From 2d44b8bb61e3e5265ac18b36b32f9f81fd506328 Mon Sep 17 00:00:00 2001 From: Bhavana Bellamgari Date: Wed, 10 Dec 2025 12:46:54 +0530 Subject: [PATCH 01/13] feat(IAM Policy Management): Updated role template references changes and test cases Signed-off-by: Bhavana Bellamgari --- .../v1/IamPolicyManagementExamples.java | 84 +++++- .../v1/IamPolicyManagement.java | 8 +- .../v1/model/CreateRoleTemplateOptions.java | 8 +- .../CreateRoleTemplateVersionOptions.java | 58 ++--- .../v1/model/ErrorResponse.java | 66 ----- .../PolicyAssignmentResourcesPolicy.java | 4 +- .../model/ReplacePolicyTemplateOptions.java | 4 +- .../v1/model/ReplaceRoleTemplateOptions.java | 58 ++--- .../model/RoleAssignmentResourceCreated.java | 2 +- .../v1/model/RoleAssignmentResourceRole.java | 2 +- .../v1/model/RoleTemplate.java | 4 +- .../v1/model/RoleTemplatePrototypeRole.java | 239 ++++++++++++++++++ .../v1/model/RoleTemplateReferencesItem.java | 134 ++++++++++ .../v1/model/TemplateControl.java | 104 ++++++++ .../v1/model/TemplateGrant.java | 158 ++++++++++++ .../v1/model/TemplatePolicy.java | 8 +- .../v1/model/TemplateRole.java | 36 +-- .../v1/IamPolicyManagementIT.java | 108 ++++++-- .../v1/IamPolicyManagementTest.java | 103 +++++--- .../CreatePolicyTemplateOptionsTest.java | 28 +- ...reatePolicyTemplateVersionOptionsTest.java | 28 +- .../model/CreateRoleTemplateOptionsTest.java | 18 +- .../CreateRoleTemplateVersionOptionsTest.java | 6 +- ...PolcyTemplateAssignmentCollectionTest.java | 2 +- .../v1/model/PolicyAssignmentRecordTest.java | 2 +- .../PolicyAssignmentResourcesPolicyTest.java | 2 +- .../model/PolicyTemplateCollectionTest.java | 5 +- .../v1/model/PolicyTemplateLimitDataTest.java | 5 +- .../v1/model/PolicyTemplateTest.java | 5 +- .../PolicyTemplateVersionsCollectionTest.java | 5 +- .../ReplacePolicyTemplateOptionsTest.java | 28 +- .../model/ReplaceRoleTemplateOptionsTest.java | 6 +- .../v1/model/RoleTemplateCollectionTest.java | 2 +- .../model/RoleTemplatePrototypeRoleTest.java | 62 +++++ .../model/RoleTemplateReferencesItemTest.java | 54 ++++ .../v1/model/RoleTemplateTest.java | 2 +- .../RoleTemplateVersionsCollectionTest.java | 2 +- .../v1/model/TemplateControlTest.java | 73 ++++++ .../v1/model/TemplateGrantTest.java | 60 +++++ .../v1/model/TemplatePolicyTest.java | 30 ++- .../v1/model/TemplateRoleTest.java | 3 - 41 files changed, 1292 insertions(+), 324 deletions(-) delete mode 100644 modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorResponse.java create mode 100644 modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java create mode 100644 modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java create mode 100644 modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java create mode 100644 modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java create mode 100644 modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java create mode 100644 modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java create mode 100644 modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java create mode 100644 modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java diff --git a/modules/examples/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementExamples.java b/modules/examples/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementExamples.java index e8c836dee35..90501dd0b23 100644 --- a/modules/examples/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementExamples.java +++ b/modules/examples/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementExamples.java @@ -135,6 +135,9 @@ import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; import com.ibm.cloud.sdk.core.http.Response; import com.ibm.cloud.sdk.core.service.exception.ServiceResponseException; @@ -197,6 +200,7 @@ protected IamPolicyManagementExamples() { } private static String exampleRoleTemplateVersion = null; private static String exampleRoleTemplateAssignmentId = null; private static String exampleRoleTemplateAssignmentETag = null; + private static String exampleRolePolicyTemplateId = null; static { System.setProperty("IBM_CREDENTIALS_FILE", "../../iam_policy_management.env"); @@ -809,10 +813,10 @@ public static void main(String[] args) throws Exception { Roles rolesModel = new Roles.Builder() .roleId("crn:v1:bluemix:public:iam::::serviceRole:Writer") .build(); - Grant grantModel = new Grant.Builder() + TemplateGrant grantModel = new TemplateGrant.Builder() .roles(java.util.Arrays.asList(rolesModel)) .build(); - Control controlModel = new Control.Builder() + TemplateControl controlModel = new TemplateControl.Builder() .grant(grantModel) .build(); V2PolicySubjectAttribute subjectAttributeService = new V2PolicySubjectAttribute.Builder() @@ -883,10 +887,10 @@ public static void main(String[] args) throws Exception { Roles rolesModel = new Roles.Builder() .roleId("crn:v1:bluemix:public:iam::::serviceRole:Reader") .build(); - Grant grantModel = new Grant.Builder() + TemplateGrant grantModel = new TemplateGrant.Builder() .roles(java.util.Arrays.asList(rolesModel)) .build(); - Control controlModel = new Control.Builder() + TemplateControl controlModel = new TemplateControl.Builder() .grant(grantModel) .build(); V2PolicySubjectAttribute subjectAttributeService = new V2PolicySubjectAttribute.Builder() @@ -951,10 +955,10 @@ public static void main(String[] args) throws Exception { Roles rolesModel = new Roles.Builder() .roleId("crn:v1:bluemix:public:iam::::role:Viewer") .build(); - Grant grantModel = new Grant.Builder() + TemplateGrant grantModel = new TemplateGrant.Builder() .roles(java.util.Arrays.asList(rolesModel)) .build(); - Control controlModel = new Control.Builder() + TemplateControl controlModel = new TemplateControl.Builder() .grant(grantModel) .build(); V2PolicySubjectAttribute subjectAttributeService = new V2PolicySubjectAttribute.Builder() @@ -1580,6 +1584,55 @@ public static void main(String[] args) throws Exception { e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); } + try { + System.out.println("createRolePolicyTemplate() result:"); + // begin-create_policy_template + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("serviceName") + .value("am-test-service") + .operator("stringEquals") + .build(); + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .build(); + Roles rolesModel = new Roles.Builder() + .roleId("crn:v1:bluemix:public:iam::::role:Viewer") + .build(); + RoleTemplateReferencesItem roleTemplateReferencesModel = new RoleTemplateReferencesItem.Builder() + .id(exampleRoleTemplateId) + .version(exampleRoleTemplateVersion) + .build(); + TemplateGrant grantModel = new TemplateGrant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .roleTemplateReferences(java.util.Arrays.asList(roleTemplateReferencesModel)) + .build(); + TemplateControl controlModel = new TemplateControl.Builder() + .grant(grantModel) + .build(); + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .resource(v2PolicyResourceModel) + .control(controlModel) + .build(); + CreatePolicyTemplateOptions createPolicyTemplateOptions = new CreatePolicyTemplateOptions.Builder() + .name("SDKRolePTExamplesTest") + .accountId(exampleAccountId) + .policy(templatePolicyModel) + .build(); + + Response response = service.createPolicyTemplate(createPolicyTemplateOptions).execute(); + PolicyTemplateLimitData policyTemplate = response.getResult(); + + exampleRolePolicyTemplateId = policyTemplate.getId(); + + System.out.println(policyTemplate); + // end-create_role_policy_template + + } 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("getRoleTemplate() result:"); // begin-get_role_template @@ -1603,9 +1656,7 @@ public static void main(String[] args) throws Exception { System.out.println("replaceRoleTemplate() result:"); // begin-replace_role_template TemplateRole templateRoleModel = new TemplateRole.Builder() - .name("SDKTestRoleTemplateRep") .displayName("SDKTestRoleTemplateRep") - .serviceName("am-test-service") .actions(java.util.Arrays.asList("am-test-service.test.create")) .build(); ReplaceRoleTemplateOptions replaceRoleTemplateOptions = new ReplaceRoleTemplateOptions.Builder() @@ -1651,9 +1702,7 @@ public static void main(String[] args) throws Exception { System.out.println("createRoleTemplateVersion() result:"); // begin-create_role_template_version TemplateRole templateRoleModel = new TemplateRole.Builder() - .name("SDKTestRoleVersion") .displayName("SDKTestRoleVersionDisp") - .serviceName("am-test-service") .description("am-test-service versioon customRole") .actions(java.util.Arrays.asList("am-test-service.test.create")) .build(); @@ -1833,6 +1882,21 @@ public static void main(String[] args) throws Exception { logger.error(String.format("Service returned status code %s: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); } + + try { + // begin-delete_role_policy_template + DeletePolicyTemplateOptions deletePolicyTemplateOptions = new DeletePolicyTemplateOptions.Builder() + .policyTemplateId(exampleRolePolicyTemplateId) + .build(); + + Response response = service.deletePolicyTemplate(deletePolicyTemplateOptions).execute(); + // end-delete_role_policy_template + System.out.printf("deleteRolePolicyTemplate() response status code: %d%n", response.getStatusCode()); + } catch (ServiceResponseException e) { + logger.error(String.format("Service returned status code %s: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); + } + try { // begin-delete_role_template_version DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptions = new DeleteRoleTemplateVersionOptions.Builder() diff --git a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java index 23449c10169..2abe3baea4e 100644 --- a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java +++ b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java @@ -2252,13 +2252,15 @@ public ServiceCall createRoleTemplateVersion(CreateRoleTemplateVer } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); - contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateVersionOptions.role())); if (createRoleTemplateVersionOptions.name() != null) { contentJson.addProperty("name", createRoleTemplateVersionOptions.name()); } if (createRoleTemplateVersionOptions.description() != null) { contentJson.addProperty("description", createRoleTemplateVersionOptions.description()); } + if (createRoleTemplateVersionOptions.role() != null) { + contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateVersionOptions.role())); + } if (createRoleTemplateVersionOptions.committed() != null) { contentJson.addProperty("committed", createRoleTemplateVersionOptions.committed()); } @@ -2323,13 +2325,15 @@ public ServiceCall replaceRoleTemplate(ReplaceRoleTemplateOptions builder.header("Accept", "application/json"); builder.header("If-Match", replaceRoleTemplateOptions.ifMatch()); final JsonObject contentJson = new JsonObject(); - contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRoleTemplateOptions.role())); if (replaceRoleTemplateOptions.name() != null) { contentJson.addProperty("name", replaceRoleTemplateOptions.name()); } if (replaceRoleTemplateOptions.description() != null) { contentJson.addProperty("description", replaceRoleTemplateOptions.description()); } + if (replaceRoleTemplateOptions.role() != null) { + contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRoleTemplateOptions.role())); + } if (replaceRoleTemplateOptions.committed() != null) { contentJson.addProperty("committed", replaceRoleTemplateOptions.committed()); } diff --git a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java index 35183eb3313..baf82e17961 100644 --- a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java +++ b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java @@ -24,7 +24,7 @@ public class CreateRoleTemplateOptions extends GenericModel { protected String accountId; protected String description; protected Boolean committed; - protected TemplateRole role; + protected RoleTemplatePrototypeRole role; protected String acceptLanguage; /** @@ -35,7 +35,7 @@ public static class Builder { private String accountId; private String description; private Boolean committed; - private TemplateRole role; + private RoleTemplatePrototypeRole role; private String acceptLanguage; /** @@ -128,7 +128,7 @@ public Builder committed(Boolean committed) { * @param role the role * @return the CreateRoleTemplateOptions builder */ - public Builder role(TemplateRole role) { + public Builder role(RoleTemplatePrototypeRole role) { this.role = role; return this; } @@ -222,7 +222,7 @@ public Boolean committed() { * * @return the role */ - public TemplateRole role() { + public RoleTemplatePrototypeRole role() { return role; } diff --git a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java index dafc10e913b..c322c5a332d 100644 --- a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java +++ b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java @@ -21,9 +21,9 @@ public class CreateRoleTemplateVersionOptions extends GenericModel { protected String roleTemplateId; - protected TemplateRole role; protected String name; protected String description; + protected TemplateRole role; protected Boolean committed; /** @@ -31,9 +31,9 @@ public class CreateRoleTemplateVersionOptions extends GenericModel { */ public static class Builder { private String roleTemplateId; - private TemplateRole role; private String name; private String description; + private TemplateRole role; private Boolean committed; /** @@ -43,9 +43,9 @@ public static class Builder { */ private Builder(CreateRoleTemplateVersionOptions createRoleTemplateVersionOptions) { this.roleTemplateId = createRoleTemplateVersionOptions.roleTemplateId; - this.role = createRoleTemplateVersionOptions.role; this.name = createRoleTemplateVersionOptions.name; this.description = createRoleTemplateVersionOptions.description; + this.role = createRoleTemplateVersionOptions.role; this.committed = createRoleTemplateVersionOptions.committed; } @@ -59,11 +59,9 @@ public Builder() { * Instantiates a new builder with required properties. * * @param roleTemplateId the roleTemplateId - * @param role the role */ - public Builder(String roleTemplateId, TemplateRole role) { + public Builder(String roleTemplateId) { this.roleTemplateId = roleTemplateId; - this.role = role; } /** @@ -86,17 +84,6 @@ public Builder roleTemplateId(String roleTemplateId) { return this; } - /** - * Set the role. - * - * @param role the role - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder role(TemplateRole role) { - this.role = role; - return this; - } - /** * Set the name. * @@ -119,6 +106,17 @@ public Builder description(String description) { return this; } + /** + * Set the role. + * + * @param role the role + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder role(TemplateRole role) { + this.role = role; + return this; + } + /** * Set the committed. * @@ -136,12 +134,10 @@ protected CreateRoleTemplateVersionOptions() { } protected CreateRoleTemplateVersionOptions(Builder builder) { com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, "roleTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.role, - "role cannot be null"); roleTemplateId = builder.roleTemplateId; - role = builder.role; name = builder.name; description = builder.description; + role = builder.role; committed = builder.committed; } @@ -165,17 +161,6 @@ public String roleTemplateId() { return roleTemplateId; } - /** - * Gets the role. - * - * The role properties that are created in an action resource when the template is assigned. - * - * @return the role - */ - public TemplateRole role() { - return role; - } - /** * Gets the name. * @@ -200,6 +185,17 @@ public String description() { return description; } + /** + * Gets the role. + * + * The role properties that are created in an action resource when the template is assigned. + * + * @return the role + */ + public TemplateRole role() { + return role; + } + /** * Gets the committed. * diff --git a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorResponse.java b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorResponse.java deleted file mode 100644 index 4e685441188..00000000000 --- a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorResponse.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The error response from API. - */ -public class ErrorResponse extends GenericModel { - - protected String trace; - protected List errors; - @SerializedName("status_code") - protected Long statusCode; - - protected ErrorResponse() { } - - /** - * Gets the trace. - * - * The unique transaction ID for the request. - * - * @return the trace - */ - public String getTrace() { - return trace; - } - - /** - * Gets the errors. - * - * The errors encountered during the response. - * - * @return the errors - */ - public List getErrors() { - return errors; - } - - /** - * Gets the statusCode. - * - * The HTTP error code of the response. - * - * @return the statusCode - */ - public Long getStatusCode() { - return statusCode; - } -} - diff --git a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesPolicy.java b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesPolicy.java index d9a1216f5ec..d79617a0a98 100644 --- a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesPolicy.java +++ b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesPolicy.java @@ -23,7 +23,7 @@ public class PolicyAssignmentResourcesPolicy extends GenericModel { @SerializedName("resource_created") protected AssignmentResourceCreated resourceCreated; @SerializedName("error_message") - protected ErrorResponse errorMessage; + protected AssignmentResourceError errorMessage; protected PolicyAssignmentResourcesPolicy() { } @@ -45,7 +45,7 @@ public AssignmentResourceCreated getResourceCreated() { * * @return the errorMessage */ - public ErrorResponse getErrorMessage() { + public AssignmentResourceError getErrorMessage() { return errorMessage; } } diff --git a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java index 3c1347dce63..5a55c4898e5 100644 --- a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java +++ b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java @@ -217,9 +217,9 @@ public String version() { /** * Gets the ifMatch. * - * The revision number for updating a policy template version and must match the ETag value of the existing policy + * The revision number for updating a policy template version and must match the Etag value of the existing policy * template version. The Etag can be retrieved using the GET - * /v1/policy_templates/{policy_template_id}/versions/{version} API and looking at the ETag response header. + * /v1/policy_templates/{policy_template_id}/versions/{version} API and looking at the Etag response header. * * @return the ifMatch */ diff --git a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java index ed017c6502e..9a69b13326c 100644 --- a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java +++ b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java @@ -23,9 +23,9 @@ public class ReplaceRoleTemplateOptions extends GenericModel { protected String roleTemplateId; protected String version; protected String ifMatch; - protected TemplateRole role; protected String name; protected String description; + protected TemplateRole role; protected Boolean committed; /** @@ -35,9 +35,9 @@ public static class Builder { private String roleTemplateId; private String version; private String ifMatch; - private TemplateRole role; private String name; private String description; + private TemplateRole role; private Boolean committed; /** @@ -49,9 +49,9 @@ private Builder(ReplaceRoleTemplateOptions replaceRoleTemplateOptions) { this.roleTemplateId = replaceRoleTemplateOptions.roleTemplateId; this.version = replaceRoleTemplateOptions.version; this.ifMatch = replaceRoleTemplateOptions.ifMatch; - this.role = replaceRoleTemplateOptions.role; this.name = replaceRoleTemplateOptions.name; this.description = replaceRoleTemplateOptions.description; + this.role = replaceRoleTemplateOptions.role; this.committed = replaceRoleTemplateOptions.committed; } @@ -67,13 +67,11 @@ public Builder() { * @param roleTemplateId the roleTemplateId * @param version the version * @param ifMatch the ifMatch - * @param role the role */ - public Builder(String roleTemplateId, String version, String ifMatch, TemplateRole role) { + public Builder(String roleTemplateId, String version, String ifMatch) { this.roleTemplateId = roleTemplateId; this.version = version; this.ifMatch = ifMatch; - this.role = role; } /** @@ -118,17 +116,6 @@ public Builder ifMatch(String ifMatch) { return this; } - /** - * Set the role. - * - * @param role the role - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder role(TemplateRole role) { - this.role = role; - return this; - } - /** * Set the name. * @@ -151,6 +138,17 @@ public Builder description(String description) { return this; } + /** + * Set the role. + * + * @param role the role + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder role(TemplateRole role) { + this.role = role; + return this; + } + /** * Set the committed. * @@ -172,14 +170,12 @@ protected ReplaceRoleTemplateOptions(Builder builder) { "version 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.role, - "role cannot be null"); roleTemplateId = builder.roleTemplateId; version = builder.version; ifMatch = builder.ifMatch; - role = builder.role; name = builder.name; description = builder.description; + role = builder.role; committed = builder.committed; } @@ -227,17 +223,6 @@ public String ifMatch() { return ifMatch; } - /** - * Gets the role. - * - * The role properties that are created in an action resource when the template is assigned. - * - * @return the role - */ - public TemplateRole role() { - return role; - } - /** * Gets the name. * @@ -262,6 +247,17 @@ public String description() { return description; } + /** + * Gets the role. + * + * The role properties that are created in an action resource when the template is assigned. + * + * @return the role + */ + public TemplateRole role() { + return role; + } + /** * Gets the committed. * diff --git a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java index e83347c984e..9ea359d63fb 100644 --- a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java +++ b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java @@ -16,7 +16,7 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** - * On success, it includes the action control assigned. + * On success, it includes the role assigned. */ public class RoleAssignmentResourceCreated extends GenericModel { diff --git a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java index 95358784dd0..22d40bdaef4 100644 --- a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java +++ b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java @@ -31,7 +31,7 @@ protected RoleAssignmentResourceRole() { } /** * Gets the resourceCreated. * - * On success, it includes the action control assigned. + * On success, it includes the role assigned. * * @return the resourceCreated */ diff --git a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java index 49127d6035e..663d0f7f1d0 100644 --- a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java +++ b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java @@ -38,7 +38,7 @@ public interface State { @SerializedName("account_id") protected String accountId; protected Boolean committed; - protected TemplateRole role; + protected RoleTemplatePrototypeRole role; protected String id; protected String href; @SerializedName("created_at") @@ -107,7 +107,7 @@ public Boolean isCommitted() { * * @return the role */ - public TemplateRole getRole() { + public RoleTemplatePrototypeRole getRole() { return role; } diff --git a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java new file mode 100644 index 00000000000..43197620689 --- /dev/null +++ b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java @@ -0,0 +1,239 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The role properties that are created in an action resource when the template is assigned. + */ +public class RoleTemplatePrototypeRole extends GenericModel { + + protected String name; + @SerializedName("display_name") + protected String displayName; + @SerializedName("service_name") + protected String serviceName; + protected String description; + protected List actions; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String displayName; + private String serviceName; + private String description; + private List actions; + + /** + * Instantiates a new Builder from an existing RoleTemplatePrototypeRole instance. + * + * @param roleTemplatePrototypeRole the instance to initialize the Builder with + */ + private Builder(RoleTemplatePrototypeRole roleTemplatePrototypeRole) { + this.name = roleTemplatePrototypeRole.name; + this.displayName = roleTemplatePrototypeRole.displayName; + this.serviceName = roleTemplatePrototypeRole.serviceName; + this.description = roleTemplatePrototypeRole.description; + this.actions = roleTemplatePrototypeRole.actions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param displayName the displayName + * @param actions the actions + */ + public Builder(String name, String displayName, List actions) { + this.name = name; + this.displayName = displayName; + this.actions = actions; + } + + /** + * Builds a RoleTemplatePrototypeRole. + * + * @return the new RoleTemplatePrototypeRole instance + */ + public RoleTemplatePrototypeRole build() { + return new RoleTemplatePrototypeRole(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the RoleTemplatePrototypeRole builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the RoleTemplatePrototypeRole builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the RoleTemplatePrototypeRole builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the RoleTemplatePrototypeRole builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the RoleTemplatePrototypeRole builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the RoleTemplatePrototypeRole builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + } + + protected RoleTemplatePrototypeRole() { } + + protected RoleTemplatePrototypeRole(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + name = builder.name; + displayName = builder.displayName; + serviceName = builder.serviceName; + description = builder.description; + actions = builder.actions; + } + + /** + * New builder. + * + * @return a RoleTemplatePrototypeRole builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the serviceName. + * + * The service name that the role refers. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the description. + * + * Description of the role. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. + * + * @return the actions + */ + public List actions() { + return actions; + } +} + diff --git a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java new file mode 100644 index 00000000000..673ff7f9750 --- /dev/null +++ b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role template reference associated with a policy template. + */ +public class RoleTemplateReferencesItem extends GenericModel { + + protected String id; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String version; + + /** + * Instantiates a new Builder from an existing RoleTemplateReferencesItem instance. + * + * @param roleTemplateReferencesItem the instance to initialize the Builder with + */ + private Builder(RoleTemplateReferencesItem roleTemplateReferencesItem) { + this.id = roleTemplateReferencesItem.id; + this.version = roleTemplateReferencesItem.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + * @param version the version + */ + public Builder(String id, String version) { + this.id = id; + this.version = version; + } + + /** + * Builds a RoleTemplateReferencesItem. + * + * @return the new RoleTemplateReferencesItem instance + */ + public RoleTemplateReferencesItem build() { + return new RoleTemplateReferencesItem(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the RoleTemplateReferencesItem builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the RoleTemplateReferencesItem builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected RoleTemplateReferencesItem() { } + + protected RoleTemplateReferencesItem(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, + "id cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + id = builder.id; + version = builder.version; + } + + /** + * New builder. + * + * @return a RoleTemplateReferencesItem builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The role template ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the version. + * + * Role template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java new file mode 100644 index 00000000000..c74a77d9b6d --- /dev/null +++ b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Specifies the type of access that is granted by the policy. + */ +public class TemplateControl extends GenericModel { + + protected TemplateGrant grant; + + /** + * Builder. + */ + public static class Builder { + private TemplateGrant grant; + + /** + * Instantiates a new Builder from an existing TemplateControl instance. + * + * @param templateControl the instance to initialize the Builder with + */ + private Builder(TemplateControl templateControl) { + this.grant = templateControl.grant; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param grant the grant + */ + public Builder(TemplateGrant grant) { + this.grant = grant; + } + + /** + * Builds a TemplateControl. + * + * @return the new TemplateControl instance + */ + public TemplateControl build() { + return new TemplateControl(this); + } + + /** + * Set the grant. + * + * @param grant the grant + * @return the TemplateControl builder + */ + public Builder grant(TemplateGrant grant) { + this.grant = grant; + return this; + } + } + + protected TemplateControl() { } + + protected TemplateControl(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.grant, + "grant cannot be null"); + grant = builder.grant; + } + + /** + * New builder. + * + * @return a TemplateControl builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the grant. + * + * Permission is granted by the policy. + * + * @return the grant + */ + public TemplateGrant grant() { + return grant; + } +} + diff --git a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java new file mode 100644 index 00000000000..b64b7bc8aca --- /dev/null +++ b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java @@ -0,0 +1,158 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Permission is granted by the policy. + */ +public class TemplateGrant extends GenericModel { + + protected List roles; + @SerializedName("role_template_references") + protected List roleTemplateReferences; + + /** + * Builder. + */ + public static class Builder { + private List roles; + private List roleTemplateReferences; + + /** + * Instantiates a new Builder from an existing TemplateGrant instance. + * + * @param templateGrant the instance to initialize the Builder with + */ + private Builder(TemplateGrant templateGrant) { + this.roles = templateGrant.roles; + this.roleTemplateReferences = templateGrant.roleTemplateReferences; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a TemplateGrant. + * + * @return the new TemplateGrant instance + */ + public TemplateGrant build() { + return new TemplateGrant(this); + } + + /** + * Adds a new element to roles. + * + * @param roles the new element to be added + * @return the TemplateGrant builder + */ + public Builder addRoles(Roles roles) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roles, + "roles cannot be null"); + if (this.roles == null) { + this.roles = new ArrayList(); + } + this.roles.add(roles); + return this; + } + + /** + * Adds a new element to roleTemplateReferences. + * + * @param roleTemplateReferences the new element to be added + * @return the TemplateGrant builder + */ + public Builder addRoleTemplateReferences(RoleTemplateReferencesItem roleTemplateReferences) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roleTemplateReferences, + "roleTemplateReferences cannot be null"); + if (this.roleTemplateReferences == null) { + this.roleTemplateReferences = new ArrayList(); + } + this.roleTemplateReferences.add(roleTemplateReferences); + return this; + } + + /** + * Set the roles. + * Existing roles will be replaced. + * + * @param roles the roles + * @return the TemplateGrant builder + */ + public Builder roles(List roles) { + this.roles = roles; + return this; + } + + /** + * Set the roleTemplateReferences. + * Existing roleTemplateReferences will be replaced. + * + * @param roleTemplateReferences the roleTemplateReferences + * @return the TemplateGrant builder + */ + public Builder roleTemplateReferences(List roleTemplateReferences) { + this.roleTemplateReferences = roleTemplateReferences; + return this; + } + } + + protected TemplateGrant() { } + + protected TemplateGrant(Builder builder) { + roles = builder.roles; + roleTemplateReferences = builder.roleTemplateReferences; + } + + /** + * New builder. + * + * @return a TemplateGrant builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List roles() { + return roles; + } + + /** + * Gets the roleTemplateReferences. + * + * A set of role template reference IDs granted by the policy. + * + * @return the roleTemplateReferences + */ + public List roleTemplateReferences() { + return roleTemplateReferences; + } +} + diff --git a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java index 9da1751c580..496b2e70e40 100644 --- a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java +++ b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java @@ -36,7 +36,7 @@ public interface Type { protected V2PolicySubject subject; protected String pattern; protected V2PolicyRule rule; - protected Control control; + protected TemplateControl control; /** * Builder. @@ -48,7 +48,7 @@ public static class Builder { private V2PolicySubject subject; private String pattern; private V2PolicyRule rule; - private Control control; + private TemplateControl control; /** * Instantiates a new Builder from an existing TemplatePolicy instance. @@ -161,7 +161,7 @@ public Builder rule(V2PolicyRule rule) { * @param control the control * @return the TemplatePolicy builder */ - public Builder control(Control control) { + public Builder control(TemplateControl control) { this.control = control; return this; } @@ -265,7 +265,7 @@ public V2PolicyRule rule() { * * @return the control */ - public Control control() { + public TemplateControl control() { return control; } } diff --git a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java index c6c41a49874..b76beb3bddb 100644 --- a/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java +++ b/modules/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java @@ -24,7 +24,6 @@ */ public class TemplateRole extends GenericModel { - protected String name; @SerializedName("display_name") protected String displayName; @SerializedName("service_name") @@ -36,7 +35,6 @@ public class TemplateRole extends GenericModel { * Builder. */ public static class Builder { - private String name; private String displayName; private String serviceName; private String description; @@ -48,7 +46,6 @@ public static class Builder { * @param templateRole the instance to initialize the Builder with */ private Builder(TemplateRole templateRole) { - this.name = templateRole.name; this.displayName = templateRole.displayName; this.serviceName = templateRole.serviceName; this.description = templateRole.description; @@ -64,15 +61,11 @@ public Builder() { /** * Instantiates a new builder with required properties. * - * @param name the name * @param displayName the displayName - * @param serviceName the serviceName * @param actions the actions */ - public Builder(String name, String displayName, String serviceName, List actions) { - this.name = name; + public Builder(String displayName, List actions) { this.displayName = displayName; - this.serviceName = serviceName; this.actions = actions; } @@ -101,17 +94,6 @@ public Builder addActions(String actions) { return this; } - /** - * Set the name. - * - * @param name the name - * @return the TemplateRole builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - /** * Set the displayName. * @@ -161,15 +143,10 @@ public Builder actions(List actions) { protected TemplateRole() { } protected TemplateRole(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, - "serviceName cannot be null"); com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, "actions cannot be null"); - name = builder.name; displayName = builder.displayName; serviceName = builder.serviceName; description = builder.description; @@ -185,17 +162,6 @@ public Builder newBuilder() { return new Builder(this); } - /** - * Gets the name. - * - * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. - * - * @return the name - */ - public String name() { - return name; - } - /** * Gets the displayName. * diff --git a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementIT.java b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementIT.java index 6553893d23d..6dafac20c33 100644 --- a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementIT.java +++ b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementIT.java @@ -99,10 +99,12 @@ public class IamPolicyManagementIT extends SdkIntegrationTestBase { String testActionControlAssignmentId = null; String testActionControlAssignmentETag = null; String testRoleTemplateId = null; + String testRoleBaseTemplateVersion = null; String testRoleTemplateVersion = null; String testRoleTemplateEtag = null; String testRoleTemplateAssignmentId = null; String testRoleTemplateAssignmentETag = null; + String testRolePolicyTemplateId = null; @Override public String getConfigFilename() { @@ -741,11 +743,11 @@ public void testCreatePolicyTemplate() throws Exception { .roleId(TEST_VIEW_ROLE_CRN) .build(); - Grant policyGrantModel = new Grant.Builder() + TemplateGrant policyGrantModel = new TemplateGrant.Builder() .roles(Arrays.asList(rolesModel)) .build(); - Control controlModel = new Control.Builder() + TemplateControl controlModel = new TemplateControl.Builder() .grant(policyGrantModel) .build(); @@ -815,11 +817,11 @@ public void testReplacePolicyTemplate() { .roleId(TEST_EDITOR_ROLE_CRN) .build(); - Grant policyGrantModel = new Grant.Builder() + TemplateGrant policyGrantModel = new TemplateGrant.Builder() .roles(Arrays.asList(rolesModel)) .build(); - Control controlModel = new Control.Builder() + TemplateControl controlModel = new TemplateControl.Builder() .grant(policyGrantModel) .build(); @@ -896,11 +898,11 @@ public void testCreatePolicyTemplateVersion() { .roleId(TEST_VIEW_ROLE_CRN) .build(); - Grant policyGrantModel = new Grant.Builder() + TemplateGrant policyGrantModel = new TemplateGrant.Builder() .roles(Arrays.asList(rolesModel)) .build(); - Control controlModel = new Control.Builder() + TemplateControl controlModel = new TemplateControl.Builder() .grant(policyGrantModel) .build(); @@ -994,11 +996,11 @@ public void testCommitPolicyTemplate() { .roleId(TEST_EDITOR_ROLE_CRN) .build(); - Grant policyGrantModel = new Grant.Builder() + TemplateGrant policyGrantModel = new TemplateGrant.Builder() .roles(Arrays.asList(rolesModel)) .build(); - Control controlModel = new Control.Builder() + TemplateControl controlModel = new TemplateControl.Builder() .grant(policyGrantModel) .build(); @@ -1082,11 +1084,11 @@ public void testCreateS2SPolicyTemplate() throws Exception { .roleId("crn:v1:bluemix:public:iam::::serviceRole:Writer") .build(); - Grant policyGrantModel = new Grant.Builder() + TemplateGrant policyGrantModel = new TemplateGrant.Builder() .roles(Arrays.asList(rolesModel)) .build(); - Control controlModel = new Control.Builder() + TemplateControl controlModel = new TemplateControl.Builder() .grant(policyGrantModel) .build(); @@ -1147,11 +1149,11 @@ public void testCreatePolicyS2STemplateVersion() { .roleId("crn:v1:bluemix:public:iam::::serviceRole:Reader") .build(); - Grant policyGrantModel = new Grant.Builder() + TemplateGrant policyGrantModel = new TemplateGrant.Builder() .roles(Arrays.asList(rolesModel)) .build(); - Control controlModel = new Control.Builder() + TemplateControl controlModel = new TemplateControl.Builder() .grant(policyGrantModel) .build(); @@ -1730,12 +1732,12 @@ public void testDeleteActionControlTemplate() { /* Role Template Integration Tests - Start */ @Test public void testCreateRoleTemplate() throws Exception { - TemplateRole templateRoleModel = new TemplateRole.Builder() + RoleTemplatePrototypeRole templateRoleModel = new RoleTemplatePrototypeRole.Builder() .name(testCustomRoleName) .displayName(testCustomRoleDisplayName) - .serviceName(TEST_SERVICE_NAME) + .serviceName("am-test-service") .description(testCustomRoleDescription) - .actions(testCustomRoleActions) + .actions(java.util.Arrays.asList("am-test-service.test.create")) .build(); CreateRoleTemplateOptions createRoleTemplateOptions = new CreateRoleTemplateOptions.Builder() @@ -1755,9 +1757,66 @@ public void testCreateRoleTemplate() throws Exception { RoleTemplate roleTemplateResult = response.getResult(); testRoleTemplateId = roleTemplateResult.getId(); + testRoleBaseTemplateVersion = roleTemplateResult.getVersion(); assertNotNull(roleTemplateResult); } + @Test(dependsOnMethods = { "testCreateRoleTemplate" }) + public void testCreateRolePolicyTemplate() throws Exception { + V2PolicyResourceAttribute resourceAttributeService = new V2PolicyResourceAttribute.Builder() + .key("serviceName") + .value("am-test-service") + .operator("stringEquals") + .build(); + + Roles rolesModel = new Roles.Builder() + .roleId(TEST_VIEW_ROLE_CRN) + .build(); + + RoleTemplateReferencesItem roleTemplateReferencesModel = new RoleTemplateReferencesItem.Builder() + .id(testRoleTemplateId) + .version(testRoleBaseTemplateVersion) + .build(); + + TemplateGrant policyGrantModel = new TemplateGrant.Builder() + .roles(Arrays.asList(rolesModel)) + .roleTemplateReferences(Arrays.asList(roleTemplateReferencesModel)) + .build(); + + TemplateControl controlModel = new TemplateControl.Builder() + .grant(policyGrantModel) + .build(); + + V2PolicyResource policyResourceModel = new V2PolicyResource.Builder() + .attributes(new ArrayList(Arrays.asList(resourceAttributeService))) + .build(); + + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type(POLICY_TYPE) + .description("SDK Test Policy") + .resource(policyResourceModel) + .control(controlModel) + .build(); + + CreatePolicyTemplateOptions createPolicyTemplateOptions = new CreatePolicyTemplateOptions.Builder() + .name("SDKJavaRolePolicyTemplate" + TEST_UNIQUE_ID) + .accountId(testAccountId) + .policy(templatePolicyModel) + .description("SDK Test template with viewer role") + .build(); + + Response response = service.createPolicyTemplate(createPolicyTemplateOptions).execute(); + assertNotNull(response); + assertEquals(response.getStatusCode(), 201); + + PolicyTemplateLimitData result = response.getResult(); + + assertNotNull(result); + assertEquals(result.getPolicy(), templatePolicyModel); + testRolePolicyTemplateId = result.getId(); + assertEquals(result.getState(), "active"); + } + @Test(dependsOnMethods = { "testCreateRoleTemplate" }) public void testGetRoleTemplate() throws Exception { GetRoleTemplateOptions getRoleTemplateOptions = new GetRoleTemplateOptions.Builder() @@ -1772,7 +1831,6 @@ public void testGetRoleTemplate() throws Exception { assertEquals(response.getStatusCode(), 200); RoleTemplate roleTemplateResult = response.getResult(); - testActionControlBaseTemplateVersion = roleTemplateResult.getVersion(); assertNotNull(roleTemplateResult); List values = response.getHeaders().values(HEADER_ETAG); assertNotNull(values); @@ -1799,9 +1857,7 @@ public void testListRoleTemplates() throws Exception { @Test(dependsOnMethods = { "testListRoleTemplates" }) public void testCreateRoleTemplateVersion() throws Exception { TemplateRole templateRoleModel = new TemplateRole.Builder() - .name("SDKTestRoleVersion") .displayName("SDKTestRoleVersionDisp") - .serviceName("am-test-service") .description("am-test-service versioon customRole") .actions(java.util.Arrays.asList("am-test-service.test.delete")) .build(); @@ -1850,11 +1906,9 @@ public void testListRoleTemplateVersions() throws Exception { public void testReplaceRoleTemplate() throws Exception { TemplateRole templateRoleModel = new TemplateRole.Builder() .actions(java.util.Arrays.asList("testString")) - .name("SDKTestRoleVersionRep") .displayName("SDKTestRoleVersionDispRep") - .serviceName("am-test-service") .description("am-test-service versioon customRole Rep") - .actions(java.util.Arrays.asList("am-test-service.test.create")) + .actions(java.util.Arrays.asList("am-test-service.test.create", "am-test-service.test.delete")) .build(); ReplaceRoleTemplateOptions replaceRoleTemplateOptions = new ReplaceRoleTemplateOptions.Builder() @@ -1862,7 +1916,6 @@ public void testReplaceRoleTemplate() throws Exception { .version(testRoleTemplateVersion) .ifMatch(testRoleTemplateEtag) .role(templateRoleModel) - .name("TestSDKRoleTemplateRep") .description("TestSDKRoleTemplateRepDesc") .build(); @@ -2002,6 +2055,17 @@ public void testDeleteRoleAssignment() throws Exception { assertEquals(response.getStatusCode(), 204); } + @Test(dependsOnMethods = { "testCreateRolePolicyTemplate" }) + public void testDeleteRolePolicyTemplate() { + DeletePolicyTemplateOptions deletePolicyTemplateOptions = new DeletePolicyTemplateOptions.Builder() + .policyTemplateId(testRolePolicyTemplateId) + .build(); + + Response response = service.deletePolicyTemplate(deletePolicyTemplateOptions).execute(); + assertNotNull(response); + assertEquals(response.getStatusCode(), 204); + } + @Test(dependsOnMethods = { "testDeleteRoleAssignment" }) public void testDeleteRoleTemplateVersion() throws Exception { DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptions = new DeleteRoleTemplateVersionOptions.Builder() diff --git a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java index aff90b34a30..bc757c03b3c 100644 --- a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java +++ b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java @@ -150,6 +150,8 @@ import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsPager; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatesPager; @@ -157,7 +159,9 @@ import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; @@ -1479,7 +1483,7 @@ public void testDeleteV2PolicyNoOptions() throws Throwable { @Test public void testListPolicyTemplatesWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policy_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policy_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}], \"role_template_references\": [{\"id\": \"id\", \"version\": \"version\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; String listPolicyTemplatesPath = "/v1/policy_templates"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -1548,8 +1552,8 @@ public void testListPolicyTemplatesNoOptions() throws Throwable { @Test public void testListPolicyTemplatesWithPagerGetNext() throws Throwable { // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}],\"role_template_references\":[{\"id\":\"id\",\"version\":\"version\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}],\"role_template_references\":[{\"id\":\"id\",\"version\":\"version\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -1589,8 +1593,8 @@ public void testListPolicyTemplatesWithPagerGetNext() throws Throwable { @Test public void testListPolicyTemplatesWithPagerGetAll() throws Throwable { // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}],\"role_template_references\":[{\"id\":\"id\",\"version\":\"version\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}],\"role_template_references\":[{\"id\":\"id\",\"version\":\"version\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -1626,7 +1630,7 @@ public void testListPolicyTemplatesWithPagerGetAll() throws Throwable { @Test public void testCreatePolicyTemplateWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}], \"role_template_references\": [{\"id\": \"id\", \"version\": \"version\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; String createPolicyTemplatePath = "/v1/policy_templates"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -1677,14 +1681,21 @@ public void testCreatePolicyTemplateWOptions() throws Throwable { .roleId("testString") .build(); - // Construct an instance of the Grant model - Grant grantModel = new Grant.Builder() + // Construct an instance of the RoleTemplateReferencesItem model + RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() + .id("testString") + .version("testString") + .build(); + + // Construct an instance of the TemplateGrant model + TemplateGrant templateGrantModel = new TemplateGrant.Builder() .roles(java.util.Arrays.asList(rolesModel)) + .roleTemplateReferences(java.util.Arrays.asList(roleTemplateReferencesItemModel)) .build(); - // Construct an instance of the Control model - Control controlModel = new Control.Builder() - .grant(grantModel) + // Construct an instance of the TemplateControl model + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) .build(); // Construct an instance of the TemplatePolicy model @@ -1695,7 +1706,7 @@ public void testCreatePolicyTemplateWOptions() throws Throwable { .subject(v2PolicySubjectModel) .pattern("testString") .rule(v2PolicyRuleModel) - .control(controlModel) + .control(templateControlModel) .build(); // Construct an instance of the CreatePolicyTemplateOptions model @@ -1747,7 +1758,7 @@ public void testCreatePolicyTemplateNoOptions() throws Throwable { @Test public void testGetPolicyTemplateWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}], \"role_template_references\": [{\"id\": \"id\", \"version\": \"version\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; String getPolicyTemplatePath = "/v1/policy_templates/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -1850,7 +1861,7 @@ public void testDeletePolicyTemplateNoOptions() throws Throwable { @Test public void testCreatePolicyTemplateVersionWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}], \"role_template_references\": [{\"id\": \"id\", \"version\": \"version\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; String createPolicyTemplateVersionPath = "/v1/policy_templates/testString/versions"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -1901,14 +1912,21 @@ public void testCreatePolicyTemplateVersionWOptions() throws Throwable { .roleId("testString") .build(); - // Construct an instance of the Grant model - Grant grantModel = new Grant.Builder() + // Construct an instance of the RoleTemplateReferencesItem model + RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() + .id("testString") + .version("testString") + .build(); + + // Construct an instance of the TemplateGrant model + TemplateGrant templateGrantModel = new TemplateGrant.Builder() .roles(java.util.Arrays.asList(rolesModel)) + .roleTemplateReferences(java.util.Arrays.asList(roleTemplateReferencesItemModel)) .build(); - // Construct an instance of the Control model - Control controlModel = new Control.Builder() - .grant(grantModel) + // Construct an instance of the TemplateControl model + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) .build(); // Construct an instance of the TemplatePolicy model @@ -1919,7 +1937,7 @@ public void testCreatePolicyTemplateVersionWOptions() throws Throwable { .subject(v2PolicySubjectModel) .pattern("testString") .rule(v2PolicyRuleModel) - .control(controlModel) + .control(templateControlModel) .build(); // Construct an instance of the CreatePolicyTemplateVersionOptions model @@ -1970,7 +1988,7 @@ public void testCreatePolicyTemplateVersionNoOptions() throws Throwable { @Test public void testListPolicyTemplateVersionsWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}], \"role_template_references\": [{\"id\": \"id\", \"version\": \"version\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; String listPolicyTemplateVersionsPath = "/v1/policy_templates/testString/versions"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -2027,8 +2045,8 @@ public void testListPolicyTemplateVersionsNoOptions() throws Throwable { @Test public void testListPolicyTemplateVersionsWithPagerGetNext() throws Throwable { // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}],\"role_template_references\":[{\"id\":\"id\",\"version\":\"version\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}],\"role_template_references\":[{\"id\":\"id\",\"version\":\"version\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -2062,8 +2080,8 @@ public void testListPolicyTemplateVersionsWithPagerGetNext() throws Throwable { @Test public void testListPolicyTemplateVersionsWithPagerGetAll() throws Throwable { // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}],\"role_template_references\":[{\"id\":\"id\",\"version\":\"version\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}],\"role_template_references\":[{\"id\":\"id\",\"version\":\"version\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -2093,7 +2111,7 @@ public void testListPolicyTemplateVersionsWithPagerGetAll() throws Throwable { @Test public void testReplacePolicyTemplateWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}], \"role_template_references\": [{\"id\": \"id\", \"version\": \"version\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; String replacePolicyTemplatePath = "/v1/policy_templates/testString/versions/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -2144,14 +2162,21 @@ public void testReplacePolicyTemplateWOptions() throws Throwable { .roleId("testString") .build(); - // Construct an instance of the Grant model - Grant grantModel = new Grant.Builder() + // Construct an instance of the RoleTemplateReferencesItem model + RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() + .id("testString") + .version("testString") + .build(); + + // Construct an instance of the TemplateGrant model + TemplateGrant templateGrantModel = new TemplateGrant.Builder() .roles(java.util.Arrays.asList(rolesModel)) + .roleTemplateReferences(java.util.Arrays.asList(roleTemplateReferencesItemModel)) .build(); - // Construct an instance of the Control model - Control controlModel = new Control.Builder() - .grant(grantModel) + // Construct an instance of the TemplateControl model + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) .build(); // Construct an instance of the TemplatePolicy model @@ -2162,7 +2187,7 @@ public void testReplacePolicyTemplateWOptions() throws Throwable { .subject(v2PolicySubjectModel) .pattern("testString") .rule(v2PolicyRuleModel) - .control(controlModel) + .control(templateControlModel) .build(); // Construct an instance of the ReplacePolicyTemplateOptions model @@ -2268,7 +2293,7 @@ public void testDeletePolicyTemplateVersionNoOptions() throws Throwable { @Test public void testGetPolicyTemplateVersionWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}], \"role_template_references\": [{\"id\": \"id\", \"version\": \"version\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; String getPolicyTemplateVersionPath = "/v1/policy_templates/testString/versions/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -4051,8 +4076,8 @@ public void testCreateRoleTemplateWOptions() throws Throwable { .setResponseCode(201) .setBody(mockResponseBody)); - // Construct an instance of the TemplateRole model - TemplateRole templateRoleModel = new TemplateRole.Builder() + // Construct an instance of the RoleTemplatePrototypeRole model + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() .name("testString") .displayName("testString") .serviceName("testString") @@ -4066,7 +4091,7 @@ public void testCreateRoleTemplateWOptions() throws Throwable { .accountId("testString") .description("testString") .committed(true) - .role(templateRoleModel) + .role(roleTemplatePrototypeRoleModel) .acceptLanguage("default") .build(); @@ -4221,7 +4246,6 @@ public void testCreateRoleTemplateVersionWOptions() throws Throwable { // Construct an instance of the TemplateRole model TemplateRole templateRoleModel = new TemplateRole.Builder() - .name("testString") .displayName("testString") .serviceName("testString") .description("testString") @@ -4231,9 +4255,9 @@ public void testCreateRoleTemplateVersionWOptions() throws Throwable { // Construct an instance of the CreateRoleTemplateVersionOptions model CreateRoleTemplateVersionOptions createRoleTemplateVersionOptionsModel = new CreateRoleTemplateVersionOptions.Builder() .roleTemplateId("testString") - .role(templateRoleModel) .name("testString") .description("testString") + .role(templateRoleModel) .committed(true) .build(); @@ -4408,7 +4432,6 @@ public void testReplaceRoleTemplateWOptions() throws Throwable { // Construct an instance of the TemplateRole model TemplateRole templateRoleModel = new TemplateRole.Builder() - .name("testString") .displayName("testString") .serviceName("testString") .description("testString") @@ -4420,9 +4443,9 @@ public void testReplaceRoleTemplateWOptions() throws Throwable { .roleTemplateId("testString") .version("testString") .ifMatch("testString") - .role(templateRoleModel) .name("testString") .description("testString") + .role(templateRoleModel) .committed(true) .build(); diff --git a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java index 8898f65df27..fb6308052d3 100644 --- a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java +++ b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java @@ -13,10 +13,11 @@ package com.ibm.cloud.platform_services.iam_policy_management.v1.model; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; @@ -94,15 +95,24 @@ public void testCreatePolicyTemplateOptions() throws Throwable { .build(); assertEquals(rolesModel.roleId(), "testString"); - Grant grantModel = new Grant.Builder() + RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleTemplateReferencesItemModel.id(), "testString"); + assertEquals(roleTemplateReferencesItemModel.version(), "testString"); + + TemplateGrant templateGrantModel = new TemplateGrant.Builder() .roles(java.util.Arrays.asList(rolesModel)) + .roleTemplateReferences(java.util.Arrays.asList(roleTemplateReferencesItemModel)) .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + assertEquals(templateGrantModel.roleTemplateReferences(), java.util.Arrays.asList(roleTemplateReferencesItemModel)); - Control controlModel = new Control.Builder() - .grant(grantModel) + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) .build(); - assertEquals(controlModel.grant(), grantModel); + assertEquals(templateControlModel.grant(), templateGrantModel); TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() .type("access") @@ -111,7 +121,7 @@ public void testCreatePolicyTemplateOptions() throws Throwable { .subject(v2PolicySubjectModel) .pattern("testString") .rule(v2PolicyRuleModel) - .control(controlModel) + .control(templateControlModel) .build(); assertEquals(templatePolicyModel.type(), "access"); assertEquals(templatePolicyModel.description(), "testString"); @@ -119,7 +129,7 @@ public void testCreatePolicyTemplateOptions() throws Throwable { assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); assertEquals(templatePolicyModel.pattern(), "testString"); assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), controlModel); + assertEquals(templatePolicyModel.control(), templateControlModel); CreatePolicyTemplateOptions createPolicyTemplateOptionsModel = new CreatePolicyTemplateOptions.Builder() .name("testString") diff --git a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java index cc8764adc34..a9ea7ea7b59 100644 --- a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java +++ b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java @@ -13,10 +13,11 @@ package com.ibm.cloud.platform_services.iam_policy_management.v1.model; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; @@ -94,15 +95,24 @@ public void testCreatePolicyTemplateVersionOptions() throws Throwable { .build(); assertEquals(rolesModel.roleId(), "testString"); - Grant grantModel = new Grant.Builder() + RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleTemplateReferencesItemModel.id(), "testString"); + assertEquals(roleTemplateReferencesItemModel.version(), "testString"); + + TemplateGrant templateGrantModel = new TemplateGrant.Builder() .roles(java.util.Arrays.asList(rolesModel)) + .roleTemplateReferences(java.util.Arrays.asList(roleTemplateReferencesItemModel)) .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + assertEquals(templateGrantModel.roleTemplateReferences(), java.util.Arrays.asList(roleTemplateReferencesItemModel)); - Control controlModel = new Control.Builder() - .grant(grantModel) + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) .build(); - assertEquals(controlModel.grant(), grantModel); + assertEquals(templateControlModel.grant(), templateGrantModel); TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() .type("access") @@ -111,7 +121,7 @@ public void testCreatePolicyTemplateVersionOptions() throws Throwable { .subject(v2PolicySubjectModel) .pattern("testString") .rule(v2PolicyRuleModel) - .control(controlModel) + .control(templateControlModel) .build(); assertEquals(templatePolicyModel.type(), "access"); assertEquals(templatePolicyModel.description(), "testString"); @@ -119,7 +129,7 @@ public void testCreatePolicyTemplateVersionOptions() throws Throwable { assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); assertEquals(templatePolicyModel.pattern(), "testString"); assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), controlModel); + assertEquals(templatePolicyModel.control(), templateControlModel); CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptionsModel = new CreatePolicyTemplateVersionOptions.Builder() .policyTemplateId("testString") diff --git a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java index b2d2d02d168..799743ddbf4 100644 --- a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java +++ b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java @@ -14,7 +14,7 @@ package com.ibm.cloud.platform_services.iam_policy_management.v1.model; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; import com.ibm.cloud.platform_services.iam_policy_management.v1.utils.TestUtilities; import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; import java.io.InputStream; @@ -32,32 +32,32 @@ public class CreateRoleTemplateOptionsTest { @Test public void testCreateRoleTemplateOptions() throws Throwable { - TemplateRole templateRoleModel = new TemplateRole.Builder() + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() .name("testString") .displayName("testString") .serviceName("testString") .description("testString") .actions(java.util.Arrays.asList("testString")) .build(); - assertEquals(templateRoleModel.name(), "testString"); - assertEquals(templateRoleModel.displayName(), "testString"); - assertEquals(templateRoleModel.serviceName(), "testString"); - assertEquals(templateRoleModel.description(), "testString"); - assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); + assertEquals(roleTemplatePrototypeRoleModel.name(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.displayName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.serviceName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.description(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.actions(), java.util.Arrays.asList("testString")); CreateRoleTemplateOptions createRoleTemplateOptionsModel = new CreateRoleTemplateOptions.Builder() .name("testString") .accountId("testString") .description("testString") .committed(true) - .role(templateRoleModel) + .role(roleTemplatePrototypeRoleModel) .acceptLanguage("default") .build(); assertEquals(createRoleTemplateOptionsModel.name(), "testString"); assertEquals(createRoleTemplateOptionsModel.accountId(), "testString"); assertEquals(createRoleTemplateOptionsModel.description(), "testString"); assertEquals(createRoleTemplateOptionsModel.committed(), Boolean.valueOf(true)); - assertEquals(createRoleTemplateOptionsModel.role(), templateRoleModel); + assertEquals(createRoleTemplateOptionsModel.role(), roleTemplatePrototypeRoleModel); assertEquals(createRoleTemplateOptionsModel.acceptLanguage(), "default"); } diff --git a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java index 1f746d295f1..a7d2d312afa 100644 --- a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java +++ b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java @@ -33,13 +33,11 @@ public class CreateRoleTemplateVersionOptionsTest { @Test public void testCreateRoleTemplateVersionOptions() throws Throwable { TemplateRole templateRoleModel = new TemplateRole.Builder() - .name("testString") .displayName("testString") .serviceName("testString") .description("testString") .actions(java.util.Arrays.asList("testString")) .build(); - assertEquals(templateRoleModel.name(), "testString"); assertEquals(templateRoleModel.displayName(), "testString"); assertEquals(templateRoleModel.serviceName(), "testString"); assertEquals(templateRoleModel.description(), "testString"); @@ -47,15 +45,15 @@ public void testCreateRoleTemplateVersionOptions() throws Throwable { CreateRoleTemplateVersionOptions createRoleTemplateVersionOptionsModel = new CreateRoleTemplateVersionOptions.Builder() .roleTemplateId("testString") - .role(templateRoleModel) .name("testString") .description("testString") + .role(templateRoleModel) .committed(true) .build(); assertEquals(createRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); - assertEquals(createRoleTemplateVersionOptionsModel.role(), templateRoleModel); assertEquals(createRoleTemplateVersionOptionsModel.name(), "testString"); assertEquals(createRoleTemplateVersionOptionsModel.description(), "testString"); + assertEquals(createRoleTemplateVersionOptionsModel.role(), templateRoleModel); assertEquals(createRoleTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); } diff --git a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolcyTemplateAssignmentCollectionTest.java b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolcyTemplateAssignmentCollectionTest.java index e131c926b44..c26a0c38420 100644 --- a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolcyTemplateAssignmentCollectionTest.java +++ b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolcyTemplateAssignmentCollectionTest.java @@ -17,7 +17,7 @@ import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorResponse; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolcyTemplateAssignmentCollection; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Options; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentRecord; diff --git a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentRecordTest.java b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentRecordTest.java index fd670da1a47..6099bfe4fb3 100644 --- a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentRecordTest.java +++ b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentRecordTest.java @@ -17,7 +17,7 @@ import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorResponse; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Options; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentRecord; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; diff --git a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesPolicyTest.java b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesPolicyTest.java index e1c63efb480..cafb43b1278 100644 --- a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesPolicyTest.java +++ b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesPolicyTest.java @@ -17,7 +17,7 @@ import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorResponse; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcesPolicy; import com.ibm.cloud.platform_services.iam_policy_management.v1.utils.TestUtilities; import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; diff --git a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java index c7e900d9b46..ee947fa0f5d 100644 --- a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java +++ b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java @@ -13,14 +13,15 @@ package com.ibm.cloud.platform_services.iam_policy_management.v1.model; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; diff --git a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java index fe91cd879fa..b1855bd6c29 100644 --- a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java +++ b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java @@ -13,12 +13,13 @@ package com.ibm.cloud.platform_services.iam_policy_management.v1.model; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; diff --git a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java index 7bc57698699..3c7415484cc 100644 --- a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java +++ b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java @@ -13,10 +13,11 @@ package com.ibm.cloud.platform_services.iam_policy_management.v1.model; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; diff --git a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java index f03afc568ca..cc18c7455ff 100644 --- a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java +++ b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java @@ -13,14 +13,15 @@ package com.ibm.cloud.platform_services.iam_policy_management.v1.model; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; diff --git a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java index 46296099f67..8c92a67c1b7 100644 --- a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java +++ b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java @@ -13,10 +13,11 @@ package com.ibm.cloud.platform_services.iam_policy_management.v1.model; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; @@ -94,15 +95,24 @@ public void testReplacePolicyTemplateOptions() throws Throwable { .build(); assertEquals(rolesModel.roleId(), "testString"); - Grant grantModel = new Grant.Builder() + RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleTemplateReferencesItemModel.id(), "testString"); + assertEquals(roleTemplateReferencesItemModel.version(), "testString"); + + TemplateGrant templateGrantModel = new TemplateGrant.Builder() .roles(java.util.Arrays.asList(rolesModel)) + .roleTemplateReferences(java.util.Arrays.asList(roleTemplateReferencesItemModel)) .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + assertEquals(templateGrantModel.roleTemplateReferences(), java.util.Arrays.asList(roleTemplateReferencesItemModel)); - Control controlModel = new Control.Builder() - .grant(grantModel) + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) .build(); - assertEquals(controlModel.grant(), grantModel); + assertEquals(templateControlModel.grant(), templateGrantModel); TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() .type("access") @@ -111,7 +121,7 @@ public void testReplacePolicyTemplateOptions() throws Throwable { .subject(v2PolicySubjectModel) .pattern("testString") .rule(v2PolicyRuleModel) - .control(controlModel) + .control(templateControlModel) .build(); assertEquals(templatePolicyModel.type(), "access"); assertEquals(templatePolicyModel.description(), "testString"); @@ -119,7 +129,7 @@ public void testReplacePolicyTemplateOptions() throws Throwable { assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); assertEquals(templatePolicyModel.pattern(), "testString"); assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), controlModel); + assertEquals(templatePolicyModel.control(), templateControlModel); ReplacePolicyTemplateOptions replacePolicyTemplateOptionsModel = new ReplacePolicyTemplateOptions.Builder() .policyTemplateId("testString") diff --git a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java index cf277697289..2f731aea7d4 100644 --- a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java +++ b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java @@ -33,13 +33,11 @@ public class ReplaceRoleTemplateOptionsTest { @Test public void testReplaceRoleTemplateOptions() throws Throwable { TemplateRole templateRoleModel = new TemplateRole.Builder() - .name("testString") .displayName("testString") .serviceName("testString") .description("testString") .actions(java.util.Arrays.asList("testString")) .build(); - assertEquals(templateRoleModel.name(), "testString"); assertEquals(templateRoleModel.displayName(), "testString"); assertEquals(templateRoleModel.serviceName(), "testString"); assertEquals(templateRoleModel.description(), "testString"); @@ -49,17 +47,17 @@ public void testReplaceRoleTemplateOptions() throws Throwable { .roleTemplateId("testString") .version("testString") .ifMatch("testString") - .role(templateRoleModel) .name("testString") .description("testString") + .role(templateRoleModel) .committed(true) .build(); assertEquals(replaceRoleTemplateOptionsModel.roleTemplateId(), "testString"); assertEquals(replaceRoleTemplateOptionsModel.version(), "testString"); assertEquals(replaceRoleTemplateOptionsModel.ifMatch(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.role(), templateRoleModel); assertEquals(replaceRoleTemplateOptionsModel.name(), "testString"); assertEquals(replaceRoleTemplateOptionsModel.description(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.role(), templateRoleModel); assertEquals(replaceRoleTemplateOptionsModel.committed(), Boolean.valueOf(true)); } diff --git a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java index cf3028a2536..fde4d11ff4c 100644 --- a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java +++ b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java @@ -18,7 +18,7 @@ import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; import com.ibm.cloud.platform_services.iam_policy_management.v1.utils.TestUtilities; import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; import java.io.InputStream; diff --git a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java new file mode 100644 index 00000000000..6c208e1c38f --- /dev/null +++ b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java @@ -0,0 +1,62 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplatePrototypeRole model. + */ +public class RoleTemplatePrototypeRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplatePrototypeRole() throws Throwable { + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() + .name("testString") + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(roleTemplatePrototypeRoleModel.name(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.displayName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.serviceName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.description(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.actions(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(roleTemplatePrototypeRoleModel); + + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModelNew = TestUtilities.deserialize(json, RoleTemplatePrototypeRole.class); + assertTrue(roleTemplatePrototypeRoleModelNew instanceof RoleTemplatePrototypeRole); + assertEquals(roleTemplatePrototypeRoleModelNew.name(), "testString"); + assertEquals(roleTemplatePrototypeRoleModelNew.displayName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModelNew.serviceName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModelNew.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRoleTemplatePrototypeRoleError() throws Throwable { + new RoleTemplatePrototypeRole.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java new file mode 100644 index 00000000000..af9de718e23 --- /dev/null +++ b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateReferencesItem model. + */ +public class RoleTemplateReferencesItemTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplateReferencesItem() throws Throwable { + RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleTemplateReferencesItemModel.id(), "testString"); + assertEquals(roleTemplateReferencesItemModel.version(), "testString"); + + String json = TestUtilities.serialize(roleTemplateReferencesItemModel); + + RoleTemplateReferencesItem roleTemplateReferencesItemModelNew = TestUtilities.deserialize(json, RoleTemplateReferencesItem.class); + assertTrue(roleTemplateReferencesItemModelNew instanceof RoleTemplateReferencesItem); + assertEquals(roleTemplateReferencesItemModelNew.id(), "testString"); + assertEquals(roleTemplateReferencesItemModelNew.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRoleTemplateReferencesItemError() throws Throwable { + new RoleTemplateReferencesItem.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java index 0c539f477db..8bb27d8dd62 100644 --- a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java +++ b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java @@ -14,7 +14,7 @@ package com.ibm.cloud.platform_services.iam_policy_management.v1.model; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; import com.ibm.cloud.platform_services.iam_policy_management.v1.utils.TestUtilities; import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; import java.io.InputStream; diff --git a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java index ceddec39ba8..068cf309bd6 100644 --- a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java +++ b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java @@ -17,8 +17,8 @@ import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; import com.ibm.cloud.platform_services.iam_policy_management.v1.utils.TestUtilities; import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; import java.io.InputStream; diff --git a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java new file mode 100644 index 00000000000..4261c386685 --- /dev/null +++ b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java @@ -0,0 +1,73 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateControl model. + */ +public class TemplateControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateControl() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleTemplateReferencesItemModel.id(), "testString"); + assertEquals(roleTemplateReferencesItemModel.version(), "testString"); + + TemplateGrant templateGrantModel = new TemplateGrant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .roleTemplateReferences(java.util.Arrays.asList(roleTemplateReferencesItemModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + assertEquals(templateGrantModel.roleTemplateReferences(), java.util.Arrays.asList(roleTemplateReferencesItemModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + String json = TestUtilities.serialize(templateControlModel); + + TemplateControl templateControlModelNew = TestUtilities.deserialize(json, TemplateControl.class); + assertTrue(templateControlModelNew instanceof TemplateControl); + assertEquals(templateControlModelNew.grant().toString(), templateGrantModel.toString()); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateControlError() throws Throwable { + new TemplateControl.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java new file mode 100644 index 00000000000..dddb8328452 --- /dev/null +++ b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java @@ -0,0 +1,60 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrant model. + */ +public class TemplateGrantTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateGrant() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleTemplateReferencesItemModel.id(), "testString"); + assertEquals(roleTemplateReferencesItemModel.version(), "testString"); + + TemplateGrant templateGrantModel = new TemplateGrant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .roleTemplateReferences(java.util.Arrays.asList(roleTemplateReferencesItemModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + assertEquals(templateGrantModel.roleTemplateReferences(), java.util.Arrays.asList(roleTemplateReferencesItemModel)); + + String json = TestUtilities.serialize(templateGrantModel); + + TemplateGrant templateGrantModelNew = TestUtilities.deserialize(json, TemplateGrant.class); + assertTrue(templateGrantModelNew instanceof TemplateGrant); + } +} \ No newline at end of file diff --git a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java index 6aac25afed3..0861e58876d 100644 --- a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java +++ b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java @@ -13,9 +13,10 @@ package com.ibm.cloud.platform_services.iam_policy_management.v1.model; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; @@ -93,15 +94,24 @@ public void testTemplatePolicy() throws Throwable { .build(); assertEquals(rolesModel.roleId(), "testString"); - Grant grantModel = new Grant.Builder() + RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleTemplateReferencesItemModel.id(), "testString"); + assertEquals(roleTemplateReferencesItemModel.version(), "testString"); + + TemplateGrant templateGrantModel = new TemplateGrant.Builder() .roles(java.util.Arrays.asList(rolesModel)) + .roleTemplateReferences(java.util.Arrays.asList(roleTemplateReferencesItemModel)) .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + assertEquals(templateGrantModel.roleTemplateReferences(), java.util.Arrays.asList(roleTemplateReferencesItemModel)); - Control controlModel = new Control.Builder() - .grant(grantModel) + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) .build(); - assertEquals(controlModel.grant(), grantModel); + assertEquals(templateControlModel.grant(), templateGrantModel); TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() .type("access") @@ -110,7 +120,7 @@ public void testTemplatePolicy() throws Throwable { .subject(v2PolicySubjectModel) .pattern("testString") .rule(v2PolicyRuleModel) - .control(controlModel) + .control(templateControlModel) .build(); assertEquals(templatePolicyModel.type(), "access"); assertEquals(templatePolicyModel.description(), "testString"); @@ -118,7 +128,7 @@ public void testTemplatePolicy() throws Throwable { assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); assertEquals(templatePolicyModel.pattern(), "testString"); assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), controlModel); + assertEquals(templatePolicyModel.control(), templateControlModel); String json = TestUtilities.serialize(templatePolicyModel); @@ -130,7 +140,7 @@ public void testTemplatePolicy() throws Throwable { assertEquals(templatePolicyModelNew.subject().toString(), v2PolicySubjectModel.toString()); assertEquals(templatePolicyModelNew.pattern(), "testString"); assertEquals(templatePolicyModelNew.rule().toString(), v2PolicyRuleModel.toString()); - assertEquals(templatePolicyModelNew.control().toString(), controlModel.toString()); + assertEquals(templatePolicyModelNew.control().toString(), templateControlModel.toString()); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java index 8e5d3425491..1735364bc85 100644 --- a/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java +++ b/modules/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java @@ -32,13 +32,11 @@ public class TemplateRoleTest { @Test public void testTemplateRole() throws Throwable { TemplateRole templateRoleModel = new TemplateRole.Builder() - .name("testString") .displayName("testString") .serviceName("testString") .description("testString") .actions(java.util.Arrays.asList("testString")) .build(); - assertEquals(templateRoleModel.name(), "testString"); assertEquals(templateRoleModel.displayName(), "testString"); assertEquals(templateRoleModel.serviceName(), "testString"); assertEquals(templateRoleModel.description(), "testString"); @@ -48,7 +46,6 @@ public void testTemplateRole() throws Throwable { TemplateRole templateRoleModelNew = TestUtilities.deserialize(json, TemplateRole.class); assertTrue(templateRoleModelNew instanceof TemplateRole); - assertEquals(templateRoleModelNew.name(), "testString"); assertEquals(templateRoleModelNew.displayName(), "testString"); assertEquals(templateRoleModelNew.serviceName(), "testString"); assertEquals(templateRoleModelNew.description(), "testString"); From 7656247fcedda3652fb33cf905972c6220caeefb Mon Sep 17 00:00:00 2001 From: Bhavana Bellamgari Date: Wed, 10 Dec 2025 12:47:07 +0530 Subject: [PATCH 02/13] Updated template grant schema Signed-off-by: Bhavana Bellamgari --- .../v1/IamPolicyManagement.java | 2566 +++++++++ .../AccountSettingsAccessManagement.java | 40 + .../v1/model/ActionControlAssignment.java | 207 + .../ActionControlAssignmentCollection.java | 88 + .../ActionControlAssignmentResource.java | 52 + ...ontrolAssignmentResourceActionControl.java | 53 + ...ctionControlAssignmentResourceCreated.java | 38 + .../ActionControlAssignmentTemplate.java | 134 + .../model/ActionControlAssignmentsPager.java | 108 + .../v1/model/ActionControlTemplate.java | 203 + .../ActionControlTemplateCollection.java | 90 + ...tionControlTemplateVersionsCollection.java | 88 + .../ActionControlTemplateVersionsPager.java | 108 + .../v1/model/ActionControlTemplatesPager.java | 108 + .../v1/model/AssignmentResourceCreated.java | 38 + .../v1/model/AssignmentResourceError.java | 88 + .../v1/model/AssignmentTargetDetails.java | 142 + .../v1/model/AssignmentTemplateDetails.java | 119 + .../CommitActionControlTemplateOptions.java | 134 + .../v1/model/CommitPolicyTemplateOptions.java | 134 + .../v1/model/CommitRoleTemplateOptions.java | 134 + .../v1/model/ConflictsWith.java | 62 + .../v1/model/Control.java | 104 + .../v1/model/ControlResponse.java | 42 + .../v1/model/ControlResponseControl.java | 24 + ...ntrolResponseControlWithEnrichedRoles.java | 24 + ...ctionControlTemplateAssignmentOptions.java | 191 + .../CreateActionControlTemplateOptions.java | 251 + ...teActionControlTemplateVersionOptions.java | 211 + .../v1/model/CreatePolicyOptions.java | 311 + ...CreatePolicyTemplateAssignmentOptions.java | 221 + .../v1/model/CreatePolicyTemplateOptions.java | 255 + .../CreatePolicyTemplateVersionOptions.java | 214 + .../v1/model/CreateRoleOptions.java | 308 + .../CreateRoleTemplateAssignmentOptions.java | 191 + .../v1/model/CreateRoleTemplateOptions.java | 251 + .../CreateRoleTemplateVersionOptions.java | 211 + .../v1/model/CreateV2PolicyOptions.java | 312 + .../v1/model/CustomRole.java | 195 + .../DeleteActionControlAssignmentOptions.java | 104 + .../DeleteActionControlTemplateOptions.java | 104 + ...teActionControlTemplateVersionOptions.java | 134 + .../model/DeletePolicyAssignmentOptions.java | 104 + .../v1/model/DeletePolicyOptions.java | 104 + .../v1/model/DeletePolicyTemplateOptions.java | 104 + .../DeletePolicyTemplateVersionOptions.java | 134 + .../v1/model/DeleteRoleAssignmentOptions.java | 104 + .../v1/model/DeleteRoleOptions.java | 104 + .../v1/model/DeleteRoleTemplateOptions.java | 104 + .../DeleteRoleTemplateVersionOptions.java | 134 + .../v1/model/DeleteV2PolicyOptions.java | 104 + .../v1/model/EnrichedRoles.java | 81 + .../v1/model/ErrorDetails.java | 40 + .../v1/model/ErrorObject.java | 128 + .../ExternalAccountIdentityInteraction.java | 40 + ...ternalAccountIdentityInteractionPatch.java | 95 + .../iam_policy_management/v1/model/First.java | 38 + .../GetActionControlAssignmentOptions.java | 104 + .../GetActionControlTemplateOptions.java | 140 + ...etActionControlTemplateVersionOptions.java | 134 + .../v1/model/GetPolicyAssignmentOptions.java | 134 + .../v1/model/GetPolicyOptions.java | 104 + .../v1/model/GetPolicyTemplateOptions.java | 140 + .../GetPolicyTemplateVersionOptions.java | 134 + .../v1/model/GetRoleAssignmentOptions.java | 104 + .../v1/model/GetRoleOptions.java | 104 + .../v1/model/GetRoleTemplateOptions.java | 140 + .../model/GetRoleTemplateVersionOptions.java | 134 + .../v1/model/GetSettingsOptions.java | 141 + .../v1/model/GetV2PolicyOptions.java | 148 + .../iam_policy_management/v1/model/Grant.java | 124 + .../v1/model/GrantWithEnrichedRoles.java | 40 + .../v1/model/IdentityTypes.java | 64 + .../v1/model/IdentityTypesBase.java | 168 + .../v1/model/IdentityTypesPatch.java | 147 + .../v1/model/LimitData.java | 50 + .../ListActionControlAssignmentsOptions.java | 245 + ...tActionControlTemplateVersionsOptions.java | 192 + .../ListActionControlTemplatesOptions.java | 193 + .../v1/model/ListPoliciesOptions.java | 501 ++ .../model/ListPolicyAssignmentsOptions.java | 275 + .../ListPolicyTemplateVersionsOptions.java | 192 + .../v1/model/ListPolicyTemplatesOptions.java | 379 ++ .../v1/model/ListRoleAssignmentsOptions.java | 245 + .../ListRoleTemplateVersionsOptions.java | 192 + .../v1/model/ListRoleTemplatesOptions.java | 307 + .../v1/model/ListRolesOptions.java | 234 + .../v1/model/ListV2PoliciesOptions.java | 492 ++ .../v1/model/NestedCondition.java | 126 + .../model/NestedConditionRuleAttribute.java | 170 + .../NestedConditionRuleWithConditions.java | 139 + .../iam_policy_management/v1/model/Next.java | 50 + .../v1/model/PoliciesPager.java | 108 + .../v1/model/Policy.java | 188 + .../model/PolicyAssignmentResourcePolicy.java | 65 + .../v1/model/PolicyAssignmentResources.java | 50 + .../v1/model/PolicyAssignmentV1.java | 193 + .../model/PolicyAssignmentV1Collection.java | 88 + .../v1/model/PolicyAssignmentV1Resources.java | 50 + .../v1/model/PolicyAssignmentV1Subject.java | 60 + .../v1/model/PolicyAssignmentsPager.java | 108 + .../v1/model/PolicyCollection.java | 88 + .../v1/model/PolicyResource.java | 167 + .../v1/model/PolicyRole.java | 131 + .../v1/model/PolicySubject.java | 124 + .../v1/model/PolicyTemplate.java | 202 + .../PolicyTemplateAssignmentCollection.java | 88 + .../model/PolicyTemplateAssignmentItems.java | 261 + ...mplateAssignmentItemsPolicyAssignment.java | 50 + ...lateAssignmentItemsPolicyAssignmentV1.java | 38 + .../v1/model/PolicyTemplateCollection.java | 90 + .../v1/model/PolicyTemplateLimitData.java | 214 + .../v1/model/PolicyTemplateMetaData.java | 201 + .../PolicyTemplateVersionsCollection.java | 88 + .../v1/model/PolicyTemplateVersionsPager.java | 108 + .../v1/model/PolicyTemplatesPager.java | 108 + .../v1/model/Previous.java | 50 + .../ReplaceActionControlTemplateOptions.java | 273 + .../v1/model/ReplacePolicyOptions.java | 335 ++ .../model/ReplacePolicyTemplateOptions.java | 276 + .../v1/model/ReplaceRoleOptions.java | 255 + .../v1/model/ReplaceRoleTemplateOptions.java | 273 + .../v1/model/ReplaceV2PolicyOptions.java | 336 ++ .../v1/model/ResourceAttribute.java | 160 + .../v1/model/ResourceTag.java | 160 + .../iam_policy_management/v1/model/Role.java | 196 + .../v1/model/RoleAction.java | 64 + .../v1/model/RoleAssignment.java | 207 + .../v1/model/RoleAssignmentCollection.java | 88 + .../v1/model/RoleAssignmentResource.java | 50 + .../model/RoleAssignmentResourceCreated.java | 38 + .../v1/model/RoleAssignmentResourceRole.java | 53 + .../v1/model/RoleAssignmentTemplate.java | 134 + .../v1/model/RoleAssignmentsPager.java | 108 + .../v1/model/RoleCollection.java | 68 + .../v1/model/RoleTemplate.java | 202 + .../v1/model/RoleTemplateCollection.java | 90 + .../v1/model/RoleTemplatePrototypeRole.java | 239 + .../v1/model/RoleTemplateReferencesItem.java | 134 + .../model/RoleTemplateVersionsCollection.java | 88 + .../v1/model/RoleTemplateVersionsPager.java | 108 + .../v1/model/RoleTemplatesPager.java | 108 + .../iam_policy_management/v1/model/Roles.java | 106 + .../v1/model/RuleAttribute.java | 209 + .../v1/model/SubjectAttribute.java | 134 + .../v1/model/TemplateActionControl.java | 182 + .../v1/model/TemplateControl.java | 104 + .../v1/model/TemplateCountData.java | 50 + .../v1/model/TemplateGrant.java | 58 + .../v1/model/TemplateGrantRoleReferences.java | 110 + .../v1/model/TemplateGrantRoles.java | 110 + .../v1/model/TemplateMetadata.java | 91 + .../v1/model/TemplatePolicy.java | 272 + .../v1/model/TemplateRole.java | 209 + .../UpdateActionControlAssignmentOptions.java | 166 + .../model/UpdatePolicyAssignmentOptions.java | 196 + .../v1/model/UpdatePolicyStateOptions.java | 171 + .../v1/model/UpdateRoleAssignmentOptions.java | 166 + .../v1/model/UpdateSettingsOptions.java | 199 + .../v1/model/V2PoliciesPager.java | 108 + .../v1/model/V2Policy.java | 247 + .../v1/model/V2PolicyCollection.java | 88 + .../v1/model/V2PolicyResource.java | 167 + .../v1/model/V2PolicyResourceAttribute.java | 181 + .../v1/model/V2PolicyResourceTag.java | 174 + .../v1/model/V2PolicyRule.java | 126 + .../v1/model/V2PolicyRuleRuleAttribute.java | 170 + .../V2PolicyRuleRuleWithNestedConditions.java | 139 + .../v1/model/V2PolicySubject.java | 124 + .../v1/model/V2PolicySubjectAttribute.java | 175 + .../v1/model/V2PolicyTemplateMetaData.java | 260 + .../v1/package-info.java | 17 + .../v1/IamPolicyManagementTest.java | 5007 +++++++++++++++++ .../AccountSettingsAccessManagementTest.java | 40 + ...ActionControlAssignmentCollectionTest.java | 47 + ...olAssignmentResourceActionControlTest.java | 43 + ...nControlAssignmentResourceCreatedTest.java | 37 + .../ActionControlAssignmentResourceTest.java | 45 + .../ActionControlAssignmentTemplateTest.java | 54 + .../v1/model/ActionControlAssignmentTest.java | 40 + .../ActionControlTemplateCollectionTest.java | 46 + .../v1/model/ActionControlTemplateTest.java | 44 + ...ControlTemplateVersionsCollectionTest.java | 46 + .../model/AssignmentResourceCreatedTest.java | 37 + .../v1/model/AssignmentResourceErrorTest.java | 44 + .../v1/model/AssignmentTargetDetailsTest.java | 54 + .../model/AssignmentTemplateDetailsTest.java | 48 + ...ommitActionControlTemplateOptionsTest.java | 47 + .../CommitPolicyTemplateOptionsTest.java | 47 + .../model/CommitRoleTemplateOptionsTest.java | 47 + .../v1/model/ConflictsWithTest.java | 39 + .../v1/model/ControlResponseControlTest.java | 39 + ...lResponseControlWithEnrichedRolesTest.java | 40 + .../v1/model/ControlResponseTest.java | 40 + .../v1/model/ControlTest.java | 63 + ...nControlTemplateAssignmentOptionsTest.java | 65 + ...reateActionControlTemplateOptionsTest.java | 65 + ...tionControlTemplateVersionOptionsTest.java | 63 + .../v1/model/CreatePolicyOptionsTest.java | 103 + ...tePolicyTemplateAssignmentOptionsTest.java | 67 + .../CreatePolicyTemplateOptionsTest.java | 145 + ...reatePolicyTemplateVersionOptionsTest.java | 143 + .../v1/model/CreateRoleOptionsTest.java | 57 + ...eateRoleTemplateAssignmentOptionsTest.java | 65 + .../model/CreateRoleTemplateOptionsTest.java | 69 + .../CreateRoleTemplateVersionOptionsTest.java | 65 + .../v1/model/CreateV2PolicyOptionsTest.java | 131 + .../v1/model/CustomRoleTest.java | 42 + ...eteActionControlAssignmentOptionsTest.java | 45 + ...eleteActionControlTemplateOptionsTest.java | 45 + ...tionControlTemplateVersionOptionsTest.java | 47 + .../DeletePolicyAssignmentOptionsTest.java | 45 + .../v1/model/DeletePolicyOptionsTest.java | 45 + .../DeletePolicyTemplateOptionsTest.java | 45 + ...eletePolicyTemplateVersionOptionsTest.java | 47 + .../DeleteRoleAssignmentOptionsTest.java | 45 + .../v1/model/DeleteRoleOptionsTest.java | 45 + .../model/DeleteRoleTemplateOptionsTest.java | 45 + .../DeleteRoleTemplateVersionOptionsTest.java | 47 + .../v1/model/DeleteV2PolicyOptionsTest.java | 45 + .../v1/model/EnrichedRolesTest.java | 39 + .../v1/model/ErrorDetailsTest.java | 38 + .../v1/model/ErrorObjectTest.java | 42 + ...alAccountIdentityInteractionPatchTest.java | 63 + ...xternalAccountIdentityInteractionTest.java | 39 + .../v1/model/FirstTest.java | 36 + ...GetActionControlAssignmentOptionsTest.java | 45 + .../GetActionControlTemplateOptionsTest.java | 47 + ...tionControlTemplateVersionOptionsTest.java | 47 + .../model/GetPolicyAssignmentOptionsTest.java | 47 + .../v1/model/GetPolicyOptionsTest.java | 45 + .../model/GetPolicyTemplateOptionsTest.java | 47 + .../GetPolicyTemplateVersionOptionsTest.java | 47 + .../model/GetRoleAssignmentOptionsTest.java | 45 + .../v1/model/GetRoleOptionsTest.java | 45 + .../v1/model/GetRoleTemplateOptionsTest.java | 47 + .../GetRoleTemplateVersionOptionsTest.java | 47 + .../v1/model/GetSettingsOptionsTest.java | 47 + .../v1/model/GetV2PolicyOptionsTest.java | 47 + .../v1/model/GrantTest.java | 56 + .../v1/model/GrantWithEnrichedRolesTest.java | 39 + .../v1/model/IdentityTypesBaseTest.java | 53 + .../v1/model/IdentityTypesPatchTest.java | 59 + .../v1/model/IdentityTypesTest.java | 40 + .../v1/model/LimitDataTest.java | 36 + ...stActionControlAssignmentsOptionsTest.java | 55 + ...ionControlTemplateVersionsOptionsTest.java | 51 + ...ListActionControlTemplatesOptionsTest.java | 51 + .../v1/model/ListPoliciesOptionsTest.java | 69 + .../ListPolicyAssignmentsOptionsTest.java | 57 + ...ListPolicyTemplateVersionsOptionsTest.java | 51 + .../model/ListPolicyTemplatesOptionsTest.java | 63 + .../model/ListRoleAssignmentsOptionsTest.java | 55 + .../ListRoleTemplateVersionsOptionsTest.java | 51 + .../model/ListRoleTemplatesOptionsTest.java | 59 + .../v1/model/ListRolesOptionsTest.java | 49 + .../v1/model/ListV2PoliciesOptionsTest.java | 69 + .../NestedConditionRuleAttributeTest.java | 57 + ...NestedConditionRuleWithConditionsTest.java | 63 + .../v1/model/NestedConditionTest.java | 38 + .../v1/model/NextTest.java | 37 + .../PolicyAssignmentResourcePolicyTest.java | 44 + .../model/PolicyAssignmentResourcesTest.java | 44 + .../PolicyAssignmentV1CollectionTest.java | 55 + .../PolicyAssignmentV1ResourcesTest.java | 45 + .../model/PolicyAssignmentV1SubjectTest.java | 36 + .../v1/model/PolicyAssignmentV1Test.java | 51 + .../v1/model/PolicyCollectionTest.java | 52 + .../v1/model/PolicyResourceTest.java | 72 + .../v1/model/PolicyRoleTest.java | 51 + .../v1/model/PolicySubjectTest.java | 58 + ...olicyTemplateAssignmentCollectionTest.java | 55 + ...teAssignmentItemsPolicyAssignmentTest.java | 50 + ...AssignmentItemsPolicyAssignmentV1Test.java | 51 + .../PolicyTemplateAssignmentItemsTest.java | 48 + .../model/PolicyTemplateCollectionTest.java | 55 + .../v1/model/PolicyTemplateLimitDataTest.java | 56 + .../v1/model/PolicyTemplateMetaDataTest.java | 50 + .../v1/model/PolicyTemplateTest.java | 53 + .../PolicyTemplateVersionsCollectionTest.java | 55 + .../v1/model/PolicyTest.java | 48 + .../v1/model/PreviousTest.java | 37 + ...placeActionControlTemplateOptionsTest.java | 67 + .../v1/model/ReplacePolicyOptionsTest.java | 105 + .../ReplacePolicyTemplateOptionsTest.java | 147 + .../v1/model/ReplaceRoleOptionsTest.java | 53 + .../model/ReplaceRoleTemplateOptionsTest.java | 69 + .../v1/model/ReplaceV2PolicyOptionsTest.java | 133 + .../v1/model/ResourceAttributeTest.java | 57 + .../v1/model/ResourceTagTest.java | 57 + .../v1/model/RoleActionTest.java | 39 + .../model/RoleAssignmentCollectionTest.java | 47 + .../RoleAssignmentResourceCreatedTest.java | 37 + .../model/RoleAssignmentResourceRoleTest.java | 43 + .../v1/model/RoleAssignmentResourceTest.java | 45 + .../v1/model/RoleAssignmentTemplateTest.java | 54 + .../v1/model/RoleAssignmentTest.java | 40 + .../v1/model/RoleCollectionTest.java | 41 + .../v1/model/RoleTemplateCollectionTest.java | 46 + .../model/RoleTemplatePrototypeRoleTest.java | 62 + .../model/RoleTemplateReferencesItemTest.java | 54 + .../v1/model/RoleTemplateTest.java | 44 + .../RoleTemplateVersionsCollectionTest.java | 46 + .../v1/model/RoleTest.java | 56 + .../v1/model/RolesTest.java | 51 + .../v1/model/RuleAttributeTest.java | 57 + .../v1/model/SubjectAttributeTest.java | 54 + .../v1/model/TemplateActionControlTest.java | 56 + .../v1/model/TemplateControlTest.java | 63 + .../v1/model/TemplateCountDataTest.java | 39 + .../TemplateGrantRoleReferencesTest.java | 58 + .../v1/model/TemplateGrantRolesTest.java | 56 + .../v1/model/TemplateGrantTest.java | 39 + .../v1/model/TemplateMetadataTest.java | 41 + .../v1/model/TemplatePolicyTest.java | 141 + .../v1/model/TemplateRoleTest.java | 59 + ...ateActionControlAssignmentOptionsTest.java | 49 + .../UpdatePolicyAssignmentOptionsTest.java | 51 + .../model/UpdatePolicyStateOptionsTest.java | 49 + .../UpdateRoleAssignmentOptionsTest.java | 49 + .../v1/model/UpdateSettingsOptionsTest.java | 75 + .../v1/model/V2PolicyCollectionTest.java | 55 + .../model/V2PolicyResourceAttributeTest.java | 57 + .../v1/model/V2PolicyResourceTagTest.java | 57 + .../v1/model/V2PolicyResourceTest.java | 72 + .../model/V2PolicyRuleRuleAttributeTest.java | 57 + ...olicyRuleRuleWithNestedConditionsTest.java | 63 + .../v1/model/V2PolicyRuleTest.java | 38 + .../model/V2PolicySubjectAttributeTest.java | 57 + .../v1/model/V2PolicySubjectTest.java | 60 + .../model/V2PolicyTemplateMetaDataTest.java | 57 + .../v1/model/V2PolicyTest.java | 55 + .../v1/utils/TestUtilities.java | 131 + 333 files changed, 41258 insertions(+) create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java new file mode 100644 index 00000000000..2abe3baea4e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java @@ -0,0 +1,2566 @@ +/* + * (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. + */ + +/* + * IBM OpenAPI SDK Code Generator Version: 3.107.1-41b0fbd0-20250825-080732 + */ + +package com.ibm.cloud.platform_services.iam_policy_management.v1; + +import com.google.gson.JsonObject; +import com.ibm.cloud.platform_services.common.SdkCommon; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; +import com.ibm.cloud.sdk.core.http.RequestBuilder; +import com.ibm.cloud.sdk.core.http.ResponseConverter; +import com.ibm.cloud.sdk.core.http.ServiceCall; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.ConfigBasedAuthenticatorFactory; +import com.ibm.cloud.sdk.core.service.BaseService; +import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; + +/** + * IAM Policy Management API. + * + * API Version: 1.0.1 + */ +public class IamPolicyManagement extends BaseService { + + /** + * Default service name used when configuring the `IamPolicyManagement` client. + */ + public static final String DEFAULT_SERVICE_NAME = "iam_policy_management"; + + /** + * Default service endpoint URL. + */ + public static final String DEFAULT_SERVICE_URL = "https://iam.cloud.ibm.com"; + + /** + * Class method which constructs an instance of the `IamPolicyManagement` client. + * The default service name is used to configure the client instance. + * + * @return an instance of the `IamPolicyManagement` client using external configuration + */ + public static IamPolicyManagement newInstance() { + return newInstance(DEFAULT_SERVICE_NAME); + } + + /** + * Class method which constructs an instance of the `IamPolicyManagement` client. + * The specified service name is used to configure the client instance. + * + * @param serviceName the service name to be used when configuring the client instance + * @return an instance of the `IamPolicyManagement` client using external configuration + */ + public static IamPolicyManagement newInstance(String serviceName) { + Authenticator authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(serviceName); + IamPolicyManagement service = new IamPolicyManagement(serviceName, authenticator); + service.configureService(serviceName); + return service; + } + + /** + * Constructs an instance of the `IamPolicyManagement` client. + * The specified service name and authenticator are used to configure the client instance. + * + * @param serviceName the service name to be used when configuring the client instance + * @param authenticator the {@link Authenticator} instance to be configured for this client + */ + public IamPolicyManagement(String serviceName, Authenticator authenticator) { + super(serviceName, authenticator); + setServiceUrl(DEFAULT_SERVICE_URL); + } + + /** + * Get policies by attributes. + * + * Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account + * and filter by attribute values. This can be done through query parameters. The following attributes are supported: + * account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query + * parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If + * the caller does not have read access to any policies an empty array is returned. + * + * @param listPoliciesOptions the {@link ListPoliciesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyCollection} + */ + public ServiceCall listPolicies(ListPoliciesOptions listPoliciesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listPoliciesOptions, + "listPoliciesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicies"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listPoliciesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listPoliciesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listPoliciesOptions.accountId())); + if (listPoliciesOptions.iamId() != null) { + builder.query("iam_id", String.valueOf(listPoliciesOptions.iamId())); + } + if (listPoliciesOptions.accessGroupId() != null) { + builder.query("access_group_id", String.valueOf(listPoliciesOptions.accessGroupId())); + } + if (listPoliciesOptions.type() != null) { + builder.query("type", String.valueOf(listPoliciesOptions.type())); + } + if (listPoliciesOptions.serviceType() != null) { + builder.query("service_type", String.valueOf(listPoliciesOptions.serviceType())); + } + if (listPoliciesOptions.tagName() != null) { + builder.query("tag_name", String.valueOf(listPoliciesOptions.tagName())); + } + if (listPoliciesOptions.tagValue() != null) { + builder.query("tag_value", String.valueOf(listPoliciesOptions.tagValue())); + } + if (listPoliciesOptions.sort() != null) { + builder.query("sort", String.valueOf(listPoliciesOptions.sort())); + } + if (listPoliciesOptions.format() != null) { + builder.query("format", String.valueOf(listPoliciesOptions.format())); + } + if (listPoliciesOptions.state() != null) { + builder.query("state", String.valueOf(listPoliciesOptions.state())); + } + if (listPoliciesOptions.limit() != null) { + builder.query("limit", String.valueOf(listPoliciesOptions.limit())); + } + if (listPoliciesOptions.start() != null) { + builder.query("start", String.valueOf(listPoliciesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a policy. + * + * Creates a policy to grant access between a subject and a resource. There are two types of policies: **access** and + * **authorization**. A policy administrator might want to create an access policy which grants access to a user, + * service-id, or an access group. They might also want to create an authorization policy and setup access between + * services. + * + * ### Access + * + * To create an access policy, use **`"type": "access"`** in the body. The possible subject attributes are + * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or + * service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. Assign roles + * that are supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or + * **`service_group_id`** attribute and the **`accountId`** attribute. The IAM Services group (`IAM`) is a subset of + * account management services that includes the IAM platform services IAM Identity, IAM Access Management, IAM Users + * Management, IAM Groups, and future IAM services. If the subject is a locked service-id, the request will fail. + * + * ### Authorization + * + * Authorization policies are supported by services on a case by case basis. Refer to service documentation to verify + * their support of authorization policies. To create an authorization policy, use **`"type": "authorization"`** in + * the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject + * attributes might be provided. The following attributes are supported: + * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are + * supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access + * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject + * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. + * + * ### Attribute Operators + * + * Currently, only the `stringEquals` and the `stringMatch` operators are available. Resource attributes may support + * one or both operators. For more information, see [Assigning access by using wildcard + * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). + * + * ### Attribute Validations + * + * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like + * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated + * against Global Catalog locations. + * + * @param createPolicyOptions the {@link CreatePolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Policy} + */ + public ServiceCall createPolicy(CreatePolicyOptions createPolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyOptions, + "createPolicyOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createPolicyOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createPolicyOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("type", createPolicyOptions.type()); + contentJson.add("subjects", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.subjects())); + contentJson.add("roles", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.roles())); + contentJson.add("resources", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.resources())); + if (createPolicyOptions.description() != null) { + contentJson.addProperty("description", createPolicyOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a policy. + * + * Update a policy to grant access between a subject and a resource. A policy administrator might want to update an + * existing policy. The policy type cannot be changed (You cannot change an access policy to an authorization policy). + * + * ### Access + * + * To update an access policy, use **`"type": "access"`** in the body. The possible subject attributes are + * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or + * service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. Assign roles + * that are supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * The policy resource must include either the **`serviceType`**, **`serviceName`**, or **`resourceGroupId`** + * attribute and the **`accountId`** attribute.` If the subject is a locked service-id, the request will fail. + * + * ### Authorization + * + * To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match + * the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following + * attributes are supported: + * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are + * supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access + * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject + * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. + * + * ### Attribute Operators + * + * Currently, only the `stringEquals` and the `stringMatch` operators are available. Resource attributes might support + * one or both operators. For more information, see [Assigning access by using wildcard + * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). + * + * ### Attribute Validations + * + * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like + * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated + * against Global Catalog locations. + * + * @param replacePolicyOptions the {@link ReplacePolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Policy} + */ + public ServiceCall replacePolicy(ReplacePolicyOptions replacePolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replacePolicyOptions, + "replacePolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_id", replacePolicyOptions.policyId()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replacePolicy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replacePolicyOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("type", replacePolicyOptions.type()); + contentJson.add("subjects", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.subjects())); + contentJson.add("roles", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.roles())); + contentJson.add("resources", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.resources())); + if (replacePolicyOptions.description() != null) { + contentJson.addProperty("description", replacePolicyOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a policy by ID. + * + * Retrieve a policy by providing a policy ID. + * + * @param getPolicyOptions the {@link GetPolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateMetaData} + */ + public ServiceCall getPolicy(GetPolicyOptions getPolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyOptions, + "getPolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_id", getPolicyOptions.policyId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicy"); + 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); + } + + /** + * Delete a policy by ID. + * + * Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service + * ID. If the subject of the policy is a locked service-id, the request will fail. + * + * @param deletePolicyOptions the {@link DeletePolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deletePolicy(DeletePolicyOptions deletePolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyOptions, + "deletePolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_id", deletePolicyOptions.policyId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Restore a deleted policy by ID. + * + * Restore a policy that has recently been deleted. A policy administrator might want to restore a deleted policy. To + * restore a policy, use **`"state": "active"`** in the body. + * + * @param updatePolicyStateOptions the {@link UpdatePolicyStateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Policy} + */ + public ServiceCall updatePolicyState(UpdatePolicyStateOptions updatePolicyStateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updatePolicyStateOptions, + "updatePolicyStateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_id", updatePolicyStateOptions.policyId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updatePolicyState"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updatePolicyStateOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + if (updatePolicyStateOptions.state() != null) { + contentJson.addProperty("state", updatePolicyStateOptions.state()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get roles by filters. + * + * Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can + * be done through query parameters. Currently, we only support the following attributes: account_id, service_name, + * service_group_id, source_service_name and policy_type. Both service_name and service_group_id attributes are + * mutually exclusive. Only roles that match the filter and that the caller has read access to are returned. If the + * caller does not have read access to any roles an empty array is returned. + * + * @param listRolesOptions the {@link ListRolesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleCollection} + */ + public ServiceCall listRoles(ListRolesOptions listRolesOptions) { + if (listRolesOptions == null) { + listRolesOptions = new ListRolesOptions.Builder().build(); + } + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoles"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listRolesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listRolesOptions.acceptLanguage()); + } + if (listRolesOptions.accountId() != null) { + builder.query("account_id", String.valueOf(listRolesOptions.accountId())); + } + if (listRolesOptions.serviceName() != null) { + builder.query("service_name", String.valueOf(listRolesOptions.serviceName())); + } + if (listRolesOptions.sourceServiceName() != null) { + builder.query("source_service_name", String.valueOf(listRolesOptions.sourceServiceName())); + } + if (listRolesOptions.policyType() != null) { + builder.query("policy_type", String.valueOf(listRolesOptions.policyType())); + } + if (listRolesOptions.serviceGroupId() != null) { + builder.query("service_group_id", String.valueOf(listRolesOptions.serviceGroupId())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get roles by filters. + * + * Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can + * be done through query parameters. Currently, we only support the following attributes: account_id, service_name, + * service_group_id, source_service_name and policy_type. Both service_name and service_group_id attributes are + * mutually exclusive. Only roles that match the filter and that the caller has read access to are returned. If the + * caller does not have read access to any roles an empty array is returned. + * + * @return a {@link ServiceCall} with a result of type {@link RoleCollection} + */ + public ServiceCall listRoles() { + return listRoles(null); + } + + /** + * Create a role. + * + * Creates a custom role for a specific service within the account. An account owner or a user assigned the + * Administrator role on the Role management service can create a custom role. Any number of actions for a single + * service can be mapped to the new role, but there must be at least one service-defined action to successfully create + * the new role. + * + * @param createRoleOptions the {@link CreateRoleOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link CustomRole} + */ + public ServiceCall createRole(CreateRoleOptions createRoleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleOptions, + "createRoleOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRole"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createRoleOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createRoleOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("display_name", createRoleOptions.displayName()); + contentJson.add("actions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleOptions.actions())); + contentJson.addProperty("name", createRoleOptions.name()); + contentJson.addProperty("account_id", createRoleOptions.accountId()); + contentJson.addProperty("service_name", createRoleOptions.serviceName()); + if (createRoleOptions.description() != null) { + contentJson.addProperty("description", createRoleOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a role. + * + * Update a custom role. A role administrator might want to update an existing role by updating the display name, + * description, or the actions that are mapped to the role. The name, account_id, and service_name can't be changed. + * + * @param replaceRoleOptions the {@link ReplaceRoleOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link CustomRole} + */ + public ServiceCall replaceRole(ReplaceRoleOptions replaceRoleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceRoleOptions, + "replaceRoleOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_id", replaceRoleOptions.roleId()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceRole"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replaceRoleOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("display_name", replaceRoleOptions.displayName()); + contentJson.add("actions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRoleOptions.actions())); + if (replaceRoleOptions.description() != null) { + contentJson.addProperty("description", replaceRoleOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a role by ID. + * + * Retrieve a role by providing a role ID. + * + * @param getRoleOptions the {@link GetRoleOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link CustomRole} + */ + public ServiceCall getRole(GetRoleOptions getRoleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleOptions, + "getRoleOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_id", getRoleOptions.roleId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRole"); + 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); + } + + /** + * Delete a role by ID. + * + * Delete a role by providing a role ID. + * + * @param deleteRoleOptions the {@link DeleteRoleOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteRole(DeleteRoleOptions deleteRoleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleOptions, + "deleteRoleOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_id", deleteRoleOptions.roleId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRole"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get policies by attributes. + * + * Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account + * and filter by attribute values. This can be done through query parameters. The following attributes are supported: + * account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query + * parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If + * the caller does not have read access to any policies an empty array is returned. + * + * @param listV2PoliciesOptions the {@link ListV2PoliciesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link V2PolicyCollection} + */ + public ServiceCall listV2Policies(ListV2PoliciesOptions listV2PoliciesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listV2PoliciesOptions, + "listV2PoliciesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listV2Policies"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listV2PoliciesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listV2PoliciesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listV2PoliciesOptions.accountId())); + if (listV2PoliciesOptions.iamId() != null) { + builder.query("iam_id", String.valueOf(listV2PoliciesOptions.iamId())); + } + if (listV2PoliciesOptions.accessGroupId() != null) { + builder.query("access_group_id", String.valueOf(listV2PoliciesOptions.accessGroupId())); + } + if (listV2PoliciesOptions.type() != null) { + builder.query("type", String.valueOf(listV2PoliciesOptions.type())); + } + if (listV2PoliciesOptions.serviceType() != null) { + builder.query("service_type", String.valueOf(listV2PoliciesOptions.serviceType())); + } + if (listV2PoliciesOptions.serviceName() != null) { + builder.query("service_name", String.valueOf(listV2PoliciesOptions.serviceName())); + } + if (listV2PoliciesOptions.serviceGroupId() != null) { + builder.query("service_group_id", String.valueOf(listV2PoliciesOptions.serviceGroupId())); + } + if (listV2PoliciesOptions.sort() != null) { + builder.query("sort", String.valueOf(listV2PoliciesOptions.sort())); + } + if (listV2PoliciesOptions.format() != null) { + builder.query("format", String.valueOf(listV2PoliciesOptions.format())); + } + if (listV2PoliciesOptions.state() != null) { + builder.query("state", String.valueOf(listV2PoliciesOptions.state())); + } + if (listV2PoliciesOptions.limit() != null) { + builder.query("limit", String.valueOf(listV2PoliciesOptions.limit())); + } + if (listV2PoliciesOptions.start() != null) { + builder.query("start", String.valueOf(listV2PoliciesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a policy. + * + * Creates a policy to grant access between a subject and a resource. Currently, there is one type of a v2/policy: + * **access**. A policy administrator might want to create an access policy that grants access to a user, service-id, + * or an access group. + * + * ### Access + * + * To create an access policy, use **`"type": "access"`** in the body. The supported subject attributes are + * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute to assign access to a user or + * service-id. Use the **`access_group_id`** subject attribute to assign access to an access group. Assign roles that + * are supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or + * **`service_group_id`** attribute and the **`accountId`** attribute. In the rule field, you can specify a single + * condition by using **`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`** with a + * combination **`operator`**. The possible combination operators are **`and`** and **`or`**. + * + * Currently, we support two types of patterns: + * + * 1. `time-based`: Used to specify a time-based restriction + * + * Combine conditions to specify a time-based restriction (e.g., access only during business hours, during the + * Monday-Friday work week). For example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following + * rule: + * ```json + * "rule": { + * "operator": "and", + * "conditions": [{ + * "key": "{{environment.attributes.day_of_week}}", + * "operator": "dayOfWeekAnyOf", + * "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] + * }, + * "key": "{{environment.attributes.current_time}}", + * "operator": "timeGreaterThanOrEquals", + * "value": "09:00:00+00:00" + * }, + * "key": "{{environment.attributes.current_time}}", + * "operator": "timeLessThanOrEquals", + * "value": "17:00:00+00:00" + * }] + * } + * ``` You can use the following operators in the **`key`** and **`value`** pair: + * ``` + * 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', + * 'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan', 'dateGreaterThanOrEquals', + * 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', + * 'dayOfWeekEquals', 'dayOfWeekAnyOf' + * ``` + * + * The pattern field that matches the rule is required when rule is provided. For the business hour rule example + * above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions + * operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) and + * [Limiting access with time-based conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the + * subject is a locked service-id, the request will fail. + * + * 2. `attribute-based`: Used to specify a combination of OR/AND based conditions applied on resource attributes. + * + * Combine conditions to specify an attribute-based condition using AND/OR-based operators. + * + * For example, a policy can grant access based on multiple conditions applied on the resource attributes below: + * ```json + * "pattern": "attribute-based-condition:resource:literal-and-wildcard" + * "rule": { + * "operator": "or", + * "conditions": [ + * { + * "operator": "and", + * "conditions": [ + * { + * "key": "{{resource.attributes.prefix}}", + * "operator": "stringEquals", + * "value": "home/test" + * }, + * { + * "key": "{{environment.attributes.delimiter}}", + * "operator": "stringEquals", + * "value": "/" + * } + * ] + * }, + * { + * "key": "{{resource.attributes.path}}", + * "operator": "stringMatch", + * "value": "home/David/_*" + * } + * ] + * } + * ``` + * + * In addition to satisfying the `resources` section, the policy grants permission only if either the `path` begins + * with `home/David/` **OR** the `prefix` is `home/test` and the `delimiter` is `/`. This mechanism helps you + * consolidate multiple policies in to a single policy, making policies easier to administer and stay within the + * policy limit for an account. View the list of operators that can be used in the condition + * [here](/docs/account?topic=account-wildcard#string-comparisons). + * + * ### Authorization + * + * Authorization policies are supported by services on a case by case basis. Refer to service documentation to verify + * their support of authorization policies. To create an authorization policy, use **`"type": "authorization"`** in + * the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject + * attributes might be provided. The following attributes are supported: + * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are + * supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access + * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject + * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. + * + * ### Attribute Operators + * + * Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators are available. For more + * information, see [Assigning access by using wildcard + * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). + * + * ### Attribute Validations + * + * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like + * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated + * against Global Catalog locations. + * + * @param createV2PolicyOptions the {@link CreateV2PolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link V2Policy} + */ + public ServiceCall createV2Policy(CreateV2PolicyOptions createV2PolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createV2PolicyOptions, + "createV2PolicyOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createV2Policy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createV2PolicyOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createV2PolicyOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.add("control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.control())); + contentJson.addProperty("type", createV2PolicyOptions.type()); + if (createV2PolicyOptions.description() != null) { + contentJson.addProperty("description", createV2PolicyOptions.description()); + } + if (createV2PolicyOptions.subject() != null) { + contentJson.add("subject", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.subject())); + } + if (createV2PolicyOptions.resource() != null) { + contentJson.add("resource", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.resource())); + } + if (createV2PolicyOptions.pattern() != null) { + contentJson.addProperty("pattern", createV2PolicyOptions.pattern()); + } + if (createV2PolicyOptions.rule() != null) { + contentJson.add("rule", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.rule())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a policy. + * + * Update a policy to grant access between a subject and a resource. A policy administrator might want to update an + * existing policy. + * + * ### Access + * + * To update an access policy, use **`"type": "access"`** in the body. The supported subject attributes are + * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute to assign access to a user or + * service-id. Use the **`access_group_id`** subject attribute to assign access to an access group. Assign roles that + * are supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or + * **`service_group_id`** attribute and the **`accountId`** attribute. In the rule field, you can specify a single + * condition by using **`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`** with a + * combination **`operator`**. The possible combination operators are **`and`** and **`or`**. + * + * Currently, we support two types of patterns: + * + * 1. `time-based`: Used to specify a time-based restriction + * + * Combine conditions to specify a time-based restriction (e.g., access only during business hours, during the + * Monday-Friday work week). For example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following + * rule: + * ```json + * "rule": { + * "operator": "and", + * "conditions": [{ + * "key": "{{environment.attributes.day_of_week}}", + * "operator": "dayOfWeekAnyOf", + * "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] + * }, + * "key": "{{environment.attributes.current_time}}", + * "operator": "timeGreaterThanOrEquals", + * "value": "09:00:00+00:00" + * }, + * "key": "{{environment.attributes.current_time}}", + * "operator": "timeLessThanOrEquals", + * "value": "17:00:00+00:00" + * }] + * } + * ``` You can use the following operators in the **`key`** and **`value`** pair: + * ``` + * 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', + * 'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan', 'dateGreaterThanOrEquals', + * 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', + * 'dayOfWeekEquals', 'dayOfWeekAnyOf' + * ``` The pattern field that matches the rule is required when rule is provided. For the business hour rule example + * above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions + * operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) and + * [Limiting access with time-based conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the + * subject is a locked service-id, the request will fail. + * + * 2. `attribute-based`: Used to specify a combination of OR/AND based conditions applied on resource attributes. + * + * Combine conditions to specify an attribute-based condition using AND/OR-based operators. + * + * For example, a policy can grant access based on multiple conditions applied on the resource attributes below: + * ```json + * "pattern": "attribute-based-condition:resource:literal-and-wildcard" + * "rule": { + * "operator": "or", + * "conditions": [ + * { + * "operator": "and", + * "conditions": [ + * { + * "key": "{{resource.attributes.prefix}}", + * "operator": "stringEquals", + * "value": "home/test" + * }, + * { + * "key": "{{environment.attributes.delimiter}}", + * "operator": "stringEquals", + * "value": "/" + * } + * ] + * }, + * { + * "key": "{{resource.attributes.path}}", + * "operator": "stringMatch", + * "value": "home/David/_*" + * } + * ] + * } + * ``` + * + * In addition to satisfying the `resources` section, the policy grants permission only if either the `path` begins + * with `home/David/` **OR** the `prefix` is `home/test` and the `delimiter` is `/`. This mechanism helps you + * consolidate multiple policies in to a single policy, making policies easier to administer and stay within the + * policy limit for an account. View the list of operators that can be used in the condition + * [here](/docs/account?topic=account-wildcard#string-comparisons). + * + * ### Authorization + * + * To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match + * the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following + * attributes are supported: + * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are + * supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access + * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject + * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. + * + * ### Attribute Operators + * + * Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators are available. For more + * information, see [Assigning access by using wildcard + * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). + * + * ### Attribute Validations + * + * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like + * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated + * against Global Catalog locations. + * + * @param replaceV2PolicyOptions the {@link ReplaceV2PolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link V2Policy} + */ + public ServiceCall replaceV2Policy(ReplaceV2PolicyOptions replaceV2PolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceV2PolicyOptions, + "replaceV2PolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("id", replaceV2PolicyOptions.id()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceV2Policy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replaceV2PolicyOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.add("control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.control())); + contentJson.addProperty("type", replaceV2PolicyOptions.type()); + if (replaceV2PolicyOptions.description() != null) { + contentJson.addProperty("description", replaceV2PolicyOptions.description()); + } + if (replaceV2PolicyOptions.subject() != null) { + contentJson.add("subject", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.subject())); + } + if (replaceV2PolicyOptions.resource() != null) { + contentJson.add("resource", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.resource())); + } + if (replaceV2PolicyOptions.pattern() != null) { + contentJson.addProperty("pattern", replaceV2PolicyOptions.pattern()); + } + if (replaceV2PolicyOptions.rule() != null) { + contentJson.add("rule", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.rule())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a policy by ID. + * + * Retrieve a policy by providing a policy ID. + * + * @param getV2PolicyOptions the {@link GetV2PolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link V2PolicyTemplateMetaData} + */ + public ServiceCall getV2Policy(GetV2PolicyOptions getV2PolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getV2PolicyOptions, + "getV2PolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("id", getV2PolicyOptions.id()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getV2Policy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getV2PolicyOptions.format() != null) { + builder.query("format", String.valueOf(getV2PolicyOptions.format())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a policy by ID. + * + * Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service + * ID. If the subject of the policy is a locked service-id, the request will fail. + * + * @param deleteV2PolicyOptions the {@link DeleteV2PolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteV2Policy(DeleteV2PolicyOptions deleteV2PolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteV2PolicyOptions, + "deleteV2PolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("id", deleteV2PolicyOptions.id()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteV2Policy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * List policy templates by attributes. + * + * List policy templates and filter by attributes by using query parameters. The following attributes are supported: + * `account_id`, `policy_service_name`, `policy_service_type`, `policy_service_group_id` and `policy_type`. + * `account_id` is a required query parameter. These attributes `policy_service_name`, `policy_service_type` and + * `policy_service_group_id` are mutually exclusive. Only policy templates that have the specified attributes and that + * the caller has read access to are returned. If the caller does not have read access to any policy templates an + * empty array is returned. + * + * @param listPolicyTemplatesOptions the {@link ListPolicyTemplatesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateCollection} + */ + public ServiceCall listPolicyTemplates(ListPolicyTemplatesOptions listPolicyTemplatesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyTemplatesOptions, + "listPolicyTemplatesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyTemplates"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listPolicyTemplatesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listPolicyTemplatesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listPolicyTemplatesOptions.accountId())); + if (listPolicyTemplatesOptions.state() != null) { + builder.query("state", String.valueOf(listPolicyTemplatesOptions.state())); + } + if (listPolicyTemplatesOptions.name() != null) { + builder.query("name", String.valueOf(listPolicyTemplatesOptions.name())); + } + if (listPolicyTemplatesOptions.policyServiceType() != null) { + builder.query("policy_service_type", String.valueOf(listPolicyTemplatesOptions.policyServiceType())); + } + if (listPolicyTemplatesOptions.policyServiceName() != null) { + builder.query("policy_service_name", String.valueOf(listPolicyTemplatesOptions.policyServiceName())); + } + if (listPolicyTemplatesOptions.policyServiceGroupId() != null) { + builder.query("policy_service_group_id", String.valueOf(listPolicyTemplatesOptions.policyServiceGroupId())); + } + if (listPolicyTemplatesOptions.policyType() != null) { + builder.query("policy_type", String.valueOf(listPolicyTemplatesOptions.policyType())); + } + if (listPolicyTemplatesOptions.limit() != null) { + builder.query("limit", String.valueOf(listPolicyTemplatesOptions.limit())); + } + if (listPolicyTemplatesOptions.start() != null) { + builder.query("start", String.valueOf(listPolicyTemplatesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a policy template. + * + * Create a policy template. Policy templates define a policy without requiring a subject, and you can use them to + * grant access to multiple subjects. + * + * @param createPolicyTemplateOptions the {@link CreatePolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateLimitData} + */ + public ServiceCall createPolicyTemplate(CreatePolicyTemplateOptions createPolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateOptions, + "createPolicyTemplateOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createPolicyTemplateOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createPolicyTemplateOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("name", createPolicyTemplateOptions.name()); + contentJson.addProperty("account_id", createPolicyTemplateOptions.accountId()); + contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateOptions.policy())); + if (createPolicyTemplateOptions.description() != null) { + contentJson.addProperty("description", createPolicyTemplateOptions.description()); + } + if (createPolicyTemplateOptions.committed() != null) { + contentJson.addProperty("committed", createPolicyTemplateOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve latest version of a policy template. + * + * Retrieve the latest version of a policy template by providing a policy template ID. + * + * @param getPolicyTemplateOptions the {@link GetPolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} + */ + public ServiceCall getPolicyTemplate(GetPolicyTemplateOptions getPolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyTemplateOptions, + "getPolicyTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", getPolicyTemplateOptions.policyTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getPolicyTemplateOptions.state() != null) { + builder.query("state", String.valueOf(getPolicyTemplateOptions.state())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a policy template. + * + * Delete a policy template by providing the policy template ID. This deletes all versions of this template. A policy + * template can't be deleted if any version of the template is assigned to one or more child accounts. You must remove + * the policy assignments first. + * + * @param deletePolicyTemplateOptions the {@link DeletePolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deletePolicyTemplate(DeletePolicyTemplateOptions deletePolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyTemplateOptions, + "deletePolicyTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", deletePolicyTemplateOptions.policyTemplateId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a new policy template version. + * + * Create a new version of a policy template. Use this if you need to make updates to a policy template that is + * committed. + * + * @param createPolicyTemplateVersionOptions the {@link CreatePolicyTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateLimitData} + */ + public ServiceCall createPolicyTemplateVersion(CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateVersionOptions, + "createPolicyTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", createPolicyTemplateVersionOptions.policyTemplateId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateVersionOptions.policy())); + if (createPolicyTemplateVersionOptions.name() != null) { + contentJson.addProperty("name", createPolicyTemplateVersionOptions.name()); + } + if (createPolicyTemplateVersionOptions.description() != null) { + contentJson.addProperty("description", createPolicyTemplateVersionOptions.description()); + } + if (createPolicyTemplateVersionOptions.committed() != null) { + contentJson.addProperty("committed", createPolicyTemplateVersionOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve policy template versions. + * + * Retrieve the versions of a policy template by providing a policy template ID. + * + * @param listPolicyTemplateVersionsOptions the {@link ListPolicyTemplateVersionsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateVersionsCollection} + */ + public ServiceCall listPolicyTemplateVersions(ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyTemplateVersionsOptions, + "listPolicyTemplateVersionsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", listPolicyTemplateVersionsOptions.policyTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyTemplateVersions"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listPolicyTemplateVersionsOptions.state() != null) { + builder.query("state", String.valueOf(listPolicyTemplateVersionsOptions.state())); + } + if (listPolicyTemplateVersionsOptions.limit() != null) { + builder.query("limit", String.valueOf(listPolicyTemplateVersionsOptions.limit())); + } + if (listPolicyTemplateVersionsOptions.start() != null) { + builder.query("start", String.valueOf(listPolicyTemplateVersionsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a policy template version. + * + * Update a specific version of a policy template. You can use this only if the version isn't committed. + * + * @param replacePolicyTemplateOptions the {@link ReplacePolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} + */ + public ServiceCall replacePolicyTemplate(ReplacePolicyTemplateOptions replacePolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replacePolicyTemplateOptions, + "replacePolicyTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", replacePolicyTemplateOptions.policyTemplateId()); + pathParamsMap.put("version", replacePolicyTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replacePolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replacePolicyTemplateOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyTemplateOptions.policy())); + if (replacePolicyTemplateOptions.name() != null) { + contentJson.addProperty("name", replacePolicyTemplateOptions.name()); + } + if (replacePolicyTemplateOptions.description() != null) { + contentJson.addProperty("description", replacePolicyTemplateOptions.description()); + } + if (replacePolicyTemplateOptions.committed() != null) { + contentJson.addProperty("committed", replacePolicyTemplateOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a policy template version. + * + * Delete a specific version of a policy template by providing a policy template ID and version number. You can't + * delete a policy template version that is assigned to one or more child accounts. You must remove the policy + * assignments first. + * + * @param deletePolicyTemplateVersionOptions the {@link DeletePolicyTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deletePolicyTemplateVersion(DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyTemplateVersionOptions, + "deletePolicyTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", deletePolicyTemplateVersionOptions.policyTemplateId()); + pathParamsMap.put("version", deletePolicyTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a policy template version. + * + * Retrieve a policy template by providing a policy template ID and version number. + * + * @param getPolicyTemplateVersionOptions the {@link GetPolicyTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} + */ + public ServiceCall getPolicyTemplateVersion(GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyTemplateVersionOptions, + "getPolicyTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", getPolicyTemplateVersionOptions.policyTemplateId()); + pathParamsMap.put("version", getPolicyTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyTemplateVersion"); + 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); + } + + /** + * Commit a policy template version. + * + * Commit a policy template version. You can make no further changes to the policy template once it's committed. If + * you need to make updates after committing a version, create a new version. + * + * @param commitPolicyTemplateOptions the {@link CommitPolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall commitPolicyTemplate(CommitPolicyTemplateOptions commitPolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(commitPolicyTemplateOptions, + "commitPolicyTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", commitPolicyTemplateOptions.policyTemplateId()); + pathParamsMap.put("version", commitPolicyTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}/commit", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitPolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get policy template assignments. + * + * Get policy template assignments by attributes. The following attributes are supported: + * `account_id`, `template_id`, `template_version`, `sort`. + * `account_id` is a required query parameter. Only policy template assignments that have the specified attributes and + * that the caller has read access to are returned. If the caller does not have read access to any policy template + * assignments an empty array is returned. + * + * @param listPolicyAssignmentsOptions the {@link ListPolicyAssignmentsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateAssignmentCollection} + */ + public ServiceCall listPolicyAssignments(ListPolicyAssignmentsOptions listPolicyAssignmentsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyAssignmentsOptions, + "listPolicyAssignmentsOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyAssignments"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listPolicyAssignmentsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listPolicyAssignmentsOptions.acceptLanguage()); + } + builder.query("version", String.valueOf(listPolicyAssignmentsOptions.version())); + builder.query("account_id", String.valueOf(listPolicyAssignmentsOptions.accountId())); + if (listPolicyAssignmentsOptions.templateId() != null) { + builder.query("template_id", String.valueOf(listPolicyAssignmentsOptions.templateId())); + } + if (listPolicyAssignmentsOptions.templateVersion() != null) { + builder.query("template_version", String.valueOf(listPolicyAssignmentsOptions.templateVersion())); + } + if (listPolicyAssignmentsOptions.limit() != null) { + builder.query("limit", String.valueOf(listPolicyAssignmentsOptions.limit())); + } + if (listPolicyAssignmentsOptions.start() != null) { + builder.query("start", String.valueOf(listPolicyAssignmentsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a policy authorization template assignment. + * + * Assign a policy template to child accounts and account groups. This creates the policy in the accounts and account + * groups that you specify. + * + * @param createPolicyTemplateAssignmentOptions the {@link CreatePolicyTemplateAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyAssignmentV1Collection} + */ + public ServiceCall createPolicyTemplateAssignment(CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateAssignmentOptions, + "createPolicyTemplateAssignmentOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplateAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createPolicyTemplateAssignmentOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createPolicyTemplateAssignmentOptions.acceptLanguage()); + } + builder.query("version", String.valueOf(createPolicyTemplateAssignmentOptions.version())); + final JsonObject contentJson = new JsonObject(); + contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateAssignmentOptions.target())); + contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateAssignmentOptions.templates())); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a policy assignment. + * + * Retrieve a policy template assignment by providing a policy assignment ID. + * + * @param getPolicyAssignmentOptions the {@link GetPolicyAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateAssignmentItems} + */ + public ServiceCall getPolicyAssignment(GetPolicyAssignmentOptions getPolicyAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyAssignmentOptions, + "getPolicyAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", getPolicyAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.query("version", String.valueOf(getPolicyAssignmentOptions.version())); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a policy authorization type assignment. + * + * Update a policy assignment by providing a policy assignment ID. + * + * @param updatePolicyAssignmentOptions the {@link UpdatePolicyAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyAssignmentV1} + */ + public ServiceCall updatePolicyAssignment(UpdatePolicyAssignmentOptions updatePolicyAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updatePolicyAssignmentOptions, + "updatePolicyAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", updatePolicyAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updatePolicyAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updatePolicyAssignmentOptions.ifMatch()); + builder.query("version", String.valueOf(updatePolicyAssignmentOptions.version())); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("template_version", updatePolicyAssignmentOptions.templateVersion()); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Remove a policy assignment. + * + * Remove a policy template assignment by providing a policy assignment ID. You can't delete a policy assignment if + * the status is "in_progress". + * + * @param deletePolicyAssignmentOptions the {@link DeletePolicyAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deletePolicyAssignment(DeletePolicyAssignmentOptions deletePolicyAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyAssignmentOptions, + "deletePolicyAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", deletePolicyAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve Access Management account settings by account ID. + * + * Retrieve Access Management settings for an account by providing the account ID. + * + * @param getSettingsOptions the {@link GetSettingsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccountSettingsAccessManagement} + */ + public ServiceCall getSettings(GetSettingsOptions getSettingsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getSettingsOptions, + "getSettingsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("account_id", getSettingsOptions.accountId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/settings/access_management", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getSettings"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getSettingsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", getSettingsOptions.acceptLanguage()); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update Access Management account settings by account ID. + * + * Update access management settings for an account. + * + * ### External Account Identity Interaction + * + * Update the way identities within an external account are allowed to interact with the requested account by + * providing: + * * the `account_id` as a parameter + * * one or more external account ID(s) and state for the specific identity in the request body + * + * External account identity interaction includes the following `identity_types`: `user` (user identities that are + * defined as [IBMid's](https://cloud.ibm.com/docs/account?topic=account-identity-overview#users-bestpract)), + * `service_id` (defined as [IAM + * ServiceIds](https://cloud.ibm.com/docs/account?topic=account-identity-overview#serviceid-bestpract)), `service` + * (defined by a service’s [CRN](https://cloud.ibm.com/docs/account?topic=account-crn)). To update an Identity’s + * setting, the `state` and `external_allowed_accounts` fields are required. + * + * Different identity states are: + * * "enabled": An identity type is allowed to access resources in the account provided it has access policies on + * those resources. + * * "limited": An identity type is allowed to access resources in the account provided it has access policies on + * those resources AND it is associated with either the account the resources are in or one of the allowed accounts. + * This setting uses the "external_allowed_accounts" list. + * * "monitor": It has no direct impact on an Identity’s access. Instead, it creates AT events for access decisions as + * if the account were in a limited “state”. + * + * **Note**: The state "enabled" is a special case. In this case, access is given to all accounts and there is no need + * to specify a particular list. Therefore, when updating "state" to "enabled" for an identity type + * "external_allowed_accounts" should be left empty. + * + * @param updateSettingsOptions the {@link UpdateSettingsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccountSettingsAccessManagement} + */ + public ServiceCall updateSettings(UpdateSettingsOptions updateSettingsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateSettingsOptions, + "updateSettingsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("account_id", updateSettingsOptions.accountId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/settings/access_management", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateSettings"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updateSettingsOptions.ifMatch()); + if (updateSettingsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", updateSettingsOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + if (updateSettingsOptions.externalAccountIdentityInteraction() != null) { + contentJson.add("external_account_identity_interaction", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateSettingsOptions.externalAccountIdentityInteraction())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * List action control templates by attributes. + * + * List action control templates and filter by attributes by using query parameters. The following attributes are + * supported: + * `account_id` + * `account_id` is a required query parameter. Only action control templates that have the specified attributes and + * that the caller has read access to are returned. If the caller does not have read access to any action control + * templates an empty array is returned. + * + * @param listActionControlTemplatesOptions the {@link ListActionControlTemplatesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplateCollection} + */ + public ServiceCall listActionControlTemplates(ListActionControlTemplatesOptions listActionControlTemplatesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlTemplatesOptions, + "listActionControlTemplatesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlTemplates"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listActionControlTemplatesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listActionControlTemplatesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listActionControlTemplatesOptions.accountId())); + if (listActionControlTemplatesOptions.limit() != null) { + builder.query("limit", String.valueOf(listActionControlTemplatesOptions.limit())); + } + if (listActionControlTemplatesOptions.start() != null) { + builder.query("start", String.valueOf(listActionControlTemplatesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create an action control template. + * + * Create an action control template. Action control templates define a service action control. + * + * @param createActionControlTemplateOptions the {@link CreateActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall createActionControlTemplate(CreateActionControlTemplateOptions createActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateOptions, + "createActionControlTemplateOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createActionControlTemplateOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createActionControlTemplateOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("name", createActionControlTemplateOptions.name()); + contentJson.addProperty("account_id", createActionControlTemplateOptions.accountId()); + if (createActionControlTemplateOptions.description() != null) { + contentJson.addProperty("description", createActionControlTemplateOptions.description()); + } + if (createActionControlTemplateOptions.committed() != null) { + contentJson.addProperty("committed", createActionControlTemplateOptions.committed()); + } + if (createActionControlTemplateOptions.actionControl() != null) { + contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateOptions.actionControl())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve the latest version of an action control template. + * + * Retrieve the latest version of an action control template by providing an action control template ID. + * + * @param getActionControlTemplateOptions the {@link GetActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall getActionControlTemplate(GetActionControlTemplateOptions getActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlTemplateOptions, + "getActionControlTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", getActionControlTemplateOptions.actionControlTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getActionControlTemplateOptions.state() != null) { + builder.query("state", String.valueOf(getActionControlTemplateOptions.state())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete an action control template. + * + * Delete an action control template by providing the action control template ID. This deletes all versions of this + * template. An action control template can't be deleted if any version of the template is assigned to one or more + * child accounts. You must remove the action control assignments first. + * + * @param deleteActionControlTemplateOptions the {@link DeleteActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteActionControlTemplate(DeleteActionControlTemplateOptions deleteActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlTemplateOptions, + "deleteActionControlTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", deleteActionControlTemplateOptions.actionControlTemplateId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a new action control template version. + * + * Create a new version of an action control template. Use this if you need to make updates to an action control + * template that is committed. + * + * @param createActionControlTemplateVersionOptions the {@link CreateActionControlTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall createActionControlTemplateVersion(CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateVersionOptions, + "createActionControlTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", createActionControlTemplateVersionOptions.actionControlTemplateId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + if (createActionControlTemplateVersionOptions.name() != null) { + contentJson.addProperty("name", createActionControlTemplateVersionOptions.name()); + } + if (createActionControlTemplateVersionOptions.description() != null) { + contentJson.addProperty("description", createActionControlTemplateVersionOptions.description()); + } + if (createActionControlTemplateVersionOptions.actionControl() != null) { + contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateVersionOptions.actionControl())); + } + if (createActionControlTemplateVersionOptions.committed() != null) { + contentJson.addProperty("committed", createActionControlTemplateVersionOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve action control template versions. + * + * Retrieve the versions of an action control template by providing an action control template ID. + * + * @param listActionControlTemplateVersionsOptions the {@link ListActionControlTemplateVersionsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplateVersionsCollection} + */ + public ServiceCall listActionControlTemplateVersions(ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlTemplateVersionsOptions, + "listActionControlTemplateVersionsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", listActionControlTemplateVersionsOptions.actionControlTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlTemplateVersions"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listActionControlTemplateVersionsOptions.state() != null) { + builder.query("state", String.valueOf(listActionControlTemplateVersionsOptions.state())); + } + if (listActionControlTemplateVersionsOptions.limit() != null) { + builder.query("limit", String.valueOf(listActionControlTemplateVersionsOptions.limit())); + } + if (listActionControlTemplateVersionsOptions.start() != null) { + builder.query("start", String.valueOf(listActionControlTemplateVersionsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update an action control template version. + * + * Update a specific version of an action control template. You can use this only if the version isn't committed. + * + * @param replaceActionControlTemplateOptions the {@link ReplaceActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall replaceActionControlTemplate(ReplaceActionControlTemplateOptions replaceActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceActionControlTemplateOptions, + "replaceActionControlTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", replaceActionControlTemplateOptions.actionControlTemplateId()); + pathParamsMap.put("version", replaceActionControlTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replaceActionControlTemplateOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + if (replaceActionControlTemplateOptions.name() != null) { + contentJson.addProperty("name", replaceActionControlTemplateOptions.name()); + } + if (replaceActionControlTemplateOptions.description() != null) { + contentJson.addProperty("description", replaceActionControlTemplateOptions.description()); + } + if (replaceActionControlTemplateOptions.actionControl() != null) { + contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceActionControlTemplateOptions.actionControl())); + } + if (replaceActionControlTemplateOptions.committed() != null) { + contentJson.addProperty("committed", replaceActionControlTemplateOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete an action control template version. + * + * Delete a specific version of an action control template by providing an action control template ID and version + * number. You can't delete an action control template version that is assigned to one or more child accounts. You + * must remove the action control assignments first. + * + * @param deleteActionControlTemplateVersionOptions the {@link DeleteActionControlTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteActionControlTemplateVersion(DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlTemplateVersionOptions, + "deleteActionControlTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", deleteActionControlTemplateVersionOptions.actionControlTemplateId()); + pathParamsMap.put("version", deleteActionControlTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve an action control template version. + * + * Retrieve an action control template by providing an action control template ID and version number. + * + * @param getActionControlTemplateVersionOptions the {@link GetActionControlTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall getActionControlTemplateVersion(GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlTemplateVersionOptions, + "getActionControlTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", getActionControlTemplateVersionOptions.actionControlTemplateId()); + pathParamsMap.put("version", getActionControlTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlTemplateVersion"); + 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); + } + + /** + * Commit an action control template version. + * + * Commit an action control template version. You cannot make any further changes to the action control template once + * it's committed. If you have to make updates after committing a version, create a new version. + * + * @param commitActionControlTemplateOptions the {@link CommitActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall commitActionControlTemplate(CommitActionControlTemplateOptions commitActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(commitActionControlTemplateOptions, + "commitActionControlTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", commitActionControlTemplateOptions.actionControlTemplateId()); + pathParamsMap.put("version", commitActionControlTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}/commit", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get action control template assignments. + * + * Get action control template assignments by attributes. The following attributes are supported: + * `account_id`, `template_id`, `template_version`, `sort`. + * `account_id` is a required query parameter. Only action control template assignments with the specified attributes + * and accessible by the caller are returned. If the caller does not have read access to any action control template + * assignments, an empty array is returned. + * + * @param listActionControlAssignmentsOptions the {@link ListActionControlAssignmentsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignmentCollection} + */ + public ServiceCall listActionControlAssignments(ListActionControlAssignmentsOptions listActionControlAssignmentsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlAssignmentsOptions, + "listActionControlAssignmentsOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlAssignments"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listActionControlAssignmentsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listActionControlAssignmentsOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listActionControlAssignmentsOptions.accountId())); + if (listActionControlAssignmentsOptions.templateId() != null) { + builder.query("template_id", String.valueOf(listActionControlAssignmentsOptions.templateId())); + } + if (listActionControlAssignmentsOptions.templateVersion() != null) { + builder.query("template_version", String.valueOf(listActionControlAssignmentsOptions.templateVersion())); + } + if (listActionControlAssignmentsOptions.limit() != null) { + builder.query("limit", String.valueOf(listActionControlAssignmentsOptions.limit())); + } + if (listActionControlAssignmentsOptions.start() != null) { + builder.query("start", String.valueOf(listActionControlAssignmentsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create an action control template assignment. + * + * Assign an action control template to child accounts and account groups. This creates the action control in the + * accounts and account groups that you specify. + * + * @param createActionControlTemplateAssignmentOptions the {@link CreateActionControlTemplateAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignmentCollection} + */ + public ServiceCall createActionControlTemplateAssignment(CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateAssignmentOptions, + "createActionControlTemplateAssignmentOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplateAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createActionControlTemplateAssignmentOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createActionControlTemplateAssignmentOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateAssignmentOptions.target())); + contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateAssignmentOptions.templates())); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve an action control assignment. + * + * Retrieve an action control template assignment by providing an action control assignment ID. + * + * @param getActionControlAssignmentOptions the {@link GetActionControlAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignment} + */ + public ServiceCall getActionControlAssignment(GetActionControlAssignmentOptions getActionControlAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlAssignmentOptions, + "getActionControlAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", getActionControlAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlAssignment"); + 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 an action control assignment. + * + * Update an action control assignment by providing an action control assignment ID. + * + * @param updateActionControlAssignmentOptions the {@link UpdateActionControlAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignment} + */ + public ServiceCall updateActionControlAssignment(UpdateActionControlAssignmentOptions updateActionControlAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateActionControlAssignmentOptions, + "updateActionControlAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", updateActionControlAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateActionControlAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updateActionControlAssignmentOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("template_version", updateActionControlAssignmentOptions.templateVersion()); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Remove an action control assignment. + * + * Remove an action control template assignment by providing an action control assignment ID. You can't delete an + * action control assignment if the status is "in_progress". + * + * @param deleteActionControlAssignmentOptions the {@link DeleteActionControlAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteActionControlAssignment(DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlAssignmentOptions, + "deleteActionControlAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", deleteActionControlAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * List role templates by attributes. + * + * List role templates and filter by attributes by using query parameters. The following attributes are supported: + * `account_id`, `name`, `role_name`, `role_service_name`, `state`, `limit`, `start`. + * `account_id` is a required query parameter. Only role templates that have the specified attributes and that the + * caller has read access to are returned. If the caller does not have read access to any role templates an empty + * array is returned. + * + * @param listRoleTemplatesOptions the {@link ListRoleTemplatesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplateCollection} + */ + public ServiceCall listRoleTemplates(ListRoleTemplatesOptions listRoleTemplatesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleTemplatesOptions, + "listRoleTemplatesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleTemplates"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listRoleTemplatesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listRoleTemplatesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listRoleTemplatesOptions.accountId())); + if (listRoleTemplatesOptions.name() != null) { + builder.query("name", String.valueOf(listRoleTemplatesOptions.name())); + } + if (listRoleTemplatesOptions.roleName() != null) { + builder.query("role_name", String.valueOf(listRoleTemplatesOptions.roleName())); + } + if (listRoleTemplatesOptions.roleServiceName() != null) { + builder.query("role_service_name", String.valueOf(listRoleTemplatesOptions.roleServiceName())); + } + if (listRoleTemplatesOptions.state() != null) { + builder.query("state", String.valueOf(listRoleTemplatesOptions.state())); + } + if (listRoleTemplatesOptions.limit() != null) { + builder.query("limit", String.valueOf(listRoleTemplatesOptions.limit())); + } + if (listRoleTemplatesOptions.start() != null) { + builder.query("start", String.valueOf(listRoleTemplatesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create role template. + * + * Create a role template. Role templates define roles from an existing system or service defined role. + * + * @param createRoleTemplateOptions the {@link CreateRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall createRoleTemplate(CreateRoleTemplateOptions createRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateOptions, + "createRoleTemplateOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createRoleTemplateOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createRoleTemplateOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("name", createRoleTemplateOptions.name()); + contentJson.addProperty("account_id", createRoleTemplateOptions.accountId()); + if (createRoleTemplateOptions.description() != null) { + contentJson.addProperty("description", createRoleTemplateOptions.description()); + } + if (createRoleTemplateOptions.committed() != null) { + contentJson.addProperty("committed", createRoleTemplateOptions.committed()); + } + if (createRoleTemplateOptions.role() != null) { + contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateOptions.role())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve the latest version of a role template. + * + * Retrieve the latest version of a role template by providing a role template ID. + * + * @param getRoleTemplateOptions the {@link GetRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall getRoleTemplate(GetRoleTemplateOptions getRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleTemplateOptions, + "getRoleTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", getRoleTemplateOptions.roleTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getRoleTemplateOptions.state() != null) { + builder.query("state", String.valueOf(getRoleTemplateOptions.state())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a Role template. + * + * Delete a role template by providing the role template ID. This deletes all versions of this template. A role + * template can't be deleted if any version of the template is assigned to one or more child accounts. You must remove + * the role assignments first. + * + * @param deleteRoleTemplateOptions the {@link DeleteRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteRoleTemplate(DeleteRoleTemplateOptions deleteRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleTemplateOptions, + "deleteRoleTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", deleteRoleTemplateOptions.roleTemplateId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a new role template version. + * + * Create a new version of a role template. Use this if you need to make updates to a role template that is committed. + * + * @param createRoleTemplateVersionOptions the {@link CreateRoleTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall createRoleTemplateVersion(CreateRoleTemplateVersionOptions createRoleTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateVersionOptions, + "createRoleTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", createRoleTemplateVersionOptions.roleTemplateId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + if (createRoleTemplateVersionOptions.name() != null) { + contentJson.addProperty("name", createRoleTemplateVersionOptions.name()); + } + if (createRoleTemplateVersionOptions.description() != null) { + contentJson.addProperty("description", createRoleTemplateVersionOptions.description()); + } + if (createRoleTemplateVersionOptions.role() != null) { + contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateVersionOptions.role())); + } + if (createRoleTemplateVersionOptions.committed() != null) { + contentJson.addProperty("committed", createRoleTemplateVersionOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve role template versions. + * + * Retrieve the versions of a role template by providing a role template ID. + * + * @param listRoleTemplateVersionsOptions the {@link ListRoleTemplateVersionsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplateVersionsCollection} + */ + public ServiceCall listRoleTemplateVersions(ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleTemplateVersionsOptions, + "listRoleTemplateVersionsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", listRoleTemplateVersionsOptions.roleTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleTemplateVersions"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listRoleTemplateVersionsOptions.state() != null) { + builder.query("state", String.valueOf(listRoleTemplateVersionsOptions.state())); + } + if (listRoleTemplateVersionsOptions.limit() != null) { + builder.query("limit", String.valueOf(listRoleTemplateVersionsOptions.limit())); + } + if (listRoleTemplateVersionsOptions.start() != null) { + builder.query("start", String.valueOf(listRoleTemplateVersionsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a role template version. + * + * Update a specific version of a role template. You can use this only if the version isn't committed. + * + * @param replaceRoleTemplateOptions the {@link ReplaceRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall replaceRoleTemplate(ReplaceRoleTemplateOptions replaceRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceRoleTemplateOptions, + "replaceRoleTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", replaceRoleTemplateOptions.roleTemplateId()); + pathParamsMap.put("version", replaceRoleTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replaceRoleTemplateOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + if (replaceRoleTemplateOptions.name() != null) { + contentJson.addProperty("name", replaceRoleTemplateOptions.name()); + } + if (replaceRoleTemplateOptions.description() != null) { + contentJson.addProperty("description", replaceRoleTemplateOptions.description()); + } + if (replaceRoleTemplateOptions.role() != null) { + contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRoleTemplateOptions.role())); + } + if (replaceRoleTemplateOptions.committed() != null) { + contentJson.addProperty("committed", replaceRoleTemplateOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a role template version. + * + * Delete a specific version of a role template by providing a role template ID and version number. You can't delete a + * role template version that is assigned to one or more child accounts. You must remove the role assignments first. + * + * @param deleteRoleTemplateVersionOptions the {@link DeleteRoleTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteRoleTemplateVersion(DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleTemplateVersionOptions, + "deleteRoleTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", deleteRoleTemplateVersionOptions.roleTemplateId()); + pathParamsMap.put("version", deleteRoleTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a role template version. + * + * Retrieve a role template by providing a role template ID and version number. + * + * @param getRoleTemplateVersionOptions the {@link GetRoleTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall getRoleTemplateVersion(GetRoleTemplateVersionOptions getRoleTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleTemplateVersionOptions, + "getRoleTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", getRoleTemplateVersionOptions.roleTemplateId()); + pathParamsMap.put("version", getRoleTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleTemplateVersion"); + 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); + } + + /** + * Commit a role template version. + * + * Commit a role template version. You cannot make any further changes to the role template once it's committed. If + * you have to make updates after committing a version, create a new version. + * + * @param commitRoleTemplateOptions the {@link CommitRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall commitRoleTemplate(CommitRoleTemplateOptions commitRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(commitRoleTemplateOptions, + "commitRoleTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", commitRoleTemplateOptions.roleTemplateId()); + pathParamsMap.put("version", commitRoleTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}/commit", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get role template assignments. + * + * Get role template assignments by attributes. The following attributes are supported: + * `account_id`, `template_id`, `template_version`, `target`, `target_type`, `limit`, `start`. + * `account_id` is a required query parameter. Only role template assignments with the specified attributes and + * accessible by the caller are returned. If the caller does not have read access to any role template assignments, an + * empty array is returned. + * + * @param listRoleAssignmentsOptions the {@link ListRoleAssignmentsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleAssignmentCollection} + */ + public ServiceCall listRoleAssignments(ListRoleAssignmentsOptions listRoleAssignmentsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleAssignmentsOptions, + "listRoleAssignmentsOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleAssignments"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listRoleAssignmentsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listRoleAssignmentsOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listRoleAssignmentsOptions.accountId())); + if (listRoleAssignmentsOptions.templateId() != null) { + builder.query("template_id", String.valueOf(listRoleAssignmentsOptions.templateId())); + } + if (listRoleAssignmentsOptions.templateVersion() != null) { + builder.query("template_version", String.valueOf(listRoleAssignmentsOptions.templateVersion())); + } + if (listRoleAssignmentsOptions.limit() != null) { + builder.query("limit", String.valueOf(listRoleAssignmentsOptions.limit())); + } + if (listRoleAssignmentsOptions.start() != null) { + builder.query("start", String.valueOf(listRoleAssignmentsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a role template assignment. + * + * Assign a role template to child accounts and account groups. This creates the role in the accounts and account + * groups that you specify. + * + * @param createRoleTemplateAssignmentOptions the {@link CreateRoleTemplateAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleAssignmentCollection} + */ + public ServiceCall createRoleTemplateAssignment(CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateAssignmentOptions, + "createRoleTemplateAssignmentOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplateAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createRoleTemplateAssignmentOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createRoleTemplateAssignmentOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateAssignmentOptions.target())); + contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateAssignmentOptions.templates())); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a role assignment. + * + * Retrieve a role template assignment by providing a role assignment ID. + * + * @param getRoleAssignmentOptions the {@link GetRoleAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleAssignment} + */ + public ServiceCall getRoleAssignment(GetRoleAssignmentOptions getRoleAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleAssignmentOptions, + "getRoleAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", getRoleAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleAssignment"); + 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 a role assignment. + * + * Update a role assignment by providing a role assignment ID. + * + * @param updateRoleAssignmentOptions the {@link UpdateRoleAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleAssignment} + */ + public ServiceCall updateRoleAssignment(UpdateRoleAssignmentOptions updateRoleAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateRoleAssignmentOptions, + "updateRoleAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", updateRoleAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateRoleAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updateRoleAssignmentOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("template_version", updateRoleAssignmentOptions.templateVersion()); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Remove a role assignment. + * + * Remove a role template assignment by providing a role assignment ID. You can't delete a role assignment if the + * status is "in_progress". + * + * @param deleteRoleAssignmentOptions the {@link DeleteRoleAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteRoleAssignment(DeleteRoleAssignmentOptions deleteRoleAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleAssignmentOptions, + "deleteRoleAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", deleteRoleAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java new file mode 100644 index 00000000000..af82ea2abe8 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The Access Management Account Settings that are currently set for the requested account. + */ +public class AccountSettingsAccessManagement extends GenericModel { + + @SerializedName("external_account_identity_interaction") + protected ExternalAccountIdentityInteraction externalAccountIdentityInteraction; + + protected AccountSettingsAccessManagement() { } + + /** + * Gets the externalAccountIdentityInteraction. + * + * How external accounts can interact in relation to the requested account. + * + * @return the externalAccountIdentityInteraction + */ + public ExternalAccountIdentityInteraction getExternalAccountIdentityInteraction() { + return externalAccountIdentityInteraction; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java new file mode 100644 index 00000000000..ea230f57263 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java @@ -0,0 +1,207 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the assigned action control template. + */ +public class ActionControlAssignment extends GenericModel { + + /** + * The current operation of the action control assignment. + */ + public interface Operation { + /** create. */ + String CREATE = "create"; + /** apply. */ + String APPLY = "apply"; + /** update. */ + String UPDATE = "update"; + /** remove. */ + String REMOVE = "remove"; + } + + /** + * The action control assignment status. + */ + public interface Status { + /** accepted. */ + String ACCEPTED = "accepted"; + /** failure. */ + String FAILURE = "failure"; + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** superseded. */ + String SUPERSEDED = "superseded"; + } + + protected String id; + @SerializedName("account_id") + protected String accountId; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String operation; + protected List resources; + protected ActionControlAssignmentTemplate template; + protected AssignmentTargetDetails target; + protected String status; + + protected ActionControlAssignment() { } + + /** + * Gets the id. + * + * Action control assignment ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the accountId. + * + * The account GUID that the action control assignments belong to. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the href. + * + * The href URL that links to the action control assignments API by action control assignment ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the action control assignment was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the action control assignment. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the action control assignment was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the action control assignment. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the operation. + * + * The current operation of the action control assignment. + * + * @return the operation + */ + public String getOperation() { + return operation; + } + + /** + * Gets the resources. + * + * Resources created when action control template is assigned. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the template. + * + * The action control template id and version that will be assigned. + * + * @return the template + */ + public ActionControlAssignmentTemplate getTemplate() { + return template; + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the status. + * + * The action control assignment status. + * + * @return the status + */ + public String getStatus() { + return status; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java new file mode 100644 index 00000000000..a9d6b28ce39 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of action control assignments. + */ +public class ActionControlAssignmentCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List assignments; + + protected ActionControlAssignmentCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the assignments. + * + * List of action control assignments. + * + * @return the assignments + */ + public List getAssignments() { + return assignments; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java new file mode 100644 index 00000000000..122d3c8277b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java @@ -0,0 +1,52 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The action control assignment resources and target where the template is assigned. + */ +public class ActionControlAssignmentResource extends GenericModel { + + protected AssignmentTargetDetails target; + @SerializedName("action_control") + protected ActionControlAssignmentResourceActionControl actionControl; + + protected ActionControlAssignmentResource() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the actionControl. + * + * Set of properties of the assigned resource or error message if assignment failed. + * + * @return the actionControl + */ + public ActionControlAssignmentResourceActionControl getActionControl() { + return actionControl; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java new file mode 100644 index 00000000000..0e5550eb4da --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Set of properties of the assigned resource or error message if assignment failed. + */ +public class ActionControlAssignmentResourceActionControl extends GenericModel { + + @SerializedName("resource_created") + protected ActionControlAssignmentResourceCreated resourceCreated; + @SerializedName("error_message") + protected AssignmentResourceError errorMessage; + + protected ActionControlAssignmentResourceActionControl() { } + + /** + * Gets the resourceCreated. + * + * On success, it includes the action control assigned. + * + * @return the resourceCreated + */ + public ActionControlAssignmentResourceCreated getResourceCreated() { + return resourceCreated; + } + + /** + * Gets the errorMessage. + * + * Body parameters for assignment error. + * + * @return the errorMessage + */ + public AssignmentResourceError getErrorMessage() { + return errorMessage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java new file mode 100644 index 00000000000..6ecbd23392a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * On success, it includes the action control assigned. + */ +public class ActionControlAssignmentResourceCreated extends GenericModel { + + protected String id; + + protected ActionControlAssignmentResourceCreated() { } + + /** + * Gets the id. + * + * action control id. + * + * @return the id + */ + public String getId() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java new file mode 100644 index 00000000000..4e6d2543e18 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The action control template id and version that will be assigned. + */ +public class ActionControlAssignmentTemplate extends GenericModel { + + protected String id; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String version; + + /** + * Instantiates a new Builder from an existing ActionControlAssignmentTemplate instance. + * + * @param actionControlAssignmentTemplate the instance to initialize the Builder with + */ + private Builder(ActionControlAssignmentTemplate actionControlAssignmentTemplate) { + this.id = actionControlAssignmentTemplate.id; + this.version = actionControlAssignmentTemplate.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + * @param version the version + */ + public Builder(String id, String version) { + this.id = id; + this.version = version; + } + + /** + * Builds a ActionControlAssignmentTemplate. + * + * @return the new ActionControlAssignmentTemplate instance + */ + public ActionControlAssignmentTemplate build() { + return new ActionControlAssignmentTemplate(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the ActionControlAssignmentTemplate builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the ActionControlAssignmentTemplate builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected ActionControlAssignmentTemplate() { } + + protected ActionControlAssignmentTemplate(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, + "id cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + id = builder.id; + version = builder.version; + } + + /** + * New builder. + * + * @return a ActionControlAssignmentTemplate builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * Action control template ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java new file mode 100644 index 00000000000..78b6d56be6d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * ActionControlAssignmentsPager can be used to simplify the use of the "listActionControlAssignments" method. + */ +public class ActionControlAssignmentsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListActionControlAssignmentsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected ActionControlAssignmentsPager() { } + + /** + * Constructs a new ActionControlAssignmentsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlAssignments" method + * @param options the ListActionControlAssignmentsOptions instance to be used to invoke the "listActionControlAssignments" method + */ + public ActionControlAssignmentsPager(IamPolicyManagement client, ListActionControlAssignmentsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<ActionControlAssignment> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListActionControlAssignmentsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + ActionControlAssignmentCollection result = client.listActionControlAssignments(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getAssignments(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<ActionControlAssignment> containing all results returned by the "listActionControlAssignments" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java new file mode 100644 index 00000000000..157c9f6a390 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java @@ -0,0 +1,203 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the action control template. + */ +public class ActionControlTemplate extends GenericModel { + + /** + * State of action control template. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String name; + protected String description; + @SerializedName("account_id") + protected String accountId; + protected Boolean committed; + @SerializedName("action_control") + protected TemplateActionControl actionControl; + protected String id; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String version; + protected String state; + + protected ActionControlTemplate() { } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Description of the action control template. This is shown to users in the enterprise account. Use this to describe + * the purpose or context of the action control for enterprise users managing IAM templates. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the committed. + * + * Committed status of the template. If committed is set to true, then the template version can no longer be updated. + * + * @return the committed + */ + public Boolean isCommitted() { + return committed; + } + + /** + * Gets the actionControl. + * + * The action control properties that are created in an action resource when the template is assigned. + * + * @return the actionControl + */ + public TemplateActionControl getActionControl() { + return actionControl; + } + + /** + * Gets the id. + * + * The action control template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the action control templates API by action control template ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the action control template was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the action control template. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the action control template was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the action control template. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the version. + * + * The version number of the template used to identify different versions of same template. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the state. + * + * State of action control template. + * + * @return the state + */ + public String getState() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java new file mode 100644 index 00000000000..e7536d2c9ae --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java @@ -0,0 +1,90 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of action control templates. + */ +public class ActionControlTemplateCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + @SerializedName("action_control_templates") + protected List actionControlTemplates; + + protected ActionControlTemplateCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the actionControlTemplates. + * + * List of action control templates. + * + * @return the actionControlTemplates + */ + public List getActionControlTemplates() { + return actionControlTemplates; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java new file mode 100644 index 00000000000..5e26f45cf46 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of versions for a specific action control template. + */ +public class ActionControlTemplateVersionsCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List versions; + + protected ActionControlTemplateVersionsCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the versions. + * + * List of action control templates versions. + * + * @return the versions + */ + public List getVersions() { + return versions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java new file mode 100644 index 00000000000..660aefe11ba --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * ActionControlTemplateVersionsPager can be used to simplify the use of the "listActionControlTemplateVersions" method. + */ +public class ActionControlTemplateVersionsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListActionControlTemplateVersionsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected ActionControlTemplateVersionsPager() { } + + /** + * Constructs a new ActionControlTemplateVersionsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlTemplateVersions" method + * @param options the ListActionControlTemplateVersionsOptions instance to be used to invoke the "listActionControlTemplateVersions" method + */ + public ActionControlTemplateVersionsPager(IamPolicyManagement client, ListActionControlTemplateVersionsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<ActionControlTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListActionControlTemplateVersionsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + ActionControlTemplateVersionsCollection result = client.listActionControlTemplateVersions(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getVersions(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<ActionControlTemplate> containing all results returned by the "listActionControlTemplateVersions" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java new file mode 100644 index 00000000000..bd326c8d7ec --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * ActionControlTemplatesPager can be used to simplify the use of the "listActionControlTemplates" method. + */ +public class ActionControlTemplatesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListActionControlTemplatesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected ActionControlTemplatesPager() { } + + /** + * Constructs a new ActionControlTemplatesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlTemplates" method + * @param options the ListActionControlTemplatesOptions instance to be used to invoke the "listActionControlTemplates" method + */ + public ActionControlTemplatesPager(IamPolicyManagement client, ListActionControlTemplatesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<ActionControlTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListActionControlTemplatesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + ActionControlTemplateCollection result = client.listActionControlTemplates(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getActionControlTemplates(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<ActionControlTemplate> containing all results returned by the "listActionControlTemplates" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java new file mode 100644 index 00000000000..c454c7a3ef5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * On success, includes the policy that is assigned. + */ +public class AssignmentResourceCreated extends GenericModel { + + protected String id; + + protected AssignmentResourceCreated() { } + + /** + * Gets the id. + * + * Policy id. + * + * @return the id + */ + public String getId() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java new file mode 100644 index 00000000000..e74dbe58b3a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Body parameters for assignment error. + */ +public class AssignmentResourceError extends GenericModel { + + protected String name; + protected String errorCode; + protected String message; + protected String code; + protected List errors; + + protected AssignmentResourceError() { } + + /** + * Gets the name. + * + * Name of the error. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the errorCode. + * + * error code. + * + * @return the errorCode + */ + public String getErrorCode() { + return errorCode; + } + + /** + * Gets the message. + * + * Error message detailing the nature of the error. + * + * @return the message + */ + public String getMessage() { + return message; + } + + /** + * Gets the code. + * + * Internal status code for the error. + * + * @return the code + */ + public String getCode() { + return code; + } + + /** + * Gets the errors. + * + * The errors encountered during the response. + * + * @return the errors + */ + public List getErrors() { + return errors; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java new file mode 100644 index 00000000000..893d528604c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java @@ -0,0 +1,142 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * assignment target account and type. + */ +public class AssignmentTargetDetails extends GenericModel { + + /** + * Assignment target type. + */ + public interface Type { + /** Account. */ + String ACCOUNT = "Account"; + } + + protected String type; + protected String id; + + /** + * Builder. + */ + public static class Builder { + private String type; + private String id; + + /** + * Instantiates a new Builder from an existing AssignmentTargetDetails instance. + * + * @param assignmentTargetDetails the instance to initialize the Builder with + */ + private Builder(AssignmentTargetDetails assignmentTargetDetails) { + this.type = assignmentTargetDetails.type; + this.id = assignmentTargetDetails.id; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param type the type + * @param id the id + */ + public Builder(String type, String id) { + this.type = type; + this.id = id; + } + + /** + * Builds a AssignmentTargetDetails. + * + * @return the new AssignmentTargetDetails instance + */ + public AssignmentTargetDetails build() { + return new AssignmentTargetDetails(this); + } + + /** + * Set the type. + * + * @param type the type + * @return the AssignmentTargetDetails builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the id. + * + * @param id the id + * @return the AssignmentTargetDetails builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + } + + protected AssignmentTargetDetails() { } + + protected AssignmentTargetDetails(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, + "id cannot be null"); + type = builder.type; + id = builder.id; + } + + /** + * New builder. + * + * @return a AssignmentTargetDetails builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the type. + * + * Assignment target type. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the id. + * + * ID of the target account. + * + * @return the id + */ + public String id() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java new file mode 100644 index 00000000000..b8025e305a9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java @@ -0,0 +1,119 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * policy template details. + */ +public class AssignmentTemplateDetails extends GenericModel { + + protected String id; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String version; + + /** + * Instantiates a new Builder from an existing AssignmentTemplateDetails instance. + * + * @param assignmentTemplateDetails the instance to initialize the Builder with + */ + private Builder(AssignmentTemplateDetails assignmentTemplateDetails) { + this.id = assignmentTemplateDetails.id; + this.version = assignmentTemplateDetails.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a AssignmentTemplateDetails. + * + * @return the new AssignmentTemplateDetails instance + */ + public AssignmentTemplateDetails build() { + return new AssignmentTemplateDetails(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the AssignmentTemplateDetails builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the AssignmentTemplateDetails builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected AssignmentTemplateDetails() { } + + protected AssignmentTemplateDetails(Builder builder) { + id = builder.id; + version = builder.version; + } + + /** + * New builder. + * + * @return a AssignmentTemplateDetails builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * Policy template ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the version. + * + * Policy template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java new file mode 100644 index 00000000000..78291e6c2c5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The commitActionControlTemplate options. + */ +public class CommitActionControlTemplateOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing CommitActionControlTemplateOptions instance. + * + * @param commitActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(CommitActionControlTemplateOptions commitActionControlTemplateOptions) { + this.actionControlTemplateId = commitActionControlTemplateOptions.actionControlTemplateId; + this.version = commitActionControlTemplateOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + * @param version the version + */ + public Builder(String actionControlTemplateId, String version) { + this.actionControlTemplateId = actionControlTemplateId; + this.version = version; + } + + /** + * Builds a CommitActionControlTemplateOptions. + * + * @return the new CommitActionControlTemplateOptions instance + */ + public CommitActionControlTemplateOptions build() { + return new CommitActionControlTemplateOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the CommitActionControlTemplateOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the CommitActionControlTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected CommitActionControlTemplateOptions() { } + + protected CommitActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a CommitActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the version. + * + * The action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java new file mode 100644 index 00000000000..61283194c44 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The commitPolicyTemplate options. + */ +public class CommitPolicyTemplateOptions extends GenericModel { + + protected String policyTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing CommitPolicyTemplateOptions instance. + * + * @param commitPolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(CommitPolicyTemplateOptions commitPolicyTemplateOptions) { + this.policyTemplateId = commitPolicyTemplateOptions.policyTemplateId; + this.version = commitPolicyTemplateOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param version the version + */ + public Builder(String policyTemplateId, String version) { + this.policyTemplateId = policyTemplateId; + this.version = version; + } + + /** + * Builds a CommitPolicyTemplateOptions. + * + * @return the new CommitPolicyTemplateOptions instance + */ + public CommitPolicyTemplateOptions build() { + return new CommitPolicyTemplateOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the CommitPolicyTemplateOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the CommitPolicyTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected CommitPolicyTemplateOptions() { } + + protected CommitPolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + policyTemplateId = builder.policyTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a CommitPolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the version. + * + * The policy template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java new file mode 100644 index 00000000000..7e93c92fb0b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The commitRoleTemplate options. + */ +public class CommitRoleTemplateOptions extends GenericModel { + + protected String roleTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing CommitRoleTemplateOptions instance. + * + * @param commitRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(CommitRoleTemplateOptions commitRoleTemplateOptions) { + this.roleTemplateId = commitRoleTemplateOptions.roleTemplateId; + this.version = commitRoleTemplateOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + * @param version the version + */ + public Builder(String roleTemplateId, String version) { + this.roleTemplateId = roleTemplateId; + this.version = version; + } + + /** + * Builds a CommitRoleTemplateOptions. + * + * @return the new CommitRoleTemplateOptions instance + */ + public CommitRoleTemplateOptions build() { + return new CommitRoleTemplateOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the CommitRoleTemplateOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the CommitRoleTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected CommitRoleTemplateOptions() { } + + protected CommitRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + roleTemplateId = builder.roleTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a CommitRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the version. + * + * The role template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java new file mode 100644 index 00000000000..be0c3d0aa98 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java @@ -0,0 +1,62 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Details of conflicting resource. + */ +public class ConflictsWith extends GenericModel { + + protected String etag; + protected String role; + protected String policy; + + protected ConflictsWith() { } + + /** + * Gets the etag. + * + * The revision number of the resource. + * + * @return the etag + */ + public String getEtag() { + return etag; + } + + /** + * Gets the role. + * + * The conflicting role of ID. + * + * @return the role + */ + public String getRole() { + return role; + } + + /** + * Gets the policy. + * + * The conflicting policy ID. + * + * @return the policy + */ + public String getPolicy() { + return policy; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java new file mode 100644 index 00000000000..15e502ac214 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Specifies the type of access that is granted by the policy. + */ +public class Control extends GenericModel { + + protected Grant grant; + + /** + * Builder. + */ + public static class Builder { + private Grant grant; + + /** + * Instantiates a new Builder from an existing Control instance. + * + * @param control the instance to initialize the Builder with + */ + private Builder(Control control) { + this.grant = control.grant; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param grant the grant + */ + public Builder(Grant grant) { + this.grant = grant; + } + + /** + * Builds a Control. + * + * @return the new Control instance + */ + public Control build() { + return new Control(this); + } + + /** + * Set the grant. + * + * @param grant the grant + * @return the Control builder + */ + public Builder grant(Grant grant) { + this.grant = grant; + return this; + } + } + + protected Control() { } + + protected Control(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.grant, + "grant cannot be null"); + grant = builder.grant; + } + + /** + * New builder. + * + * @return a Control builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the grant. + * + * Permission is granted by the policy. + * + * @return the grant + */ + public Grant grant() { + return grant; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java new file mode 100644 index 00000000000..5055d290c80 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * ControlResponse. + * + * Classes which extend this class: + * - ControlResponseControl + * - ControlResponseControlWithEnrichedRoles + */ +public class ControlResponse extends GenericModel { + + protected Grant grant; + + protected ControlResponse() { } + + /** + * Gets the grant. + * + * Permission is granted by the policy. + * + * @return the grant + */ + public Grant getGrant() { + return grant; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java new file mode 100644 index 00000000000..5934ebf7c76 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java @@ -0,0 +1,24 @@ +/* + * (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_policy_management.v1.model; + +/** + * Specifies the type of access that is granted by the policy. + */ +public class ControlResponseControl extends ControlResponse { + + + protected ControlResponseControl() { } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java new file mode 100644 index 00000000000..8b3c73d73c0 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java @@ -0,0 +1,24 @@ +/* + * (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_policy_management.v1.model; + +/** + * Specifies the type of access that is granted by the policy with additional role information. + */ +public class ControlResponseControlWithEnrichedRoles extends ControlResponse { + + + protected ControlResponseControlWithEnrichedRoles() { } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java new file mode 100644 index 00000000000..1ccd3f8b4dd --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java @@ -0,0 +1,191 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createActionControlTemplateAssignment options. + */ +public class CreateActionControlTemplateAssignmentOptions extends GenericModel { + + protected AssignmentTargetDetails target; + protected List templates; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private AssignmentTargetDetails target; + private List templates; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateActionControlTemplateAssignmentOptions instance. + * + * @param createActionControlTemplateAssignmentOptions the instance to initialize the Builder with + */ + private Builder(CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptions) { + this.target = createActionControlTemplateAssignmentOptions.target; + this.templates = createActionControlTemplateAssignmentOptions.templates; + this.acceptLanguage = createActionControlTemplateAssignmentOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param target the target + * @param templates the templates + */ + public Builder(AssignmentTargetDetails target, List templates) { + this.target = target; + this.templates = templates; + } + + /** + * Builds a CreateActionControlTemplateAssignmentOptions. + * + * @return the new CreateActionControlTemplateAssignmentOptions instance + */ + public CreateActionControlTemplateAssignmentOptions build() { + return new CreateActionControlTemplateAssignmentOptions(this); + } + + /** + * Adds a new element to templates. + * + * @param templates the new element to be added + * @return the CreateActionControlTemplateAssignmentOptions builder + */ + public Builder addTemplates(ActionControlAssignmentTemplate templates) { + com.ibm.cloud.sdk.core.util.Validator.notNull(templates, + "templates cannot be null"); + if (this.templates == null) { + this.templates = new ArrayList(); + } + this.templates.add(templates); + return this; + } + + /** + * Set the target. + * + * @param target the target + * @return the CreateActionControlTemplateAssignmentOptions builder + */ + public Builder target(AssignmentTargetDetails target) { + this.target = target; + return this; + } + + /** + * Set the templates. + * Existing templates will be replaced. + * + * @param templates the templates + * @return the CreateActionControlTemplateAssignmentOptions builder + */ + public Builder templates(List templates) { + this.templates = templates; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateActionControlTemplateAssignmentOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateActionControlTemplateAssignmentOptions() { } + + protected CreateActionControlTemplateAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, + "target cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, + "templates cannot be null"); + target = builder.target; + templates = builder.templates; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateActionControlTemplateAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails target() { + return target; + } + + /** + * Gets the templates. + * + * List of action control template details for action control assignment. + * + * @return the templates + */ + public List templates() { + return templates; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java new file mode 100644 index 00000000000..37594a7a440 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java @@ -0,0 +1,251 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createActionControlTemplate options. + */ +public class CreateActionControlTemplateOptions extends GenericModel { + + protected String name; + protected String accountId; + protected String description; + protected Boolean committed; + protected TemplateActionControl actionControl; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String accountId; + private String description; + private Boolean committed; + private TemplateActionControl actionControl; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateActionControlTemplateOptions instance. + * + * @param createActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(CreateActionControlTemplateOptions createActionControlTemplateOptions) { + this.name = createActionControlTemplateOptions.name; + this.accountId = createActionControlTemplateOptions.accountId; + this.description = createActionControlTemplateOptions.description; + this.committed = createActionControlTemplateOptions.committed; + this.actionControl = createActionControlTemplateOptions.actionControl; + this.acceptLanguage = createActionControlTemplateOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param accountId the accountId + */ + public Builder(String name, String accountId) { + this.name = name; + this.accountId = accountId; + } + + /** + * Builds a CreateActionControlTemplateOptions. + * + * @return the new CreateActionControlTemplateOptions instance + */ + public CreateActionControlTemplateOptions build() { + return new CreateActionControlTemplateOptions(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateActionControlTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreateActionControlTemplateOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateActionControlTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreateActionControlTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + + /** + * Set the actionControl. + * + * @param actionControl the actionControl + * @return the CreateActionControlTemplateOptions builder + */ + public Builder actionControl(TemplateActionControl actionControl) { + this.actionControl = actionControl; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateActionControlTemplateOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateActionControlTemplateOptions() { } + + protected CreateActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + name = builder.name; + accountId = builder.accountId; + description = builder.description; + committed = builder.committed; + actionControl = builder.actionControl; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the description. + * + * Description of the action control template. This is shown to users in the enterprise account. Use this to describe + * the purpose or context of the action control for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template. If committed is set to true, then the template version can no longer be updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } + + /** + * Gets the actionControl. + * + * The action control properties that are created in an action resource when the template is assigned. + * + * @return the actionControl + */ + public TemplateActionControl actionControl() { + return actionControl; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java new file mode 100644 index 00000000000..13ce1a8e60f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java @@ -0,0 +1,211 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createActionControlTemplateVersion options. + */ +public class CreateActionControlTemplateVersionOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String name; + protected String description; + protected TemplateActionControl actionControl; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String name; + private String description; + private TemplateActionControl actionControl; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing CreateActionControlTemplateVersionOptions instance. + * + * @param createActionControlTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptions) { + this.actionControlTemplateId = createActionControlTemplateVersionOptions.actionControlTemplateId; + this.name = createActionControlTemplateVersionOptions.name; + this.description = createActionControlTemplateVersionOptions.description; + this.actionControl = createActionControlTemplateVersionOptions.actionControl; + this.committed = createActionControlTemplateVersionOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + */ + public Builder(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + } + + /** + * Builds a CreateActionControlTemplateVersionOptions. + * + * @return the new CreateActionControlTemplateVersionOptions instance + */ + public CreateActionControlTemplateVersionOptions build() { + return new CreateActionControlTemplateVersionOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actionControl. + * + * @param actionControl the actionControl + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder actionControl(TemplateActionControl actionControl) { + this.actionControl = actionControl; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected CreateActionControlTemplateVersionOptions() { } + + protected CreateActionControlTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + name = builder.name; + description = builder.description; + actionControl = builder.actionControl; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a CreateActionControlTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * The action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will + * change the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the action control template. This is shown to users in the enterprise account. Use this to describe + * the purpose or context of the action control for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actionControl. + * + * The action control properties that are created in an action resource when the template is assigned. + * + * @return the actionControl + */ + public TemplateActionControl actionControl() { + return actionControl; + } + + /** + * Gets the committed. + * + * Committed status of the template version. If committed is set to true, then the template version can no longer be + * updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java new file mode 100644 index 00000000000..b6ec9f78c02 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java @@ -0,0 +1,311 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createPolicy options. + */ +public class CreatePolicyOptions extends GenericModel { + + protected String type; + protected List subjects; + protected List roles; + protected List resources; + protected String description; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String type; + private List subjects; + private List roles; + private List resources; + private String description; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreatePolicyOptions instance. + * + * @param createPolicyOptions the instance to initialize the Builder with + */ + private Builder(CreatePolicyOptions createPolicyOptions) { + this.type = createPolicyOptions.type; + this.subjects = createPolicyOptions.subjects; + this.roles = createPolicyOptions.roles; + this.resources = createPolicyOptions.resources; + this.description = createPolicyOptions.description; + this.acceptLanguage = createPolicyOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param type the type + * @param subjects the subjects + * @param roles the roles + * @param resources the resources + */ + public Builder(String type, List subjects, List roles, List resources) { + this.type = type; + this.subjects = subjects; + this.roles = roles; + this.resources = resources; + } + + /** + * Builds a CreatePolicyOptions. + * + * @return the new CreatePolicyOptions instance + */ + public CreatePolicyOptions build() { + return new CreatePolicyOptions(this); + } + + /** + * Adds a new element to subjects. + * + * @param subjects the new element to be added + * @return the CreatePolicyOptions builder + */ + public Builder addSubjects(PolicySubject subjects) { + com.ibm.cloud.sdk.core.util.Validator.notNull(subjects, + "subjects cannot be null"); + if (this.subjects == null) { + this.subjects = new ArrayList(); + } + this.subjects.add(subjects); + return this; + } + + /** + * Adds a new element to roles. + * + * @param roles the new element to be added + * @return the CreatePolicyOptions builder + */ + public Builder addRoles(PolicyRole roles) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roles, + "roles cannot be null"); + if (this.roles == null) { + this.roles = new ArrayList(); + } + this.roles.add(roles); + return this; + } + + /** + * Adds a new element to resources. + * + * @param resources the new element to be added + * @return the CreatePolicyOptions builder + */ + public Builder addResources(PolicyResource resources) { + com.ibm.cloud.sdk.core.util.Validator.notNull(resources, + "resources cannot be null"); + if (this.resources == null) { + this.resources = new ArrayList(); + } + this.resources.add(resources); + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the CreatePolicyOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the subjects. + * Existing subjects will be replaced. + * + * @param subjects the subjects + * @return the CreatePolicyOptions builder + */ + public Builder subjects(List subjects) { + this.subjects = subjects; + return this; + } + + /** + * Set the roles. + * Existing roles will be replaced. + * + * @param roles the roles + * @return the CreatePolicyOptions builder + */ + public Builder roles(List roles) { + this.roles = roles; + return this; + } + + /** + * Set the resources. + * Existing resources will be replaced. + * + * @param resources the resources + * @return the CreatePolicyOptions builder + */ + public Builder resources(List resources) { + this.resources = resources; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreatePolicyOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreatePolicyOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreatePolicyOptions() { } + + protected CreatePolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subjects, + "subjects cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, + "roles cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resources, + "resources cannot be null"); + type = builder.type; + subjects = builder.subjects; + roles = builder.roles; + resources = builder.resources; + description = builder.description; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreatePolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the subjects. + * + * The subjects associated with a policy. + * + * @return the subjects + */ + public List subjects() { + return subjects; + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List roles() { + return roles; + } + + /** + * Gets the resources. + * + * The resources associated with a policy. + * + * @return the resources + */ + public List resources() { + return resources; + } + + /** + * Gets the description. + * + * Customer-defined description. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java new file mode 100644 index 00000000000..b71ca393f11 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java @@ -0,0 +1,221 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createPolicyTemplateAssignment options. + */ +public class CreatePolicyTemplateAssignmentOptions extends GenericModel { + + protected String version; + protected AssignmentTargetDetails target; + protected List templates; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String version; + private AssignmentTargetDetails target; + private List templates; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreatePolicyTemplateAssignmentOptions instance. + * + * @param createPolicyTemplateAssignmentOptions the instance to initialize the Builder with + */ + private Builder(CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptions) { + this.version = createPolicyTemplateAssignmentOptions.version; + this.target = createPolicyTemplateAssignmentOptions.target; + this.templates = createPolicyTemplateAssignmentOptions.templates; + this.acceptLanguage = createPolicyTemplateAssignmentOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param version the version + * @param target the target + * @param templates the templates + */ + public Builder(String version, AssignmentTargetDetails target, List templates) { + this.version = version; + this.target = target; + this.templates = templates; + } + + /** + * Builds a CreatePolicyTemplateAssignmentOptions. + * + * @return the new CreatePolicyTemplateAssignmentOptions instance + */ + public CreatePolicyTemplateAssignmentOptions build() { + return new CreatePolicyTemplateAssignmentOptions(this); + } + + /** + * Adds a new element to templates. + * + * @param templates the new element to be added + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder addTemplates(AssignmentTemplateDetails templates) { + com.ibm.cloud.sdk.core.util.Validator.notNull(templates, + "templates cannot be null"); + if (this.templates == null) { + this.templates = new ArrayList(); + } + this.templates.add(templates); + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the target. + * + * @param target the target + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder target(AssignmentTargetDetails target) { + this.target = target; + return this; + } + + /** + * Set the templates. + * Existing templates will be replaced. + * + * @param templates the templates + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder templates(List templates) { + this.templates = templates; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreatePolicyTemplateAssignmentOptions() { } + + protected CreatePolicyTemplateAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, + "target cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, + "templates cannot be null"); + version = builder.version; + target = builder.target; + templates = builder.templates; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreatePolicyTemplateAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the version. + * + * specify version of response body format. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails target() { + return target; + } + + /** + * Gets the templates. + * + * List of template details for policy assignment. + * + * @return the templates + */ + public List templates() { + return templates; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java new file mode 100644 index 00000000000..72944308428 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java @@ -0,0 +1,255 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createPolicyTemplate options. + */ +public class CreatePolicyTemplateOptions extends GenericModel { + + protected String name; + protected String accountId; + protected TemplatePolicy policy; + protected String description; + protected Boolean committed; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String accountId; + private TemplatePolicy policy; + private String description; + private Boolean committed; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreatePolicyTemplateOptions instance. + * + * @param createPolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(CreatePolicyTemplateOptions createPolicyTemplateOptions) { + this.name = createPolicyTemplateOptions.name; + this.accountId = createPolicyTemplateOptions.accountId; + this.policy = createPolicyTemplateOptions.policy; + this.description = createPolicyTemplateOptions.description; + this.committed = createPolicyTemplateOptions.committed; + this.acceptLanguage = createPolicyTemplateOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param accountId the accountId + * @param policy the policy + */ + public Builder(String name, String accountId, TemplatePolicy policy) { + this.name = name; + this.accountId = accountId; + this.policy = policy; + } + + /** + * Builds a CreatePolicyTemplateOptions. + * + * @return the new CreatePolicyTemplateOptions instance + */ + public CreatePolicyTemplateOptions build() { + return new CreatePolicyTemplateOptions(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the CreatePolicyTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreatePolicyTemplateOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the policy. + * + * @param policy the policy + * @return the CreatePolicyTemplateOptions builder + */ + public Builder policy(TemplatePolicy policy) { + this.policy = policy; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreatePolicyTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreatePolicyTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreatePolicyTemplateOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreatePolicyTemplateOptions() { } + + protected CreatePolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.policy, + "policy cannot be null"); + name = builder.name; + accountId = builder.accountId; + policy = builder.policy; + description = builder.description; + committed = builder.committed; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreatePolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy policy() { + return policy; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java new file mode 100644 index 00000000000..6903774c335 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java @@ -0,0 +1,214 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createPolicyTemplateVersion options. + */ +public class CreatePolicyTemplateVersionOptions extends GenericModel { + + protected String policyTemplateId; + protected TemplatePolicy policy; + protected String name; + protected String description; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private TemplatePolicy policy; + private String name; + private String description; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing CreatePolicyTemplateVersionOptions instance. + * + * @param createPolicyTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptions) { + this.policyTemplateId = createPolicyTemplateVersionOptions.policyTemplateId; + this.policy = createPolicyTemplateVersionOptions.policy; + this.name = createPolicyTemplateVersionOptions.name; + this.description = createPolicyTemplateVersionOptions.description; + this.committed = createPolicyTemplateVersionOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param policy the policy + */ + public Builder(String policyTemplateId, TemplatePolicy policy) { + this.policyTemplateId = policyTemplateId; + this.policy = policy; + } + + /** + * Builds a CreatePolicyTemplateVersionOptions. + * + * @return the new CreatePolicyTemplateVersionOptions instance + */ + public CreatePolicyTemplateVersionOptions build() { + return new CreatePolicyTemplateVersionOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the policy. + * + * @param policy the policy + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder policy(TemplatePolicy policy) { + this.policy = policy; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected CreatePolicyTemplateVersionOptions() { } + + protected CreatePolicyTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.policy, + "policy cannot be null"); + policyTemplateId = builder.policyTemplateId; + policy = builder.policy; + name = builder.name; + description = builder.description; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a CreatePolicyTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy policy() { + return policy; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template version. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java new file mode 100644 index 00000000000..725ec5d8a53 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java @@ -0,0 +1,308 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createRole options. + */ +public class CreateRoleOptions extends GenericModel { + + protected String displayName; + protected List actions; + protected String name; + protected String accountId; + protected String serviceName; + protected String description; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String displayName; + private List actions; + private String name; + private String accountId; + private String serviceName; + private String description; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateRoleOptions instance. + * + * @param createRoleOptions the instance to initialize the Builder with + */ + private Builder(CreateRoleOptions createRoleOptions) { + this.displayName = createRoleOptions.displayName; + this.actions = createRoleOptions.actions; + this.name = createRoleOptions.name; + this.accountId = createRoleOptions.accountId; + this.serviceName = createRoleOptions.serviceName; + this.description = createRoleOptions.description; + this.acceptLanguage = createRoleOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param displayName the displayName + * @param actions the actions + * @param name the name + * @param accountId the accountId + * @param serviceName the serviceName + */ + public Builder(String displayName, List actions, String name, String accountId, String serviceName) { + this.displayName = displayName; + this.actions = actions; + this.name = name; + this.accountId = accountId; + this.serviceName = serviceName; + } + + /** + * Builds a CreateRoleOptions. + * + * @return the new CreateRoleOptions instance + */ + public CreateRoleOptions build() { + return new CreateRoleOptions(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the CreateRoleOptions builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the CreateRoleOptions builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the CreateRoleOptions builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateRoleOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreateRoleOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the CreateRoleOptions builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateRoleOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateRoleOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateRoleOptions() { } + + protected CreateRoleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, + "serviceName cannot be null"); + displayName = builder.displayName; + actions = builder.actions; + name = builder.name; + accountId = builder.accountId; + serviceName = builder.serviceName; + description = builder.description; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateRoleOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List actions() { + return actions; + } + + /** + * Gets the name. + * + * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the accountId. + * + * The account GUID. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the serviceName. + * + * The service name. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java new file mode 100644 index 00000000000..c9bef88e703 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java @@ -0,0 +1,191 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createRoleTemplateAssignment options. + */ +public class CreateRoleTemplateAssignmentOptions extends GenericModel { + + protected AssignmentTargetDetails target; + protected List templates; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private AssignmentTargetDetails target; + private List templates; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateRoleTemplateAssignmentOptions instance. + * + * @param createRoleTemplateAssignmentOptions the instance to initialize the Builder with + */ + private Builder(CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptions) { + this.target = createRoleTemplateAssignmentOptions.target; + this.templates = createRoleTemplateAssignmentOptions.templates; + this.acceptLanguage = createRoleTemplateAssignmentOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param target the target + * @param templates the templates + */ + public Builder(AssignmentTargetDetails target, List templates) { + this.target = target; + this.templates = templates; + } + + /** + * Builds a CreateRoleTemplateAssignmentOptions. + * + * @return the new CreateRoleTemplateAssignmentOptions instance + */ + public CreateRoleTemplateAssignmentOptions build() { + return new CreateRoleTemplateAssignmentOptions(this); + } + + /** + * Adds a new element to templates. + * + * @param templates the new element to be added + * @return the CreateRoleTemplateAssignmentOptions builder + */ + public Builder addTemplates(RoleAssignmentTemplate templates) { + com.ibm.cloud.sdk.core.util.Validator.notNull(templates, + "templates cannot be null"); + if (this.templates == null) { + this.templates = new ArrayList(); + } + this.templates.add(templates); + return this; + } + + /** + * Set the target. + * + * @param target the target + * @return the CreateRoleTemplateAssignmentOptions builder + */ + public Builder target(AssignmentTargetDetails target) { + this.target = target; + return this; + } + + /** + * Set the templates. + * Existing templates will be replaced. + * + * @param templates the templates + * @return the CreateRoleTemplateAssignmentOptions builder + */ + public Builder templates(List templates) { + this.templates = templates; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateRoleTemplateAssignmentOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateRoleTemplateAssignmentOptions() { } + + protected CreateRoleTemplateAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, + "target cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, + "templates cannot be null"); + target = builder.target; + templates = builder.templates; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateRoleTemplateAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails target() { + return target; + } + + /** + * Gets the templates. + * + * List of role template details for role assignment. + * + * @return the templates + */ + public List templates() { + return templates; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java new file mode 100644 index 00000000000..baf82e17961 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java @@ -0,0 +1,251 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createRoleTemplate options. + */ +public class CreateRoleTemplateOptions extends GenericModel { + + protected String name; + protected String accountId; + protected String description; + protected Boolean committed; + protected RoleTemplatePrototypeRole role; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String accountId; + private String description; + private Boolean committed; + private RoleTemplatePrototypeRole role; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateRoleTemplateOptions instance. + * + * @param createRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(CreateRoleTemplateOptions createRoleTemplateOptions) { + this.name = createRoleTemplateOptions.name; + this.accountId = createRoleTemplateOptions.accountId; + this.description = createRoleTemplateOptions.description; + this.committed = createRoleTemplateOptions.committed; + this.role = createRoleTemplateOptions.role; + this.acceptLanguage = createRoleTemplateOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param accountId the accountId + */ + public Builder(String name, String accountId) { + this.name = name; + this.accountId = accountId; + } + + /** + * Builds a CreateRoleTemplateOptions. + * + * @return the new CreateRoleTemplateOptions instance + */ + public CreateRoleTemplateOptions build() { + return new CreateRoleTemplateOptions(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateRoleTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreateRoleTemplateOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateRoleTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreateRoleTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + + /** + * Set the role. + * + * @param role the role + * @return the CreateRoleTemplateOptions builder + */ + public Builder role(RoleTemplatePrototypeRole role) { + this.role = role; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateRoleTemplateOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateRoleTemplateOptions() { } + + protected CreateRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + name = builder.name; + accountId = builder.accountId; + description = builder.description; + committed = builder.committed; + role = builder.role; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the description. + * + * Description of the role template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the role for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template. If committed is set to true, then the template version can no longer be updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } + + /** + * Gets the role. + * + * The role properties that are created in an action resource when the template is assigned. + * + * @return the role + */ + public RoleTemplatePrototypeRole role() { + return role; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java new file mode 100644 index 00000000000..c322c5a332d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java @@ -0,0 +1,211 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createRoleTemplateVersion options. + */ +public class CreateRoleTemplateVersionOptions extends GenericModel { + + protected String roleTemplateId; + protected String name; + protected String description; + protected TemplateRole role; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String name; + private String description; + private TemplateRole role; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing CreateRoleTemplateVersionOptions instance. + * + * @param createRoleTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(CreateRoleTemplateVersionOptions createRoleTemplateVersionOptions) { + this.roleTemplateId = createRoleTemplateVersionOptions.roleTemplateId; + this.name = createRoleTemplateVersionOptions.name; + this.description = createRoleTemplateVersionOptions.description; + this.role = createRoleTemplateVersionOptions.role; + this.committed = createRoleTemplateVersionOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + */ + public Builder(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + } + + /** + * Builds a CreateRoleTemplateVersionOptions. + * + * @return the new CreateRoleTemplateVersionOptions instance + */ + public CreateRoleTemplateVersionOptions build() { + return new CreateRoleTemplateVersionOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the role. + * + * @param role the role + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder role(TemplateRole role) { + this.role = role; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected CreateRoleTemplateVersionOptions() { } + + protected CreateRoleTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + roleTemplateId = builder.roleTemplateId; + name = builder.name; + description = builder.description; + role = builder.role; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a CreateRoleTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * The role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will + * change the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the role template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the role for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the role. + * + * The role properties that are created in an action resource when the template is assigned. + * + * @return the role + */ + public TemplateRole role() { + return role; + } + + /** + * Gets the committed. + * + * Committed status of the template version. If committed is set to true, then the template version can no longer be + * updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java new file mode 100644 index 00000000000..59ccb4b908a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java @@ -0,0 +1,312 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createV2Policy options. + */ +public class CreateV2PolicyOptions extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + protected Control control; + protected String type; + protected String description; + protected V2PolicySubject subject; + protected V2PolicyResource resource; + protected String pattern; + protected V2PolicyRule rule; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private Control control; + private String type; + private String description; + private V2PolicySubject subject; + private V2PolicyResource resource; + private String pattern; + private V2PolicyRule rule; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateV2PolicyOptions instance. + * + * @param createV2PolicyOptions the instance to initialize the Builder with + */ + private Builder(CreateV2PolicyOptions createV2PolicyOptions) { + this.control = createV2PolicyOptions.control; + this.type = createV2PolicyOptions.type; + this.description = createV2PolicyOptions.description; + this.subject = createV2PolicyOptions.subject; + this.resource = createV2PolicyOptions.resource; + this.pattern = createV2PolicyOptions.pattern; + this.rule = createV2PolicyOptions.rule; + this.acceptLanguage = createV2PolicyOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param control the control + * @param type the type + */ + public Builder(Control control, String type) { + this.control = control; + this.type = type; + } + + /** + * Builds a CreateV2PolicyOptions. + * + * @return the new CreateV2PolicyOptions instance + */ + public CreateV2PolicyOptions build() { + return new CreateV2PolicyOptions(this); + } + + /** + * Set the control. + * + * @param control the control + * @return the CreateV2PolicyOptions builder + */ + public Builder control(Control control) { + this.control = control; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the CreateV2PolicyOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateV2PolicyOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the subject. + * + * @param subject the subject + * @return the CreateV2PolicyOptions builder + */ + public Builder subject(V2PolicySubject subject) { + this.subject = subject; + return this; + } + + /** + * Set the resource. + * + * @param resource the resource + * @return the CreateV2PolicyOptions builder + */ + public Builder resource(V2PolicyResource resource) { + this.resource = resource; + return this; + } + + /** + * Set the pattern. + * + * @param pattern the pattern + * @return the CreateV2PolicyOptions builder + */ + public Builder pattern(String pattern) { + this.pattern = pattern; + return this; + } + + /** + * Set the rule. + * + * @param rule the rule + * @return the CreateV2PolicyOptions builder + */ + public Builder rule(V2PolicyRule rule) { + this.rule = rule; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateV2PolicyOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateV2PolicyOptions() { } + + protected CreateV2PolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.control, + "control cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + control = builder.control; + type = builder.type; + description = builder.description; + subject = builder.subject; + resource = builder.resource; + pattern = builder.pattern; + rule = builder.rule; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateV2PolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the control. + * + * Specifies the type of access that is granted by the policy. + * + * @return the control + */ + public Control control() { + return control; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject subject() { + return subject; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource resource() { + return resource; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String pattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule rule() { + return rule; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java new file mode 100644 index 00000000000..f5e35c13d9f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java @@ -0,0 +1,195 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * An additional set of properties associated with a role. + */ +public class CustomRole extends GenericModel { + + protected String id; + @SerializedName("display_name") + protected String displayName; + protected String description; + protected List actions; + protected String crn; + protected String name; + @SerializedName("account_id") + protected String accountId; + @SerializedName("service_name") + protected String serviceName; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String href; + + protected CustomRole() { } + + /** + * Gets the id. + * + * The role ID. Composed of hexadecimal characters. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String getDisplayName() { + return displayName; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List getActions() { + return actions; + } + + /** + * Gets the crn. + * + * The role Cloud Resource Name (CRN). Example CRN: + * 'crn:v1:ibmcloud:public:iam-access-management::a/exampleAccountId::customRole:ExampleRoleName'. + * + * @return the crn + */ + public String getCrn() { + return crn; + } + + /** + * Gets the name. + * + * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the accountId. + * + * The account GUID. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the serviceName. + * + * The service name. + * + * @return the serviceName + */ + public String getServiceName() { + return serviceName; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the role was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the role. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the role was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the href. + * + * The href links back to the role. + * + * @return the href + */ + public String getHref() { + return href; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java new file mode 100644 index 00000000000..f71d2c2ab9d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteActionControlAssignment options. + */ +public class DeleteActionControlAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing DeleteActionControlAssignmentOptions instance. + * + * @param deleteActionControlAssignmentOptions the instance to initialize the Builder with + */ + private Builder(DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptions) { + this.assignmentId = deleteActionControlAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a DeleteActionControlAssignmentOptions. + * + * @return the new DeleteActionControlAssignmentOptions instance + */ + public DeleteActionControlAssignmentOptions build() { + return new DeleteActionControlAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the DeleteActionControlAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected DeleteActionControlAssignmentOptions() { } + + protected DeleteActionControlAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a DeleteActionControlAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Action control template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java new file mode 100644 index 00000000000..6ff35d83603 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteActionControlTemplate options. + */ +public class DeleteActionControlTemplateOptions extends GenericModel { + + protected String actionControlTemplateId; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + + /** + * Instantiates a new Builder from an existing DeleteActionControlTemplateOptions instance. + * + * @param deleteActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(DeleteActionControlTemplateOptions deleteActionControlTemplateOptions) { + this.actionControlTemplateId = deleteActionControlTemplateOptions.actionControlTemplateId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + */ + public Builder(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + } + + /** + * Builds a DeleteActionControlTemplateOptions. + * + * @return the new DeleteActionControlTemplateOptions instance + */ + public DeleteActionControlTemplateOptions build() { + return new DeleteActionControlTemplateOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the DeleteActionControlTemplateOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + } + + protected DeleteActionControlTemplateOptions() { } + + protected DeleteActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + } + + /** + * New builder. + * + * @return a DeleteActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java new file mode 100644 index 00000000000..69aca0555a1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteActionControlTemplateVersion options. + */ +public class DeleteActionControlTemplateVersionOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing DeleteActionControlTemplateVersionOptions instance. + * + * @param deleteActionControlTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptions) { + this.actionControlTemplateId = deleteActionControlTemplateVersionOptions.actionControlTemplateId; + this.version = deleteActionControlTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + * @param version the version + */ + public Builder(String actionControlTemplateId, String version) { + this.actionControlTemplateId = actionControlTemplateId; + this.version = version; + } + + /** + * Builds a DeleteActionControlTemplateVersionOptions. + * + * @return the new DeleteActionControlTemplateVersionOptions instance + */ + public DeleteActionControlTemplateVersionOptions build() { + return new DeleteActionControlTemplateVersionOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the DeleteActionControlTemplateVersionOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the DeleteActionControlTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected DeleteActionControlTemplateVersionOptions() { } + + protected DeleteActionControlTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a DeleteActionControlTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java new file mode 100644 index 00000000000..3ab2cf17469 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deletePolicyAssignment options. + */ +public class DeletePolicyAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing DeletePolicyAssignmentOptions instance. + * + * @param deletePolicyAssignmentOptions the instance to initialize the Builder with + */ + private Builder(DeletePolicyAssignmentOptions deletePolicyAssignmentOptions) { + this.assignmentId = deletePolicyAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a DeletePolicyAssignmentOptions. + * + * @return the new DeletePolicyAssignmentOptions instance + */ + public DeletePolicyAssignmentOptions build() { + return new DeletePolicyAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the DeletePolicyAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected DeletePolicyAssignmentOptions() { } + + protected DeletePolicyAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a DeletePolicyAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * The policy template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java new file mode 100644 index 00000000000..fe070b2064a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deletePolicy options. + */ +public class DeletePolicyOptions extends GenericModel { + + protected String policyId; + + /** + * Builder. + */ + public static class Builder { + private String policyId; + + /** + * Instantiates a new Builder from an existing DeletePolicyOptions instance. + * + * @param deletePolicyOptions the instance to initialize the Builder with + */ + private Builder(DeletePolicyOptions deletePolicyOptions) { + this.policyId = deletePolicyOptions.policyId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyId the policyId + */ + public Builder(String policyId) { + this.policyId = policyId; + } + + /** + * Builds a DeletePolicyOptions. + * + * @return the new DeletePolicyOptions instance + */ + public DeletePolicyOptions build() { + return new DeletePolicyOptions(this); + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the DeletePolicyOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + } + + protected DeletePolicyOptions() { } + + protected DeletePolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId cannot be empty"); + policyId = builder.policyId; + } + + /** + * New builder. + * + * @return a DeletePolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyId. + * + * The policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java new file mode 100644 index 00000000000..bb70b0d6727 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deletePolicyTemplate options. + */ +public class DeletePolicyTemplateOptions extends GenericModel { + + protected String policyTemplateId; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + + /** + * Instantiates a new Builder from an existing DeletePolicyTemplateOptions instance. + * + * @param deletePolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(DeletePolicyTemplateOptions deletePolicyTemplateOptions) { + this.policyTemplateId = deletePolicyTemplateOptions.policyTemplateId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + */ + public Builder(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + } + + /** + * Builds a DeletePolicyTemplateOptions. + * + * @return the new DeletePolicyTemplateOptions instance + */ + public DeletePolicyTemplateOptions build() { + return new DeletePolicyTemplateOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the DeletePolicyTemplateOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + } + + protected DeletePolicyTemplateOptions() { } + + protected DeletePolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + policyTemplateId = builder.policyTemplateId; + } + + /** + * New builder. + * + * @return a DeletePolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java new file mode 100644 index 00000000000..9a04a5157b6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deletePolicyTemplateVersion options. + */ +public class DeletePolicyTemplateVersionOptions extends GenericModel { + + protected String policyTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing DeletePolicyTemplateVersionOptions instance. + * + * @param deletePolicyTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptions) { + this.policyTemplateId = deletePolicyTemplateVersionOptions.policyTemplateId; + this.version = deletePolicyTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param version the version + */ + public Builder(String policyTemplateId, String version) { + this.policyTemplateId = policyTemplateId; + this.version = version; + } + + /** + * Builds a DeletePolicyTemplateVersionOptions. + * + * @return the new DeletePolicyTemplateVersionOptions instance + */ + public DeletePolicyTemplateVersionOptions build() { + return new DeletePolicyTemplateVersionOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the DeletePolicyTemplateVersionOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the DeletePolicyTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected DeletePolicyTemplateVersionOptions() { } + + protected DeletePolicyTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + policyTemplateId = builder.policyTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a DeletePolicyTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the version. + * + * The policy template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java new file mode 100644 index 00000000000..b9341a9f414 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteRoleAssignment options. + */ +public class DeleteRoleAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing DeleteRoleAssignmentOptions instance. + * + * @param deleteRoleAssignmentOptions the instance to initialize the Builder with + */ + private Builder(DeleteRoleAssignmentOptions deleteRoleAssignmentOptions) { + this.assignmentId = deleteRoleAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a DeleteRoleAssignmentOptions. + * + * @return the new DeleteRoleAssignmentOptions instance + */ + public DeleteRoleAssignmentOptions build() { + return new DeleteRoleAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the DeleteRoleAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected DeleteRoleAssignmentOptions() { } + + protected DeleteRoleAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a DeleteRoleAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Role template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java new file mode 100644 index 00000000000..8675777719e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteRole options. + */ +public class DeleteRoleOptions extends GenericModel { + + protected String roleId; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + + /** + * Instantiates a new Builder from an existing DeleteRoleOptions instance. + * + * @param deleteRoleOptions the instance to initialize the Builder with + */ + private Builder(DeleteRoleOptions deleteRoleOptions) { + this.roleId = deleteRoleOptions.roleId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + */ + public Builder(String roleId) { + this.roleId = roleId; + } + + /** + * Builds a DeleteRoleOptions. + * + * @return the new DeleteRoleOptions instance + */ + public DeleteRoleOptions build() { + return new DeleteRoleOptions(this); + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the DeleteRoleOptions builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + } + + protected DeleteRoleOptions() { } + + protected DeleteRoleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, + "roleId cannot be empty"); + roleId = builder.roleId; + } + + /** + * New builder. + * + * @return a DeleteRoleOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role ID. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java new file mode 100644 index 00000000000..c76bf3bfda4 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteRoleTemplate options. + */ +public class DeleteRoleTemplateOptions extends GenericModel { + + protected String roleTemplateId; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + + /** + * Instantiates a new Builder from an existing DeleteRoleTemplateOptions instance. + * + * @param deleteRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(DeleteRoleTemplateOptions deleteRoleTemplateOptions) { + this.roleTemplateId = deleteRoleTemplateOptions.roleTemplateId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + */ + public Builder(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + } + + /** + * Builds a DeleteRoleTemplateOptions. + * + * @return the new DeleteRoleTemplateOptions instance + */ + public DeleteRoleTemplateOptions build() { + return new DeleteRoleTemplateOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the DeleteRoleTemplateOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + } + + protected DeleteRoleTemplateOptions() { } + + protected DeleteRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + roleTemplateId = builder.roleTemplateId; + } + + /** + * New builder. + * + * @return a DeleteRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java new file mode 100644 index 00000000000..9f974213165 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteRoleTemplateVersion options. + */ +public class DeleteRoleTemplateVersionOptions extends GenericModel { + + protected String roleTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing DeleteRoleTemplateVersionOptions instance. + * + * @param deleteRoleTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptions) { + this.roleTemplateId = deleteRoleTemplateVersionOptions.roleTemplateId; + this.version = deleteRoleTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + * @param version the version + */ + public Builder(String roleTemplateId, String version) { + this.roleTemplateId = roleTemplateId; + this.version = version; + } + + /** + * Builds a DeleteRoleTemplateVersionOptions. + * + * @return the new DeleteRoleTemplateVersionOptions instance + */ + public DeleteRoleTemplateVersionOptions build() { + return new DeleteRoleTemplateVersionOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the DeleteRoleTemplateVersionOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the DeleteRoleTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected DeleteRoleTemplateVersionOptions() { } + + protected DeleteRoleTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + roleTemplateId = builder.roleTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a DeleteRoleTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the version. + * + * Role template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java new file mode 100644 index 00000000000..92c1caaa34c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteV2Policy options. + */ +public class DeleteV2PolicyOptions extends GenericModel { + + protected String id; + + /** + * Builder. + */ + public static class Builder { + private String id; + + /** + * Instantiates a new Builder from an existing DeleteV2PolicyOptions instance. + * + * @param deleteV2PolicyOptions the instance to initialize the Builder with + */ + private Builder(DeleteV2PolicyOptions deleteV2PolicyOptions) { + this.id = deleteV2PolicyOptions.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 DeleteV2PolicyOptions. + * + * @return the new DeleteV2PolicyOptions instance + */ + public DeleteV2PolicyOptions build() { + return new DeleteV2PolicyOptions(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the DeleteV2PolicyOptions builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + } + + protected DeleteV2PolicyOptions() { } + + protected DeleteV2PolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, + "id cannot be empty"); + id = builder.id; + } + + /** + * New builder. + * + * @return a DeleteV2PolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String id() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java new file mode 100644 index 00000000000..0978eb1040b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java @@ -0,0 +1,81 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role associated with a policy with additional information (display_name, description, actions) when + * `format=display`. + */ +public class EnrichedRoles extends GenericModel { + + @SerializedName("role_id") + protected String roleId; + @SerializedName("display_name") + protected String displayName; + protected String description; + protected List actions; + + protected EnrichedRoles() { } + + /** + * Gets the roleId. + * + * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. + * + * @return the roleId + */ + public String getRoleId() { + return roleId; + } + + /** + * Gets the displayName. + * + * The display name of the role, either service-defined or user-defined for custom roles. + * + * @return the displayName + */ + public String getDisplayName() { + return displayName; + } + + /** + * Gets the description. + * + * The role description, either service-defined or user-defined for custom roles. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List getActions() { + return actions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java new file mode 100644 index 00000000000..e99ea48f5f6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Additional error details. + */ +public class ErrorDetails extends GenericModel { + + @SerializedName("conflicts_with") + protected ConflictsWith conflictsWith; + + protected ErrorDetails() { } + + /** + * Gets the conflictsWith. + * + * Details of conflicting resource. + * + * @return the conflictsWith + */ + public ConflictsWith getConflictsWith() { + return conflictsWith; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java new file mode 100644 index 00000000000..b5411a7bb36 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java @@ -0,0 +1,128 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * ErrorObject. + */ +public class ErrorObject extends GenericModel { + + /** + * The API error code for the error. + */ + public interface Code { + /** insufficent_permissions. */ + String INSUFFICENT_PERMISSIONS = "insufficent_permissions"; + /** invalid_body. */ + String INVALID_BODY = "invalid_body"; + /** invalid_token. */ + String INVALID_TOKEN = "invalid_token"; + /** missing_required_query_parameter. */ + String MISSING_REQUIRED_QUERY_PARAMETER = "missing_required_query_parameter"; + /** not_found. */ + String NOT_FOUND = "not_found"; + /** policy_conflict_error. */ + String POLICY_CONFLICT_ERROR = "policy_conflict_error"; + /** policy_not_found. */ + String POLICY_NOT_FOUND = "policy_not_found"; + /** request_not_processed. */ + String REQUEST_NOT_PROCESSED = "request_not_processed"; + /** role_conflict_error. */ + String ROLE_CONFLICT_ERROR = "role_conflict_error"; + /** role_not_found. */ + String ROLE_NOT_FOUND = "role_not_found"; + /** too_many_requests. */ + String TOO_MANY_REQUESTS = "too_many_requests"; + /** unable_to_process. */ + String UNABLE_TO_PROCESS = "unable_to_process"; + /** unsupported_content_type. */ + String UNSUPPORTED_CONTENT_TYPE = "unsupported_content_type"; + /** policy_template_conflict_error. */ + String POLICY_TEMPLATE_CONFLICT_ERROR = "policy_template_conflict_error"; + /** policy_template_not_found. */ + String POLICY_TEMPLATE_NOT_FOUND = "policy_template_not_found"; + /** policy_assignment_not_found. */ + String POLICY_ASSIGNMENT_NOT_FOUND = "policy_assignment_not_found"; + /** policy_assignment_conflict_error. */ + String POLICY_ASSIGNMENT_CONFLICT_ERROR = "policy_assignment_conflict_error"; + /** resource_not_found. */ + String RESOURCE_NOT_FOUND = "resource_not_found"; + /** action_control_template_not_found. */ + String ACTION_CONTROL_TEMPLATE_NOT_FOUND = "action_control_template_not_found"; + /** action_control_assignment_not_found. */ + String ACTION_CONTROL_ASSIGNMENT_NOT_FOUND = "action_control_assignment_not_found"; + /** role_template_conflict_error. */ + String ROLE_TEMPLATE_CONFLICT_ERROR = "role_template_conflict_error"; + /** role_template_not_found. */ + String ROLE_TEMPLATE_NOT_FOUND = "role_template_not_found"; + /** role_assignment_not_found. */ + String ROLE_ASSIGNMENT_NOT_FOUND = "role_assignment_not_found"; + } + + protected String code; + protected String message; + protected ErrorDetails details; + @SerializedName("more_info") + protected String moreInfo; + + protected ErrorObject() { } + + /** + * Gets the code. + * + * The API error code for the error. + * + * @return the code + */ + public String getCode() { + return code; + } + + /** + * Gets the message. + * + * The error message returned by the API. + * + * @return the message + */ + public String getMessage() { + return message; + } + + /** + * Gets the details. + * + * Additional error details. + * + * @return the details + */ + public ErrorDetails getDetails() { + return details; + } + + /** + * Gets the moreInfo. + * + * Additional info for error. + * + * @return the moreInfo + */ + public String getMoreInfo() { + return moreInfo; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java new file mode 100644 index 00000000000..5c1c9a9fad6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * How external accounts can interact in relation to the requested account. + */ +public class ExternalAccountIdentityInteraction extends GenericModel { + + @SerializedName("identity_types") + protected IdentityTypes identityTypes; + + protected ExternalAccountIdentityInteraction() { } + + /** + * Gets the identityTypes. + * + * The settings for each identity type. + * + * @return the identityTypes + */ + public IdentityTypes getIdentityTypes() { + return identityTypes; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java new file mode 100644 index 00000000000..1efd0673e9d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java @@ -0,0 +1,95 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Update to how external accounts can interact in relation to the requested account. + */ +public class ExternalAccountIdentityInteractionPatch extends GenericModel { + + @SerializedName("identity_types") + protected IdentityTypesPatch identityTypes; + + /** + * Builder. + */ + public static class Builder { + private IdentityTypesPatch identityTypes; + + /** + * Instantiates a new Builder from an existing ExternalAccountIdentityInteractionPatch instance. + * + * @param externalAccountIdentityInteractionPatch the instance to initialize the Builder with + */ + private Builder(ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatch) { + this.identityTypes = externalAccountIdentityInteractionPatch.identityTypes; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ExternalAccountIdentityInteractionPatch. + * + * @return the new ExternalAccountIdentityInteractionPatch instance + */ + public ExternalAccountIdentityInteractionPatch build() { + return new ExternalAccountIdentityInteractionPatch(this); + } + + /** + * Set the identityTypes. + * + * @param identityTypes the identityTypes + * @return the ExternalAccountIdentityInteractionPatch builder + */ + public Builder identityTypes(IdentityTypesPatch identityTypes) { + this.identityTypes = identityTypes; + return this; + } + } + + protected ExternalAccountIdentityInteractionPatch() { } + + protected ExternalAccountIdentityInteractionPatch(Builder builder) { + identityTypes = builder.identityTypes; + } + + /** + * New builder. + * + * @return a ExternalAccountIdentityInteractionPatch builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the identityTypes. + * + * The settings to apply for each identity type for a request. + * + * @return the identityTypes + */ + public IdentityTypesPatch identityTypes() { + return identityTypes; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java new file mode 100644 index 00000000000..83cd67d33c9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Details with linking href to first page of requested collection. + */ +public class First extends GenericModel { + + protected String href; + + protected First() { } + + /** + * Gets the href. + * + * The href linking to the page of requested collection. + * + * @return the href + */ + public String getHref() { + return href; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java new file mode 100644 index 00000000000..f87e7d741a4 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getActionControlAssignment options. + */ +public class GetActionControlAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing GetActionControlAssignmentOptions instance. + * + * @param getActionControlAssignmentOptions the instance to initialize the Builder with + */ + private Builder(GetActionControlAssignmentOptions getActionControlAssignmentOptions) { + this.assignmentId = getActionControlAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a GetActionControlAssignmentOptions. + * + * @return the new GetActionControlAssignmentOptions instance + */ + public GetActionControlAssignmentOptions build() { + return new GetActionControlAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the GetActionControlAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected GetActionControlAssignmentOptions() { } + + protected GetActionControlAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a GetActionControlAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Action control template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java new file mode 100644 index 00000000000..963c68e8876 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java @@ -0,0 +1,140 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getActionControlTemplate options. + */ +public class GetActionControlTemplateOptions extends GenericModel { + + /** + * The action control template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String actionControlTemplateId; + protected String state; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String state; + + /** + * Instantiates a new Builder from an existing GetActionControlTemplateOptions instance. + * + * @param getActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(GetActionControlTemplateOptions getActionControlTemplateOptions) { + this.actionControlTemplateId = getActionControlTemplateOptions.actionControlTemplateId; + this.state = getActionControlTemplateOptions.state; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + */ + public Builder(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + } + + /** + * Builds a GetActionControlTemplateOptions. + * + * @return the new GetActionControlTemplateOptions instance + */ + public GetActionControlTemplateOptions build() { + return new GetActionControlTemplateOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the GetActionControlTemplateOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the GetActionControlTemplateOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + } + + protected GetActionControlTemplateOptions() { } + + protected GetActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + state = builder.state; + } + + /** + * New builder. + * + * @return a GetActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the state. + * + * The action control template state. + * + * @return the state + */ + public String state() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java new file mode 100644 index 00000000000..95bc94950bb --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getActionControlTemplateVersion options. + */ +public class GetActionControlTemplateVersionOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing GetActionControlTemplateVersionOptions instance. + * + * @param getActionControlTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptions) { + this.actionControlTemplateId = getActionControlTemplateVersionOptions.actionControlTemplateId; + this.version = getActionControlTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + * @param version the version + */ + public Builder(String actionControlTemplateId, String version) { + this.actionControlTemplateId = actionControlTemplateId; + this.version = version; + } + + /** + * Builds a GetActionControlTemplateVersionOptions. + * + * @return the new GetActionControlTemplateVersionOptions instance + */ + public GetActionControlTemplateVersionOptions build() { + return new GetActionControlTemplateVersionOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the GetActionControlTemplateVersionOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the GetActionControlTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected GetActionControlTemplateVersionOptions() { } + + protected GetActionControlTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a GetActionControlTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java new file mode 100644 index 00000000000..d1c7c359003 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getPolicyAssignment options. + */ +public class GetPolicyAssignmentOptions extends GenericModel { + + protected String assignmentId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + private String version; + + /** + * Instantiates a new Builder from an existing GetPolicyAssignmentOptions instance. + * + * @param getPolicyAssignmentOptions the instance to initialize the Builder with + */ + private Builder(GetPolicyAssignmentOptions getPolicyAssignmentOptions) { + this.assignmentId = getPolicyAssignmentOptions.assignmentId; + this.version = getPolicyAssignmentOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + * @param version the version + */ + public Builder(String assignmentId, String version) { + this.assignmentId = assignmentId; + this.version = version; + } + + /** + * Builds a GetPolicyAssignmentOptions. + * + * @return the new GetPolicyAssignmentOptions instance + */ + public GetPolicyAssignmentOptions build() { + return new GetPolicyAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the GetPolicyAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the GetPolicyAssignmentOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected GetPolicyAssignmentOptions() { } + + protected GetPolicyAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + assignmentId = builder.assignmentId; + version = builder.version; + } + + /** + * New builder. + * + * @return a GetPolicyAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * The policy template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } + + /** + * Gets the version. + * + * specify version of response body format. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java new file mode 100644 index 00000000000..e780ac06896 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getPolicy options. + */ +public class GetPolicyOptions extends GenericModel { + + protected String policyId; + + /** + * Builder. + */ + public static class Builder { + private String policyId; + + /** + * Instantiates a new Builder from an existing GetPolicyOptions instance. + * + * @param getPolicyOptions the instance to initialize the Builder with + */ + private Builder(GetPolicyOptions getPolicyOptions) { + this.policyId = getPolicyOptions.policyId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyId the policyId + */ + public Builder(String policyId) { + this.policyId = policyId; + } + + /** + * Builds a GetPolicyOptions. + * + * @return the new GetPolicyOptions instance + */ + public GetPolicyOptions build() { + return new GetPolicyOptions(this); + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the GetPolicyOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + } + + protected GetPolicyOptions() { } + + protected GetPolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId cannot be empty"); + policyId = builder.policyId; + } + + /** + * New builder. + * + * @return a GetPolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyId. + * + * The policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java new file mode 100644 index 00000000000..ee604554a85 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java @@ -0,0 +1,140 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getPolicyTemplate options. + */ +public class GetPolicyTemplateOptions extends GenericModel { + + /** + * The policy template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String policyTemplateId; + protected String state; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String state; + + /** + * Instantiates a new Builder from an existing GetPolicyTemplateOptions instance. + * + * @param getPolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(GetPolicyTemplateOptions getPolicyTemplateOptions) { + this.policyTemplateId = getPolicyTemplateOptions.policyTemplateId; + this.state = getPolicyTemplateOptions.state; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + */ + public Builder(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + } + + /** + * Builds a GetPolicyTemplateOptions. + * + * @return the new GetPolicyTemplateOptions instance + */ + public GetPolicyTemplateOptions build() { + return new GetPolicyTemplateOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the GetPolicyTemplateOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the GetPolicyTemplateOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + } + + protected GetPolicyTemplateOptions() { } + + protected GetPolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + policyTemplateId = builder.policyTemplateId; + state = builder.state; + } + + /** + * New builder. + * + * @return a GetPolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the state. + * + * The policy template state. + * + * @return the state + */ + public String state() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java new file mode 100644 index 00000000000..8741f83357d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getPolicyTemplateVersion options. + */ +public class GetPolicyTemplateVersionOptions extends GenericModel { + + protected String policyTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing GetPolicyTemplateVersionOptions instance. + * + * @param getPolicyTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptions) { + this.policyTemplateId = getPolicyTemplateVersionOptions.policyTemplateId; + this.version = getPolicyTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param version the version + */ + public Builder(String policyTemplateId, String version) { + this.policyTemplateId = policyTemplateId; + this.version = version; + } + + /** + * Builds a GetPolicyTemplateVersionOptions. + * + * @return the new GetPolicyTemplateVersionOptions instance + */ + public GetPolicyTemplateVersionOptions build() { + return new GetPolicyTemplateVersionOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the GetPolicyTemplateVersionOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the GetPolicyTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected GetPolicyTemplateVersionOptions() { } + + protected GetPolicyTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + policyTemplateId = builder.policyTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a GetPolicyTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the version. + * + * The policy template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java new file mode 100644 index 00000000000..35313b9b746 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getRoleAssignment options. + */ +public class GetRoleAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing GetRoleAssignmentOptions instance. + * + * @param getRoleAssignmentOptions the instance to initialize the Builder with + */ + private Builder(GetRoleAssignmentOptions getRoleAssignmentOptions) { + this.assignmentId = getRoleAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a GetRoleAssignmentOptions. + * + * @return the new GetRoleAssignmentOptions instance + */ + public GetRoleAssignmentOptions build() { + return new GetRoleAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the GetRoleAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected GetRoleAssignmentOptions() { } + + protected GetRoleAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a GetRoleAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Role template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java new file mode 100644 index 00000000000..8c56ac7f58a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getRole options. + */ +public class GetRoleOptions extends GenericModel { + + protected String roleId; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + + /** + * Instantiates a new Builder from an existing GetRoleOptions instance. + * + * @param getRoleOptions the instance to initialize the Builder with + */ + private Builder(GetRoleOptions getRoleOptions) { + this.roleId = getRoleOptions.roleId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + */ + public Builder(String roleId) { + this.roleId = roleId; + } + + /** + * Builds a GetRoleOptions. + * + * @return the new GetRoleOptions instance + */ + public GetRoleOptions build() { + return new GetRoleOptions(this); + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the GetRoleOptions builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + } + + protected GetRoleOptions() { } + + protected GetRoleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, + "roleId cannot be empty"); + roleId = builder.roleId; + } + + /** + * New builder. + * + * @return a GetRoleOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role ID. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java new file mode 100644 index 00000000000..e33fcf29b32 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java @@ -0,0 +1,140 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getRoleTemplate options. + */ +public class GetRoleTemplateOptions extends GenericModel { + + /** + * The role template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String roleTemplateId; + protected String state; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String state; + + /** + * Instantiates a new Builder from an existing GetRoleTemplateOptions instance. + * + * @param getRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(GetRoleTemplateOptions getRoleTemplateOptions) { + this.roleTemplateId = getRoleTemplateOptions.roleTemplateId; + this.state = getRoleTemplateOptions.state; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + */ + public Builder(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + } + + /** + * Builds a GetRoleTemplateOptions. + * + * @return the new GetRoleTemplateOptions instance + */ + public GetRoleTemplateOptions build() { + return new GetRoleTemplateOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the GetRoleTemplateOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the GetRoleTemplateOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + } + + protected GetRoleTemplateOptions() { } + + protected GetRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + roleTemplateId = builder.roleTemplateId; + state = builder.state; + } + + /** + * New builder. + * + * @return a GetRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the state. + * + * The role template state. + * + * @return the state + */ + public String state() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java new file mode 100644 index 00000000000..4757484f969 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getRoleTemplateVersion options. + */ +public class GetRoleTemplateVersionOptions extends GenericModel { + + protected String roleTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing GetRoleTemplateVersionOptions instance. + * + * @param getRoleTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(GetRoleTemplateVersionOptions getRoleTemplateVersionOptions) { + this.roleTemplateId = getRoleTemplateVersionOptions.roleTemplateId; + this.version = getRoleTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + * @param version the version + */ + public Builder(String roleTemplateId, String version) { + this.roleTemplateId = roleTemplateId; + this.version = version; + } + + /** + * Builds a GetRoleTemplateVersionOptions. + * + * @return the new GetRoleTemplateVersionOptions instance + */ + public GetRoleTemplateVersionOptions build() { + return new GetRoleTemplateVersionOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the GetRoleTemplateVersionOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the GetRoleTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected GetRoleTemplateVersionOptions() { } + + protected GetRoleTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + roleTemplateId = builder.roleTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a GetRoleTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the version. + * + * Role template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java new file mode 100644 index 00000000000..ebc88bbf45c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getSettings options. + */ +public class GetSettingsOptions extends GenericModel { + + protected String accountId; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing GetSettingsOptions instance. + * + * @param getSettingsOptions the instance to initialize the Builder with + */ + private Builder(GetSettingsOptions getSettingsOptions) { + this.accountId = getSettingsOptions.accountId; + this.acceptLanguage = getSettingsOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a GetSettingsOptions. + * + * @return the new GetSettingsOptions instance + */ + public GetSettingsOptions build() { + return new GetSettingsOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the GetSettingsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the GetSettingsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected GetSettingsOptions() { } + + protected GetSettingsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.accountId, + "accountId cannot be empty"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a GetSettingsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the settings belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java new file mode 100644 index 00000000000..23a950cc815 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java @@ -0,0 +1,148 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getV2Policy options. + */ +public class GetV2PolicyOptions extends GenericModel { + + /** + * Include additional data for policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles and translations for all + * relevant fields. + */ + public interface Format { + /** include_last_permit. */ + String INCLUDE_LAST_PERMIT = "include_last_permit"; + /** display. */ + String DISPLAY = "display"; + } + + protected String id; + protected String format; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String format; + + /** + * Instantiates a new Builder from an existing GetV2PolicyOptions instance. + * + * @param getV2PolicyOptions the instance to initialize the Builder with + */ + private Builder(GetV2PolicyOptions getV2PolicyOptions) { + this.id = getV2PolicyOptions.id; + this.format = getV2PolicyOptions.format; + } + + /** + * 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 GetV2PolicyOptions. + * + * @return the new GetV2PolicyOptions instance + */ + public GetV2PolicyOptions build() { + return new GetV2PolicyOptions(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the GetV2PolicyOptions builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the format. + * + * @param format the format + * @return the GetV2PolicyOptions builder + */ + public Builder format(String format) { + this.format = format; + return this; + } + } + + protected GetV2PolicyOptions() { } + + protected GetV2PolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, + "id cannot be empty"); + id = builder.id; + format = builder.format; + } + + /** + * New builder. + * + * @return a GetV2PolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the format. + * + * Include additional data for policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles and translations for all + * relevant fields. + * + * @return the format + */ + public String format() { + return format; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java new file mode 100644 index 00000000000..d8439c9d6f7 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java @@ -0,0 +1,124 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Permission is granted by the policy. + */ +public class Grant extends GenericModel { + + protected List roles; + + /** + * Builder. + */ + public static class Builder { + private List roles; + + /** + * Instantiates a new Builder from an existing Grant instance. + * + * @param grant the instance to initialize the Builder with + */ + private Builder(Grant grant) { + this.roles = grant.roles; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roles the roles + */ + public Builder(List roles) { + this.roles = roles; + } + + /** + * Builds a Grant. + * + * @return the new Grant instance + */ + public Grant build() { + return new Grant(this); + } + + /** + * Adds a new element to roles. + * + * @param roles the new element to be added + * @return the Grant builder + */ + public Builder addRoles(Roles roles) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roles, + "roles cannot be null"); + if (this.roles == null) { + this.roles = new ArrayList(); + } + this.roles.add(roles); + return this; + } + + /** + * Set the roles. + * Existing roles will be replaced. + * + * @param roles the roles + * @return the Grant builder + */ + public Builder roles(List roles) { + this.roles = roles; + return this; + } + } + + protected Grant() { } + + protected Grant(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, + "roles cannot be null"); + roles = builder.roles; + } + + /** + * New builder. + * + * @return a Grant builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List roles() { + return roles; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java new file mode 100644 index 00000000000..1dbc53fefb6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Permission granted by the policy with translated roles and additional role information. + */ +public class GrantWithEnrichedRoles extends GenericModel { + + protected List roles; + + protected GrantWithEnrichedRoles() { } + + /** + * Gets the roles. + * + * A set of roles granted by the policy. + * + * @return the roles + */ + public List getRoles() { + return roles; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java new file mode 100644 index 00000000000..0ac71d8192b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java @@ -0,0 +1,64 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The settings for each identity type. + */ +public class IdentityTypes extends GenericModel { + + protected IdentityTypesBase user; + @SerializedName("service_id") + protected IdentityTypesBase serviceId; + protected IdentityTypesBase service; + + protected IdentityTypes() { } + + /** + * Gets the user. + * + * The core set of properties associated with an identity type. + * + * @return the user + */ + public IdentityTypesBase getUser() { + return user; + } + + /** + * Gets the serviceId. + * + * The core set of properties associated with an identity type. + * + * @return the serviceId + */ + public IdentityTypesBase getServiceId() { + return serviceId; + } + + /** + * Gets the service. + * + * The core set of properties associated with an identity type. + * + * @return the service + */ + public IdentityTypesBase getService() { + return service; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java new file mode 100644 index 00000000000..e8df91a1e5d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java @@ -0,0 +1,168 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with an identity type. + */ +public class IdentityTypesBase extends GenericModel { + + /** + * The state of the identity type. + */ + public interface State { + /** enabled. */ + String ENABLED = "enabled"; + /** monitor. */ + String MONITOR = "monitor"; + /** limited. */ + String LIMITED = "limited"; + } + + protected String state; + @SerializedName("external_allowed_accounts") + protected List externalAllowedAccounts; + + /** + * Builder. + */ + public static class Builder { + private String state; + private List externalAllowedAccounts; + + /** + * Instantiates a new Builder from an existing IdentityTypesBase instance. + * + * @param identityTypesBase the instance to initialize the Builder with + */ + private Builder(IdentityTypesBase identityTypesBase) { + this.state = identityTypesBase.state; + this.externalAllowedAccounts = identityTypesBase.externalAllowedAccounts; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param state the state + * @param externalAllowedAccounts the externalAllowedAccounts + */ + public Builder(String state, List externalAllowedAccounts) { + this.state = state; + this.externalAllowedAccounts = externalAllowedAccounts; + } + + /** + * Builds a IdentityTypesBase. + * + * @return the new IdentityTypesBase instance + */ + public IdentityTypesBase build() { + return new IdentityTypesBase(this); + } + + /** + * Adds a new element to externalAllowedAccounts. + * + * @param externalAllowedAccounts the new element to be added + * @return the IdentityTypesBase builder + */ + public Builder addExternalAllowedAccounts(String externalAllowedAccounts) { + com.ibm.cloud.sdk.core.util.Validator.notNull(externalAllowedAccounts, + "externalAllowedAccounts cannot be null"); + if (this.externalAllowedAccounts == null) { + this.externalAllowedAccounts = new ArrayList(); + } + this.externalAllowedAccounts.add(externalAllowedAccounts); + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the IdentityTypesBase builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the externalAllowedAccounts. + * Existing externalAllowedAccounts will be replaced. + * + * @param externalAllowedAccounts the externalAllowedAccounts + * @return the IdentityTypesBase builder + */ + public Builder externalAllowedAccounts(List externalAllowedAccounts) { + this.externalAllowedAccounts = externalAllowedAccounts; + return this; + } + } + + protected IdentityTypesBase() { } + + protected IdentityTypesBase(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.state, + "state cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.externalAllowedAccounts, + "externalAllowedAccounts cannot be null"); + state = builder.state; + externalAllowedAccounts = builder.externalAllowedAccounts; + } + + /** + * New builder. + * + * @return a IdentityTypesBase builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the state. + * + * The state of the identity type. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the externalAllowedAccounts. + * + * List of accounts that the state applies to for a given identity. + * + * @return the externalAllowedAccounts + */ + public List externalAllowedAccounts() { + return externalAllowedAccounts; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java new file mode 100644 index 00000000000..77aa5a26366 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java @@ -0,0 +1,147 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The settings to apply for each identity type for a request. + */ +public class IdentityTypesPatch extends GenericModel { + + protected IdentityTypesBase user; + @SerializedName("service_id") + protected IdentityTypesBase serviceId; + protected IdentityTypesBase service; + + /** + * Builder. + */ + public static class Builder { + private IdentityTypesBase user; + private IdentityTypesBase serviceId; + private IdentityTypesBase service; + + /** + * Instantiates a new Builder from an existing IdentityTypesPatch instance. + * + * @param identityTypesPatch the instance to initialize the Builder with + */ + private Builder(IdentityTypesPatch identityTypesPatch) { + this.user = identityTypesPatch.user; + this.serviceId = identityTypesPatch.serviceId; + this.service = identityTypesPatch.service; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a IdentityTypesPatch. + * + * @return the new IdentityTypesPatch instance + */ + public IdentityTypesPatch build() { + return new IdentityTypesPatch(this); + } + + /** + * Set the user. + * + * @param user the user + * @return the IdentityTypesPatch builder + */ + public Builder user(IdentityTypesBase user) { + this.user = user; + return this; + } + + /** + * Set the serviceId. + * + * @param serviceId the serviceId + * @return the IdentityTypesPatch builder + */ + public Builder serviceId(IdentityTypesBase serviceId) { + this.serviceId = serviceId; + return this; + } + + /** + * Set the service. + * + * @param service the service + * @return the IdentityTypesPatch builder + */ + public Builder service(IdentityTypesBase service) { + this.service = service; + return this; + } + } + + protected IdentityTypesPatch() { } + + protected IdentityTypesPatch(Builder builder) { + user = builder.user; + serviceId = builder.serviceId; + service = builder.service; + } + + /** + * New builder. + * + * @return a IdentityTypesPatch builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the user. + * + * The core set of properties associated with an identity type. + * + * @return the user + */ + public IdentityTypesBase user() { + return user; + } + + /** + * Gets the serviceId. + * + * The core set of properties associated with an identity type. + * + * @return the serviceId + */ + public IdentityTypesBase serviceId() { + return serviceId; + } + + /** + * Gets the service. + * + * The core set of properties associated with an identity type. + * + * @return the service + */ + public IdentityTypesBase service() { + return service; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java new file mode 100644 index 00000000000..5aa0b39573b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * policy template current and limit details with in an account. + */ +public class LimitData extends GenericModel { + + protected Long current; + protected Long limit; + + protected LimitData() { } + + /** + * Gets the current. + * + * policy template current count. + * + * @return the current + */ + public Long getCurrent() { + return current; + } + + /** + * Gets the limit. + * + * policy template limit count. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java new file mode 100644 index 00000000000..6835f5afccc --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java @@ -0,0 +1,245 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listActionControlAssignments options. + */ +public class ListActionControlAssignmentsOptions extends GenericModel { + + protected String accountId; + protected String acceptLanguage; + protected String templateId; + protected String templateVersion; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String templateId; + private String templateVersion; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListActionControlAssignmentsOptions instance. + * + * @param listActionControlAssignmentsOptions the instance to initialize the Builder with + */ + private Builder(ListActionControlAssignmentsOptions listActionControlAssignmentsOptions) { + this.accountId = listActionControlAssignmentsOptions.accountId; + this.acceptLanguage = listActionControlAssignmentsOptions.acceptLanguage; + this.templateId = listActionControlAssignmentsOptions.templateId; + this.templateVersion = listActionControlAssignmentsOptions.templateVersion; + this.limit = listActionControlAssignmentsOptions.limit; + this.start = listActionControlAssignmentsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListActionControlAssignmentsOptions. + * + * @return the new ListActionControlAssignmentsOptions instance + */ + public ListActionControlAssignmentsOptions build() { + return new ListActionControlAssignmentsOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the templateId. + * + * @param templateId the templateId + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder templateId(String templateId) { + this.templateId = templateId; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListActionControlAssignmentsOptions() { } + + protected ListActionControlAssignmentsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + templateId = builder.templateId; + templateVersion = builder.templateVersion; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListActionControlAssignmentsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID in which the action control assignment belongs to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the templateId. + * + * Optional template ID. + * + * @return the templateId + */ + public String templateId() { + return templateId; + } + + /** + * Gets the templateVersion. + * + * Optional action control template version. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java new file mode 100644 index 00000000000..984d1060c83 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listActionControlTemplateVersions options. + */ +public class ListActionControlTemplateVersionsOptions extends GenericModel { + + /** + * Action control template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String actionControlTemplateId; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListActionControlTemplateVersionsOptions instance. + * + * @param listActionControlTemplateVersionsOptions the instance to initialize the Builder with + */ + private Builder(ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions) { + this.actionControlTemplateId = listActionControlTemplateVersionsOptions.actionControlTemplateId; + this.state = listActionControlTemplateVersionsOptions.state; + this.limit = listActionControlTemplateVersionsOptions.limit; + this.start = listActionControlTemplateVersionsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + */ + public Builder(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + } + + /** + * Builds a ListActionControlTemplateVersionsOptions. + * + * @return the new ListActionControlTemplateVersionsOptions instance + */ + public ListActionControlTemplateVersionsOptions build() { + return new ListActionControlTemplateVersionsOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the ListActionControlTemplateVersionsOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListActionControlTemplateVersionsOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListActionControlTemplateVersionsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListActionControlTemplateVersionsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListActionControlTemplateVersionsOptions() { } + + protected ListActionControlTemplateVersionsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListActionControlTemplateVersionsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * The action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the state. + * + * Action control template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java new file mode 100644 index 00000000000..d019db6119f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java @@ -0,0 +1,193 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listActionControlTemplates options. + */ +public class ListActionControlTemplatesOptions extends GenericModel { + + protected String accountId; + protected String acceptLanguage; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListActionControlTemplatesOptions instance. + * + * @param listActionControlTemplatesOptions the instance to initialize the Builder with + */ + private Builder(ListActionControlTemplatesOptions listActionControlTemplatesOptions) { + this.accountId = listActionControlTemplatesOptions.accountId; + this.acceptLanguage = listActionControlTemplatesOptions.acceptLanguage; + this.limit = listActionControlTemplatesOptions.limit; + this.start = listActionControlTemplatesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListActionControlTemplatesOptions. + * + * @return the new ListActionControlTemplatesOptions instance + */ + public ListActionControlTemplatesOptions build() { + return new ListActionControlTemplatesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListActionControlTemplatesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListActionControlTemplatesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListActionControlTemplatesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListActionControlTemplatesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListActionControlTemplatesOptions() { } + + protected ListActionControlTemplatesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListActionControlTemplatesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the action control templates belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java new file mode 100644 index 00000000000..90ecb352c37 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java @@ -0,0 +1,501 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listPolicies options. + */ +public class ListPoliciesOptions extends GenericModel { + + /** + * Optional type of policy. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + /** + * Optional type of service. + */ + public interface ServiceType { + /** service. */ + String SERVICE = "service"; + /** platform_service. */ + String PLATFORM_SERVICE = "platform_service"; + } + + /** + * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending + * '-' to field. Example '-last_modified_at'. + */ + public interface Sort { + /** id. */ + String ID = "id"; + /** type. */ + String TYPE = "type"; + /** href. */ + String HREF = "href"; + /** created_at. */ + String CREATED_AT = "created_at"; + /** created_by_id. */ + String CREATED_BY_ID = "created_by_id"; + /** last_modified_at. */ + String LAST_MODIFIED_AT = "last_modified_at"; + /** last_modified_by_id. */ + String LAST_MODIFIED_BY_ID = "last_modified_by_id"; + /** state. */ + String STATE = "state"; + } + + /** + * Include additional data per policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles. + */ + public interface Format { + /** include_last_permit. */ + String INCLUDE_LAST_PERMIT = "include_last_permit"; + /** display. */ + String DISPLAY = "display"; + } + + /** + * The state of the policy. + * * `active` - returns active policies + * * `deleted` - returns non-active policies. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String accountId; + protected String acceptLanguage; + protected String iamId; + protected String accessGroupId; + protected String type; + protected String serviceType; + protected String tagName; + protected String tagValue; + protected String sort; + protected String format; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String iamId; + private String accessGroupId; + private String type; + private String serviceType; + private String tagName; + private String tagValue; + private String sort; + private String format; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListPoliciesOptions instance. + * + * @param listPoliciesOptions the instance to initialize the Builder with + */ + private Builder(ListPoliciesOptions listPoliciesOptions) { + this.accountId = listPoliciesOptions.accountId; + this.acceptLanguage = listPoliciesOptions.acceptLanguage; + this.iamId = listPoliciesOptions.iamId; + this.accessGroupId = listPoliciesOptions.accessGroupId; + this.type = listPoliciesOptions.type; + this.serviceType = listPoliciesOptions.serviceType; + this.tagName = listPoliciesOptions.tagName; + this.tagValue = listPoliciesOptions.tagValue; + this.sort = listPoliciesOptions.sort; + this.format = listPoliciesOptions.format; + this.state = listPoliciesOptions.state; + this.limit = listPoliciesOptions.limit; + this.start = listPoliciesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListPoliciesOptions. + * + * @return the new ListPoliciesOptions instance + */ + public ListPoliciesOptions build() { + return new ListPoliciesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListPoliciesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListPoliciesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the iamId. + * + * @param iamId the iamId + * @return the ListPoliciesOptions builder + */ + public Builder iamId(String iamId) { + this.iamId = iamId; + return this; + } + + /** + * Set the accessGroupId. + * + * @param accessGroupId the accessGroupId + * @return the ListPoliciesOptions builder + */ + public Builder accessGroupId(String accessGroupId) { + this.accessGroupId = accessGroupId; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the ListPoliciesOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the serviceType. + * + * @param serviceType the serviceType + * @return the ListPoliciesOptions builder + */ + public Builder serviceType(String serviceType) { + this.serviceType = serviceType; + return this; + } + + /** + * Set the tagName. + * + * @param tagName the tagName + * @return the ListPoliciesOptions builder + */ + public Builder tagName(String tagName) { + this.tagName = tagName; + return this; + } + + /** + * Set the tagValue. + * + * @param tagValue the tagValue + * @return the ListPoliciesOptions builder + */ + public Builder tagValue(String tagValue) { + this.tagValue = tagValue; + return this; + } + + /** + * Set the sort. + * + * @param sort the sort + * @return the ListPoliciesOptions builder + */ + public Builder sort(String sort) { + this.sort = sort; + return this; + } + + /** + * Set the format. + * + * @param format the format + * @return the ListPoliciesOptions builder + */ + public Builder format(String format) { + this.format = format; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListPoliciesOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListPoliciesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListPoliciesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListPoliciesOptions() { } + + protected ListPoliciesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + iamId = builder.iamId; + accessGroupId = builder.accessGroupId; + type = builder.type; + serviceType = builder.serviceType; + tagName = builder.tagName; + tagValue = builder.tagValue; + sort = builder.sort; + format = builder.format; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListPoliciesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the policies belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the iamId. + * + * Optional IAM ID used to identify the subject. + * + * @return the iamId + */ + public String iamId() { + return iamId; + } + + /** + * Gets the accessGroupId. + * + * Optional access group id. + * + * @return the accessGroupId + */ + public String accessGroupId() { + return accessGroupId; + } + + /** + * Gets the type. + * + * Optional type of policy. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the serviceType. + * + * Optional type of service. + * + * @return the serviceType + */ + public String serviceType() { + return serviceType; + } + + /** + * Gets the tagName. + * + * Optional name of the access tag in the policy. + * + * @return the tagName + */ + public String tagName() { + return tagName; + } + + /** + * Gets the tagValue. + * + * Optional value of the access tag in the policy. + * + * @return the tagValue + */ + public String tagValue() { + return tagValue; + } + + /** + * Gets the sort. + * + * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending + * '-' to field. Example '-last_modified_at'. + * + * @return the sort + */ + public String sort() { + return sort; + } + + /** + * Gets the format. + * + * Include additional data per policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles. + * + * @return the format + */ + public String format() { + return format; + } + + /** + * Gets the state. + * + * The state of the policy. + * * `active` - returns active policies + * * `deleted` - returns non-active policies. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java new file mode 100644 index 00000000000..9362749c670 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java @@ -0,0 +1,275 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listPolicyAssignments options. + */ +public class ListPolicyAssignmentsOptions extends GenericModel { + + protected String version; + protected String accountId; + protected String acceptLanguage; + protected String templateId; + protected String templateVersion; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String version; + private String accountId; + private String acceptLanguage; + private String templateId; + private String templateVersion; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListPolicyAssignmentsOptions instance. + * + * @param listPolicyAssignmentsOptions the instance to initialize the Builder with + */ + private Builder(ListPolicyAssignmentsOptions listPolicyAssignmentsOptions) { + this.version = listPolicyAssignmentsOptions.version; + this.accountId = listPolicyAssignmentsOptions.accountId; + this.acceptLanguage = listPolicyAssignmentsOptions.acceptLanguage; + this.templateId = listPolicyAssignmentsOptions.templateId; + this.templateVersion = listPolicyAssignmentsOptions.templateVersion; + this.limit = listPolicyAssignmentsOptions.limit; + this.start = listPolicyAssignmentsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param version the version + * @param accountId the accountId + */ + public Builder(String version, String accountId) { + this.version = version; + this.accountId = accountId; + } + + /** + * Builds a ListPolicyAssignmentsOptions. + * + * @return the new ListPolicyAssignmentsOptions instance + */ + public ListPolicyAssignmentsOptions build() { + return new ListPolicyAssignmentsOptions(this); + } + + /** + * Set the version. + * + * @param version the version + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the templateId. + * + * @param templateId the templateId + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder templateId(String templateId) { + this.templateId = templateId; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListPolicyAssignmentsOptions() { } + + protected ListPolicyAssignmentsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + version = builder.version; + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + templateId = builder.templateId; + templateVersion = builder.templateVersion; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListPolicyAssignmentsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the version. + * + * specify version of response body format. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the accountId. + * + * The account GUID in which the policies belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the templateId. + * + * Optional template id. + * + * @return the templateId + */ + public String templateId() { + return templateId; + } + + /** + * Gets the templateVersion. + * + * Optional policy template version. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java new file mode 100644 index 00000000000..c7965ba6c31 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listPolicyTemplateVersions options. + */ +public class ListPolicyTemplateVersionsOptions extends GenericModel { + + /** + * The policy template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String policyTemplateId; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListPolicyTemplateVersionsOptions instance. + * + * @param listPolicyTemplateVersionsOptions the instance to initialize the Builder with + */ + private Builder(ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions) { + this.policyTemplateId = listPolicyTemplateVersionsOptions.policyTemplateId; + this.state = listPolicyTemplateVersionsOptions.state; + this.limit = listPolicyTemplateVersionsOptions.limit; + this.start = listPolicyTemplateVersionsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + */ + public Builder(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + } + + /** + * Builds a ListPolicyTemplateVersionsOptions. + * + * @return the new ListPolicyTemplateVersionsOptions instance + */ + public ListPolicyTemplateVersionsOptions build() { + return new ListPolicyTemplateVersionsOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the ListPolicyTemplateVersionsOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListPolicyTemplateVersionsOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListPolicyTemplateVersionsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListPolicyTemplateVersionsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListPolicyTemplateVersionsOptions() { } + + protected ListPolicyTemplateVersionsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + policyTemplateId = builder.policyTemplateId; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListPolicyTemplateVersionsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the state. + * + * The policy template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java new file mode 100644 index 00000000000..f230c9bd549 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java @@ -0,0 +1,379 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listPolicyTemplates options. + */ +public class ListPolicyTemplatesOptions extends GenericModel { + + /** + * The policy template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + /** + * Service type, Optional. + */ + public interface PolicyServiceType { + /** service. */ + String SERVICE = "service"; + /** platform_service. */ + String PLATFORM_SERVICE = "platform_service"; + } + + /** + * Policy type, Optional. + */ + public interface PolicyType { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + protected String accountId; + protected String acceptLanguage; + protected String state; + protected String name; + protected String policyServiceType; + protected String policyServiceName; + protected String policyServiceGroupId; + protected String policyType; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String state; + private String name; + private String policyServiceType; + private String policyServiceName; + private String policyServiceGroupId; + private String policyType; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListPolicyTemplatesOptions instance. + * + * @param listPolicyTemplatesOptions the instance to initialize the Builder with + */ + private Builder(ListPolicyTemplatesOptions listPolicyTemplatesOptions) { + this.accountId = listPolicyTemplatesOptions.accountId; + this.acceptLanguage = listPolicyTemplatesOptions.acceptLanguage; + this.state = listPolicyTemplatesOptions.state; + this.name = listPolicyTemplatesOptions.name; + this.policyServiceType = listPolicyTemplatesOptions.policyServiceType; + this.policyServiceName = listPolicyTemplatesOptions.policyServiceName; + this.policyServiceGroupId = listPolicyTemplatesOptions.policyServiceGroupId; + this.policyType = listPolicyTemplatesOptions.policyType; + this.limit = listPolicyTemplatesOptions.limit; + this.start = listPolicyTemplatesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListPolicyTemplatesOptions. + * + * @return the new ListPolicyTemplatesOptions instance + */ + public ListPolicyTemplatesOptions build() { + return new ListPolicyTemplatesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListPolicyTemplatesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListPolicyTemplatesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListPolicyTemplatesOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ListPolicyTemplatesOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the policyServiceType. + * + * @param policyServiceType the policyServiceType + * @return the ListPolicyTemplatesOptions builder + */ + public Builder policyServiceType(String policyServiceType) { + this.policyServiceType = policyServiceType; + return this; + } + + /** + * Set the policyServiceName. + * + * @param policyServiceName the policyServiceName + * @return the ListPolicyTemplatesOptions builder + */ + public Builder policyServiceName(String policyServiceName) { + this.policyServiceName = policyServiceName; + return this; + } + + /** + * Set the policyServiceGroupId. + * + * @param policyServiceGroupId the policyServiceGroupId + * @return the ListPolicyTemplatesOptions builder + */ + public Builder policyServiceGroupId(String policyServiceGroupId) { + this.policyServiceGroupId = policyServiceGroupId; + return this; + } + + /** + * Set the policyType. + * + * @param policyType the policyType + * @return the ListPolicyTemplatesOptions builder + */ + public Builder policyType(String policyType) { + this.policyType = policyType; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListPolicyTemplatesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListPolicyTemplatesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListPolicyTemplatesOptions() { } + + protected ListPolicyTemplatesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + state = builder.state; + name = builder.name; + policyServiceType = builder.policyServiceType; + policyServiceName = builder.policyServiceName; + policyServiceGroupId = builder.policyServiceGroupId; + policyType = builder.policyType; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListPolicyTemplatesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the policy templates belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the state. + * + * The policy template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the name. + * + * The policy template name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the policyServiceType. + * + * Service type, Optional. + * + * @return the policyServiceType + */ + public String policyServiceType() { + return policyServiceType; + } + + /** + * Gets the policyServiceName. + * + * Service name, Optional. + * + * @return the policyServiceName + */ + public String policyServiceName() { + return policyServiceName; + } + + /** + * Gets the policyServiceGroupId. + * + * Service group id, Optional. + * + * @return the policyServiceGroupId + */ + public String policyServiceGroupId() { + return policyServiceGroupId; + } + + /** + * Gets the policyType. + * + * Policy type, Optional. + * + * @return the policyType + */ + public String policyType() { + return policyType; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java new file mode 100644 index 00000000000..adcb3f0cc90 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java @@ -0,0 +1,245 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listRoleAssignments options. + */ +public class ListRoleAssignmentsOptions extends GenericModel { + + protected String accountId; + protected String acceptLanguage; + protected String templateId; + protected String templateVersion; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String templateId; + private String templateVersion; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListRoleAssignmentsOptions instance. + * + * @param listRoleAssignmentsOptions the instance to initialize the Builder with + */ + private Builder(ListRoleAssignmentsOptions listRoleAssignmentsOptions) { + this.accountId = listRoleAssignmentsOptions.accountId; + this.acceptLanguage = listRoleAssignmentsOptions.acceptLanguage; + this.templateId = listRoleAssignmentsOptions.templateId; + this.templateVersion = listRoleAssignmentsOptions.templateVersion; + this.limit = listRoleAssignmentsOptions.limit; + this.start = listRoleAssignmentsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListRoleAssignmentsOptions. + * + * @return the new ListRoleAssignmentsOptions instance + */ + public ListRoleAssignmentsOptions build() { + return new ListRoleAssignmentsOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListRoleAssignmentsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListRoleAssignmentsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the templateId. + * + * @param templateId the templateId + * @return the ListRoleAssignmentsOptions builder + */ + public Builder templateId(String templateId) { + this.templateId = templateId; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the ListRoleAssignmentsOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListRoleAssignmentsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListRoleAssignmentsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListRoleAssignmentsOptions() { } + + protected ListRoleAssignmentsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + templateId = builder.templateId; + templateVersion = builder.templateVersion; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListRoleAssignmentsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID in which the role assignment belongs to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the templateId. + * + * Optional template ID. + * + * @return the templateId + */ + public String templateId() { + return templateId; + } + + /** + * Gets the templateVersion. + * + * Optional role template version. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java new file mode 100644 index 00000000000..e22751433e5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listRoleTemplateVersions options. + */ +public class ListRoleTemplateVersionsOptions extends GenericModel { + + /** + * Role template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String roleTemplateId; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListRoleTemplateVersionsOptions instance. + * + * @param listRoleTemplateVersionsOptions the instance to initialize the Builder with + */ + private Builder(ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions) { + this.roleTemplateId = listRoleTemplateVersionsOptions.roleTemplateId; + this.state = listRoleTemplateVersionsOptions.state; + this.limit = listRoleTemplateVersionsOptions.limit; + this.start = listRoleTemplateVersionsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + */ + public Builder(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + } + + /** + * Builds a ListRoleTemplateVersionsOptions. + * + * @return the new ListRoleTemplateVersionsOptions instance + */ + public ListRoleTemplateVersionsOptions build() { + return new ListRoleTemplateVersionsOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the ListRoleTemplateVersionsOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListRoleTemplateVersionsOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListRoleTemplateVersionsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListRoleTemplateVersionsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListRoleTemplateVersionsOptions() { } + + protected ListRoleTemplateVersionsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + roleTemplateId = builder.roleTemplateId; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListRoleTemplateVersionsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * The role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the state. + * + * Role template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java new file mode 100644 index 00000000000..8f889bdce96 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java @@ -0,0 +1,307 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listRoleTemplates options. + */ +public class ListRoleTemplatesOptions extends GenericModel { + + /** + * The role template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String accountId; + protected String acceptLanguage; + protected String name; + protected String roleName; + protected String roleServiceName; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String name; + private String roleName; + private String roleServiceName; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListRoleTemplatesOptions instance. + * + * @param listRoleTemplatesOptions the instance to initialize the Builder with + */ + private Builder(ListRoleTemplatesOptions listRoleTemplatesOptions) { + this.accountId = listRoleTemplatesOptions.accountId; + this.acceptLanguage = listRoleTemplatesOptions.acceptLanguage; + this.name = listRoleTemplatesOptions.name; + this.roleName = listRoleTemplatesOptions.roleName; + this.roleServiceName = listRoleTemplatesOptions.roleServiceName; + this.state = listRoleTemplatesOptions.state; + this.limit = listRoleTemplatesOptions.limit; + this.start = listRoleTemplatesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListRoleTemplatesOptions. + * + * @return the new ListRoleTemplatesOptions instance + */ + public ListRoleTemplatesOptions build() { + return new ListRoleTemplatesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListRoleTemplatesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListRoleTemplatesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ListRoleTemplatesOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the roleName. + * + * @param roleName the roleName + * @return the ListRoleTemplatesOptions builder + */ + public Builder roleName(String roleName) { + this.roleName = roleName; + return this; + } + + /** + * Set the roleServiceName. + * + * @param roleServiceName the roleServiceName + * @return the ListRoleTemplatesOptions builder + */ + public Builder roleServiceName(String roleServiceName) { + this.roleServiceName = roleServiceName; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListRoleTemplatesOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListRoleTemplatesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListRoleTemplatesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListRoleTemplatesOptions() { } + + protected ListRoleTemplatesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + name = builder.name; + roleName = builder.roleName; + roleServiceName = builder.roleServiceName; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListRoleTemplatesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the role templates belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the name. + * + * The role template name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the roleName. + * + * The template role name. + * + * @return the roleName + */ + public String roleName() { + return roleName; + } + + /** + * Gets the roleServiceName. + * + * The template role service name. + * + * @return the roleServiceName + */ + public String roleServiceName() { + return roleServiceName; + } + + /** + * Gets the state. + * + * The role template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java new file mode 100644 index 00000000000..2ca364c53a3 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java @@ -0,0 +1,234 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listRoles options. + */ +public class ListRolesOptions extends GenericModel { + + protected String acceptLanguage; + protected String accountId; + protected String serviceName; + protected String sourceServiceName; + protected String policyType; + protected String serviceGroupId; + + /** + * Builder. + */ + public static class Builder { + private String acceptLanguage; + private String accountId; + private String serviceName; + private String sourceServiceName; + private String policyType; + private String serviceGroupId; + + /** + * Instantiates a new Builder from an existing ListRolesOptions instance. + * + * @param listRolesOptions the instance to initialize the Builder with + */ + private Builder(ListRolesOptions listRolesOptions) { + this.acceptLanguage = listRolesOptions.acceptLanguage; + this.accountId = listRolesOptions.accountId; + this.serviceName = listRolesOptions.serviceName; + this.sourceServiceName = listRolesOptions.sourceServiceName; + this.policyType = listRolesOptions.policyType; + this.serviceGroupId = listRolesOptions.serviceGroupId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ListRolesOptions. + * + * @return the new ListRolesOptions instance + */ + public ListRolesOptions build() { + return new ListRolesOptions(this); + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListRolesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListRolesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the ListRolesOptions builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the sourceServiceName. + * + * @param sourceServiceName the sourceServiceName + * @return the ListRolesOptions builder + */ + public Builder sourceServiceName(String sourceServiceName) { + this.sourceServiceName = sourceServiceName; + return this; + } + + /** + * Set the policyType. + * + * @param policyType the policyType + * @return the ListRolesOptions builder + */ + public Builder policyType(String policyType) { + this.policyType = policyType; + return this; + } + + /** + * Set the serviceGroupId. + * + * @param serviceGroupId the serviceGroupId + * @return the ListRolesOptions builder + */ + public Builder serviceGroupId(String serviceGroupId) { + this.serviceGroupId = serviceGroupId; + return this; + } + } + + protected ListRolesOptions() { } + + protected ListRolesOptions(Builder builder) { + acceptLanguage = builder.acceptLanguage; + accountId = builder.accountId; + serviceName = builder.serviceName; + sourceServiceName = builder.sourceServiceName; + policyType = builder.policyType; + serviceGroupId = builder.serviceGroupId; + } + + /** + * New builder. + * + * @return a ListRolesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the accountId. + * + * Optional account GUID in which the roles belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the serviceName. + * + * Optional name of IAM enabled service. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the sourceServiceName. + * + * Optional name of source IAM enabled service. + * + * @return the sourceServiceName + */ + public String sourceServiceName() { + return sourceServiceName; + } + + /** + * Gets the policyType. + * + * Optional Policy Type. + * + * @return the policyType + */ + public String policyType() { + return policyType; + } + + /** + * Gets the serviceGroupId. + * + * Optional id of service group. + * + * @return the serviceGroupId + */ + public String serviceGroupId() { + return serviceGroupId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java new file mode 100644 index 00000000000..65849c3d9a6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java @@ -0,0 +1,492 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listV2Policies options. + */ +public class ListV2PoliciesOptions extends GenericModel { + + /** + * Optional type of policy. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + /** + * Optional type of service. + */ + public interface ServiceType { + /** service. */ + String SERVICE = "service"; + /** platform_service. */ + String PLATFORM_SERVICE = "platform_service"; + } + + /** + * Include additional data per policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles and translations for all + * relevant fields. + */ + public interface Format { + /** include_last_permit. */ + String INCLUDE_LAST_PERMIT = "include_last_permit"; + /** display. */ + String DISPLAY = "display"; + } + + /** + * The state of the policy. + * * `active` - returns active policies + * * `deleted` - returns non-active policies. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String accountId; + protected String acceptLanguage; + protected String iamId; + protected String accessGroupId; + protected String type; + protected String serviceType; + protected String serviceName; + protected String serviceGroupId; + protected String sort; + protected String format; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String iamId; + private String accessGroupId; + private String type; + private String serviceType; + private String serviceName; + private String serviceGroupId; + private String sort; + private String format; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListV2PoliciesOptions instance. + * + * @param listV2PoliciesOptions the instance to initialize the Builder with + */ + private Builder(ListV2PoliciesOptions listV2PoliciesOptions) { + this.accountId = listV2PoliciesOptions.accountId; + this.acceptLanguage = listV2PoliciesOptions.acceptLanguage; + this.iamId = listV2PoliciesOptions.iamId; + this.accessGroupId = listV2PoliciesOptions.accessGroupId; + this.type = listV2PoliciesOptions.type; + this.serviceType = listV2PoliciesOptions.serviceType; + this.serviceName = listV2PoliciesOptions.serviceName; + this.serviceGroupId = listV2PoliciesOptions.serviceGroupId; + this.sort = listV2PoliciesOptions.sort; + this.format = listV2PoliciesOptions.format; + this.state = listV2PoliciesOptions.state; + this.limit = listV2PoliciesOptions.limit; + this.start = listV2PoliciesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListV2PoliciesOptions. + * + * @return the new ListV2PoliciesOptions instance + */ + public ListV2PoliciesOptions build() { + return new ListV2PoliciesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListV2PoliciesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListV2PoliciesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the iamId. + * + * @param iamId the iamId + * @return the ListV2PoliciesOptions builder + */ + public Builder iamId(String iamId) { + this.iamId = iamId; + return this; + } + + /** + * Set the accessGroupId. + * + * @param accessGroupId the accessGroupId + * @return the ListV2PoliciesOptions builder + */ + public Builder accessGroupId(String accessGroupId) { + this.accessGroupId = accessGroupId; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the ListV2PoliciesOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the serviceType. + * + * @param serviceType the serviceType + * @return the ListV2PoliciesOptions builder + */ + public Builder serviceType(String serviceType) { + this.serviceType = serviceType; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the ListV2PoliciesOptions builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the serviceGroupId. + * + * @param serviceGroupId the serviceGroupId + * @return the ListV2PoliciesOptions builder + */ + public Builder serviceGroupId(String serviceGroupId) { + this.serviceGroupId = serviceGroupId; + return this; + } + + /** + * Set the sort. + * + * @param sort the sort + * @return the ListV2PoliciesOptions builder + */ + public Builder sort(String sort) { + this.sort = sort; + return this; + } + + /** + * Set the format. + * + * @param format the format + * @return the ListV2PoliciesOptions builder + */ + public Builder format(String format) { + this.format = format; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListV2PoliciesOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListV2PoliciesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListV2PoliciesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListV2PoliciesOptions() { } + + protected ListV2PoliciesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + iamId = builder.iamId; + accessGroupId = builder.accessGroupId; + type = builder.type; + serviceType = builder.serviceType; + serviceName = builder.serviceName; + serviceGroupId = builder.serviceGroupId; + sort = builder.sort; + format = builder.format; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListV2PoliciesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID in which the policies belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the iamId. + * + * Optional IAM ID used to identify the subject. + * + * @return the iamId + */ + public String iamId() { + return iamId; + } + + /** + * Gets the accessGroupId. + * + * Optional access group id. + * + * @return the accessGroupId + */ + public String accessGroupId() { + return accessGroupId; + } + + /** + * Gets the type. + * + * Optional type of policy. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the serviceType. + * + * Optional type of service. + * + * @return the serviceType + */ + public String serviceType() { + return serviceType; + } + + /** + * Gets the serviceName. + * + * Optional name of service. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the serviceGroupId. + * + * Optional ID of service group. + * + * @return the serviceGroupId + */ + public String serviceGroupId() { + return serviceGroupId; + } + + /** + * Gets the sort. + * + * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending + * '-' to field, for example, '-last_modified_at'. Note that last permit information is only included when + * 'format=include_last_permit', for example, "format=include_last_permit&sort=last_permit_at" Example fields that + * can be sorted on: + * - 'id' + * - 'type' + * - 'href' + * - 'created_at' + * - 'created_by_id' + * - 'last_modified_at' + * - 'last_modified_by_id' + * - 'state' + * - 'last_permit_at' + * - 'last_permit_frequency'. + * + * @return the sort + */ + public String sort() { + return sort; + } + + /** + * Gets the format. + * + * Include additional data per policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles and translations for all + * relevant fields. + * + * @return the format + */ + public String format() { + return format; + } + + /** + * Gets the state. + * + * The state of the policy. + * * `active` - returns active policies + * * `deleted` - returns non-active policies. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java new file mode 100644 index 00000000000..4d43d84dbba --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java @@ -0,0 +1,126 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Condition that specifies additional conditions or RuleAttribute to grant access. + * + * Classes which extend this class: + * - NestedConditionRuleAttribute + * - NestedConditionRuleWithConditions + */ +public class NestedCondition extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + protected String key; + protected String operator; + protected Object value; + protected List conditions; + + protected NestedCondition() { } + + /** + * Gets the key. + * + * The name of an attribute. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } + + /** + * Gets the conditions. + * + * List of conditions associated with a policy. For example, time-based conditions that grant access over a certain + * time period. + * + * @return the conditions + */ + public List conditions() { + return conditions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java new file mode 100644 index 00000000000..b1d44da3f6b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java @@ -0,0 +1,170 @@ +/* + * (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_policy_management.v1.model; + +/** + * Rule that specifies additional access that is granted (For example, time-based condition). + */ +public class NestedConditionRuleAttribute extends NestedCondition { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing NestedConditionRuleAttribute instance. + * + * @param nestedConditionRuleAttribute the instance to initialize the Builder with + */ + public Builder(NestedCondition nestedConditionRuleAttribute) { + this.key = nestedConditionRuleAttribute.key; + this.operator = nestedConditionRuleAttribute.operator; + this.value = nestedConditionRuleAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a NestedConditionRuleAttribute. + * + * @return the new NestedConditionRuleAttribute instance + */ + public NestedConditionRuleAttribute build() { + return new NestedConditionRuleAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the NestedConditionRuleAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the NestedConditionRuleAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the NestedConditionRuleAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected NestedConditionRuleAttribute() { } + + protected NestedConditionRuleAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a NestedConditionRuleAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java new file mode 100644 index 00000000000..20d0faac795 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java @@ -0,0 +1,139 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * Rule that specifies additional access that is granted (for example, time-based condition) accross multiple + * conditions. + */ +public class NestedConditionRuleWithConditions extends NestedCondition { + + /** + * Operator to evaluate conditions. + */ + public interface Operator { + /** and. */ + String AND = "and"; + /** or. */ + String OR = "or"; + } + + + /** + * Builder. + */ + public static class Builder { + private String operator; + private List conditions; + + /** + * Instantiates a new Builder from an existing NestedConditionRuleWithConditions instance. + * + * @param nestedConditionRuleWithConditions the instance to initialize the Builder with + */ + public Builder(NestedCondition nestedConditionRuleWithConditions) { + this.operator = nestedConditionRuleWithConditions.operator; + this.conditions = nestedConditionRuleWithConditions.conditions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param operator the operator + * @param conditions the conditions + */ + public Builder(String operator, List conditions) { + this.operator = operator; + this.conditions = conditions; + } + + /** + * Builds a NestedConditionRuleWithConditions. + * + * @return the new NestedConditionRuleWithConditions instance + */ + public NestedConditionRuleWithConditions build() { + return new NestedConditionRuleWithConditions(this); + } + + /** + * Adds a new element to conditions. + * + * @param conditions the new element to be added + * @return the NestedConditionRuleWithConditions builder + */ + public Builder addConditions(RuleAttribute conditions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(conditions, + "conditions cannot be null"); + if (this.conditions == null) { + this.conditions = new ArrayList(); + } + this.conditions.add(conditions); + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the NestedConditionRuleWithConditions builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the conditions. + * Existing conditions will be replaced. + * + * @param conditions the conditions + * @return the NestedConditionRuleWithConditions builder + */ + public Builder conditions(List conditions) { + this.conditions = conditions; + return this; + } + } + + protected NestedConditionRuleWithConditions() { } + + protected NestedConditionRuleWithConditions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.conditions, + "conditions cannot be null"); + operator = builder.operator; + conditions = builder.conditions; + } + + /** + * New builder. + * + * @return a NestedConditionRuleWithConditions builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java new file mode 100644 index 00000000000..b0442f902bc --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Details with href linking to the following page of requested collection. + */ +public class Next extends GenericModel { + + protected String href; + protected String start; + + protected Next() { } + + /** + * Gets the href. + * + * The href linking to the page of requested collection. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection. + * + * @return the start + */ + public String getStart() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java new file mode 100644 index 00000000000..8f12053c72e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * PoliciesPager can be used to simplify the use of the "listPolicies" method. + */ +public class PoliciesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListPoliciesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected PoliciesPager() { } + + /** + * Constructs a new PoliciesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listPolicies" method + * @param options the ListPoliciesOptions instance to be used to invoke the "listPolicies" method + */ + public PoliciesPager(IamPolicyManagement client, ListPoliciesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<PolicyTemplateMetaData> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListPoliciesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + PolicyCollection result = client.listPolicies(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getPolicies(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<PolicyTemplateMetaData> containing all results returned by the "listPolicies" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java new file mode 100644 index 00000000000..af852b7cd74 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java @@ -0,0 +1,188 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with a policy. + */ +public class Policy extends GenericModel { + + /** + * The policy state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String id; + protected String type; + protected String description; + protected List subjects; + protected List roles; + protected List resources; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String state; + + protected Policy() { } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the description. + * + * Customer-defined description. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the subjects. + * + * The subjects associated with a policy. + * + * @return the subjects + */ + public List getSubjects() { + return subjects; + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List getRoles() { + return roles; + } + + /** + * Gets the resources. + * + * The resources associated with a policy. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the href. + * + * The href links back to the policy. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the state. + * + * The policy state. + * + * @return the state + */ + public String getState() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java new file mode 100644 index 00000000000..3e566ce7bdf --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Set of properties for the assigned resource. + */ +public class PolicyAssignmentResourcePolicy extends GenericModel { + + @SerializedName("resource_created") + protected AssignmentResourceCreated resourceCreated; + protected String status; + @SerializedName("error_message") + protected AssignmentResourceError errorMessage; + + protected PolicyAssignmentResourcePolicy() { } + + /** + * Gets the resourceCreated. + * + * On success, includes the policy that is assigned. + * + * @return the resourceCreated + */ + public AssignmentResourceCreated getResourceCreated() { + return resourceCreated; + } + + /** + * Gets the status. + * + * policy status. + * + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * Gets the errorMessage. + * + * Body parameters for assignment error. + * + * @return the errorMessage + */ + public AssignmentResourceError getErrorMessage() { + return errorMessage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java new file mode 100644 index 00000000000..ad944536b0d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The policy assignment resources. + */ +public class PolicyAssignmentResources extends GenericModel { + + protected String target; + protected PolicyAssignmentResourcePolicy policy; + + protected PolicyAssignmentResources() { } + + /** + * Gets the target. + * + * Account ID where resources are assigned. + * + * @return the target + */ + public String getTarget() { + return target; + } + + /** + * Gets the policy. + * + * Set of properties for the assigned resource. + * + * @return the policy + */ + public PolicyAssignmentResourcePolicy getPolicy() { + return policy; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java new file mode 100644 index 00000000000..f1ea295713c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java @@ -0,0 +1,193 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the policy template assignment. + */ +public class PolicyAssignmentV1 extends GenericModel { + + /** + * The policy assignment status. + */ + public interface Status { + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** succeeded. */ + String SUCCEEDED = "succeeded"; + /** succeed_with_errors. */ + String SUCCEED_WITH_ERRORS = "succeed_with_errors"; + /** failed. */ + String FAILED = "failed"; + } + + protected AssignmentTargetDetails target; + protected String id; + @SerializedName("account_id") + protected String accountId; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected List resources; + protected PolicyAssignmentV1Subject subject; + protected AssignmentTemplateDetails template; + protected String status; + + protected PolicyAssignmentV1() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the id. + * + * Policy assignment ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the accountId. + * + * The account GUID that the policies assignments belong to. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the href. + * + * The href URL that links to the policies assignments API by policy assignment ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy assignment was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy assignment. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy assignment was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy assignment. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the resources. + * + * Object for each account assigned. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the subject. + * + * Subject details of access type assignment. + * + * @return the subject + */ + public PolicyAssignmentV1Subject getSubject() { + return subject; + } + + /** + * Gets the template. + * + * policy template details. + * + * @return the template + */ + public AssignmentTemplateDetails getTemplate() { + return template; + } + + /** + * Gets the status. + * + * The policy assignment status. + * + * @return the status + */ + public String getStatus() { + return status; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java new file mode 100644 index 00000000000..7331ee5a854 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Policy assignment response. + */ +public class PolicyAssignmentV1Collection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List assignments; + + protected PolicyAssignmentV1Collection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the assignments. + * + * Response of policy assignments. + * + * @return the assignments + */ + public List getAssignments() { + return assignments; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java new file mode 100644 index 00000000000..c05eb90816b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The policy assignment resources. + */ +public class PolicyAssignmentV1Resources extends GenericModel { + + protected AssignmentTargetDetails target; + protected PolicyAssignmentResourcePolicy policy; + + protected PolicyAssignmentV1Resources() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the policy. + * + * Set of properties for the assigned resource. + * + * @return the policy + */ + public PolicyAssignmentResourcePolicy getPolicy() { + return policy; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java new file mode 100644 index 00000000000..58b2cd240ba --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java @@ -0,0 +1,60 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Subject details of access type assignment. + */ +public class PolicyAssignmentV1Subject extends GenericModel { + + /** + * The identity type of the subject of the assignment. + */ + public interface Type { + /** iam_id. */ + String IAM_ID = "iam_id"; + /** access_group_id. */ + String ACCESS_GROUP_ID = "access_group_id"; + } + + protected String id; + protected String type; + + protected PolicyAssignmentV1Subject() { } + + /** + * Gets the id. + * + * The unique identifier of the subject of the assignment. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the type. + * + * The identity type of the subject of the assignment. + * + * @return the type + */ + public String getType() { + return type; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java new file mode 100644 index 00000000000..931769daed5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * PolicyAssignmentsPager can be used to simplify the use of the "listPolicyAssignments" method. + */ +public class PolicyAssignmentsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListPolicyAssignmentsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected PolicyAssignmentsPager() { } + + /** + * Constructs a new PolicyAssignmentsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyAssignments" method + * @param options the ListPolicyAssignmentsOptions instance to be used to invoke the "listPolicyAssignments" method + */ + public PolicyAssignmentsPager(IamPolicyManagement client, ListPolicyAssignmentsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<PolicyTemplateAssignmentItems> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListPolicyAssignmentsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + PolicyTemplateAssignmentCollection result = client.listPolicyAssignments(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getAssignments(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<PolicyTemplateAssignmentItems> containing all results returned by the "listPolicyAssignments" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java new file mode 100644 index 00000000000..25062dd0a52 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of policies. + */ +public class PolicyCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List policies; + + protected PolicyCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the policies. + * + * List of policies. + * + * @return the policies + */ + public List getPolicies() { + return policies; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java new file mode 100644 index 00000000000..4033f2dbc9d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java @@ -0,0 +1,167 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The attributes of the resource. Note that only one resource is allowed in a policy. + */ +public class PolicyResource extends GenericModel { + + protected List attributes; + protected List tags; + + /** + * Builder. + */ + public static class Builder { + private List attributes; + private List tags; + + /** + * Instantiates a new Builder from an existing PolicyResource instance. + * + * @param policyResource the instance to initialize the Builder with + */ + private Builder(PolicyResource policyResource) { + this.attributes = policyResource.attributes; + this.tags = policyResource.tags; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param attributes the attributes + */ + public Builder(List attributes) { + this.attributes = attributes; + } + + /** + * Builds a PolicyResource. + * + * @return the new PolicyResource instance + */ + public PolicyResource build() { + return new PolicyResource(this); + } + + /** + * Adds a new element to attributes. + * + * @param attributes the new element to be added + * @return the PolicyResource builder + */ + public Builder addAttributes(ResourceAttribute attributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, + "attributes cannot be null"); + if (this.attributes == null) { + this.attributes = new ArrayList(); + } + this.attributes.add(attributes); + return this; + } + + /** + * Adds a new element to tags. + * + * @param tags the new element to be added + * @return the PolicyResource builder + */ + public Builder addTags(ResourceTag tags) { + com.ibm.cloud.sdk.core.util.Validator.notNull(tags, + "tags cannot be null"); + if (this.tags == null) { + this.tags = new ArrayList(); + } + this.tags.add(tags); + return this; + } + + /** + * Set the attributes. + * Existing attributes will be replaced. + * + * @param attributes the attributes + * @return the PolicyResource builder + */ + public Builder attributes(List attributes) { + this.attributes = attributes; + return this; + } + + /** + * Set the tags. + * Existing tags will be replaced. + * + * @param tags the tags + * @return the PolicyResource builder + */ + public Builder tags(List tags) { + this.tags = tags; + return this; + } + } + + protected PolicyResource() { } + + protected PolicyResource(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, + "attributes cannot be null"); + attributes = builder.attributes; + tags = builder.tags; + } + + /** + * New builder. + * + * @return a PolicyResource builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the attributes. + * + * List of resource attributes. + * + * @return the attributes + */ + public List attributes() { + return attributes; + } + + /** + * Gets the tags. + * + * List of access management tags. + * + * @return the tags + */ + public List tags() { + return tags; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java new file mode 100644 index 00000000000..7319eabce7b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java @@ -0,0 +1,131 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role associated with a policy. + */ +public class PolicyRole extends GenericModel { + + @SerializedName("role_id") + protected String roleId; + @SerializedName("display_name") + protected String displayName; + protected String description; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + + /** + * Instantiates a new Builder from an existing PolicyRole instance. + * + * @param policyRole the instance to initialize the Builder with + */ + private Builder(PolicyRole policyRole) { + this.roleId = policyRole.roleId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + */ + public Builder(String roleId) { + this.roleId = roleId; + } + + /** + * Builds a PolicyRole. + * + * @return the new PolicyRole instance + */ + public PolicyRole build() { + return new PolicyRole(this); + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the PolicyRole builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + } + + protected PolicyRole() { } + + protected PolicyRole(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleId, + "roleId cannot be null"); + roleId = builder.roleId; + } + + /** + * New builder. + * + * @return a PolicyRole builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } + + /** + * Gets the displayName. + * + * The display name of the role. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String description() { + return description; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java new file mode 100644 index 00000000000..bf1b035a6b7 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java @@ -0,0 +1,124 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The subject attribute values that must match in order for this policy to apply in a permission decision. + */ +public class PolicySubject extends GenericModel { + + protected List attributes; + + /** + * Builder. + */ + public static class Builder { + private List attributes; + + /** + * Instantiates a new Builder from an existing PolicySubject instance. + * + * @param policySubject the instance to initialize the Builder with + */ + private Builder(PolicySubject policySubject) { + this.attributes = policySubject.attributes; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param attributes the attributes + */ + public Builder(List attributes) { + this.attributes = attributes; + } + + /** + * Builds a PolicySubject. + * + * @return the new PolicySubject instance + */ + public PolicySubject build() { + return new PolicySubject(this); + } + + /** + * Adds a new element to attributes. + * + * @param attributes the new element to be added + * @return the PolicySubject builder + */ + public Builder addAttributes(SubjectAttribute attributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, + "attributes cannot be null"); + if (this.attributes == null) { + this.attributes = new ArrayList(); + } + this.attributes.add(attributes); + return this; + } + + /** + * Set the attributes. + * Existing attributes will be replaced. + * + * @param attributes the attributes + * @return the PolicySubject builder + */ + public Builder attributes(List attributes) { + this.attributes = attributes; + return this; + } + } + + protected PolicySubject() { } + + protected PolicySubject(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, + "attributes cannot be null"); + attributes = builder.attributes; + } + + /** + * New builder. + * + * @return a PolicySubject builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the attributes. + * + * List of subject attributes. + * + * @return the attributes + */ + public List attributes() { + return attributes; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java new file mode 100644 index 00000000000..bdffbe98c10 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java @@ -0,0 +1,202 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the policy template. + */ +public class PolicyTemplate extends GenericModel { + + /** + * State of policy template. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String name; + protected String description; + @SerializedName("account_id") + protected String accountId; + protected String version; + protected Boolean committed; + protected TemplatePolicy policy; + protected String state; + protected String id; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + + protected PolicyTemplate() { } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the version. + * + * Template version. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the committed. + * + * Committed status of the template version. + * + * @return the committed + */ + public Boolean isCommitted() { + return committed; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy getPolicy() { + return policy; + } + + /** + * Gets the state. + * + * State of policy template. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the id. + * + * The policy template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the policy templates API by policy template ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy template was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy template. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy template was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy template. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java new file mode 100644 index 00000000000..54727eadf4d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of policies assignments. + */ +public class PolicyTemplateAssignmentCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List assignments; + + protected PolicyTemplateAssignmentCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the assignments. + * + * List of policy assignments. + * + * @return the assignments + */ + public List getAssignments() { + return assignments; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java new file mode 100644 index 00000000000..2c8e82df441 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java @@ -0,0 +1,261 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * PolicyTemplateAssignmentItems. + * + * Classes which extend this class: + * - PolicyTemplateAssignmentItemsPolicyAssignmentV1 + * - PolicyTemplateAssignmentItemsPolicyAssignment + */ +public class PolicyTemplateAssignmentItems extends GenericModel { + + /** + * The policy assignment status. + */ + public interface Status { + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** succeeded. */ + String SUCCEEDED = "succeeded"; + /** succeed_with_errors. */ + String SUCCEED_WITH_ERRORS = "succeed_with_errors"; + /** failed. */ + String FAILED = "failed"; + } + + /** + * Assignment target type. + */ + public interface TargetType { + /** Account. */ + String ACCOUNT = "Account"; + /** AccountGroup. */ + String ACCOUNTGROUP = "AccountGroup"; + /** Enterprise. */ + String ENTERPRISE = "Enterprise"; + } + + protected AssignmentTargetDetails target; + protected String id; + @SerializedName("account_id") + protected String accountId; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected List resources; + protected PolicyAssignmentV1Subject subject; + protected AssignmentTemplateDetails template; + protected String status; + @SerializedName("template_id") + protected String templateId; + @SerializedName("template_version") + protected String templateVersion; + @SerializedName("assignment_id") + protected String assignmentId; + @SerializedName("target_type") + protected String targetType; + + protected PolicyTemplateAssignmentItems() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the id. + * + * Policy assignment ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the accountId. + * + * The account GUID that the policies assignments belong to. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the href. + * + * The href URL that links to the policies assignments API by policy assignment ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy assignment was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy assignment. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy assignment was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy assignment. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the resources. + * + * Object for each account assigned. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the subject. + * + * Subject details of access type assignment. + * + * @return the subject + */ + public PolicyAssignmentV1Subject getSubject() { + return subject; + } + + /** + * Gets the template. + * + * policy template details. + * + * @return the template + */ + public AssignmentTemplateDetails getTemplate() { + return template; + } + + /** + * Gets the status. + * + * The policy assignment status. + * + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * Gets the templateId. + * + * policy template ID. + * + * @return the templateId + */ + public String getTemplateId() { + return templateId; + } + + /** + * Gets the templateVersion. + * + * policy template version. + * + * @return the templateVersion + */ + public String getTemplateVersion() { + return templateVersion; + } + + /** + * Gets the assignmentId. + * + * Passed in value to correlate with other assignments. + * + * @return the assignmentId + */ + public String getAssignmentId() { + return assignmentId; + } + + /** + * Gets the targetType. + * + * Assignment target type. + * + * @return the targetType + */ + public String getTargetType() { + return targetType; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java new file mode 100644 index 00000000000..ec9c32e5bdd --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +/** + * The set of properties associated with the policy template assignment. + */ +public class PolicyTemplateAssignmentItemsPolicyAssignment extends PolicyTemplateAssignmentItems { + + /** + * Assignment target type. + */ + public interface TargetType { + /** Account. */ + String ACCOUNT = "Account"; + /** AccountGroup. */ + String ACCOUNTGROUP = "AccountGroup"; + /** Enterprise. */ + String ENTERPRISE = "Enterprise"; + } + + /** + * The policy assignment status. + */ + public interface Status { + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** succeeded. */ + String SUCCEEDED = "succeeded"; + /** succeed_with_errors. */ + String SUCCEED_WITH_ERRORS = "succeed_with_errors"; + /** failed. */ + String FAILED = "failed"; + } + + + protected PolicyTemplateAssignmentItemsPolicyAssignment() { } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java new file mode 100644 index 00000000000..4cebdbb17b1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.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_policy_management.v1.model; + +/** + * The set of properties associated with the policy template assignment. + */ +public class PolicyTemplateAssignmentItemsPolicyAssignmentV1 extends PolicyTemplateAssignmentItems { + + /** + * The policy assignment status. + */ + public interface Status { + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** succeeded. */ + String SUCCEEDED = "succeeded"; + /** succeed_with_errors. */ + String SUCCEED_WITH_ERRORS = "succeed_with_errors"; + /** failed. */ + String FAILED = "failed"; + } + + + protected PolicyTemplateAssignmentItemsPolicyAssignmentV1() { } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java new file mode 100644 index 00000000000..2a262c584b5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java @@ -0,0 +1,90 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of policy Templates. + */ +public class PolicyTemplateCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + @SerializedName("policy_templates") + protected List policyTemplates; + + protected PolicyTemplateCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the policyTemplates. + * + * List of policy templates. + * + * @return the policyTemplates + */ + public List getPolicyTemplates() { + return policyTemplates; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java new file mode 100644 index 00000000000..5a2876dfe28 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java @@ -0,0 +1,214 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the policy template. + */ +public class PolicyTemplateLimitData extends GenericModel { + + /** + * State of policy template. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String name; + protected String description; + @SerializedName("account_id") + protected String accountId; + protected String version; + protected Boolean committed; + protected TemplatePolicy policy; + protected String state; + protected String id; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected TemplateCountData counts; + + protected PolicyTemplateLimitData() { } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the version. + * + * Template version. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the committed. + * + * Committed status of the template version. + * + * @return the committed + */ + public Boolean isCommitted() { + return committed; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy getPolicy() { + return policy; + } + + /** + * Gets the state. + * + * State of policy template. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the id. + * + * The policy template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the policy templates API by policy template ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy template was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy template. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy template was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy template. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the counts. + * + * policy template count details. + * + * @return the counts + */ + public TemplateCountData getCounts() { + return counts; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java new file mode 100644 index 00000000000..07effc5b3ad --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java @@ -0,0 +1,201 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with a policy. + */ +public class PolicyTemplateMetaData extends GenericModel { + + /** + * The policy state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String id; + protected String type; + protected String description; + protected List subjects; + protected List roles; + protected List resources; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String state; + protected TemplateMetadata template; + + protected PolicyTemplateMetaData() { } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the description. + * + * Customer-defined description. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the subjects. + * + * The subjects associated with a policy. + * + * @return the subjects + */ + public List getSubjects() { + return subjects; + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List getRoles() { + return roles; + } + + /** + * Gets the resources. + * + * The resources associated with a policy. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the href. + * + * The href links back to the policy. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the state. + * + * The policy state. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the template. + * + * The details of the IAM template that was used to create an enterprise-managed policy in your account. When + * returned, this indicates that the policy is created from and managed by a template in the root enterprise account. + * + * @return the template + */ + public TemplateMetadata getTemplate() { + return template; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java new file mode 100644 index 00000000000..a4f95bc6562 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of versions for a specific policy template. + */ +public class PolicyTemplateVersionsCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List versions; + + protected PolicyTemplateVersionsCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the versions. + * + * List of policy templates versions. + * + * @return the versions + */ + public List getVersions() { + return versions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java new file mode 100644 index 00000000000..f6a2496cf91 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * PolicyTemplateVersionsPager can be used to simplify the use of the "listPolicyTemplateVersions" method. + */ +public class PolicyTemplateVersionsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListPolicyTemplateVersionsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected PolicyTemplateVersionsPager() { } + + /** + * Constructs a new PolicyTemplateVersionsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyTemplateVersions" method + * @param options the ListPolicyTemplateVersionsOptions instance to be used to invoke the "listPolicyTemplateVersions" method + */ + public PolicyTemplateVersionsPager(IamPolicyManagement client, ListPolicyTemplateVersionsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<PolicyTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListPolicyTemplateVersionsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + PolicyTemplateVersionsCollection result = client.listPolicyTemplateVersions(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getVersions(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<PolicyTemplate> containing all results returned by the "listPolicyTemplateVersions" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java new file mode 100644 index 00000000000..eba6e6c8fad --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * PolicyTemplatesPager can be used to simplify the use of the "listPolicyTemplates" method. + */ +public class PolicyTemplatesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListPolicyTemplatesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected PolicyTemplatesPager() { } + + /** + * Constructs a new PolicyTemplatesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyTemplates" method + * @param options the ListPolicyTemplatesOptions instance to be used to invoke the "listPolicyTemplates" method + */ + public PolicyTemplatesPager(IamPolicyManagement client, ListPolicyTemplatesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<PolicyTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListPolicyTemplatesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + PolicyTemplateCollection result = client.listPolicyTemplates(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getPolicyTemplates(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<PolicyTemplate> containing all results returned by the "listPolicyTemplates" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java new file mode 100644 index 00000000000..2656f3fb790 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Details with linking href to previous page of requested collection. + */ +public class Previous extends GenericModel { + + protected String href; + protected String start; + + protected Previous() { } + + /** + * Gets the href. + * + * The href linking to the page of requested collection. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection. + * + * @return the start + */ + public String getStart() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java new file mode 100644 index 00000000000..151a77e8cb9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java @@ -0,0 +1,273 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replaceActionControlTemplate options. + */ +public class ReplaceActionControlTemplateOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String version; + protected String ifMatch; + protected String name; + protected String description; + protected TemplateActionControl actionControl; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String version; + private String ifMatch; + private String name; + private String description; + private TemplateActionControl actionControl; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing ReplaceActionControlTemplateOptions instance. + * + * @param replaceActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(ReplaceActionControlTemplateOptions replaceActionControlTemplateOptions) { + this.actionControlTemplateId = replaceActionControlTemplateOptions.actionControlTemplateId; + this.version = replaceActionControlTemplateOptions.version; + this.ifMatch = replaceActionControlTemplateOptions.ifMatch; + this.name = replaceActionControlTemplateOptions.name; + this.description = replaceActionControlTemplateOptions.description; + this.actionControl = replaceActionControlTemplateOptions.actionControl; + this.committed = replaceActionControlTemplateOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + * @param version the version + * @param ifMatch the ifMatch + */ + public Builder(String actionControlTemplateId, String version, String ifMatch) { + this.actionControlTemplateId = actionControlTemplateId; + this.version = version; + this.ifMatch = ifMatch; + } + + /** + * Builds a ReplaceActionControlTemplateOptions. + * + * @return the new ReplaceActionControlTemplateOptions instance + */ + public ReplaceActionControlTemplateOptions build() { + return new ReplaceActionControlTemplateOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actionControl. + * + * @param actionControl the actionControl + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder actionControl(TemplateActionControl actionControl) { + this.actionControl = actionControl; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected ReplaceActionControlTemplateOptions() { } + + protected ReplaceActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + actionControlTemplateId = builder.actionControlTemplateId; + version = builder.version; + ifMatch = builder.ifMatch; + name = builder.name; + description = builder.description; + actionControl = builder.actionControl; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a ReplaceActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating an action control template version must match the Etag value of the existing + * action control template version. The Etag can be retrieved using the GET + * /v1/action_control_templates/{template_id}/versions/{version} API and looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will + * change the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the action control template. This is shown to users in the enterprise account. Use this to describe + * the purpose or context of the action control for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actionControl. + * + * The action control properties that are created in an action resource when the template is assigned. + * + * @return the actionControl + */ + public TemplateActionControl actionControl() { + return actionControl; + } + + /** + * Gets the committed. + * + * Committed status of the template version. If committed is set to true, then the template version can no longer be + * updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java new file mode 100644 index 00000000000..80cbe9e4c79 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java @@ -0,0 +1,335 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replacePolicy options. + */ +public class ReplacePolicyOptions extends GenericModel { + + protected String policyId; + protected String ifMatch; + protected String type; + protected List subjects; + protected List roles; + protected List resources; + protected String description; + + /** + * Builder. + */ + public static class Builder { + private String policyId; + private String ifMatch; + private String type; + private List subjects; + private List roles; + private List resources; + private String description; + + /** + * Instantiates a new Builder from an existing ReplacePolicyOptions instance. + * + * @param replacePolicyOptions the instance to initialize the Builder with + */ + private Builder(ReplacePolicyOptions replacePolicyOptions) { + this.policyId = replacePolicyOptions.policyId; + this.ifMatch = replacePolicyOptions.ifMatch; + this.type = replacePolicyOptions.type; + this.subjects = replacePolicyOptions.subjects; + this.roles = replacePolicyOptions.roles; + this.resources = replacePolicyOptions.resources; + this.description = replacePolicyOptions.description; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyId the policyId + * @param ifMatch the ifMatch + * @param type the type + * @param subjects the subjects + * @param roles the roles + * @param resources the resources + */ + public Builder(String policyId, String ifMatch, String type, List subjects, List roles, List resources) { + this.policyId = policyId; + this.ifMatch = ifMatch; + this.type = type; + this.subjects = subjects; + this.roles = roles; + this.resources = resources; + } + + /** + * Builds a ReplacePolicyOptions. + * + * @return the new ReplacePolicyOptions instance + */ + public ReplacePolicyOptions build() { + return new ReplacePolicyOptions(this); + } + + /** + * Adds a new element to subjects. + * + * @param subjects the new element to be added + * @return the ReplacePolicyOptions builder + */ + public Builder addSubjects(PolicySubject subjects) { + com.ibm.cloud.sdk.core.util.Validator.notNull(subjects, + "subjects cannot be null"); + if (this.subjects == null) { + this.subjects = new ArrayList(); + } + this.subjects.add(subjects); + return this; + } + + /** + * Adds a new element to roles. + * + * @param roles the new element to be added + * @return the ReplacePolicyOptions builder + */ + public Builder addRoles(PolicyRole roles) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roles, + "roles cannot be null"); + if (this.roles == null) { + this.roles = new ArrayList(); + } + this.roles.add(roles); + return this; + } + + /** + * Adds a new element to resources. + * + * @param resources the new element to be added + * @return the ReplacePolicyOptions builder + */ + public Builder addResources(PolicyResource resources) { + com.ibm.cloud.sdk.core.util.Validator.notNull(resources, + "resources cannot be null"); + if (this.resources == null) { + this.resources = new ArrayList(); + } + this.resources.add(resources); + return this; + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the ReplacePolicyOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplacePolicyOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the ReplacePolicyOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the subjects. + * Existing subjects will be replaced. + * + * @param subjects the subjects + * @return the ReplacePolicyOptions builder + */ + public Builder subjects(List subjects) { + this.subjects = subjects; + return this; + } + + /** + * Set the roles. + * Existing roles will be replaced. + * + * @param roles the roles + * @return the ReplacePolicyOptions builder + */ + public Builder roles(List roles) { + this.roles = roles; + return this; + } + + /** + * Set the resources. + * Existing resources will be replaced. + * + * @param resources the resources + * @return the ReplacePolicyOptions builder + */ + public Builder resources(List resources) { + this.resources = resources; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplacePolicyOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + } + + protected ReplacePolicyOptions() { } + + protected ReplacePolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId 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.type, + "type cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subjects, + "subjects cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, + "roles cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resources, + "resources cannot be null"); + policyId = builder.policyId; + ifMatch = builder.ifMatch; + type = builder.type; + subjects = builder.subjects; + roles = builder.roles; + resources = builder.resources; + description = builder.description; + } + + /** + * New builder. + * + * @return a ReplacePolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyId. + * + * The policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be + * retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the subjects. + * + * The subjects associated with a policy. + * + * @return the subjects + */ + public List subjects() { + return subjects; + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List roles() { + return roles; + } + + /** + * Gets the resources. + * + * The resources associated with a policy. + * + * @return the resources + */ + public List resources() { + return resources; + } + + /** + * Gets the description. + * + * Customer-defined description. + * + * @return the description + */ + public String description() { + return description; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java new file mode 100644 index 00000000000..5a55c4898e5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java @@ -0,0 +1,276 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replacePolicyTemplate options. + */ +public class ReplacePolicyTemplateOptions extends GenericModel { + + protected String policyTemplateId; + protected String version; + protected String ifMatch; + protected TemplatePolicy policy; + protected String name; + protected String description; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String version; + private String ifMatch; + private TemplatePolicy policy; + private String name; + private String description; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing ReplacePolicyTemplateOptions instance. + * + * @param replacePolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(ReplacePolicyTemplateOptions replacePolicyTemplateOptions) { + this.policyTemplateId = replacePolicyTemplateOptions.policyTemplateId; + this.version = replacePolicyTemplateOptions.version; + this.ifMatch = replacePolicyTemplateOptions.ifMatch; + this.policy = replacePolicyTemplateOptions.policy; + this.name = replacePolicyTemplateOptions.name; + this.description = replacePolicyTemplateOptions.description; + this.committed = replacePolicyTemplateOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param version the version + * @param ifMatch the ifMatch + * @param policy the policy + */ + public Builder(String policyTemplateId, String version, String ifMatch, TemplatePolicy policy) { + this.policyTemplateId = policyTemplateId; + this.version = version; + this.ifMatch = ifMatch; + this.policy = policy; + } + + /** + * Builds a ReplacePolicyTemplateOptions. + * + * @return the new ReplacePolicyTemplateOptions instance + */ + public ReplacePolicyTemplateOptions build() { + return new ReplacePolicyTemplateOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the policy. + * + * @param policy the policy + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder policy(TemplatePolicy policy) { + this.policy = policy; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected ReplacePolicyTemplateOptions() { } + + protected ReplacePolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version 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.policy, + "policy cannot be null"); + policyTemplateId = builder.policyTemplateId; + version = builder.version; + ifMatch = builder.ifMatch; + policy = builder.policy; + name = builder.name; + description = builder.description; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a ReplacePolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the version. + * + * The policy template version. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy template version and must match the Etag value of the existing policy + * template version. The Etag can be retrieved using the GET + * /v1/policy_templates/{policy_template_id}/versions/{version} API and looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy policy() { + return policy; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template version. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java new file mode 100644 index 00000000000..fc4b536103d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java @@ -0,0 +1,255 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replaceRole options. + */ +public class ReplaceRoleOptions extends GenericModel { + + protected String roleId; + protected String ifMatch; + protected String displayName; + protected List actions; + protected String description; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + private String ifMatch; + private String displayName; + private List actions; + private String description; + + /** + * Instantiates a new Builder from an existing ReplaceRoleOptions instance. + * + * @param replaceRoleOptions the instance to initialize the Builder with + */ + private Builder(ReplaceRoleOptions replaceRoleOptions) { + this.roleId = replaceRoleOptions.roleId; + this.ifMatch = replaceRoleOptions.ifMatch; + this.displayName = replaceRoleOptions.displayName; + this.actions = replaceRoleOptions.actions; + this.description = replaceRoleOptions.description; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + * @param ifMatch the ifMatch + * @param displayName the displayName + * @param actions the actions + */ + public Builder(String roleId, String ifMatch, String displayName, List actions) { + this.roleId = roleId; + this.ifMatch = ifMatch; + this.displayName = displayName; + this.actions = actions; + } + + /** + * Builds a ReplaceRoleOptions. + * + * @return the new ReplaceRoleOptions instance + */ + public ReplaceRoleOptions build() { + return new ReplaceRoleOptions(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the ReplaceRoleOptions builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the ReplaceRoleOptions builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplaceRoleOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the ReplaceRoleOptions builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the ReplaceRoleOptions builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplaceRoleOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the role. + * + * @param role the role + * @return the ReplaceRoleOptions builder + */ + public Builder role(Role role) { + this.displayName = role.displayName(); + this.actions = role.actions(); + this.description = role.description(); + return this; + } + } + + protected ReplaceRoleOptions() { } + + protected ReplaceRoleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, + "roleId 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.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + roleId = builder.roleId; + ifMatch = builder.ifMatch; + displayName = builder.displayName; + actions = builder.actions; + description = builder.description; + } + + /** + * New builder. + * + * @return a ReplaceRoleOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role ID. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a role and must match the ETag value of the existing role. The Etag can be + * retrieved using the GET /v2/roles/{role_id} API and looking at the ETag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List actions() { + return actions; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String description() { + return description; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java new file mode 100644 index 00000000000..9a69b13326c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java @@ -0,0 +1,273 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replaceRoleTemplate options. + */ +public class ReplaceRoleTemplateOptions extends GenericModel { + + protected String roleTemplateId; + protected String version; + protected String ifMatch; + protected String name; + protected String description; + protected TemplateRole role; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String version; + private String ifMatch; + private String name; + private String description; + private TemplateRole role; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing ReplaceRoleTemplateOptions instance. + * + * @param replaceRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(ReplaceRoleTemplateOptions replaceRoleTemplateOptions) { + this.roleTemplateId = replaceRoleTemplateOptions.roleTemplateId; + this.version = replaceRoleTemplateOptions.version; + this.ifMatch = replaceRoleTemplateOptions.ifMatch; + this.name = replaceRoleTemplateOptions.name; + this.description = replaceRoleTemplateOptions.description; + this.role = replaceRoleTemplateOptions.role; + this.committed = replaceRoleTemplateOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + * @param version the version + * @param ifMatch the ifMatch + */ + public Builder(String roleTemplateId, String version, String ifMatch) { + this.roleTemplateId = roleTemplateId; + this.version = version; + this.ifMatch = ifMatch; + } + + /** + * Builds a ReplaceRoleTemplateOptions. + * + * @return the new ReplaceRoleTemplateOptions instance + */ + public ReplaceRoleTemplateOptions build() { + return new ReplaceRoleTemplateOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the role. + * + * @param role the role + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder role(TemplateRole role) { + this.role = role; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected ReplaceRoleTemplateOptions() { } + + protected ReplaceRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + roleTemplateId = builder.roleTemplateId; + version = builder.version; + ifMatch = builder.ifMatch; + name = builder.name; + description = builder.description; + role = builder.role; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a ReplaceRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the version. + * + * Role template version. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a role template version must match the Etag value of the existing role template + * version. The Etag can be retrieved using the GET /v1/role_templates/{template_id}/versions/{version} API and + * looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will + * change the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the role template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the role for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the role. + * + * The role properties that are created in an action resource when the template is assigned. + * + * @return the role + */ + public TemplateRole role() { + return role; + } + + /** + * Gets the committed. + * + * Committed status of the template version. If committed is set to true, then the template version can no longer be + * updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java new file mode 100644 index 00000000000..960f4782635 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java @@ -0,0 +1,336 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replaceV2Policy options. + */ +public class ReplaceV2PolicyOptions extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + protected String id; + protected String ifMatch; + protected Control control; + protected String type; + protected String description; + protected V2PolicySubject subject; + protected V2PolicyResource resource; + protected String pattern; + protected V2PolicyRule rule; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String ifMatch; + private Control control; + private String type; + private String description; + private V2PolicySubject subject; + private V2PolicyResource resource; + private String pattern; + private V2PolicyRule rule; + + /** + * Instantiates a new Builder from an existing ReplaceV2PolicyOptions instance. + * + * @param replaceV2PolicyOptions the instance to initialize the Builder with + */ + private Builder(ReplaceV2PolicyOptions replaceV2PolicyOptions) { + this.id = replaceV2PolicyOptions.id; + this.ifMatch = replaceV2PolicyOptions.ifMatch; + this.control = replaceV2PolicyOptions.control; + this.type = replaceV2PolicyOptions.type; + this.description = replaceV2PolicyOptions.description; + this.subject = replaceV2PolicyOptions.subject; + this.resource = replaceV2PolicyOptions.resource; + this.pattern = replaceV2PolicyOptions.pattern; + this.rule = replaceV2PolicyOptions.rule; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + * @param ifMatch the ifMatch + * @param control the control + * @param type the type + */ + public Builder(String id, String ifMatch, Control control, String type) { + this.id = id; + this.ifMatch = ifMatch; + this.control = control; + this.type = type; + } + + /** + * Builds a ReplaceV2PolicyOptions. + * + * @return the new ReplaceV2PolicyOptions instance + */ + public ReplaceV2PolicyOptions build() { + return new ReplaceV2PolicyOptions(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the ReplaceV2PolicyOptions builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplaceV2PolicyOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the control. + * + * @param control the control + * @return the ReplaceV2PolicyOptions builder + */ + public Builder control(Control control) { + this.control = control; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the ReplaceV2PolicyOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplaceV2PolicyOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the subject. + * + * @param subject the subject + * @return the ReplaceV2PolicyOptions builder + */ + public Builder subject(V2PolicySubject subject) { + this.subject = subject; + return this; + } + + /** + * Set the resource. + * + * @param resource the resource + * @return the ReplaceV2PolicyOptions builder + */ + public Builder resource(V2PolicyResource resource) { + this.resource = resource; + return this; + } + + /** + * Set the pattern. + * + * @param pattern the pattern + * @return the ReplaceV2PolicyOptions builder + */ + public Builder pattern(String pattern) { + this.pattern = pattern; + return this; + } + + /** + * Set the rule. + * + * @param rule the rule + * @return the ReplaceV2PolicyOptions builder + */ + public Builder rule(V2PolicyRule rule) { + this.rule = rule; + return this; + } + } + + protected ReplaceV2PolicyOptions() { } + + protected ReplaceV2PolicyOptions(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.control, + "control cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + id = builder.id; + ifMatch = builder.ifMatch; + control = builder.control; + type = builder.type; + description = builder.description; + subject = builder.subject; + resource = builder.resource; + pattern = builder.pattern; + rule = builder.rule; + } + + /** + * New builder. + * + * @return a ReplaceV2PolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be + * retrieved using the GET /v2/policies/{id} API and looking at the ETag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the control. + * + * Specifies the type of access that is granted by the policy. + * + * @return the control + */ + public Control control() { + return control; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject subject() { + return subject; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource resource() { + return resource; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String pattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule rule() { + return rule; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java new file mode 100644 index 00000000000..3a8b7e87b9e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * An attribute associated with a resource. + */ +public class ResourceAttribute extends GenericModel { + + protected String name; + protected String value; + protected String operator; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String value; + private String operator; + + /** + * Instantiates a new Builder from an existing ResourceAttribute instance. + * + * @param resourceAttribute the instance to initialize the Builder with + */ + private Builder(ResourceAttribute resourceAttribute) { + this.name = resourceAttribute.name; + this.value = resourceAttribute.value; + this.operator = resourceAttribute.operator; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param value the value + */ + public Builder(String name, String value) { + this.name = name; + this.value = value; + } + + /** + * Builds a ResourceAttribute. + * + * @return the new ResourceAttribute instance + */ + public ResourceAttribute build() { + return new ResourceAttribute(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the ResourceAttribute builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the ResourceAttribute builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the ResourceAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + } + + protected ResourceAttribute() { } + + protected ResourceAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + name = builder.name; + value = builder.value; + operator = builder.operator; + } + + /** + * New builder. + * + * @return a ResourceAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The name of an attribute. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the value. + * + * The value of an attribute. + * + * @return the value + */ + public String value() { + return value; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java new file mode 100644 index 00000000000..7da4cffee56 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A tag associated with a resource. + */ +public class ResourceTag extends GenericModel { + + protected String name; + protected String value; + protected String operator; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String value; + private String operator; + + /** + * Instantiates a new Builder from an existing ResourceTag instance. + * + * @param resourceTag the instance to initialize the Builder with + */ + private Builder(ResourceTag resourceTag) { + this.name = resourceTag.name; + this.value = resourceTag.value; + this.operator = resourceTag.operator; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param value the value + */ + public Builder(String name, String value) { + this.name = name; + this.value = value; + } + + /** + * Builds a ResourceTag. + * + * @return the new ResourceTag instance + */ + public ResourceTag build() { + return new ResourceTag(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the ResourceTag builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the ResourceTag builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the ResourceTag builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + } + + protected ResourceTag() { } + + protected ResourceTag(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + name = builder.name; + value = builder.value; + operator = builder.operator; + } + + /** + * New builder. + * + * @return a ResourceTag builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The name of an access management tag. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the value. + * + * The value of an access management tag. + * + * @return the value + */ + public String value() { + return value; + } + + /** + * Gets the operator. + * + * The operator of an access management tag. + * + * @return the operator + */ + public String operator() { + return operator; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java new file mode 100644 index 00000000000..24b99c9bd08 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java @@ -0,0 +1,196 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role resource. + */ +public class Role extends GenericModel { + + @SerializedName("display_name") + protected String displayName; + protected String description; + protected List actions; + protected String crn; + + /** + * Builder. + */ + public static class Builder { + private String displayName; + private String description; + private List actions; + + /** + * Instantiates a new Builder from an existing Role instance. + * + * @param role the instance to initialize the Builder with + */ + private Builder(Role role) { + this.displayName = role.displayName; + this.description = role.description; + this.actions = role.actions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param displayName the displayName + * @param actions the actions + */ + public Builder(String displayName, List actions) { + this.displayName = displayName; + this.actions = actions; + } + + /** + * Builds a Role. + * + * @return the new Role instance + */ + public Role build() { + return new Role(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the Role builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the Role builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the Role builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the Role builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + } + + protected Role() { } + + protected Role(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + displayName = builder.displayName; + description = builder.description; + actions = builder.actions; + } + + /** + * New builder. + * + * @return a Role builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List actions() { + return actions; + } + + /** + * Gets the crn. + * + * The role Cloud Resource Name (CRN). Example CRN: + * 'crn:v1:ibmcloud:public:iam-access-management::a/exampleAccountId::customRole:ExampleRoleName'. + * + * @return the crn + */ + public String crn() { + return crn; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java new file mode 100644 index 00000000000..9169fc88572 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java @@ -0,0 +1,64 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * An action that can be performed by the policy subject when assigned a role. + */ +public class RoleAction extends GenericModel { + + protected String id; + @SerializedName("display_name") + protected String displayName; + protected String description; + + protected RoleAction() { } + + /** + * Gets the id. + * + * Unique identifier for action with structure service.resource.action. For example, cbr.rule.read. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the displayName. + * + * Services defined display name for action. + * + * @return the displayName + */ + public String getDisplayName() { + return displayName; + } + + /** + * Gets the description. + * + * Service defined description for action. + * + * @return the description + */ + public String getDescription() { + return description; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java new file mode 100644 index 00000000000..23bb4b65c6f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java @@ -0,0 +1,207 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the assigned role template. + */ +public class RoleAssignment extends GenericModel { + + /** + * The current operation of the role assignment. + */ + public interface Operation { + /** create. */ + String CREATE = "create"; + /** apply. */ + String APPLY = "apply"; + /** update. */ + String UPDATE = "update"; + /** remove. */ + String REMOVE = "remove"; + } + + /** + * The role assignment status. + */ + public interface Status { + /** accepted. */ + String ACCEPTED = "accepted"; + /** failure. */ + String FAILURE = "failure"; + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** superseded. */ + String SUPERSEDED = "superseded"; + } + + protected String id; + @SerializedName("account_id") + protected String accountId; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String operation; + protected List resources; + protected RoleAssignmentTemplate template; + protected AssignmentTargetDetails target; + protected String status; + + protected RoleAssignment() { } + + /** + * Gets the id. + * + * Action control assignment ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the accountId. + * + * The account GUID that the role assignments belong to. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the href. + * + * The href URL that links to the role assignments API by role assignment ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the role assignment was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the role assignment. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the role assignment was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the role assignment. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the operation. + * + * The current operation of the role assignment. + * + * @return the operation + */ + public String getOperation() { + return operation; + } + + /** + * Gets the resources. + * + * Resources created when role template is assigned. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the template. + * + * The role template id and version that will be assigned. + * + * @return the template + */ + public RoleAssignmentTemplate getTemplate() { + return template; + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the status. + * + * The role assignment status. + * + * @return the status + */ + public String getStatus() { + return status; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java new file mode 100644 index 00000000000..658ac5b8c99 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of role assignments. + */ +public class RoleAssignmentCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List assignments; + + protected RoleAssignmentCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the assignments. + * + * List of role assignments. + * + * @return the assignments + */ + public List getAssignments() { + return assignments; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java new file mode 100644 index 00000000000..60d7a02d604 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The role assignment resources and target where the template is assigned. + */ +public class RoleAssignmentResource extends GenericModel { + + protected AssignmentTargetDetails target; + protected RoleAssignmentResourceRole role; + + protected RoleAssignmentResource() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the role. + * + * Set of properties of the assigned resource or error message if assignment failed. + * + * @return the role + */ + public RoleAssignmentResourceRole getRole() { + return role; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java new file mode 100644 index 00000000000..9ea359d63fb --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * On success, it includes the role assigned. + */ +public class RoleAssignmentResourceCreated extends GenericModel { + + protected String id; + + protected RoleAssignmentResourceCreated() { } + + /** + * Gets the id. + * + * role id. + * + * @return the id + */ + public String getId() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java new file mode 100644 index 00000000000..22d40bdaef4 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Set of properties of the assigned resource or error message if assignment failed. + */ +public class RoleAssignmentResourceRole extends GenericModel { + + @SerializedName("resource_created") + protected RoleAssignmentResourceCreated resourceCreated; + @SerializedName("error_message") + protected AssignmentResourceError errorMessage; + + protected RoleAssignmentResourceRole() { } + + /** + * Gets the resourceCreated. + * + * On success, it includes the role assigned. + * + * @return the resourceCreated + */ + public RoleAssignmentResourceCreated getResourceCreated() { + return resourceCreated; + } + + /** + * Gets the errorMessage. + * + * Body parameters for assignment error. + * + * @return the errorMessage + */ + public AssignmentResourceError getErrorMessage() { + return errorMessage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java new file mode 100644 index 00000000000..3524b91f4d5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The role template id and version that will be assigned. + */ +public class RoleAssignmentTemplate extends GenericModel { + + protected String id; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String version; + + /** + * Instantiates a new Builder from an existing RoleAssignmentTemplate instance. + * + * @param roleAssignmentTemplate the instance to initialize the Builder with + */ + private Builder(RoleAssignmentTemplate roleAssignmentTemplate) { + this.id = roleAssignmentTemplate.id; + this.version = roleAssignmentTemplate.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + * @param version the version + */ + public Builder(String id, String version) { + this.id = id; + this.version = version; + } + + /** + * Builds a RoleAssignmentTemplate. + * + * @return the new RoleAssignmentTemplate instance + */ + public RoleAssignmentTemplate build() { + return new RoleAssignmentTemplate(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the RoleAssignmentTemplate builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the RoleAssignmentTemplate builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected RoleAssignmentTemplate() { } + + protected RoleAssignmentTemplate(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, + "id cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + id = builder.id; + version = builder.version; + } + + /** + * New builder. + * + * @return a RoleAssignmentTemplate builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * Action control template ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java new file mode 100644 index 00000000000..16296a82e40 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * RoleAssignmentsPager can be used to simplify the use of the "listRoleAssignments" method. + */ +public class RoleAssignmentsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListRoleAssignmentsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected RoleAssignmentsPager() { } + + /** + * Constructs a new RoleAssignmentsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listRoleAssignments" method + * @param options the ListRoleAssignmentsOptions instance to be used to invoke the "listRoleAssignments" method + */ + public RoleAssignmentsPager(IamPolicyManagement client, ListRoleAssignmentsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<RoleAssignment> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListRoleAssignmentsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + RoleAssignmentCollection result = client.listRoleAssignments(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getAssignments(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<RoleAssignment> containing all results returned by the "listRoleAssignments" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java new file mode 100644 index 00000000000..282730a2dfc --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java @@ -0,0 +1,68 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of roles returned by the 'list roles' operation. + */ +public class RoleCollection extends GenericModel { + + @SerializedName("custom_roles") + protected List customRoles; + @SerializedName("service_roles") + protected List serviceRoles; + @SerializedName("system_roles") + protected List systemRoles; + + protected RoleCollection() { } + + /** + * Gets the customRoles. + * + * List of custom roles. + * + * @return the customRoles + */ + public List getCustomRoles() { + return customRoles; + } + + /** + * Gets the serviceRoles. + * + * List of service roles. + * + * @return the serviceRoles + */ + public List getServiceRoles() { + return serviceRoles; + } + + /** + * Gets the systemRoles. + * + * List of system roles. + * + * @return the systemRoles + */ + public List getSystemRoles() { + return systemRoles; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java new file mode 100644 index 00000000000..663d0f7f1d0 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java @@ -0,0 +1,202 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the role template. + */ +public class RoleTemplate extends GenericModel { + + /** + * State of role template. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String name; + protected String description; + @SerializedName("account_id") + protected String accountId; + protected Boolean committed; + protected RoleTemplatePrototypeRole role; + protected String id; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String version; + protected String state; + + protected RoleTemplate() { } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Description of the role template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the role for enterprise users managing IAM templates. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the committed. + * + * Committed status of the template. If committed is set to true, then the template version can no longer be updated. + * + * @return the committed + */ + public Boolean isCommitted() { + return committed; + } + + /** + * Gets the role. + * + * The role properties that are created in an action resource when the template is assigned. + * + * @return the role + */ + public RoleTemplatePrototypeRole getRole() { + return role; + } + + /** + * Gets the id. + * + * The role template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the role templates API by role template ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the role template was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the role template. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the role template was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the role template. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the version. + * + * The version number of the template used to identify different versions of same template. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the state. + * + * State of role template. + * + * @return the state + */ + public String getState() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java new file mode 100644 index 00000000000..22a739b4a58 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java @@ -0,0 +1,90 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of role templates. + */ +public class RoleTemplateCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + @SerializedName("role_templates") + protected List roleTemplates; + + protected RoleTemplateCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the roleTemplates. + * + * List of role templates. + * + * @return the roleTemplates + */ + public List getRoleTemplates() { + return roleTemplates; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java new file mode 100644 index 00000000000..43197620689 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java @@ -0,0 +1,239 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The role properties that are created in an action resource when the template is assigned. + */ +public class RoleTemplatePrototypeRole extends GenericModel { + + protected String name; + @SerializedName("display_name") + protected String displayName; + @SerializedName("service_name") + protected String serviceName; + protected String description; + protected List actions; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String displayName; + private String serviceName; + private String description; + private List actions; + + /** + * Instantiates a new Builder from an existing RoleTemplatePrototypeRole instance. + * + * @param roleTemplatePrototypeRole the instance to initialize the Builder with + */ + private Builder(RoleTemplatePrototypeRole roleTemplatePrototypeRole) { + this.name = roleTemplatePrototypeRole.name; + this.displayName = roleTemplatePrototypeRole.displayName; + this.serviceName = roleTemplatePrototypeRole.serviceName; + this.description = roleTemplatePrototypeRole.description; + this.actions = roleTemplatePrototypeRole.actions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param displayName the displayName + * @param actions the actions + */ + public Builder(String name, String displayName, List actions) { + this.name = name; + this.displayName = displayName; + this.actions = actions; + } + + /** + * Builds a RoleTemplatePrototypeRole. + * + * @return the new RoleTemplatePrototypeRole instance + */ + public RoleTemplatePrototypeRole build() { + return new RoleTemplatePrototypeRole(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the RoleTemplatePrototypeRole builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the RoleTemplatePrototypeRole builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the RoleTemplatePrototypeRole builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the RoleTemplatePrototypeRole builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the RoleTemplatePrototypeRole builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the RoleTemplatePrototypeRole builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + } + + protected RoleTemplatePrototypeRole() { } + + protected RoleTemplatePrototypeRole(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + name = builder.name; + displayName = builder.displayName; + serviceName = builder.serviceName; + description = builder.description; + actions = builder.actions; + } + + /** + * New builder. + * + * @return a RoleTemplatePrototypeRole builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the serviceName. + * + * The service name that the role refers. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the description. + * + * Description of the role. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. + * + * @return the actions + */ + public List actions() { + return actions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java new file mode 100644 index 00000000000..673ff7f9750 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role template reference associated with a policy template. + */ +public class RoleTemplateReferencesItem extends GenericModel { + + protected String id; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String version; + + /** + * Instantiates a new Builder from an existing RoleTemplateReferencesItem instance. + * + * @param roleTemplateReferencesItem the instance to initialize the Builder with + */ + private Builder(RoleTemplateReferencesItem roleTemplateReferencesItem) { + this.id = roleTemplateReferencesItem.id; + this.version = roleTemplateReferencesItem.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + * @param version the version + */ + public Builder(String id, String version) { + this.id = id; + this.version = version; + } + + /** + * Builds a RoleTemplateReferencesItem. + * + * @return the new RoleTemplateReferencesItem instance + */ + public RoleTemplateReferencesItem build() { + return new RoleTemplateReferencesItem(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the RoleTemplateReferencesItem builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the RoleTemplateReferencesItem builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected RoleTemplateReferencesItem() { } + + protected RoleTemplateReferencesItem(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, + "id cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + id = builder.id; + version = builder.version; + } + + /** + * New builder. + * + * @return a RoleTemplateReferencesItem builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The role template ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the version. + * + * Role template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java new file mode 100644 index 00000000000..a983208afe3 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of versions for a specific role template. + */ +public class RoleTemplateVersionsCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List versions; + + protected RoleTemplateVersionsCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the versions. + * + * List of role templates versions. + * + * @return the versions + */ + public List getVersions() { + return versions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java new file mode 100644 index 00000000000..7af200cd72f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * RoleTemplateVersionsPager can be used to simplify the use of the "listRoleTemplateVersions" method. + */ +public class RoleTemplateVersionsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListRoleTemplateVersionsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected RoleTemplateVersionsPager() { } + + /** + * Constructs a new RoleTemplateVersionsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listRoleTemplateVersions" method + * @param options the ListRoleTemplateVersionsOptions instance to be used to invoke the "listRoleTemplateVersions" method + */ + public RoleTemplateVersionsPager(IamPolicyManagement client, ListRoleTemplateVersionsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<RoleTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListRoleTemplateVersionsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + RoleTemplateVersionsCollection result = client.listRoleTemplateVersions(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getVersions(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<RoleTemplate> containing all results returned by the "listRoleTemplateVersions" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java new file mode 100644 index 00000000000..3654e0757ba --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * RoleTemplatesPager can be used to simplify the use of the "listRoleTemplates" method. + */ +public class RoleTemplatesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListRoleTemplatesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected RoleTemplatesPager() { } + + /** + * Constructs a new RoleTemplatesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listRoleTemplates" method + * @param options the ListRoleTemplatesOptions instance to be used to invoke the "listRoleTemplates" method + */ + public RoleTemplatesPager(IamPolicyManagement client, ListRoleTemplatesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<RoleTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListRoleTemplatesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + RoleTemplateCollection result = client.listRoleTemplates(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getRoleTemplates(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<RoleTemplate> containing all results returned by the "listRoleTemplates" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java new file mode 100644 index 00000000000..03b6ff75eb1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java @@ -0,0 +1,106 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role associated with a policy. + */ +public class Roles extends GenericModel { + + @SerializedName("role_id") + protected String roleId; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + + /** + * Instantiates a new Builder from an existing Roles instance. + * + * @param roles the instance to initialize the Builder with + */ + private Builder(Roles roles) { + this.roleId = roles.roleId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + */ + public Builder(String roleId) { + this.roleId = roleId; + } + + /** + * Builds a Roles. + * + * @return the new Roles instance + */ + public Roles build() { + return new Roles(this); + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the Roles builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + } + + protected Roles() { } + + protected Roles(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleId, + "roleId cannot be null"); + roleId = builder.roleId; + } + + /** + * New builder. + * + * @return a Roles builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java new file mode 100644 index 00000000000..fbf66d53ae1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java @@ -0,0 +1,209 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Rule that specifies additional access that is granted (For example, time-based condition). + */ +public class RuleAttribute extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + protected String key; + protected String operator; + protected Object value; + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing RuleAttribute instance. + * + * @param ruleAttribute the instance to initialize the Builder with + */ + private Builder(RuleAttribute ruleAttribute) { + this.key = ruleAttribute.key; + this.operator = ruleAttribute.operator; + this.value = ruleAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a RuleAttribute. + * + * @return the new RuleAttribute instance + */ + public RuleAttribute build() { + return new RuleAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the RuleAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the RuleAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the RuleAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected RuleAttribute() { } + + protected RuleAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a RuleAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the key. + * + * The name of an attribute. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java new file mode 100644 index 00000000000..d7e54e112c5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * An attribute associated with a subject. + */ +public class SubjectAttribute extends GenericModel { + + protected String name; + protected String value; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String value; + + /** + * Instantiates a new Builder from an existing SubjectAttribute instance. + * + * @param subjectAttribute the instance to initialize the Builder with + */ + private Builder(SubjectAttribute subjectAttribute) { + this.name = subjectAttribute.name; + this.value = subjectAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param value the value + */ + public Builder(String name, String value) { + this.name = name; + this.value = value; + } + + /** + * Builds a SubjectAttribute. + * + * @return the new SubjectAttribute instance + */ + public SubjectAttribute build() { + return new SubjectAttribute(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the SubjectAttribute builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the SubjectAttribute builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + } + + protected SubjectAttribute() { } + + protected SubjectAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + name = builder.name; + value = builder.value; + } + + /** + * New builder. + * + * @return a SubjectAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The name of an attribute. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the value. + * + * The value of an attribute. + * + * @return the value + */ + public String value() { + return value; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java new file mode 100644 index 00000000000..62f4bd77f87 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java @@ -0,0 +1,182 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The action control properties that are created in an action resource when the template is assigned. + */ +public class TemplateActionControl extends GenericModel { + + @SerializedName("service_name") + protected String serviceName; + protected String description; + protected List actions; + + /** + * Builder. + */ + public static class Builder { + private String serviceName; + private String description; + private List actions; + + /** + * Instantiates a new Builder from an existing TemplateActionControl instance. + * + * @param templateActionControl the instance to initialize the Builder with + */ + private Builder(TemplateActionControl templateActionControl) { + this.serviceName = templateActionControl.serviceName; + this.description = templateActionControl.description; + this.actions = templateActionControl.actions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param serviceName the serviceName + * @param actions the actions + */ + public Builder(String serviceName, List actions) { + this.serviceName = serviceName; + this.actions = actions; + } + + /** + * Builds a TemplateActionControl. + * + * @return the new TemplateActionControl instance + */ + public TemplateActionControl build() { + return new TemplateActionControl(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the TemplateActionControl builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the TemplateActionControl builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the TemplateActionControl builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the TemplateActionControl builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + } + + protected TemplateActionControl() { } + + protected TemplateActionControl(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, + "serviceName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + serviceName = builder.serviceName; + description = builder.description; + actions = builder.actions; + } + + /** + * New builder. + * + * @return a TemplateActionControl builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the serviceName. + * + * The service name that the action control refers. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the description. + * + * Description of the action control. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actions. + * + * List of actions to control access. + * + * @return the actions + */ + public List actions() { + return actions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java new file mode 100644 index 00000000000..c74a77d9b6d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Specifies the type of access that is granted by the policy. + */ +public class TemplateControl extends GenericModel { + + protected TemplateGrant grant; + + /** + * Builder. + */ + public static class Builder { + private TemplateGrant grant; + + /** + * Instantiates a new Builder from an existing TemplateControl instance. + * + * @param templateControl the instance to initialize the Builder with + */ + private Builder(TemplateControl templateControl) { + this.grant = templateControl.grant; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param grant the grant + */ + public Builder(TemplateGrant grant) { + this.grant = grant; + } + + /** + * Builds a TemplateControl. + * + * @return the new TemplateControl instance + */ + public TemplateControl build() { + return new TemplateControl(this); + } + + /** + * Set the grant. + * + * @param grant the grant + * @return the TemplateControl builder + */ + public Builder grant(TemplateGrant grant) { + this.grant = grant; + return this; + } + } + + protected TemplateControl() { } + + protected TemplateControl(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.grant, + "grant cannot be null"); + grant = builder.grant; + } + + /** + * New builder. + * + * @return a TemplateControl builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the grant. + * + * Permission is granted by the policy. + * + * @return the grant + */ + public TemplateGrant grant() { + return grant; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java new file mode 100644 index 00000000000..edb134e1270 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * policy template count details. + */ +public class TemplateCountData extends GenericModel { + + protected LimitData template; + protected LimitData version; + + protected TemplateCountData() { } + + /** + * Gets the template. + * + * policy template current and limit details with in an account. + * + * @return the template + */ + public LimitData getTemplate() { + return template; + } + + /** + * Gets the version. + * + * policy template current and limit details with in an account. + * + * @return the version + */ + public LimitData getVersion() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java new file mode 100644 index 00000000000..fd0daff9665 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java @@ -0,0 +1,58 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Permission is granted by the policy. + * + * Classes which extend this class: + * - TemplateGrantRoles + * - TemplateGrantRoleReferences + */ +public class TemplateGrant extends GenericModel { + + protected List roles; + @SerializedName("role_template_references") + protected List roleTemplateReferences; + + protected TemplateGrant() { } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List roles() { + return roles; + } + + /** + * Gets the roleTemplateReferences. + * + * A set of role template reference IDs granted by the policy. + * + * @return the roleTemplateReferences + */ + public List roleTemplateReferences() { + return roleTemplateReferences; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java new file mode 100644 index 00000000000..248eb121b72 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java @@ -0,0 +1,110 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * TemplateGrantRoleReferences. + */ +public class TemplateGrantRoleReferences extends TemplateGrant { + + + /** + * Builder. + */ + public static class Builder { + private List roleTemplateReferences; + + /** + * Instantiates a new Builder from an existing TemplateGrantRoleReferences instance. + * + * @param templateGrantRoleReferences the instance to initialize the Builder with + */ + public Builder(TemplateGrant templateGrantRoleReferences) { + this.roleTemplateReferences = templateGrantRoleReferences.roleTemplateReferences; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateReferences the roleTemplateReferences + */ + public Builder(List roleTemplateReferences) { + this.roleTemplateReferences = roleTemplateReferences; + } + + /** + * Builds a TemplateGrantRoleReferences. + * + * @return the new TemplateGrantRoleReferences instance + */ + public TemplateGrantRoleReferences build() { + return new TemplateGrantRoleReferences(this); + } + + /** + * Adds a new element to roleTemplateReferences. + * + * @param roleTemplateReferences the new element to be added + * @return the TemplateGrantRoleReferences builder + */ + public Builder addRoleTemplateReferences(RoleTemplateReferencesItem roleTemplateReferences) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roleTemplateReferences, + "roleTemplateReferences cannot be null"); + if (this.roleTemplateReferences == null) { + this.roleTemplateReferences = new ArrayList(); + } + this.roleTemplateReferences.add(roleTemplateReferences); + return this; + } + + /** + * Set the roleTemplateReferences. + * Existing roleTemplateReferences will be replaced. + * + * @param roleTemplateReferences the roleTemplateReferences + * @return the TemplateGrantRoleReferences builder + */ + public Builder roleTemplateReferences(List roleTemplateReferences) { + this.roleTemplateReferences = roleTemplateReferences; + return this; + } + } + + protected TemplateGrantRoleReferences() { } + + protected TemplateGrantRoleReferences(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleTemplateReferences, + "roleTemplateReferences cannot be null"); + roleTemplateReferences = builder.roleTemplateReferences; + } + + /** + * New builder. + * + * @return a TemplateGrantRoleReferences builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java new file mode 100644 index 00000000000..6524b3645eb --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java @@ -0,0 +1,110 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * TemplateGrantRoles. + */ +public class TemplateGrantRoles extends TemplateGrant { + + + /** + * Builder. + */ + public static class Builder { + private List roles; + + /** + * Instantiates a new Builder from an existing TemplateGrantRoles instance. + * + * @param templateGrantRoles the instance to initialize the Builder with + */ + public Builder(TemplateGrant templateGrantRoles) { + this.roles = templateGrantRoles.roles; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roles the roles + */ + public Builder(List roles) { + this.roles = roles; + } + + /** + * Builds a TemplateGrantRoles. + * + * @return the new TemplateGrantRoles instance + */ + public TemplateGrantRoles build() { + return new TemplateGrantRoles(this); + } + + /** + * Adds a new element to roles. + * + * @param roles the new element to be added + * @return the TemplateGrantRoles builder + */ + public Builder addRoles(Roles roles) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roles, + "roles cannot be null"); + if (this.roles == null) { + this.roles = new ArrayList(); + } + this.roles.add(roles); + return this; + } + + /** + * Set the roles. + * Existing roles will be replaced. + * + * @param roles the roles + * @return the TemplateGrantRoles builder + */ + public Builder roles(List roles) { + this.roles = roles; + return this; + } + } + + protected TemplateGrantRoles() { } + + protected TemplateGrantRoles(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, + "roles cannot be null"); + roles = builder.roles; + } + + /** + * New builder. + * + * @return a TemplateGrantRoles builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java new file mode 100644 index 00000000000..41f112312cd --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java @@ -0,0 +1,91 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The details of the IAM template that was used to create an enterprise-managed policy in your account. When returned, + * this indicates that the policy is created from and managed by a template in the root enterprise account. + */ +public class TemplateMetadata extends GenericModel { + + protected String id; + protected String version; + @SerializedName("assignment_id") + protected String assignmentId; + @SerializedName("root_id") + protected String rootId; + @SerializedName("root_version") + protected String rootVersion; + + protected TemplateMetadata() { } + + /** + * Gets the id. + * + * The policy template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the version. + * + * Template version. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the assignmentId. + * + * Policy assignment ID. + * + * @return the assignmentId + */ + public String getAssignmentId() { + return assignmentId; + } + + /** + * Gets the rootId. + * + * Orchestrator template ID. + * + * @return the rootId + */ + public String getRootId() { + return rootId; + } + + /** + * Gets the rootVersion. + * + * Orchestrator template version. + * + * @return the rootVersion + */ + public String getRootVersion() { + return rootVersion; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java new file mode 100644 index 00000000000..496b2e70e40 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java @@ -0,0 +1,272 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the template's policy object. + */ +public class TemplatePolicy extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + protected String type; + protected String description; + protected V2PolicyResource resource; + protected V2PolicySubject subject; + protected String pattern; + protected V2PolicyRule rule; + protected TemplateControl control; + + /** + * Builder. + */ + public static class Builder { + private String type; + private String description; + private V2PolicyResource resource; + private V2PolicySubject subject; + private String pattern; + private V2PolicyRule rule; + private TemplateControl control; + + /** + * Instantiates a new Builder from an existing TemplatePolicy instance. + * + * @param templatePolicy the instance to initialize the Builder with + */ + private Builder(TemplatePolicy templatePolicy) { + this.type = templatePolicy.type; + this.description = templatePolicy.description; + this.resource = templatePolicy.resource; + this.subject = templatePolicy.subject; + this.pattern = templatePolicy.pattern; + this.rule = templatePolicy.rule; + this.control = templatePolicy.control; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param type the type + */ + public Builder(String type) { + this.type = type; + } + + /** + * Builds a TemplatePolicy. + * + * @return the new TemplatePolicy instance + */ + public TemplatePolicy build() { + return new TemplatePolicy(this); + } + + /** + * Set the type. + * + * @param type the type + * @return the TemplatePolicy builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the TemplatePolicy builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the resource. + * + * @param resource the resource + * @return the TemplatePolicy builder + */ + public Builder resource(V2PolicyResource resource) { + this.resource = resource; + return this; + } + + /** + * Set the subject. + * + * @param subject the subject + * @return the TemplatePolicy builder + */ + public Builder subject(V2PolicySubject subject) { + this.subject = subject; + return this; + } + + /** + * Set the pattern. + * + * @param pattern the pattern + * @return the TemplatePolicy builder + */ + public Builder pattern(String pattern) { + this.pattern = pattern; + return this; + } + + /** + * Set the rule. + * + * @param rule the rule + * @return the TemplatePolicy builder + */ + public Builder rule(V2PolicyRule rule) { + this.rule = rule; + return this; + } + + /** + * Set the control. + * + * @param control the control + * @return the TemplatePolicy builder + */ + public Builder control(TemplateControl control) { + this.control = control; + return this; + } + } + + protected TemplatePolicy() { } + + protected TemplatePolicy(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + type = builder.type; + description = builder.description; + resource = builder.resource; + subject = builder.subject; + pattern = builder.pattern; + rule = builder.rule; + control = builder.control; + } + + /** + * New builder. + * + * @return a TemplatePolicy builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. This is shown in child accounts when an access group or trusted profile template uses + * the policy template to assign access. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource resource() { + return resource; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject subject() { + return subject; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String pattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule rule() { + return rule; + } + + /** + * Gets the control. + * + * Specifies the type of access that is granted by the policy. + * + * @return the control + */ + public TemplateControl control() { + return control; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java new file mode 100644 index 00000000000..b76beb3bddb --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java @@ -0,0 +1,209 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The role properties that are created in an action resource when the template is assigned. + */ +public class TemplateRole extends GenericModel { + + @SerializedName("display_name") + protected String displayName; + @SerializedName("service_name") + protected String serviceName; + protected String description; + protected List actions; + + /** + * Builder. + */ + public static class Builder { + private String displayName; + private String serviceName; + private String description; + private List actions; + + /** + * Instantiates a new Builder from an existing TemplateRole instance. + * + * @param templateRole the instance to initialize the Builder with + */ + private Builder(TemplateRole templateRole) { + this.displayName = templateRole.displayName; + this.serviceName = templateRole.serviceName; + this.description = templateRole.description; + this.actions = templateRole.actions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param displayName the displayName + * @param actions the actions + */ + public Builder(String displayName, List actions) { + this.displayName = displayName; + this.actions = actions; + } + + /** + * Builds a TemplateRole. + * + * @return the new TemplateRole instance + */ + public TemplateRole build() { + return new TemplateRole(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the TemplateRole builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the TemplateRole builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the TemplateRole builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the TemplateRole builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the TemplateRole builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + } + + protected TemplateRole() { } + + protected TemplateRole(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + displayName = builder.displayName; + serviceName = builder.serviceName; + description = builder.description; + actions = builder.actions; + } + + /** + * New builder. + * + * @return a TemplateRole builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the serviceName. + * + * The service name that the role refers. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the description. + * + * Description of the role. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. + * + * @return the actions + */ + public List actions() { + return actions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java new file mode 100644 index 00000000000..caf2f737b55 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java @@ -0,0 +1,166 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updateActionControlAssignment options. + */ +public class UpdateActionControlAssignmentOptions extends GenericModel { + + protected String assignmentId; + protected String ifMatch; + protected String templateVersion; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + private String ifMatch; + private String templateVersion; + + /** + * Instantiates a new Builder from an existing UpdateActionControlAssignmentOptions instance. + * + * @param updateActionControlAssignmentOptions the instance to initialize the Builder with + */ + private Builder(UpdateActionControlAssignmentOptions updateActionControlAssignmentOptions) { + this.assignmentId = updateActionControlAssignmentOptions.assignmentId; + this.ifMatch = updateActionControlAssignmentOptions.ifMatch; + this.templateVersion = updateActionControlAssignmentOptions.templateVersion; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + * @param ifMatch the ifMatch + * @param templateVersion the templateVersion + */ + public Builder(String assignmentId, String ifMatch, String templateVersion) { + this.assignmentId = assignmentId; + this.ifMatch = ifMatch; + this.templateVersion = templateVersion; + } + + /** + * Builds a UpdateActionControlAssignmentOptions. + * + * @return the new UpdateActionControlAssignmentOptions instance + */ + public UpdateActionControlAssignmentOptions build() { + return new UpdateActionControlAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the UpdateActionControlAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdateActionControlAssignmentOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the UpdateActionControlAssignmentOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + } + + protected UpdateActionControlAssignmentOptions() { } + + protected UpdateActionControlAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId 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.templateVersion, + "templateVersion cannot be null"); + assignmentId = builder.assignmentId; + ifMatch = builder.ifMatch; + templateVersion = builder.templateVersion; + } + + /** + * New builder. + * + * @return a UpdateActionControlAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Action control template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating an action control assignment and must match the Etag value of the existing action + * control assignment. The Etag can be retrieved using the GET /v1/action_control_assignments/{assignment_id} API and + * looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the templateVersion. + * + * The version number of the template used to identify different versions of same template. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java new file mode 100644 index 00000000000..869eb357802 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java @@ -0,0 +1,196 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updatePolicyAssignment options. + */ +public class UpdatePolicyAssignmentOptions extends GenericModel { + + protected String assignmentId; + protected String version; + protected String ifMatch; + protected String templateVersion; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + private String version; + private String ifMatch; + private String templateVersion; + + /** + * Instantiates a new Builder from an existing UpdatePolicyAssignmentOptions instance. + * + * @param updatePolicyAssignmentOptions the instance to initialize the Builder with + */ + private Builder(UpdatePolicyAssignmentOptions updatePolicyAssignmentOptions) { + this.assignmentId = updatePolicyAssignmentOptions.assignmentId; + this.version = updatePolicyAssignmentOptions.version; + this.ifMatch = updatePolicyAssignmentOptions.ifMatch; + this.templateVersion = updatePolicyAssignmentOptions.templateVersion; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + * @param version the version + * @param ifMatch the ifMatch + * @param templateVersion the templateVersion + */ + public Builder(String assignmentId, String version, String ifMatch, String templateVersion) { + this.assignmentId = assignmentId; + this.version = version; + this.ifMatch = ifMatch; + this.templateVersion = templateVersion; + } + + /** + * Builds a UpdatePolicyAssignmentOptions. + * + * @return the new UpdatePolicyAssignmentOptions instance + */ + public UpdatePolicyAssignmentOptions build() { + return new UpdatePolicyAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the UpdatePolicyAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the UpdatePolicyAssignmentOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdatePolicyAssignmentOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the UpdatePolicyAssignmentOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + } + + protected UpdatePolicyAssignmentOptions() { } + + protected UpdatePolicyAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templateVersion, + "templateVersion cannot be null"); + assignmentId = builder.assignmentId; + version = builder.version; + ifMatch = builder.ifMatch; + templateVersion = builder.templateVersion; + } + + /** + * New builder. + * + * @return a UpdatePolicyAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * The policy template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } + + /** + * Gets the version. + * + * specify version of response body format. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy assignment and must match the Etag value of the existing policy + * assignment. The Etag can be retrieved using the GET /v1/policy_assignments/{assignment_id} API and looking at the + * Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the templateVersion. + * + * The policy template version to update to. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java new file mode 100644 index 00000000000..a28b357641f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java @@ -0,0 +1,171 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updatePolicyState options. + */ +public class UpdatePolicyStateOptions extends GenericModel { + + /** + * The policy state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String policyId; + protected String ifMatch; + protected String state; + + /** + * Builder. + */ + public static class Builder { + private String policyId; + private String ifMatch; + private String state; + + /** + * Instantiates a new Builder from an existing UpdatePolicyStateOptions instance. + * + * @param updatePolicyStateOptions the instance to initialize the Builder with + */ + private Builder(UpdatePolicyStateOptions updatePolicyStateOptions) { + this.policyId = updatePolicyStateOptions.policyId; + this.ifMatch = updatePolicyStateOptions.ifMatch; + this.state = updatePolicyStateOptions.state; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyId the policyId + * @param ifMatch the ifMatch + */ + public Builder(String policyId, String ifMatch) { + this.policyId = policyId; + this.ifMatch = ifMatch; + } + + /** + * Builds a UpdatePolicyStateOptions. + * + * @return the new UpdatePolicyStateOptions instance + */ + public UpdatePolicyStateOptions build() { + return new UpdatePolicyStateOptions(this); + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the UpdatePolicyStateOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdatePolicyStateOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the UpdatePolicyStateOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + } + + protected UpdatePolicyStateOptions() { } + + protected UpdatePolicyStateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + policyId = builder.policyId; + ifMatch = builder.ifMatch; + state = builder.state; + } + + /** + * New builder. + * + * @return a UpdatePolicyStateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyId. + * + * The policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be + * retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the state. + * + * The policy state. + * + * @return the state + */ + public String state() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java new file mode 100644 index 00000000000..f10cba5fe93 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java @@ -0,0 +1,166 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updateRoleAssignment options. + */ +public class UpdateRoleAssignmentOptions extends GenericModel { + + protected String assignmentId; + protected String ifMatch; + protected String templateVersion; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + private String ifMatch; + private String templateVersion; + + /** + * Instantiates a new Builder from an existing UpdateRoleAssignmentOptions instance. + * + * @param updateRoleAssignmentOptions the instance to initialize the Builder with + */ + private Builder(UpdateRoleAssignmentOptions updateRoleAssignmentOptions) { + this.assignmentId = updateRoleAssignmentOptions.assignmentId; + this.ifMatch = updateRoleAssignmentOptions.ifMatch; + this.templateVersion = updateRoleAssignmentOptions.templateVersion; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + * @param ifMatch the ifMatch + * @param templateVersion the templateVersion + */ + public Builder(String assignmentId, String ifMatch, String templateVersion) { + this.assignmentId = assignmentId; + this.ifMatch = ifMatch; + this.templateVersion = templateVersion; + } + + /** + * Builds a UpdateRoleAssignmentOptions. + * + * @return the new UpdateRoleAssignmentOptions instance + */ + public UpdateRoleAssignmentOptions build() { + return new UpdateRoleAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the UpdateRoleAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdateRoleAssignmentOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the UpdateRoleAssignmentOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + } + + protected UpdateRoleAssignmentOptions() { } + + protected UpdateRoleAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId 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.templateVersion, + "templateVersion cannot be null"); + assignmentId = builder.assignmentId; + ifMatch = builder.ifMatch; + templateVersion = builder.templateVersion; + } + + /** + * New builder. + * + * @return a UpdateRoleAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Role template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a role assignment and must match the Etag value of the existing role assignment. + * The Etag can be retrieved using the GET /v1/role_assignments/{assignment_id} API and looking at the Etag response + * header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the templateVersion. + * + * The version number of the template used to identify different versions of same template. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java new file mode 100644 index 00000000000..3d9dbb43fb3 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java @@ -0,0 +1,199 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updateSettings options. + */ +public class UpdateSettingsOptions extends GenericModel { + + protected String accountId; + protected String ifMatch; + protected ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String ifMatch; + private ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing UpdateSettingsOptions instance. + * + * @param updateSettingsOptions the instance to initialize the Builder with + */ + private Builder(UpdateSettingsOptions updateSettingsOptions) { + this.accountId = updateSettingsOptions.accountId; + this.ifMatch = updateSettingsOptions.ifMatch; + this.externalAccountIdentityInteraction = updateSettingsOptions.externalAccountIdentityInteraction; + this.acceptLanguage = updateSettingsOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + * @param ifMatch the ifMatch + */ + public Builder(String accountId, String ifMatch) { + this.accountId = accountId; + this.ifMatch = ifMatch; + } + + /** + * Builds a UpdateSettingsOptions. + * + * @return the new UpdateSettingsOptions instance + */ + public UpdateSettingsOptions build() { + return new UpdateSettingsOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the UpdateSettingsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdateSettingsOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the externalAccountIdentityInteraction. + * + * @param externalAccountIdentityInteraction the externalAccountIdentityInteraction + * @return the UpdateSettingsOptions builder + */ + public Builder externalAccountIdentityInteraction(ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction) { + this.externalAccountIdentityInteraction = externalAccountIdentityInteraction; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the UpdateSettingsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected UpdateSettingsOptions() { } + + protected UpdateSettingsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.accountId, + "accountId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + accountId = builder.accountId; + ifMatch = builder.ifMatch; + externalAccountIdentityInteraction = builder.externalAccountIdentityInteraction; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a UpdateSettingsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the settings belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating Access Management Account Settings and must match the Etag value of the existing + * Access Management Account Settings. The Etag can be retrieved using the GET + * /v1/accounts/{account_id}/settings/access_management API and looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the externalAccountIdentityInteraction. + * + * Update to how external accounts can interact in relation to the requested account. + * + * @return the externalAccountIdentityInteraction + */ + public ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction() { + return externalAccountIdentityInteraction; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java new file mode 100644 index 00000000000..fdae9e28c12 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * V2PoliciesPager can be used to simplify the use of the "listV2Policies" method. + */ +public class V2PoliciesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListV2PoliciesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected V2PoliciesPager() { } + + /** + * Constructs a new V2PoliciesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listV2Policies" method + * @param options the ListV2PoliciesOptions instance to be used to invoke the "listV2Policies" method + */ + public V2PoliciesPager(IamPolicyManagement client, ListV2PoliciesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<V2PolicyTemplateMetaData> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListV2PoliciesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + V2PolicyCollection result = client.listV2Policies(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getPolicies(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<V2PolicyTemplateMetaData> containing all results returned by the "listV2Policies" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java new file mode 100644 index 00000000000..842a354b7b1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java @@ -0,0 +1,247 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the policy. + */ +public class V2Policy extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + /** + * The policy state, either 'deleted' or 'active'. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String type; + protected String description; + protected V2PolicySubject subject; + protected V2PolicyResource resource; + protected String pattern; + protected V2PolicyRule rule; + protected String id; + protected String href; + protected ControlResponse control; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String state; + @SerializedName("last_permit_at") + protected String lastPermitAt; + @SerializedName("last_permit_frequency") + protected Long lastPermitFrequency; + + protected V2Policy() { } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject getSubject() { + return subject; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource getResource() { + return resource; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String getPattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule getRule() { + return rule; + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the policies API by policy ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the control. + * + * @return the control + */ + public ControlResponse getControl() { + return control; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the state. + * + * The policy state, either 'deleted' or 'active'. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the lastPermitAt. + * + * The optional last permit time of policy, when passing query parameter format=include_last_permit. + * + * @return the lastPermitAt + */ + public String getLastPermitAt() { + return lastPermitAt; + } + + /** + * Gets the lastPermitFrequency. + * + * The optional count of times that policy has provided a permit, when passing query parameter + * format=include_last_permit. + * + * @return the lastPermitFrequency + */ + public Long getLastPermitFrequency() { + return lastPermitFrequency; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java new file mode 100644 index 00000000000..d392025f8d8 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of policies. + */ +public class V2PolicyCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List policies; + + protected V2PolicyCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the policies. + * + * List of policies. + * + * @return the policies + */ + public List getPolicies() { + return policies; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java new file mode 100644 index 00000000000..caf8dd522a9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java @@ -0,0 +1,167 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The resource attributes to which the policy grants access. + */ +public class V2PolicyResource extends GenericModel { + + protected List attributes; + protected List tags; + + /** + * Builder. + */ + public static class Builder { + private List attributes; + private List tags; + + /** + * Instantiates a new Builder from an existing V2PolicyResource instance. + * + * @param v2PolicyResource the instance to initialize the Builder with + */ + private Builder(V2PolicyResource v2PolicyResource) { + this.attributes = v2PolicyResource.attributes; + this.tags = v2PolicyResource.tags; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param attributes the attributes + */ + public Builder(List attributes) { + this.attributes = attributes; + } + + /** + * Builds a V2PolicyResource. + * + * @return the new V2PolicyResource instance + */ + public V2PolicyResource build() { + return new V2PolicyResource(this); + } + + /** + * Adds a new element to attributes. + * + * @param attributes the new element to be added + * @return the V2PolicyResource builder + */ + public Builder addAttributes(V2PolicyResourceAttribute attributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, + "attributes cannot be null"); + if (this.attributes == null) { + this.attributes = new ArrayList(); + } + this.attributes.add(attributes); + return this; + } + + /** + * Adds a new element to tags. + * + * @param tags the new element to be added + * @return the V2PolicyResource builder + */ + public Builder addTags(V2PolicyResourceTag tags) { + com.ibm.cloud.sdk.core.util.Validator.notNull(tags, + "tags cannot be null"); + if (this.tags == null) { + this.tags = new ArrayList(); + } + this.tags.add(tags); + return this; + } + + /** + * Set the attributes. + * Existing attributes will be replaced. + * + * @param attributes the attributes + * @return the V2PolicyResource builder + */ + public Builder attributes(List attributes) { + this.attributes = attributes; + return this; + } + + /** + * Set the tags. + * Existing tags will be replaced. + * + * @param tags the tags + * @return the V2PolicyResource builder + */ + public Builder tags(List tags) { + this.tags = tags; + return this; + } + } + + protected V2PolicyResource() { } + + protected V2PolicyResource(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, + "attributes cannot be null"); + attributes = builder.attributes; + tags = builder.tags; + } + + /** + * New builder. + * + * @return a V2PolicyResource builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the attributes. + * + * List of resource attributes to which the policy grants access. + * + * @return the attributes + */ + public List attributes() { + return attributes; + } + + /** + * Gets the tags. + * + * Optional list of resource tags to which the policy grants access. + * + * @return the tags + */ + public List tags() { + return tags; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java new file mode 100644 index 00000000000..73e7cedd55e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java @@ -0,0 +1,181 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Resource attribute to which the policy grants access. + */ +public class V2PolicyResourceAttribute extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + } + + protected String key; + protected String operator; + protected Object value; + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing V2PolicyResourceAttribute instance. + * + * @param v2PolicyResourceAttribute the instance to initialize the Builder with + */ + private Builder(V2PolicyResourceAttribute v2PolicyResourceAttribute) { + this.key = v2PolicyResourceAttribute.key; + this.operator = v2PolicyResourceAttribute.operator; + this.value = v2PolicyResourceAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a V2PolicyResourceAttribute. + * + * @return the new V2PolicyResourceAttribute instance + */ + public V2PolicyResourceAttribute build() { + return new V2PolicyResourceAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the V2PolicyResourceAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicyResourceAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the V2PolicyResourceAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected V2PolicyResourceAttribute() { } + + protected V2PolicyResourceAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a V2PolicyResourceAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the key. + * + * The name of a resource attribute. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java new file mode 100644 index 00000000000..bb32772b8dc --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java @@ -0,0 +1,174 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A tag associated with a resource. + */ +public class V2PolicyResourceTag extends GenericModel { + + /** + * The operator of an access management tag. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + } + + protected String key; + protected String value; + protected String operator; + + /** + * Builder. + */ + public static class Builder { + private String key; + private String value; + private String operator; + + /** + * Instantiates a new Builder from an existing V2PolicyResourceTag instance. + * + * @param v2PolicyResourceTag the instance to initialize the Builder with + */ + private Builder(V2PolicyResourceTag v2PolicyResourceTag) { + this.key = v2PolicyResourceTag.key; + this.value = v2PolicyResourceTag.value; + this.operator = v2PolicyResourceTag.operator; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param value the value + * @param operator the operator + */ + public Builder(String key, String value, String operator) { + this.key = key; + this.value = value; + this.operator = operator; + } + + /** + * Builds a V2PolicyResourceTag. + * + * @return the new V2PolicyResourceTag instance + */ + public V2PolicyResourceTag build() { + return new V2PolicyResourceTag(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the V2PolicyResourceTag builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the V2PolicyResourceTag builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicyResourceTag builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + } + + protected V2PolicyResourceTag() { } + + protected V2PolicyResourceTag(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + key = builder.key; + value = builder.value; + operator = builder.operator; + } + + /** + * New builder. + * + * @return a V2PolicyResourceTag builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the key. + * + * The name of an access management tag. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the value. + * + * The value of an access management tag. + * + * @return the value + */ + public String value() { + return value; + } + + /** + * Gets the operator. + * + * The operator of an access management tag. + * + * @return the operator + */ + public String operator() { + return operator; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java new file mode 100644 index 00000000000..13a9f5fbd94 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java @@ -0,0 +1,126 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Additional access conditions associated with the policy. + * + * Classes which extend this class: + * - V2PolicyRuleRuleAttribute + * - V2PolicyRuleRuleWithNestedConditions + */ +public class V2PolicyRule extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + protected String key; + protected String operator; + protected Object value; + protected List conditions; + + protected V2PolicyRule() { } + + /** + * Gets the key. + * + * The name of an attribute. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } + + /** + * Gets the conditions. + * + * List of conditions associated with a policy. For example, time-based conditions that grant access over a certain + * time period. + * + * @return the conditions + */ + public List conditions() { + return conditions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java new file mode 100644 index 00000000000..c20b3a8cb0c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java @@ -0,0 +1,170 @@ +/* + * (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_policy_management.v1.model; + +/** + * Rule that specifies additional access that is granted (For example, time-based condition). + */ +public class V2PolicyRuleRuleAttribute extends V2PolicyRule { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing V2PolicyRuleRuleAttribute instance. + * + * @param v2PolicyRuleRuleAttribute the instance to initialize the Builder with + */ + public Builder(V2PolicyRule v2PolicyRuleRuleAttribute) { + this.key = v2PolicyRuleRuleAttribute.key; + this.operator = v2PolicyRuleRuleAttribute.operator; + this.value = v2PolicyRuleRuleAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a V2PolicyRuleRuleAttribute. + * + * @return the new V2PolicyRuleRuleAttribute instance + */ + public V2PolicyRuleRuleAttribute build() { + return new V2PolicyRuleRuleAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the V2PolicyRuleRuleAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicyRuleRuleAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the V2PolicyRuleRuleAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected V2PolicyRuleRuleAttribute() { } + + protected V2PolicyRuleRuleAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a V2PolicyRuleRuleAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java new file mode 100644 index 00000000000..8d6e57920f9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java @@ -0,0 +1,139 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * Rule that specifies additional access that is granted (for example, time-based condition) accross multiple + * conditions. + */ +public class V2PolicyRuleRuleWithNestedConditions extends V2PolicyRule { + + /** + * Operator to evaluate conditions. + */ + public interface Operator { + /** and. */ + String AND = "and"; + /** or. */ + String OR = "or"; + } + + + /** + * Builder. + */ + public static class Builder { + private String operator; + private List conditions; + + /** + * Instantiates a new Builder from an existing V2PolicyRuleRuleWithNestedConditions instance. + * + * @param v2PolicyRuleRuleWithNestedConditions the instance to initialize the Builder with + */ + public Builder(V2PolicyRule v2PolicyRuleRuleWithNestedConditions) { + this.operator = v2PolicyRuleRuleWithNestedConditions.operator; + this.conditions = v2PolicyRuleRuleWithNestedConditions.conditions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param operator the operator + * @param conditions the conditions + */ + public Builder(String operator, List conditions) { + this.operator = operator; + this.conditions = conditions; + } + + /** + * Builds a V2PolicyRuleRuleWithNestedConditions. + * + * @return the new V2PolicyRuleRuleWithNestedConditions instance + */ + public V2PolicyRuleRuleWithNestedConditions build() { + return new V2PolicyRuleRuleWithNestedConditions(this); + } + + /** + * Adds a new element to conditions. + * + * @param conditions the new element to be added + * @return the V2PolicyRuleRuleWithNestedConditions builder + */ + public Builder addConditions(NestedCondition conditions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(conditions, + "conditions cannot be null"); + if (this.conditions == null) { + this.conditions = new ArrayList(); + } + this.conditions.add(conditions); + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicyRuleRuleWithNestedConditions builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the conditions. + * Existing conditions will be replaced. + * + * @param conditions the conditions + * @return the V2PolicyRuleRuleWithNestedConditions builder + */ + public Builder conditions(List conditions) { + this.conditions = conditions; + return this; + } + } + + protected V2PolicyRuleRuleWithNestedConditions() { } + + protected V2PolicyRuleRuleWithNestedConditions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.conditions, + "conditions cannot be null"); + operator = builder.operator; + conditions = builder.conditions; + } + + /** + * New builder. + * + * @return a V2PolicyRuleRuleWithNestedConditions builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java new file mode 100644 index 00000000000..891513fd45a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java @@ -0,0 +1,124 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The subject attributes for whom the policy grants access. + */ +public class V2PolicySubject extends GenericModel { + + protected List attributes; + + /** + * Builder. + */ + public static class Builder { + private List attributes; + + /** + * Instantiates a new Builder from an existing V2PolicySubject instance. + * + * @param v2PolicySubject the instance to initialize the Builder with + */ + private Builder(V2PolicySubject v2PolicySubject) { + this.attributes = v2PolicySubject.attributes; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param attributes the attributes + */ + public Builder(List attributes) { + this.attributes = attributes; + } + + /** + * Builds a V2PolicySubject. + * + * @return the new V2PolicySubject instance + */ + public V2PolicySubject build() { + return new V2PolicySubject(this); + } + + /** + * Adds a new element to attributes. + * + * @param attributes the new element to be added + * @return the V2PolicySubject builder + */ + public Builder addAttributes(V2PolicySubjectAttribute attributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, + "attributes cannot be null"); + if (this.attributes == null) { + this.attributes = new ArrayList(); + } + this.attributes.add(attributes); + return this; + } + + /** + * Set the attributes. + * Existing attributes will be replaced. + * + * @param attributes the attributes + * @return the V2PolicySubject builder + */ + public Builder attributes(List attributes) { + this.attributes = attributes; + return this; + } + } + + protected V2PolicySubject() { } + + protected V2PolicySubject(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, + "attributes cannot be null"); + attributes = builder.attributes; + } + + /** + * New builder. + * + * @return a V2PolicySubject builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the attributes. + * + * List of subject attributes associated with policy. + * + * @return the attributes + */ + public List attributes() { + return attributes; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java new file mode 100644 index 00000000000..c90606429df --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java @@ -0,0 +1,175 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Subject attribute for whom the policy grants access. + */ +public class V2PolicySubjectAttribute extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + } + + protected String key; + protected String operator; + protected Object value; + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing V2PolicySubjectAttribute instance. + * + * @param v2PolicySubjectAttribute the instance to initialize the Builder with + */ + private Builder(V2PolicySubjectAttribute v2PolicySubjectAttribute) { + this.key = v2PolicySubjectAttribute.key; + this.operator = v2PolicySubjectAttribute.operator; + this.value = v2PolicySubjectAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a V2PolicySubjectAttribute. + * + * @return the new V2PolicySubjectAttribute instance + */ + public V2PolicySubjectAttribute build() { + return new V2PolicySubjectAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the V2PolicySubjectAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicySubjectAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the V2PolicySubjectAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected V2PolicySubjectAttribute() { } + + protected V2PolicySubjectAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a V2PolicySubjectAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the key. + * + * The name of a subject attribute. For example, iam_id, access_group_id. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java new file mode 100644 index 00000000000..720f7b57d4e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java @@ -0,0 +1,260 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the policy. + */ +public class V2PolicyTemplateMetaData extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + /** + * The policy state, either 'deleted' or 'active'. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String type; + protected String description; + protected V2PolicySubject subject; + protected V2PolicyResource resource; + protected String pattern; + protected V2PolicyRule rule; + protected String id; + protected String href; + protected ControlResponse control; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String state; + @SerializedName("last_permit_at") + protected String lastPermitAt; + @SerializedName("last_permit_frequency") + protected Long lastPermitFrequency; + protected TemplateMetadata template; + + protected V2PolicyTemplateMetaData() { } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject getSubject() { + return subject; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource getResource() { + return resource; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String getPattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule getRule() { + return rule; + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the policies API by policy ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the control. + * + * @return the control + */ + public ControlResponse getControl() { + return control; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the state. + * + * The policy state, either 'deleted' or 'active'. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the lastPermitAt. + * + * The optional last permit time of policy, when passing query parameter format=include_last_permit. + * + * @return the lastPermitAt + */ + public String getLastPermitAt() { + return lastPermitAt; + } + + /** + * Gets the lastPermitFrequency. + * + * The optional count of times that policy has provided a permit, when passing query parameter + * format=include_last_permit. + * + * @return the lastPermitFrequency + */ + public Long getLastPermitFrequency() { + return lastPermitFrequency; + } + + /** + * Gets the template. + * + * The details of the IAM template that was used to create an enterprise-managed policy in your account. When + * returned, this indicates that the policy is created from and managed by a template in the root enterprise account. + * + * @return the template + */ + public TemplateMetadata getTemplate() { + return template; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java new file mode 100644 index 00000000000..63a87389391 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java @@ -0,0 +1,17 @@ +/* + * (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. + */ + +/** + * IAM Policy Management v1. + */ +package com.ibm.cloud.platform_services.iam_policy_management.v1; diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java new file mode 100644 index 00000000000..b38933306a6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java @@ -0,0 +1,5007 @@ +/* + * (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_policy_management.v1; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplatesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponse; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControlWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedCondition; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleWithConditions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PoliciesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplatesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoleReferences; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PoliciesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRule; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleWithNestedConditions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.http.Response; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import okhttp3.mockwebserver.RecordedRequest; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the IamPolicyManagement service. + */ +public class IamPolicyManagementTest { + + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + protected MockWebServer server; + protected IamPolicyManagement iamPolicyManagementService; + + // Construct the service with a null authenticator (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testConstructorWithNullAuthenticator() throws Throwable { + final String serviceName = "testService"; + new IamPolicyManagement(serviceName, null); + } + + // Test the listPolicies operation with a valid options model parameter + @Test + public void testListPoliciesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policies\": [{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}]}"; + String listPoliciesPath = "/v1/policies"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListPoliciesOptions model + ListPoliciesOptions listPoliciesOptionsModel = new ListPoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .tagName("testString") + .tagValue("testString") + .sort("id") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listPolicies() with a valid options model and verify the result + Response response = iamPolicyManagementService.listPolicies(listPoliciesOptionsModel).execute(); + assertNotNull(response); + PolicyCollection 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, listPoliciesPath); + // 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("access_group_id"), "testString"); + assertEquals(query.get("type"), "access"); + assertEquals(query.get("service_type"), "service"); + assertEquals(query.get("tag_name"), "testString"); + assertEquals(query.get("tag_value"), "testString"); + assertEquals(query.get("sort"), "id"); + assertEquals(query.get("format"), "include_last_permit"); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listPolicies operation with and without retries enabled + @Test + public void testListPoliciesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListPoliciesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListPoliciesWOptions(); + } + + // Test the listPolicies operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPoliciesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listPolicies(null).execute(); + } + + // Test the listPolicies operation using the PoliciesPager.getNext() method + @Test + public void testListPoliciesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPoliciesOptions listPoliciesOptions = new ListPoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .tagName("testString") + .tagValue("testString") + .sort("id") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + PoliciesPager pager = new PoliciesPager(iamPolicyManagementService, listPoliciesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listPolicies operation using the PoliciesPager.getAll() method + @Test + public void testListPoliciesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPoliciesOptions listPoliciesOptions = new ListPoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .tagName("testString") + .tagValue("testString") + .sort("id") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + PoliciesPager pager = new PoliciesPager(iamPolicyManagementService, listPoliciesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createPolicy operation with a valid options model parameter + @Test + public void testCreatePolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; + String createPolicyPath = "/v1/policies"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the SubjectAttribute model + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + + // Construct an instance of the PolicySubject model + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + + // Construct an instance of the PolicyRole model + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the ResourceAttribute model + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + + // Construct an instance of the ResourceTag model + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + + // Construct an instance of the PolicyResource model + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + + // Construct an instance of the CreatePolicyOptions model + CreatePolicyOptions createPolicyOptionsModel = new CreatePolicyOptions.Builder() + .type("testString") + .subjects(java.util.Arrays.asList(policySubjectModel)) + .roles(java.util.Arrays.asList(policyRoleModel)) + .resources(java.util.Arrays.asList(policyResourceModel)) + .description("testString") + .acceptLanguage("default") + .build(); + + // Invoke createPolicy() with a valid options model and verify the result + Response response = iamPolicyManagementService.createPolicy(createPolicyOptionsModel).execute(); + assertNotNull(response); + Policy 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createPolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createPolicy operation with and without retries enabled + @Test + public void testCreatePolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreatePolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreatePolicyWOptions(); + } + + // Test the createPolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createPolicy(null).execute(); + } + + // Test the replacePolicy operation with a valid options model parameter + @Test + public void testReplacePolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; + String replacePolicyPath = "/v1/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the SubjectAttribute model + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + + // Construct an instance of the PolicySubject model + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + + // Construct an instance of the PolicyRole model + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the ResourceAttribute model + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + + // Construct an instance of the ResourceTag model + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + + // Construct an instance of the PolicyResource model + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + + // Construct an instance of the ReplacePolicyOptions model + ReplacePolicyOptions replacePolicyOptionsModel = new ReplacePolicyOptions.Builder() + .policyId("testString") + .ifMatch("testString") + .type("testString") + .subjects(java.util.Arrays.asList(policySubjectModel)) + .roles(java.util.Arrays.asList(policyRoleModel)) + .resources(java.util.Arrays.asList(policyResourceModel)) + .description("testString") + .build(); + + // Invoke replacePolicy() with a valid options model and verify the result + Response response = iamPolicyManagementService.replacePolicy(replacePolicyOptionsModel).execute(); + assertNotNull(response); + Policy 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, replacePolicyPath); + // 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 replacePolicy operation with and without retries enabled + @Test + public void testReplacePolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplacePolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplacePolicyWOptions(); + } + + // Test the replacePolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplacePolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replacePolicy(null).execute(); + } + + // Test the getPolicy operation with a valid options model parameter + @Test + public void testGetPolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}"; + String getPolicyPath = "/v1/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetPolicyOptions model + GetPolicyOptions getPolicyOptionsModel = new GetPolicyOptions.Builder() + .policyId("testString") + .build(); + + // Invoke getPolicy() with a valid options model and verify the result + Response response = iamPolicyManagementService.getPolicy(getPolicyOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateMetaData 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, getPolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getPolicy operation with and without retries enabled + @Test + public void testGetPolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetPolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetPolicyWOptions(); + } + + // Test the getPolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getPolicy(null).execute(); + } + + // Test the deletePolicy operation with a valid options model parameter + @Test + public void testDeletePolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deletePolicyPath = "/v1/policies/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeletePolicyOptions model + DeletePolicyOptions deletePolicyOptionsModel = new DeletePolicyOptions.Builder() + .policyId("testString") + .build(); + + // Invoke deletePolicy() with a valid options model and verify the result + Response response = iamPolicyManagementService.deletePolicy(deletePolicyOptionsModel).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, deletePolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deletePolicy operation with and without retries enabled + @Test + public void testDeletePolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeletePolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeletePolicyWOptions(); + } + + // Test the deletePolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deletePolicy(null).execute(); + } + + // Test the updatePolicyState operation with a valid options model parameter + @Test + public void testUpdatePolicyStateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; + String updatePolicyStatePath = "/v1/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdatePolicyStateOptions model + UpdatePolicyStateOptions updatePolicyStateOptionsModel = new UpdatePolicyStateOptions.Builder() + .policyId("testString") + .ifMatch("testString") + .state("active") + .build(); + + // Invoke updatePolicyState() with a valid options model and verify the result + Response response = iamPolicyManagementService.updatePolicyState(updatePolicyStateOptionsModel).execute(); + assertNotNull(response); + Policy 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updatePolicyStatePath); + // 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 updatePolicyState operation with and without retries enabled + @Test + public void testUpdatePolicyStateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdatePolicyStateWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdatePolicyStateWOptions(); + } + + // Test the updatePolicyState operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdatePolicyStateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updatePolicyState(null).execute(); + } + + // Test the listRoles operation with a valid options model parameter + @Test + public void testListRolesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"custom_roles\": [{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}], \"service_roles\": [{\"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\"}], \"system_roles\": [{\"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\"}]}"; + String listRolesPath = "/v2/roles"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListRolesOptions model + ListRolesOptions listRolesOptionsModel = new ListRolesOptions.Builder() + .acceptLanguage("default") + .accountId("testString") + .serviceName("iam-groups") + .sourceServiceName("iam-groups") + .policyType("authorization") + .serviceGroupId("IAM") + .build(); + + // Invoke listRoles() with a valid options model and verify the result + Response response = iamPolicyManagementService.listRoles(listRolesOptionsModel).execute(); + assertNotNull(response); + RoleCollection 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, listRolesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("service_name"), "iam-groups"); + assertEquals(query.get("source_service_name"), "iam-groups"); + assertEquals(query.get("policy_type"), "authorization"); + assertEquals(query.get("service_group_id"), "IAM"); + } + + // Test the listRoles operation with and without retries enabled + @Test + public void testListRolesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListRolesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListRolesWOptions(); + } + + // Test the createRole operation with a valid options model parameter + @Test + public void testCreateRoleWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; + String createRolePath = "/v2/roles"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the CreateRoleOptions model + CreateRoleOptions createRoleOptionsModel = new CreateRoleOptions.Builder() + .displayName("testString") + .actions(java.util.Arrays.asList("testString")) + .name("Developer") + .accountId("testString") + .serviceName("iam-groups") + .description("testString") + .acceptLanguage("default") + .build(); + + // Invoke createRole() with a valid options model and verify the result + Response response = iamPolicyManagementService.createRole(createRoleOptionsModel).execute(); + assertNotNull(response); + CustomRole 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createRolePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createRole operation with and without retries enabled + @Test + public void testCreateRoleWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateRoleWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateRoleWOptions(); + } + + // Test the createRole operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createRole(null).execute(); + } + + // Test the replaceRole operation with a valid options model parameter + @Test + public void testReplaceRoleWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; + String replaceRolePath = "/v2/roles/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ReplaceRoleOptions model + ReplaceRoleOptions replaceRoleOptionsModel = new ReplaceRoleOptions.Builder() + .roleId("testString") + .ifMatch("testString") + .displayName("testString") + .actions(java.util.Arrays.asList("testString")) + .description("testString") + .build(); + + // Invoke replaceRole() with a valid options model and verify the result + Response response = iamPolicyManagementService.replaceRole(replaceRoleOptionsModel).execute(); + assertNotNull(response); + CustomRole 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, replaceRolePath); + // 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 replaceRole operation with and without retries enabled + @Test + public void testReplaceRoleWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplaceRoleWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplaceRoleWOptions(); + } + + // Test the replaceRole operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceRoleNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replaceRole(null).execute(); + } + + // Test the getRole operation with a valid options model parameter + @Test + public void testGetRoleWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; + String getRolePath = "/v2/roles/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetRoleOptions model + GetRoleOptions getRoleOptionsModel = new GetRoleOptions.Builder() + .roleId("testString") + .build(); + + // Invoke getRole() with a valid options model and verify the result + Response response = iamPolicyManagementService.getRole(getRoleOptionsModel).execute(); + assertNotNull(response); + CustomRole 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, getRolePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getRole operation with and without retries enabled + @Test + public void testGetRoleWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetRoleWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetRoleWOptions(); + } + + // Test the getRole operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getRole(null).execute(); + } + + // Test the deleteRole operation with a valid options model parameter + @Test + public void testDeleteRoleWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteRolePath = "/v2/roles/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteRoleOptions model + DeleteRoleOptions deleteRoleOptionsModel = new DeleteRoleOptions.Builder() + .roleId("testString") + .build(); + + // Invoke deleteRole() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteRole(deleteRoleOptionsModel).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, deleteRolePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteRole operation with and without retries enabled + @Test + public void testDeleteRoleWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteRoleWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteRoleWOptions(); + } + + // Test the deleteRole operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteRole(null).execute(); + } + + // Test the listV2Policies operation with a valid options model parameter + @Test + public void testListV2PoliciesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policies\": [{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19, \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}]}"; + String listV2PoliciesPath = "/v2/policies"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListV2PoliciesOptions model + ListV2PoliciesOptions listV2PoliciesOptionsModel = new ListV2PoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .serviceName("testString") + .serviceGroupId("testString") + .sort("testString") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listV2Policies() with a valid options model and verify the result + Response response = iamPolicyManagementService.listV2Policies(listV2PoliciesOptionsModel).execute(); + assertNotNull(response); + V2PolicyCollection 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, listV2PoliciesPath); + // 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("access_group_id"), "testString"); + assertEquals(query.get("type"), "access"); + assertEquals(query.get("service_type"), "service"); + assertEquals(query.get("service_name"), "testString"); + assertEquals(query.get("service_group_id"), "testString"); + assertEquals(query.get("sort"), "testString"); + assertEquals(query.get("format"), "include_last_permit"); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listV2Policies operation with and without retries enabled + @Test + public void testListV2PoliciesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListV2PoliciesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListV2PoliciesWOptions(); + } + + // Test the listV2Policies operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListV2PoliciesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listV2Policies(null).execute(); + } + + // Test the listV2Policies operation using the V2PoliciesPager.getNext() method + @Test + public void testListV2PoliciesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListV2PoliciesOptions listV2PoliciesOptions = new ListV2PoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .serviceName("testString") + .serviceGroupId("testString") + .sort("testString") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + V2PoliciesPager pager = new V2PoliciesPager(iamPolicyManagementService, listV2PoliciesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listV2Policies operation using the V2PoliciesPager.getAll() method + @Test + public void testListV2PoliciesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListV2PoliciesOptions listV2PoliciesOptions = new ListV2PoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .serviceName("testString") + .serviceGroupId("testString") + .sort("testString") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + V2PoliciesPager pager = new V2PoliciesPager(iamPolicyManagementService, listV2PoliciesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createV2Policy operation with a valid options model parameter + @Test + public void testCreateV2PolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19}"; + String createV2PolicyPath = "/v2/policies"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the Grant model + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the Control model + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the CreateV2PolicyOptions model + CreateV2PolicyOptions createV2PolicyOptionsModel = new CreateV2PolicyOptions.Builder() + .control(controlModel) + .type("access") + .description("testString") + .subject(v2PolicySubjectModel) + .resource(v2PolicyResourceModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .acceptLanguage("default") + .build(); + + // Invoke createV2Policy() with a valid options model and verify the result + Response response = iamPolicyManagementService.createV2Policy(createV2PolicyOptionsModel).execute(); + assertNotNull(response); + V2Policy 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createV2PolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createV2Policy operation with and without retries enabled + @Test + public void testCreateV2PolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateV2PolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateV2PolicyWOptions(); + } + + // Test the createV2Policy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateV2PolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createV2Policy(null).execute(); + } + + // Test the replaceV2Policy operation with a valid options model parameter + @Test + public void testReplaceV2PolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19}"; + String replaceV2PolicyPath = "/v2/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the Grant model + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the Control model + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the ReplaceV2PolicyOptions model + ReplaceV2PolicyOptions replaceV2PolicyOptionsModel = new ReplaceV2PolicyOptions.Builder() + .id("testString") + .ifMatch("testString") + .control(controlModel) + .type("access") + .description("testString") + .subject(v2PolicySubjectModel) + .resource(v2PolicyResourceModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .build(); + + // Invoke replaceV2Policy() with a valid options model and verify the result + Response response = iamPolicyManagementService.replaceV2Policy(replaceV2PolicyOptionsModel).execute(); + assertNotNull(response); + V2Policy 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, replaceV2PolicyPath); + // 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 replaceV2Policy operation with and without retries enabled + @Test + public void testReplaceV2PolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplaceV2PolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplaceV2PolicyWOptions(); + } + + // Test the replaceV2Policy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceV2PolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replaceV2Policy(null).execute(); + } + + // Test the getV2Policy operation with a valid options model parameter + @Test + public void testGetV2PolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19, \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}"; + String getV2PolicyPath = "/v2/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetV2PolicyOptions model + GetV2PolicyOptions getV2PolicyOptionsModel = new GetV2PolicyOptions.Builder() + .id("testString") + .format("include_last_permit") + .build(); + + // Invoke getV2Policy() with a valid options model and verify the result + Response response = iamPolicyManagementService.getV2Policy(getV2PolicyOptionsModel).execute(); + assertNotNull(response); + V2PolicyTemplateMetaData 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, getV2PolicyPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("format"), "include_last_permit"); + } + + // Test the getV2Policy operation with and without retries enabled + @Test + public void testGetV2PolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetV2PolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetV2PolicyWOptions(); + } + + // Test the getV2Policy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetV2PolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getV2Policy(null).execute(); + } + + // Test the deleteV2Policy operation with a valid options model parameter + @Test + public void testDeleteV2PolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteV2PolicyPath = "/v2/policies/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteV2PolicyOptions model + DeleteV2PolicyOptions deleteV2PolicyOptionsModel = new DeleteV2PolicyOptions.Builder() + .id("testString") + .build(); + + // Invoke deleteV2Policy() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteV2Policy(deleteV2PolicyOptionsModel).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, deleteV2PolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteV2Policy operation with and without retries enabled + @Test + public void testDeleteV2PolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteV2PolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteV2PolicyWOptions(); + } + + // Test the deleteV2Policy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteV2PolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteV2Policy(null).execute(); + } + + // Test the listPolicyTemplates operation with a valid options model parameter + @Test + public void testListPolicyTemplatesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policy_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; + String listPolicyTemplatesPath = "/v1/policy_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListPolicyTemplatesOptions model + ListPolicyTemplatesOptions listPolicyTemplatesOptionsModel = new ListPolicyTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .state("active") + .name("testString") + .policyServiceType("service") + .policyServiceName("testString") + .policyServiceGroupId("testString") + .policyType("access") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listPolicyTemplates() with a valid options model and verify the result + Response response = iamPolicyManagementService.listPolicyTemplates(listPolicyTemplatesOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateCollection 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, listPolicyTemplatesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("state"), "active"); + assertEquals(query.get("name"), "testString"); + assertEquals(query.get("policy_service_type"), "service"); + assertEquals(query.get("policy_service_name"), "testString"); + assertEquals(query.get("policy_service_group_id"), "testString"); + assertEquals(query.get("policy_type"), "access"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listPolicyTemplates operation with and without retries enabled + @Test + public void testListPolicyTemplatesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListPolicyTemplatesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListPolicyTemplatesWOptions(); + } + + // Test the listPolicyTemplates operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyTemplatesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listPolicyTemplates(null).execute(); + } + + // Test the listPolicyTemplates operation using the PolicyTemplatesPager.getNext() method + @Test + public void testListPolicyTemplatesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyTemplatesOptions listPolicyTemplatesOptions = new ListPolicyTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .state("active") + .name("testString") + .policyServiceType("service") + .policyServiceName("testString") + .policyServiceGroupId("testString") + .policyType("access") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + PolicyTemplatesPager pager = new PolicyTemplatesPager(iamPolicyManagementService, listPolicyTemplatesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listPolicyTemplates operation using the PolicyTemplatesPager.getAll() method + @Test + public void testListPolicyTemplatesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyTemplatesOptions listPolicyTemplatesOptions = new ListPolicyTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .state("active") + .name("testString") + .policyServiceType("service") + .policyServiceName("testString") + .policyServiceGroupId("testString") + .policyType("access") + .limit(Long.valueOf("10")) + .build(); + + PolicyTemplatesPager pager = new PolicyTemplatesPager(iamPolicyManagementService, listPolicyTemplatesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createPolicyTemplate operation with a valid options model parameter + @Test + public void testCreatePolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; + String createPolicyTemplatePath = "/v1/policy_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the TemplateGrantRoles model + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the TemplateControl model + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + + // Construct an instance of the TemplatePolicy model + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + + // Construct an instance of the CreatePolicyTemplateOptions model + CreatePolicyTemplateOptions createPolicyTemplateOptionsModel = new CreatePolicyTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .policy(templatePolicyModel) + .description("testString") + .committed(true) + .acceptLanguage("default") + .build(); + + // Invoke createPolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.createPolicyTemplate(createPolicyTemplateOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateLimitData 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createPolicyTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createPolicyTemplate operation with and without retries enabled + @Test + public void testCreatePolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreatePolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreatePolicyTemplateWOptions(); + } + + // Test the createPolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createPolicyTemplate(null).execute(); + } + + // Test the getPolicyTemplate operation with a valid options model parameter + @Test + public void testGetPolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String getPolicyTemplatePath = "/v1/policy_templates/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetPolicyTemplateOptions model + GetPolicyTemplateOptions getPolicyTemplateOptionsModel = new GetPolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .state("active") + .build(); + + // Invoke getPolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.getPolicyTemplate(getPolicyTemplateOptionsModel).execute(); + assertNotNull(response); + PolicyTemplate 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, getPolicyTemplatePath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + } + + // Test the getPolicyTemplate operation with and without retries enabled + @Test + public void testGetPolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetPolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetPolicyTemplateWOptions(); + } + + // Test the getPolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getPolicyTemplate(null).execute(); + } + + // Test the deletePolicyTemplate operation with a valid options model parameter + @Test + public void testDeletePolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deletePolicyTemplatePath = "/v1/policy_templates/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeletePolicyTemplateOptions model + DeletePolicyTemplateOptions deletePolicyTemplateOptionsModel = new DeletePolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .build(); + + // Invoke deletePolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.deletePolicyTemplate(deletePolicyTemplateOptionsModel).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, deletePolicyTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deletePolicyTemplate operation with and without retries enabled + @Test + public void testDeletePolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeletePolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeletePolicyTemplateWOptions(); + } + + // Test the deletePolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deletePolicyTemplate(null).execute(); + } + + // Test the createPolicyTemplateVersion operation with a valid options model parameter + @Test + public void testCreatePolicyTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; + String createPolicyTemplateVersionPath = "/v1/policy_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the TemplateGrantRoles model + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the TemplateControl model + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + + // Construct an instance of the TemplatePolicy model + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + + // Construct an instance of the CreatePolicyTemplateVersionOptions model + CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptionsModel = new CreatePolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .policy(templatePolicyModel) + .name("testString") + .description("testString") + .committed(true) + .build(); + + // Invoke createPolicyTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.createPolicyTemplateVersion(createPolicyTemplateVersionOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateLimitData 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createPolicyTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createPolicyTemplateVersion operation with and without retries enabled + @Test + public void testCreatePolicyTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreatePolicyTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreatePolicyTemplateVersionWOptions(); + } + + // Test the createPolicyTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createPolicyTemplateVersion(null).execute(); + } + + // Test the listPolicyTemplateVersions operation with a valid options model parameter + @Test + public void testListPolicyTemplateVersionsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; + String listPolicyTemplateVersionsPath = "/v1/policy_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListPolicyTemplateVersionsOptions model + ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptionsModel = new ListPolicyTemplateVersionsOptions.Builder() + .policyTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listPolicyTemplateVersions() with a valid options model and verify the result + Response response = iamPolicyManagementService.listPolicyTemplateVersions(listPolicyTemplateVersionsOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateVersionsCollection 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, listPolicyTemplateVersionsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listPolicyTemplateVersions operation with and without retries enabled + @Test + public void testListPolicyTemplateVersionsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListPolicyTemplateVersionsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListPolicyTemplateVersionsWOptions(); + } + + // Test the listPolicyTemplateVersions operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyTemplateVersionsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listPolicyTemplateVersions(null).execute(); + } + + // Test the listPolicyTemplateVersions operation using the PolicyTemplateVersionsPager.getNext() method + @Test + public void testListPolicyTemplateVersionsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions = new ListPolicyTemplateVersionsOptions.Builder() + .policyTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + PolicyTemplateVersionsPager pager = new PolicyTemplateVersionsPager(iamPolicyManagementService, listPolicyTemplateVersionsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listPolicyTemplateVersions operation using the PolicyTemplateVersionsPager.getAll() method + @Test + public void testListPolicyTemplateVersionsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions = new ListPolicyTemplateVersionsOptions.Builder() + .policyTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + PolicyTemplateVersionsPager pager = new PolicyTemplateVersionsPager(iamPolicyManagementService, listPolicyTemplateVersionsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the replacePolicyTemplate operation with a valid options model parameter + @Test + public void testReplacePolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String replacePolicyTemplatePath = "/v1/policy_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the TemplateGrantRoles model + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the TemplateControl model + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + + // Construct an instance of the TemplatePolicy model + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + + // Construct an instance of the ReplacePolicyTemplateOptions model + ReplacePolicyTemplateOptions replacePolicyTemplateOptionsModel = new ReplacePolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .ifMatch("testString") + .policy(templatePolicyModel) + .name("testString") + .description("testString") + .committed(true) + .build(); + + // Invoke replacePolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.replacePolicyTemplate(replacePolicyTemplateOptionsModel).execute(); + assertNotNull(response); + PolicyTemplate 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, replacePolicyTemplatePath); + // 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 replacePolicyTemplate operation with and without retries enabled + @Test + public void testReplacePolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplacePolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplacePolicyTemplateWOptions(); + } + + // Test the replacePolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplacePolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replacePolicyTemplate(null).execute(); + } + + // Test the deletePolicyTemplateVersion operation with a valid options model parameter + @Test + public void testDeletePolicyTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deletePolicyTemplateVersionPath = "/v1/policy_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeletePolicyTemplateVersionOptions model + DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptionsModel = new DeletePolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + + // Invoke deletePolicyTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.deletePolicyTemplateVersion(deletePolicyTemplateVersionOptionsModel).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, deletePolicyTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deletePolicyTemplateVersion operation with and without retries enabled + @Test + public void testDeletePolicyTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeletePolicyTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeletePolicyTemplateVersionWOptions(); + } + + // Test the deletePolicyTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deletePolicyTemplateVersion(null).execute(); + } + + // Test the getPolicyTemplateVersion operation with a valid options model parameter + @Test + public void testGetPolicyTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String getPolicyTemplateVersionPath = "/v1/policy_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetPolicyTemplateVersionOptions model + GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptionsModel = new GetPolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + + // Invoke getPolicyTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.getPolicyTemplateVersion(getPolicyTemplateVersionOptionsModel).execute(); + assertNotNull(response); + PolicyTemplate 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, getPolicyTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getPolicyTemplateVersion operation with and without retries enabled + @Test + public void testGetPolicyTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetPolicyTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetPolicyTemplateVersionWOptions(); + } + + // Test the getPolicyTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getPolicyTemplateVersion(null).execute(); + } + + // Test the commitPolicyTemplate operation with a valid options model parameter + @Test + public void testCommitPolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String commitPolicyTemplatePath = "/v1/policy_templates/testString/versions/testString/commit"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the CommitPolicyTemplateOptions model + CommitPolicyTemplateOptions commitPolicyTemplateOptionsModel = new CommitPolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + + // Invoke commitPolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.commitPolicyTemplate(commitPolicyTemplateOptionsModel).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, commitPolicyTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the commitPolicyTemplate operation with and without retries enabled + @Test + public void testCommitPolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCommitPolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCommitPolicyTemplateWOptions(); + } + + // Test the commitPolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitPolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.commitPolicyTemplate(null).execute(); + } + + // Test the listPolicyAssignments operation with a valid options model parameter + @Test + public void testListPolicyAssignmentsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}]}"; + String listPolicyAssignmentsPath = "/v1/policy_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListPolicyAssignmentsOptions model + ListPolicyAssignmentsOptions listPolicyAssignmentsOptionsModel = new ListPolicyAssignmentsOptions.Builder() + .version("1.0") + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listPolicyAssignments() with a valid options model and verify the result + Response response = iamPolicyManagementService.listPolicyAssignments(listPolicyAssignmentsOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateAssignmentCollection 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, listPolicyAssignmentsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "1.0"); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("template_id"), "testString"); + assertEquals(query.get("template_version"), "testString"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listPolicyAssignments operation with and without retries enabled + @Test + public void testListPolicyAssignmentsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListPolicyAssignmentsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListPolicyAssignmentsWOptions(); + } + + // Test the listPolicyAssignments operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyAssignmentsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listPolicyAssignments(null).execute(); + } + + // Test the listPolicyAssignments operation using the PolicyAssignmentsPager.getNext() method + @Test + public void testListPolicyAssignmentsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyAssignmentsOptions listPolicyAssignmentsOptions = new ListPolicyAssignmentsOptions.Builder() + .version("1.0") + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + PolicyAssignmentsPager pager = new PolicyAssignmentsPager(iamPolicyManagementService, listPolicyAssignmentsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listPolicyAssignments operation using the PolicyAssignmentsPager.getAll() method + @Test + public void testListPolicyAssignmentsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyAssignmentsOptions listPolicyAssignmentsOptions = new ListPolicyAssignmentsOptions.Builder() + .version("1.0") + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + PolicyAssignmentsPager pager = new PolicyAssignmentsPager(iamPolicyManagementService, listPolicyAssignmentsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createPolicyTemplateAssignment operation with a valid options model parameter + @Test + public void testCreatePolicyTemplateAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}]}"; + String createPolicyTemplateAssignmentPath = "/v1/policy_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the AssignmentTargetDetails model + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + + // Construct an instance of the AssignmentTemplateDetails model + AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() + .id("testString") + .version("testString") + .build(); + + // Construct an instance of the CreatePolicyTemplateAssignmentOptions model + CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptionsModel = new CreatePolicyTemplateAssignmentOptions.Builder() + .version("1.0") + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(assignmentTemplateDetailsModel)) + .acceptLanguage("default") + .build(); + + // Invoke createPolicyTemplateAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.createPolicyTemplateAssignment(createPolicyTemplateAssignmentOptionsModel).execute(); + assertNotNull(response); + PolicyAssignmentV1Collection 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createPolicyTemplateAssignmentPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "1.0"); + } + + // Test the createPolicyTemplateAssignment operation with and without retries enabled + @Test + public void testCreatePolicyTemplateAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreatePolicyTemplateAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreatePolicyTemplateAssignmentWOptions(); + } + + // Test the createPolicyTemplateAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createPolicyTemplateAssignment(null).execute(); + } + + // Test the getPolicyAssignment operation with a valid options model parameter + @Test + public void testGetPolicyAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}"; + String getPolicyAssignmentPath = "/v1/policy_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetPolicyAssignmentOptions model + GetPolicyAssignmentOptions getPolicyAssignmentOptionsModel = new GetPolicyAssignmentOptions.Builder() + .assignmentId("testString") + .version("1.0") + .build(); + + // Invoke getPolicyAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.getPolicyAssignment(getPolicyAssignmentOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateAssignmentItems 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, getPolicyAssignmentPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "1.0"); + } + + // Test the getPolicyAssignment operation with and without retries enabled + @Test + public void testGetPolicyAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetPolicyAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetPolicyAssignmentWOptions(); + } + + // Test the getPolicyAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getPolicyAssignment(null).execute(); + } + + // Test the updatePolicyAssignment operation with a valid options model parameter + @Test + public void testUpdatePolicyAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}"; + String updatePolicyAssignmentPath = "/v1/policy_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdatePolicyAssignmentOptions model + UpdatePolicyAssignmentOptions updatePolicyAssignmentOptionsModel = new UpdatePolicyAssignmentOptions.Builder() + .assignmentId("testString") + .version("1.0") + .ifMatch("testString") + .templateVersion("testString") + .build(); + + // Invoke updatePolicyAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.updatePolicyAssignment(updatePolicyAssignmentOptionsModel).execute(); + assertNotNull(response); + PolicyAssignmentV1 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updatePolicyAssignmentPath); + // Verify header parameters + assertEquals(request.getHeader("If-Match"), "testString"); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "1.0"); + } + + // Test the updatePolicyAssignment operation with and without retries enabled + @Test + public void testUpdatePolicyAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdatePolicyAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdatePolicyAssignmentWOptions(); + } + + // Test the updatePolicyAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdatePolicyAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updatePolicyAssignment(null).execute(); + } + + // Test the deletePolicyAssignment operation with a valid options model parameter + @Test + public void testDeletePolicyAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deletePolicyAssignmentPath = "/v1/policy_assignments/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeletePolicyAssignmentOptions model + DeletePolicyAssignmentOptions deletePolicyAssignmentOptionsModel = new DeletePolicyAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke deletePolicyAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.deletePolicyAssignment(deletePolicyAssignmentOptionsModel).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, deletePolicyAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deletePolicyAssignment operation with and without retries enabled + @Test + public void testDeletePolicyAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeletePolicyAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeletePolicyAssignmentWOptions(); + } + + // Test the deletePolicyAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deletePolicyAssignment(null).execute(); + } + + // Test the getSettings operation with a valid options model parameter + @Test + public void testGetSettingsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"external_account_identity_interaction\": {\"identity_types\": {\"user\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service_id\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}}}}"; + String getSettingsPath = "/v1/accounts/testString/settings/access_management"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetSettingsOptions model + GetSettingsOptions getSettingsOptionsModel = new GetSettingsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .build(); + + // Invoke getSettings() with a valid options model and verify the result + Response response = iamPolicyManagementService.getSettings(getSettingsOptionsModel).execute(); + assertNotNull(response); + AccountSettingsAccessManagement 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, getSettingsPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getSettings operation with and without retries enabled + @Test + public void testGetSettingsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetSettingsWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetSettingsWOptions(); + } + + // Test the getSettings operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetSettingsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getSettings(null).execute(); + } + + // Test the updateSettings operation with a valid options model parameter + @Test + public void testUpdateSettingsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"external_account_identity_interaction\": {\"identity_types\": {\"user\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service_id\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}}}}"; + String updateSettingsPath = "/v1/accounts/testString/settings/access_management"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the IdentityTypesBase model + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the IdentityTypesPatch model + IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() + .user(identityTypesBaseModel) + .serviceId(identityTypesBaseModel) + .service(identityTypesBaseModel) + .build(); + + // Construct an instance of the ExternalAccountIdentityInteractionPatch model + ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() + .identityTypes(identityTypesPatchModel) + .build(); + + // Construct an instance of the UpdateSettingsOptions model + UpdateSettingsOptions updateSettingsOptionsModel = new UpdateSettingsOptions.Builder() + .accountId("testString") + .ifMatch("testString") + .externalAccountIdentityInteraction(externalAccountIdentityInteractionPatchModel) + .acceptLanguage("default") + .build(); + + // Invoke updateSettings() with a valid options model and verify the result + Response response = iamPolicyManagementService.updateSettings(updateSettingsOptionsModel).execute(); + assertNotNull(response); + AccountSettingsAccessManagement 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updateSettingsPath); + // 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 updateSettings operation with and without retries enabled + @Test + public void testUpdateSettingsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdateSettingsWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdateSettingsWOptions(); + } + + // Test the updateSettings operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateSettingsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updateSettings(null).execute(); + } + + // Test the listActionControlTemplates operation with a valid options model parameter + @Test + public void testListActionControlTemplatesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"action_control_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; + String listActionControlTemplatesPath = "/v1/action_control_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListActionControlTemplatesOptions model + ListActionControlTemplatesOptions listActionControlTemplatesOptionsModel = new ListActionControlTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listActionControlTemplates() with a valid options model and verify the result + Response response = iamPolicyManagementService.listActionControlTemplates(listActionControlTemplatesOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplateCollection 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, listActionControlTemplatesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listActionControlTemplates operation with and without retries enabled + @Test + public void testListActionControlTemplatesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListActionControlTemplatesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListActionControlTemplatesWOptions(); + } + + // Test the listActionControlTemplates operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlTemplatesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listActionControlTemplates(null).execute(); + } + + // Test the listActionControlTemplates operation using the ActionControlTemplatesPager.getNext() method + @Test + public void testListActionControlTemplatesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlTemplatesOptions listActionControlTemplatesOptions = new ListActionControlTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + ActionControlTemplatesPager pager = new ActionControlTemplatesPager(iamPolicyManagementService, listActionControlTemplatesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listActionControlTemplates operation using the ActionControlTemplatesPager.getAll() method + @Test + public void testListActionControlTemplatesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlTemplatesOptions listActionControlTemplatesOptions = new ListActionControlTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .limit(Long.valueOf("10")) + .build(); + + ActionControlTemplatesPager pager = new ActionControlTemplatesPager(iamPolicyManagementService, listActionControlTemplatesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createActionControlTemplate operation with a valid options model parameter + @Test + public void testCreateActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String createActionControlTemplatePath = "/v1/action_control_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateActionControl model + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the CreateActionControlTemplateOptions model + CreateActionControlTemplateOptions createActionControlTemplateOptionsModel = new CreateActionControlTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .description("testString") + .committed(true) + .actionControl(templateActionControlModel) + .acceptLanguage("default") + .build(); + + // Invoke createActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.createActionControlTemplate(createActionControlTemplateOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createActionControlTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createActionControlTemplate operation with and without retries enabled + @Test + public void testCreateActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateActionControlTemplateWOptions(); + } + + // Test the createActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createActionControlTemplate(null).execute(); + } + + // Test the getActionControlTemplate operation with a valid options model parameter + @Test + public void testGetActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String getActionControlTemplatePath = "/v1/action_control_templates/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetActionControlTemplateOptions model + GetActionControlTemplateOptions getActionControlTemplateOptionsModel = new GetActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .build(); + + // Invoke getActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.getActionControlTemplate(getActionControlTemplateOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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, getActionControlTemplatePath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + } + + // Test the getActionControlTemplate operation with and without retries enabled + @Test + public void testGetActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetActionControlTemplateWOptions(); + } + + // Test the getActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getActionControlTemplate(null).execute(); + } + + // Test the deleteActionControlTemplate operation with a valid options model parameter + @Test + public void testDeleteActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteActionControlTemplatePath = "/v1/action_control_templates/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteActionControlTemplateOptions model + DeleteActionControlTemplateOptions deleteActionControlTemplateOptionsModel = new DeleteActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .build(); + + // Invoke deleteActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteActionControlTemplate(deleteActionControlTemplateOptionsModel).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, deleteActionControlTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteActionControlTemplate operation with and without retries enabled + @Test + public void testDeleteActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteActionControlTemplateWOptions(); + } + + // Test the deleteActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteActionControlTemplate(null).execute(); + } + + // Test the createActionControlTemplateVersion operation with a valid options model parameter + @Test + public void testCreateActionControlTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String createActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateActionControl model + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the CreateActionControlTemplateVersionOptions model + CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptionsModel = new CreateActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .name("testString") + .description("testString") + .actionControl(templateActionControlModel) + .committed(true) + .build(); + + // Invoke createActionControlTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.createActionControlTemplateVersion(createActionControlTemplateVersionOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createActionControlTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createActionControlTemplateVersion operation with and without retries enabled + @Test + public void testCreateActionControlTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateActionControlTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateActionControlTemplateVersionWOptions(); + } + + // Test the createActionControlTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createActionControlTemplateVersion(null).execute(); + } + + // Test the listActionControlTemplateVersions operation with a valid options model parameter + @Test + public void testListActionControlTemplateVersionsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; + String listActionControlTemplateVersionsPath = "/v1/action_control_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListActionControlTemplateVersionsOptions model + ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptionsModel = new ListActionControlTemplateVersionsOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listActionControlTemplateVersions() with a valid options model and verify the result + Response response = iamPolicyManagementService.listActionControlTemplateVersions(listActionControlTemplateVersionsOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplateVersionsCollection 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, listActionControlTemplateVersionsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listActionControlTemplateVersions operation with and without retries enabled + @Test + public void testListActionControlTemplateVersionsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListActionControlTemplateVersionsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListActionControlTemplateVersionsWOptions(); + } + + // Test the listActionControlTemplateVersions operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlTemplateVersionsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listActionControlTemplateVersions(null).execute(); + } + + // Test the listActionControlTemplateVersions operation using the ActionControlTemplateVersionsPager.getNext() method + @Test + public void testListActionControlTemplateVersionsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions = new ListActionControlTemplateVersionsOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + ActionControlTemplateVersionsPager pager = new ActionControlTemplateVersionsPager(iamPolicyManagementService, listActionControlTemplateVersionsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listActionControlTemplateVersions operation using the ActionControlTemplateVersionsPager.getAll() method + @Test + public void testListActionControlTemplateVersionsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions = new ListActionControlTemplateVersionsOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + ActionControlTemplateVersionsPager pager = new ActionControlTemplateVersionsPager(iamPolicyManagementService, listActionControlTemplateVersionsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the replaceActionControlTemplate operation with a valid options model parameter + @Test + public void testReplaceActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String replaceActionControlTemplatePath = "/v1/action_control_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateActionControl model + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the ReplaceActionControlTemplateOptions model + ReplaceActionControlTemplateOptions replaceActionControlTemplateOptionsModel = new ReplaceActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .actionControl(templateActionControlModel) + .committed(true) + .build(); + + // Invoke replaceActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.replaceActionControlTemplate(replaceActionControlTemplateOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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, replaceActionControlTemplatePath); + // 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 replaceActionControlTemplate operation with and without retries enabled + @Test + public void testReplaceActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplaceActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplaceActionControlTemplateWOptions(); + } + + // Test the replaceActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replaceActionControlTemplate(null).execute(); + } + + // Test the deleteActionControlTemplateVersion operation with a valid options model parameter + @Test + public void testDeleteActionControlTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteActionControlTemplateVersionOptions model + DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptionsModel = new DeleteActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + + // Invoke deleteActionControlTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteActionControlTemplateVersion(deleteActionControlTemplateVersionOptionsModel).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, deleteActionControlTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteActionControlTemplateVersion operation with and without retries enabled + @Test + public void testDeleteActionControlTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteActionControlTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteActionControlTemplateVersionWOptions(); + } + + // Test the deleteActionControlTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteActionControlTemplateVersion(null).execute(); + } + + // Test the getActionControlTemplateVersion operation with a valid options model parameter + @Test + public void testGetActionControlTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String getActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetActionControlTemplateVersionOptions model + GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptionsModel = new GetActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + + // Invoke getActionControlTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.getActionControlTemplateVersion(getActionControlTemplateVersionOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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, getActionControlTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getActionControlTemplateVersion operation with and without retries enabled + @Test + public void testGetActionControlTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetActionControlTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetActionControlTemplateVersionWOptions(); + } + + // Test the getActionControlTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getActionControlTemplateVersion(null).execute(); + } + + // Test the commitActionControlTemplate operation with a valid options model parameter + @Test + public void testCommitActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String commitActionControlTemplatePath = "/v1/action_control_templates/testString/versions/testString/commit"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the CommitActionControlTemplateOptions model + CommitActionControlTemplateOptions commitActionControlTemplateOptionsModel = new CommitActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + + // Invoke commitActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.commitActionControlTemplate(commitActionControlTemplateOptionsModel).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, commitActionControlTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the commitActionControlTemplate operation with and without retries enabled + @Test + public void testCommitActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCommitActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCommitActionControlTemplateWOptions(); + } + + // Test the commitActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.commitActionControlTemplate(null).execute(); + } + + // Test the listActionControlAssignments operation with a valid options model parameter + @Test + public void testListActionControlAssignmentsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; + String listActionControlAssignmentsPath = "/v1/action_control_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListActionControlAssignmentsOptions model + ListActionControlAssignmentsOptions listActionControlAssignmentsOptionsModel = new ListActionControlAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listActionControlAssignments() with a valid options model and verify the result + Response response = iamPolicyManagementService.listActionControlAssignments(listActionControlAssignmentsOptionsModel).execute(); + assertNotNull(response); + ActionControlAssignmentCollection 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, listActionControlAssignmentsPath); + // 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(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listActionControlAssignments operation with and without retries enabled + @Test + public void testListActionControlAssignmentsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListActionControlAssignmentsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListActionControlAssignmentsWOptions(); + } + + // Test the listActionControlAssignments operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlAssignmentsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listActionControlAssignments(null).execute(); + } + + // Test the listActionControlAssignments operation using the ActionControlAssignmentsPager.getNext() method + @Test + public void testListActionControlAssignmentsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlAssignmentsOptions listActionControlAssignmentsOptions = new ListActionControlAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + ActionControlAssignmentsPager pager = new ActionControlAssignmentsPager(iamPolicyManagementService, listActionControlAssignmentsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listActionControlAssignments operation using the ActionControlAssignmentsPager.getAll() method + @Test + public void testListActionControlAssignmentsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlAssignmentsOptions listActionControlAssignmentsOptions = new ListActionControlAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + ActionControlAssignmentsPager pager = new ActionControlAssignmentsPager(iamPolicyManagementService, listActionControlAssignmentsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createActionControlTemplateAssignment operation with a valid options model parameter + @Test + public void testCreateActionControlTemplateAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; + String createActionControlTemplateAssignmentPath = "/v1/action_control_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the AssignmentTargetDetails model + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + + // Construct an instance of the ActionControlAssignmentTemplate model + ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + + // Construct an instance of the CreateActionControlTemplateAssignmentOptions model + CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptionsModel = new CreateActionControlTemplateAssignmentOptions.Builder() + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(actionControlAssignmentTemplateModel)) + .acceptLanguage("default") + .build(); + + // Invoke createActionControlTemplateAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.createActionControlTemplateAssignment(createActionControlTemplateAssignmentOptionsModel).execute(); + assertNotNull(response); + ActionControlAssignmentCollection 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createActionControlTemplateAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createActionControlTemplateAssignment operation with and without retries enabled + @Test + public void testCreateActionControlTemplateAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateActionControlTemplateAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateActionControlTemplateAssignmentWOptions(); + } + + // Test the createActionControlTemplateAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createActionControlTemplateAssignment(null).execute(); + } + + // Test the getActionControlAssignment operation with a valid options model parameter + @Test + public void testGetActionControlAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; + String getActionControlAssignmentPath = "/v1/action_control_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetActionControlAssignmentOptions model + GetActionControlAssignmentOptions getActionControlAssignmentOptionsModel = new GetActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke getActionControlAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.getActionControlAssignment(getActionControlAssignmentOptionsModel).execute(); + assertNotNull(response); + ActionControlAssignment 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, getActionControlAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getActionControlAssignment operation with and without retries enabled + @Test + public void testGetActionControlAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetActionControlAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetActionControlAssignmentWOptions(); + } + + // Test the getActionControlAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getActionControlAssignment(null).execute(); + } + + // Test the updateActionControlAssignment operation with a valid options model parameter + @Test + public void testUpdateActionControlAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; + String updateActionControlAssignmentPath = "/v1/action_control_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdateActionControlAssignmentOptions model + UpdateActionControlAssignmentOptions updateActionControlAssignmentOptionsModel = new UpdateActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .ifMatch("testString") + .templateVersion("testString") + .build(); + + // Invoke updateActionControlAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.updateActionControlAssignment(updateActionControlAssignmentOptionsModel).execute(); + assertNotNull(response); + ActionControlAssignment 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updateActionControlAssignmentPath); + // 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 updateActionControlAssignment operation with and without retries enabled + @Test + public void testUpdateActionControlAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdateActionControlAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdateActionControlAssignmentWOptions(); + } + + // Test the updateActionControlAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateActionControlAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updateActionControlAssignment(null).execute(); + } + + // Test the deleteActionControlAssignment operation with a valid options model parameter + @Test + public void testDeleteActionControlAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteActionControlAssignmentPath = "/v1/action_control_assignments/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteActionControlAssignmentOptions model + DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptionsModel = new DeleteActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke deleteActionControlAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteActionControlAssignment(deleteActionControlAssignmentOptionsModel).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, deleteActionControlAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteActionControlAssignment operation with and without retries enabled + @Test + public void testDeleteActionControlAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteActionControlAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteActionControlAssignmentWOptions(); + } + + // Test the deleteActionControlAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteActionControlAssignment(null).execute(); + } + + // Test the listRoleTemplates operation with a valid options model parameter + @Test + public void testListRoleTemplatesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"role_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; + String listRoleTemplatesPath = "/v1/role_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListRoleTemplatesOptions model + ListRoleTemplatesOptions listRoleTemplatesOptionsModel = new ListRoleTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .name("testString") + .roleName("testString") + .roleServiceName("testString") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listRoleTemplates() with a valid options model and verify the result + Response response = iamPolicyManagementService.listRoleTemplates(listRoleTemplatesOptionsModel).execute(); + assertNotNull(response); + RoleTemplateCollection 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, listRoleTemplatesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("name"), "testString"); + assertEquals(query.get("role_name"), "testString"); + assertEquals(query.get("role_service_name"), "testString"); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listRoleTemplates operation with and without retries enabled + @Test + public void testListRoleTemplatesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListRoleTemplatesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListRoleTemplatesWOptions(); + } + + // Test the listRoleTemplates operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleTemplatesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listRoleTemplates(null).execute(); + } + + // Test the listRoleTemplates operation using the RoleTemplatesPager.getNext() method + @Test + public void testListRoleTemplatesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleTemplatesOptions listRoleTemplatesOptions = new ListRoleTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .name("testString") + .roleName("testString") + .roleServiceName("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + RoleTemplatesPager pager = new RoleTemplatesPager(iamPolicyManagementService, listRoleTemplatesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listRoleTemplates operation using the RoleTemplatesPager.getAll() method + @Test + public void testListRoleTemplatesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleTemplatesOptions listRoleTemplatesOptions = new ListRoleTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .name("testString") + .roleName("testString") + .roleServiceName("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + RoleTemplatesPager pager = new RoleTemplatesPager(iamPolicyManagementService, listRoleTemplatesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createRoleTemplate operation with a valid options model parameter + @Test + public void testCreateRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String createRoleTemplatePath = "/v1/role_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the RoleTemplatePrototypeRole model + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() + .name("testString") + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the CreateRoleTemplateOptions model + CreateRoleTemplateOptions createRoleTemplateOptionsModel = new CreateRoleTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .description("testString") + .committed(true) + .role(roleTemplatePrototypeRoleModel) + .acceptLanguage("default") + .build(); + + // Invoke createRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.createRoleTemplate(createRoleTemplateOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createRoleTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createRoleTemplate operation with and without retries enabled + @Test + public void testCreateRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateRoleTemplateWOptions(); + } + + // Test the createRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createRoleTemplate(null).execute(); + } + + // Test the getRoleTemplate operation with a valid options model parameter + @Test + public void testGetRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String getRoleTemplatePath = "/v1/role_templates/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetRoleTemplateOptions model + GetRoleTemplateOptions getRoleTemplateOptionsModel = new GetRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .state("active") + .build(); + + // Invoke getRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.getRoleTemplate(getRoleTemplateOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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, getRoleTemplatePath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + } + + // Test the getRoleTemplate operation with and without retries enabled + @Test + public void testGetRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetRoleTemplateWOptions(); + } + + // Test the getRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getRoleTemplate(null).execute(); + } + + // Test the deleteRoleTemplate operation with a valid options model parameter + @Test + public void testDeleteRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteRoleTemplatePath = "/v1/role_templates/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteRoleTemplateOptions model + DeleteRoleTemplateOptions deleteRoleTemplateOptionsModel = new DeleteRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .build(); + + // Invoke deleteRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteRoleTemplate(deleteRoleTemplateOptionsModel).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, deleteRoleTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteRoleTemplate operation with and without retries enabled + @Test + public void testDeleteRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteRoleTemplateWOptions(); + } + + // Test the deleteRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteRoleTemplate(null).execute(); + } + + // Test the createRoleTemplateVersion operation with a valid options model parameter + @Test + public void testCreateRoleTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String createRoleTemplateVersionPath = "/v1/role_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateRole model + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the CreateRoleTemplateVersionOptions model + CreateRoleTemplateVersionOptions createRoleTemplateVersionOptionsModel = new CreateRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .name("testString") + .description("testString") + .role(templateRoleModel) + .committed(true) + .build(); + + // Invoke createRoleTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.createRoleTemplateVersion(createRoleTemplateVersionOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createRoleTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createRoleTemplateVersion operation with and without retries enabled + @Test + public void testCreateRoleTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateRoleTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateRoleTemplateVersionWOptions(); + } + + // Test the createRoleTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createRoleTemplateVersion(null).execute(); + } + + // Test the listRoleTemplateVersions operation with a valid options model parameter + @Test + public void testListRoleTemplateVersionsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; + String listRoleTemplateVersionsPath = "/v1/role_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListRoleTemplateVersionsOptions model + ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptionsModel = new ListRoleTemplateVersionsOptions.Builder() + .roleTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listRoleTemplateVersions() with a valid options model and verify the result + Response response = iamPolicyManagementService.listRoleTemplateVersions(listRoleTemplateVersionsOptionsModel).execute(); + assertNotNull(response); + RoleTemplateVersionsCollection 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, listRoleTemplateVersionsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listRoleTemplateVersions operation with and without retries enabled + @Test + public void testListRoleTemplateVersionsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListRoleTemplateVersionsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListRoleTemplateVersionsWOptions(); + } + + // Test the listRoleTemplateVersions operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleTemplateVersionsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listRoleTemplateVersions(null).execute(); + } + + // Test the listRoleTemplateVersions operation using the RoleTemplateVersionsPager.getNext() method + @Test + public void testListRoleTemplateVersionsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions = new ListRoleTemplateVersionsOptions.Builder() + .roleTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + RoleTemplateVersionsPager pager = new RoleTemplateVersionsPager(iamPolicyManagementService, listRoleTemplateVersionsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listRoleTemplateVersions operation using the RoleTemplateVersionsPager.getAll() method + @Test + public void testListRoleTemplateVersionsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions = new ListRoleTemplateVersionsOptions.Builder() + .roleTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + RoleTemplateVersionsPager pager = new RoleTemplateVersionsPager(iamPolicyManagementService, listRoleTemplateVersionsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the replaceRoleTemplate operation with a valid options model parameter + @Test + public void testReplaceRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String replaceRoleTemplatePath = "/v1/role_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateRole model + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the ReplaceRoleTemplateOptions model + ReplaceRoleTemplateOptions replaceRoleTemplateOptionsModel = new ReplaceRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .role(templateRoleModel) + .committed(true) + .build(); + + // Invoke replaceRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.replaceRoleTemplate(replaceRoleTemplateOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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, replaceRoleTemplatePath); + // 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 replaceRoleTemplate operation with and without retries enabled + @Test + public void testReplaceRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplaceRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplaceRoleTemplateWOptions(); + } + + // Test the replaceRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replaceRoleTemplate(null).execute(); + } + + // Test the deleteRoleTemplateVersion operation with a valid options model parameter + @Test + public void testDeleteRoleTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteRoleTemplateVersionPath = "/v1/role_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteRoleTemplateVersionOptions model + DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptionsModel = new DeleteRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + + // Invoke deleteRoleTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteRoleTemplateVersion(deleteRoleTemplateVersionOptionsModel).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, deleteRoleTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteRoleTemplateVersion operation with and without retries enabled + @Test + public void testDeleteRoleTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteRoleTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteRoleTemplateVersionWOptions(); + } + + // Test the deleteRoleTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteRoleTemplateVersion(null).execute(); + } + + // Test the getRoleTemplateVersion operation with a valid options model parameter + @Test + public void testGetRoleTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String getRoleTemplateVersionPath = "/v1/role_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetRoleTemplateVersionOptions model + GetRoleTemplateVersionOptions getRoleTemplateVersionOptionsModel = new GetRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + + // Invoke getRoleTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.getRoleTemplateVersion(getRoleTemplateVersionOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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, getRoleTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getRoleTemplateVersion operation with and without retries enabled + @Test + public void testGetRoleTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetRoleTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetRoleTemplateVersionWOptions(); + } + + // Test the getRoleTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getRoleTemplateVersion(null).execute(); + } + + // Test the commitRoleTemplate operation with a valid options model parameter + @Test + public void testCommitRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String commitRoleTemplatePath = "/v1/role_templates/testString/versions/testString/commit"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the CommitRoleTemplateOptions model + CommitRoleTemplateOptions commitRoleTemplateOptionsModel = new CommitRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + + // Invoke commitRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.commitRoleTemplate(commitRoleTemplateOptionsModel).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, commitRoleTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the commitRoleTemplate operation with and without retries enabled + @Test + public void testCommitRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCommitRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCommitRoleTemplateWOptions(); + } + + // Test the commitRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.commitRoleTemplate(null).execute(); + } + + // Test the listRoleAssignments operation with a valid options model parameter + @Test + public void testListRoleAssignmentsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; + String listRoleAssignmentsPath = "/v1/role_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListRoleAssignmentsOptions model + ListRoleAssignmentsOptions listRoleAssignmentsOptionsModel = new ListRoleAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listRoleAssignments() with a valid options model and verify the result + Response response = iamPolicyManagementService.listRoleAssignments(listRoleAssignmentsOptionsModel).execute(); + assertNotNull(response); + RoleAssignmentCollection 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, listRoleAssignmentsPath); + // 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(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listRoleAssignments operation with and without retries enabled + @Test + public void testListRoleAssignmentsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListRoleAssignmentsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListRoleAssignmentsWOptions(); + } + + // Test the listRoleAssignments operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleAssignmentsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listRoleAssignments(null).execute(); + } + + // Test the listRoleAssignments operation using the RoleAssignmentsPager.getNext() method + @Test + public void testListRoleAssignmentsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleAssignmentsOptions listRoleAssignmentsOptions = new ListRoleAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + RoleAssignmentsPager pager = new RoleAssignmentsPager(iamPolicyManagementService, listRoleAssignmentsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listRoleAssignments operation using the RoleAssignmentsPager.getAll() method + @Test + public void testListRoleAssignmentsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleAssignmentsOptions listRoleAssignmentsOptions = new ListRoleAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + RoleAssignmentsPager pager = new RoleAssignmentsPager(iamPolicyManagementService, listRoleAssignmentsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createRoleTemplateAssignment operation with a valid options model parameter + @Test + public void testCreateRoleTemplateAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; + String createRoleTemplateAssignmentPath = "/v1/role_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the AssignmentTargetDetails model + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + + // Construct an instance of the RoleAssignmentTemplate model + RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + + // Construct an instance of the CreateRoleTemplateAssignmentOptions model + CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptionsModel = new CreateRoleTemplateAssignmentOptions.Builder() + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(roleAssignmentTemplateModel)) + .acceptLanguage("default") + .build(); + + // Invoke createRoleTemplateAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.createRoleTemplateAssignment(createRoleTemplateAssignmentOptionsModel).execute(); + assertNotNull(response); + RoleAssignmentCollection 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createRoleTemplateAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createRoleTemplateAssignment operation with and without retries enabled + @Test + public void testCreateRoleTemplateAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateRoleTemplateAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateRoleTemplateAssignmentWOptions(); + } + + // Test the createRoleTemplateAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createRoleTemplateAssignment(null).execute(); + } + + // Test the getRoleAssignment operation with a valid options model parameter + @Test + public void testGetRoleAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; + String getRoleAssignmentPath = "/v1/role_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetRoleAssignmentOptions model + GetRoleAssignmentOptions getRoleAssignmentOptionsModel = new GetRoleAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke getRoleAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.getRoleAssignment(getRoleAssignmentOptionsModel).execute(); + assertNotNull(response); + RoleAssignment 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, getRoleAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getRoleAssignment operation with and without retries enabled + @Test + public void testGetRoleAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetRoleAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetRoleAssignmentWOptions(); + } + + // Test the getRoleAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getRoleAssignment(null).execute(); + } + + // Test the updateRoleAssignment operation with a valid options model parameter + @Test + public void testUpdateRoleAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; + String updateRoleAssignmentPath = "/v1/role_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdateRoleAssignmentOptions model + UpdateRoleAssignmentOptions updateRoleAssignmentOptionsModel = new UpdateRoleAssignmentOptions.Builder() + .assignmentId("testString") + .ifMatch("testString") + .templateVersion("testString") + .build(); + + // Invoke updateRoleAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.updateRoleAssignment(updateRoleAssignmentOptionsModel).execute(); + assertNotNull(response); + RoleAssignment 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updateRoleAssignmentPath); + // 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 updateRoleAssignment operation with and without retries enabled + @Test + public void testUpdateRoleAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdateRoleAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdateRoleAssignmentWOptions(); + } + + // Test the updateRoleAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateRoleAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updateRoleAssignment(null).execute(); + } + + // Test the deleteRoleAssignment operation with a valid options model parameter + @Test + public void testDeleteRoleAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteRoleAssignmentPath = "/v1/role_assignments/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteRoleAssignmentOptions model + DeleteRoleAssignmentOptions deleteRoleAssignmentOptionsModel = new DeleteRoleAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke deleteRoleAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteRoleAssignment(deleteRoleAssignmentOptionsModel).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, deleteRoleAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteRoleAssignment operation with and without retries enabled + @Test + public void testDeleteRoleAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteRoleAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteRoleAssignmentWOptions(); + } + + // Test the deleteRoleAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteRoleAssignment(null).execute(); + } + + // Perform setup needed before each test method + @BeforeMethod + public void beforeEachTest() { + // Start the mock server. + try { + server = new MockWebServer(); + server.start(); + } catch (IOException err) { + fail("Failed to instantiate mock web server"); + } + + // Construct an instance of the service + constructClientService(); + } + + // Perform tear down after each test method + @AfterMethod + public void afterEachTest() throws IOException { + server.shutdown(); + iamPolicyManagementService = null; + } + + // Constructs an instance of the service to be used by the tests + public void constructClientService() { + System.setProperty("TESTSERVICE_AUTH_TYPE", "noAuth"); + final String serviceName = "testService"; + + iamPolicyManagementService = IamPolicyManagement.newInstance(serviceName); + String url = server.url("/").toString(); + iamPolicyManagementService.setServiceUrl(url); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java new file mode 100644 index 00000000000..5630ccb0c03 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.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 AccountSettingsAccessManagement model. + */ +public class AccountSettingsAccessManagementTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAccountSettingsAccessManagement() throws Throwable { + AccountSettingsAccessManagement accountSettingsAccessManagementModel = new AccountSettingsAccessManagement(); + assertNull(accountSettingsAccessManagementModel.getExternalAccountIdentityInteraction()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java new file mode 100644 index 00000000000..d4dfc8863c6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentCollection model. + */ +public class ActionControlAssignmentCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentCollection() throws Throwable { + ActionControlAssignmentCollection actionControlAssignmentCollectionModel = new ActionControlAssignmentCollection(); + assertNull(actionControlAssignmentCollectionModel.getLimit()); + assertNull(actionControlAssignmentCollectionModel.getFirst()); + assertNull(actionControlAssignmentCollectionModel.getNext()); + assertNull(actionControlAssignmentCollectionModel.getPrevious()); + assertNull(actionControlAssignmentCollectionModel.getAssignments()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java new file mode 100644 index 00000000000..cb53bc44d1c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java @@ -0,0 +1,43 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResourceActionControl model. + */ +public class ActionControlAssignmentResourceActionControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentResourceActionControl() throws Throwable { + ActionControlAssignmentResourceActionControl actionControlAssignmentResourceActionControlModel = new ActionControlAssignmentResourceActionControl(); + assertNull(actionControlAssignmentResourceActionControlModel.getResourceCreated()); + assertNull(actionControlAssignmentResourceActionControlModel.getErrorMessage()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java new file mode 100644 index 00000000000..284ec17a0f0 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResourceCreated model. + */ +public class ActionControlAssignmentResourceCreatedTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentResourceCreated() throws Throwable { + ActionControlAssignmentResourceCreated actionControlAssignmentResourceCreatedModel = new ActionControlAssignmentResourceCreated(); + assertNull(actionControlAssignmentResourceCreatedModel.getId()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java new file mode 100644 index 00000000000..eaa560dce78 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResource model. + */ +public class ActionControlAssignmentResourceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentResource() throws Throwable { + ActionControlAssignmentResource actionControlAssignmentResourceModel = new ActionControlAssignmentResource(); + assertNull(actionControlAssignmentResourceModel.getTarget()); + assertNull(actionControlAssignmentResourceModel.getActionControl()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java new file mode 100644 index 00000000000..262a74bea45 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentTemplate model. + */ +public class ActionControlAssignmentTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentTemplate() throws Throwable { + ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(actionControlAssignmentTemplateModel.id(), "testString"); + assertEquals(actionControlAssignmentTemplateModel.version(), "testString"); + + String json = TestUtilities.serialize(actionControlAssignmentTemplateModel); + + ActionControlAssignmentTemplate actionControlAssignmentTemplateModelNew = TestUtilities.deserialize(json, ActionControlAssignmentTemplate.class); + assertTrue(actionControlAssignmentTemplateModelNew instanceof ActionControlAssignmentTemplate); + assertEquals(actionControlAssignmentTemplateModelNew.id(), "testString"); + assertEquals(actionControlAssignmentTemplateModelNew.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testActionControlAssignmentTemplateError() throws Throwable { + new ActionControlAssignmentTemplate.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java new file mode 100644 index 00000000000..c5173f940c4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignment model. + */ +public class ActionControlAssignmentTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignment() throws Throwable { + ActionControlAssignment actionControlAssignmentModel = new ActionControlAssignment(); + assertNull(actionControlAssignmentModel.getTemplate()); + assertNull(actionControlAssignmentModel.getTarget()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java new file mode 100644 index 00000000000..58155ee1e7e --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java @@ -0,0 +1,46 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplateCollection model. + */ +public class ActionControlTemplateCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlTemplateCollection() throws Throwable { + ActionControlTemplateCollection actionControlTemplateCollectionModel = new ActionControlTemplateCollection(); + assertNull(actionControlTemplateCollectionModel.getLimit()); + assertNull(actionControlTemplateCollectionModel.getFirst()); + assertNull(actionControlTemplateCollectionModel.getNext()); + assertNull(actionControlTemplateCollectionModel.getPrevious()); + assertNull(actionControlTemplateCollectionModel.getActionControlTemplates()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java new file mode 100644 index 00000000000..a086106a57e --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplate model. + */ +public class ActionControlTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlTemplate() throws Throwable { + ActionControlTemplate actionControlTemplateModel = new ActionControlTemplate(); + assertNull(actionControlTemplateModel.getName()); + assertNull(actionControlTemplateModel.getDescription()); + assertNull(actionControlTemplateModel.getAccountId()); + assertNull(actionControlTemplateModel.isCommitted()); + assertNull(actionControlTemplateModel.getActionControl()); + assertNull(actionControlTemplateModel.getVersion()); + assertNull(actionControlTemplateModel.getState()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java new file mode 100644 index 00000000000..7b6bf014357 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java @@ -0,0 +1,46 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplateVersionsCollection model. + */ +public class ActionControlTemplateVersionsCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlTemplateVersionsCollection() throws Throwable { + ActionControlTemplateVersionsCollection actionControlTemplateVersionsCollectionModel = new ActionControlTemplateVersionsCollection(); + assertNull(actionControlTemplateVersionsCollectionModel.getLimit()); + assertNull(actionControlTemplateVersionsCollectionModel.getFirst()); + assertNull(actionControlTemplateVersionsCollectionModel.getNext()); + assertNull(actionControlTemplateVersionsCollectionModel.getPrevious()); + assertNull(actionControlTemplateVersionsCollectionModel.getVersions()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java new file mode 100644 index 00000000000..4038d52606c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentResourceCreated model. + */ +public class AssignmentResourceCreatedTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAssignmentResourceCreated() throws Throwable { + AssignmentResourceCreated assignmentResourceCreatedModel = new AssignmentResourceCreated(); + assertNull(assignmentResourceCreatedModel.getId()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java new file mode 100644 index 00000000000..81e3799a42c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentResourceError model. + */ +public class AssignmentResourceErrorTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAssignmentResourceError() throws Throwable { + AssignmentResourceError assignmentResourceErrorModel = new AssignmentResourceError(); + assertNull(assignmentResourceErrorModel.getName()); + assertNull(assignmentResourceErrorModel.getErrorCode()); + assertNull(assignmentResourceErrorModel.getMessage()); + assertNull(assignmentResourceErrorModel.getCode()); + assertNull(assignmentResourceErrorModel.getErrors()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java new file mode 100644 index 00000000000..48e4a605cbb --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentTargetDetails model. + */ +public class AssignmentTargetDetailsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAssignmentTargetDetails() throws Throwable { + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + assertEquals(assignmentTargetDetailsModel.type(), "Account"); + assertEquals(assignmentTargetDetailsModel.id(), "testString"); + + String json = TestUtilities.serialize(assignmentTargetDetailsModel); + + AssignmentTargetDetails assignmentTargetDetailsModelNew = TestUtilities.deserialize(json, AssignmentTargetDetails.class); + assertTrue(assignmentTargetDetailsModelNew instanceof AssignmentTargetDetails); + assertEquals(assignmentTargetDetailsModelNew.type(), "Account"); + assertEquals(assignmentTargetDetailsModelNew.id(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testAssignmentTargetDetailsError() throws Throwable { + new AssignmentTargetDetails.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java new file mode 100644 index 00000000000..bcecf27ed27 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java @@ -0,0 +1,48 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentTemplateDetails model. + */ +public class AssignmentTemplateDetailsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAssignmentTemplateDetails() throws Throwable { + AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(assignmentTemplateDetailsModel.id(), "testString"); + assertEquals(assignmentTemplateDetailsModel.version(), "testString"); + + String json = TestUtilities.serialize(assignmentTemplateDetailsModel); + + AssignmentTemplateDetails assignmentTemplateDetailsModelNew = TestUtilities.deserialize(json, AssignmentTemplateDetails.class); + assertTrue(assignmentTemplateDetailsModelNew instanceof AssignmentTemplateDetails); + assertEquals(assignmentTemplateDetailsModelNew.id(), "testString"); + assertEquals(assignmentTemplateDetailsModelNew.version(), "testString"); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..2b5ed42c76a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CommitActionControlTemplateOptions model. + */ +public class CommitActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCommitActionControlTemplateOptions() throws Throwable { + CommitActionControlTemplateOptions commitActionControlTemplateOptionsModel = new CommitActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + assertEquals(commitActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(commitActionControlTemplateOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitActionControlTemplateOptionsError() throws Throwable { + new CommitActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..66cdca59588 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CommitPolicyTemplateOptions model. + */ +public class CommitPolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCommitPolicyTemplateOptions() throws Throwable { + CommitPolicyTemplateOptions commitPolicyTemplateOptionsModel = new CommitPolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + assertEquals(commitPolicyTemplateOptionsModel.policyTemplateId(), "testString"); + assertEquals(commitPolicyTemplateOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitPolicyTemplateOptionsError() throws Throwable { + new CommitPolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..09c48b8e80e --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CommitRoleTemplateOptions model. + */ +public class CommitRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCommitRoleTemplateOptions() throws Throwable { + CommitRoleTemplateOptions commitRoleTemplateOptionsModel = new CommitRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + assertEquals(commitRoleTemplateOptionsModel.roleTemplateId(), "testString"); + assertEquals(commitRoleTemplateOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitRoleTemplateOptionsError() throws Throwable { + new CommitRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java new file mode 100644 index 00000000000..94ef6ce21e8 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.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 ConflictsWith model. + */ +public class ConflictsWithTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testConflictsWith() throws Throwable { + ConflictsWith conflictsWithModel = new ConflictsWith(); + assertNull(conflictsWithModel.getEtag()); + assertNull(conflictsWithModel.getRole()); + assertNull(conflictsWithModel.getPolicy()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java new file mode 100644 index 00000000000..bbe19a7b9b1 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponseControl model. + */ +public class ControlResponseControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testControlResponseControl() throws Throwable { + ControlResponseControl controlResponseControlModel = new ControlResponseControl(); + assertNull(controlResponseControlModel.getGrant()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java new file mode 100644 index 00000000000..7b2fbfae90d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControlWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponseControlWithEnrichedRoles model. + */ +public class ControlResponseControlWithEnrichedRolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testControlResponseControlWithEnrichedRoles() throws Throwable { + ControlResponseControlWithEnrichedRoles controlResponseControlWithEnrichedRolesModel = new ControlResponseControlWithEnrichedRoles(); + assertNull(controlResponseControlWithEnrichedRolesModel.getGrant()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java new file mode 100644 index 00000000000..f42cbc0a2d8 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponse; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponse model. + */ +public class ControlResponseTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testControlResponse() throws Throwable { + ControlResponse controlResponseModel = new ControlResponse(); + assertNotNull(controlResponseModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java new file mode 100644 index 00000000000..c8b1e3000f9 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 Control model. + */ +public class ControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testControl() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + assertEquals(controlModel.grant(), grantModel); + + String json = TestUtilities.serialize(controlModel); + + Control controlModelNew = TestUtilities.deserialize(json, Control.class); + assertTrue(controlModelNew instanceof Control); + assertEquals(controlModelNew.grant().toString(), grantModel.toString()); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testControlError() throws Throwable { + new Control.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java new file mode 100644 index 00000000000..f2557c8f64f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateAssignmentOptions model. + */ +public class CreateActionControlTemplateAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateActionControlTemplateAssignmentOptions() throws Throwable { + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + assertEquals(assignmentTargetDetailsModel.type(), "Account"); + assertEquals(assignmentTargetDetailsModel.id(), "testString"); + + ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(actionControlAssignmentTemplateModel.id(), "testString"); + assertEquals(actionControlAssignmentTemplateModel.version(), "testString"); + + CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptionsModel = new CreateActionControlTemplateAssignmentOptions.Builder() + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(actionControlAssignmentTemplateModel)) + .acceptLanguage("default") + .build(); + assertEquals(createActionControlTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); + assertEquals(createActionControlTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(actionControlAssignmentTemplateModel)); + assertEquals(createActionControlTemplateAssignmentOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateAssignmentOptionsError() throws Throwable { + new CreateActionControlTemplateAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..2508072a03c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateOptions model. + */ +public class CreateActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateActionControlTemplateOptions() throws Throwable { + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateActionControlModel.serviceName(), "testString"); + assertEquals(templateActionControlModel.description(), "testString"); + assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); + + CreateActionControlTemplateOptions createActionControlTemplateOptionsModel = new CreateActionControlTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .description("testString") + .committed(true) + .actionControl(templateActionControlModel) + .acceptLanguage("default") + .build(); + assertEquals(createActionControlTemplateOptionsModel.name(), "testString"); + assertEquals(createActionControlTemplateOptionsModel.accountId(), "testString"); + assertEquals(createActionControlTemplateOptionsModel.description(), "testString"); + assertEquals(createActionControlTemplateOptionsModel.committed(), Boolean.valueOf(true)); + assertEquals(createActionControlTemplateOptionsModel.actionControl(), templateActionControlModel); + assertEquals(createActionControlTemplateOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateOptionsError() throws Throwable { + new CreateActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..d5070249115 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateVersionOptions model. + */ +public class CreateActionControlTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateActionControlTemplateVersionOptions() throws Throwable { + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateActionControlModel.serviceName(), "testString"); + assertEquals(templateActionControlModel.description(), "testString"); + assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); + + CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptionsModel = new CreateActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .name("testString") + .description("testString") + .actionControl(templateActionControlModel) + .committed(true) + .build(); + assertEquals(createActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(createActionControlTemplateVersionOptionsModel.name(), "testString"); + assertEquals(createActionControlTemplateVersionOptionsModel.description(), "testString"); + assertEquals(createActionControlTemplateVersionOptionsModel.actionControl(), templateActionControlModel); + assertEquals(createActionControlTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateVersionOptionsError() throws Throwable { + new CreateActionControlTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java new file mode 100644 index 00000000000..c2dd24fd213 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java @@ -0,0 +1,103 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyOptions model. + */ +public class CreatePolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreatePolicyOptions() throws Throwable { + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(subjectAttributeModel.name(), "testString"); + assertEquals(subjectAttributeModel.value(), "testString"); + + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); + + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + assertEquals(policyRoleModel.roleId(), "testString"); + + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceAttributeModel.name(), "testString"); + assertEquals(resourceAttributeModel.value(), "testString"); + assertEquals(resourceAttributeModel.operator(), "testString"); + + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceTagModel.name(), "testString"); + assertEquals(resourceTagModel.value(), "testString"); + assertEquals(resourceTagModel.operator(), "testString"); + + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); + assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); + + CreatePolicyOptions createPolicyOptionsModel = new CreatePolicyOptions.Builder() + .type("testString") + .subjects(java.util.Arrays.asList(policySubjectModel)) + .roles(java.util.Arrays.asList(policyRoleModel)) + .resources(java.util.Arrays.asList(policyResourceModel)) + .description("testString") + .acceptLanguage("default") + .build(); + assertEquals(createPolicyOptionsModel.type(), "testString"); + assertEquals(createPolicyOptionsModel.subjects(), java.util.Arrays.asList(policySubjectModel)); + assertEquals(createPolicyOptionsModel.roles(), java.util.Arrays.asList(policyRoleModel)); + assertEquals(createPolicyOptionsModel.resources(), java.util.Arrays.asList(policyResourceModel)); + assertEquals(createPolicyOptionsModel.description(), "testString"); + assertEquals(createPolicyOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyOptionsError() throws Throwable { + new CreatePolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java new file mode 100644 index 00000000000..5b08b4b398a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java @@ -0,0 +1,67 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateAssignmentOptions model. + */ +public class CreatePolicyTemplateAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreatePolicyTemplateAssignmentOptions() throws Throwable { + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + assertEquals(assignmentTargetDetailsModel.type(), "Account"); + assertEquals(assignmentTargetDetailsModel.id(), "testString"); + + AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(assignmentTemplateDetailsModel.id(), "testString"); + assertEquals(assignmentTemplateDetailsModel.version(), "testString"); + + CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptionsModel = new CreatePolicyTemplateAssignmentOptions.Builder() + .version("1.0") + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(assignmentTemplateDetailsModel)) + .acceptLanguage("default") + .build(); + assertEquals(createPolicyTemplateAssignmentOptionsModel.version(), "1.0"); + assertEquals(createPolicyTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); + assertEquals(createPolicyTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(assignmentTemplateDetailsModel)); + assertEquals(createPolicyTemplateAssignmentOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateAssignmentOptionsError() throws Throwable { + new CreatePolicyTemplateAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..68617451831 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java @@ -0,0 +1,145 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateOptions model. + */ +public class CreatePolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreatePolicyTemplateOptions() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + assertEquals(templatePolicyModel.type(), "access"); + assertEquals(templatePolicyModel.description(), "testString"); + assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); + assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); + assertEquals(templatePolicyModel.pattern(), "testString"); + assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); + assertEquals(templatePolicyModel.control(), templateControlModel); + + CreatePolicyTemplateOptions createPolicyTemplateOptionsModel = new CreatePolicyTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .policy(templatePolicyModel) + .description("testString") + .committed(true) + .acceptLanguage("default") + .build(); + assertEquals(createPolicyTemplateOptionsModel.name(), "testString"); + assertEquals(createPolicyTemplateOptionsModel.accountId(), "testString"); + assertEquals(createPolicyTemplateOptionsModel.policy(), templatePolicyModel); + assertEquals(createPolicyTemplateOptionsModel.description(), "testString"); + assertEquals(createPolicyTemplateOptionsModel.committed(), Boolean.valueOf(true)); + assertEquals(createPolicyTemplateOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateOptionsError() throws Throwable { + new CreatePolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..d6919e6e1b9 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java @@ -0,0 +1,143 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateVersionOptions model. + */ +public class CreatePolicyTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreatePolicyTemplateVersionOptions() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + assertEquals(templatePolicyModel.type(), "access"); + assertEquals(templatePolicyModel.description(), "testString"); + assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); + assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); + assertEquals(templatePolicyModel.pattern(), "testString"); + assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); + assertEquals(templatePolicyModel.control(), templateControlModel); + + CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptionsModel = new CreatePolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .policy(templatePolicyModel) + .name("testString") + .description("testString") + .committed(true) + .build(); + assertEquals(createPolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); + assertEquals(createPolicyTemplateVersionOptionsModel.policy(), templatePolicyModel); + assertEquals(createPolicyTemplateVersionOptionsModel.name(), "testString"); + assertEquals(createPolicyTemplateVersionOptionsModel.description(), "testString"); + assertEquals(createPolicyTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateVersionOptionsError() throws Throwable { + new CreatePolicyTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java new file mode 100644 index 00000000000..849512f2bda --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleOptions model. + */ +public class CreateRoleOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateRoleOptions() throws Throwable { + CreateRoleOptions createRoleOptionsModel = new CreateRoleOptions.Builder() + .displayName("testString") + .actions(java.util.Arrays.asList("testString")) + .name("Developer") + .accountId("testString") + .serviceName("iam-groups") + .description("testString") + .acceptLanguage("default") + .build(); + assertEquals(createRoleOptionsModel.displayName(), "testString"); + assertEquals(createRoleOptionsModel.actions(), java.util.Arrays.asList("testString")); + assertEquals(createRoleOptionsModel.name(), "Developer"); + assertEquals(createRoleOptionsModel.accountId(), "testString"); + assertEquals(createRoleOptionsModel.serviceName(), "iam-groups"); + assertEquals(createRoleOptionsModel.description(), "testString"); + assertEquals(createRoleOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleOptionsError() throws Throwable { + new CreateRoleOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java new file mode 100644 index 00000000000..bff414389a5 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateAssignmentOptions model. + */ +public class CreateRoleTemplateAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateRoleTemplateAssignmentOptions() throws Throwable { + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + assertEquals(assignmentTargetDetailsModel.type(), "Account"); + assertEquals(assignmentTargetDetailsModel.id(), "testString"); + + RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleAssignmentTemplateModel.id(), "testString"); + assertEquals(roleAssignmentTemplateModel.version(), "testString"); + + CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptionsModel = new CreateRoleTemplateAssignmentOptions.Builder() + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(roleAssignmentTemplateModel)) + .acceptLanguage("default") + .build(); + assertEquals(createRoleTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); + assertEquals(createRoleTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(roleAssignmentTemplateModel)); + assertEquals(createRoleTemplateAssignmentOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateAssignmentOptionsError() throws Throwable { + new CreateRoleTemplateAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..799743ddbf4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateOptions model. + */ +public class CreateRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateRoleTemplateOptions() throws Throwable { + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() + .name("testString") + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(roleTemplatePrototypeRoleModel.name(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.displayName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.serviceName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.description(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.actions(), java.util.Arrays.asList("testString")); + + CreateRoleTemplateOptions createRoleTemplateOptionsModel = new CreateRoleTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .description("testString") + .committed(true) + .role(roleTemplatePrototypeRoleModel) + .acceptLanguage("default") + .build(); + assertEquals(createRoleTemplateOptionsModel.name(), "testString"); + assertEquals(createRoleTemplateOptionsModel.accountId(), "testString"); + assertEquals(createRoleTemplateOptionsModel.description(), "testString"); + assertEquals(createRoleTemplateOptionsModel.committed(), Boolean.valueOf(true)); + assertEquals(createRoleTemplateOptionsModel.role(), roleTemplatePrototypeRoleModel); + assertEquals(createRoleTemplateOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateOptionsError() throws Throwable { + new CreateRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..a7d2d312afa --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateVersionOptions model. + */ +public class CreateRoleTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateRoleTemplateVersionOptions() throws Throwable { + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateRoleModel.displayName(), "testString"); + assertEquals(templateRoleModel.serviceName(), "testString"); + assertEquals(templateRoleModel.description(), "testString"); + assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); + + CreateRoleTemplateVersionOptions createRoleTemplateVersionOptionsModel = new CreateRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .name("testString") + .description("testString") + .role(templateRoleModel) + .committed(true) + .build(); + assertEquals(createRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); + assertEquals(createRoleTemplateVersionOptionsModel.name(), "testString"); + assertEquals(createRoleTemplateVersionOptionsModel.description(), "testString"); + assertEquals(createRoleTemplateVersionOptionsModel.role(), templateRoleModel); + assertEquals(createRoleTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateVersionOptionsError() throws Throwable { + new CreateRoleTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java new file mode 100644 index 00000000000..acce8b7b537 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java @@ -0,0 +1,131 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateV2PolicyOptions model. + */ +public class CreateV2PolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateV2PolicyOptions() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + assertEquals(controlModel.grant(), grantModel); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + CreateV2PolicyOptions createV2PolicyOptionsModel = new CreateV2PolicyOptions.Builder() + .control(controlModel) + .type("access") + .description("testString") + .subject(v2PolicySubjectModel) + .resource(v2PolicyResourceModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .acceptLanguage("default") + .build(); + assertEquals(createV2PolicyOptionsModel.control(), controlModel); + assertEquals(createV2PolicyOptionsModel.type(), "access"); + assertEquals(createV2PolicyOptionsModel.description(), "testString"); + assertEquals(createV2PolicyOptionsModel.subject(), v2PolicySubjectModel); + assertEquals(createV2PolicyOptionsModel.resource(), v2PolicyResourceModel); + assertEquals(createV2PolicyOptionsModel.pattern(), "testString"); + assertEquals(createV2PolicyOptionsModel.rule(), v2PolicyRuleModel); + assertEquals(createV2PolicyOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateV2PolicyOptionsError() throws Throwable { + new CreateV2PolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java new file mode 100644 index 00000000000..acc0dc0a3c1 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 CustomRole model. + */ +public class CustomRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCustomRole() throws Throwable { + CustomRole customRoleModel = new CustomRole(); + assertNull(customRoleModel.getDisplayName()); + assertNull(customRoleModel.getDescription()); + assertNull(customRoleModel.getActions()); + assertNull(customRoleModel.getName()); + assertNull(customRoleModel.getAccountId()); + assertNull(customRoleModel.getServiceName()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java new file mode 100644 index 00000000000..1a38606ede5 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlAssignmentOptions model. + */ +public class DeleteActionControlAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteActionControlAssignmentOptions() throws Throwable { + DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptionsModel = new DeleteActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(deleteActionControlAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlAssignmentOptionsError() throws Throwable { + new DeleteActionControlAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..75b111e9214 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlTemplateOptions model. + */ +public class DeleteActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteActionControlTemplateOptions() throws Throwable { + DeleteActionControlTemplateOptions deleteActionControlTemplateOptionsModel = new DeleteActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .build(); + assertEquals(deleteActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlTemplateOptionsError() throws Throwable { + new DeleteActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..64fb5790244 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlTemplateVersionOptions model. + */ +public class DeleteActionControlTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteActionControlTemplateVersionOptions() throws Throwable { + DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptionsModel = new DeleteActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + assertEquals(deleteActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(deleteActionControlTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlTemplateVersionOptionsError() throws Throwable { + new DeleteActionControlTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java new file mode 100644 index 00000000000..75aed905222 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyAssignmentOptions model. + */ +public class DeletePolicyAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeletePolicyAssignmentOptions() throws Throwable { + DeletePolicyAssignmentOptions deletePolicyAssignmentOptionsModel = new DeletePolicyAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(deletePolicyAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyAssignmentOptionsError() throws Throwable { + new DeletePolicyAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java new file mode 100644 index 00000000000..1b130eb0f79 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyOptions model. + */ +public class DeletePolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeletePolicyOptions() throws Throwable { + DeletePolicyOptions deletePolicyOptionsModel = new DeletePolicyOptions.Builder() + .policyId("testString") + .build(); + assertEquals(deletePolicyOptionsModel.policyId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyOptionsError() throws Throwable { + new DeletePolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..288517222aa --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyTemplateOptions model. + */ +public class DeletePolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeletePolicyTemplateOptions() throws Throwable { + DeletePolicyTemplateOptions deletePolicyTemplateOptionsModel = new DeletePolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .build(); + assertEquals(deletePolicyTemplateOptionsModel.policyTemplateId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyTemplateOptionsError() throws Throwable { + new DeletePolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..7b1c6cffa1d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyTemplateVersionOptions model. + */ +public class DeletePolicyTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeletePolicyTemplateVersionOptions() throws Throwable { + DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptionsModel = new DeletePolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + assertEquals(deletePolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); + assertEquals(deletePolicyTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyTemplateVersionOptionsError() throws Throwable { + new DeletePolicyTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java new file mode 100644 index 00000000000..7f9b614304f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleAssignmentOptions model. + */ +public class DeleteRoleAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteRoleAssignmentOptions() throws Throwable { + DeleteRoleAssignmentOptions deleteRoleAssignmentOptionsModel = new DeleteRoleAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(deleteRoleAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleAssignmentOptionsError() throws Throwable { + new DeleteRoleAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java new file mode 100644 index 00000000000..9c6690cda7b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleOptions model. + */ +public class DeleteRoleOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteRoleOptions() throws Throwable { + DeleteRoleOptions deleteRoleOptionsModel = new DeleteRoleOptions.Builder() + .roleId("testString") + .build(); + assertEquals(deleteRoleOptionsModel.roleId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleOptionsError() throws Throwable { + new DeleteRoleOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..3fc04286ed3 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleTemplateOptions model. + */ +public class DeleteRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteRoleTemplateOptions() throws Throwable { + DeleteRoleTemplateOptions deleteRoleTemplateOptionsModel = new DeleteRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .build(); + assertEquals(deleteRoleTemplateOptionsModel.roleTemplateId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleTemplateOptionsError() throws Throwable { + new DeleteRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..ff652fa335c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleTemplateVersionOptions model. + */ +public class DeleteRoleTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteRoleTemplateVersionOptions() throws Throwable { + DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptionsModel = new DeleteRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + assertEquals(deleteRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); + assertEquals(deleteRoleTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleTemplateVersionOptionsError() throws Throwable { + new DeleteRoleTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java new file mode 100644 index 00000000000..6a33aa8f116 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteV2PolicyOptions model. + */ +public class DeleteV2PolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteV2PolicyOptions() throws Throwable { + DeleteV2PolicyOptions deleteV2PolicyOptionsModel = new DeleteV2PolicyOptions.Builder() + .id("testString") + .build(); + assertEquals(deleteV2PolicyOptionsModel.id(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteV2PolicyOptionsError() throws Throwable { + new DeleteV2PolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java new file mode 100644 index 00000000000..104a5210ed9 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.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 EnrichedRoles model. + */ +public class EnrichedRolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testEnrichedRoles() throws Throwable { + EnrichedRoles enrichedRolesModel = new EnrichedRoles(); + assertNull(enrichedRolesModel.getRoleId()); + assertNull(enrichedRolesModel.getActions()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java new file mode 100644 index 00000000000..460b37f8105 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.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 ErrorDetails model. + */ +public class ErrorDetailsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testErrorDetails() throws Throwable { + ErrorDetails errorDetailsModel = new ErrorDetails(); + assertNull(errorDetailsModel.getConflictsWith()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java new file mode 100644 index 00000000000..e7f7f9afbfc --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.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 ErrorObject model. + */ +public class ErrorObjectTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testErrorObject() throws Throwable { + ErrorObject errorObjectModel = new ErrorObject(); + assertNull(errorObjectModel.getCode()); + assertNull(errorObjectModel.getMessage()); + assertNull(errorObjectModel.getDetails()); + assertNull(errorObjectModel.getMoreInfo()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java new file mode 100644 index 00000000000..90c91c8fcaf --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; +import com.ibm.cloud.platform_services.iam_policy_management.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 ExternalAccountIdentityInteractionPatch model. + */ +public class ExternalAccountIdentityInteractionPatchTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testExternalAccountIdentityInteractionPatch() throws Throwable { + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + assertEquals(identityTypesBaseModel.state(), "enabled"); + assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); + + IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() + .user(identityTypesBaseModel) + .serviceId(identityTypesBaseModel) + .service(identityTypesBaseModel) + .build(); + assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); + + ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() + .identityTypes(identityTypesPatchModel) + .build(); + assertEquals(externalAccountIdentityInteractionPatchModel.identityTypes(), identityTypesPatchModel); + + String json = TestUtilities.serialize(externalAccountIdentityInteractionPatchModel); + + ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModelNew = TestUtilities.deserialize(json, ExternalAccountIdentityInteractionPatch.class); + assertTrue(externalAccountIdentityInteractionPatchModelNew instanceof ExternalAccountIdentityInteractionPatch); + assertEquals(externalAccountIdentityInteractionPatchModelNew.identityTypes().toString(), identityTypesPatchModel.toString()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java new file mode 100644 index 00000000000..2e4aaef7e07 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.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 ExternalAccountIdentityInteraction model. + */ +public class ExternalAccountIdentityInteractionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testExternalAccountIdentityInteraction() throws Throwable { + ExternalAccountIdentityInteraction externalAccountIdentityInteractionModel = new ExternalAccountIdentityInteraction(); + assertNull(externalAccountIdentityInteractionModel.getIdentityTypes()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java new file mode 100644 index 00000000000..b4d68673091 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java @@ -0,0 +1,36 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.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 First model. + */ +public class FirstTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testFirst() throws Throwable { + First firstModel = new First(); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java new file mode 100644 index 00000000000..73e66a5a756 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlAssignmentOptions model. + */ +public class GetActionControlAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetActionControlAssignmentOptions() throws Throwable { + GetActionControlAssignmentOptions getActionControlAssignmentOptionsModel = new GetActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(getActionControlAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlAssignmentOptionsError() throws Throwable { + new GetActionControlAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..d6e66ce6939 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlTemplateOptions model. + */ +public class GetActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetActionControlTemplateOptions() throws Throwable { + GetActionControlTemplateOptions getActionControlTemplateOptionsModel = new GetActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .build(); + assertEquals(getActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(getActionControlTemplateOptionsModel.state(), "active"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlTemplateOptionsError() throws Throwable { + new GetActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..ac8e17fe083 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlTemplateVersionOptions model. + */ +public class GetActionControlTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetActionControlTemplateVersionOptions() throws Throwable { + GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptionsModel = new GetActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + assertEquals(getActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(getActionControlTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlTemplateVersionOptionsError() throws Throwable { + new GetActionControlTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java new file mode 100644 index 00000000000..6b2a479c37d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyAssignmentOptions model. + */ +public class GetPolicyAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetPolicyAssignmentOptions() throws Throwable { + GetPolicyAssignmentOptions getPolicyAssignmentOptionsModel = new GetPolicyAssignmentOptions.Builder() + .assignmentId("testString") + .version("1.0") + .build(); + assertEquals(getPolicyAssignmentOptionsModel.assignmentId(), "testString"); + assertEquals(getPolicyAssignmentOptionsModel.version(), "1.0"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyAssignmentOptionsError() throws Throwable { + new GetPolicyAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java new file mode 100644 index 00000000000..2a7348c2c2d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyOptions model. + */ +public class GetPolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetPolicyOptions() throws Throwable { + GetPolicyOptions getPolicyOptionsModel = new GetPolicyOptions.Builder() + .policyId("testString") + .build(); + assertEquals(getPolicyOptionsModel.policyId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyOptionsError() throws Throwable { + new GetPolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..06535ed77ed --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyTemplateOptions model. + */ +public class GetPolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetPolicyTemplateOptions() throws Throwable { + GetPolicyTemplateOptions getPolicyTemplateOptionsModel = new GetPolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .state("active") + .build(); + assertEquals(getPolicyTemplateOptionsModel.policyTemplateId(), "testString"); + assertEquals(getPolicyTemplateOptionsModel.state(), "active"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyTemplateOptionsError() throws Throwable { + new GetPolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..264b5db4912 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyTemplateVersionOptions model. + */ +public class GetPolicyTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetPolicyTemplateVersionOptions() throws Throwable { + GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptionsModel = new GetPolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + assertEquals(getPolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); + assertEquals(getPolicyTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyTemplateVersionOptionsError() throws Throwable { + new GetPolicyTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java new file mode 100644 index 00000000000..0c1f6b2bb5a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleAssignmentOptions model. + */ +public class GetRoleAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetRoleAssignmentOptions() throws Throwable { + GetRoleAssignmentOptions getRoleAssignmentOptionsModel = new GetRoleAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(getRoleAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleAssignmentOptionsError() throws Throwable { + new GetRoleAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java new file mode 100644 index 00000000000..e589b8d1285 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleOptions model. + */ +public class GetRoleOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetRoleOptions() throws Throwable { + GetRoleOptions getRoleOptionsModel = new GetRoleOptions.Builder() + .roleId("testString") + .build(); + assertEquals(getRoleOptionsModel.roleId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleOptionsError() throws Throwable { + new GetRoleOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..3c10b5207dc --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleTemplateOptions model. + */ +public class GetRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetRoleTemplateOptions() throws Throwable { + GetRoleTemplateOptions getRoleTemplateOptionsModel = new GetRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .state("active") + .build(); + assertEquals(getRoleTemplateOptionsModel.roleTemplateId(), "testString"); + assertEquals(getRoleTemplateOptionsModel.state(), "active"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleTemplateOptionsError() throws Throwable { + new GetRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..3bd5d278630 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleTemplateVersionOptions model. + */ +public class GetRoleTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetRoleTemplateVersionOptions() throws Throwable { + GetRoleTemplateVersionOptions getRoleTemplateVersionOptionsModel = new GetRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + assertEquals(getRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); + assertEquals(getRoleTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleTemplateVersionOptionsError() throws Throwable { + new GetRoleTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java new file mode 100644 index 00000000000..00f780c4153 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetSettingsOptions model. + */ +public class GetSettingsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetSettingsOptions() throws Throwable { + GetSettingsOptions getSettingsOptionsModel = new GetSettingsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .build(); + assertEquals(getSettingsOptionsModel.accountId(), "testString"); + assertEquals(getSettingsOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetSettingsOptionsError() throws Throwable { + new GetSettingsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java new file mode 100644 index 00000000000..ebad7af7371 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetV2PolicyOptions model. + */ +public class GetV2PolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetV2PolicyOptions() throws Throwable { + GetV2PolicyOptions getV2PolicyOptionsModel = new GetV2PolicyOptions.Builder() + .id("testString") + .format("include_last_permit") + .build(); + assertEquals(getV2PolicyOptionsModel.id(), "testString"); + assertEquals(getV2PolicyOptionsModel.format(), "include_last_permit"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetV2PolicyOptionsError() throws Throwable { + new GetV2PolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java new file mode 100644 index 00000000000..f627a54ecc2 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 Grant model. + */ +public class GrantTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGrant() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + + String json = TestUtilities.serialize(grantModel); + + Grant grantModelNew = TestUtilities.deserialize(json, Grant.class); + assertTrue(grantModelNew instanceof Grant); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGrantError() throws Throwable { + new Grant.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java new file mode 100644 index 00000000000..f86af34fab8 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.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 GrantWithEnrichedRoles model. + */ +public class GrantWithEnrichedRolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGrantWithEnrichedRoles() throws Throwable { + GrantWithEnrichedRoles grantWithEnrichedRolesModel = new GrantWithEnrichedRoles(); + assertNull(grantWithEnrichedRolesModel.getRoles()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java new file mode 100644 index 00000000000..2a4d38de51a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypesBase model. + */ +public class IdentityTypesBaseTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testIdentityTypesBase() throws Throwable { + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + assertEquals(identityTypesBaseModel.state(), "enabled"); + assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(identityTypesBaseModel); + + IdentityTypesBase identityTypesBaseModelNew = TestUtilities.deserialize(json, IdentityTypesBase.class); + assertTrue(identityTypesBaseModelNew instanceof IdentityTypesBase); + assertEquals(identityTypesBaseModelNew.state(), "enabled"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testIdentityTypesBaseError() throws Throwable { + new IdentityTypesBase.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java new file mode 100644 index 00000000000..3e762536695 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java @@ -0,0 +1,59 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; +import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypesPatch model. + */ +public class IdentityTypesPatchTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testIdentityTypesPatch() throws Throwable { + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + assertEquals(identityTypesBaseModel.state(), "enabled"); + assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); + + IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() + .user(identityTypesBaseModel) + .serviceId(identityTypesBaseModel) + .service(identityTypesBaseModel) + .build(); + assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); + + String json = TestUtilities.serialize(identityTypesPatchModel); + + IdentityTypesPatch identityTypesPatchModelNew = TestUtilities.deserialize(json, IdentityTypesPatch.class); + assertTrue(identityTypesPatchModelNew instanceof IdentityTypesPatch); + assertEquals(identityTypesPatchModelNew.user().toString(), identityTypesBaseModel.toString()); + assertEquals(identityTypesPatchModelNew.serviceId().toString(), identityTypesBaseModel.toString()); + assertEquals(identityTypesPatchModelNew.service().toString(), identityTypesBaseModel.toString()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java new file mode 100644 index 00000000000..e2b6c77338f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypes model. + */ +public class IdentityTypesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testIdentityTypes() throws Throwable { + IdentityTypes identityTypesModel = new IdentityTypes(); + assertNull(identityTypesModel.getUser()); + assertNull(identityTypesModel.getServiceId()); + assertNull(identityTypesModel.getService()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java new file mode 100644 index 00000000000..c3f51516e25 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java @@ -0,0 +1,36 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; +import com.ibm.cloud.platform_services.iam_policy_management.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 LimitData model. + */ +public class LimitDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testLimitData() throws Throwable { + LimitData limitDataModel = new LimitData(); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java new file mode 100644 index 00000000000..0d64653d829 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlAssignmentsOptions model. + */ +public class ListActionControlAssignmentsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListActionControlAssignmentsOptions() throws Throwable { + ListActionControlAssignmentsOptions listActionControlAssignmentsOptionsModel = new ListActionControlAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listActionControlAssignmentsOptionsModel.accountId(), "testString"); + assertEquals(listActionControlAssignmentsOptionsModel.acceptLanguage(), "default"); + assertEquals(listActionControlAssignmentsOptionsModel.templateId(), "testString"); + assertEquals(listActionControlAssignmentsOptionsModel.templateVersion(), "testString"); + assertEquals(listActionControlAssignmentsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listActionControlAssignmentsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlAssignmentsOptionsError() throws Throwable { + new ListActionControlAssignmentsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java new file mode 100644 index 00000000000..dfe91662d83 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlTemplateVersionsOptions model. + */ +public class ListActionControlTemplateVersionsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListActionControlTemplateVersionsOptions() throws Throwable { + ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptionsModel = new ListActionControlTemplateVersionsOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listActionControlTemplateVersionsOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(listActionControlTemplateVersionsOptionsModel.state(), "active"); + assertEquals(listActionControlTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listActionControlTemplateVersionsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlTemplateVersionsOptionsError() throws Throwable { + new ListActionControlTemplateVersionsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java new file mode 100644 index 00000000000..9e2e6a18158 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlTemplatesOptions model. + */ +public class ListActionControlTemplatesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListActionControlTemplatesOptions() throws Throwable { + ListActionControlTemplatesOptions listActionControlTemplatesOptionsModel = new ListActionControlTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listActionControlTemplatesOptionsModel.accountId(), "testString"); + assertEquals(listActionControlTemplatesOptionsModel.acceptLanguage(), "default"); + assertEquals(listActionControlTemplatesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listActionControlTemplatesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlTemplatesOptionsError() throws Throwable { + new ListActionControlTemplatesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java new file mode 100644 index 00000000000..8bfe5000355 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListPoliciesOptions model. + */ +public class ListPoliciesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListPoliciesOptions() throws Throwable { + ListPoliciesOptions listPoliciesOptionsModel = new ListPoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .tagName("testString") + .tagValue("testString") + .sort("id") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listPoliciesOptionsModel.accountId(), "testString"); + assertEquals(listPoliciesOptionsModel.acceptLanguage(), "default"); + assertEquals(listPoliciesOptionsModel.iamId(), "testString"); + assertEquals(listPoliciesOptionsModel.accessGroupId(), "testString"); + assertEquals(listPoliciesOptionsModel.type(), "access"); + assertEquals(listPoliciesOptionsModel.serviceType(), "service"); + assertEquals(listPoliciesOptionsModel.tagName(), "testString"); + assertEquals(listPoliciesOptionsModel.tagValue(), "testString"); + assertEquals(listPoliciesOptionsModel.sort(), "id"); + assertEquals(listPoliciesOptionsModel.format(), "include_last_permit"); + assertEquals(listPoliciesOptionsModel.state(), "active"); + assertEquals(listPoliciesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listPoliciesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPoliciesOptionsError() throws Throwable { + new ListPoliciesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java new file mode 100644 index 00000000000..32729befeda --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyAssignmentsOptions model. + */ +public class ListPolicyAssignmentsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListPolicyAssignmentsOptions() throws Throwable { + ListPolicyAssignmentsOptions listPolicyAssignmentsOptionsModel = new ListPolicyAssignmentsOptions.Builder() + .version("1.0") + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listPolicyAssignmentsOptionsModel.version(), "1.0"); + assertEquals(listPolicyAssignmentsOptionsModel.accountId(), "testString"); + assertEquals(listPolicyAssignmentsOptionsModel.acceptLanguage(), "default"); + assertEquals(listPolicyAssignmentsOptionsModel.templateId(), "testString"); + assertEquals(listPolicyAssignmentsOptionsModel.templateVersion(), "testString"); + assertEquals(listPolicyAssignmentsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listPolicyAssignmentsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyAssignmentsOptionsError() throws Throwable { + new ListPolicyAssignmentsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java new file mode 100644 index 00000000000..1053d41b84b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyTemplateVersionsOptions model. + */ +public class ListPolicyTemplateVersionsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListPolicyTemplateVersionsOptions() throws Throwable { + ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptionsModel = new ListPolicyTemplateVersionsOptions.Builder() + .policyTemplateId("testString") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listPolicyTemplateVersionsOptionsModel.policyTemplateId(), "testString"); + assertEquals(listPolicyTemplateVersionsOptionsModel.state(), "active"); + assertEquals(listPolicyTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listPolicyTemplateVersionsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyTemplateVersionsOptionsError() throws Throwable { + new ListPolicyTemplateVersionsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java new file mode 100644 index 00000000000..5065a9d9495 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyTemplatesOptions model. + */ +public class ListPolicyTemplatesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListPolicyTemplatesOptions() throws Throwable { + ListPolicyTemplatesOptions listPolicyTemplatesOptionsModel = new ListPolicyTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .state("active") + .name("testString") + .policyServiceType("service") + .policyServiceName("testString") + .policyServiceGroupId("testString") + .policyType("access") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listPolicyTemplatesOptionsModel.accountId(), "testString"); + assertEquals(listPolicyTemplatesOptionsModel.acceptLanguage(), "default"); + assertEquals(listPolicyTemplatesOptionsModel.state(), "active"); + assertEquals(listPolicyTemplatesOptionsModel.name(), "testString"); + assertEquals(listPolicyTemplatesOptionsModel.policyServiceType(), "service"); + assertEquals(listPolicyTemplatesOptionsModel.policyServiceName(), "testString"); + assertEquals(listPolicyTemplatesOptionsModel.policyServiceGroupId(), "testString"); + assertEquals(listPolicyTemplatesOptionsModel.policyType(), "access"); + assertEquals(listPolicyTemplatesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listPolicyTemplatesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyTemplatesOptionsError() throws Throwable { + new ListPolicyTemplatesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java new file mode 100644 index 00000000000..bd82df9bfd5 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleAssignmentsOptions model. + */ +public class ListRoleAssignmentsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListRoleAssignmentsOptions() throws Throwable { + ListRoleAssignmentsOptions listRoleAssignmentsOptionsModel = new ListRoleAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listRoleAssignmentsOptionsModel.accountId(), "testString"); + assertEquals(listRoleAssignmentsOptionsModel.acceptLanguage(), "default"); + assertEquals(listRoleAssignmentsOptionsModel.templateId(), "testString"); + assertEquals(listRoleAssignmentsOptionsModel.templateVersion(), "testString"); + assertEquals(listRoleAssignmentsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listRoleAssignmentsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleAssignmentsOptionsError() throws Throwable { + new ListRoleAssignmentsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java new file mode 100644 index 00000000000..2e89527b653 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleTemplateVersionsOptions model. + */ +public class ListRoleTemplateVersionsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListRoleTemplateVersionsOptions() throws Throwable { + ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptionsModel = new ListRoleTemplateVersionsOptions.Builder() + .roleTemplateId("testString") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listRoleTemplateVersionsOptionsModel.roleTemplateId(), "testString"); + assertEquals(listRoleTemplateVersionsOptionsModel.state(), "active"); + assertEquals(listRoleTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listRoleTemplateVersionsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleTemplateVersionsOptionsError() throws Throwable { + new ListRoleTemplateVersionsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java new file mode 100644 index 00000000000..21d23a7be0f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java @@ -0,0 +1,59 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleTemplatesOptions model. + */ +public class ListRoleTemplatesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListRoleTemplatesOptions() throws Throwable { + ListRoleTemplatesOptions listRoleTemplatesOptionsModel = new ListRoleTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .name("testString") + .roleName("testString") + .roleServiceName("testString") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listRoleTemplatesOptionsModel.accountId(), "testString"); + assertEquals(listRoleTemplatesOptionsModel.acceptLanguage(), "default"); + assertEquals(listRoleTemplatesOptionsModel.name(), "testString"); + assertEquals(listRoleTemplatesOptionsModel.roleName(), "testString"); + assertEquals(listRoleTemplatesOptionsModel.roleServiceName(), "testString"); + assertEquals(listRoleTemplatesOptionsModel.state(), "active"); + assertEquals(listRoleTemplatesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listRoleTemplatesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleTemplatesOptionsError() throws Throwable { + new ListRoleTemplatesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java new file mode 100644 index 00000000000..4fb97c7fc9a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListRolesOptions model. + */ +public class ListRolesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListRolesOptions() throws Throwable { + ListRolesOptions listRolesOptionsModel = new ListRolesOptions.Builder() + .acceptLanguage("default") + .accountId("testString") + .serviceName("iam-groups") + .sourceServiceName("iam-groups") + .policyType("authorization") + .serviceGroupId("IAM") + .build(); + assertEquals(listRolesOptionsModel.acceptLanguage(), "default"); + assertEquals(listRolesOptionsModel.accountId(), "testString"); + assertEquals(listRolesOptionsModel.serviceName(), "iam-groups"); + assertEquals(listRolesOptionsModel.sourceServiceName(), "iam-groups"); + assertEquals(listRolesOptionsModel.policyType(), "authorization"); + assertEquals(listRolesOptionsModel.serviceGroupId(), "IAM"); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java new file mode 100644 index 00000000000..8c72945373b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListV2PoliciesOptions model. + */ +public class ListV2PoliciesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListV2PoliciesOptions() throws Throwable { + ListV2PoliciesOptions listV2PoliciesOptionsModel = new ListV2PoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .serviceName("testString") + .serviceGroupId("testString") + .sort("testString") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listV2PoliciesOptionsModel.accountId(), "testString"); + assertEquals(listV2PoliciesOptionsModel.acceptLanguage(), "default"); + assertEquals(listV2PoliciesOptionsModel.iamId(), "testString"); + assertEquals(listV2PoliciesOptionsModel.accessGroupId(), "testString"); + assertEquals(listV2PoliciesOptionsModel.type(), "access"); + assertEquals(listV2PoliciesOptionsModel.serviceType(), "service"); + assertEquals(listV2PoliciesOptionsModel.serviceName(), "testString"); + assertEquals(listV2PoliciesOptionsModel.serviceGroupId(), "testString"); + assertEquals(listV2PoliciesOptionsModel.sort(), "testString"); + assertEquals(listV2PoliciesOptionsModel.format(), "include_last_permit"); + assertEquals(listV2PoliciesOptionsModel.state(), "active"); + assertEquals(listV2PoliciesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listV2PoliciesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListV2PoliciesOptionsError() throws Throwable { + new ListV2PoliciesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java new file mode 100644 index 00000000000..0661d4245a2 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 NestedConditionRuleAttribute model. + */ +public class NestedConditionRuleAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testNestedConditionRuleAttribute() throws Throwable { + NestedConditionRuleAttribute nestedConditionRuleAttributeModel = new NestedConditionRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(nestedConditionRuleAttributeModel.key(), "testString"); + assertEquals(nestedConditionRuleAttributeModel.operator(), "stringEquals"); + assertEquals(nestedConditionRuleAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(nestedConditionRuleAttributeModel); + + NestedConditionRuleAttribute nestedConditionRuleAttributeModelNew = TestUtilities.deserialize(json, NestedConditionRuleAttribute.class); + assertTrue(nestedConditionRuleAttributeModelNew instanceof NestedConditionRuleAttribute); + assertEquals(nestedConditionRuleAttributeModelNew.key(), "testString"); + assertEquals(nestedConditionRuleAttributeModelNew.operator(), "stringEquals"); + assertEquals(nestedConditionRuleAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testNestedConditionRuleAttributeError() throws Throwable { + new NestedConditionRuleAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java new file mode 100644 index 00000000000..1ba394dbb7d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleWithConditions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 NestedConditionRuleWithConditions model. + */ +public class NestedConditionRuleWithConditionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testNestedConditionRuleWithConditions() throws Throwable { + RuleAttribute ruleAttributeModel = new RuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(ruleAttributeModel.key(), "testString"); + assertEquals(ruleAttributeModel.operator(), "stringEquals"); + assertEquals(ruleAttributeModel.value(), "testString"); + + NestedConditionRuleWithConditions nestedConditionRuleWithConditionsModel = new NestedConditionRuleWithConditions.Builder() + .operator("and") + .conditions(java.util.Arrays.asList(ruleAttributeModel)) + .build(); + assertEquals(nestedConditionRuleWithConditionsModel.operator(), "and"); + assertEquals(nestedConditionRuleWithConditionsModel.conditions(), java.util.Arrays.asList(ruleAttributeModel)); + + String json = TestUtilities.serialize(nestedConditionRuleWithConditionsModel); + + NestedConditionRuleWithConditions nestedConditionRuleWithConditionsModelNew = TestUtilities.deserialize(json, NestedConditionRuleWithConditions.class); + assertTrue(nestedConditionRuleWithConditionsModelNew instanceof NestedConditionRuleWithConditions); + assertEquals(nestedConditionRuleWithConditionsModelNew.operator(), "and"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testNestedConditionRuleWithConditionsError() throws Throwable { + new NestedConditionRuleWithConditions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java new file mode 100644 index 00000000000..4956eea2675 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedCondition; +import com.ibm.cloud.platform_services.iam_policy_management.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 NestedCondition model. + */ +public class NestedConditionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testNestedCondition() throws Throwable { + NestedCondition nestedConditionModel = new NestedCondition(); + assertNotNull(nestedConditionModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java new file mode 100644 index 00000000000..c5e084a44d5 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.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 Next model. + */ +public class NextTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testNext() throws Throwable { + Next nextModel = new Next(); + assertNull(nextModel.getStart()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java new file mode 100644 index 00000000000..d5b05ede760 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentResourcePolicy model. + */ +public class PolicyAssignmentResourcePolicyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentResourcePolicy() throws Throwable { + PolicyAssignmentResourcePolicy policyAssignmentResourcePolicyModel = new PolicyAssignmentResourcePolicy(); + assertNull(policyAssignmentResourcePolicyModel.getResourceCreated()); + assertNull(policyAssignmentResourcePolicyModel.getStatus()); + assertNull(policyAssignmentResourcePolicyModel.getErrorMessage()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java new file mode 100644 index 00000000000..8b146425617 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentResources model. + */ +public class PolicyAssignmentResourcesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentResources() throws Throwable { + PolicyAssignmentResources policyAssignmentResourcesModel = new PolicyAssignmentResources(); + assertNull(policyAssignmentResourcesModel.getTarget()); + assertNull(policyAssignmentResourcesModel.getPolicy()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java new file mode 100644 index 00000000000..8a3a6b67703 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Collection model. + */ +public class PolicyAssignmentV1CollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentV1Collection() throws Throwable { + PolicyAssignmentV1Collection policyAssignmentV1CollectionModel = new PolicyAssignmentV1Collection(); + assertNull(policyAssignmentV1CollectionModel.getLimit()); + assertNull(policyAssignmentV1CollectionModel.getFirst()); + assertNull(policyAssignmentV1CollectionModel.getNext()); + assertNull(policyAssignmentV1CollectionModel.getPrevious()); + assertNull(policyAssignmentV1CollectionModel.getAssignments()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java new file mode 100644 index 00000000000..56c843a232e --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Resources model. + */ +public class PolicyAssignmentV1ResourcesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentV1Resources() throws Throwable { + PolicyAssignmentV1Resources policyAssignmentV1ResourcesModel = new PolicyAssignmentV1Resources(); + assertNull(policyAssignmentV1ResourcesModel.getTarget()); + assertNull(policyAssignmentV1ResourcesModel.getPolicy()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java new file mode 100644 index 00000000000..f5d14b29447 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java @@ -0,0 +1,36 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Subject model. + */ +public class PolicyAssignmentV1SubjectTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentV1Subject() throws Throwable { + PolicyAssignmentV1Subject policyAssignmentV1SubjectModel = new PolicyAssignmentV1Subject(); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java new file mode 100644 index 00000000000..d9889483421 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1 model. + */ +public class PolicyAssignmentV1Test { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentV1() throws Throwable { + PolicyAssignmentV1 policyAssignmentV1Model = new PolicyAssignmentV1(); + assertNull(policyAssignmentV1Model.getTarget()); + assertNull(policyAssignmentV1Model.getResources()); + assertNull(policyAssignmentV1Model.getSubject()); + assertNull(policyAssignmentV1Model.getTemplate()); + assertNull(policyAssignmentV1Model.getStatus()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java new file mode 100644 index 00000000000..3d372dfaf20 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java @@ -0,0 +1,52 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyCollection model. + */ +public class PolicyCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyCollection() throws Throwable { + PolicyCollection policyCollectionModel = new PolicyCollection(); + assertNull(policyCollectionModel.getLimit()); + assertNull(policyCollectionModel.getFirst()); + assertNull(policyCollectionModel.getNext()); + assertNull(policyCollectionModel.getPrevious()); + assertNull(policyCollectionModel.getPolicies()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java new file mode 100644 index 00000000000..cb2f203a5c3 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java @@ -0,0 +1,72 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyResource model. + */ +public class PolicyResourceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyResource() throws Throwable { + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceAttributeModel.name(), "testString"); + assertEquals(resourceAttributeModel.value(), "testString"); + assertEquals(resourceAttributeModel.operator(), "testString"); + + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceTagModel.name(), "testString"); + assertEquals(resourceTagModel.value(), "testString"); + assertEquals(resourceTagModel.operator(), "testString"); + + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); + assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); + + String json = TestUtilities.serialize(policyResourceModel); + + PolicyResource policyResourceModelNew = TestUtilities.deserialize(json, PolicyResource.class); + assertTrue(policyResourceModelNew instanceof PolicyResource); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPolicyResourceError() throws Throwable { + new PolicyResource.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java new file mode 100644 index 00000000000..299e15b1fd4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyRole model. + */ +public class PolicyRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyRole() throws Throwable { + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + assertEquals(policyRoleModel.roleId(), "testString"); + + String json = TestUtilities.serialize(policyRoleModel); + + PolicyRole policyRoleModelNew = TestUtilities.deserialize(json, PolicyRole.class); + assertTrue(policyRoleModelNew instanceof PolicyRole); + assertEquals(policyRoleModelNew.roleId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPolicyRoleError() throws Throwable { + new PolicyRole.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java new file mode 100644 index 00000000000..6d0a937bd53 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java @@ -0,0 +1,58 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicySubject model. + */ +public class PolicySubjectTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicySubject() throws Throwable { + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(subjectAttributeModel.name(), "testString"); + assertEquals(subjectAttributeModel.value(), "testString"); + + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); + + String json = TestUtilities.serialize(policySubjectModel); + + PolicySubject policySubjectModelNew = TestUtilities.deserialize(json, PolicySubject.class); + assertTrue(policySubjectModelNew instanceof PolicySubject); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPolicySubjectError() throws Throwable { + new PolicySubject.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java new file mode 100644 index 00000000000..8cb98be3d32 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentCollection model. + */ +public class PolicyTemplateAssignmentCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateAssignmentCollection() throws Throwable { + PolicyTemplateAssignmentCollection policyTemplateAssignmentCollectionModel = new PolicyTemplateAssignmentCollection(); + assertNull(policyTemplateAssignmentCollectionModel.getLimit()); + assertNull(policyTemplateAssignmentCollectionModel.getFirst()); + assertNull(policyTemplateAssignmentCollectionModel.getNext()); + assertNull(policyTemplateAssignmentCollectionModel.getPrevious()); + assertNull(policyTemplateAssignmentCollectionModel.getAssignments()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java new file mode 100644 index 00000000000..fded12633d2 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItemsPolicyAssignment model. + */ +public class PolicyTemplateAssignmentItemsPolicyAssignmentTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateAssignmentItemsPolicyAssignment() throws Throwable { + PolicyTemplateAssignmentItemsPolicyAssignment policyTemplateAssignmentItemsPolicyAssignmentModel = new PolicyTemplateAssignmentItemsPolicyAssignment(); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTemplateId()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTemplateVersion()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getAssignmentId()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTargetType()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTarget()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getResources()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getStatus()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java new file mode 100644 index 00000000000..6b74125d238 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItemsPolicyAssignmentV1 model. + */ +public class PolicyTemplateAssignmentItemsPolicyAssignmentV1Test { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateAssignmentItemsPolicyAssignmentV1() throws Throwable { + PolicyTemplateAssignmentItemsPolicyAssignmentV1 policyTemplateAssignmentItemsPolicyAssignmentV1Model = new PolicyTemplateAssignmentItemsPolicyAssignmentV1(); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getTarget()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getResources()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getSubject()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getTemplate()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getStatus()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java new file mode 100644 index 00000000000..05b400e91c1 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java @@ -0,0 +1,48 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItems model. + */ +public class PolicyTemplateAssignmentItemsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testPolicyTemplateAssignmentItems() throws Throwable { + PolicyTemplateAssignmentItems policyTemplateAssignmentItemsModel = new PolicyTemplateAssignmentItems(); + assertNotNull(policyTemplateAssignmentItemsModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java new file mode 100644 index 00000000000..52041b1a6a3 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateCollection model. + */ +public class PolicyTemplateCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateCollection() throws Throwable { + PolicyTemplateCollection policyTemplateCollectionModel = new PolicyTemplateCollection(); + assertNull(policyTemplateCollectionModel.getLimit()); + assertNull(policyTemplateCollectionModel.getFirst()); + assertNull(policyTemplateCollectionModel.getNext()); + assertNull(policyTemplateCollectionModel.getPrevious()); + assertNull(policyTemplateCollectionModel.getPolicyTemplates()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java new file mode 100644 index 00000000000..b6ee06990a2 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateLimitData model. + */ +public class PolicyTemplateLimitDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateLimitData() throws Throwable { + PolicyTemplateLimitData policyTemplateLimitDataModel = new PolicyTemplateLimitData(); + assertNull(policyTemplateLimitDataModel.getName()); + assertNull(policyTemplateLimitDataModel.getDescription()); + assertNull(policyTemplateLimitDataModel.getAccountId()); + assertNull(policyTemplateLimitDataModel.getVersion()); + assertNull(policyTemplateLimitDataModel.isCommitted()); + assertNull(policyTemplateLimitDataModel.getPolicy()); + assertNull(policyTemplateLimitDataModel.getState()); + assertNull(policyTemplateLimitDataModel.getCounts()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java new file mode 100644 index 00000000000..edeb45c4d96 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateMetaData model. + */ +public class PolicyTemplateMetaDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateMetaData() throws Throwable { + PolicyTemplateMetaData policyTemplateMetaDataModel = new PolicyTemplateMetaData(); + assertNull(policyTemplateMetaDataModel.getType()); + assertNull(policyTemplateMetaDataModel.getDescription()); + assertNull(policyTemplateMetaDataModel.getSubjects()); + assertNull(policyTemplateMetaDataModel.getRoles()); + assertNull(policyTemplateMetaDataModel.getResources()); + assertNull(policyTemplateMetaDataModel.getState()); + assertNull(policyTemplateMetaDataModel.getTemplate()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java new file mode 100644 index 00000000000..c349e4a3415 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplate model. + */ +public class PolicyTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplate() throws Throwable { + PolicyTemplate policyTemplateModel = new PolicyTemplate(); + assertNull(policyTemplateModel.getName()); + assertNull(policyTemplateModel.getDescription()); + assertNull(policyTemplateModel.getAccountId()); + assertNull(policyTemplateModel.getVersion()); + assertNull(policyTemplateModel.isCommitted()); + assertNull(policyTemplateModel.getPolicy()); + assertNull(policyTemplateModel.getState()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java new file mode 100644 index 00000000000..da651956461 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateVersionsCollection model. + */ +public class PolicyTemplateVersionsCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateVersionsCollection() throws Throwable { + PolicyTemplateVersionsCollection policyTemplateVersionsCollectionModel = new PolicyTemplateVersionsCollection(); + assertNull(policyTemplateVersionsCollectionModel.getLimit()); + assertNull(policyTemplateVersionsCollectionModel.getFirst()); + assertNull(policyTemplateVersionsCollectionModel.getNext()); + assertNull(policyTemplateVersionsCollectionModel.getPrevious()); + assertNull(policyTemplateVersionsCollectionModel.getVersions()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java new file mode 100644 index 00000000000..28eba4f9a85 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java @@ -0,0 +1,48 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 Policy model. + */ +public class PolicyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicy() throws Throwable { + Policy policyModel = new Policy(); + assertNull(policyModel.getType()); + assertNull(policyModel.getDescription()); + assertNull(policyModel.getSubjects()); + assertNull(policyModel.getRoles()); + assertNull(policyModel.getResources()); + assertNull(policyModel.getState()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java new file mode 100644 index 00000000000..e3788c51212 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.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 Previous model. + */ +public class PreviousTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPrevious() throws Throwable { + Previous previousModel = new Previous(); + assertNull(previousModel.getStart()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..430f5f63764 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java @@ -0,0 +1,67 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceActionControlTemplateOptions model. + */ +public class ReplaceActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplaceActionControlTemplateOptions() throws Throwable { + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateActionControlModel.serviceName(), "testString"); + assertEquals(templateActionControlModel.description(), "testString"); + assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); + + ReplaceActionControlTemplateOptions replaceActionControlTemplateOptionsModel = new ReplaceActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .actionControl(templateActionControlModel) + .committed(true) + .build(); + assertEquals(replaceActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.version(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.ifMatch(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.name(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.description(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.actionControl(), templateActionControlModel); + assertEquals(replaceActionControlTemplateOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceActionControlTemplateOptionsError() throws Throwable { + new ReplaceActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java new file mode 100644 index 00000000000..2f20b05f37c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java @@ -0,0 +1,105 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplacePolicyOptions model. + */ +public class ReplacePolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplacePolicyOptions() throws Throwable { + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(subjectAttributeModel.name(), "testString"); + assertEquals(subjectAttributeModel.value(), "testString"); + + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); + + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + assertEquals(policyRoleModel.roleId(), "testString"); + + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceAttributeModel.name(), "testString"); + assertEquals(resourceAttributeModel.value(), "testString"); + assertEquals(resourceAttributeModel.operator(), "testString"); + + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceTagModel.name(), "testString"); + assertEquals(resourceTagModel.value(), "testString"); + assertEquals(resourceTagModel.operator(), "testString"); + + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); + assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); + + ReplacePolicyOptions replacePolicyOptionsModel = new ReplacePolicyOptions.Builder() + .policyId("testString") + .ifMatch("testString") + .type("testString") + .subjects(java.util.Arrays.asList(policySubjectModel)) + .roles(java.util.Arrays.asList(policyRoleModel)) + .resources(java.util.Arrays.asList(policyResourceModel)) + .description("testString") + .build(); + assertEquals(replacePolicyOptionsModel.policyId(), "testString"); + assertEquals(replacePolicyOptionsModel.ifMatch(), "testString"); + assertEquals(replacePolicyOptionsModel.type(), "testString"); + assertEquals(replacePolicyOptionsModel.subjects(), java.util.Arrays.asList(policySubjectModel)); + assertEquals(replacePolicyOptionsModel.roles(), java.util.Arrays.asList(policyRoleModel)); + assertEquals(replacePolicyOptionsModel.resources(), java.util.Arrays.asList(policyResourceModel)); + assertEquals(replacePolicyOptionsModel.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplacePolicyOptionsError() throws Throwable { + new ReplacePolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..2dc2430daca --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java @@ -0,0 +1,147 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplacePolicyTemplateOptions model. + */ +public class ReplacePolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplacePolicyTemplateOptions() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + assertEquals(templatePolicyModel.type(), "access"); + assertEquals(templatePolicyModel.description(), "testString"); + assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); + assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); + assertEquals(templatePolicyModel.pattern(), "testString"); + assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); + assertEquals(templatePolicyModel.control(), templateControlModel); + + ReplacePolicyTemplateOptions replacePolicyTemplateOptionsModel = new ReplacePolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .ifMatch("testString") + .policy(templatePolicyModel) + .name("testString") + .description("testString") + .committed(true) + .build(); + assertEquals(replacePolicyTemplateOptionsModel.policyTemplateId(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.version(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.ifMatch(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.policy(), templatePolicyModel); + assertEquals(replacePolicyTemplateOptionsModel.name(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.description(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplacePolicyTemplateOptionsError() throws Throwable { + new ReplacePolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java new file mode 100644 index 00000000000..9900abb2543 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceRoleOptions model. + */ +public class ReplaceRoleOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplaceRoleOptions() throws Throwable { + ReplaceRoleOptions replaceRoleOptionsModel = new ReplaceRoleOptions.Builder() + .roleId("testString") + .ifMatch("testString") + .displayName("testString") + .actions(java.util.Arrays.asList("testString")) + .description("testString") + .build(); + assertEquals(replaceRoleOptionsModel.roleId(), "testString"); + assertEquals(replaceRoleOptionsModel.ifMatch(), "testString"); + assertEquals(replaceRoleOptionsModel.displayName(), "testString"); + assertEquals(replaceRoleOptionsModel.actions(), java.util.Arrays.asList("testString")); + assertEquals(replaceRoleOptionsModel.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceRoleOptionsError() throws Throwable { + new ReplaceRoleOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..2f731aea7d4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceRoleTemplateOptions model. + */ +public class ReplaceRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplaceRoleTemplateOptions() throws Throwable { + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateRoleModel.displayName(), "testString"); + assertEquals(templateRoleModel.serviceName(), "testString"); + assertEquals(templateRoleModel.description(), "testString"); + assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); + + ReplaceRoleTemplateOptions replaceRoleTemplateOptionsModel = new ReplaceRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .role(templateRoleModel) + .committed(true) + .build(); + assertEquals(replaceRoleTemplateOptionsModel.roleTemplateId(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.version(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.ifMatch(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.name(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.description(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.role(), templateRoleModel); + assertEquals(replaceRoleTemplateOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceRoleTemplateOptionsError() throws Throwable { + new ReplaceRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java new file mode 100644 index 00000000000..23690eda780 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java @@ -0,0 +1,133 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceV2PolicyOptions model. + */ +public class ReplaceV2PolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplaceV2PolicyOptions() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + assertEquals(controlModel.grant(), grantModel); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + ReplaceV2PolicyOptions replaceV2PolicyOptionsModel = new ReplaceV2PolicyOptions.Builder() + .id("testString") + .ifMatch("testString") + .control(controlModel) + .type("access") + .description("testString") + .subject(v2PolicySubjectModel) + .resource(v2PolicyResourceModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .build(); + assertEquals(replaceV2PolicyOptionsModel.id(), "testString"); + assertEquals(replaceV2PolicyOptionsModel.ifMatch(), "testString"); + assertEquals(replaceV2PolicyOptionsModel.control(), controlModel); + assertEquals(replaceV2PolicyOptionsModel.type(), "access"); + assertEquals(replaceV2PolicyOptionsModel.description(), "testString"); + assertEquals(replaceV2PolicyOptionsModel.subject(), v2PolicySubjectModel); + assertEquals(replaceV2PolicyOptionsModel.resource(), v2PolicyResourceModel); + assertEquals(replaceV2PolicyOptionsModel.pattern(), "testString"); + assertEquals(replaceV2PolicyOptionsModel.rule(), v2PolicyRuleModel); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceV2PolicyOptionsError() throws Throwable { + new ReplaceV2PolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java new file mode 100644 index 00000000000..bd50b514f43 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 ResourceAttribute model. + */ +public class ResourceAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testResourceAttribute() throws Throwable { + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceAttributeModel.name(), "testString"); + assertEquals(resourceAttributeModel.value(), "testString"); + assertEquals(resourceAttributeModel.operator(), "testString"); + + String json = TestUtilities.serialize(resourceAttributeModel); + + ResourceAttribute resourceAttributeModelNew = TestUtilities.deserialize(json, ResourceAttribute.class); + assertTrue(resourceAttributeModelNew instanceof ResourceAttribute); + assertEquals(resourceAttributeModelNew.name(), "testString"); + assertEquals(resourceAttributeModelNew.value(), "testString"); + assertEquals(resourceAttributeModelNew.operator(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testResourceAttributeError() throws Throwable { + new ResourceAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java new file mode 100644 index 00000000000..88a1eb5d5b6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.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 ResourceTag model. + */ +public class ResourceTagTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testResourceTag() throws Throwable { + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceTagModel.name(), "testString"); + assertEquals(resourceTagModel.value(), "testString"); + assertEquals(resourceTagModel.operator(), "testString"); + + String json = TestUtilities.serialize(resourceTagModel); + + ResourceTag resourceTagModelNew = TestUtilities.deserialize(json, ResourceTag.class); + assertTrue(resourceTagModelNew instanceof ResourceTag); + assertEquals(resourceTagModelNew.name(), "testString"); + assertEquals(resourceTagModelNew.value(), "testString"); + assertEquals(resourceTagModelNew.operator(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testResourceTagError() throws Throwable { + new ResourceTag.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java new file mode 100644 index 00000000000..e4c0bcc6f92 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAction model. + */ +public class RoleActionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAction() throws Throwable { + RoleAction roleActionModel = new RoleAction(); + assertNull(roleActionModel.getId()); + assertNull(roleActionModel.getDisplayName()); + assertNull(roleActionModel.getDescription()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java new file mode 100644 index 00000000000..42801bc7771 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentCollection model. + */ +public class RoleAssignmentCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentCollection() throws Throwable { + RoleAssignmentCollection roleAssignmentCollectionModel = new RoleAssignmentCollection(); + assertNull(roleAssignmentCollectionModel.getLimit()); + assertNull(roleAssignmentCollectionModel.getFirst()); + assertNull(roleAssignmentCollectionModel.getNext()); + assertNull(roleAssignmentCollectionModel.getPrevious()); + assertNull(roleAssignmentCollectionModel.getAssignments()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java new file mode 100644 index 00000000000..bef8b71b0fa --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResourceCreated model. + */ +public class RoleAssignmentResourceCreatedTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentResourceCreated() throws Throwable { + RoleAssignmentResourceCreated roleAssignmentResourceCreatedModel = new RoleAssignmentResourceCreated(); + assertNull(roleAssignmentResourceCreatedModel.getId()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java new file mode 100644 index 00000000000..c346ca0f48f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java @@ -0,0 +1,43 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResourceRole model. + */ +public class RoleAssignmentResourceRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentResourceRole() throws Throwable { + RoleAssignmentResourceRole roleAssignmentResourceRoleModel = new RoleAssignmentResourceRole(); + assertNull(roleAssignmentResourceRoleModel.getResourceCreated()); + assertNull(roleAssignmentResourceRoleModel.getErrorMessage()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java new file mode 100644 index 00000000000..4fca1b25b5b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResource model. + */ +public class RoleAssignmentResourceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentResource() throws Throwable { + RoleAssignmentResource roleAssignmentResourceModel = new RoleAssignmentResource(); + assertNull(roleAssignmentResourceModel.getTarget()); + assertNull(roleAssignmentResourceModel.getRole()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java new file mode 100644 index 00000000000..4f2e3a37200 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentTemplate model. + */ +public class RoleAssignmentTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentTemplate() throws Throwable { + RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleAssignmentTemplateModel.id(), "testString"); + assertEquals(roleAssignmentTemplateModel.version(), "testString"); + + String json = TestUtilities.serialize(roleAssignmentTemplateModel); + + RoleAssignmentTemplate roleAssignmentTemplateModelNew = TestUtilities.deserialize(json, RoleAssignmentTemplate.class); + assertTrue(roleAssignmentTemplateModelNew instanceof RoleAssignmentTemplate); + assertEquals(roleAssignmentTemplateModelNew.id(), "testString"); + assertEquals(roleAssignmentTemplateModelNew.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRoleAssignmentTemplateError() throws Throwable { + new RoleAssignmentTemplate.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java new file mode 100644 index 00000000000..bd3bda7ce24 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignment model. + */ +public class RoleAssignmentTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignment() throws Throwable { + RoleAssignment roleAssignmentModel = new RoleAssignment(); + assertNull(roleAssignmentModel.getTemplate()); + assertNull(roleAssignmentModel.getTarget()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java new file mode 100644 index 00000000000..812c2dcb131 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java @@ -0,0 +1,41 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleCollection model. + */ +public class RoleCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleCollection() throws Throwable { + RoleCollection roleCollectionModel = new RoleCollection(); + assertNull(roleCollectionModel.getCustomRoles()); + assertNull(roleCollectionModel.getServiceRoles()); + assertNull(roleCollectionModel.getSystemRoles()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java new file mode 100644 index 00000000000..fde4d11ff4c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java @@ -0,0 +1,46 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateCollection model. + */ +public class RoleTemplateCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplateCollection() throws Throwable { + RoleTemplateCollection roleTemplateCollectionModel = new RoleTemplateCollection(); + assertNull(roleTemplateCollectionModel.getLimit()); + assertNull(roleTemplateCollectionModel.getFirst()); + assertNull(roleTemplateCollectionModel.getNext()); + assertNull(roleTemplateCollectionModel.getPrevious()); + assertNull(roleTemplateCollectionModel.getRoleTemplates()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java new file mode 100644 index 00000000000..6c208e1c38f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java @@ -0,0 +1,62 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplatePrototypeRole model. + */ +public class RoleTemplatePrototypeRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplatePrototypeRole() throws Throwable { + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() + .name("testString") + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(roleTemplatePrototypeRoleModel.name(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.displayName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.serviceName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.description(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.actions(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(roleTemplatePrototypeRoleModel); + + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModelNew = TestUtilities.deserialize(json, RoleTemplatePrototypeRole.class); + assertTrue(roleTemplatePrototypeRoleModelNew instanceof RoleTemplatePrototypeRole); + assertEquals(roleTemplatePrototypeRoleModelNew.name(), "testString"); + assertEquals(roleTemplatePrototypeRoleModelNew.displayName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModelNew.serviceName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModelNew.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRoleTemplatePrototypeRoleError() throws Throwable { + new RoleTemplatePrototypeRole.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java new file mode 100644 index 00000000000..af9de718e23 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateReferencesItem model. + */ +public class RoleTemplateReferencesItemTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplateReferencesItem() throws Throwable { + RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleTemplateReferencesItemModel.id(), "testString"); + assertEquals(roleTemplateReferencesItemModel.version(), "testString"); + + String json = TestUtilities.serialize(roleTemplateReferencesItemModel); + + RoleTemplateReferencesItem roleTemplateReferencesItemModelNew = TestUtilities.deserialize(json, RoleTemplateReferencesItem.class); + assertTrue(roleTemplateReferencesItemModelNew instanceof RoleTemplateReferencesItem); + assertEquals(roleTemplateReferencesItemModelNew.id(), "testString"); + assertEquals(roleTemplateReferencesItemModelNew.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRoleTemplateReferencesItemError() throws Throwable { + new RoleTemplateReferencesItem.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java new file mode 100644 index 00000000000..8bb27d8dd62 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplate model. + */ +public class RoleTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplate() throws Throwable { + RoleTemplate roleTemplateModel = new RoleTemplate(); + assertNull(roleTemplateModel.getName()); + assertNull(roleTemplateModel.getDescription()); + assertNull(roleTemplateModel.getAccountId()); + assertNull(roleTemplateModel.isCommitted()); + assertNull(roleTemplateModel.getRole()); + assertNull(roleTemplateModel.getVersion()); + assertNull(roleTemplateModel.getState()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java new file mode 100644 index 00000000000..068cf309bd6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java @@ -0,0 +1,46 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateVersionsCollection model. + */ +public class RoleTemplateVersionsCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplateVersionsCollection() throws Throwable { + RoleTemplateVersionsCollection roleTemplateVersionsCollectionModel = new RoleTemplateVersionsCollection(); + assertNull(roleTemplateVersionsCollectionModel.getLimit()); + assertNull(roleTemplateVersionsCollectionModel.getFirst()); + assertNull(roleTemplateVersionsCollectionModel.getNext()); + assertNull(roleTemplateVersionsCollectionModel.getPrevious()); + assertNull(roleTemplateVersionsCollectionModel.getVersions()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java new file mode 100644 index 00000000000..a632e63587f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; +import com.ibm.cloud.platform_services.iam_policy_management.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 Role model. + */ +public class RoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRole() throws Throwable { + Role roleModel = new Role.Builder() + .displayName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(roleModel.displayName(), "testString"); + assertEquals(roleModel.description(), "testString"); + assertEquals(roleModel.actions(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(roleModel); + + Role roleModelNew = TestUtilities.deserialize(json, Role.class); + assertTrue(roleModelNew instanceof Role); + assertEquals(roleModelNew.displayName(), "testString"); + assertEquals(roleModelNew.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRoleError() throws Throwable { + new Role.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java new file mode 100644 index 00000000000..8383ef794a9 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 Roles model. + */ +public class RolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoles() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + String json = TestUtilities.serialize(rolesModel); + + Roles rolesModelNew = TestUtilities.deserialize(json, Roles.class); + assertTrue(rolesModelNew instanceof Roles); + assertEquals(rolesModelNew.roleId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRolesError() throws Throwable { + new Roles.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java new file mode 100644 index 00000000000..a05e5ee8704 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 RuleAttribute model. + */ +public class RuleAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRuleAttribute() throws Throwable { + RuleAttribute ruleAttributeModel = new RuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(ruleAttributeModel.key(), "testString"); + assertEquals(ruleAttributeModel.operator(), "stringEquals"); + assertEquals(ruleAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(ruleAttributeModel); + + RuleAttribute ruleAttributeModelNew = TestUtilities.deserialize(json, RuleAttribute.class); + assertTrue(ruleAttributeModelNew instanceof RuleAttribute); + assertEquals(ruleAttributeModelNew.key(), "testString"); + assertEquals(ruleAttributeModelNew.operator(), "stringEquals"); + assertEquals(ruleAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRuleAttributeError() throws Throwable { + new RuleAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java new file mode 100644 index 00000000000..7bae03a42e0 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 SubjectAttribute model. + */ +public class SubjectAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testSubjectAttribute() throws Throwable { + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(subjectAttributeModel.name(), "testString"); + assertEquals(subjectAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(subjectAttributeModel); + + SubjectAttribute subjectAttributeModelNew = TestUtilities.deserialize(json, SubjectAttribute.class); + assertTrue(subjectAttributeModelNew instanceof SubjectAttribute); + assertEquals(subjectAttributeModelNew.name(), "testString"); + assertEquals(subjectAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testSubjectAttributeError() throws Throwable { + new SubjectAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java new file mode 100644 index 00000000000..d3a6d4ef53a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateActionControl model. + */ +public class TemplateActionControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateActionControl() throws Throwable { + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateActionControlModel.serviceName(), "testString"); + assertEquals(templateActionControlModel.description(), "testString"); + assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(templateActionControlModel); + + TemplateActionControl templateActionControlModelNew = TestUtilities.deserialize(json, TemplateActionControl.class); + assertTrue(templateActionControlModelNew instanceof TemplateActionControl); + assertEquals(templateActionControlModelNew.serviceName(), "testString"); + assertEquals(templateActionControlModelNew.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateActionControlError() throws Throwable { + new TemplateActionControl.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java new file mode 100644 index 00000000000..fba96e64cef --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateControl model. + */ +public class TemplateControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateControl() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + String json = TestUtilities.serialize(templateControlModel); + + TemplateControl templateControlModelNew = TestUtilities.deserialize(json, TemplateControl.class); + assertTrue(templateControlModelNew instanceof TemplateControl); + assertEquals(templateControlModelNew.grant().toString(), templateGrantModel.toString()); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateControlError() throws Throwable { + new TemplateControl.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java new file mode 100644 index 00000000000..b440cf19100 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateCountData model. + */ +public class TemplateCountDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateCountData() throws Throwable { + TemplateCountData templateCountDataModel = new TemplateCountData(); + assertNull(templateCountDataModel.getTemplate()); + assertNull(templateCountDataModel.getVersion()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java new file mode 100644 index 00000000000..e7759eacc21 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java @@ -0,0 +1,58 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoleReferences; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrantRoleReferences model. + */ +public class TemplateGrantRoleReferencesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateGrantRoleReferences() throws Throwable { + RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleTemplateReferencesItemModel.id(), "testString"); + assertEquals(roleTemplateReferencesItemModel.version(), "testString"); + + TemplateGrantRoleReferences templateGrantRoleReferencesModel = new TemplateGrantRoleReferences.Builder() + .roleTemplateReferences(java.util.Arrays.asList(roleTemplateReferencesItemModel)) + .build(); + assertEquals(templateGrantRoleReferencesModel.roleTemplateReferences(), java.util.Arrays.asList(roleTemplateReferencesItemModel)); + + String json = TestUtilities.serialize(templateGrantRoleReferencesModel); + + TemplateGrantRoleReferences templateGrantRoleReferencesModelNew = TestUtilities.deserialize(json, TemplateGrantRoleReferences.class); + assertTrue(templateGrantRoleReferencesModelNew instanceof TemplateGrantRoleReferences); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateGrantRoleReferencesError() throws Throwable { + new TemplateGrantRoleReferences.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java new file mode 100644 index 00000000000..8cddc6f9a19 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrantRoles model. + */ +public class TemplateGrantRolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateGrantRoles() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantRolesModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantRolesModel.roles(), java.util.Arrays.asList(rolesModel)); + + String json = TestUtilities.serialize(templateGrantRolesModel); + + TemplateGrantRoles templateGrantRolesModelNew = TestUtilities.deserialize(json, TemplateGrantRoles.class); + assertTrue(templateGrantRolesModelNew instanceof TemplateGrantRoles); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateGrantRolesError() throws Throwable { + new TemplateGrantRoles.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java new file mode 100644 index 00000000000..90e6fdc2b9f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrant model. + */ +public class TemplateGrantTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testTemplateGrant() throws Throwable { + TemplateGrant templateGrantModel = new TemplateGrant(); + assertNotNull(templateGrantModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java new file mode 100644 index 00000000000..c2688232e2b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java @@ -0,0 +1,41 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateMetadata model. + */ +public class TemplateMetadataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateMetadata() throws Throwable { + TemplateMetadata templateMetadataModel = new TemplateMetadata(); + assertNull(templateMetadataModel.getId()); + assertNull(templateMetadataModel.getVersion()); + assertNull(templateMetadataModel.getAssignmentId()); + assertNull(templateMetadataModel.getRootId()); + assertNull(templateMetadataModel.getRootVersion()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java new file mode 100644 index 00000000000..0e256ffd599 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplatePolicy model. + */ +public class TemplatePolicyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplatePolicy() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + assertEquals(templatePolicyModel.type(), "access"); + assertEquals(templatePolicyModel.description(), "testString"); + assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); + assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); + assertEquals(templatePolicyModel.pattern(), "testString"); + assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); + assertEquals(templatePolicyModel.control(), templateControlModel); + + String json = TestUtilities.serialize(templatePolicyModel); + + TemplatePolicy templatePolicyModelNew = TestUtilities.deserialize(json, TemplatePolicy.class); + assertTrue(templatePolicyModelNew instanceof TemplatePolicy); + assertEquals(templatePolicyModelNew.type(), "access"); + assertEquals(templatePolicyModelNew.description(), "testString"); + assertEquals(templatePolicyModelNew.resource().toString(), v2PolicyResourceModel.toString()); + assertEquals(templatePolicyModelNew.subject().toString(), v2PolicySubjectModel.toString()); + assertEquals(templatePolicyModelNew.pattern(), "testString"); + assertEquals(templatePolicyModelNew.rule().toString(), v2PolicyRuleModel.toString()); + assertEquals(templatePolicyModelNew.control().toString(), templateControlModel.toString()); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplatePolicyError() throws Throwable { + new TemplatePolicy.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java new file mode 100644 index 00000000000..1735364bc85 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java @@ -0,0 +1,59 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateRole model. + */ +public class TemplateRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateRole() throws Throwable { + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateRoleModel.displayName(), "testString"); + assertEquals(templateRoleModel.serviceName(), "testString"); + assertEquals(templateRoleModel.description(), "testString"); + assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(templateRoleModel); + + TemplateRole templateRoleModelNew = TestUtilities.deserialize(json, TemplateRole.class); + assertTrue(templateRoleModelNew instanceof TemplateRole); + assertEquals(templateRoleModelNew.displayName(), "testString"); + assertEquals(templateRoleModelNew.serviceName(), "testString"); + assertEquals(templateRoleModelNew.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateRoleError() throws Throwable { + new TemplateRole.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java new file mode 100644 index 00000000000..df7a09c2829 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateActionControlAssignmentOptions model. + */ +public class UpdateActionControlAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateActionControlAssignmentOptions() throws Throwable { + UpdateActionControlAssignmentOptions updateActionControlAssignmentOptionsModel = new UpdateActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .ifMatch("testString") + .templateVersion("testString") + .build(); + assertEquals(updateActionControlAssignmentOptionsModel.assignmentId(), "testString"); + assertEquals(updateActionControlAssignmentOptionsModel.ifMatch(), "testString"); + assertEquals(updateActionControlAssignmentOptionsModel.templateVersion(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateActionControlAssignmentOptionsError() throws Throwable { + new UpdateActionControlAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java new file mode 100644 index 00000000000..0008325ffcf --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdatePolicyAssignmentOptions model. + */ +public class UpdatePolicyAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdatePolicyAssignmentOptions() throws Throwable { + UpdatePolicyAssignmentOptions updatePolicyAssignmentOptionsModel = new UpdatePolicyAssignmentOptions.Builder() + .assignmentId("testString") + .version("1.0") + .ifMatch("testString") + .templateVersion("testString") + .build(); + assertEquals(updatePolicyAssignmentOptionsModel.assignmentId(), "testString"); + assertEquals(updatePolicyAssignmentOptionsModel.version(), "1.0"); + assertEquals(updatePolicyAssignmentOptionsModel.ifMatch(), "testString"); + assertEquals(updatePolicyAssignmentOptionsModel.templateVersion(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdatePolicyAssignmentOptionsError() throws Throwable { + new UpdatePolicyAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java new file mode 100644 index 00000000000..de000e8c745 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdatePolicyStateOptions model. + */ +public class UpdatePolicyStateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdatePolicyStateOptions() throws Throwable { + UpdatePolicyStateOptions updatePolicyStateOptionsModel = new UpdatePolicyStateOptions.Builder() + .policyId("testString") + .ifMatch("testString") + .state("active") + .build(); + assertEquals(updatePolicyStateOptionsModel.policyId(), "testString"); + assertEquals(updatePolicyStateOptionsModel.ifMatch(), "testString"); + assertEquals(updatePolicyStateOptionsModel.state(), "active"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdatePolicyStateOptionsError() throws Throwable { + new UpdatePolicyStateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java new file mode 100644 index 00000000000..879c3d5f456 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateRoleAssignmentOptions model. + */ +public class UpdateRoleAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateRoleAssignmentOptions() throws Throwable { + UpdateRoleAssignmentOptions updateRoleAssignmentOptionsModel = new UpdateRoleAssignmentOptions.Builder() + .assignmentId("testString") + .ifMatch("testString") + .templateVersion("testString") + .build(); + assertEquals(updateRoleAssignmentOptionsModel.assignmentId(), "testString"); + assertEquals(updateRoleAssignmentOptionsModel.ifMatch(), "testString"); + assertEquals(updateRoleAssignmentOptionsModel.templateVersion(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateRoleAssignmentOptionsError() throws Throwable { + new UpdateRoleAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java new file mode 100644 index 00000000000..1d69d016781 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java @@ -0,0 +1,75 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateSettingsOptions model. + */ +public class UpdateSettingsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateSettingsOptions() throws Throwable { + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + assertEquals(identityTypesBaseModel.state(), "enabled"); + assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); + + IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() + .user(identityTypesBaseModel) + .serviceId(identityTypesBaseModel) + .service(identityTypesBaseModel) + .build(); + assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); + + ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() + .identityTypes(identityTypesPatchModel) + .build(); + assertEquals(externalAccountIdentityInteractionPatchModel.identityTypes(), identityTypesPatchModel); + + UpdateSettingsOptions updateSettingsOptionsModel = new UpdateSettingsOptions.Builder() + .accountId("testString") + .ifMatch("testString") + .externalAccountIdentityInteraction(externalAccountIdentityInteractionPatchModel) + .acceptLanguage("default") + .build(); + assertEquals(updateSettingsOptionsModel.accountId(), "testString"); + assertEquals(updateSettingsOptionsModel.ifMatch(), "testString"); + assertEquals(updateSettingsOptionsModel.externalAccountIdentityInteraction(), externalAccountIdentityInteractionPatchModel); + assertEquals(updateSettingsOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateSettingsOptionsError() throws Throwable { + new UpdateSettingsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java new file mode 100644 index 00000000000..aff020c8985 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyCollection model. + */ +public class V2PolicyCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyCollection() throws Throwable { + V2PolicyCollection v2PolicyCollectionModel = new V2PolicyCollection(); + assertNull(v2PolicyCollectionModel.getLimit()); + assertNull(v2PolicyCollectionModel.getFirst()); + assertNull(v2PolicyCollectionModel.getNext()); + assertNull(v2PolicyCollectionModel.getPrevious()); + assertNull(v2PolicyCollectionModel.getPolicies()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java new file mode 100644 index 00000000000..407eaadb155 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResourceAttribute model. + */ +public class V2PolicyResourceAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyResourceAttribute() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(v2PolicyResourceAttributeModel); + + V2PolicyResourceAttribute v2PolicyResourceAttributeModelNew = TestUtilities.deserialize(json, V2PolicyResourceAttribute.class); + assertTrue(v2PolicyResourceAttributeModelNew instanceof V2PolicyResourceAttribute); + assertEquals(v2PolicyResourceAttributeModelNew.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModelNew.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyResourceAttributeError() throws Throwable { + new V2PolicyResourceAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java new file mode 100644 index 00000000000..97c9c813216 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResourceTag model. + */ +public class V2PolicyResourceTagTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyResourceTag() throws Throwable { + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + String json = TestUtilities.serialize(v2PolicyResourceTagModel); + + V2PolicyResourceTag v2PolicyResourceTagModelNew = TestUtilities.deserialize(json, V2PolicyResourceTag.class); + assertTrue(v2PolicyResourceTagModelNew instanceof V2PolicyResourceTag); + assertEquals(v2PolicyResourceTagModelNew.key(), "testString"); + assertEquals(v2PolicyResourceTagModelNew.value(), "testString"); + assertEquals(v2PolicyResourceTagModelNew.operator(), "stringEquals"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyResourceTagError() throws Throwable { + new V2PolicyResourceTag.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java new file mode 100644 index 00000000000..d153fd97be6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java @@ -0,0 +1,72 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResource model. + */ +public class V2PolicyResourceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyResource() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + String json = TestUtilities.serialize(v2PolicyResourceModel); + + V2PolicyResource v2PolicyResourceModelNew = TestUtilities.deserialize(json, V2PolicyResource.class); + assertTrue(v2PolicyResourceModelNew instanceof V2PolicyResource); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyResourceError() throws Throwable { + new V2PolicyResource.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java new file mode 100644 index 00000000000..6d6da85f2b4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRuleRuleAttribute model. + */ +public class V2PolicyRuleRuleAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyRuleRuleAttribute() throws Throwable { + V2PolicyRuleRuleAttribute v2PolicyRuleRuleAttributeModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleRuleAttributeModel.key(), "testString"); + assertEquals(v2PolicyRuleRuleAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleRuleAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(v2PolicyRuleRuleAttributeModel); + + V2PolicyRuleRuleAttribute v2PolicyRuleRuleAttributeModelNew = TestUtilities.deserialize(json, V2PolicyRuleRuleAttribute.class); + assertTrue(v2PolicyRuleRuleAttributeModelNew instanceof V2PolicyRuleRuleAttribute); + assertEquals(v2PolicyRuleRuleAttributeModelNew.key(), "testString"); + assertEquals(v2PolicyRuleRuleAttributeModelNew.operator(), "stringEquals"); + assertEquals(v2PolicyRuleRuleAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyRuleRuleAttributeError() throws Throwable { + new V2PolicyRuleRuleAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java new file mode 100644 index 00000000000..fdf25669ef7 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleWithNestedConditions; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRuleRuleWithNestedConditions model. + */ +public class V2PolicyRuleRuleWithNestedConditionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyRuleRuleWithNestedConditions() throws Throwable { + NestedConditionRuleAttribute nestedConditionModel = new NestedConditionRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(nestedConditionModel.key(), "testString"); + assertEquals(nestedConditionModel.operator(), "stringEquals"); + assertEquals(nestedConditionModel.value(), "testString"); + + V2PolicyRuleRuleWithNestedConditions v2PolicyRuleRuleWithNestedConditionsModel = new V2PolicyRuleRuleWithNestedConditions.Builder() + .operator("and") + .conditions(java.util.Arrays.asList(nestedConditionModel)) + .build(); + assertEquals(v2PolicyRuleRuleWithNestedConditionsModel.operator(), "and"); + assertEquals(v2PolicyRuleRuleWithNestedConditionsModel.conditions(), java.util.Arrays.asList(nestedConditionModel)); + + String json = TestUtilities.serialize(v2PolicyRuleRuleWithNestedConditionsModel); + + V2PolicyRuleRuleWithNestedConditions v2PolicyRuleRuleWithNestedConditionsModelNew = TestUtilities.deserialize(json, V2PolicyRuleRuleWithNestedConditions.class); + assertTrue(v2PolicyRuleRuleWithNestedConditionsModelNew instanceof V2PolicyRuleRuleWithNestedConditions); + assertEquals(v2PolicyRuleRuleWithNestedConditionsModelNew.operator(), "and"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyRuleRuleWithNestedConditionsError() throws Throwable { + new V2PolicyRuleRuleWithNestedConditions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java new file mode 100644 index 00000000000..e0af599840c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRule; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRule model. + */ +public class V2PolicyRuleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testV2PolicyRule() throws Throwable { + V2PolicyRule v2PolicyRuleModel = new V2PolicyRule(); + assertNotNull(v2PolicyRuleModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java new file mode 100644 index 00000000000..a6e8f9d8922 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicySubjectAttribute model. + */ +public class V2PolicySubjectAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicySubjectAttribute() throws Throwable { + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(v2PolicySubjectAttributeModel); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModelNew = TestUtilities.deserialize(json, V2PolicySubjectAttribute.class); + assertTrue(v2PolicySubjectAttributeModelNew instanceof V2PolicySubjectAttribute); + assertEquals(v2PolicySubjectAttributeModelNew.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModelNew.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicySubjectAttributeError() throws Throwable { + new V2PolicySubjectAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java new file mode 100644 index 00000000000..37adbaff5df --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java @@ -0,0 +1,60 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicySubject model. + */ +public class V2PolicySubjectTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicySubject() throws Throwable { + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + String json = TestUtilities.serialize(v2PolicySubjectModel); + + V2PolicySubject v2PolicySubjectModelNew = TestUtilities.deserialize(json, V2PolicySubject.class); + assertTrue(v2PolicySubjectModelNew instanceof V2PolicySubject); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicySubjectError() throws Throwable { + new V2PolicySubject.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java new file mode 100644 index 00000000000..2ffbe45575b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyTemplateMetaData model. + */ +public class V2PolicyTemplateMetaDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyTemplateMetaData() throws Throwable { + V2PolicyTemplateMetaData v2PolicyTemplateMetaDataModel = new V2PolicyTemplateMetaData(); + assertNull(v2PolicyTemplateMetaDataModel.getType()); + assertNull(v2PolicyTemplateMetaDataModel.getDescription()); + assertNull(v2PolicyTemplateMetaDataModel.getSubject()); + assertNull(v2PolicyTemplateMetaDataModel.getResource()); + assertNull(v2PolicyTemplateMetaDataModel.getPattern()); + assertNull(v2PolicyTemplateMetaDataModel.getRule()); + assertNull(v2PolicyTemplateMetaDataModel.getControl()); + assertNull(v2PolicyTemplateMetaDataModel.getState()); + assertNull(v2PolicyTemplateMetaDataModel.getLastPermitAt()); + assertNull(v2PolicyTemplateMetaDataModel.getLastPermitFrequency()); + assertNull(v2PolicyTemplateMetaDataModel.getTemplate()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java new file mode 100644 index 00000000000..1630201062c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2Policy model. + */ +public class V2PolicyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2Policy() throws Throwable { + V2Policy v2PolicyModel = new V2Policy(); + assertNull(v2PolicyModel.getType()); + assertNull(v2PolicyModel.getDescription()); + assertNull(v2PolicyModel.getSubject()); + assertNull(v2PolicyModel.getResource()); + assertNull(v2PolicyModel.getPattern()); + assertNull(v2PolicyModel.getRule()); + assertNull(v2PolicyModel.getControl()); + assertNull(v2PolicyModel.getState()); + assertNull(v2PolicyModel.getLastPermitAt()); + assertNull(v2PolicyModel.getLastPermitFrequency()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java new file mode 100644 index 00000000000..04aaecc16ae --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java @@ -0,0 +1,131 @@ +/* + * (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_policy_management.v1.utils; + +import java.util.Base64; +import java.util.Map; +import java.util.Set; +import java.util.List; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.io.InputStream; +import java.io.ByteArrayInputStream; + +import okhttp3.mockwebserver.RecordedRequest; +import okhttp3.HttpUrl; +import com.ibm.cloud.sdk.core.util.DateUtils; +import com.ibm.cloud.sdk.core.util.GsonSingleton; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; + +/** + * A class used by the unit tests containing utility functions. + */ +public class TestUtilities { + public static Map createMockMap() { + Map mockMap = new HashMap<>(); + mockMap.put("foo", "bar"); + return mockMap; + } + + public static HashMap createMockStreamMap() { + return new HashMap() { + { put("key1", createMockStream("This is a mock file.")); } + }; + } + + public static Map parseQueryString(RecordedRequest req) { + Map queryMap = new HashMap<>(); + + try { + HttpUrl requestUrl = req.getRequestUrl(); + + if (requestUrl != null) { + Set queryParamsNames = requestUrl.queryParameterNames(); + // map the parameter name to its corresponding value + for (String p : queryParamsNames) { + // get the corresponding value for the parameter (p) + List val = requestUrl.queryParameterValues(p); + if (val != null && !val.isEmpty()) { + String joinedQuery = String.join(",", val); + queryMap.put(p, joinedQuery); + } + } + } + if (queryMap.isEmpty()) { + return null; + } + } catch (Exception e) { + return null; + } + + return queryMap; + } + + public static String parseReqPath(RecordedRequest req) { + String parsedPath = null; + + try { + String fullPath = req.getPath(); + if (fullPath != null && !fullPath.isEmpty()) { + // retrieve the path segment before the query parameter + parsedPath = fullPath.split("\\?", 2)[0]; + } + if (parsedPath.isEmpty() || parsedPath == null) { + return null; + } + + } catch (Exception e) { + return null; + } + + return parsedPath; + } + + public static String serialize(Object obj) { + return GsonSingleton.getGson().toJson(obj); + } + + public static T deserialize(String json, Class clazz) { + return GsonSingleton.getGson().fromJson(json, clazz); + } + + public static InputStream createMockStream(String s) { + return new ByteArrayInputStream(s.getBytes()); + } + + public static List creatMockListFileWithMetadata() { + List list = new ArrayList(); + byte[] fileBytes = {(byte) 0xde, (byte) 0xad, (byte) 0xbe, (byte) 0xef}; + InputStream inputStream = new ByteArrayInputStream(fileBytes); + FileWithMetadata.Builder builder = new FileWithMetadata.Builder(); + builder.data(inputStream); + FileWithMetadata fileWithMetadata = builder.build(); + list.add(fileWithMetadata); + + return list; + } + + public static byte[] createMockByteArray(String encodedString) throws Exception { + return Base64.getDecoder().decode(encodedString); + } + + public static Date createMockDate(String date) throws Exception { + return DateUtils.parseAsDate(date); + } + + public static Date createMockDateTime(String date) throws Exception { + return DateUtils.parseAsDateTime(date); + } +} \ No newline at end of file From 72790a01ac9e0391260b6c318c7f46e164c62fb6 Mon Sep 17 00:00:00 2001 From: Bhavana Bellamgari Date: Wed, 10 Dec 2025 12:50:27 +0530 Subject: [PATCH 03/13] Removed the wrongly generated code Signed-off-by: Bhavana Bellamgari Signed-off-by: Bhavana Bellamgari --- .../v1/IamPolicyManagement.java | 2566 --------- .../AccountSettingsAccessManagement.java | 40 - .../v1/model/ActionControlAssignment.java | 207 - .../ActionControlAssignmentCollection.java | 88 - .../ActionControlAssignmentResource.java | 52 - ...ontrolAssignmentResourceActionControl.java | 53 - ...ctionControlAssignmentResourceCreated.java | 38 - .../ActionControlAssignmentTemplate.java | 134 - .../model/ActionControlAssignmentsPager.java | 108 - .../v1/model/ActionControlTemplate.java | 203 - .../ActionControlTemplateCollection.java | 90 - ...tionControlTemplateVersionsCollection.java | 88 - .../ActionControlTemplateVersionsPager.java | 108 - .../v1/model/ActionControlTemplatesPager.java | 108 - .../v1/model/AssignmentResourceCreated.java | 38 - .../v1/model/AssignmentResourceError.java | 88 - .../v1/model/AssignmentTargetDetails.java | 142 - .../v1/model/AssignmentTemplateDetails.java | 119 - .../CommitActionControlTemplateOptions.java | 134 - .../v1/model/CommitPolicyTemplateOptions.java | 134 - .../v1/model/CommitRoleTemplateOptions.java | 134 - .../v1/model/ConflictsWith.java | 62 - .../v1/model/Control.java | 104 - .../v1/model/ControlResponse.java | 42 - .../v1/model/ControlResponseControl.java | 24 - ...ntrolResponseControlWithEnrichedRoles.java | 24 - ...ctionControlTemplateAssignmentOptions.java | 191 - .../CreateActionControlTemplateOptions.java | 251 - ...teActionControlTemplateVersionOptions.java | 211 - .../v1/model/CreatePolicyOptions.java | 311 - ...CreatePolicyTemplateAssignmentOptions.java | 221 - .../v1/model/CreatePolicyTemplateOptions.java | 255 - .../CreatePolicyTemplateVersionOptions.java | 214 - .../v1/model/CreateRoleOptions.java | 308 - .../CreateRoleTemplateAssignmentOptions.java | 191 - .../v1/model/CreateRoleTemplateOptions.java | 251 - .../CreateRoleTemplateVersionOptions.java | 211 - .../v1/model/CreateV2PolicyOptions.java | 312 - .../v1/model/CustomRole.java | 195 - .../DeleteActionControlAssignmentOptions.java | 104 - .../DeleteActionControlTemplateOptions.java | 104 - ...teActionControlTemplateVersionOptions.java | 134 - .../model/DeletePolicyAssignmentOptions.java | 104 - .../v1/model/DeletePolicyOptions.java | 104 - .../v1/model/DeletePolicyTemplateOptions.java | 104 - .../DeletePolicyTemplateVersionOptions.java | 134 - .../v1/model/DeleteRoleAssignmentOptions.java | 104 - .../v1/model/DeleteRoleOptions.java | 104 - .../v1/model/DeleteRoleTemplateOptions.java | 104 - .../DeleteRoleTemplateVersionOptions.java | 134 - .../v1/model/DeleteV2PolicyOptions.java | 104 - .../v1/model/EnrichedRoles.java | 81 - .../v1/model/ErrorDetails.java | 40 - .../v1/model/ErrorObject.java | 128 - .../ExternalAccountIdentityInteraction.java | 40 - ...ternalAccountIdentityInteractionPatch.java | 95 - .../iam_policy_management/v1/model/First.java | 38 - .../GetActionControlAssignmentOptions.java | 104 - .../GetActionControlTemplateOptions.java | 140 - ...etActionControlTemplateVersionOptions.java | 134 - .../v1/model/GetPolicyAssignmentOptions.java | 134 - .../v1/model/GetPolicyOptions.java | 104 - .../v1/model/GetPolicyTemplateOptions.java | 140 - .../GetPolicyTemplateVersionOptions.java | 134 - .../v1/model/GetRoleAssignmentOptions.java | 104 - .../v1/model/GetRoleOptions.java | 104 - .../v1/model/GetRoleTemplateOptions.java | 140 - .../model/GetRoleTemplateVersionOptions.java | 134 - .../v1/model/GetSettingsOptions.java | 141 - .../v1/model/GetV2PolicyOptions.java | 148 - .../iam_policy_management/v1/model/Grant.java | 124 - .../v1/model/GrantWithEnrichedRoles.java | 40 - .../v1/model/IdentityTypes.java | 64 - .../v1/model/IdentityTypesBase.java | 168 - .../v1/model/IdentityTypesPatch.java | 147 - .../v1/model/LimitData.java | 50 - .../ListActionControlAssignmentsOptions.java | 245 - ...tActionControlTemplateVersionsOptions.java | 192 - .../ListActionControlTemplatesOptions.java | 193 - .../v1/model/ListPoliciesOptions.java | 501 -- .../model/ListPolicyAssignmentsOptions.java | 275 - .../ListPolicyTemplateVersionsOptions.java | 192 - .../v1/model/ListPolicyTemplatesOptions.java | 379 -- .../v1/model/ListRoleAssignmentsOptions.java | 245 - .../ListRoleTemplateVersionsOptions.java | 192 - .../v1/model/ListRoleTemplatesOptions.java | 307 - .../v1/model/ListRolesOptions.java | 234 - .../v1/model/ListV2PoliciesOptions.java | 492 -- .../v1/model/NestedCondition.java | 126 - .../model/NestedConditionRuleAttribute.java | 170 - .../NestedConditionRuleWithConditions.java | 139 - .../iam_policy_management/v1/model/Next.java | 50 - .../v1/model/PoliciesPager.java | 108 - .../v1/model/Policy.java | 188 - .../model/PolicyAssignmentResourcePolicy.java | 65 - .../v1/model/PolicyAssignmentResources.java | 50 - .../v1/model/PolicyAssignmentV1.java | 193 - .../model/PolicyAssignmentV1Collection.java | 88 - .../v1/model/PolicyAssignmentV1Resources.java | 50 - .../v1/model/PolicyAssignmentV1Subject.java | 60 - .../v1/model/PolicyAssignmentsPager.java | 108 - .../v1/model/PolicyCollection.java | 88 - .../v1/model/PolicyResource.java | 167 - .../v1/model/PolicyRole.java | 131 - .../v1/model/PolicySubject.java | 124 - .../v1/model/PolicyTemplate.java | 202 - .../PolicyTemplateAssignmentCollection.java | 88 - .../model/PolicyTemplateAssignmentItems.java | 261 - ...mplateAssignmentItemsPolicyAssignment.java | 50 - ...lateAssignmentItemsPolicyAssignmentV1.java | 38 - .../v1/model/PolicyTemplateCollection.java | 90 - .../v1/model/PolicyTemplateLimitData.java | 214 - .../v1/model/PolicyTemplateMetaData.java | 201 - .../PolicyTemplateVersionsCollection.java | 88 - .../v1/model/PolicyTemplateVersionsPager.java | 108 - .../v1/model/PolicyTemplatesPager.java | 108 - .../v1/model/Previous.java | 50 - .../ReplaceActionControlTemplateOptions.java | 273 - .../v1/model/ReplacePolicyOptions.java | 335 -- .../model/ReplacePolicyTemplateOptions.java | 276 - .../v1/model/ReplaceRoleOptions.java | 255 - .../v1/model/ReplaceRoleTemplateOptions.java | 273 - .../v1/model/ReplaceV2PolicyOptions.java | 336 -- .../v1/model/ResourceAttribute.java | 160 - .../v1/model/ResourceTag.java | 160 - .../iam_policy_management/v1/model/Role.java | 196 - .../v1/model/RoleAction.java | 64 - .../v1/model/RoleAssignment.java | 207 - .../v1/model/RoleAssignmentCollection.java | 88 - .../v1/model/RoleAssignmentResource.java | 50 - .../model/RoleAssignmentResourceCreated.java | 38 - .../v1/model/RoleAssignmentResourceRole.java | 53 - .../v1/model/RoleAssignmentTemplate.java | 134 - .../v1/model/RoleAssignmentsPager.java | 108 - .../v1/model/RoleCollection.java | 68 - .../v1/model/RoleTemplate.java | 202 - .../v1/model/RoleTemplateCollection.java | 90 - .../v1/model/RoleTemplatePrototypeRole.java | 239 - .../v1/model/RoleTemplateReferencesItem.java | 134 - .../model/RoleTemplateVersionsCollection.java | 88 - .../v1/model/RoleTemplateVersionsPager.java | 108 - .../v1/model/RoleTemplatesPager.java | 108 - .../iam_policy_management/v1/model/Roles.java | 106 - .../v1/model/RuleAttribute.java | 209 - .../v1/model/SubjectAttribute.java | 134 - .../v1/model/TemplateActionControl.java | 182 - .../v1/model/TemplateControl.java | 104 - .../v1/model/TemplateCountData.java | 50 - .../v1/model/TemplateGrant.java | 58 - .../v1/model/TemplateGrantRoleReferences.java | 110 - .../v1/model/TemplateGrantRoles.java | 110 - .../v1/model/TemplateMetadata.java | 91 - .../v1/model/TemplatePolicy.java | 272 - .../v1/model/TemplateRole.java | 209 - .../UpdateActionControlAssignmentOptions.java | 166 - .../model/UpdatePolicyAssignmentOptions.java | 196 - .../v1/model/UpdatePolicyStateOptions.java | 171 - .../v1/model/UpdateRoleAssignmentOptions.java | 166 - .../v1/model/UpdateSettingsOptions.java | 199 - .../v1/model/V2PoliciesPager.java | 108 - .../v1/model/V2Policy.java | 247 - .../v1/model/V2PolicyCollection.java | 88 - .../v1/model/V2PolicyResource.java | 167 - .../v1/model/V2PolicyResourceAttribute.java | 181 - .../v1/model/V2PolicyResourceTag.java | 174 - .../v1/model/V2PolicyRule.java | 126 - .../v1/model/V2PolicyRuleRuleAttribute.java | 170 - .../V2PolicyRuleRuleWithNestedConditions.java | 139 - .../v1/model/V2PolicySubject.java | 124 - .../v1/model/V2PolicySubjectAttribute.java | 175 - .../v1/model/V2PolicyTemplateMetaData.java | 260 - .../v1/package-info.java | 17 - .../v1/IamPolicyManagementTest.java | 5007 ----------------- .../AccountSettingsAccessManagementTest.java | 40 - ...ActionControlAssignmentCollectionTest.java | 47 - ...olAssignmentResourceActionControlTest.java | 43 - ...nControlAssignmentResourceCreatedTest.java | 37 - .../ActionControlAssignmentResourceTest.java | 45 - .../ActionControlAssignmentTemplateTest.java | 54 - .../v1/model/ActionControlAssignmentTest.java | 40 - .../ActionControlTemplateCollectionTest.java | 46 - .../v1/model/ActionControlTemplateTest.java | 44 - ...ControlTemplateVersionsCollectionTest.java | 46 - .../model/AssignmentResourceCreatedTest.java | 37 - .../v1/model/AssignmentResourceErrorTest.java | 44 - .../v1/model/AssignmentTargetDetailsTest.java | 54 - .../model/AssignmentTemplateDetailsTest.java | 48 - ...ommitActionControlTemplateOptionsTest.java | 47 - .../CommitPolicyTemplateOptionsTest.java | 47 - .../model/CommitRoleTemplateOptionsTest.java | 47 - .../v1/model/ConflictsWithTest.java | 39 - .../v1/model/ControlResponseControlTest.java | 39 - ...lResponseControlWithEnrichedRolesTest.java | 40 - .../v1/model/ControlResponseTest.java | 40 - .../v1/model/ControlTest.java | 63 - ...nControlTemplateAssignmentOptionsTest.java | 65 - ...reateActionControlTemplateOptionsTest.java | 65 - ...tionControlTemplateVersionOptionsTest.java | 63 - .../v1/model/CreatePolicyOptionsTest.java | 103 - ...tePolicyTemplateAssignmentOptionsTest.java | 67 - .../CreatePolicyTemplateOptionsTest.java | 145 - ...reatePolicyTemplateVersionOptionsTest.java | 143 - .../v1/model/CreateRoleOptionsTest.java | 57 - ...eateRoleTemplateAssignmentOptionsTest.java | 65 - .../model/CreateRoleTemplateOptionsTest.java | 69 - .../CreateRoleTemplateVersionOptionsTest.java | 65 - .../v1/model/CreateV2PolicyOptionsTest.java | 131 - .../v1/model/CustomRoleTest.java | 42 - ...eteActionControlAssignmentOptionsTest.java | 45 - ...eleteActionControlTemplateOptionsTest.java | 45 - ...tionControlTemplateVersionOptionsTest.java | 47 - .../DeletePolicyAssignmentOptionsTest.java | 45 - .../v1/model/DeletePolicyOptionsTest.java | 45 - .../DeletePolicyTemplateOptionsTest.java | 45 - ...eletePolicyTemplateVersionOptionsTest.java | 47 - .../DeleteRoleAssignmentOptionsTest.java | 45 - .../v1/model/DeleteRoleOptionsTest.java | 45 - .../model/DeleteRoleTemplateOptionsTest.java | 45 - .../DeleteRoleTemplateVersionOptionsTest.java | 47 - .../v1/model/DeleteV2PolicyOptionsTest.java | 45 - .../v1/model/EnrichedRolesTest.java | 39 - .../v1/model/ErrorDetailsTest.java | 38 - .../v1/model/ErrorObjectTest.java | 42 - ...alAccountIdentityInteractionPatchTest.java | 63 - ...xternalAccountIdentityInteractionTest.java | 39 - .../v1/model/FirstTest.java | 36 - ...GetActionControlAssignmentOptionsTest.java | 45 - .../GetActionControlTemplateOptionsTest.java | 47 - ...tionControlTemplateVersionOptionsTest.java | 47 - .../model/GetPolicyAssignmentOptionsTest.java | 47 - .../v1/model/GetPolicyOptionsTest.java | 45 - .../model/GetPolicyTemplateOptionsTest.java | 47 - .../GetPolicyTemplateVersionOptionsTest.java | 47 - .../model/GetRoleAssignmentOptionsTest.java | 45 - .../v1/model/GetRoleOptionsTest.java | 45 - .../v1/model/GetRoleTemplateOptionsTest.java | 47 - .../GetRoleTemplateVersionOptionsTest.java | 47 - .../v1/model/GetSettingsOptionsTest.java | 47 - .../v1/model/GetV2PolicyOptionsTest.java | 47 - .../v1/model/GrantTest.java | 56 - .../v1/model/GrantWithEnrichedRolesTest.java | 39 - .../v1/model/IdentityTypesBaseTest.java | 53 - .../v1/model/IdentityTypesPatchTest.java | 59 - .../v1/model/IdentityTypesTest.java | 40 - .../v1/model/LimitDataTest.java | 36 - ...stActionControlAssignmentsOptionsTest.java | 55 - ...ionControlTemplateVersionsOptionsTest.java | 51 - ...ListActionControlTemplatesOptionsTest.java | 51 - .../v1/model/ListPoliciesOptionsTest.java | 69 - .../ListPolicyAssignmentsOptionsTest.java | 57 - ...ListPolicyTemplateVersionsOptionsTest.java | 51 - .../model/ListPolicyTemplatesOptionsTest.java | 63 - .../model/ListRoleAssignmentsOptionsTest.java | 55 - .../ListRoleTemplateVersionsOptionsTest.java | 51 - .../model/ListRoleTemplatesOptionsTest.java | 59 - .../v1/model/ListRolesOptionsTest.java | 49 - .../v1/model/ListV2PoliciesOptionsTest.java | 69 - .../NestedConditionRuleAttributeTest.java | 57 - ...NestedConditionRuleWithConditionsTest.java | 63 - .../v1/model/NestedConditionTest.java | 38 - .../v1/model/NextTest.java | 37 - .../PolicyAssignmentResourcePolicyTest.java | 44 - .../model/PolicyAssignmentResourcesTest.java | 44 - .../PolicyAssignmentV1CollectionTest.java | 55 - .../PolicyAssignmentV1ResourcesTest.java | 45 - .../model/PolicyAssignmentV1SubjectTest.java | 36 - .../v1/model/PolicyAssignmentV1Test.java | 51 - .../v1/model/PolicyCollectionTest.java | 52 - .../v1/model/PolicyResourceTest.java | 72 - .../v1/model/PolicyRoleTest.java | 51 - .../v1/model/PolicySubjectTest.java | 58 - ...olicyTemplateAssignmentCollectionTest.java | 55 - ...teAssignmentItemsPolicyAssignmentTest.java | 50 - ...AssignmentItemsPolicyAssignmentV1Test.java | 51 - .../PolicyTemplateAssignmentItemsTest.java | 48 - .../model/PolicyTemplateCollectionTest.java | 55 - .../v1/model/PolicyTemplateLimitDataTest.java | 56 - .../v1/model/PolicyTemplateMetaDataTest.java | 50 - .../v1/model/PolicyTemplateTest.java | 53 - .../PolicyTemplateVersionsCollectionTest.java | 55 - .../v1/model/PolicyTest.java | 48 - .../v1/model/PreviousTest.java | 37 - ...placeActionControlTemplateOptionsTest.java | 67 - .../v1/model/ReplacePolicyOptionsTest.java | 105 - .../ReplacePolicyTemplateOptionsTest.java | 147 - .../v1/model/ReplaceRoleOptionsTest.java | 53 - .../model/ReplaceRoleTemplateOptionsTest.java | 69 - .../v1/model/ReplaceV2PolicyOptionsTest.java | 133 - .../v1/model/ResourceAttributeTest.java | 57 - .../v1/model/ResourceTagTest.java | 57 - .../v1/model/RoleActionTest.java | 39 - .../model/RoleAssignmentCollectionTest.java | 47 - .../RoleAssignmentResourceCreatedTest.java | 37 - .../model/RoleAssignmentResourceRoleTest.java | 43 - .../v1/model/RoleAssignmentResourceTest.java | 45 - .../v1/model/RoleAssignmentTemplateTest.java | 54 - .../v1/model/RoleAssignmentTest.java | 40 - .../v1/model/RoleCollectionTest.java | 41 - .../v1/model/RoleTemplateCollectionTest.java | 46 - .../model/RoleTemplatePrototypeRoleTest.java | 62 - .../model/RoleTemplateReferencesItemTest.java | 54 - .../v1/model/RoleTemplateTest.java | 44 - .../RoleTemplateVersionsCollectionTest.java | 46 - .../v1/model/RoleTest.java | 56 - .../v1/model/RolesTest.java | 51 - .../v1/model/RuleAttributeTest.java | 57 - .../v1/model/SubjectAttributeTest.java | 54 - .../v1/model/TemplateActionControlTest.java | 56 - .../v1/model/TemplateControlTest.java | 63 - .../v1/model/TemplateCountDataTest.java | 39 - .../TemplateGrantRoleReferencesTest.java | 58 - .../v1/model/TemplateGrantRolesTest.java | 56 - .../v1/model/TemplateGrantTest.java | 39 - .../v1/model/TemplateMetadataTest.java | 41 - .../v1/model/TemplatePolicyTest.java | 141 - .../v1/model/TemplateRoleTest.java | 59 - ...ateActionControlAssignmentOptionsTest.java | 49 - .../UpdatePolicyAssignmentOptionsTest.java | 51 - .../model/UpdatePolicyStateOptionsTest.java | 49 - .../UpdateRoleAssignmentOptionsTest.java | 49 - .../v1/model/UpdateSettingsOptionsTest.java | 75 - .../v1/model/V2PolicyCollectionTest.java | 55 - .../model/V2PolicyResourceAttributeTest.java | 57 - .../v1/model/V2PolicyResourceTagTest.java | 57 - .../v1/model/V2PolicyResourceTest.java | 72 - .../model/V2PolicyRuleRuleAttributeTest.java | 57 - ...olicyRuleRuleWithNestedConditionsTest.java | 63 - .../v1/model/V2PolicyRuleTest.java | 38 - .../model/V2PolicySubjectAttributeTest.java | 57 - .../v1/model/V2PolicySubjectTest.java | 60 - .../model/V2PolicyTemplateMetaDataTest.java | 57 - .../v1/model/V2PolicyTest.java | 55 - .../v1/utils/TestUtilities.java | 131 - 333 files changed, 41258 deletions(-) delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java deleted file mode 100644 index 2abe3baea4e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java +++ /dev/null @@ -1,2566 +0,0 @@ -/* - * (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. - */ - -/* - * IBM OpenAPI SDK Code Generator Version: 3.107.1-41b0fbd0-20250825-080732 - */ - -package com.ibm.cloud.platform_services.iam_policy_management.v1; - -import com.google.gson.JsonObject; -import com.ibm.cloud.platform_services.common.SdkCommon; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; -import com.ibm.cloud.sdk.core.http.RequestBuilder; -import com.ibm.cloud.sdk.core.http.ResponseConverter; -import com.ibm.cloud.sdk.core.http.ServiceCall; -import com.ibm.cloud.sdk.core.security.Authenticator; -import com.ibm.cloud.sdk.core.security.ConfigBasedAuthenticatorFactory; -import com.ibm.cloud.sdk.core.service.BaseService; -import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -/** - * IAM Policy Management API. - * - * API Version: 1.0.1 - */ -public class IamPolicyManagement extends BaseService { - - /** - * Default service name used when configuring the `IamPolicyManagement` client. - */ - public static final String DEFAULT_SERVICE_NAME = "iam_policy_management"; - - /** - * Default service endpoint URL. - */ - public static final String DEFAULT_SERVICE_URL = "https://iam.cloud.ibm.com"; - - /** - * Class method which constructs an instance of the `IamPolicyManagement` client. - * The default service name is used to configure the client instance. - * - * @return an instance of the `IamPolicyManagement` client using external configuration - */ - public static IamPolicyManagement newInstance() { - return newInstance(DEFAULT_SERVICE_NAME); - } - - /** - * Class method which constructs an instance of the `IamPolicyManagement` client. - * The specified service name is used to configure the client instance. - * - * @param serviceName the service name to be used when configuring the client instance - * @return an instance of the `IamPolicyManagement` client using external configuration - */ - public static IamPolicyManagement newInstance(String serviceName) { - Authenticator authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(serviceName); - IamPolicyManagement service = new IamPolicyManagement(serviceName, authenticator); - service.configureService(serviceName); - return service; - } - - /** - * Constructs an instance of the `IamPolicyManagement` client. - * The specified service name and authenticator are used to configure the client instance. - * - * @param serviceName the service name to be used when configuring the client instance - * @param authenticator the {@link Authenticator} instance to be configured for this client - */ - public IamPolicyManagement(String serviceName, Authenticator authenticator) { - super(serviceName, authenticator); - setServiceUrl(DEFAULT_SERVICE_URL); - } - - /** - * Get policies by attributes. - * - * Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account - * and filter by attribute values. This can be done through query parameters. The following attributes are supported: - * account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query - * parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If - * the caller does not have read access to any policies an empty array is returned. - * - * @param listPoliciesOptions the {@link ListPoliciesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyCollection} - */ - public ServiceCall listPolicies(ListPoliciesOptions listPoliciesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listPoliciesOptions, - "listPoliciesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicies"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listPoliciesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listPoliciesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listPoliciesOptions.accountId())); - if (listPoliciesOptions.iamId() != null) { - builder.query("iam_id", String.valueOf(listPoliciesOptions.iamId())); - } - if (listPoliciesOptions.accessGroupId() != null) { - builder.query("access_group_id", String.valueOf(listPoliciesOptions.accessGroupId())); - } - if (listPoliciesOptions.type() != null) { - builder.query("type", String.valueOf(listPoliciesOptions.type())); - } - if (listPoliciesOptions.serviceType() != null) { - builder.query("service_type", String.valueOf(listPoliciesOptions.serviceType())); - } - if (listPoliciesOptions.tagName() != null) { - builder.query("tag_name", String.valueOf(listPoliciesOptions.tagName())); - } - if (listPoliciesOptions.tagValue() != null) { - builder.query("tag_value", String.valueOf(listPoliciesOptions.tagValue())); - } - if (listPoliciesOptions.sort() != null) { - builder.query("sort", String.valueOf(listPoliciesOptions.sort())); - } - if (listPoliciesOptions.format() != null) { - builder.query("format", String.valueOf(listPoliciesOptions.format())); - } - if (listPoliciesOptions.state() != null) { - builder.query("state", String.valueOf(listPoliciesOptions.state())); - } - if (listPoliciesOptions.limit() != null) { - builder.query("limit", String.valueOf(listPoliciesOptions.limit())); - } - if (listPoliciesOptions.start() != null) { - builder.query("start", String.valueOf(listPoliciesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a policy. - * - * Creates a policy to grant access between a subject and a resource. There are two types of policies: **access** and - * **authorization**. A policy administrator might want to create an access policy which grants access to a user, - * service-id, or an access group. They might also want to create an authorization policy and setup access between - * services. - * - * ### Access - * - * To create an access policy, use **`"type": "access"`** in the body. The possible subject attributes are - * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or - * service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. Assign roles - * that are supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or - * **`service_group_id`** attribute and the **`accountId`** attribute. The IAM Services group (`IAM`) is a subset of - * account management services that includes the IAM platform services IAM Identity, IAM Access Management, IAM Users - * Management, IAM Groups, and future IAM services. If the subject is a locked service-id, the request will fail. - * - * ### Authorization - * - * Authorization policies are supported by services on a case by case basis. Refer to service documentation to verify - * their support of authorization policies. To create an authorization policy, use **`"type": "authorization"`** in - * the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject - * attributes might be provided. The following attributes are supported: - * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are - * supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access - * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject - * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. - * - * ### Attribute Operators - * - * Currently, only the `stringEquals` and the `stringMatch` operators are available. Resource attributes may support - * one or both operators. For more information, see [Assigning access by using wildcard - * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). - * - * ### Attribute Validations - * - * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like - * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated - * against Global Catalog locations. - * - * @param createPolicyOptions the {@link CreatePolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Policy} - */ - public ServiceCall createPolicy(CreatePolicyOptions createPolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyOptions, - "createPolicyOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createPolicyOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createPolicyOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("type", createPolicyOptions.type()); - contentJson.add("subjects", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.subjects())); - contentJson.add("roles", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.roles())); - contentJson.add("resources", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.resources())); - if (createPolicyOptions.description() != null) { - contentJson.addProperty("description", createPolicyOptions.description()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a policy. - * - * Update a policy to grant access between a subject and a resource. A policy administrator might want to update an - * existing policy. The policy type cannot be changed (You cannot change an access policy to an authorization policy). - * - * ### Access - * - * To update an access policy, use **`"type": "access"`** in the body. The possible subject attributes are - * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or - * service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. Assign roles - * that are supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * The policy resource must include either the **`serviceType`**, **`serviceName`**, or **`resourceGroupId`** - * attribute and the **`accountId`** attribute.` If the subject is a locked service-id, the request will fail. - * - * ### Authorization - * - * To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match - * the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following - * attributes are supported: - * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are - * supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access - * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject - * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. - * - * ### Attribute Operators - * - * Currently, only the `stringEquals` and the `stringMatch` operators are available. Resource attributes might support - * one or both operators. For more information, see [Assigning access by using wildcard - * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). - * - * ### Attribute Validations - * - * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like - * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated - * against Global Catalog locations. - * - * @param replacePolicyOptions the {@link ReplacePolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Policy} - */ - public ServiceCall replacePolicy(ReplacePolicyOptions replacePolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replacePolicyOptions, - "replacePolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_id", replacePolicyOptions.policyId()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replacePolicy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replacePolicyOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("type", replacePolicyOptions.type()); - contentJson.add("subjects", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.subjects())); - contentJson.add("roles", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.roles())); - contentJson.add("resources", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.resources())); - if (replacePolicyOptions.description() != null) { - contentJson.addProperty("description", replacePolicyOptions.description()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a policy by ID. - * - * Retrieve a policy by providing a policy ID. - * - * @param getPolicyOptions the {@link GetPolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateMetaData} - */ - public ServiceCall getPolicy(GetPolicyOptions getPolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyOptions, - "getPolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_id", getPolicyOptions.policyId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicy"); - 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); - } - - /** - * Delete a policy by ID. - * - * Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service - * ID. If the subject of the policy is a locked service-id, the request will fail. - * - * @param deletePolicyOptions the {@link DeletePolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deletePolicy(DeletePolicyOptions deletePolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyOptions, - "deletePolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_id", deletePolicyOptions.policyId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Restore a deleted policy by ID. - * - * Restore a policy that has recently been deleted. A policy administrator might want to restore a deleted policy. To - * restore a policy, use **`"state": "active"`** in the body. - * - * @param updatePolicyStateOptions the {@link UpdatePolicyStateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Policy} - */ - public ServiceCall updatePolicyState(UpdatePolicyStateOptions updatePolicyStateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updatePolicyStateOptions, - "updatePolicyStateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_id", updatePolicyStateOptions.policyId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updatePolicyState"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updatePolicyStateOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - if (updatePolicyStateOptions.state() != null) { - contentJson.addProperty("state", updatePolicyStateOptions.state()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get roles by filters. - * - * Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can - * be done through query parameters. Currently, we only support the following attributes: account_id, service_name, - * service_group_id, source_service_name and policy_type. Both service_name and service_group_id attributes are - * mutually exclusive. Only roles that match the filter and that the caller has read access to are returned. If the - * caller does not have read access to any roles an empty array is returned. - * - * @param listRolesOptions the {@link ListRolesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleCollection} - */ - public ServiceCall listRoles(ListRolesOptions listRolesOptions) { - if (listRolesOptions == null) { - listRolesOptions = new ListRolesOptions.Builder().build(); - } - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoles"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listRolesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listRolesOptions.acceptLanguage()); - } - if (listRolesOptions.accountId() != null) { - builder.query("account_id", String.valueOf(listRolesOptions.accountId())); - } - if (listRolesOptions.serviceName() != null) { - builder.query("service_name", String.valueOf(listRolesOptions.serviceName())); - } - if (listRolesOptions.sourceServiceName() != null) { - builder.query("source_service_name", String.valueOf(listRolesOptions.sourceServiceName())); - } - if (listRolesOptions.policyType() != null) { - builder.query("policy_type", String.valueOf(listRolesOptions.policyType())); - } - if (listRolesOptions.serviceGroupId() != null) { - builder.query("service_group_id", String.valueOf(listRolesOptions.serviceGroupId())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get roles by filters. - * - * Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can - * be done through query parameters. Currently, we only support the following attributes: account_id, service_name, - * service_group_id, source_service_name and policy_type. Both service_name and service_group_id attributes are - * mutually exclusive. Only roles that match the filter and that the caller has read access to are returned. If the - * caller does not have read access to any roles an empty array is returned. - * - * @return a {@link ServiceCall} with a result of type {@link RoleCollection} - */ - public ServiceCall listRoles() { - return listRoles(null); - } - - /** - * Create a role. - * - * Creates a custom role for a specific service within the account. An account owner or a user assigned the - * Administrator role on the Role management service can create a custom role. Any number of actions for a single - * service can be mapped to the new role, but there must be at least one service-defined action to successfully create - * the new role. - * - * @param createRoleOptions the {@link CreateRoleOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link CustomRole} - */ - public ServiceCall createRole(CreateRoleOptions createRoleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleOptions, - "createRoleOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRole"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createRoleOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createRoleOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("display_name", createRoleOptions.displayName()); - contentJson.add("actions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleOptions.actions())); - contentJson.addProperty("name", createRoleOptions.name()); - contentJson.addProperty("account_id", createRoleOptions.accountId()); - contentJson.addProperty("service_name", createRoleOptions.serviceName()); - if (createRoleOptions.description() != null) { - contentJson.addProperty("description", createRoleOptions.description()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a role. - * - * Update a custom role. A role administrator might want to update an existing role by updating the display name, - * description, or the actions that are mapped to the role. The name, account_id, and service_name can't be changed. - * - * @param replaceRoleOptions the {@link ReplaceRoleOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link CustomRole} - */ - public ServiceCall replaceRole(ReplaceRoleOptions replaceRoleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceRoleOptions, - "replaceRoleOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_id", replaceRoleOptions.roleId()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceRole"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replaceRoleOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("display_name", replaceRoleOptions.displayName()); - contentJson.add("actions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRoleOptions.actions())); - if (replaceRoleOptions.description() != null) { - contentJson.addProperty("description", replaceRoleOptions.description()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a role by ID. - * - * Retrieve a role by providing a role ID. - * - * @param getRoleOptions the {@link GetRoleOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link CustomRole} - */ - public ServiceCall getRole(GetRoleOptions getRoleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleOptions, - "getRoleOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_id", getRoleOptions.roleId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRole"); - 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); - } - - /** - * Delete a role by ID. - * - * Delete a role by providing a role ID. - * - * @param deleteRoleOptions the {@link DeleteRoleOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteRole(DeleteRoleOptions deleteRoleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleOptions, - "deleteRoleOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_id", deleteRoleOptions.roleId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRole"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get policies by attributes. - * - * Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account - * and filter by attribute values. This can be done through query parameters. The following attributes are supported: - * account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query - * parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If - * the caller does not have read access to any policies an empty array is returned. - * - * @param listV2PoliciesOptions the {@link ListV2PoliciesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link V2PolicyCollection} - */ - public ServiceCall listV2Policies(ListV2PoliciesOptions listV2PoliciesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listV2PoliciesOptions, - "listV2PoliciesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listV2Policies"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listV2PoliciesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listV2PoliciesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listV2PoliciesOptions.accountId())); - if (listV2PoliciesOptions.iamId() != null) { - builder.query("iam_id", String.valueOf(listV2PoliciesOptions.iamId())); - } - if (listV2PoliciesOptions.accessGroupId() != null) { - builder.query("access_group_id", String.valueOf(listV2PoliciesOptions.accessGroupId())); - } - if (listV2PoliciesOptions.type() != null) { - builder.query("type", String.valueOf(listV2PoliciesOptions.type())); - } - if (listV2PoliciesOptions.serviceType() != null) { - builder.query("service_type", String.valueOf(listV2PoliciesOptions.serviceType())); - } - if (listV2PoliciesOptions.serviceName() != null) { - builder.query("service_name", String.valueOf(listV2PoliciesOptions.serviceName())); - } - if (listV2PoliciesOptions.serviceGroupId() != null) { - builder.query("service_group_id", String.valueOf(listV2PoliciesOptions.serviceGroupId())); - } - if (listV2PoliciesOptions.sort() != null) { - builder.query("sort", String.valueOf(listV2PoliciesOptions.sort())); - } - if (listV2PoliciesOptions.format() != null) { - builder.query("format", String.valueOf(listV2PoliciesOptions.format())); - } - if (listV2PoliciesOptions.state() != null) { - builder.query("state", String.valueOf(listV2PoliciesOptions.state())); - } - if (listV2PoliciesOptions.limit() != null) { - builder.query("limit", String.valueOf(listV2PoliciesOptions.limit())); - } - if (listV2PoliciesOptions.start() != null) { - builder.query("start", String.valueOf(listV2PoliciesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a policy. - * - * Creates a policy to grant access between a subject and a resource. Currently, there is one type of a v2/policy: - * **access**. A policy administrator might want to create an access policy that grants access to a user, service-id, - * or an access group. - * - * ### Access - * - * To create an access policy, use **`"type": "access"`** in the body. The supported subject attributes are - * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute to assign access to a user or - * service-id. Use the **`access_group_id`** subject attribute to assign access to an access group. Assign roles that - * are supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or - * **`service_group_id`** attribute and the **`accountId`** attribute. In the rule field, you can specify a single - * condition by using **`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`** with a - * combination **`operator`**. The possible combination operators are **`and`** and **`or`**. - * - * Currently, we support two types of patterns: - * - * 1. `time-based`: Used to specify a time-based restriction - * - * Combine conditions to specify a time-based restriction (e.g., access only during business hours, during the - * Monday-Friday work week). For example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following - * rule: - * ```json - * "rule": { - * "operator": "and", - * "conditions": [{ - * "key": "{{environment.attributes.day_of_week}}", - * "operator": "dayOfWeekAnyOf", - * "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] - * }, - * "key": "{{environment.attributes.current_time}}", - * "operator": "timeGreaterThanOrEquals", - * "value": "09:00:00+00:00" - * }, - * "key": "{{environment.attributes.current_time}}", - * "operator": "timeLessThanOrEquals", - * "value": "17:00:00+00:00" - * }] - * } - * ``` You can use the following operators in the **`key`** and **`value`** pair: - * ``` - * 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', - * 'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan', 'dateGreaterThanOrEquals', - * 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', - * 'dayOfWeekEquals', 'dayOfWeekAnyOf' - * ``` - * - * The pattern field that matches the rule is required when rule is provided. For the business hour rule example - * above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions - * operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) and - * [Limiting access with time-based conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the - * subject is a locked service-id, the request will fail. - * - * 2. `attribute-based`: Used to specify a combination of OR/AND based conditions applied on resource attributes. - * - * Combine conditions to specify an attribute-based condition using AND/OR-based operators. - * - * For example, a policy can grant access based on multiple conditions applied on the resource attributes below: - * ```json - * "pattern": "attribute-based-condition:resource:literal-and-wildcard" - * "rule": { - * "operator": "or", - * "conditions": [ - * { - * "operator": "and", - * "conditions": [ - * { - * "key": "{{resource.attributes.prefix}}", - * "operator": "stringEquals", - * "value": "home/test" - * }, - * { - * "key": "{{environment.attributes.delimiter}}", - * "operator": "stringEquals", - * "value": "/" - * } - * ] - * }, - * { - * "key": "{{resource.attributes.path}}", - * "operator": "stringMatch", - * "value": "home/David/_*" - * } - * ] - * } - * ``` - * - * In addition to satisfying the `resources` section, the policy grants permission only if either the `path` begins - * with `home/David/` **OR** the `prefix` is `home/test` and the `delimiter` is `/`. This mechanism helps you - * consolidate multiple policies in to a single policy, making policies easier to administer and stay within the - * policy limit for an account. View the list of operators that can be used in the condition - * [here](/docs/account?topic=account-wildcard#string-comparisons). - * - * ### Authorization - * - * Authorization policies are supported by services on a case by case basis. Refer to service documentation to verify - * their support of authorization policies. To create an authorization policy, use **`"type": "authorization"`** in - * the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject - * attributes might be provided. The following attributes are supported: - * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are - * supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access - * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject - * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. - * - * ### Attribute Operators - * - * Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators are available. For more - * information, see [Assigning access by using wildcard - * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). - * - * ### Attribute Validations - * - * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like - * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated - * against Global Catalog locations. - * - * @param createV2PolicyOptions the {@link CreateV2PolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link V2Policy} - */ - public ServiceCall createV2Policy(CreateV2PolicyOptions createV2PolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createV2PolicyOptions, - "createV2PolicyOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createV2Policy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createV2PolicyOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createV2PolicyOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.add("control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.control())); - contentJson.addProperty("type", createV2PolicyOptions.type()); - if (createV2PolicyOptions.description() != null) { - contentJson.addProperty("description", createV2PolicyOptions.description()); - } - if (createV2PolicyOptions.subject() != null) { - contentJson.add("subject", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.subject())); - } - if (createV2PolicyOptions.resource() != null) { - contentJson.add("resource", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.resource())); - } - if (createV2PolicyOptions.pattern() != null) { - contentJson.addProperty("pattern", createV2PolicyOptions.pattern()); - } - if (createV2PolicyOptions.rule() != null) { - contentJson.add("rule", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.rule())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a policy. - * - * Update a policy to grant access between a subject and a resource. A policy administrator might want to update an - * existing policy. - * - * ### Access - * - * To update an access policy, use **`"type": "access"`** in the body. The supported subject attributes are - * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute to assign access to a user or - * service-id. Use the **`access_group_id`** subject attribute to assign access to an access group. Assign roles that - * are supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or - * **`service_group_id`** attribute and the **`accountId`** attribute. In the rule field, you can specify a single - * condition by using **`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`** with a - * combination **`operator`**. The possible combination operators are **`and`** and **`or`**. - * - * Currently, we support two types of patterns: - * - * 1. `time-based`: Used to specify a time-based restriction - * - * Combine conditions to specify a time-based restriction (e.g., access only during business hours, during the - * Monday-Friday work week). For example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following - * rule: - * ```json - * "rule": { - * "operator": "and", - * "conditions": [{ - * "key": "{{environment.attributes.day_of_week}}", - * "operator": "dayOfWeekAnyOf", - * "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] - * }, - * "key": "{{environment.attributes.current_time}}", - * "operator": "timeGreaterThanOrEquals", - * "value": "09:00:00+00:00" - * }, - * "key": "{{environment.attributes.current_time}}", - * "operator": "timeLessThanOrEquals", - * "value": "17:00:00+00:00" - * }] - * } - * ``` You can use the following operators in the **`key`** and **`value`** pair: - * ``` - * 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', - * 'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan', 'dateGreaterThanOrEquals', - * 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', - * 'dayOfWeekEquals', 'dayOfWeekAnyOf' - * ``` The pattern field that matches the rule is required when rule is provided. For the business hour rule example - * above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions - * operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) and - * [Limiting access with time-based conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the - * subject is a locked service-id, the request will fail. - * - * 2. `attribute-based`: Used to specify a combination of OR/AND based conditions applied on resource attributes. - * - * Combine conditions to specify an attribute-based condition using AND/OR-based operators. - * - * For example, a policy can grant access based on multiple conditions applied on the resource attributes below: - * ```json - * "pattern": "attribute-based-condition:resource:literal-and-wildcard" - * "rule": { - * "operator": "or", - * "conditions": [ - * { - * "operator": "and", - * "conditions": [ - * { - * "key": "{{resource.attributes.prefix}}", - * "operator": "stringEquals", - * "value": "home/test" - * }, - * { - * "key": "{{environment.attributes.delimiter}}", - * "operator": "stringEquals", - * "value": "/" - * } - * ] - * }, - * { - * "key": "{{resource.attributes.path}}", - * "operator": "stringMatch", - * "value": "home/David/_*" - * } - * ] - * } - * ``` - * - * In addition to satisfying the `resources` section, the policy grants permission only if either the `path` begins - * with `home/David/` **OR** the `prefix` is `home/test` and the `delimiter` is `/`. This mechanism helps you - * consolidate multiple policies in to a single policy, making policies easier to administer and stay within the - * policy limit for an account. View the list of operators that can be used in the condition - * [here](/docs/account?topic=account-wildcard#string-comparisons). - * - * ### Authorization - * - * To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match - * the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following - * attributes are supported: - * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are - * supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access - * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject - * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. - * - * ### Attribute Operators - * - * Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators are available. For more - * information, see [Assigning access by using wildcard - * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). - * - * ### Attribute Validations - * - * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like - * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated - * against Global Catalog locations. - * - * @param replaceV2PolicyOptions the {@link ReplaceV2PolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link V2Policy} - */ - public ServiceCall replaceV2Policy(ReplaceV2PolicyOptions replaceV2PolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceV2PolicyOptions, - "replaceV2PolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", replaceV2PolicyOptions.id()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceV2Policy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replaceV2PolicyOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.add("control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.control())); - contentJson.addProperty("type", replaceV2PolicyOptions.type()); - if (replaceV2PolicyOptions.description() != null) { - contentJson.addProperty("description", replaceV2PolicyOptions.description()); - } - if (replaceV2PolicyOptions.subject() != null) { - contentJson.add("subject", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.subject())); - } - if (replaceV2PolicyOptions.resource() != null) { - contentJson.add("resource", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.resource())); - } - if (replaceV2PolicyOptions.pattern() != null) { - contentJson.addProperty("pattern", replaceV2PolicyOptions.pattern()); - } - if (replaceV2PolicyOptions.rule() != null) { - contentJson.add("rule", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.rule())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a policy by ID. - * - * Retrieve a policy by providing a policy ID. - * - * @param getV2PolicyOptions the {@link GetV2PolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link V2PolicyTemplateMetaData} - */ - public ServiceCall getV2Policy(GetV2PolicyOptions getV2PolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getV2PolicyOptions, - "getV2PolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", getV2PolicyOptions.id()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getV2Policy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getV2PolicyOptions.format() != null) { - builder.query("format", String.valueOf(getV2PolicyOptions.format())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a policy by ID. - * - * Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service - * ID. If the subject of the policy is a locked service-id, the request will fail. - * - * @param deleteV2PolicyOptions the {@link DeleteV2PolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteV2Policy(DeleteV2PolicyOptions deleteV2PolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteV2PolicyOptions, - "deleteV2PolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", deleteV2PolicyOptions.id()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteV2Policy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List policy templates by attributes. - * - * List policy templates and filter by attributes by using query parameters. The following attributes are supported: - * `account_id`, `policy_service_name`, `policy_service_type`, `policy_service_group_id` and `policy_type`. - * `account_id` is a required query parameter. These attributes `policy_service_name`, `policy_service_type` and - * `policy_service_group_id` are mutually exclusive. Only policy templates that have the specified attributes and that - * the caller has read access to are returned. If the caller does not have read access to any policy templates an - * empty array is returned. - * - * @param listPolicyTemplatesOptions the {@link ListPolicyTemplatesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateCollection} - */ - public ServiceCall listPolicyTemplates(ListPolicyTemplatesOptions listPolicyTemplatesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyTemplatesOptions, - "listPolicyTemplatesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyTemplates"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listPolicyTemplatesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listPolicyTemplatesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listPolicyTemplatesOptions.accountId())); - if (listPolicyTemplatesOptions.state() != null) { - builder.query("state", String.valueOf(listPolicyTemplatesOptions.state())); - } - if (listPolicyTemplatesOptions.name() != null) { - builder.query("name", String.valueOf(listPolicyTemplatesOptions.name())); - } - if (listPolicyTemplatesOptions.policyServiceType() != null) { - builder.query("policy_service_type", String.valueOf(listPolicyTemplatesOptions.policyServiceType())); - } - if (listPolicyTemplatesOptions.policyServiceName() != null) { - builder.query("policy_service_name", String.valueOf(listPolicyTemplatesOptions.policyServiceName())); - } - if (listPolicyTemplatesOptions.policyServiceGroupId() != null) { - builder.query("policy_service_group_id", String.valueOf(listPolicyTemplatesOptions.policyServiceGroupId())); - } - if (listPolicyTemplatesOptions.policyType() != null) { - builder.query("policy_type", String.valueOf(listPolicyTemplatesOptions.policyType())); - } - if (listPolicyTemplatesOptions.limit() != null) { - builder.query("limit", String.valueOf(listPolicyTemplatesOptions.limit())); - } - if (listPolicyTemplatesOptions.start() != null) { - builder.query("start", String.valueOf(listPolicyTemplatesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a policy template. - * - * Create a policy template. Policy templates define a policy without requiring a subject, and you can use them to - * grant access to multiple subjects. - * - * @param createPolicyTemplateOptions the {@link CreatePolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateLimitData} - */ - public ServiceCall createPolicyTemplate(CreatePolicyTemplateOptions createPolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateOptions, - "createPolicyTemplateOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createPolicyTemplateOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createPolicyTemplateOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("name", createPolicyTemplateOptions.name()); - contentJson.addProperty("account_id", createPolicyTemplateOptions.accountId()); - contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateOptions.policy())); - if (createPolicyTemplateOptions.description() != null) { - contentJson.addProperty("description", createPolicyTemplateOptions.description()); - } - if (createPolicyTemplateOptions.committed() != null) { - contentJson.addProperty("committed", createPolicyTemplateOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve latest version of a policy template. - * - * Retrieve the latest version of a policy template by providing a policy template ID. - * - * @param getPolicyTemplateOptions the {@link GetPolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} - */ - public ServiceCall getPolicyTemplate(GetPolicyTemplateOptions getPolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyTemplateOptions, - "getPolicyTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", getPolicyTemplateOptions.policyTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getPolicyTemplateOptions.state() != null) { - builder.query("state", String.valueOf(getPolicyTemplateOptions.state())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a policy template. - * - * Delete a policy template by providing the policy template ID. This deletes all versions of this template. A policy - * template can't be deleted if any version of the template is assigned to one or more child accounts. You must remove - * the policy assignments first. - * - * @param deletePolicyTemplateOptions the {@link DeletePolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deletePolicyTemplate(DeletePolicyTemplateOptions deletePolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyTemplateOptions, - "deletePolicyTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", deletePolicyTemplateOptions.policyTemplateId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a new policy template version. - * - * Create a new version of a policy template. Use this if you need to make updates to a policy template that is - * committed. - * - * @param createPolicyTemplateVersionOptions the {@link CreatePolicyTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateLimitData} - */ - public ServiceCall createPolicyTemplateVersion(CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateVersionOptions, - "createPolicyTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", createPolicyTemplateVersionOptions.policyTemplateId()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - final JsonObject contentJson = new JsonObject(); - contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateVersionOptions.policy())); - if (createPolicyTemplateVersionOptions.name() != null) { - contentJson.addProperty("name", createPolicyTemplateVersionOptions.name()); - } - if (createPolicyTemplateVersionOptions.description() != null) { - contentJson.addProperty("description", createPolicyTemplateVersionOptions.description()); - } - if (createPolicyTemplateVersionOptions.committed() != null) { - contentJson.addProperty("committed", createPolicyTemplateVersionOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve policy template versions. - * - * Retrieve the versions of a policy template by providing a policy template ID. - * - * @param listPolicyTemplateVersionsOptions the {@link ListPolicyTemplateVersionsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateVersionsCollection} - */ - public ServiceCall listPolicyTemplateVersions(ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyTemplateVersionsOptions, - "listPolicyTemplateVersionsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", listPolicyTemplateVersionsOptions.policyTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyTemplateVersions"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listPolicyTemplateVersionsOptions.state() != null) { - builder.query("state", String.valueOf(listPolicyTemplateVersionsOptions.state())); - } - if (listPolicyTemplateVersionsOptions.limit() != null) { - builder.query("limit", String.valueOf(listPolicyTemplateVersionsOptions.limit())); - } - if (listPolicyTemplateVersionsOptions.start() != null) { - builder.query("start", String.valueOf(listPolicyTemplateVersionsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a policy template version. - * - * Update a specific version of a policy template. You can use this only if the version isn't committed. - * - * @param replacePolicyTemplateOptions the {@link ReplacePolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} - */ - public ServiceCall replacePolicyTemplate(ReplacePolicyTemplateOptions replacePolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replacePolicyTemplateOptions, - "replacePolicyTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", replacePolicyTemplateOptions.policyTemplateId()); - pathParamsMap.put("version", replacePolicyTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replacePolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replacePolicyTemplateOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyTemplateOptions.policy())); - if (replacePolicyTemplateOptions.name() != null) { - contentJson.addProperty("name", replacePolicyTemplateOptions.name()); - } - if (replacePolicyTemplateOptions.description() != null) { - contentJson.addProperty("description", replacePolicyTemplateOptions.description()); - } - if (replacePolicyTemplateOptions.committed() != null) { - contentJson.addProperty("committed", replacePolicyTemplateOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a policy template version. - * - * Delete a specific version of a policy template by providing a policy template ID and version number. You can't - * delete a policy template version that is assigned to one or more child accounts. You must remove the policy - * assignments first. - * - * @param deletePolicyTemplateVersionOptions the {@link DeletePolicyTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deletePolicyTemplateVersion(DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyTemplateVersionOptions, - "deletePolicyTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", deletePolicyTemplateVersionOptions.policyTemplateId()); - pathParamsMap.put("version", deletePolicyTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a policy template version. - * - * Retrieve a policy template by providing a policy template ID and version number. - * - * @param getPolicyTemplateVersionOptions the {@link GetPolicyTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} - */ - public ServiceCall getPolicyTemplateVersion(GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyTemplateVersionOptions, - "getPolicyTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", getPolicyTemplateVersionOptions.policyTemplateId()); - pathParamsMap.put("version", getPolicyTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyTemplateVersion"); - 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); - } - - /** - * Commit a policy template version. - * - * Commit a policy template version. You can make no further changes to the policy template once it's committed. If - * you need to make updates after committing a version, create a new version. - * - * @param commitPolicyTemplateOptions the {@link CommitPolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall commitPolicyTemplate(CommitPolicyTemplateOptions commitPolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(commitPolicyTemplateOptions, - "commitPolicyTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", commitPolicyTemplateOptions.policyTemplateId()); - pathParamsMap.put("version", commitPolicyTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}/commit", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitPolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get policy template assignments. - * - * Get policy template assignments by attributes. The following attributes are supported: - * `account_id`, `template_id`, `template_version`, `sort`. - * `account_id` is a required query parameter. Only policy template assignments that have the specified attributes and - * that the caller has read access to are returned. If the caller does not have read access to any policy template - * assignments an empty array is returned. - * - * @param listPolicyAssignmentsOptions the {@link ListPolicyAssignmentsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateAssignmentCollection} - */ - public ServiceCall listPolicyAssignments(ListPolicyAssignmentsOptions listPolicyAssignmentsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyAssignmentsOptions, - "listPolicyAssignmentsOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyAssignments"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listPolicyAssignmentsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listPolicyAssignmentsOptions.acceptLanguage()); - } - builder.query("version", String.valueOf(listPolicyAssignmentsOptions.version())); - builder.query("account_id", String.valueOf(listPolicyAssignmentsOptions.accountId())); - if (listPolicyAssignmentsOptions.templateId() != null) { - builder.query("template_id", String.valueOf(listPolicyAssignmentsOptions.templateId())); - } - if (listPolicyAssignmentsOptions.templateVersion() != null) { - builder.query("template_version", String.valueOf(listPolicyAssignmentsOptions.templateVersion())); - } - if (listPolicyAssignmentsOptions.limit() != null) { - builder.query("limit", String.valueOf(listPolicyAssignmentsOptions.limit())); - } - if (listPolicyAssignmentsOptions.start() != null) { - builder.query("start", String.valueOf(listPolicyAssignmentsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a policy authorization template assignment. - * - * Assign a policy template to child accounts and account groups. This creates the policy in the accounts and account - * groups that you specify. - * - * @param createPolicyTemplateAssignmentOptions the {@link CreatePolicyTemplateAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyAssignmentV1Collection} - */ - public ServiceCall createPolicyTemplateAssignment(CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateAssignmentOptions, - "createPolicyTemplateAssignmentOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplateAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createPolicyTemplateAssignmentOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createPolicyTemplateAssignmentOptions.acceptLanguage()); - } - builder.query("version", String.valueOf(createPolicyTemplateAssignmentOptions.version())); - final JsonObject contentJson = new JsonObject(); - contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateAssignmentOptions.target())); - contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateAssignmentOptions.templates())); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a policy assignment. - * - * Retrieve a policy template assignment by providing a policy assignment ID. - * - * @param getPolicyAssignmentOptions the {@link GetPolicyAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateAssignmentItems} - */ - public ServiceCall getPolicyAssignment(GetPolicyAssignmentOptions getPolicyAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyAssignmentOptions, - "getPolicyAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", getPolicyAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(getPolicyAssignmentOptions.version())); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a policy authorization type assignment. - * - * Update a policy assignment by providing a policy assignment ID. - * - * @param updatePolicyAssignmentOptions the {@link UpdatePolicyAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyAssignmentV1} - */ - public ServiceCall updatePolicyAssignment(UpdatePolicyAssignmentOptions updatePolicyAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updatePolicyAssignmentOptions, - "updatePolicyAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", updatePolicyAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updatePolicyAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updatePolicyAssignmentOptions.ifMatch()); - builder.query("version", String.valueOf(updatePolicyAssignmentOptions.version())); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("template_version", updatePolicyAssignmentOptions.templateVersion()); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Remove a policy assignment. - * - * Remove a policy template assignment by providing a policy assignment ID. You can't delete a policy assignment if - * the status is "in_progress". - * - * @param deletePolicyAssignmentOptions the {@link DeletePolicyAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deletePolicyAssignment(DeletePolicyAssignmentOptions deletePolicyAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyAssignmentOptions, - "deletePolicyAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", deletePolicyAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve Access Management account settings by account ID. - * - * Retrieve Access Management settings for an account by providing the account ID. - * - * @param getSettingsOptions the {@link GetSettingsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AccountSettingsAccessManagement} - */ - public ServiceCall getSettings(GetSettingsOptions getSettingsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getSettingsOptions, - "getSettingsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", getSettingsOptions.accountId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/settings/access_management", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getSettings"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getSettingsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", getSettingsOptions.acceptLanguage()); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update Access Management account settings by account ID. - * - * Update access management settings for an account. - * - * ### External Account Identity Interaction - * - * Update the way identities within an external account are allowed to interact with the requested account by - * providing: - * * the `account_id` as a parameter - * * one or more external account ID(s) and state for the specific identity in the request body - * - * External account identity interaction includes the following `identity_types`: `user` (user identities that are - * defined as [IBMid's](https://cloud.ibm.com/docs/account?topic=account-identity-overview#users-bestpract)), - * `service_id` (defined as [IAM - * ServiceIds](https://cloud.ibm.com/docs/account?topic=account-identity-overview#serviceid-bestpract)), `service` - * (defined by a service’s [CRN](https://cloud.ibm.com/docs/account?topic=account-crn)). To update an Identity’s - * setting, the `state` and `external_allowed_accounts` fields are required. - * - * Different identity states are: - * * "enabled": An identity type is allowed to access resources in the account provided it has access policies on - * those resources. - * * "limited": An identity type is allowed to access resources in the account provided it has access policies on - * those resources AND it is associated with either the account the resources are in or one of the allowed accounts. - * This setting uses the "external_allowed_accounts" list. - * * "monitor": It has no direct impact on an Identity’s access. Instead, it creates AT events for access decisions as - * if the account were in a limited “state”. - * - * **Note**: The state "enabled" is a special case. In this case, access is given to all accounts and there is no need - * to specify a particular list. Therefore, when updating "state" to "enabled" for an identity type - * "external_allowed_accounts" should be left empty. - * - * @param updateSettingsOptions the {@link UpdateSettingsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AccountSettingsAccessManagement} - */ - public ServiceCall updateSettings(UpdateSettingsOptions updateSettingsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateSettingsOptions, - "updateSettingsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", updateSettingsOptions.accountId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/settings/access_management", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateSettings"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updateSettingsOptions.ifMatch()); - if (updateSettingsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", updateSettingsOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - if (updateSettingsOptions.externalAccountIdentityInteraction() != null) { - contentJson.add("external_account_identity_interaction", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateSettingsOptions.externalAccountIdentityInteraction())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List action control templates by attributes. - * - * List action control templates and filter by attributes by using query parameters. The following attributes are - * supported: - * `account_id` - * `account_id` is a required query parameter. Only action control templates that have the specified attributes and - * that the caller has read access to are returned. If the caller does not have read access to any action control - * templates an empty array is returned. - * - * @param listActionControlTemplatesOptions the {@link ListActionControlTemplatesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplateCollection} - */ - public ServiceCall listActionControlTemplates(ListActionControlTemplatesOptions listActionControlTemplatesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlTemplatesOptions, - "listActionControlTemplatesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlTemplates"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listActionControlTemplatesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listActionControlTemplatesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listActionControlTemplatesOptions.accountId())); - if (listActionControlTemplatesOptions.limit() != null) { - builder.query("limit", String.valueOf(listActionControlTemplatesOptions.limit())); - } - if (listActionControlTemplatesOptions.start() != null) { - builder.query("start", String.valueOf(listActionControlTemplatesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create an action control template. - * - * Create an action control template. Action control templates define a service action control. - * - * @param createActionControlTemplateOptions the {@link CreateActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall createActionControlTemplate(CreateActionControlTemplateOptions createActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateOptions, - "createActionControlTemplateOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createActionControlTemplateOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createActionControlTemplateOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("name", createActionControlTemplateOptions.name()); - contentJson.addProperty("account_id", createActionControlTemplateOptions.accountId()); - if (createActionControlTemplateOptions.description() != null) { - contentJson.addProperty("description", createActionControlTemplateOptions.description()); - } - if (createActionControlTemplateOptions.committed() != null) { - contentJson.addProperty("committed", createActionControlTemplateOptions.committed()); - } - if (createActionControlTemplateOptions.actionControl() != null) { - contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateOptions.actionControl())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve the latest version of an action control template. - * - * Retrieve the latest version of an action control template by providing an action control template ID. - * - * @param getActionControlTemplateOptions the {@link GetActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall getActionControlTemplate(GetActionControlTemplateOptions getActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlTemplateOptions, - "getActionControlTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", getActionControlTemplateOptions.actionControlTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getActionControlTemplateOptions.state() != null) { - builder.query("state", String.valueOf(getActionControlTemplateOptions.state())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete an action control template. - * - * Delete an action control template by providing the action control template ID. This deletes all versions of this - * template. An action control template can't be deleted if any version of the template is assigned to one or more - * child accounts. You must remove the action control assignments first. - * - * @param deleteActionControlTemplateOptions the {@link DeleteActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteActionControlTemplate(DeleteActionControlTemplateOptions deleteActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlTemplateOptions, - "deleteActionControlTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", deleteActionControlTemplateOptions.actionControlTemplateId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a new action control template version. - * - * Create a new version of an action control template. Use this if you need to make updates to an action control - * template that is committed. - * - * @param createActionControlTemplateVersionOptions the {@link CreateActionControlTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall createActionControlTemplateVersion(CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateVersionOptions, - "createActionControlTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", createActionControlTemplateVersionOptions.actionControlTemplateId()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - final JsonObject contentJson = new JsonObject(); - if (createActionControlTemplateVersionOptions.name() != null) { - contentJson.addProperty("name", createActionControlTemplateVersionOptions.name()); - } - if (createActionControlTemplateVersionOptions.description() != null) { - contentJson.addProperty("description", createActionControlTemplateVersionOptions.description()); - } - if (createActionControlTemplateVersionOptions.actionControl() != null) { - contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateVersionOptions.actionControl())); - } - if (createActionControlTemplateVersionOptions.committed() != null) { - contentJson.addProperty("committed", createActionControlTemplateVersionOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve action control template versions. - * - * Retrieve the versions of an action control template by providing an action control template ID. - * - * @param listActionControlTemplateVersionsOptions the {@link ListActionControlTemplateVersionsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplateVersionsCollection} - */ - public ServiceCall listActionControlTemplateVersions(ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlTemplateVersionsOptions, - "listActionControlTemplateVersionsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", listActionControlTemplateVersionsOptions.actionControlTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlTemplateVersions"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listActionControlTemplateVersionsOptions.state() != null) { - builder.query("state", String.valueOf(listActionControlTemplateVersionsOptions.state())); - } - if (listActionControlTemplateVersionsOptions.limit() != null) { - builder.query("limit", String.valueOf(listActionControlTemplateVersionsOptions.limit())); - } - if (listActionControlTemplateVersionsOptions.start() != null) { - builder.query("start", String.valueOf(listActionControlTemplateVersionsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update an action control template version. - * - * Update a specific version of an action control template. You can use this only if the version isn't committed. - * - * @param replaceActionControlTemplateOptions the {@link ReplaceActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall replaceActionControlTemplate(ReplaceActionControlTemplateOptions replaceActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceActionControlTemplateOptions, - "replaceActionControlTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", replaceActionControlTemplateOptions.actionControlTemplateId()); - pathParamsMap.put("version", replaceActionControlTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replaceActionControlTemplateOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - if (replaceActionControlTemplateOptions.name() != null) { - contentJson.addProperty("name", replaceActionControlTemplateOptions.name()); - } - if (replaceActionControlTemplateOptions.description() != null) { - contentJson.addProperty("description", replaceActionControlTemplateOptions.description()); - } - if (replaceActionControlTemplateOptions.actionControl() != null) { - contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceActionControlTemplateOptions.actionControl())); - } - if (replaceActionControlTemplateOptions.committed() != null) { - contentJson.addProperty("committed", replaceActionControlTemplateOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete an action control template version. - * - * Delete a specific version of an action control template by providing an action control template ID and version - * number. You can't delete an action control template version that is assigned to one or more child accounts. You - * must remove the action control assignments first. - * - * @param deleteActionControlTemplateVersionOptions the {@link DeleteActionControlTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteActionControlTemplateVersion(DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlTemplateVersionOptions, - "deleteActionControlTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", deleteActionControlTemplateVersionOptions.actionControlTemplateId()); - pathParamsMap.put("version", deleteActionControlTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve an action control template version. - * - * Retrieve an action control template by providing an action control template ID and version number. - * - * @param getActionControlTemplateVersionOptions the {@link GetActionControlTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall getActionControlTemplateVersion(GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlTemplateVersionOptions, - "getActionControlTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", getActionControlTemplateVersionOptions.actionControlTemplateId()); - pathParamsMap.put("version", getActionControlTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlTemplateVersion"); - 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); - } - - /** - * Commit an action control template version. - * - * Commit an action control template version. You cannot make any further changes to the action control template once - * it's committed. If you have to make updates after committing a version, create a new version. - * - * @param commitActionControlTemplateOptions the {@link CommitActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall commitActionControlTemplate(CommitActionControlTemplateOptions commitActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(commitActionControlTemplateOptions, - "commitActionControlTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", commitActionControlTemplateOptions.actionControlTemplateId()); - pathParamsMap.put("version", commitActionControlTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}/commit", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get action control template assignments. - * - * Get action control template assignments by attributes. The following attributes are supported: - * `account_id`, `template_id`, `template_version`, `sort`. - * `account_id` is a required query parameter. Only action control template assignments with the specified attributes - * and accessible by the caller are returned. If the caller does not have read access to any action control template - * assignments, an empty array is returned. - * - * @param listActionControlAssignmentsOptions the {@link ListActionControlAssignmentsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignmentCollection} - */ - public ServiceCall listActionControlAssignments(ListActionControlAssignmentsOptions listActionControlAssignmentsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlAssignmentsOptions, - "listActionControlAssignmentsOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlAssignments"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listActionControlAssignmentsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listActionControlAssignmentsOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listActionControlAssignmentsOptions.accountId())); - if (listActionControlAssignmentsOptions.templateId() != null) { - builder.query("template_id", String.valueOf(listActionControlAssignmentsOptions.templateId())); - } - if (listActionControlAssignmentsOptions.templateVersion() != null) { - builder.query("template_version", String.valueOf(listActionControlAssignmentsOptions.templateVersion())); - } - if (listActionControlAssignmentsOptions.limit() != null) { - builder.query("limit", String.valueOf(listActionControlAssignmentsOptions.limit())); - } - if (listActionControlAssignmentsOptions.start() != null) { - builder.query("start", String.valueOf(listActionControlAssignmentsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create an action control template assignment. - * - * Assign an action control template to child accounts and account groups. This creates the action control in the - * accounts and account groups that you specify. - * - * @param createActionControlTemplateAssignmentOptions the {@link CreateActionControlTemplateAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignmentCollection} - */ - public ServiceCall createActionControlTemplateAssignment(CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateAssignmentOptions, - "createActionControlTemplateAssignmentOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplateAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createActionControlTemplateAssignmentOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createActionControlTemplateAssignmentOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateAssignmentOptions.target())); - contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateAssignmentOptions.templates())); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve an action control assignment. - * - * Retrieve an action control template assignment by providing an action control assignment ID. - * - * @param getActionControlAssignmentOptions the {@link GetActionControlAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignment} - */ - public ServiceCall getActionControlAssignment(GetActionControlAssignmentOptions getActionControlAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlAssignmentOptions, - "getActionControlAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", getActionControlAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlAssignment"); - 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 an action control assignment. - * - * Update an action control assignment by providing an action control assignment ID. - * - * @param updateActionControlAssignmentOptions the {@link UpdateActionControlAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignment} - */ - public ServiceCall updateActionControlAssignment(UpdateActionControlAssignmentOptions updateActionControlAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateActionControlAssignmentOptions, - "updateActionControlAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", updateActionControlAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateActionControlAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updateActionControlAssignmentOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("template_version", updateActionControlAssignmentOptions.templateVersion()); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Remove an action control assignment. - * - * Remove an action control template assignment by providing an action control assignment ID. You can't delete an - * action control assignment if the status is "in_progress". - * - * @param deleteActionControlAssignmentOptions the {@link DeleteActionControlAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteActionControlAssignment(DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlAssignmentOptions, - "deleteActionControlAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", deleteActionControlAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List role templates by attributes. - * - * List role templates and filter by attributes by using query parameters. The following attributes are supported: - * `account_id`, `name`, `role_name`, `role_service_name`, `state`, `limit`, `start`. - * `account_id` is a required query parameter. Only role templates that have the specified attributes and that the - * caller has read access to are returned. If the caller does not have read access to any role templates an empty - * array is returned. - * - * @param listRoleTemplatesOptions the {@link ListRoleTemplatesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplateCollection} - */ - public ServiceCall listRoleTemplates(ListRoleTemplatesOptions listRoleTemplatesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleTemplatesOptions, - "listRoleTemplatesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleTemplates"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listRoleTemplatesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listRoleTemplatesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listRoleTemplatesOptions.accountId())); - if (listRoleTemplatesOptions.name() != null) { - builder.query("name", String.valueOf(listRoleTemplatesOptions.name())); - } - if (listRoleTemplatesOptions.roleName() != null) { - builder.query("role_name", String.valueOf(listRoleTemplatesOptions.roleName())); - } - if (listRoleTemplatesOptions.roleServiceName() != null) { - builder.query("role_service_name", String.valueOf(listRoleTemplatesOptions.roleServiceName())); - } - if (listRoleTemplatesOptions.state() != null) { - builder.query("state", String.valueOf(listRoleTemplatesOptions.state())); - } - if (listRoleTemplatesOptions.limit() != null) { - builder.query("limit", String.valueOf(listRoleTemplatesOptions.limit())); - } - if (listRoleTemplatesOptions.start() != null) { - builder.query("start", String.valueOf(listRoleTemplatesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create role template. - * - * Create a role template. Role templates define roles from an existing system or service defined role. - * - * @param createRoleTemplateOptions the {@link CreateRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall createRoleTemplate(CreateRoleTemplateOptions createRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateOptions, - "createRoleTemplateOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createRoleTemplateOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createRoleTemplateOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("name", createRoleTemplateOptions.name()); - contentJson.addProperty("account_id", createRoleTemplateOptions.accountId()); - if (createRoleTemplateOptions.description() != null) { - contentJson.addProperty("description", createRoleTemplateOptions.description()); - } - if (createRoleTemplateOptions.committed() != null) { - contentJson.addProperty("committed", createRoleTemplateOptions.committed()); - } - if (createRoleTemplateOptions.role() != null) { - contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateOptions.role())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve the latest version of a role template. - * - * Retrieve the latest version of a role template by providing a role template ID. - * - * @param getRoleTemplateOptions the {@link GetRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall getRoleTemplate(GetRoleTemplateOptions getRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleTemplateOptions, - "getRoleTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", getRoleTemplateOptions.roleTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getRoleTemplateOptions.state() != null) { - builder.query("state", String.valueOf(getRoleTemplateOptions.state())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a Role template. - * - * Delete a role template by providing the role template ID. This deletes all versions of this template. A role - * template can't be deleted if any version of the template is assigned to one or more child accounts. You must remove - * the role assignments first. - * - * @param deleteRoleTemplateOptions the {@link DeleteRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteRoleTemplate(DeleteRoleTemplateOptions deleteRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleTemplateOptions, - "deleteRoleTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", deleteRoleTemplateOptions.roleTemplateId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a new role template version. - * - * Create a new version of a role template. Use this if you need to make updates to a role template that is committed. - * - * @param createRoleTemplateVersionOptions the {@link CreateRoleTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall createRoleTemplateVersion(CreateRoleTemplateVersionOptions createRoleTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateVersionOptions, - "createRoleTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", createRoleTemplateVersionOptions.roleTemplateId()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - final JsonObject contentJson = new JsonObject(); - if (createRoleTemplateVersionOptions.name() != null) { - contentJson.addProperty("name", createRoleTemplateVersionOptions.name()); - } - if (createRoleTemplateVersionOptions.description() != null) { - contentJson.addProperty("description", createRoleTemplateVersionOptions.description()); - } - if (createRoleTemplateVersionOptions.role() != null) { - contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateVersionOptions.role())); - } - if (createRoleTemplateVersionOptions.committed() != null) { - contentJson.addProperty("committed", createRoleTemplateVersionOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve role template versions. - * - * Retrieve the versions of a role template by providing a role template ID. - * - * @param listRoleTemplateVersionsOptions the {@link ListRoleTemplateVersionsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplateVersionsCollection} - */ - public ServiceCall listRoleTemplateVersions(ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleTemplateVersionsOptions, - "listRoleTemplateVersionsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", listRoleTemplateVersionsOptions.roleTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleTemplateVersions"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listRoleTemplateVersionsOptions.state() != null) { - builder.query("state", String.valueOf(listRoleTemplateVersionsOptions.state())); - } - if (listRoleTemplateVersionsOptions.limit() != null) { - builder.query("limit", String.valueOf(listRoleTemplateVersionsOptions.limit())); - } - if (listRoleTemplateVersionsOptions.start() != null) { - builder.query("start", String.valueOf(listRoleTemplateVersionsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a role template version. - * - * Update a specific version of a role template. You can use this only if the version isn't committed. - * - * @param replaceRoleTemplateOptions the {@link ReplaceRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall replaceRoleTemplate(ReplaceRoleTemplateOptions replaceRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceRoleTemplateOptions, - "replaceRoleTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", replaceRoleTemplateOptions.roleTemplateId()); - pathParamsMap.put("version", replaceRoleTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replaceRoleTemplateOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - if (replaceRoleTemplateOptions.name() != null) { - contentJson.addProperty("name", replaceRoleTemplateOptions.name()); - } - if (replaceRoleTemplateOptions.description() != null) { - contentJson.addProperty("description", replaceRoleTemplateOptions.description()); - } - if (replaceRoleTemplateOptions.role() != null) { - contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRoleTemplateOptions.role())); - } - if (replaceRoleTemplateOptions.committed() != null) { - contentJson.addProperty("committed", replaceRoleTemplateOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a role template version. - * - * Delete a specific version of a role template by providing a role template ID and version number. You can't delete a - * role template version that is assigned to one or more child accounts. You must remove the role assignments first. - * - * @param deleteRoleTemplateVersionOptions the {@link DeleteRoleTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteRoleTemplateVersion(DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleTemplateVersionOptions, - "deleteRoleTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", deleteRoleTemplateVersionOptions.roleTemplateId()); - pathParamsMap.put("version", deleteRoleTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a role template version. - * - * Retrieve a role template by providing a role template ID and version number. - * - * @param getRoleTemplateVersionOptions the {@link GetRoleTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall getRoleTemplateVersion(GetRoleTemplateVersionOptions getRoleTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleTemplateVersionOptions, - "getRoleTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", getRoleTemplateVersionOptions.roleTemplateId()); - pathParamsMap.put("version", getRoleTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleTemplateVersion"); - 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); - } - - /** - * Commit a role template version. - * - * Commit a role template version. You cannot make any further changes to the role template once it's committed. If - * you have to make updates after committing a version, create a new version. - * - * @param commitRoleTemplateOptions the {@link CommitRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall commitRoleTemplate(CommitRoleTemplateOptions commitRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(commitRoleTemplateOptions, - "commitRoleTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", commitRoleTemplateOptions.roleTemplateId()); - pathParamsMap.put("version", commitRoleTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}/commit", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get role template assignments. - * - * Get role template assignments by attributes. The following attributes are supported: - * `account_id`, `template_id`, `template_version`, `target`, `target_type`, `limit`, `start`. - * `account_id` is a required query parameter. Only role template assignments with the specified attributes and - * accessible by the caller are returned. If the caller does not have read access to any role template assignments, an - * empty array is returned. - * - * @param listRoleAssignmentsOptions the {@link ListRoleAssignmentsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleAssignmentCollection} - */ - public ServiceCall listRoleAssignments(ListRoleAssignmentsOptions listRoleAssignmentsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleAssignmentsOptions, - "listRoleAssignmentsOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleAssignments"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listRoleAssignmentsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listRoleAssignmentsOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listRoleAssignmentsOptions.accountId())); - if (listRoleAssignmentsOptions.templateId() != null) { - builder.query("template_id", String.valueOf(listRoleAssignmentsOptions.templateId())); - } - if (listRoleAssignmentsOptions.templateVersion() != null) { - builder.query("template_version", String.valueOf(listRoleAssignmentsOptions.templateVersion())); - } - if (listRoleAssignmentsOptions.limit() != null) { - builder.query("limit", String.valueOf(listRoleAssignmentsOptions.limit())); - } - if (listRoleAssignmentsOptions.start() != null) { - builder.query("start", String.valueOf(listRoleAssignmentsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a role template assignment. - * - * Assign a role template to child accounts and account groups. This creates the role in the accounts and account - * groups that you specify. - * - * @param createRoleTemplateAssignmentOptions the {@link CreateRoleTemplateAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleAssignmentCollection} - */ - public ServiceCall createRoleTemplateAssignment(CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateAssignmentOptions, - "createRoleTemplateAssignmentOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplateAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createRoleTemplateAssignmentOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createRoleTemplateAssignmentOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateAssignmentOptions.target())); - contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateAssignmentOptions.templates())); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a role assignment. - * - * Retrieve a role template assignment by providing a role assignment ID. - * - * @param getRoleAssignmentOptions the {@link GetRoleAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleAssignment} - */ - public ServiceCall getRoleAssignment(GetRoleAssignmentOptions getRoleAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleAssignmentOptions, - "getRoleAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", getRoleAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleAssignment"); - 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 a role assignment. - * - * Update a role assignment by providing a role assignment ID. - * - * @param updateRoleAssignmentOptions the {@link UpdateRoleAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleAssignment} - */ - public ServiceCall updateRoleAssignment(UpdateRoleAssignmentOptions updateRoleAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateRoleAssignmentOptions, - "updateRoleAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", updateRoleAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateRoleAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updateRoleAssignmentOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("template_version", updateRoleAssignmentOptions.templateVersion()); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Remove a role assignment. - * - * Remove a role template assignment by providing a role assignment ID. You can't delete a role assignment if the - * status is "in_progress". - * - * @param deleteRoleAssignmentOptions the {@link DeleteRoleAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteRoleAssignment(DeleteRoleAssignmentOptions deleteRoleAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleAssignmentOptions, - "deleteRoleAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", deleteRoleAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java deleted file mode 100644 index af82ea2abe8..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The Access Management Account Settings that are currently set for the requested account. - */ -public class AccountSettingsAccessManagement extends GenericModel { - - @SerializedName("external_account_identity_interaction") - protected ExternalAccountIdentityInteraction externalAccountIdentityInteraction; - - protected AccountSettingsAccessManagement() { } - - /** - * Gets the externalAccountIdentityInteraction. - * - * How external accounts can interact in relation to the requested account. - * - * @return the externalAccountIdentityInteraction - */ - public ExternalAccountIdentityInteraction getExternalAccountIdentityInteraction() { - return externalAccountIdentityInteraction; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java deleted file mode 100644 index ea230f57263..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the assigned action control template. - */ -public class ActionControlAssignment extends GenericModel { - - /** - * The current operation of the action control assignment. - */ - public interface Operation { - /** create. */ - String CREATE = "create"; - /** apply. */ - String APPLY = "apply"; - /** update. */ - String UPDATE = "update"; - /** remove. */ - String REMOVE = "remove"; - } - - /** - * The action control assignment status. - */ - public interface Status { - /** accepted. */ - String ACCEPTED = "accepted"; - /** failure. */ - String FAILURE = "failure"; - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** superseded. */ - String SUPERSEDED = "superseded"; - } - - protected String id; - @SerializedName("account_id") - protected String accountId; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String operation; - protected List resources; - protected ActionControlAssignmentTemplate template; - protected AssignmentTargetDetails target; - protected String status; - - protected ActionControlAssignment() { } - - /** - * Gets the id. - * - * Action control assignment ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the accountId. - * - * The account GUID that the action control assignments belong to. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the href. - * - * The href URL that links to the action control assignments API by action control assignment ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the action control assignment was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the action control assignment. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the action control assignment was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the action control assignment. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the operation. - * - * The current operation of the action control assignment. - * - * @return the operation - */ - public String getOperation() { - return operation; - } - - /** - * Gets the resources. - * - * Resources created when action control template is assigned. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the template. - * - * The action control template id and version that will be assigned. - * - * @return the template - */ - public ActionControlAssignmentTemplate getTemplate() { - return template; - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the status. - * - * The action control assignment status. - * - * @return the status - */ - public String getStatus() { - return status; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java deleted file mode 100644 index a9d6b28ce39..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of action control assignments. - */ -public class ActionControlAssignmentCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List assignments; - - protected ActionControlAssignmentCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the assignments. - * - * List of action control assignments. - * - * @return the assignments - */ - public List getAssignments() { - return assignments; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java deleted file mode 100644 index 122d3c8277b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The action control assignment resources and target where the template is assigned. - */ -public class ActionControlAssignmentResource extends GenericModel { - - protected AssignmentTargetDetails target; - @SerializedName("action_control") - protected ActionControlAssignmentResourceActionControl actionControl; - - protected ActionControlAssignmentResource() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the actionControl. - * - * Set of properties of the assigned resource or error message if assignment failed. - * - * @return the actionControl - */ - public ActionControlAssignmentResourceActionControl getActionControl() { - return actionControl; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java deleted file mode 100644 index 0e5550eb4da..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Set of properties of the assigned resource or error message if assignment failed. - */ -public class ActionControlAssignmentResourceActionControl extends GenericModel { - - @SerializedName("resource_created") - protected ActionControlAssignmentResourceCreated resourceCreated; - @SerializedName("error_message") - protected AssignmentResourceError errorMessage; - - protected ActionControlAssignmentResourceActionControl() { } - - /** - * Gets the resourceCreated. - * - * On success, it includes the action control assigned. - * - * @return the resourceCreated - */ - public ActionControlAssignmentResourceCreated getResourceCreated() { - return resourceCreated; - } - - /** - * Gets the errorMessage. - * - * Body parameters for assignment error. - * - * @return the errorMessage - */ - public AssignmentResourceError getErrorMessage() { - return errorMessage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java deleted file mode 100644 index 6ecbd23392a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * On success, it includes the action control assigned. - */ -public class ActionControlAssignmentResourceCreated extends GenericModel { - - protected String id; - - protected ActionControlAssignmentResourceCreated() { } - - /** - * Gets the id. - * - * action control id. - * - * @return the id - */ - public String getId() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java deleted file mode 100644 index 4e6d2543e18..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The action control template id and version that will be assigned. - */ -public class ActionControlAssignmentTemplate extends GenericModel { - - protected String id; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String version; - - /** - * Instantiates a new Builder from an existing ActionControlAssignmentTemplate instance. - * - * @param actionControlAssignmentTemplate the instance to initialize the Builder with - */ - private Builder(ActionControlAssignmentTemplate actionControlAssignmentTemplate) { - this.id = actionControlAssignmentTemplate.id; - this.version = actionControlAssignmentTemplate.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param id the id - * @param version the version - */ - public Builder(String id, String version) { - this.id = id; - this.version = version; - } - - /** - * Builds a ActionControlAssignmentTemplate. - * - * @return the new ActionControlAssignmentTemplate instance - */ - public ActionControlAssignmentTemplate build() { - return new ActionControlAssignmentTemplate(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the ActionControlAssignmentTemplate builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the ActionControlAssignmentTemplate builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected ActionControlAssignmentTemplate() { } - - protected ActionControlAssignmentTemplate(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - id = builder.id; - version = builder.version; - } - - /** - * New builder. - * - * @return a ActionControlAssignmentTemplate builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * Action control template ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java deleted file mode 100644 index 78b6d56be6d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * ActionControlAssignmentsPager can be used to simplify the use of the "listActionControlAssignments" method. - */ -public class ActionControlAssignmentsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListActionControlAssignmentsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected ActionControlAssignmentsPager() { } - - /** - * Constructs a new ActionControlAssignmentsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlAssignments" method - * @param options the ListActionControlAssignmentsOptions instance to be used to invoke the "listActionControlAssignments" method - */ - public ActionControlAssignmentsPager(IamPolicyManagement client, ListActionControlAssignmentsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<ActionControlAssignment> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListActionControlAssignmentsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - ActionControlAssignmentCollection result = client.listActionControlAssignments(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getAssignments(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<ActionControlAssignment> containing all results returned by the "listActionControlAssignments" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java deleted file mode 100644 index 157c9f6a390..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the action control template. - */ -public class ActionControlTemplate extends GenericModel { - - /** - * State of action control template. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String name; - protected String description; - @SerializedName("account_id") - protected String accountId; - protected Boolean committed; - @SerializedName("action_control") - protected TemplateActionControl actionControl; - protected String id; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String version; - protected String state; - - protected ActionControlTemplate() { } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the description. - * - * Description of the action control template. This is shown to users in the enterprise account. Use this to describe - * the purpose or context of the action control for enterprise users managing IAM templates. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the committed. - * - * Committed status of the template. If committed is set to true, then the template version can no longer be updated. - * - * @return the committed - */ - public Boolean isCommitted() { - return committed; - } - - /** - * Gets the actionControl. - * - * The action control properties that are created in an action resource when the template is assigned. - * - * @return the actionControl - */ - public TemplateActionControl getActionControl() { - return actionControl; - } - - /** - * Gets the id. - * - * The action control template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the action control templates API by action control template ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the action control template was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the action control template. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the action control template was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the action control template. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the version. - * - * The version number of the template used to identify different versions of same template. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the state. - * - * State of action control template. - * - * @return the state - */ - public String getState() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java deleted file mode 100644 index e7536d2c9ae..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of action control templates. - */ -public class ActionControlTemplateCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - @SerializedName("action_control_templates") - protected List actionControlTemplates; - - protected ActionControlTemplateCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the actionControlTemplates. - * - * List of action control templates. - * - * @return the actionControlTemplates - */ - public List getActionControlTemplates() { - return actionControlTemplates; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java deleted file mode 100644 index 5e26f45cf46..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of versions for a specific action control template. - */ -public class ActionControlTemplateVersionsCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List versions; - - protected ActionControlTemplateVersionsCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the versions. - * - * List of action control templates versions. - * - * @return the versions - */ - public List getVersions() { - return versions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java deleted file mode 100644 index 660aefe11ba..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * ActionControlTemplateVersionsPager can be used to simplify the use of the "listActionControlTemplateVersions" method. - */ -public class ActionControlTemplateVersionsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListActionControlTemplateVersionsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected ActionControlTemplateVersionsPager() { } - - /** - * Constructs a new ActionControlTemplateVersionsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlTemplateVersions" method - * @param options the ListActionControlTemplateVersionsOptions instance to be used to invoke the "listActionControlTemplateVersions" method - */ - public ActionControlTemplateVersionsPager(IamPolicyManagement client, ListActionControlTemplateVersionsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<ActionControlTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListActionControlTemplateVersionsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - ActionControlTemplateVersionsCollection result = client.listActionControlTemplateVersions(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getVersions(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<ActionControlTemplate> containing all results returned by the "listActionControlTemplateVersions" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java deleted file mode 100644 index bd326c8d7ec..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * ActionControlTemplatesPager can be used to simplify the use of the "listActionControlTemplates" method. - */ -public class ActionControlTemplatesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListActionControlTemplatesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected ActionControlTemplatesPager() { } - - /** - * Constructs a new ActionControlTemplatesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlTemplates" method - * @param options the ListActionControlTemplatesOptions instance to be used to invoke the "listActionControlTemplates" method - */ - public ActionControlTemplatesPager(IamPolicyManagement client, ListActionControlTemplatesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<ActionControlTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListActionControlTemplatesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - ActionControlTemplateCollection result = client.listActionControlTemplates(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getActionControlTemplates(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<ActionControlTemplate> containing all results returned by the "listActionControlTemplates" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java deleted file mode 100644 index c454c7a3ef5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * On success, includes the policy that is assigned. - */ -public class AssignmentResourceCreated extends GenericModel { - - protected String id; - - protected AssignmentResourceCreated() { } - - /** - * Gets the id. - * - * Policy id. - * - * @return the id - */ - public String getId() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java deleted file mode 100644 index e74dbe58b3a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Body parameters for assignment error. - */ -public class AssignmentResourceError extends GenericModel { - - protected String name; - protected String errorCode; - protected String message; - protected String code; - protected List errors; - - protected AssignmentResourceError() { } - - /** - * Gets the name. - * - * Name of the error. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the errorCode. - * - * error code. - * - * @return the errorCode - */ - public String getErrorCode() { - return errorCode; - } - - /** - * Gets the message. - * - * Error message detailing the nature of the error. - * - * @return the message - */ - public String getMessage() { - return message; - } - - /** - * Gets the code. - * - * Internal status code for the error. - * - * @return the code - */ - public String getCode() { - return code; - } - - /** - * Gets the errors. - * - * The errors encountered during the response. - * - * @return the errors - */ - public List getErrors() { - return errors; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java deleted file mode 100644 index 893d528604c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * assignment target account and type. - */ -public class AssignmentTargetDetails extends GenericModel { - - /** - * Assignment target type. - */ - public interface Type { - /** Account. */ - String ACCOUNT = "Account"; - } - - protected String type; - protected String id; - - /** - * Builder. - */ - public static class Builder { - private String type; - private String id; - - /** - * Instantiates a new Builder from an existing AssignmentTargetDetails instance. - * - * @param assignmentTargetDetails the instance to initialize the Builder with - */ - private Builder(AssignmentTargetDetails assignmentTargetDetails) { - this.type = assignmentTargetDetails.type; - this.id = assignmentTargetDetails.id; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param type the type - * @param id the id - */ - public Builder(String type, String id) { - this.type = type; - this.id = id; - } - - /** - * Builds a AssignmentTargetDetails. - * - * @return the new AssignmentTargetDetails instance - */ - public AssignmentTargetDetails build() { - return new AssignmentTargetDetails(this); - } - - /** - * Set the type. - * - * @param type the type - * @return the AssignmentTargetDetails builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the id. - * - * @param id the id - * @return the AssignmentTargetDetails builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - } - - protected AssignmentTargetDetails() { } - - protected AssignmentTargetDetails(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - type = builder.type; - id = builder.id; - } - - /** - * New builder. - * - * @return a AssignmentTargetDetails builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the type. - * - * Assignment target type. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the id. - * - * ID of the target account. - * - * @return the id - */ - public String id() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java deleted file mode 100644 index b8025e305a9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * policy template details. - */ -public class AssignmentTemplateDetails extends GenericModel { - - protected String id; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String version; - - /** - * Instantiates a new Builder from an existing AssignmentTemplateDetails instance. - * - * @param assignmentTemplateDetails the instance to initialize the Builder with - */ - private Builder(AssignmentTemplateDetails assignmentTemplateDetails) { - this.id = assignmentTemplateDetails.id; - this.version = assignmentTemplateDetails.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a AssignmentTemplateDetails. - * - * @return the new AssignmentTemplateDetails instance - */ - public AssignmentTemplateDetails build() { - return new AssignmentTemplateDetails(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the AssignmentTemplateDetails builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the AssignmentTemplateDetails builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected AssignmentTemplateDetails() { } - - protected AssignmentTemplateDetails(Builder builder) { - id = builder.id; - version = builder.version; - } - - /** - * New builder. - * - * @return a AssignmentTemplateDetails builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * Policy template ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the version. - * - * Policy template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java deleted file mode 100644 index 78291e6c2c5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The commitActionControlTemplate options. - */ -public class CommitActionControlTemplateOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing CommitActionControlTemplateOptions instance. - * - * @param commitActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(CommitActionControlTemplateOptions commitActionControlTemplateOptions) { - this.actionControlTemplateId = commitActionControlTemplateOptions.actionControlTemplateId; - this.version = commitActionControlTemplateOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - * @param version the version - */ - public Builder(String actionControlTemplateId, String version) { - this.actionControlTemplateId = actionControlTemplateId; - this.version = version; - } - - /** - * Builds a CommitActionControlTemplateOptions. - * - * @return the new CommitActionControlTemplateOptions instance - */ - public CommitActionControlTemplateOptions build() { - return new CommitActionControlTemplateOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the CommitActionControlTemplateOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the CommitActionControlTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected CommitActionControlTemplateOptions() { } - - protected CommitActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a CommitActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the version. - * - * The action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java deleted file mode 100644 index 61283194c44..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The commitPolicyTemplate options. - */ -public class CommitPolicyTemplateOptions extends GenericModel { - - protected String policyTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing CommitPolicyTemplateOptions instance. - * - * @param commitPolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(CommitPolicyTemplateOptions commitPolicyTemplateOptions) { - this.policyTemplateId = commitPolicyTemplateOptions.policyTemplateId; - this.version = commitPolicyTemplateOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param version the version - */ - public Builder(String policyTemplateId, String version) { - this.policyTemplateId = policyTemplateId; - this.version = version; - } - - /** - * Builds a CommitPolicyTemplateOptions. - * - * @return the new CommitPolicyTemplateOptions instance - */ - public CommitPolicyTemplateOptions build() { - return new CommitPolicyTemplateOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the CommitPolicyTemplateOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the CommitPolicyTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected CommitPolicyTemplateOptions() { } - - protected CommitPolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - policyTemplateId = builder.policyTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a CommitPolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the version. - * - * The policy template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java deleted file mode 100644 index 7e93c92fb0b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The commitRoleTemplate options. - */ -public class CommitRoleTemplateOptions extends GenericModel { - - protected String roleTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing CommitRoleTemplateOptions instance. - * - * @param commitRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(CommitRoleTemplateOptions commitRoleTemplateOptions) { - this.roleTemplateId = commitRoleTemplateOptions.roleTemplateId; - this.version = commitRoleTemplateOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - * @param version the version - */ - public Builder(String roleTemplateId, String version) { - this.roleTemplateId = roleTemplateId; - this.version = version; - } - - /** - * Builds a CommitRoleTemplateOptions. - * - * @return the new CommitRoleTemplateOptions instance - */ - public CommitRoleTemplateOptions build() { - return new CommitRoleTemplateOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the CommitRoleTemplateOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the CommitRoleTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected CommitRoleTemplateOptions() { } - - protected CommitRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - roleTemplateId = builder.roleTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a CommitRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the version. - * - * The role template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java deleted file mode 100644 index be0c3d0aa98..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Details of conflicting resource. - */ -public class ConflictsWith extends GenericModel { - - protected String etag; - protected String role; - protected String policy; - - protected ConflictsWith() { } - - /** - * Gets the etag. - * - * The revision number of the resource. - * - * @return the etag - */ - public String getEtag() { - return etag; - } - - /** - * Gets the role. - * - * The conflicting role of ID. - * - * @return the role - */ - public String getRole() { - return role; - } - - /** - * Gets the policy. - * - * The conflicting policy ID. - * - * @return the policy - */ - public String getPolicy() { - return policy; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java deleted file mode 100644 index 15e502ac214..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Specifies the type of access that is granted by the policy. - */ -public class Control extends GenericModel { - - protected Grant grant; - - /** - * Builder. - */ - public static class Builder { - private Grant grant; - - /** - * Instantiates a new Builder from an existing Control instance. - * - * @param control the instance to initialize the Builder with - */ - private Builder(Control control) { - this.grant = control.grant; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param grant the grant - */ - public Builder(Grant grant) { - this.grant = grant; - } - - /** - * Builds a Control. - * - * @return the new Control instance - */ - public Control build() { - return new Control(this); - } - - /** - * Set the grant. - * - * @param grant the grant - * @return the Control builder - */ - public Builder grant(Grant grant) { - this.grant = grant; - return this; - } - } - - protected Control() { } - - protected Control(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.grant, - "grant cannot be null"); - grant = builder.grant; - } - - /** - * New builder. - * - * @return a Control builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the grant. - * - * Permission is granted by the policy. - * - * @return the grant - */ - public Grant grant() { - return grant; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java deleted file mode 100644 index 5055d290c80..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * ControlResponse. - * - * Classes which extend this class: - * - ControlResponseControl - * - ControlResponseControlWithEnrichedRoles - */ -public class ControlResponse extends GenericModel { - - protected Grant grant; - - protected ControlResponse() { } - - /** - * Gets the grant. - * - * Permission is granted by the policy. - * - * @return the grant - */ - public Grant getGrant() { - return grant; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java deleted file mode 100644 index 5934ebf7c76..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * Specifies the type of access that is granted by the policy. - */ -public class ControlResponseControl extends ControlResponse { - - - protected ControlResponseControl() { } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java deleted file mode 100644 index 8b3c73d73c0..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * Specifies the type of access that is granted by the policy with additional role information. - */ -public class ControlResponseControlWithEnrichedRoles extends ControlResponse { - - - protected ControlResponseControlWithEnrichedRoles() { } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java deleted file mode 100644 index 1ccd3f8b4dd..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createActionControlTemplateAssignment options. - */ -public class CreateActionControlTemplateAssignmentOptions extends GenericModel { - - protected AssignmentTargetDetails target; - protected List templates; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private AssignmentTargetDetails target; - private List templates; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateActionControlTemplateAssignmentOptions instance. - * - * @param createActionControlTemplateAssignmentOptions the instance to initialize the Builder with - */ - private Builder(CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptions) { - this.target = createActionControlTemplateAssignmentOptions.target; - this.templates = createActionControlTemplateAssignmentOptions.templates; - this.acceptLanguage = createActionControlTemplateAssignmentOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param target the target - * @param templates the templates - */ - public Builder(AssignmentTargetDetails target, List templates) { - this.target = target; - this.templates = templates; - } - - /** - * Builds a CreateActionControlTemplateAssignmentOptions. - * - * @return the new CreateActionControlTemplateAssignmentOptions instance - */ - public CreateActionControlTemplateAssignmentOptions build() { - return new CreateActionControlTemplateAssignmentOptions(this); - } - - /** - * Adds a new element to templates. - * - * @param templates the new element to be added - * @return the CreateActionControlTemplateAssignmentOptions builder - */ - public Builder addTemplates(ActionControlAssignmentTemplate templates) { - com.ibm.cloud.sdk.core.util.Validator.notNull(templates, - "templates cannot be null"); - if (this.templates == null) { - this.templates = new ArrayList(); - } - this.templates.add(templates); - return this; - } - - /** - * Set the target. - * - * @param target the target - * @return the CreateActionControlTemplateAssignmentOptions builder - */ - public Builder target(AssignmentTargetDetails target) { - this.target = target; - return this; - } - - /** - * Set the templates. - * Existing templates will be replaced. - * - * @param templates the templates - * @return the CreateActionControlTemplateAssignmentOptions builder - */ - public Builder templates(List templates) { - this.templates = templates; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateActionControlTemplateAssignmentOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateActionControlTemplateAssignmentOptions() { } - - protected CreateActionControlTemplateAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, - "target cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, - "templates cannot be null"); - target = builder.target; - templates = builder.templates; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateActionControlTemplateAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails target() { - return target; - } - - /** - * Gets the templates. - * - * List of action control template details for action control assignment. - * - * @return the templates - */ - public List templates() { - return templates; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java deleted file mode 100644 index 37594a7a440..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createActionControlTemplate options. - */ -public class CreateActionControlTemplateOptions extends GenericModel { - - protected String name; - protected String accountId; - protected String description; - protected Boolean committed; - protected TemplateActionControl actionControl; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String accountId; - private String description; - private Boolean committed; - private TemplateActionControl actionControl; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateActionControlTemplateOptions instance. - * - * @param createActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(CreateActionControlTemplateOptions createActionControlTemplateOptions) { - this.name = createActionControlTemplateOptions.name; - this.accountId = createActionControlTemplateOptions.accountId; - this.description = createActionControlTemplateOptions.description; - this.committed = createActionControlTemplateOptions.committed; - this.actionControl = createActionControlTemplateOptions.actionControl; - this.acceptLanguage = createActionControlTemplateOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param accountId the accountId - */ - public Builder(String name, String accountId) { - this.name = name; - this.accountId = accountId; - } - - /** - * Builds a CreateActionControlTemplateOptions. - * - * @return the new CreateActionControlTemplateOptions instance - */ - public CreateActionControlTemplateOptions build() { - return new CreateActionControlTemplateOptions(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateActionControlTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the CreateActionControlTemplateOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateActionControlTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreateActionControlTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - - /** - * Set the actionControl. - * - * @param actionControl the actionControl - * @return the CreateActionControlTemplateOptions builder - */ - public Builder actionControl(TemplateActionControl actionControl) { - this.actionControl = actionControl; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateActionControlTemplateOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateActionControlTemplateOptions() { } - - protected CreateActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - name = builder.name; - accountId = builder.accountId; - description = builder.description; - committed = builder.committed; - actionControl = builder.actionControl; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the description. - * - * Description of the action control template. This is shown to users in the enterprise account. Use this to describe - * the purpose or context of the action control for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template. If committed is set to true, then the template version can no longer be updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } - - /** - * Gets the actionControl. - * - * The action control properties that are created in an action resource when the template is assigned. - * - * @return the actionControl - */ - public TemplateActionControl actionControl() { - return actionControl; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java deleted file mode 100644 index 13ce1a8e60f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createActionControlTemplateVersion options. - */ -public class CreateActionControlTemplateVersionOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String name; - protected String description; - protected TemplateActionControl actionControl; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String name; - private String description; - private TemplateActionControl actionControl; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing CreateActionControlTemplateVersionOptions instance. - * - * @param createActionControlTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptions) { - this.actionControlTemplateId = createActionControlTemplateVersionOptions.actionControlTemplateId; - this.name = createActionControlTemplateVersionOptions.name; - this.description = createActionControlTemplateVersionOptions.description; - this.actionControl = createActionControlTemplateVersionOptions.actionControl; - this.committed = createActionControlTemplateVersionOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - */ - public Builder(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - } - - /** - * Builds a CreateActionControlTemplateVersionOptions. - * - * @return the new CreateActionControlTemplateVersionOptions instance - */ - public CreateActionControlTemplateVersionOptions build() { - return new CreateActionControlTemplateVersionOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actionControl. - * - * @param actionControl the actionControl - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder actionControl(TemplateActionControl actionControl) { - this.actionControl = actionControl; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected CreateActionControlTemplateVersionOptions() { } - - protected CreateActionControlTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - name = builder.name; - description = builder.description; - actionControl = builder.actionControl; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a CreateActionControlTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * The action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will - * change the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the action control template. This is shown to users in the enterprise account. Use this to describe - * the purpose or context of the action control for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actionControl. - * - * The action control properties that are created in an action resource when the template is assigned. - * - * @return the actionControl - */ - public TemplateActionControl actionControl() { - return actionControl; - } - - /** - * Gets the committed. - * - * Committed status of the template version. If committed is set to true, then the template version can no longer be - * updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java deleted file mode 100644 index b6ec9f78c02..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java +++ /dev/null @@ -1,311 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createPolicy options. - */ -public class CreatePolicyOptions extends GenericModel { - - protected String type; - protected List subjects; - protected List roles; - protected List resources; - protected String description; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String type; - private List subjects; - private List roles; - private List resources; - private String description; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreatePolicyOptions instance. - * - * @param createPolicyOptions the instance to initialize the Builder with - */ - private Builder(CreatePolicyOptions createPolicyOptions) { - this.type = createPolicyOptions.type; - this.subjects = createPolicyOptions.subjects; - this.roles = createPolicyOptions.roles; - this.resources = createPolicyOptions.resources; - this.description = createPolicyOptions.description; - this.acceptLanguage = createPolicyOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param type the type - * @param subjects the subjects - * @param roles the roles - * @param resources the resources - */ - public Builder(String type, List subjects, List roles, List resources) { - this.type = type; - this.subjects = subjects; - this.roles = roles; - this.resources = resources; - } - - /** - * Builds a CreatePolicyOptions. - * - * @return the new CreatePolicyOptions instance - */ - public CreatePolicyOptions build() { - return new CreatePolicyOptions(this); - } - - /** - * Adds a new element to subjects. - * - * @param subjects the new element to be added - * @return the CreatePolicyOptions builder - */ - public Builder addSubjects(PolicySubject subjects) { - com.ibm.cloud.sdk.core.util.Validator.notNull(subjects, - "subjects cannot be null"); - if (this.subjects == null) { - this.subjects = new ArrayList(); - } - this.subjects.add(subjects); - return this; - } - - /** - * Adds a new element to roles. - * - * @param roles the new element to be added - * @return the CreatePolicyOptions builder - */ - public Builder addRoles(PolicyRole roles) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roles, - "roles cannot be null"); - if (this.roles == null) { - this.roles = new ArrayList(); - } - this.roles.add(roles); - return this; - } - - /** - * Adds a new element to resources. - * - * @param resources the new element to be added - * @return the CreatePolicyOptions builder - */ - public Builder addResources(PolicyResource resources) { - com.ibm.cloud.sdk.core.util.Validator.notNull(resources, - "resources cannot be null"); - if (this.resources == null) { - this.resources = new ArrayList(); - } - this.resources.add(resources); - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the CreatePolicyOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the subjects. - * Existing subjects will be replaced. - * - * @param subjects the subjects - * @return the CreatePolicyOptions builder - */ - public Builder subjects(List subjects) { - this.subjects = subjects; - return this; - } - - /** - * Set the roles. - * Existing roles will be replaced. - * - * @param roles the roles - * @return the CreatePolicyOptions builder - */ - public Builder roles(List roles) { - this.roles = roles; - return this; - } - - /** - * Set the resources. - * Existing resources will be replaced. - * - * @param resources the resources - * @return the CreatePolicyOptions builder - */ - public Builder resources(List resources) { - this.resources = resources; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreatePolicyOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreatePolicyOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreatePolicyOptions() { } - - protected CreatePolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subjects, - "subjects cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, - "roles cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resources, - "resources cannot be null"); - type = builder.type; - subjects = builder.subjects; - roles = builder.roles; - resources = builder.resources; - description = builder.description; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreatePolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the subjects. - * - * The subjects associated with a policy. - * - * @return the subjects - */ - public List subjects() { - return subjects; - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List roles() { - return roles; - } - - /** - * Gets the resources. - * - * The resources associated with a policy. - * - * @return the resources - */ - public List resources() { - return resources; - } - - /** - * Gets the description. - * - * Customer-defined description. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java deleted file mode 100644 index b71ca393f11..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createPolicyTemplateAssignment options. - */ -public class CreatePolicyTemplateAssignmentOptions extends GenericModel { - - protected String version; - protected AssignmentTargetDetails target; - protected List templates; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String version; - private AssignmentTargetDetails target; - private List templates; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreatePolicyTemplateAssignmentOptions instance. - * - * @param createPolicyTemplateAssignmentOptions the instance to initialize the Builder with - */ - private Builder(CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptions) { - this.version = createPolicyTemplateAssignmentOptions.version; - this.target = createPolicyTemplateAssignmentOptions.target; - this.templates = createPolicyTemplateAssignmentOptions.templates; - this.acceptLanguage = createPolicyTemplateAssignmentOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param version the version - * @param target the target - * @param templates the templates - */ - public Builder(String version, AssignmentTargetDetails target, List templates) { - this.version = version; - this.target = target; - this.templates = templates; - } - - /** - * Builds a CreatePolicyTemplateAssignmentOptions. - * - * @return the new CreatePolicyTemplateAssignmentOptions instance - */ - public CreatePolicyTemplateAssignmentOptions build() { - return new CreatePolicyTemplateAssignmentOptions(this); - } - - /** - * Adds a new element to templates. - * - * @param templates the new element to be added - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder addTemplates(AssignmentTemplateDetails templates) { - com.ibm.cloud.sdk.core.util.Validator.notNull(templates, - "templates cannot be null"); - if (this.templates == null) { - this.templates = new ArrayList(); - } - this.templates.add(templates); - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the target. - * - * @param target the target - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder target(AssignmentTargetDetails target) { - this.target = target; - return this; - } - - /** - * Set the templates. - * Existing templates will be replaced. - * - * @param templates the templates - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder templates(List templates) { - this.templates = templates; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreatePolicyTemplateAssignmentOptions() { } - - protected CreatePolicyTemplateAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, - "target cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, - "templates cannot be null"); - version = builder.version; - target = builder.target; - templates = builder.templates; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreatePolicyTemplateAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the version. - * - * specify version of response body format. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails target() { - return target; - } - - /** - * Gets the templates. - * - * List of template details for policy assignment. - * - * @return the templates - */ - public List templates() { - return templates; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java deleted file mode 100644 index 72944308428..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java +++ /dev/null @@ -1,255 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createPolicyTemplate options. - */ -public class CreatePolicyTemplateOptions extends GenericModel { - - protected String name; - protected String accountId; - protected TemplatePolicy policy; - protected String description; - protected Boolean committed; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String accountId; - private TemplatePolicy policy; - private String description; - private Boolean committed; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreatePolicyTemplateOptions instance. - * - * @param createPolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(CreatePolicyTemplateOptions createPolicyTemplateOptions) { - this.name = createPolicyTemplateOptions.name; - this.accountId = createPolicyTemplateOptions.accountId; - this.policy = createPolicyTemplateOptions.policy; - this.description = createPolicyTemplateOptions.description; - this.committed = createPolicyTemplateOptions.committed; - this.acceptLanguage = createPolicyTemplateOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param accountId the accountId - * @param policy the policy - */ - public Builder(String name, String accountId, TemplatePolicy policy) { - this.name = name; - this.accountId = accountId; - this.policy = policy; - } - - /** - * Builds a CreatePolicyTemplateOptions. - * - * @return the new CreatePolicyTemplateOptions instance - */ - public CreatePolicyTemplateOptions build() { - return new CreatePolicyTemplateOptions(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the CreatePolicyTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the CreatePolicyTemplateOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the policy. - * - * @param policy the policy - * @return the CreatePolicyTemplateOptions builder - */ - public Builder policy(TemplatePolicy policy) { - this.policy = policy; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreatePolicyTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreatePolicyTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreatePolicyTemplateOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreatePolicyTemplateOptions() { } - - protected CreatePolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.policy, - "policy cannot be null"); - name = builder.name; - accountId = builder.accountId; - policy = builder.policy; - description = builder.description; - committed = builder.committed; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreatePolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy policy() { - return policy; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java deleted file mode 100644 index 6903774c335..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createPolicyTemplateVersion options. - */ -public class CreatePolicyTemplateVersionOptions extends GenericModel { - - protected String policyTemplateId; - protected TemplatePolicy policy; - protected String name; - protected String description; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private TemplatePolicy policy; - private String name; - private String description; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing CreatePolicyTemplateVersionOptions instance. - * - * @param createPolicyTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptions) { - this.policyTemplateId = createPolicyTemplateVersionOptions.policyTemplateId; - this.policy = createPolicyTemplateVersionOptions.policy; - this.name = createPolicyTemplateVersionOptions.name; - this.description = createPolicyTemplateVersionOptions.description; - this.committed = createPolicyTemplateVersionOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param policy the policy - */ - public Builder(String policyTemplateId, TemplatePolicy policy) { - this.policyTemplateId = policyTemplateId; - this.policy = policy; - } - - /** - * Builds a CreatePolicyTemplateVersionOptions. - * - * @return the new CreatePolicyTemplateVersionOptions instance - */ - public CreatePolicyTemplateVersionOptions build() { - return new CreatePolicyTemplateVersionOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the policy. - * - * @param policy the policy - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder policy(TemplatePolicy policy) { - this.policy = policy; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected CreatePolicyTemplateVersionOptions() { } - - protected CreatePolicyTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.policy, - "policy cannot be null"); - policyTemplateId = builder.policyTemplateId; - policy = builder.policy; - name = builder.name; - description = builder.description; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a CreatePolicyTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy policy() { - return policy; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template version. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java deleted file mode 100644 index 725ec5d8a53..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java +++ /dev/null @@ -1,308 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createRole options. - */ -public class CreateRoleOptions extends GenericModel { - - protected String displayName; - protected List actions; - protected String name; - protected String accountId; - protected String serviceName; - protected String description; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String displayName; - private List actions; - private String name; - private String accountId; - private String serviceName; - private String description; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateRoleOptions instance. - * - * @param createRoleOptions the instance to initialize the Builder with - */ - private Builder(CreateRoleOptions createRoleOptions) { - this.displayName = createRoleOptions.displayName; - this.actions = createRoleOptions.actions; - this.name = createRoleOptions.name; - this.accountId = createRoleOptions.accountId; - this.serviceName = createRoleOptions.serviceName; - this.description = createRoleOptions.description; - this.acceptLanguage = createRoleOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param displayName the displayName - * @param actions the actions - * @param name the name - * @param accountId the accountId - * @param serviceName the serviceName - */ - public Builder(String displayName, List actions, String name, String accountId, String serviceName) { - this.displayName = displayName; - this.actions = actions; - this.name = name; - this.accountId = accountId; - this.serviceName = serviceName; - } - - /** - * Builds a CreateRoleOptions. - * - * @return the new CreateRoleOptions instance - */ - public CreateRoleOptions build() { - return new CreateRoleOptions(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the CreateRoleOptions builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the CreateRoleOptions builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the CreateRoleOptions builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateRoleOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the CreateRoleOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the CreateRoleOptions builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateRoleOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateRoleOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateRoleOptions() { } - - protected CreateRoleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, - "serviceName cannot be null"); - displayName = builder.displayName; - actions = builder.actions; - name = builder.name; - accountId = builder.accountId; - serviceName = builder.serviceName; - description = builder.description; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateRoleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List actions() { - return actions; - } - - /** - * Gets the name. - * - * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the accountId. - * - * The account GUID. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the serviceName. - * - * The service name. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java deleted file mode 100644 index c9bef88e703..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createRoleTemplateAssignment options. - */ -public class CreateRoleTemplateAssignmentOptions extends GenericModel { - - protected AssignmentTargetDetails target; - protected List templates; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private AssignmentTargetDetails target; - private List templates; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateRoleTemplateAssignmentOptions instance. - * - * @param createRoleTemplateAssignmentOptions the instance to initialize the Builder with - */ - private Builder(CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptions) { - this.target = createRoleTemplateAssignmentOptions.target; - this.templates = createRoleTemplateAssignmentOptions.templates; - this.acceptLanguage = createRoleTemplateAssignmentOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param target the target - * @param templates the templates - */ - public Builder(AssignmentTargetDetails target, List templates) { - this.target = target; - this.templates = templates; - } - - /** - * Builds a CreateRoleTemplateAssignmentOptions. - * - * @return the new CreateRoleTemplateAssignmentOptions instance - */ - public CreateRoleTemplateAssignmentOptions build() { - return new CreateRoleTemplateAssignmentOptions(this); - } - - /** - * Adds a new element to templates. - * - * @param templates the new element to be added - * @return the CreateRoleTemplateAssignmentOptions builder - */ - public Builder addTemplates(RoleAssignmentTemplate templates) { - com.ibm.cloud.sdk.core.util.Validator.notNull(templates, - "templates cannot be null"); - if (this.templates == null) { - this.templates = new ArrayList(); - } - this.templates.add(templates); - return this; - } - - /** - * Set the target. - * - * @param target the target - * @return the CreateRoleTemplateAssignmentOptions builder - */ - public Builder target(AssignmentTargetDetails target) { - this.target = target; - return this; - } - - /** - * Set the templates. - * Existing templates will be replaced. - * - * @param templates the templates - * @return the CreateRoleTemplateAssignmentOptions builder - */ - public Builder templates(List templates) { - this.templates = templates; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateRoleTemplateAssignmentOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateRoleTemplateAssignmentOptions() { } - - protected CreateRoleTemplateAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, - "target cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, - "templates cannot be null"); - target = builder.target; - templates = builder.templates; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateRoleTemplateAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails target() { - return target; - } - - /** - * Gets the templates. - * - * List of role template details for role assignment. - * - * @return the templates - */ - public List templates() { - return templates; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java deleted file mode 100644 index baf82e17961..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createRoleTemplate options. - */ -public class CreateRoleTemplateOptions extends GenericModel { - - protected String name; - protected String accountId; - protected String description; - protected Boolean committed; - protected RoleTemplatePrototypeRole role; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String accountId; - private String description; - private Boolean committed; - private RoleTemplatePrototypeRole role; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateRoleTemplateOptions instance. - * - * @param createRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(CreateRoleTemplateOptions createRoleTemplateOptions) { - this.name = createRoleTemplateOptions.name; - this.accountId = createRoleTemplateOptions.accountId; - this.description = createRoleTemplateOptions.description; - this.committed = createRoleTemplateOptions.committed; - this.role = createRoleTemplateOptions.role; - this.acceptLanguage = createRoleTemplateOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param accountId the accountId - */ - public Builder(String name, String accountId) { - this.name = name; - this.accountId = accountId; - } - - /** - * Builds a CreateRoleTemplateOptions. - * - * @return the new CreateRoleTemplateOptions instance - */ - public CreateRoleTemplateOptions build() { - return new CreateRoleTemplateOptions(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateRoleTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the CreateRoleTemplateOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateRoleTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreateRoleTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - - /** - * Set the role. - * - * @param role the role - * @return the CreateRoleTemplateOptions builder - */ - public Builder role(RoleTemplatePrototypeRole role) { - this.role = role; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateRoleTemplateOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateRoleTemplateOptions() { } - - protected CreateRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - name = builder.name; - accountId = builder.accountId; - description = builder.description; - committed = builder.committed; - role = builder.role; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the description. - * - * Description of the role template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the role for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template. If committed is set to true, then the template version can no longer be updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } - - /** - * Gets the role. - * - * The role properties that are created in an action resource when the template is assigned. - * - * @return the role - */ - public RoleTemplatePrototypeRole role() { - return role; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java deleted file mode 100644 index c322c5a332d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createRoleTemplateVersion options. - */ -public class CreateRoleTemplateVersionOptions extends GenericModel { - - protected String roleTemplateId; - protected String name; - protected String description; - protected TemplateRole role; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String name; - private String description; - private TemplateRole role; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing CreateRoleTemplateVersionOptions instance. - * - * @param createRoleTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(CreateRoleTemplateVersionOptions createRoleTemplateVersionOptions) { - this.roleTemplateId = createRoleTemplateVersionOptions.roleTemplateId; - this.name = createRoleTemplateVersionOptions.name; - this.description = createRoleTemplateVersionOptions.description; - this.role = createRoleTemplateVersionOptions.role; - this.committed = createRoleTemplateVersionOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - */ - public Builder(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - } - - /** - * Builds a CreateRoleTemplateVersionOptions. - * - * @return the new CreateRoleTemplateVersionOptions instance - */ - public CreateRoleTemplateVersionOptions build() { - return new CreateRoleTemplateVersionOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the role. - * - * @param role the role - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder role(TemplateRole role) { - this.role = role; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected CreateRoleTemplateVersionOptions() { } - - protected CreateRoleTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - roleTemplateId = builder.roleTemplateId; - name = builder.name; - description = builder.description; - role = builder.role; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a CreateRoleTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * The role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will - * change the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the role template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the role for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the role. - * - * The role properties that are created in an action resource when the template is assigned. - * - * @return the role - */ - public TemplateRole role() { - return role; - } - - /** - * Gets the committed. - * - * Committed status of the template version. If committed is set to true, then the template version can no longer be - * updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java deleted file mode 100644 index 59ccb4b908a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java +++ /dev/null @@ -1,312 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createV2Policy options. - */ -public class CreateV2PolicyOptions extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - protected Control control; - protected String type; - protected String description; - protected V2PolicySubject subject; - protected V2PolicyResource resource; - protected String pattern; - protected V2PolicyRule rule; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private Control control; - private String type; - private String description; - private V2PolicySubject subject; - private V2PolicyResource resource; - private String pattern; - private V2PolicyRule rule; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateV2PolicyOptions instance. - * - * @param createV2PolicyOptions the instance to initialize the Builder with - */ - private Builder(CreateV2PolicyOptions createV2PolicyOptions) { - this.control = createV2PolicyOptions.control; - this.type = createV2PolicyOptions.type; - this.description = createV2PolicyOptions.description; - this.subject = createV2PolicyOptions.subject; - this.resource = createV2PolicyOptions.resource; - this.pattern = createV2PolicyOptions.pattern; - this.rule = createV2PolicyOptions.rule; - this.acceptLanguage = createV2PolicyOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param control the control - * @param type the type - */ - public Builder(Control control, String type) { - this.control = control; - this.type = type; - } - - /** - * Builds a CreateV2PolicyOptions. - * - * @return the new CreateV2PolicyOptions instance - */ - public CreateV2PolicyOptions build() { - return new CreateV2PolicyOptions(this); - } - - /** - * Set the control. - * - * @param control the control - * @return the CreateV2PolicyOptions builder - */ - public Builder control(Control control) { - this.control = control; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the CreateV2PolicyOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateV2PolicyOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the subject. - * - * @param subject the subject - * @return the CreateV2PolicyOptions builder - */ - public Builder subject(V2PolicySubject subject) { - this.subject = subject; - return this; - } - - /** - * Set the resource. - * - * @param resource the resource - * @return the CreateV2PolicyOptions builder - */ - public Builder resource(V2PolicyResource resource) { - this.resource = resource; - return this; - } - - /** - * Set the pattern. - * - * @param pattern the pattern - * @return the CreateV2PolicyOptions builder - */ - public Builder pattern(String pattern) { - this.pattern = pattern; - return this; - } - - /** - * Set the rule. - * - * @param rule the rule - * @return the CreateV2PolicyOptions builder - */ - public Builder rule(V2PolicyRule rule) { - this.rule = rule; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateV2PolicyOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateV2PolicyOptions() { } - - protected CreateV2PolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.control, - "control cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - control = builder.control; - type = builder.type; - description = builder.description; - subject = builder.subject; - resource = builder.resource; - pattern = builder.pattern; - rule = builder.rule; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateV2PolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the control. - * - * Specifies the type of access that is granted by the policy. - * - * @return the control - */ - public Control control() { - return control; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject subject() { - return subject; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource resource() { - return resource; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String pattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule rule() { - return rule; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java deleted file mode 100644 index f5e35c13d9f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * An additional set of properties associated with a role. - */ -public class CustomRole extends GenericModel { - - protected String id; - @SerializedName("display_name") - protected String displayName; - protected String description; - protected List actions; - protected String crn; - protected String name; - @SerializedName("account_id") - protected String accountId; - @SerializedName("service_name") - protected String serviceName; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String href; - - protected CustomRole() { } - - /** - * Gets the id. - * - * The role ID. Composed of hexadecimal characters. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String getDisplayName() { - return displayName; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List getActions() { - return actions; - } - - /** - * Gets the crn. - * - * The role Cloud Resource Name (CRN). Example CRN: - * 'crn:v1:ibmcloud:public:iam-access-management::a/exampleAccountId::customRole:ExampleRoleName'. - * - * @return the crn - */ - public String getCrn() { - return crn; - } - - /** - * Gets the name. - * - * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the accountId. - * - * The account GUID. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the serviceName. - * - * The service name. - * - * @return the serviceName - */ - public String getServiceName() { - return serviceName; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the role was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the role. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the role was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the href. - * - * The href links back to the role. - * - * @return the href - */ - public String getHref() { - return href; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java deleted file mode 100644 index f71d2c2ab9d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteActionControlAssignment options. - */ -public class DeleteActionControlAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing DeleteActionControlAssignmentOptions instance. - * - * @param deleteActionControlAssignmentOptions the instance to initialize the Builder with - */ - private Builder(DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptions) { - this.assignmentId = deleteActionControlAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a DeleteActionControlAssignmentOptions. - * - * @return the new DeleteActionControlAssignmentOptions instance - */ - public DeleteActionControlAssignmentOptions build() { - return new DeleteActionControlAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the DeleteActionControlAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected DeleteActionControlAssignmentOptions() { } - - protected DeleteActionControlAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a DeleteActionControlAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Action control template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java deleted file mode 100644 index 6ff35d83603..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteActionControlTemplate options. - */ -public class DeleteActionControlTemplateOptions extends GenericModel { - - protected String actionControlTemplateId; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - - /** - * Instantiates a new Builder from an existing DeleteActionControlTemplateOptions instance. - * - * @param deleteActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(DeleteActionControlTemplateOptions deleteActionControlTemplateOptions) { - this.actionControlTemplateId = deleteActionControlTemplateOptions.actionControlTemplateId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - */ - public Builder(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - } - - /** - * Builds a DeleteActionControlTemplateOptions. - * - * @return the new DeleteActionControlTemplateOptions instance - */ - public DeleteActionControlTemplateOptions build() { - return new DeleteActionControlTemplateOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the DeleteActionControlTemplateOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - } - - protected DeleteActionControlTemplateOptions() { } - - protected DeleteActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - } - - /** - * New builder. - * - * @return a DeleteActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java deleted file mode 100644 index 69aca0555a1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteActionControlTemplateVersion options. - */ -public class DeleteActionControlTemplateVersionOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing DeleteActionControlTemplateVersionOptions instance. - * - * @param deleteActionControlTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptions) { - this.actionControlTemplateId = deleteActionControlTemplateVersionOptions.actionControlTemplateId; - this.version = deleteActionControlTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - * @param version the version - */ - public Builder(String actionControlTemplateId, String version) { - this.actionControlTemplateId = actionControlTemplateId; - this.version = version; - } - - /** - * Builds a DeleteActionControlTemplateVersionOptions. - * - * @return the new DeleteActionControlTemplateVersionOptions instance - */ - public DeleteActionControlTemplateVersionOptions build() { - return new DeleteActionControlTemplateVersionOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the DeleteActionControlTemplateVersionOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the DeleteActionControlTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected DeleteActionControlTemplateVersionOptions() { } - - protected DeleteActionControlTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a DeleteActionControlTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java deleted file mode 100644 index 3ab2cf17469..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deletePolicyAssignment options. - */ -public class DeletePolicyAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing DeletePolicyAssignmentOptions instance. - * - * @param deletePolicyAssignmentOptions the instance to initialize the Builder with - */ - private Builder(DeletePolicyAssignmentOptions deletePolicyAssignmentOptions) { - this.assignmentId = deletePolicyAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a DeletePolicyAssignmentOptions. - * - * @return the new DeletePolicyAssignmentOptions instance - */ - public DeletePolicyAssignmentOptions build() { - return new DeletePolicyAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the DeletePolicyAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected DeletePolicyAssignmentOptions() { } - - protected DeletePolicyAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a DeletePolicyAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * The policy template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java deleted file mode 100644 index fe070b2064a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deletePolicy options. - */ -public class DeletePolicyOptions extends GenericModel { - - protected String policyId; - - /** - * Builder. - */ - public static class Builder { - private String policyId; - - /** - * Instantiates a new Builder from an existing DeletePolicyOptions instance. - * - * @param deletePolicyOptions the instance to initialize the Builder with - */ - private Builder(DeletePolicyOptions deletePolicyOptions) { - this.policyId = deletePolicyOptions.policyId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyId the policyId - */ - public Builder(String policyId) { - this.policyId = policyId; - } - - /** - * Builds a DeletePolicyOptions. - * - * @return the new DeletePolicyOptions instance - */ - public DeletePolicyOptions build() { - return new DeletePolicyOptions(this); - } - - /** - * Set the policyId. - * - * @param policyId the policyId - * @return the DeletePolicyOptions builder - */ - public Builder policyId(String policyId) { - this.policyId = policyId; - return this; - } - } - - protected DeletePolicyOptions() { } - - protected DeletePolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, - "policyId cannot be empty"); - policyId = builder.policyId; - } - - /** - * New builder. - * - * @return a DeletePolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyId. - * - * The policy ID. - * - * @return the policyId - */ - public String policyId() { - return policyId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java deleted file mode 100644 index bb70b0d6727..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deletePolicyTemplate options. - */ -public class DeletePolicyTemplateOptions extends GenericModel { - - protected String policyTemplateId; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - - /** - * Instantiates a new Builder from an existing DeletePolicyTemplateOptions instance. - * - * @param deletePolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(DeletePolicyTemplateOptions deletePolicyTemplateOptions) { - this.policyTemplateId = deletePolicyTemplateOptions.policyTemplateId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - */ - public Builder(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - } - - /** - * Builds a DeletePolicyTemplateOptions. - * - * @return the new DeletePolicyTemplateOptions instance - */ - public DeletePolicyTemplateOptions build() { - return new DeletePolicyTemplateOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the DeletePolicyTemplateOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - } - - protected DeletePolicyTemplateOptions() { } - - protected DeletePolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - policyTemplateId = builder.policyTemplateId; - } - - /** - * New builder. - * - * @return a DeletePolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java deleted file mode 100644 index 9a04a5157b6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deletePolicyTemplateVersion options. - */ -public class DeletePolicyTemplateVersionOptions extends GenericModel { - - protected String policyTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing DeletePolicyTemplateVersionOptions instance. - * - * @param deletePolicyTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptions) { - this.policyTemplateId = deletePolicyTemplateVersionOptions.policyTemplateId; - this.version = deletePolicyTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param version the version - */ - public Builder(String policyTemplateId, String version) { - this.policyTemplateId = policyTemplateId; - this.version = version; - } - - /** - * Builds a DeletePolicyTemplateVersionOptions. - * - * @return the new DeletePolicyTemplateVersionOptions instance - */ - public DeletePolicyTemplateVersionOptions build() { - return new DeletePolicyTemplateVersionOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the DeletePolicyTemplateVersionOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the DeletePolicyTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected DeletePolicyTemplateVersionOptions() { } - - protected DeletePolicyTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - policyTemplateId = builder.policyTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a DeletePolicyTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the version. - * - * The policy template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java deleted file mode 100644 index b9341a9f414..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteRoleAssignment options. - */ -public class DeleteRoleAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing DeleteRoleAssignmentOptions instance. - * - * @param deleteRoleAssignmentOptions the instance to initialize the Builder with - */ - private Builder(DeleteRoleAssignmentOptions deleteRoleAssignmentOptions) { - this.assignmentId = deleteRoleAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a DeleteRoleAssignmentOptions. - * - * @return the new DeleteRoleAssignmentOptions instance - */ - public DeleteRoleAssignmentOptions build() { - return new DeleteRoleAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the DeleteRoleAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected DeleteRoleAssignmentOptions() { } - - protected DeleteRoleAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a DeleteRoleAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Role template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java deleted file mode 100644 index 8675777719e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteRole options. - */ -public class DeleteRoleOptions extends GenericModel { - - protected String roleId; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - - /** - * Instantiates a new Builder from an existing DeleteRoleOptions instance. - * - * @param deleteRoleOptions the instance to initialize the Builder with - */ - private Builder(DeleteRoleOptions deleteRoleOptions) { - this.roleId = deleteRoleOptions.roleId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - */ - public Builder(String roleId) { - this.roleId = roleId; - } - - /** - * Builds a DeleteRoleOptions. - * - * @return the new DeleteRoleOptions instance - */ - public DeleteRoleOptions build() { - return new DeleteRoleOptions(this); - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the DeleteRoleOptions builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - } - - protected DeleteRoleOptions() { } - - protected DeleteRoleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, - "roleId cannot be empty"); - roleId = builder.roleId; - } - - /** - * New builder. - * - * @return a DeleteRoleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role ID. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java deleted file mode 100644 index c76bf3bfda4..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteRoleTemplate options. - */ -public class DeleteRoleTemplateOptions extends GenericModel { - - protected String roleTemplateId; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - - /** - * Instantiates a new Builder from an existing DeleteRoleTemplateOptions instance. - * - * @param deleteRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(DeleteRoleTemplateOptions deleteRoleTemplateOptions) { - this.roleTemplateId = deleteRoleTemplateOptions.roleTemplateId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - */ - public Builder(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - } - - /** - * Builds a DeleteRoleTemplateOptions. - * - * @return the new DeleteRoleTemplateOptions instance - */ - public DeleteRoleTemplateOptions build() { - return new DeleteRoleTemplateOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the DeleteRoleTemplateOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - } - - protected DeleteRoleTemplateOptions() { } - - protected DeleteRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - roleTemplateId = builder.roleTemplateId; - } - - /** - * New builder. - * - * @return a DeleteRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java deleted file mode 100644 index 9f974213165..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteRoleTemplateVersion options. - */ -public class DeleteRoleTemplateVersionOptions extends GenericModel { - - protected String roleTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing DeleteRoleTemplateVersionOptions instance. - * - * @param deleteRoleTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptions) { - this.roleTemplateId = deleteRoleTemplateVersionOptions.roleTemplateId; - this.version = deleteRoleTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - * @param version the version - */ - public Builder(String roleTemplateId, String version) { - this.roleTemplateId = roleTemplateId; - this.version = version; - } - - /** - * Builds a DeleteRoleTemplateVersionOptions. - * - * @return the new DeleteRoleTemplateVersionOptions instance - */ - public DeleteRoleTemplateVersionOptions build() { - return new DeleteRoleTemplateVersionOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the DeleteRoleTemplateVersionOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the DeleteRoleTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected DeleteRoleTemplateVersionOptions() { } - - protected DeleteRoleTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - roleTemplateId = builder.roleTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a DeleteRoleTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the version. - * - * Role template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java deleted file mode 100644 index 92c1caaa34c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteV2Policy options. - */ -public class DeleteV2PolicyOptions extends GenericModel { - - protected String id; - - /** - * Builder. - */ - public static class Builder { - private String id; - - /** - * Instantiates a new Builder from an existing DeleteV2PolicyOptions instance. - * - * @param deleteV2PolicyOptions the instance to initialize the Builder with - */ - private Builder(DeleteV2PolicyOptions deleteV2PolicyOptions) { - this.id = deleteV2PolicyOptions.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 DeleteV2PolicyOptions. - * - * @return the new DeleteV2PolicyOptions instance - */ - public DeleteV2PolicyOptions build() { - return new DeleteV2PolicyOptions(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the DeleteV2PolicyOptions builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - } - - protected DeleteV2PolicyOptions() { } - - protected DeleteV2PolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, - "id cannot be empty"); - id = builder.id; - } - - /** - * New builder. - * - * @return a DeleteV2PolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String id() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java deleted file mode 100644 index 0978eb1040b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role associated with a policy with additional information (display_name, description, actions) when - * `format=display`. - */ -public class EnrichedRoles extends GenericModel { - - @SerializedName("role_id") - protected String roleId; - @SerializedName("display_name") - protected String displayName; - protected String description; - protected List actions; - - protected EnrichedRoles() { } - - /** - * Gets the roleId. - * - * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. - * - * @return the roleId - */ - public String getRoleId() { - return roleId; - } - - /** - * Gets the displayName. - * - * The display name of the role, either service-defined or user-defined for custom roles. - * - * @return the displayName - */ - public String getDisplayName() { - return displayName; - } - - /** - * Gets the description. - * - * The role description, either service-defined or user-defined for custom roles. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List getActions() { - return actions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java deleted file mode 100644 index e99ea48f5f6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Additional error details. - */ -public class ErrorDetails extends GenericModel { - - @SerializedName("conflicts_with") - protected ConflictsWith conflictsWith; - - protected ErrorDetails() { } - - /** - * Gets the conflictsWith. - * - * Details of conflicting resource. - * - * @return the conflictsWith - */ - public ConflictsWith getConflictsWith() { - return conflictsWith; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java deleted file mode 100644 index b5411a7bb36..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * ErrorObject. - */ -public class ErrorObject extends GenericModel { - - /** - * The API error code for the error. - */ - public interface Code { - /** insufficent_permissions. */ - String INSUFFICENT_PERMISSIONS = "insufficent_permissions"; - /** invalid_body. */ - String INVALID_BODY = "invalid_body"; - /** invalid_token. */ - String INVALID_TOKEN = "invalid_token"; - /** missing_required_query_parameter. */ - String MISSING_REQUIRED_QUERY_PARAMETER = "missing_required_query_parameter"; - /** not_found. */ - String NOT_FOUND = "not_found"; - /** policy_conflict_error. */ - String POLICY_CONFLICT_ERROR = "policy_conflict_error"; - /** policy_not_found. */ - String POLICY_NOT_FOUND = "policy_not_found"; - /** request_not_processed. */ - String REQUEST_NOT_PROCESSED = "request_not_processed"; - /** role_conflict_error. */ - String ROLE_CONFLICT_ERROR = "role_conflict_error"; - /** role_not_found. */ - String ROLE_NOT_FOUND = "role_not_found"; - /** too_many_requests. */ - String TOO_MANY_REQUESTS = "too_many_requests"; - /** unable_to_process. */ - String UNABLE_TO_PROCESS = "unable_to_process"; - /** unsupported_content_type. */ - String UNSUPPORTED_CONTENT_TYPE = "unsupported_content_type"; - /** policy_template_conflict_error. */ - String POLICY_TEMPLATE_CONFLICT_ERROR = "policy_template_conflict_error"; - /** policy_template_not_found. */ - String POLICY_TEMPLATE_NOT_FOUND = "policy_template_not_found"; - /** policy_assignment_not_found. */ - String POLICY_ASSIGNMENT_NOT_FOUND = "policy_assignment_not_found"; - /** policy_assignment_conflict_error. */ - String POLICY_ASSIGNMENT_CONFLICT_ERROR = "policy_assignment_conflict_error"; - /** resource_not_found. */ - String RESOURCE_NOT_FOUND = "resource_not_found"; - /** action_control_template_not_found. */ - String ACTION_CONTROL_TEMPLATE_NOT_FOUND = "action_control_template_not_found"; - /** action_control_assignment_not_found. */ - String ACTION_CONTROL_ASSIGNMENT_NOT_FOUND = "action_control_assignment_not_found"; - /** role_template_conflict_error. */ - String ROLE_TEMPLATE_CONFLICT_ERROR = "role_template_conflict_error"; - /** role_template_not_found. */ - String ROLE_TEMPLATE_NOT_FOUND = "role_template_not_found"; - /** role_assignment_not_found. */ - String ROLE_ASSIGNMENT_NOT_FOUND = "role_assignment_not_found"; - } - - protected String code; - protected String message; - protected ErrorDetails details; - @SerializedName("more_info") - protected String moreInfo; - - protected ErrorObject() { } - - /** - * Gets the code. - * - * The API error code for the error. - * - * @return the code - */ - public String getCode() { - return code; - } - - /** - * Gets the message. - * - * The error message returned by the API. - * - * @return the message - */ - public String getMessage() { - return message; - } - - /** - * Gets the details. - * - * Additional error details. - * - * @return the details - */ - public ErrorDetails getDetails() { - return details; - } - - /** - * Gets the moreInfo. - * - * Additional info for error. - * - * @return the moreInfo - */ - public String getMoreInfo() { - return moreInfo; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java deleted file mode 100644 index 5c1c9a9fad6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * How external accounts can interact in relation to the requested account. - */ -public class ExternalAccountIdentityInteraction extends GenericModel { - - @SerializedName("identity_types") - protected IdentityTypes identityTypes; - - protected ExternalAccountIdentityInteraction() { } - - /** - * Gets the identityTypes. - * - * The settings for each identity type. - * - * @return the identityTypes - */ - public IdentityTypes getIdentityTypes() { - return identityTypes; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java deleted file mode 100644 index 1efd0673e9d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Update to how external accounts can interact in relation to the requested account. - */ -public class ExternalAccountIdentityInteractionPatch extends GenericModel { - - @SerializedName("identity_types") - protected IdentityTypesPatch identityTypes; - - /** - * Builder. - */ - public static class Builder { - private IdentityTypesPatch identityTypes; - - /** - * Instantiates a new Builder from an existing ExternalAccountIdentityInteractionPatch instance. - * - * @param externalAccountIdentityInteractionPatch the instance to initialize the Builder with - */ - private Builder(ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatch) { - this.identityTypes = externalAccountIdentityInteractionPatch.identityTypes; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a ExternalAccountIdentityInteractionPatch. - * - * @return the new ExternalAccountIdentityInteractionPatch instance - */ - public ExternalAccountIdentityInteractionPatch build() { - return new ExternalAccountIdentityInteractionPatch(this); - } - - /** - * Set the identityTypes. - * - * @param identityTypes the identityTypes - * @return the ExternalAccountIdentityInteractionPatch builder - */ - public Builder identityTypes(IdentityTypesPatch identityTypes) { - this.identityTypes = identityTypes; - return this; - } - } - - protected ExternalAccountIdentityInteractionPatch() { } - - protected ExternalAccountIdentityInteractionPatch(Builder builder) { - identityTypes = builder.identityTypes; - } - - /** - * New builder. - * - * @return a ExternalAccountIdentityInteractionPatch builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the identityTypes. - * - * The settings to apply for each identity type for a request. - * - * @return the identityTypes - */ - public IdentityTypesPatch identityTypes() { - return identityTypes; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java deleted file mode 100644 index 83cd67d33c9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Details with linking href to first page of requested collection. - */ -public class First extends GenericModel { - - protected String href; - - protected First() { } - - /** - * Gets the href. - * - * The href linking to the page of requested collection. - * - * @return the href - */ - public String getHref() { - return href; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java deleted file mode 100644 index f87e7d741a4..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getActionControlAssignment options. - */ -public class GetActionControlAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing GetActionControlAssignmentOptions instance. - * - * @param getActionControlAssignmentOptions the instance to initialize the Builder with - */ - private Builder(GetActionControlAssignmentOptions getActionControlAssignmentOptions) { - this.assignmentId = getActionControlAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a GetActionControlAssignmentOptions. - * - * @return the new GetActionControlAssignmentOptions instance - */ - public GetActionControlAssignmentOptions build() { - return new GetActionControlAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the GetActionControlAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected GetActionControlAssignmentOptions() { } - - protected GetActionControlAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a GetActionControlAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Action control template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java deleted file mode 100644 index 963c68e8876..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getActionControlTemplate options. - */ -public class GetActionControlTemplateOptions extends GenericModel { - - /** - * The action control template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String actionControlTemplateId; - protected String state; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String state; - - /** - * Instantiates a new Builder from an existing GetActionControlTemplateOptions instance. - * - * @param getActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(GetActionControlTemplateOptions getActionControlTemplateOptions) { - this.actionControlTemplateId = getActionControlTemplateOptions.actionControlTemplateId; - this.state = getActionControlTemplateOptions.state; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - */ - public Builder(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - } - - /** - * Builds a GetActionControlTemplateOptions. - * - * @return the new GetActionControlTemplateOptions instance - */ - public GetActionControlTemplateOptions build() { - return new GetActionControlTemplateOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the GetActionControlTemplateOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the GetActionControlTemplateOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - } - - protected GetActionControlTemplateOptions() { } - - protected GetActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - state = builder.state; - } - - /** - * New builder. - * - * @return a GetActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the state. - * - * The action control template state. - * - * @return the state - */ - public String state() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java deleted file mode 100644 index 95bc94950bb..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getActionControlTemplateVersion options. - */ -public class GetActionControlTemplateVersionOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing GetActionControlTemplateVersionOptions instance. - * - * @param getActionControlTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptions) { - this.actionControlTemplateId = getActionControlTemplateVersionOptions.actionControlTemplateId; - this.version = getActionControlTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - * @param version the version - */ - public Builder(String actionControlTemplateId, String version) { - this.actionControlTemplateId = actionControlTemplateId; - this.version = version; - } - - /** - * Builds a GetActionControlTemplateVersionOptions. - * - * @return the new GetActionControlTemplateVersionOptions instance - */ - public GetActionControlTemplateVersionOptions build() { - return new GetActionControlTemplateVersionOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the GetActionControlTemplateVersionOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the GetActionControlTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected GetActionControlTemplateVersionOptions() { } - - protected GetActionControlTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a GetActionControlTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java deleted file mode 100644 index d1c7c359003..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getPolicyAssignment options. - */ -public class GetPolicyAssignmentOptions extends GenericModel { - - protected String assignmentId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - private String version; - - /** - * Instantiates a new Builder from an existing GetPolicyAssignmentOptions instance. - * - * @param getPolicyAssignmentOptions the instance to initialize the Builder with - */ - private Builder(GetPolicyAssignmentOptions getPolicyAssignmentOptions) { - this.assignmentId = getPolicyAssignmentOptions.assignmentId; - this.version = getPolicyAssignmentOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - * @param version the version - */ - public Builder(String assignmentId, String version) { - this.assignmentId = assignmentId; - this.version = version; - } - - /** - * Builds a GetPolicyAssignmentOptions. - * - * @return the new GetPolicyAssignmentOptions instance - */ - public GetPolicyAssignmentOptions build() { - return new GetPolicyAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the GetPolicyAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the GetPolicyAssignmentOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected GetPolicyAssignmentOptions() { } - - protected GetPolicyAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - assignmentId = builder.assignmentId; - version = builder.version; - } - - /** - * New builder. - * - * @return a GetPolicyAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * The policy template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } - - /** - * Gets the version. - * - * specify version of response body format. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java deleted file mode 100644 index e780ac06896..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getPolicy options. - */ -public class GetPolicyOptions extends GenericModel { - - protected String policyId; - - /** - * Builder. - */ - public static class Builder { - private String policyId; - - /** - * Instantiates a new Builder from an existing GetPolicyOptions instance. - * - * @param getPolicyOptions the instance to initialize the Builder with - */ - private Builder(GetPolicyOptions getPolicyOptions) { - this.policyId = getPolicyOptions.policyId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyId the policyId - */ - public Builder(String policyId) { - this.policyId = policyId; - } - - /** - * Builds a GetPolicyOptions. - * - * @return the new GetPolicyOptions instance - */ - public GetPolicyOptions build() { - return new GetPolicyOptions(this); - } - - /** - * Set the policyId. - * - * @param policyId the policyId - * @return the GetPolicyOptions builder - */ - public Builder policyId(String policyId) { - this.policyId = policyId; - return this; - } - } - - protected GetPolicyOptions() { } - - protected GetPolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, - "policyId cannot be empty"); - policyId = builder.policyId; - } - - /** - * New builder. - * - * @return a GetPolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyId. - * - * The policy ID. - * - * @return the policyId - */ - public String policyId() { - return policyId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java deleted file mode 100644 index ee604554a85..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getPolicyTemplate options. - */ -public class GetPolicyTemplateOptions extends GenericModel { - - /** - * The policy template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String policyTemplateId; - protected String state; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String state; - - /** - * Instantiates a new Builder from an existing GetPolicyTemplateOptions instance. - * - * @param getPolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(GetPolicyTemplateOptions getPolicyTemplateOptions) { - this.policyTemplateId = getPolicyTemplateOptions.policyTemplateId; - this.state = getPolicyTemplateOptions.state; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - */ - public Builder(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - } - - /** - * Builds a GetPolicyTemplateOptions. - * - * @return the new GetPolicyTemplateOptions instance - */ - public GetPolicyTemplateOptions build() { - return new GetPolicyTemplateOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the GetPolicyTemplateOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the GetPolicyTemplateOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - } - - protected GetPolicyTemplateOptions() { } - - protected GetPolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - policyTemplateId = builder.policyTemplateId; - state = builder.state; - } - - /** - * New builder. - * - * @return a GetPolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the state. - * - * The policy template state. - * - * @return the state - */ - public String state() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java deleted file mode 100644 index 8741f83357d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getPolicyTemplateVersion options. - */ -public class GetPolicyTemplateVersionOptions extends GenericModel { - - protected String policyTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing GetPolicyTemplateVersionOptions instance. - * - * @param getPolicyTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptions) { - this.policyTemplateId = getPolicyTemplateVersionOptions.policyTemplateId; - this.version = getPolicyTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param version the version - */ - public Builder(String policyTemplateId, String version) { - this.policyTemplateId = policyTemplateId; - this.version = version; - } - - /** - * Builds a GetPolicyTemplateVersionOptions. - * - * @return the new GetPolicyTemplateVersionOptions instance - */ - public GetPolicyTemplateVersionOptions build() { - return new GetPolicyTemplateVersionOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the GetPolicyTemplateVersionOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the GetPolicyTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected GetPolicyTemplateVersionOptions() { } - - protected GetPolicyTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - policyTemplateId = builder.policyTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a GetPolicyTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the version. - * - * The policy template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java deleted file mode 100644 index 35313b9b746..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getRoleAssignment options. - */ -public class GetRoleAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing GetRoleAssignmentOptions instance. - * - * @param getRoleAssignmentOptions the instance to initialize the Builder with - */ - private Builder(GetRoleAssignmentOptions getRoleAssignmentOptions) { - this.assignmentId = getRoleAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a GetRoleAssignmentOptions. - * - * @return the new GetRoleAssignmentOptions instance - */ - public GetRoleAssignmentOptions build() { - return new GetRoleAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the GetRoleAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected GetRoleAssignmentOptions() { } - - protected GetRoleAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a GetRoleAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Role template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java deleted file mode 100644 index 8c56ac7f58a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getRole options. - */ -public class GetRoleOptions extends GenericModel { - - protected String roleId; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - - /** - * Instantiates a new Builder from an existing GetRoleOptions instance. - * - * @param getRoleOptions the instance to initialize the Builder with - */ - private Builder(GetRoleOptions getRoleOptions) { - this.roleId = getRoleOptions.roleId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - */ - public Builder(String roleId) { - this.roleId = roleId; - } - - /** - * Builds a GetRoleOptions. - * - * @return the new GetRoleOptions instance - */ - public GetRoleOptions build() { - return new GetRoleOptions(this); - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the GetRoleOptions builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - } - - protected GetRoleOptions() { } - - protected GetRoleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, - "roleId cannot be empty"); - roleId = builder.roleId; - } - - /** - * New builder. - * - * @return a GetRoleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role ID. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java deleted file mode 100644 index e33fcf29b32..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getRoleTemplate options. - */ -public class GetRoleTemplateOptions extends GenericModel { - - /** - * The role template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String roleTemplateId; - protected String state; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String state; - - /** - * Instantiates a new Builder from an existing GetRoleTemplateOptions instance. - * - * @param getRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(GetRoleTemplateOptions getRoleTemplateOptions) { - this.roleTemplateId = getRoleTemplateOptions.roleTemplateId; - this.state = getRoleTemplateOptions.state; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - */ - public Builder(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - } - - /** - * Builds a GetRoleTemplateOptions. - * - * @return the new GetRoleTemplateOptions instance - */ - public GetRoleTemplateOptions build() { - return new GetRoleTemplateOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the GetRoleTemplateOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the GetRoleTemplateOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - } - - protected GetRoleTemplateOptions() { } - - protected GetRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - roleTemplateId = builder.roleTemplateId; - state = builder.state; - } - - /** - * New builder. - * - * @return a GetRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the state. - * - * The role template state. - * - * @return the state - */ - public String state() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java deleted file mode 100644 index 4757484f969..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getRoleTemplateVersion options. - */ -public class GetRoleTemplateVersionOptions extends GenericModel { - - protected String roleTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing GetRoleTemplateVersionOptions instance. - * - * @param getRoleTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(GetRoleTemplateVersionOptions getRoleTemplateVersionOptions) { - this.roleTemplateId = getRoleTemplateVersionOptions.roleTemplateId; - this.version = getRoleTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - * @param version the version - */ - public Builder(String roleTemplateId, String version) { - this.roleTemplateId = roleTemplateId; - this.version = version; - } - - /** - * Builds a GetRoleTemplateVersionOptions. - * - * @return the new GetRoleTemplateVersionOptions instance - */ - public GetRoleTemplateVersionOptions build() { - return new GetRoleTemplateVersionOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the GetRoleTemplateVersionOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the GetRoleTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected GetRoleTemplateVersionOptions() { } - - protected GetRoleTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - roleTemplateId = builder.roleTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a GetRoleTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the version. - * - * Role template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java deleted file mode 100644 index ebc88bbf45c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getSettings options. - */ -public class GetSettingsOptions extends GenericModel { - - protected String accountId; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing GetSettingsOptions instance. - * - * @param getSettingsOptions the instance to initialize the Builder with - */ - private Builder(GetSettingsOptions getSettingsOptions) { - this.accountId = getSettingsOptions.accountId; - this.acceptLanguage = getSettingsOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a GetSettingsOptions. - * - * @return the new GetSettingsOptions instance - */ - public GetSettingsOptions build() { - return new GetSettingsOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the GetSettingsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the GetSettingsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected GetSettingsOptions() { } - - protected GetSettingsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.accountId, - "accountId cannot be empty"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a GetSettingsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the settings belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java deleted file mode 100644 index 23a950cc815..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getV2Policy options. - */ -public class GetV2PolicyOptions extends GenericModel { - - /** - * Include additional data for policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles and translations for all - * relevant fields. - */ - public interface Format { - /** include_last_permit. */ - String INCLUDE_LAST_PERMIT = "include_last_permit"; - /** display. */ - String DISPLAY = "display"; - } - - protected String id; - protected String format; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String format; - - /** - * Instantiates a new Builder from an existing GetV2PolicyOptions instance. - * - * @param getV2PolicyOptions the instance to initialize the Builder with - */ - private Builder(GetV2PolicyOptions getV2PolicyOptions) { - this.id = getV2PolicyOptions.id; - this.format = getV2PolicyOptions.format; - } - - /** - * 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 GetV2PolicyOptions. - * - * @return the new GetV2PolicyOptions instance - */ - public GetV2PolicyOptions build() { - return new GetV2PolicyOptions(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the GetV2PolicyOptions builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the format. - * - * @param format the format - * @return the GetV2PolicyOptions builder - */ - public Builder format(String format) { - this.format = format; - return this; - } - } - - protected GetV2PolicyOptions() { } - - protected GetV2PolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, - "id cannot be empty"); - id = builder.id; - format = builder.format; - } - - /** - * New builder. - * - * @return a GetV2PolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the format. - * - * Include additional data for policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles and translations for all - * relevant fields. - * - * @return the format - */ - public String format() { - return format; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java deleted file mode 100644 index d8439c9d6f7..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Permission is granted by the policy. - */ -public class Grant extends GenericModel { - - protected List roles; - - /** - * Builder. - */ - public static class Builder { - private List roles; - - /** - * Instantiates a new Builder from an existing Grant instance. - * - * @param grant the instance to initialize the Builder with - */ - private Builder(Grant grant) { - this.roles = grant.roles; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roles the roles - */ - public Builder(List roles) { - this.roles = roles; - } - - /** - * Builds a Grant. - * - * @return the new Grant instance - */ - public Grant build() { - return new Grant(this); - } - - /** - * Adds a new element to roles. - * - * @param roles the new element to be added - * @return the Grant builder - */ - public Builder addRoles(Roles roles) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roles, - "roles cannot be null"); - if (this.roles == null) { - this.roles = new ArrayList(); - } - this.roles.add(roles); - return this; - } - - /** - * Set the roles. - * Existing roles will be replaced. - * - * @param roles the roles - * @return the Grant builder - */ - public Builder roles(List roles) { - this.roles = roles; - return this; - } - } - - protected Grant() { } - - protected Grant(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, - "roles cannot be null"); - roles = builder.roles; - } - - /** - * New builder. - * - * @return a Grant builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List roles() { - return roles; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java deleted file mode 100644 index 1dbc53fefb6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Permission granted by the policy with translated roles and additional role information. - */ -public class GrantWithEnrichedRoles extends GenericModel { - - protected List roles; - - protected GrantWithEnrichedRoles() { } - - /** - * Gets the roles. - * - * A set of roles granted by the policy. - * - * @return the roles - */ - public List getRoles() { - return roles; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java deleted file mode 100644 index 0ac71d8192b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The settings for each identity type. - */ -public class IdentityTypes extends GenericModel { - - protected IdentityTypesBase user; - @SerializedName("service_id") - protected IdentityTypesBase serviceId; - protected IdentityTypesBase service; - - protected IdentityTypes() { } - - /** - * Gets the user. - * - * The core set of properties associated with an identity type. - * - * @return the user - */ - public IdentityTypesBase getUser() { - return user; - } - - /** - * Gets the serviceId. - * - * The core set of properties associated with an identity type. - * - * @return the serviceId - */ - public IdentityTypesBase getServiceId() { - return serviceId; - } - - /** - * Gets the service. - * - * The core set of properties associated with an identity type. - * - * @return the service - */ - public IdentityTypesBase getService() { - return service; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java deleted file mode 100644 index e8df91a1e5d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with an identity type. - */ -public class IdentityTypesBase extends GenericModel { - - /** - * The state of the identity type. - */ - public interface State { - /** enabled. */ - String ENABLED = "enabled"; - /** monitor. */ - String MONITOR = "monitor"; - /** limited. */ - String LIMITED = "limited"; - } - - protected String state; - @SerializedName("external_allowed_accounts") - protected List externalAllowedAccounts; - - /** - * Builder. - */ - public static class Builder { - private String state; - private List externalAllowedAccounts; - - /** - * Instantiates a new Builder from an existing IdentityTypesBase instance. - * - * @param identityTypesBase the instance to initialize the Builder with - */ - private Builder(IdentityTypesBase identityTypesBase) { - this.state = identityTypesBase.state; - this.externalAllowedAccounts = identityTypesBase.externalAllowedAccounts; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param state the state - * @param externalAllowedAccounts the externalAllowedAccounts - */ - public Builder(String state, List externalAllowedAccounts) { - this.state = state; - this.externalAllowedAccounts = externalAllowedAccounts; - } - - /** - * Builds a IdentityTypesBase. - * - * @return the new IdentityTypesBase instance - */ - public IdentityTypesBase build() { - return new IdentityTypesBase(this); - } - - /** - * Adds a new element to externalAllowedAccounts. - * - * @param externalAllowedAccounts the new element to be added - * @return the IdentityTypesBase builder - */ - public Builder addExternalAllowedAccounts(String externalAllowedAccounts) { - com.ibm.cloud.sdk.core.util.Validator.notNull(externalAllowedAccounts, - "externalAllowedAccounts cannot be null"); - if (this.externalAllowedAccounts == null) { - this.externalAllowedAccounts = new ArrayList(); - } - this.externalAllowedAccounts.add(externalAllowedAccounts); - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the IdentityTypesBase builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the externalAllowedAccounts. - * Existing externalAllowedAccounts will be replaced. - * - * @param externalAllowedAccounts the externalAllowedAccounts - * @return the IdentityTypesBase builder - */ - public Builder externalAllowedAccounts(List externalAllowedAccounts) { - this.externalAllowedAccounts = externalAllowedAccounts; - return this; - } - } - - protected IdentityTypesBase() { } - - protected IdentityTypesBase(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.state, - "state cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.externalAllowedAccounts, - "externalAllowedAccounts cannot be null"); - state = builder.state; - externalAllowedAccounts = builder.externalAllowedAccounts; - } - - /** - * New builder. - * - * @return a IdentityTypesBase builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the state. - * - * The state of the identity type. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the externalAllowedAccounts. - * - * List of accounts that the state applies to for a given identity. - * - * @return the externalAllowedAccounts - */ - public List externalAllowedAccounts() { - return externalAllowedAccounts; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java deleted file mode 100644 index 77aa5a26366..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The settings to apply for each identity type for a request. - */ -public class IdentityTypesPatch extends GenericModel { - - protected IdentityTypesBase user; - @SerializedName("service_id") - protected IdentityTypesBase serviceId; - protected IdentityTypesBase service; - - /** - * Builder. - */ - public static class Builder { - private IdentityTypesBase user; - private IdentityTypesBase serviceId; - private IdentityTypesBase service; - - /** - * Instantiates a new Builder from an existing IdentityTypesPatch instance. - * - * @param identityTypesPatch the instance to initialize the Builder with - */ - private Builder(IdentityTypesPatch identityTypesPatch) { - this.user = identityTypesPatch.user; - this.serviceId = identityTypesPatch.serviceId; - this.service = identityTypesPatch.service; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a IdentityTypesPatch. - * - * @return the new IdentityTypesPatch instance - */ - public IdentityTypesPatch build() { - return new IdentityTypesPatch(this); - } - - /** - * Set the user. - * - * @param user the user - * @return the IdentityTypesPatch builder - */ - public Builder user(IdentityTypesBase user) { - this.user = user; - return this; - } - - /** - * Set the serviceId. - * - * @param serviceId the serviceId - * @return the IdentityTypesPatch builder - */ - public Builder serviceId(IdentityTypesBase serviceId) { - this.serviceId = serviceId; - return this; - } - - /** - * Set the service. - * - * @param service the service - * @return the IdentityTypesPatch builder - */ - public Builder service(IdentityTypesBase service) { - this.service = service; - return this; - } - } - - protected IdentityTypesPatch() { } - - protected IdentityTypesPatch(Builder builder) { - user = builder.user; - serviceId = builder.serviceId; - service = builder.service; - } - - /** - * New builder. - * - * @return a IdentityTypesPatch builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the user. - * - * The core set of properties associated with an identity type. - * - * @return the user - */ - public IdentityTypesBase user() { - return user; - } - - /** - * Gets the serviceId. - * - * The core set of properties associated with an identity type. - * - * @return the serviceId - */ - public IdentityTypesBase serviceId() { - return serviceId; - } - - /** - * Gets the service. - * - * The core set of properties associated with an identity type. - * - * @return the service - */ - public IdentityTypesBase service() { - return service; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java deleted file mode 100644 index 5aa0b39573b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * policy template current and limit details with in an account. - */ -public class LimitData extends GenericModel { - - protected Long current; - protected Long limit; - - protected LimitData() { } - - /** - * Gets the current. - * - * policy template current count. - * - * @return the current - */ - public Long getCurrent() { - return current; - } - - /** - * Gets the limit. - * - * policy template limit count. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java deleted file mode 100644 index 6835f5afccc..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listActionControlAssignments options. - */ -public class ListActionControlAssignmentsOptions extends GenericModel { - - protected String accountId; - protected String acceptLanguage; - protected String templateId; - protected String templateVersion; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String templateId; - private String templateVersion; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListActionControlAssignmentsOptions instance. - * - * @param listActionControlAssignmentsOptions the instance to initialize the Builder with - */ - private Builder(ListActionControlAssignmentsOptions listActionControlAssignmentsOptions) { - this.accountId = listActionControlAssignmentsOptions.accountId; - this.acceptLanguage = listActionControlAssignmentsOptions.acceptLanguage; - this.templateId = listActionControlAssignmentsOptions.templateId; - this.templateVersion = listActionControlAssignmentsOptions.templateVersion; - this.limit = listActionControlAssignmentsOptions.limit; - this.start = listActionControlAssignmentsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListActionControlAssignmentsOptions. - * - * @return the new ListActionControlAssignmentsOptions instance - */ - public ListActionControlAssignmentsOptions build() { - return new ListActionControlAssignmentsOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the templateId. - * - * @param templateId the templateId - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder templateId(String templateId) { - this.templateId = templateId; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListActionControlAssignmentsOptions() { } - - protected ListActionControlAssignmentsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - templateId = builder.templateId; - templateVersion = builder.templateVersion; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListActionControlAssignmentsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID in which the action control assignment belongs to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the templateId. - * - * Optional template ID. - * - * @return the templateId - */ - public String templateId() { - return templateId; - } - - /** - * Gets the templateVersion. - * - * Optional action control template version. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java deleted file mode 100644 index 984d1060c83..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listActionControlTemplateVersions options. - */ -public class ListActionControlTemplateVersionsOptions extends GenericModel { - - /** - * Action control template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String actionControlTemplateId; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListActionControlTemplateVersionsOptions instance. - * - * @param listActionControlTemplateVersionsOptions the instance to initialize the Builder with - */ - private Builder(ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions) { - this.actionControlTemplateId = listActionControlTemplateVersionsOptions.actionControlTemplateId; - this.state = listActionControlTemplateVersionsOptions.state; - this.limit = listActionControlTemplateVersionsOptions.limit; - this.start = listActionControlTemplateVersionsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - */ - public Builder(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - } - - /** - * Builds a ListActionControlTemplateVersionsOptions. - * - * @return the new ListActionControlTemplateVersionsOptions instance - */ - public ListActionControlTemplateVersionsOptions build() { - return new ListActionControlTemplateVersionsOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the ListActionControlTemplateVersionsOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListActionControlTemplateVersionsOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListActionControlTemplateVersionsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListActionControlTemplateVersionsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListActionControlTemplateVersionsOptions() { } - - protected ListActionControlTemplateVersionsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListActionControlTemplateVersionsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * The action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the state. - * - * Action control template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java deleted file mode 100644 index d019db6119f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listActionControlTemplates options. - */ -public class ListActionControlTemplatesOptions extends GenericModel { - - protected String accountId; - protected String acceptLanguage; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListActionControlTemplatesOptions instance. - * - * @param listActionControlTemplatesOptions the instance to initialize the Builder with - */ - private Builder(ListActionControlTemplatesOptions listActionControlTemplatesOptions) { - this.accountId = listActionControlTemplatesOptions.accountId; - this.acceptLanguage = listActionControlTemplatesOptions.acceptLanguage; - this.limit = listActionControlTemplatesOptions.limit; - this.start = listActionControlTemplatesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListActionControlTemplatesOptions. - * - * @return the new ListActionControlTemplatesOptions instance - */ - public ListActionControlTemplatesOptions build() { - return new ListActionControlTemplatesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListActionControlTemplatesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListActionControlTemplatesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListActionControlTemplatesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListActionControlTemplatesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListActionControlTemplatesOptions() { } - - protected ListActionControlTemplatesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListActionControlTemplatesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the action control templates belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java deleted file mode 100644 index 90ecb352c37..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java +++ /dev/null @@ -1,501 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listPolicies options. - */ -public class ListPoliciesOptions extends GenericModel { - - /** - * Optional type of policy. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - /** - * Optional type of service. - */ - public interface ServiceType { - /** service. */ - String SERVICE = "service"; - /** platform_service. */ - String PLATFORM_SERVICE = "platform_service"; - } - - /** - * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending - * '-' to field. Example '-last_modified_at'. - */ - public interface Sort { - /** id. */ - String ID = "id"; - /** type. */ - String TYPE = "type"; - /** href. */ - String HREF = "href"; - /** created_at. */ - String CREATED_AT = "created_at"; - /** created_by_id. */ - String CREATED_BY_ID = "created_by_id"; - /** last_modified_at. */ - String LAST_MODIFIED_AT = "last_modified_at"; - /** last_modified_by_id. */ - String LAST_MODIFIED_BY_ID = "last_modified_by_id"; - /** state. */ - String STATE = "state"; - } - - /** - * Include additional data per policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles. - */ - public interface Format { - /** include_last_permit. */ - String INCLUDE_LAST_PERMIT = "include_last_permit"; - /** display. */ - String DISPLAY = "display"; - } - - /** - * The state of the policy. - * * `active` - returns active policies - * * `deleted` - returns non-active policies. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String accountId; - protected String acceptLanguage; - protected String iamId; - protected String accessGroupId; - protected String type; - protected String serviceType; - protected String tagName; - protected String tagValue; - protected String sort; - protected String format; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String iamId; - private String accessGroupId; - private String type; - private String serviceType; - private String tagName; - private String tagValue; - private String sort; - private String format; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListPoliciesOptions instance. - * - * @param listPoliciesOptions the instance to initialize the Builder with - */ - private Builder(ListPoliciesOptions listPoliciesOptions) { - this.accountId = listPoliciesOptions.accountId; - this.acceptLanguage = listPoliciesOptions.acceptLanguage; - this.iamId = listPoliciesOptions.iamId; - this.accessGroupId = listPoliciesOptions.accessGroupId; - this.type = listPoliciesOptions.type; - this.serviceType = listPoliciesOptions.serviceType; - this.tagName = listPoliciesOptions.tagName; - this.tagValue = listPoliciesOptions.tagValue; - this.sort = listPoliciesOptions.sort; - this.format = listPoliciesOptions.format; - this.state = listPoliciesOptions.state; - this.limit = listPoliciesOptions.limit; - this.start = listPoliciesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListPoliciesOptions. - * - * @return the new ListPoliciesOptions instance - */ - public ListPoliciesOptions build() { - return new ListPoliciesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListPoliciesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListPoliciesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the iamId. - * - * @param iamId the iamId - * @return the ListPoliciesOptions builder - */ - public Builder iamId(String iamId) { - this.iamId = iamId; - return this; - } - - /** - * Set the accessGroupId. - * - * @param accessGroupId the accessGroupId - * @return the ListPoliciesOptions builder - */ - public Builder accessGroupId(String accessGroupId) { - this.accessGroupId = accessGroupId; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the ListPoliciesOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the serviceType. - * - * @param serviceType the serviceType - * @return the ListPoliciesOptions builder - */ - public Builder serviceType(String serviceType) { - this.serviceType = serviceType; - return this; - } - - /** - * Set the tagName. - * - * @param tagName the tagName - * @return the ListPoliciesOptions builder - */ - public Builder tagName(String tagName) { - this.tagName = tagName; - return this; - } - - /** - * Set the tagValue. - * - * @param tagValue the tagValue - * @return the ListPoliciesOptions builder - */ - public Builder tagValue(String tagValue) { - this.tagValue = tagValue; - return this; - } - - /** - * Set the sort. - * - * @param sort the sort - * @return the ListPoliciesOptions builder - */ - public Builder sort(String sort) { - this.sort = sort; - return this; - } - - /** - * Set the format. - * - * @param format the format - * @return the ListPoliciesOptions builder - */ - public Builder format(String format) { - this.format = format; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListPoliciesOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListPoliciesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListPoliciesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListPoliciesOptions() { } - - protected ListPoliciesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - iamId = builder.iamId; - accessGroupId = builder.accessGroupId; - type = builder.type; - serviceType = builder.serviceType; - tagName = builder.tagName; - tagValue = builder.tagValue; - sort = builder.sort; - format = builder.format; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListPoliciesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the policies belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the iamId. - * - * Optional IAM ID used to identify the subject. - * - * @return the iamId - */ - public String iamId() { - return iamId; - } - - /** - * Gets the accessGroupId. - * - * Optional access group id. - * - * @return the accessGroupId - */ - public String accessGroupId() { - return accessGroupId; - } - - /** - * Gets the type. - * - * Optional type of policy. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the serviceType. - * - * Optional type of service. - * - * @return the serviceType - */ - public String serviceType() { - return serviceType; - } - - /** - * Gets the tagName. - * - * Optional name of the access tag in the policy. - * - * @return the tagName - */ - public String tagName() { - return tagName; - } - - /** - * Gets the tagValue. - * - * Optional value of the access tag in the policy. - * - * @return the tagValue - */ - public String tagValue() { - return tagValue; - } - - /** - * Gets the sort. - * - * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending - * '-' to field. Example '-last_modified_at'. - * - * @return the sort - */ - public String sort() { - return sort; - } - - /** - * Gets the format. - * - * Include additional data per policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles. - * - * @return the format - */ - public String format() { - return format; - } - - /** - * Gets the state. - * - * The state of the policy. - * * `active` - returns active policies - * * `deleted` - returns non-active policies. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java deleted file mode 100644 index 9362749c670..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java +++ /dev/null @@ -1,275 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listPolicyAssignments options. - */ -public class ListPolicyAssignmentsOptions extends GenericModel { - - protected String version; - protected String accountId; - protected String acceptLanguage; - protected String templateId; - protected String templateVersion; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String version; - private String accountId; - private String acceptLanguage; - private String templateId; - private String templateVersion; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListPolicyAssignmentsOptions instance. - * - * @param listPolicyAssignmentsOptions the instance to initialize the Builder with - */ - private Builder(ListPolicyAssignmentsOptions listPolicyAssignmentsOptions) { - this.version = listPolicyAssignmentsOptions.version; - this.accountId = listPolicyAssignmentsOptions.accountId; - this.acceptLanguage = listPolicyAssignmentsOptions.acceptLanguage; - this.templateId = listPolicyAssignmentsOptions.templateId; - this.templateVersion = listPolicyAssignmentsOptions.templateVersion; - this.limit = listPolicyAssignmentsOptions.limit; - this.start = listPolicyAssignmentsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param version the version - * @param accountId the accountId - */ - public Builder(String version, String accountId) { - this.version = version; - this.accountId = accountId; - } - - /** - * Builds a ListPolicyAssignmentsOptions. - * - * @return the new ListPolicyAssignmentsOptions instance - */ - public ListPolicyAssignmentsOptions build() { - return new ListPolicyAssignmentsOptions(this); - } - - /** - * Set the version. - * - * @param version the version - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the templateId. - * - * @param templateId the templateId - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder templateId(String templateId) { - this.templateId = templateId; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListPolicyAssignmentsOptions() { } - - protected ListPolicyAssignmentsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - version = builder.version; - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - templateId = builder.templateId; - templateVersion = builder.templateVersion; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListPolicyAssignmentsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the version. - * - * specify version of response body format. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the accountId. - * - * The account GUID in which the policies belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the templateId. - * - * Optional template id. - * - * @return the templateId - */ - public String templateId() { - return templateId; - } - - /** - * Gets the templateVersion. - * - * Optional policy template version. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java deleted file mode 100644 index c7965ba6c31..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listPolicyTemplateVersions options. - */ -public class ListPolicyTemplateVersionsOptions extends GenericModel { - - /** - * The policy template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String policyTemplateId; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListPolicyTemplateVersionsOptions instance. - * - * @param listPolicyTemplateVersionsOptions the instance to initialize the Builder with - */ - private Builder(ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions) { - this.policyTemplateId = listPolicyTemplateVersionsOptions.policyTemplateId; - this.state = listPolicyTemplateVersionsOptions.state; - this.limit = listPolicyTemplateVersionsOptions.limit; - this.start = listPolicyTemplateVersionsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - */ - public Builder(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - } - - /** - * Builds a ListPolicyTemplateVersionsOptions. - * - * @return the new ListPolicyTemplateVersionsOptions instance - */ - public ListPolicyTemplateVersionsOptions build() { - return new ListPolicyTemplateVersionsOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the ListPolicyTemplateVersionsOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListPolicyTemplateVersionsOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListPolicyTemplateVersionsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListPolicyTemplateVersionsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListPolicyTemplateVersionsOptions() { } - - protected ListPolicyTemplateVersionsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - policyTemplateId = builder.policyTemplateId; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListPolicyTemplateVersionsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the state. - * - * The policy template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java deleted file mode 100644 index f230c9bd549..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java +++ /dev/null @@ -1,379 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listPolicyTemplates options. - */ -public class ListPolicyTemplatesOptions extends GenericModel { - - /** - * The policy template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - /** - * Service type, Optional. - */ - public interface PolicyServiceType { - /** service. */ - String SERVICE = "service"; - /** platform_service. */ - String PLATFORM_SERVICE = "platform_service"; - } - - /** - * Policy type, Optional. - */ - public interface PolicyType { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - protected String accountId; - protected String acceptLanguage; - protected String state; - protected String name; - protected String policyServiceType; - protected String policyServiceName; - protected String policyServiceGroupId; - protected String policyType; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String state; - private String name; - private String policyServiceType; - private String policyServiceName; - private String policyServiceGroupId; - private String policyType; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListPolicyTemplatesOptions instance. - * - * @param listPolicyTemplatesOptions the instance to initialize the Builder with - */ - private Builder(ListPolicyTemplatesOptions listPolicyTemplatesOptions) { - this.accountId = listPolicyTemplatesOptions.accountId; - this.acceptLanguage = listPolicyTemplatesOptions.acceptLanguage; - this.state = listPolicyTemplatesOptions.state; - this.name = listPolicyTemplatesOptions.name; - this.policyServiceType = listPolicyTemplatesOptions.policyServiceType; - this.policyServiceName = listPolicyTemplatesOptions.policyServiceName; - this.policyServiceGroupId = listPolicyTemplatesOptions.policyServiceGroupId; - this.policyType = listPolicyTemplatesOptions.policyType; - this.limit = listPolicyTemplatesOptions.limit; - this.start = listPolicyTemplatesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListPolicyTemplatesOptions. - * - * @return the new ListPolicyTemplatesOptions instance - */ - public ListPolicyTemplatesOptions build() { - return new ListPolicyTemplatesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListPolicyTemplatesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListPolicyTemplatesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListPolicyTemplatesOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ListPolicyTemplatesOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the policyServiceType. - * - * @param policyServiceType the policyServiceType - * @return the ListPolicyTemplatesOptions builder - */ - public Builder policyServiceType(String policyServiceType) { - this.policyServiceType = policyServiceType; - return this; - } - - /** - * Set the policyServiceName. - * - * @param policyServiceName the policyServiceName - * @return the ListPolicyTemplatesOptions builder - */ - public Builder policyServiceName(String policyServiceName) { - this.policyServiceName = policyServiceName; - return this; - } - - /** - * Set the policyServiceGroupId. - * - * @param policyServiceGroupId the policyServiceGroupId - * @return the ListPolicyTemplatesOptions builder - */ - public Builder policyServiceGroupId(String policyServiceGroupId) { - this.policyServiceGroupId = policyServiceGroupId; - return this; - } - - /** - * Set the policyType. - * - * @param policyType the policyType - * @return the ListPolicyTemplatesOptions builder - */ - public Builder policyType(String policyType) { - this.policyType = policyType; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListPolicyTemplatesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListPolicyTemplatesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListPolicyTemplatesOptions() { } - - protected ListPolicyTemplatesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - state = builder.state; - name = builder.name; - policyServiceType = builder.policyServiceType; - policyServiceName = builder.policyServiceName; - policyServiceGroupId = builder.policyServiceGroupId; - policyType = builder.policyType; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListPolicyTemplatesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the policy templates belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the state. - * - * The policy template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the name. - * - * The policy template name. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the policyServiceType. - * - * Service type, Optional. - * - * @return the policyServiceType - */ - public String policyServiceType() { - return policyServiceType; - } - - /** - * Gets the policyServiceName. - * - * Service name, Optional. - * - * @return the policyServiceName - */ - public String policyServiceName() { - return policyServiceName; - } - - /** - * Gets the policyServiceGroupId. - * - * Service group id, Optional. - * - * @return the policyServiceGroupId - */ - public String policyServiceGroupId() { - return policyServiceGroupId; - } - - /** - * Gets the policyType. - * - * Policy type, Optional. - * - * @return the policyType - */ - public String policyType() { - return policyType; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java deleted file mode 100644 index adcb3f0cc90..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listRoleAssignments options. - */ -public class ListRoleAssignmentsOptions extends GenericModel { - - protected String accountId; - protected String acceptLanguage; - protected String templateId; - protected String templateVersion; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String templateId; - private String templateVersion; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListRoleAssignmentsOptions instance. - * - * @param listRoleAssignmentsOptions the instance to initialize the Builder with - */ - private Builder(ListRoleAssignmentsOptions listRoleAssignmentsOptions) { - this.accountId = listRoleAssignmentsOptions.accountId; - this.acceptLanguage = listRoleAssignmentsOptions.acceptLanguage; - this.templateId = listRoleAssignmentsOptions.templateId; - this.templateVersion = listRoleAssignmentsOptions.templateVersion; - this.limit = listRoleAssignmentsOptions.limit; - this.start = listRoleAssignmentsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListRoleAssignmentsOptions. - * - * @return the new ListRoleAssignmentsOptions instance - */ - public ListRoleAssignmentsOptions build() { - return new ListRoleAssignmentsOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListRoleAssignmentsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListRoleAssignmentsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the templateId. - * - * @param templateId the templateId - * @return the ListRoleAssignmentsOptions builder - */ - public Builder templateId(String templateId) { - this.templateId = templateId; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the ListRoleAssignmentsOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListRoleAssignmentsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListRoleAssignmentsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListRoleAssignmentsOptions() { } - - protected ListRoleAssignmentsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - templateId = builder.templateId; - templateVersion = builder.templateVersion; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListRoleAssignmentsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID in which the role assignment belongs to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the templateId. - * - * Optional template ID. - * - * @return the templateId - */ - public String templateId() { - return templateId; - } - - /** - * Gets the templateVersion. - * - * Optional role template version. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java deleted file mode 100644 index e22751433e5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listRoleTemplateVersions options. - */ -public class ListRoleTemplateVersionsOptions extends GenericModel { - - /** - * Role template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String roleTemplateId; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListRoleTemplateVersionsOptions instance. - * - * @param listRoleTemplateVersionsOptions the instance to initialize the Builder with - */ - private Builder(ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions) { - this.roleTemplateId = listRoleTemplateVersionsOptions.roleTemplateId; - this.state = listRoleTemplateVersionsOptions.state; - this.limit = listRoleTemplateVersionsOptions.limit; - this.start = listRoleTemplateVersionsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - */ - public Builder(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - } - - /** - * Builds a ListRoleTemplateVersionsOptions. - * - * @return the new ListRoleTemplateVersionsOptions instance - */ - public ListRoleTemplateVersionsOptions build() { - return new ListRoleTemplateVersionsOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the ListRoleTemplateVersionsOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListRoleTemplateVersionsOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListRoleTemplateVersionsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListRoleTemplateVersionsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListRoleTemplateVersionsOptions() { } - - protected ListRoleTemplateVersionsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - roleTemplateId = builder.roleTemplateId; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListRoleTemplateVersionsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * The role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the state. - * - * Role template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java deleted file mode 100644 index 8f889bdce96..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java +++ /dev/null @@ -1,307 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listRoleTemplates options. - */ -public class ListRoleTemplatesOptions extends GenericModel { - - /** - * The role template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String accountId; - protected String acceptLanguage; - protected String name; - protected String roleName; - protected String roleServiceName; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String name; - private String roleName; - private String roleServiceName; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListRoleTemplatesOptions instance. - * - * @param listRoleTemplatesOptions the instance to initialize the Builder with - */ - private Builder(ListRoleTemplatesOptions listRoleTemplatesOptions) { - this.accountId = listRoleTemplatesOptions.accountId; - this.acceptLanguage = listRoleTemplatesOptions.acceptLanguage; - this.name = listRoleTemplatesOptions.name; - this.roleName = listRoleTemplatesOptions.roleName; - this.roleServiceName = listRoleTemplatesOptions.roleServiceName; - this.state = listRoleTemplatesOptions.state; - this.limit = listRoleTemplatesOptions.limit; - this.start = listRoleTemplatesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListRoleTemplatesOptions. - * - * @return the new ListRoleTemplatesOptions instance - */ - public ListRoleTemplatesOptions build() { - return new ListRoleTemplatesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListRoleTemplatesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListRoleTemplatesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ListRoleTemplatesOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the roleName. - * - * @param roleName the roleName - * @return the ListRoleTemplatesOptions builder - */ - public Builder roleName(String roleName) { - this.roleName = roleName; - return this; - } - - /** - * Set the roleServiceName. - * - * @param roleServiceName the roleServiceName - * @return the ListRoleTemplatesOptions builder - */ - public Builder roleServiceName(String roleServiceName) { - this.roleServiceName = roleServiceName; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListRoleTemplatesOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListRoleTemplatesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListRoleTemplatesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListRoleTemplatesOptions() { } - - protected ListRoleTemplatesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - name = builder.name; - roleName = builder.roleName; - roleServiceName = builder.roleServiceName; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListRoleTemplatesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the role templates belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the name. - * - * The role template name. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the roleName. - * - * The template role name. - * - * @return the roleName - */ - public String roleName() { - return roleName; - } - - /** - * Gets the roleServiceName. - * - * The template role service name. - * - * @return the roleServiceName - */ - public String roleServiceName() { - return roleServiceName; - } - - /** - * Gets the state. - * - * The role template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java deleted file mode 100644 index 2ca364c53a3..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listRoles options. - */ -public class ListRolesOptions extends GenericModel { - - protected String acceptLanguage; - protected String accountId; - protected String serviceName; - protected String sourceServiceName; - protected String policyType; - protected String serviceGroupId; - - /** - * Builder. - */ - public static class Builder { - private String acceptLanguage; - private String accountId; - private String serviceName; - private String sourceServiceName; - private String policyType; - private String serviceGroupId; - - /** - * Instantiates a new Builder from an existing ListRolesOptions instance. - * - * @param listRolesOptions the instance to initialize the Builder with - */ - private Builder(ListRolesOptions listRolesOptions) { - this.acceptLanguage = listRolesOptions.acceptLanguage; - this.accountId = listRolesOptions.accountId; - this.serviceName = listRolesOptions.serviceName; - this.sourceServiceName = listRolesOptions.sourceServiceName; - this.policyType = listRolesOptions.policyType; - this.serviceGroupId = listRolesOptions.serviceGroupId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a ListRolesOptions. - * - * @return the new ListRolesOptions instance - */ - public ListRolesOptions build() { - return new ListRolesOptions(this); - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListRolesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListRolesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the ListRolesOptions builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the sourceServiceName. - * - * @param sourceServiceName the sourceServiceName - * @return the ListRolesOptions builder - */ - public Builder sourceServiceName(String sourceServiceName) { - this.sourceServiceName = sourceServiceName; - return this; - } - - /** - * Set the policyType. - * - * @param policyType the policyType - * @return the ListRolesOptions builder - */ - public Builder policyType(String policyType) { - this.policyType = policyType; - return this; - } - - /** - * Set the serviceGroupId. - * - * @param serviceGroupId the serviceGroupId - * @return the ListRolesOptions builder - */ - public Builder serviceGroupId(String serviceGroupId) { - this.serviceGroupId = serviceGroupId; - return this; - } - } - - protected ListRolesOptions() { } - - protected ListRolesOptions(Builder builder) { - acceptLanguage = builder.acceptLanguage; - accountId = builder.accountId; - serviceName = builder.serviceName; - sourceServiceName = builder.sourceServiceName; - policyType = builder.policyType; - serviceGroupId = builder.serviceGroupId; - } - - /** - * New builder. - * - * @return a ListRolesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the accountId. - * - * Optional account GUID in which the roles belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the serviceName. - * - * Optional name of IAM enabled service. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the sourceServiceName. - * - * Optional name of source IAM enabled service. - * - * @return the sourceServiceName - */ - public String sourceServiceName() { - return sourceServiceName; - } - - /** - * Gets the policyType. - * - * Optional Policy Type. - * - * @return the policyType - */ - public String policyType() { - return policyType; - } - - /** - * Gets the serviceGroupId. - * - * Optional id of service group. - * - * @return the serviceGroupId - */ - public String serviceGroupId() { - return serviceGroupId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java deleted file mode 100644 index 65849c3d9a6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java +++ /dev/null @@ -1,492 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listV2Policies options. - */ -public class ListV2PoliciesOptions extends GenericModel { - - /** - * Optional type of policy. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - /** - * Optional type of service. - */ - public interface ServiceType { - /** service. */ - String SERVICE = "service"; - /** platform_service. */ - String PLATFORM_SERVICE = "platform_service"; - } - - /** - * Include additional data per policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles and translations for all - * relevant fields. - */ - public interface Format { - /** include_last_permit. */ - String INCLUDE_LAST_PERMIT = "include_last_permit"; - /** display. */ - String DISPLAY = "display"; - } - - /** - * The state of the policy. - * * `active` - returns active policies - * * `deleted` - returns non-active policies. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String accountId; - protected String acceptLanguage; - protected String iamId; - protected String accessGroupId; - protected String type; - protected String serviceType; - protected String serviceName; - protected String serviceGroupId; - protected String sort; - protected String format; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String iamId; - private String accessGroupId; - private String type; - private String serviceType; - private String serviceName; - private String serviceGroupId; - private String sort; - private String format; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListV2PoliciesOptions instance. - * - * @param listV2PoliciesOptions the instance to initialize the Builder with - */ - private Builder(ListV2PoliciesOptions listV2PoliciesOptions) { - this.accountId = listV2PoliciesOptions.accountId; - this.acceptLanguage = listV2PoliciesOptions.acceptLanguage; - this.iamId = listV2PoliciesOptions.iamId; - this.accessGroupId = listV2PoliciesOptions.accessGroupId; - this.type = listV2PoliciesOptions.type; - this.serviceType = listV2PoliciesOptions.serviceType; - this.serviceName = listV2PoliciesOptions.serviceName; - this.serviceGroupId = listV2PoliciesOptions.serviceGroupId; - this.sort = listV2PoliciesOptions.sort; - this.format = listV2PoliciesOptions.format; - this.state = listV2PoliciesOptions.state; - this.limit = listV2PoliciesOptions.limit; - this.start = listV2PoliciesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListV2PoliciesOptions. - * - * @return the new ListV2PoliciesOptions instance - */ - public ListV2PoliciesOptions build() { - return new ListV2PoliciesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListV2PoliciesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListV2PoliciesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the iamId. - * - * @param iamId the iamId - * @return the ListV2PoliciesOptions builder - */ - public Builder iamId(String iamId) { - this.iamId = iamId; - return this; - } - - /** - * Set the accessGroupId. - * - * @param accessGroupId the accessGroupId - * @return the ListV2PoliciesOptions builder - */ - public Builder accessGroupId(String accessGroupId) { - this.accessGroupId = accessGroupId; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the ListV2PoliciesOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the serviceType. - * - * @param serviceType the serviceType - * @return the ListV2PoliciesOptions builder - */ - public Builder serviceType(String serviceType) { - this.serviceType = serviceType; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the ListV2PoliciesOptions builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the serviceGroupId. - * - * @param serviceGroupId the serviceGroupId - * @return the ListV2PoliciesOptions builder - */ - public Builder serviceGroupId(String serviceGroupId) { - this.serviceGroupId = serviceGroupId; - return this; - } - - /** - * Set the sort. - * - * @param sort the sort - * @return the ListV2PoliciesOptions builder - */ - public Builder sort(String sort) { - this.sort = sort; - return this; - } - - /** - * Set the format. - * - * @param format the format - * @return the ListV2PoliciesOptions builder - */ - public Builder format(String format) { - this.format = format; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListV2PoliciesOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListV2PoliciesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListV2PoliciesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListV2PoliciesOptions() { } - - protected ListV2PoliciesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - iamId = builder.iamId; - accessGroupId = builder.accessGroupId; - type = builder.type; - serviceType = builder.serviceType; - serviceName = builder.serviceName; - serviceGroupId = builder.serviceGroupId; - sort = builder.sort; - format = builder.format; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListV2PoliciesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID in which the policies belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the iamId. - * - * Optional IAM ID used to identify the subject. - * - * @return the iamId - */ - public String iamId() { - return iamId; - } - - /** - * Gets the accessGroupId. - * - * Optional access group id. - * - * @return the accessGroupId - */ - public String accessGroupId() { - return accessGroupId; - } - - /** - * Gets the type. - * - * Optional type of policy. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the serviceType. - * - * Optional type of service. - * - * @return the serviceType - */ - public String serviceType() { - return serviceType; - } - - /** - * Gets the serviceName. - * - * Optional name of service. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the serviceGroupId. - * - * Optional ID of service group. - * - * @return the serviceGroupId - */ - public String serviceGroupId() { - return serviceGroupId; - } - - /** - * Gets the sort. - * - * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending - * '-' to field, for example, '-last_modified_at'. Note that last permit information is only included when - * 'format=include_last_permit', for example, "format=include_last_permit&sort=last_permit_at" Example fields that - * can be sorted on: - * - 'id' - * - 'type' - * - 'href' - * - 'created_at' - * - 'created_by_id' - * - 'last_modified_at' - * - 'last_modified_by_id' - * - 'state' - * - 'last_permit_at' - * - 'last_permit_frequency'. - * - * @return the sort - */ - public String sort() { - return sort; - } - - /** - * Gets the format. - * - * Include additional data per policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles and translations for all - * relevant fields. - * - * @return the format - */ - public String format() { - return format; - } - - /** - * Gets the state. - * - * The state of the policy. - * * `active` - returns active policies - * * `deleted` - returns non-active policies. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java deleted file mode 100644 index 4d43d84dbba..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Condition that specifies additional conditions or RuleAttribute to grant access. - * - * Classes which extend this class: - * - NestedConditionRuleAttribute - * - NestedConditionRuleWithConditions - */ -public class NestedCondition extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - protected String key; - protected String operator; - protected Object value; - protected List conditions; - - protected NestedCondition() { } - - /** - * Gets the key. - * - * The name of an attribute. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } - - /** - * Gets the conditions. - * - * List of conditions associated with a policy. For example, time-based conditions that grant access over a certain - * time period. - * - * @return the conditions - */ - public List conditions() { - return conditions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java deleted file mode 100644 index b1d44da3f6b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * Rule that specifies additional access that is granted (For example, time-based condition). - */ -public class NestedConditionRuleAttribute extends NestedCondition { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing NestedConditionRuleAttribute instance. - * - * @param nestedConditionRuleAttribute the instance to initialize the Builder with - */ - public Builder(NestedCondition nestedConditionRuleAttribute) { - this.key = nestedConditionRuleAttribute.key; - this.operator = nestedConditionRuleAttribute.operator; - this.value = nestedConditionRuleAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a NestedConditionRuleAttribute. - * - * @return the new NestedConditionRuleAttribute instance - */ - public NestedConditionRuleAttribute build() { - return new NestedConditionRuleAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the NestedConditionRuleAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the NestedConditionRuleAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the NestedConditionRuleAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected NestedConditionRuleAttribute() { } - - protected NestedConditionRuleAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a NestedConditionRuleAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java deleted file mode 100644 index 20d0faac795..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * Rule that specifies additional access that is granted (for example, time-based condition) accross multiple - * conditions. - */ -public class NestedConditionRuleWithConditions extends NestedCondition { - - /** - * Operator to evaluate conditions. - */ - public interface Operator { - /** and. */ - String AND = "and"; - /** or. */ - String OR = "or"; - } - - - /** - * Builder. - */ - public static class Builder { - private String operator; - private List conditions; - - /** - * Instantiates a new Builder from an existing NestedConditionRuleWithConditions instance. - * - * @param nestedConditionRuleWithConditions the instance to initialize the Builder with - */ - public Builder(NestedCondition nestedConditionRuleWithConditions) { - this.operator = nestedConditionRuleWithConditions.operator; - this.conditions = nestedConditionRuleWithConditions.conditions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param operator the operator - * @param conditions the conditions - */ - public Builder(String operator, List conditions) { - this.operator = operator; - this.conditions = conditions; - } - - /** - * Builds a NestedConditionRuleWithConditions. - * - * @return the new NestedConditionRuleWithConditions instance - */ - public NestedConditionRuleWithConditions build() { - return new NestedConditionRuleWithConditions(this); - } - - /** - * Adds a new element to conditions. - * - * @param conditions the new element to be added - * @return the NestedConditionRuleWithConditions builder - */ - public Builder addConditions(RuleAttribute conditions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(conditions, - "conditions cannot be null"); - if (this.conditions == null) { - this.conditions = new ArrayList(); - } - this.conditions.add(conditions); - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the NestedConditionRuleWithConditions builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the conditions. - * Existing conditions will be replaced. - * - * @param conditions the conditions - * @return the NestedConditionRuleWithConditions builder - */ - public Builder conditions(List conditions) { - this.conditions = conditions; - return this; - } - } - - protected NestedConditionRuleWithConditions() { } - - protected NestedConditionRuleWithConditions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.conditions, - "conditions cannot be null"); - operator = builder.operator; - conditions = builder.conditions; - } - - /** - * New builder. - * - * @return a NestedConditionRuleWithConditions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java deleted file mode 100644 index b0442f902bc..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Details with href linking to the following page of requested collection. - */ -public class Next extends GenericModel { - - protected String href; - protected String start; - - protected Next() { } - - /** - * Gets the href. - * - * The href linking to the page of requested collection. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection. - * - * @return the start - */ - public String getStart() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java deleted file mode 100644 index 8f12053c72e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * PoliciesPager can be used to simplify the use of the "listPolicies" method. - */ -public class PoliciesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListPoliciesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected PoliciesPager() { } - - /** - * Constructs a new PoliciesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listPolicies" method - * @param options the ListPoliciesOptions instance to be used to invoke the "listPolicies" method - */ - public PoliciesPager(IamPolicyManagement client, ListPoliciesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<PolicyTemplateMetaData> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListPoliciesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - PolicyCollection result = client.listPolicies(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getPolicies(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<PolicyTemplateMetaData> containing all results returned by the "listPolicies" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java deleted file mode 100644 index af852b7cd74..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with a policy. - */ -public class Policy extends GenericModel { - - /** - * The policy state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String id; - protected String type; - protected String description; - protected List subjects; - protected List roles; - protected List resources; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String state; - - protected Policy() { } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Gets the description. - * - * Customer-defined description. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the subjects. - * - * The subjects associated with a policy. - * - * @return the subjects - */ - public List getSubjects() { - return subjects; - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List getRoles() { - return roles; - } - - /** - * Gets the resources. - * - * The resources associated with a policy. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the href. - * - * The href links back to the policy. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the state. - * - * The policy state. - * - * @return the state - */ - public String getState() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java deleted file mode 100644 index 3e566ce7bdf..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Set of properties for the assigned resource. - */ -public class PolicyAssignmentResourcePolicy extends GenericModel { - - @SerializedName("resource_created") - protected AssignmentResourceCreated resourceCreated; - protected String status; - @SerializedName("error_message") - protected AssignmentResourceError errorMessage; - - protected PolicyAssignmentResourcePolicy() { } - - /** - * Gets the resourceCreated. - * - * On success, includes the policy that is assigned. - * - * @return the resourceCreated - */ - public AssignmentResourceCreated getResourceCreated() { - return resourceCreated; - } - - /** - * Gets the status. - * - * policy status. - * - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * Gets the errorMessage. - * - * Body parameters for assignment error. - * - * @return the errorMessage - */ - public AssignmentResourceError getErrorMessage() { - return errorMessage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java deleted file mode 100644 index ad944536b0d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The policy assignment resources. - */ -public class PolicyAssignmentResources extends GenericModel { - - protected String target; - protected PolicyAssignmentResourcePolicy policy; - - protected PolicyAssignmentResources() { } - - /** - * Gets the target. - * - * Account ID where resources are assigned. - * - * @return the target - */ - public String getTarget() { - return target; - } - - /** - * Gets the policy. - * - * Set of properties for the assigned resource. - * - * @return the policy - */ - public PolicyAssignmentResourcePolicy getPolicy() { - return policy; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java deleted file mode 100644 index f1ea295713c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the policy template assignment. - */ -public class PolicyAssignmentV1 extends GenericModel { - - /** - * The policy assignment status. - */ - public interface Status { - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** succeeded. */ - String SUCCEEDED = "succeeded"; - /** succeed_with_errors. */ - String SUCCEED_WITH_ERRORS = "succeed_with_errors"; - /** failed. */ - String FAILED = "failed"; - } - - protected AssignmentTargetDetails target; - protected String id; - @SerializedName("account_id") - protected String accountId; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected List resources; - protected PolicyAssignmentV1Subject subject; - protected AssignmentTemplateDetails template; - protected String status; - - protected PolicyAssignmentV1() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the id. - * - * Policy assignment ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the accountId. - * - * The account GUID that the policies assignments belong to. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the href. - * - * The href URL that links to the policies assignments API by policy assignment ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy assignment was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy assignment. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy assignment was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy assignment. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the resources. - * - * Object for each account assigned. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the subject. - * - * Subject details of access type assignment. - * - * @return the subject - */ - public PolicyAssignmentV1Subject getSubject() { - return subject; - } - - /** - * Gets the template. - * - * policy template details. - * - * @return the template - */ - public AssignmentTemplateDetails getTemplate() { - return template; - } - - /** - * Gets the status. - * - * The policy assignment status. - * - * @return the status - */ - public String getStatus() { - return status; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java deleted file mode 100644 index 7331ee5a854..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Policy assignment response. - */ -public class PolicyAssignmentV1Collection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List assignments; - - protected PolicyAssignmentV1Collection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the assignments. - * - * Response of policy assignments. - * - * @return the assignments - */ - public List getAssignments() { - return assignments; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java deleted file mode 100644 index c05eb90816b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The policy assignment resources. - */ -public class PolicyAssignmentV1Resources extends GenericModel { - - protected AssignmentTargetDetails target; - protected PolicyAssignmentResourcePolicy policy; - - protected PolicyAssignmentV1Resources() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the policy. - * - * Set of properties for the assigned resource. - * - * @return the policy - */ - public PolicyAssignmentResourcePolicy getPolicy() { - return policy; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java deleted file mode 100644 index 58b2cd240ba..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Subject details of access type assignment. - */ -public class PolicyAssignmentV1Subject extends GenericModel { - - /** - * The identity type of the subject of the assignment. - */ - public interface Type { - /** iam_id. */ - String IAM_ID = "iam_id"; - /** access_group_id. */ - String ACCESS_GROUP_ID = "access_group_id"; - } - - protected String id; - protected String type; - - protected PolicyAssignmentV1Subject() { } - - /** - * Gets the id. - * - * The unique identifier of the subject of the assignment. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the type. - * - * The identity type of the subject of the assignment. - * - * @return the type - */ - public String getType() { - return type; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java deleted file mode 100644 index 931769daed5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * PolicyAssignmentsPager can be used to simplify the use of the "listPolicyAssignments" method. - */ -public class PolicyAssignmentsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListPolicyAssignmentsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected PolicyAssignmentsPager() { } - - /** - * Constructs a new PolicyAssignmentsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyAssignments" method - * @param options the ListPolicyAssignmentsOptions instance to be used to invoke the "listPolicyAssignments" method - */ - public PolicyAssignmentsPager(IamPolicyManagement client, ListPolicyAssignmentsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<PolicyTemplateAssignmentItems> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListPolicyAssignmentsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - PolicyTemplateAssignmentCollection result = client.listPolicyAssignments(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getAssignments(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<PolicyTemplateAssignmentItems> containing all results returned by the "listPolicyAssignments" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java deleted file mode 100644 index 25062dd0a52..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of policies. - */ -public class PolicyCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List policies; - - protected PolicyCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the policies. - * - * List of policies. - * - * @return the policies - */ - public List getPolicies() { - return policies; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java deleted file mode 100644 index 4033f2dbc9d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The attributes of the resource. Note that only one resource is allowed in a policy. - */ -public class PolicyResource extends GenericModel { - - protected List attributes; - protected List tags; - - /** - * Builder. - */ - public static class Builder { - private List attributes; - private List tags; - - /** - * Instantiates a new Builder from an existing PolicyResource instance. - * - * @param policyResource the instance to initialize the Builder with - */ - private Builder(PolicyResource policyResource) { - this.attributes = policyResource.attributes; - this.tags = policyResource.tags; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param attributes the attributes - */ - public Builder(List attributes) { - this.attributes = attributes; - } - - /** - * Builds a PolicyResource. - * - * @return the new PolicyResource instance - */ - public PolicyResource build() { - return new PolicyResource(this); - } - - /** - * Adds a new element to attributes. - * - * @param attributes the new element to be added - * @return the PolicyResource builder - */ - public Builder addAttributes(ResourceAttribute attributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, - "attributes cannot be null"); - if (this.attributes == null) { - this.attributes = new ArrayList(); - } - this.attributes.add(attributes); - return this; - } - - /** - * Adds a new element to tags. - * - * @param tags the new element to be added - * @return the PolicyResource builder - */ - public Builder addTags(ResourceTag tags) { - com.ibm.cloud.sdk.core.util.Validator.notNull(tags, - "tags cannot be null"); - if (this.tags == null) { - this.tags = new ArrayList(); - } - this.tags.add(tags); - return this; - } - - /** - * Set the attributes. - * Existing attributes will be replaced. - * - * @param attributes the attributes - * @return the PolicyResource builder - */ - public Builder attributes(List attributes) { - this.attributes = attributes; - return this; - } - - /** - * Set the tags. - * Existing tags will be replaced. - * - * @param tags the tags - * @return the PolicyResource builder - */ - public Builder tags(List tags) { - this.tags = tags; - return this; - } - } - - protected PolicyResource() { } - - protected PolicyResource(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, - "attributes cannot be null"); - attributes = builder.attributes; - tags = builder.tags; - } - - /** - * New builder. - * - * @return a PolicyResource builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the attributes. - * - * List of resource attributes. - * - * @return the attributes - */ - public List attributes() { - return attributes; - } - - /** - * Gets the tags. - * - * List of access management tags. - * - * @return the tags - */ - public List tags() { - return tags; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java deleted file mode 100644 index 7319eabce7b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role associated with a policy. - */ -public class PolicyRole extends GenericModel { - - @SerializedName("role_id") - protected String roleId; - @SerializedName("display_name") - protected String displayName; - protected String description; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - - /** - * Instantiates a new Builder from an existing PolicyRole instance. - * - * @param policyRole the instance to initialize the Builder with - */ - private Builder(PolicyRole policyRole) { - this.roleId = policyRole.roleId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - */ - public Builder(String roleId) { - this.roleId = roleId; - } - - /** - * Builds a PolicyRole. - * - * @return the new PolicyRole instance - */ - public PolicyRole build() { - return new PolicyRole(this); - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the PolicyRole builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - } - - protected PolicyRole() { } - - protected PolicyRole(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleId, - "roleId cannot be null"); - roleId = builder.roleId; - } - - /** - * New builder. - * - * @return a PolicyRole builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } - - /** - * Gets the displayName. - * - * The display name of the role. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String description() { - return description; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java deleted file mode 100644 index bf1b035a6b7..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The subject attribute values that must match in order for this policy to apply in a permission decision. - */ -public class PolicySubject extends GenericModel { - - protected List attributes; - - /** - * Builder. - */ - public static class Builder { - private List attributes; - - /** - * Instantiates a new Builder from an existing PolicySubject instance. - * - * @param policySubject the instance to initialize the Builder with - */ - private Builder(PolicySubject policySubject) { - this.attributes = policySubject.attributes; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param attributes the attributes - */ - public Builder(List attributes) { - this.attributes = attributes; - } - - /** - * Builds a PolicySubject. - * - * @return the new PolicySubject instance - */ - public PolicySubject build() { - return new PolicySubject(this); - } - - /** - * Adds a new element to attributes. - * - * @param attributes the new element to be added - * @return the PolicySubject builder - */ - public Builder addAttributes(SubjectAttribute attributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, - "attributes cannot be null"); - if (this.attributes == null) { - this.attributes = new ArrayList(); - } - this.attributes.add(attributes); - return this; - } - - /** - * Set the attributes. - * Existing attributes will be replaced. - * - * @param attributes the attributes - * @return the PolicySubject builder - */ - public Builder attributes(List attributes) { - this.attributes = attributes; - return this; - } - } - - protected PolicySubject() { } - - protected PolicySubject(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, - "attributes cannot be null"); - attributes = builder.attributes; - } - - /** - * New builder. - * - * @return a PolicySubject builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the attributes. - * - * List of subject attributes. - * - * @return the attributes - */ - public List attributes() { - return attributes; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java deleted file mode 100644 index bdffbe98c10..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the policy template. - */ -public class PolicyTemplate extends GenericModel { - - /** - * State of policy template. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String name; - protected String description; - @SerializedName("account_id") - protected String accountId; - protected String version; - protected Boolean committed; - protected TemplatePolicy policy; - protected String state; - protected String id; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - - protected PolicyTemplate() { } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the version. - * - * Template version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the committed. - * - * Committed status of the template version. - * - * @return the committed - */ - public Boolean isCommitted() { - return committed; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy getPolicy() { - return policy; - } - - /** - * Gets the state. - * - * State of policy template. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the id. - * - * The policy template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the policy templates API by policy template ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy template was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy template. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy template was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy template. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java deleted file mode 100644 index 54727eadf4d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of policies assignments. - */ -public class PolicyTemplateAssignmentCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List assignments; - - protected PolicyTemplateAssignmentCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the assignments. - * - * List of policy assignments. - * - * @return the assignments - */ - public List getAssignments() { - return assignments; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java deleted file mode 100644 index 2c8e82df441..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * PolicyTemplateAssignmentItems. - * - * Classes which extend this class: - * - PolicyTemplateAssignmentItemsPolicyAssignmentV1 - * - PolicyTemplateAssignmentItemsPolicyAssignment - */ -public class PolicyTemplateAssignmentItems extends GenericModel { - - /** - * The policy assignment status. - */ - public interface Status { - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** succeeded. */ - String SUCCEEDED = "succeeded"; - /** succeed_with_errors. */ - String SUCCEED_WITH_ERRORS = "succeed_with_errors"; - /** failed. */ - String FAILED = "failed"; - } - - /** - * Assignment target type. - */ - public interface TargetType { - /** Account. */ - String ACCOUNT = "Account"; - /** AccountGroup. */ - String ACCOUNTGROUP = "AccountGroup"; - /** Enterprise. */ - String ENTERPRISE = "Enterprise"; - } - - protected AssignmentTargetDetails target; - protected String id; - @SerializedName("account_id") - protected String accountId; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected List resources; - protected PolicyAssignmentV1Subject subject; - protected AssignmentTemplateDetails template; - protected String status; - @SerializedName("template_id") - protected String templateId; - @SerializedName("template_version") - protected String templateVersion; - @SerializedName("assignment_id") - protected String assignmentId; - @SerializedName("target_type") - protected String targetType; - - protected PolicyTemplateAssignmentItems() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the id. - * - * Policy assignment ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the accountId. - * - * The account GUID that the policies assignments belong to. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the href. - * - * The href URL that links to the policies assignments API by policy assignment ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy assignment was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy assignment. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy assignment was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy assignment. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the resources. - * - * Object for each account assigned. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the subject. - * - * Subject details of access type assignment. - * - * @return the subject - */ - public PolicyAssignmentV1Subject getSubject() { - return subject; - } - - /** - * Gets the template. - * - * policy template details. - * - * @return the template - */ - public AssignmentTemplateDetails getTemplate() { - return template; - } - - /** - * Gets the status. - * - * The policy assignment status. - * - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * Gets the templateId. - * - * policy template ID. - * - * @return the templateId - */ - public String getTemplateId() { - return templateId; - } - - /** - * Gets the templateVersion. - * - * policy template version. - * - * @return the templateVersion - */ - public String getTemplateVersion() { - return templateVersion; - } - - /** - * Gets the assignmentId. - * - * Passed in value to correlate with other assignments. - * - * @return the assignmentId - */ - public String getAssignmentId() { - return assignmentId; - } - - /** - * Gets the targetType. - * - * Assignment target type. - * - * @return the targetType - */ - public String getTargetType() { - return targetType; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java deleted file mode 100644 index ec9c32e5bdd..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * The set of properties associated with the policy template assignment. - */ -public class PolicyTemplateAssignmentItemsPolicyAssignment extends PolicyTemplateAssignmentItems { - - /** - * Assignment target type. - */ - public interface TargetType { - /** Account. */ - String ACCOUNT = "Account"; - /** AccountGroup. */ - String ACCOUNTGROUP = "AccountGroup"; - /** Enterprise. */ - String ENTERPRISE = "Enterprise"; - } - - /** - * The policy assignment status. - */ - public interface Status { - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** succeeded. */ - String SUCCEEDED = "succeeded"; - /** succeed_with_errors. */ - String SUCCEED_WITH_ERRORS = "succeed_with_errors"; - /** failed. */ - String FAILED = "failed"; - } - - - protected PolicyTemplateAssignmentItemsPolicyAssignment() { } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java deleted file mode 100644 index 4cebdbb17b1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * The set of properties associated with the policy template assignment. - */ -public class PolicyTemplateAssignmentItemsPolicyAssignmentV1 extends PolicyTemplateAssignmentItems { - - /** - * The policy assignment status. - */ - public interface Status { - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** succeeded. */ - String SUCCEEDED = "succeeded"; - /** succeed_with_errors. */ - String SUCCEED_WITH_ERRORS = "succeed_with_errors"; - /** failed. */ - String FAILED = "failed"; - } - - - protected PolicyTemplateAssignmentItemsPolicyAssignmentV1() { } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java deleted file mode 100644 index 2a262c584b5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of policy Templates. - */ -public class PolicyTemplateCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - @SerializedName("policy_templates") - protected List policyTemplates; - - protected PolicyTemplateCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the policyTemplates. - * - * List of policy templates. - * - * @return the policyTemplates - */ - public List getPolicyTemplates() { - return policyTemplates; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java deleted file mode 100644 index 5a2876dfe28..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the policy template. - */ -public class PolicyTemplateLimitData extends GenericModel { - - /** - * State of policy template. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String name; - protected String description; - @SerializedName("account_id") - protected String accountId; - protected String version; - protected Boolean committed; - protected TemplatePolicy policy; - protected String state; - protected String id; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected TemplateCountData counts; - - protected PolicyTemplateLimitData() { } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the version. - * - * Template version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the committed. - * - * Committed status of the template version. - * - * @return the committed - */ - public Boolean isCommitted() { - return committed; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy getPolicy() { - return policy; - } - - /** - * Gets the state. - * - * State of policy template. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the id. - * - * The policy template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the policy templates API by policy template ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy template was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy template. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy template was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy template. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the counts. - * - * policy template count details. - * - * @return the counts - */ - public TemplateCountData getCounts() { - return counts; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java deleted file mode 100644 index 07effc5b3ad..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with a policy. - */ -public class PolicyTemplateMetaData extends GenericModel { - - /** - * The policy state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String id; - protected String type; - protected String description; - protected List subjects; - protected List roles; - protected List resources; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String state; - protected TemplateMetadata template; - - protected PolicyTemplateMetaData() { } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Gets the description. - * - * Customer-defined description. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the subjects. - * - * The subjects associated with a policy. - * - * @return the subjects - */ - public List getSubjects() { - return subjects; - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List getRoles() { - return roles; - } - - /** - * Gets the resources. - * - * The resources associated with a policy. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the href. - * - * The href links back to the policy. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the state. - * - * The policy state. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the template. - * - * The details of the IAM template that was used to create an enterprise-managed policy in your account. When - * returned, this indicates that the policy is created from and managed by a template in the root enterprise account. - * - * @return the template - */ - public TemplateMetadata getTemplate() { - return template; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java deleted file mode 100644 index a4f95bc6562..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of versions for a specific policy template. - */ -public class PolicyTemplateVersionsCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List versions; - - protected PolicyTemplateVersionsCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the versions. - * - * List of policy templates versions. - * - * @return the versions - */ - public List getVersions() { - return versions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java deleted file mode 100644 index f6a2496cf91..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * PolicyTemplateVersionsPager can be used to simplify the use of the "listPolicyTemplateVersions" method. - */ -public class PolicyTemplateVersionsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListPolicyTemplateVersionsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected PolicyTemplateVersionsPager() { } - - /** - * Constructs a new PolicyTemplateVersionsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyTemplateVersions" method - * @param options the ListPolicyTemplateVersionsOptions instance to be used to invoke the "listPolicyTemplateVersions" method - */ - public PolicyTemplateVersionsPager(IamPolicyManagement client, ListPolicyTemplateVersionsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<PolicyTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListPolicyTemplateVersionsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - PolicyTemplateVersionsCollection result = client.listPolicyTemplateVersions(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getVersions(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<PolicyTemplate> containing all results returned by the "listPolicyTemplateVersions" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java deleted file mode 100644 index eba6e6c8fad..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * PolicyTemplatesPager can be used to simplify the use of the "listPolicyTemplates" method. - */ -public class PolicyTemplatesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListPolicyTemplatesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected PolicyTemplatesPager() { } - - /** - * Constructs a new PolicyTemplatesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyTemplates" method - * @param options the ListPolicyTemplatesOptions instance to be used to invoke the "listPolicyTemplates" method - */ - public PolicyTemplatesPager(IamPolicyManagement client, ListPolicyTemplatesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<PolicyTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListPolicyTemplatesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - PolicyTemplateCollection result = client.listPolicyTemplates(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getPolicyTemplates(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<PolicyTemplate> containing all results returned by the "listPolicyTemplates" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java deleted file mode 100644 index 2656f3fb790..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Details with linking href to previous page of requested collection. - */ -public class Previous extends GenericModel { - - protected String href; - protected String start; - - protected Previous() { } - - /** - * Gets the href. - * - * The href linking to the page of requested collection. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection. - * - * @return the start - */ - public String getStart() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java deleted file mode 100644 index 151a77e8cb9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java +++ /dev/null @@ -1,273 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replaceActionControlTemplate options. - */ -public class ReplaceActionControlTemplateOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String version; - protected String ifMatch; - protected String name; - protected String description; - protected TemplateActionControl actionControl; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String version; - private String ifMatch; - private String name; - private String description; - private TemplateActionControl actionControl; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing ReplaceActionControlTemplateOptions instance. - * - * @param replaceActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(ReplaceActionControlTemplateOptions replaceActionControlTemplateOptions) { - this.actionControlTemplateId = replaceActionControlTemplateOptions.actionControlTemplateId; - this.version = replaceActionControlTemplateOptions.version; - this.ifMatch = replaceActionControlTemplateOptions.ifMatch; - this.name = replaceActionControlTemplateOptions.name; - this.description = replaceActionControlTemplateOptions.description; - this.actionControl = replaceActionControlTemplateOptions.actionControl; - this.committed = replaceActionControlTemplateOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - * @param version the version - * @param ifMatch the ifMatch - */ - public Builder(String actionControlTemplateId, String version, String ifMatch) { - this.actionControlTemplateId = actionControlTemplateId; - this.version = version; - this.ifMatch = ifMatch; - } - - /** - * Builds a ReplaceActionControlTemplateOptions. - * - * @return the new ReplaceActionControlTemplateOptions instance - */ - public ReplaceActionControlTemplateOptions build() { - return new ReplaceActionControlTemplateOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actionControl. - * - * @param actionControl the actionControl - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder actionControl(TemplateActionControl actionControl) { - this.actionControl = actionControl; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected ReplaceActionControlTemplateOptions() { } - - protected ReplaceActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - actionControlTemplateId = builder.actionControlTemplateId; - version = builder.version; - ifMatch = builder.ifMatch; - name = builder.name; - description = builder.description; - actionControl = builder.actionControl; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a ReplaceActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating an action control template version must match the Etag value of the existing - * action control template version. The Etag can be retrieved using the GET - * /v1/action_control_templates/{template_id}/versions/{version} API and looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will - * change the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the action control template. This is shown to users in the enterprise account. Use this to describe - * the purpose or context of the action control for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actionControl. - * - * The action control properties that are created in an action resource when the template is assigned. - * - * @return the actionControl - */ - public TemplateActionControl actionControl() { - return actionControl; - } - - /** - * Gets the committed. - * - * Committed status of the template version. If committed is set to true, then the template version can no longer be - * updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java deleted file mode 100644 index 80cbe9e4c79..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java +++ /dev/null @@ -1,335 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replacePolicy options. - */ -public class ReplacePolicyOptions extends GenericModel { - - protected String policyId; - protected String ifMatch; - protected String type; - protected List subjects; - protected List roles; - protected List resources; - protected String description; - - /** - * Builder. - */ - public static class Builder { - private String policyId; - private String ifMatch; - private String type; - private List subjects; - private List roles; - private List resources; - private String description; - - /** - * Instantiates a new Builder from an existing ReplacePolicyOptions instance. - * - * @param replacePolicyOptions the instance to initialize the Builder with - */ - private Builder(ReplacePolicyOptions replacePolicyOptions) { - this.policyId = replacePolicyOptions.policyId; - this.ifMatch = replacePolicyOptions.ifMatch; - this.type = replacePolicyOptions.type; - this.subjects = replacePolicyOptions.subjects; - this.roles = replacePolicyOptions.roles; - this.resources = replacePolicyOptions.resources; - this.description = replacePolicyOptions.description; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyId the policyId - * @param ifMatch the ifMatch - * @param type the type - * @param subjects the subjects - * @param roles the roles - * @param resources the resources - */ - public Builder(String policyId, String ifMatch, String type, List subjects, List roles, List resources) { - this.policyId = policyId; - this.ifMatch = ifMatch; - this.type = type; - this.subjects = subjects; - this.roles = roles; - this.resources = resources; - } - - /** - * Builds a ReplacePolicyOptions. - * - * @return the new ReplacePolicyOptions instance - */ - public ReplacePolicyOptions build() { - return new ReplacePolicyOptions(this); - } - - /** - * Adds a new element to subjects. - * - * @param subjects the new element to be added - * @return the ReplacePolicyOptions builder - */ - public Builder addSubjects(PolicySubject subjects) { - com.ibm.cloud.sdk.core.util.Validator.notNull(subjects, - "subjects cannot be null"); - if (this.subjects == null) { - this.subjects = new ArrayList(); - } - this.subjects.add(subjects); - return this; - } - - /** - * Adds a new element to roles. - * - * @param roles the new element to be added - * @return the ReplacePolicyOptions builder - */ - public Builder addRoles(PolicyRole roles) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roles, - "roles cannot be null"); - if (this.roles == null) { - this.roles = new ArrayList(); - } - this.roles.add(roles); - return this; - } - - /** - * Adds a new element to resources. - * - * @param resources the new element to be added - * @return the ReplacePolicyOptions builder - */ - public Builder addResources(PolicyResource resources) { - com.ibm.cloud.sdk.core.util.Validator.notNull(resources, - "resources cannot be null"); - if (this.resources == null) { - this.resources = new ArrayList(); - } - this.resources.add(resources); - return this; - } - - /** - * Set the policyId. - * - * @param policyId the policyId - * @return the ReplacePolicyOptions builder - */ - public Builder policyId(String policyId) { - this.policyId = policyId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplacePolicyOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the ReplacePolicyOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the subjects. - * Existing subjects will be replaced. - * - * @param subjects the subjects - * @return the ReplacePolicyOptions builder - */ - public Builder subjects(List subjects) { - this.subjects = subjects; - return this; - } - - /** - * Set the roles. - * Existing roles will be replaced. - * - * @param roles the roles - * @return the ReplacePolicyOptions builder - */ - public Builder roles(List roles) { - this.roles = roles; - return this; - } - - /** - * Set the resources. - * Existing resources will be replaced. - * - * @param resources the resources - * @return the ReplacePolicyOptions builder - */ - public Builder resources(List resources) { - this.resources = resources; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplacePolicyOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - } - - protected ReplacePolicyOptions() { } - - protected ReplacePolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, - "policyId 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.type, - "type cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subjects, - "subjects cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, - "roles cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resources, - "resources cannot be null"); - policyId = builder.policyId; - ifMatch = builder.ifMatch; - type = builder.type; - subjects = builder.subjects; - roles = builder.roles; - resources = builder.resources; - description = builder.description; - } - - /** - * New builder. - * - * @return a ReplacePolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyId. - * - * The policy ID. - * - * @return the policyId - */ - public String policyId() { - return policyId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be - * retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the subjects. - * - * The subjects associated with a policy. - * - * @return the subjects - */ - public List subjects() { - return subjects; - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List roles() { - return roles; - } - - /** - * Gets the resources. - * - * The resources associated with a policy. - * - * @return the resources - */ - public List resources() { - return resources; - } - - /** - * Gets the description. - * - * Customer-defined description. - * - * @return the description - */ - public String description() { - return description; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java deleted file mode 100644 index 5a55c4898e5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replacePolicyTemplate options. - */ -public class ReplacePolicyTemplateOptions extends GenericModel { - - protected String policyTemplateId; - protected String version; - protected String ifMatch; - protected TemplatePolicy policy; - protected String name; - protected String description; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String version; - private String ifMatch; - private TemplatePolicy policy; - private String name; - private String description; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing ReplacePolicyTemplateOptions instance. - * - * @param replacePolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(ReplacePolicyTemplateOptions replacePolicyTemplateOptions) { - this.policyTemplateId = replacePolicyTemplateOptions.policyTemplateId; - this.version = replacePolicyTemplateOptions.version; - this.ifMatch = replacePolicyTemplateOptions.ifMatch; - this.policy = replacePolicyTemplateOptions.policy; - this.name = replacePolicyTemplateOptions.name; - this.description = replacePolicyTemplateOptions.description; - this.committed = replacePolicyTemplateOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param version the version - * @param ifMatch the ifMatch - * @param policy the policy - */ - public Builder(String policyTemplateId, String version, String ifMatch, TemplatePolicy policy) { - this.policyTemplateId = policyTemplateId; - this.version = version; - this.ifMatch = ifMatch; - this.policy = policy; - } - - /** - * Builds a ReplacePolicyTemplateOptions. - * - * @return the new ReplacePolicyTemplateOptions instance - */ - public ReplacePolicyTemplateOptions build() { - return new ReplacePolicyTemplateOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the policy. - * - * @param policy the policy - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder policy(TemplatePolicy policy) { - this.policy = policy; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected ReplacePolicyTemplateOptions() { } - - protected ReplacePolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version 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.policy, - "policy cannot be null"); - policyTemplateId = builder.policyTemplateId; - version = builder.version; - ifMatch = builder.ifMatch; - policy = builder.policy; - name = builder.name; - description = builder.description; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a ReplacePolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the version. - * - * The policy template version. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy template version and must match the Etag value of the existing policy - * template version. The Etag can be retrieved using the GET - * /v1/policy_templates/{policy_template_id}/versions/{version} API and looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy policy() { - return policy; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template version. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java deleted file mode 100644 index fc4b536103d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java +++ /dev/null @@ -1,255 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replaceRole options. - */ -public class ReplaceRoleOptions extends GenericModel { - - protected String roleId; - protected String ifMatch; - protected String displayName; - protected List actions; - protected String description; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - private String ifMatch; - private String displayName; - private List actions; - private String description; - - /** - * Instantiates a new Builder from an existing ReplaceRoleOptions instance. - * - * @param replaceRoleOptions the instance to initialize the Builder with - */ - private Builder(ReplaceRoleOptions replaceRoleOptions) { - this.roleId = replaceRoleOptions.roleId; - this.ifMatch = replaceRoleOptions.ifMatch; - this.displayName = replaceRoleOptions.displayName; - this.actions = replaceRoleOptions.actions; - this.description = replaceRoleOptions.description; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - * @param ifMatch the ifMatch - * @param displayName the displayName - * @param actions the actions - */ - public Builder(String roleId, String ifMatch, String displayName, List actions) { - this.roleId = roleId; - this.ifMatch = ifMatch; - this.displayName = displayName; - this.actions = actions; - } - - /** - * Builds a ReplaceRoleOptions. - * - * @return the new ReplaceRoleOptions instance - */ - public ReplaceRoleOptions build() { - return new ReplaceRoleOptions(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the ReplaceRoleOptions builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the ReplaceRoleOptions builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplaceRoleOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the ReplaceRoleOptions builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the ReplaceRoleOptions builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplaceRoleOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the role. - * - * @param role the role - * @return the ReplaceRoleOptions builder - */ - public Builder role(Role role) { - this.displayName = role.displayName(); - this.actions = role.actions(); - this.description = role.description(); - return this; - } - } - - protected ReplaceRoleOptions() { } - - protected ReplaceRoleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, - "roleId 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.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - roleId = builder.roleId; - ifMatch = builder.ifMatch; - displayName = builder.displayName; - actions = builder.actions; - description = builder.description; - } - - /** - * New builder. - * - * @return a ReplaceRoleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role ID. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a role and must match the ETag value of the existing role. The Etag can be - * retrieved using the GET /v2/roles/{role_id} API and looking at the ETag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List actions() { - return actions; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String description() { - return description; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java deleted file mode 100644 index 9a69b13326c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java +++ /dev/null @@ -1,273 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replaceRoleTemplate options. - */ -public class ReplaceRoleTemplateOptions extends GenericModel { - - protected String roleTemplateId; - protected String version; - protected String ifMatch; - protected String name; - protected String description; - protected TemplateRole role; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String version; - private String ifMatch; - private String name; - private String description; - private TemplateRole role; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing ReplaceRoleTemplateOptions instance. - * - * @param replaceRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(ReplaceRoleTemplateOptions replaceRoleTemplateOptions) { - this.roleTemplateId = replaceRoleTemplateOptions.roleTemplateId; - this.version = replaceRoleTemplateOptions.version; - this.ifMatch = replaceRoleTemplateOptions.ifMatch; - this.name = replaceRoleTemplateOptions.name; - this.description = replaceRoleTemplateOptions.description; - this.role = replaceRoleTemplateOptions.role; - this.committed = replaceRoleTemplateOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - * @param version the version - * @param ifMatch the ifMatch - */ - public Builder(String roleTemplateId, String version, String ifMatch) { - this.roleTemplateId = roleTemplateId; - this.version = version; - this.ifMatch = ifMatch; - } - - /** - * Builds a ReplaceRoleTemplateOptions. - * - * @return the new ReplaceRoleTemplateOptions instance - */ - public ReplaceRoleTemplateOptions build() { - return new ReplaceRoleTemplateOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the role. - * - * @param role the role - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder role(TemplateRole role) { - this.role = role; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected ReplaceRoleTemplateOptions() { } - - protected ReplaceRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - roleTemplateId = builder.roleTemplateId; - version = builder.version; - ifMatch = builder.ifMatch; - name = builder.name; - description = builder.description; - role = builder.role; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a ReplaceRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the version. - * - * Role template version. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a role template version must match the Etag value of the existing role template - * version. The Etag can be retrieved using the GET /v1/role_templates/{template_id}/versions/{version} API and - * looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will - * change the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the role template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the role for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the role. - * - * The role properties that are created in an action resource when the template is assigned. - * - * @return the role - */ - public TemplateRole role() { - return role; - } - - /** - * Gets the committed. - * - * Committed status of the template version. If committed is set to true, then the template version can no longer be - * updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java deleted file mode 100644 index 960f4782635..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java +++ /dev/null @@ -1,336 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replaceV2Policy options. - */ -public class ReplaceV2PolicyOptions extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - protected String id; - protected String ifMatch; - protected Control control; - protected String type; - protected String description; - protected V2PolicySubject subject; - protected V2PolicyResource resource; - protected String pattern; - protected V2PolicyRule rule; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String ifMatch; - private Control control; - private String type; - private String description; - private V2PolicySubject subject; - private V2PolicyResource resource; - private String pattern; - private V2PolicyRule rule; - - /** - * Instantiates a new Builder from an existing ReplaceV2PolicyOptions instance. - * - * @param replaceV2PolicyOptions the instance to initialize the Builder with - */ - private Builder(ReplaceV2PolicyOptions replaceV2PolicyOptions) { - this.id = replaceV2PolicyOptions.id; - this.ifMatch = replaceV2PolicyOptions.ifMatch; - this.control = replaceV2PolicyOptions.control; - this.type = replaceV2PolicyOptions.type; - this.description = replaceV2PolicyOptions.description; - this.subject = replaceV2PolicyOptions.subject; - this.resource = replaceV2PolicyOptions.resource; - this.pattern = replaceV2PolicyOptions.pattern; - this.rule = replaceV2PolicyOptions.rule; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param id the id - * @param ifMatch the ifMatch - * @param control the control - * @param type the type - */ - public Builder(String id, String ifMatch, Control control, String type) { - this.id = id; - this.ifMatch = ifMatch; - this.control = control; - this.type = type; - } - - /** - * Builds a ReplaceV2PolicyOptions. - * - * @return the new ReplaceV2PolicyOptions instance - */ - public ReplaceV2PolicyOptions build() { - return new ReplaceV2PolicyOptions(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the ReplaceV2PolicyOptions builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplaceV2PolicyOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the control. - * - * @param control the control - * @return the ReplaceV2PolicyOptions builder - */ - public Builder control(Control control) { - this.control = control; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the ReplaceV2PolicyOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplaceV2PolicyOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the subject. - * - * @param subject the subject - * @return the ReplaceV2PolicyOptions builder - */ - public Builder subject(V2PolicySubject subject) { - this.subject = subject; - return this; - } - - /** - * Set the resource. - * - * @param resource the resource - * @return the ReplaceV2PolicyOptions builder - */ - public Builder resource(V2PolicyResource resource) { - this.resource = resource; - return this; - } - - /** - * Set the pattern. - * - * @param pattern the pattern - * @return the ReplaceV2PolicyOptions builder - */ - public Builder pattern(String pattern) { - this.pattern = pattern; - return this; - } - - /** - * Set the rule. - * - * @param rule the rule - * @return the ReplaceV2PolicyOptions builder - */ - public Builder rule(V2PolicyRule rule) { - this.rule = rule; - return this; - } - } - - protected ReplaceV2PolicyOptions() { } - - protected ReplaceV2PolicyOptions(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.control, - "control cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - id = builder.id; - ifMatch = builder.ifMatch; - control = builder.control; - type = builder.type; - description = builder.description; - subject = builder.subject; - resource = builder.resource; - pattern = builder.pattern; - rule = builder.rule; - } - - /** - * New builder. - * - * @return a ReplaceV2PolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be - * retrieved using the GET /v2/policies/{id} API and looking at the ETag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the control. - * - * Specifies the type of access that is granted by the policy. - * - * @return the control - */ - public Control control() { - return control; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject subject() { - return subject; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource resource() { - return resource; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String pattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule rule() { - return rule; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java deleted file mode 100644 index 3a8b7e87b9e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * An attribute associated with a resource. - */ -public class ResourceAttribute extends GenericModel { - - protected String name; - protected String value; - protected String operator; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String value; - private String operator; - - /** - * Instantiates a new Builder from an existing ResourceAttribute instance. - * - * @param resourceAttribute the instance to initialize the Builder with - */ - private Builder(ResourceAttribute resourceAttribute) { - this.name = resourceAttribute.name; - this.value = resourceAttribute.value; - this.operator = resourceAttribute.operator; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param value the value - */ - public Builder(String name, String value) { - this.name = name; - this.value = value; - } - - /** - * Builds a ResourceAttribute. - * - * @return the new ResourceAttribute instance - */ - public ResourceAttribute build() { - return new ResourceAttribute(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the ResourceAttribute builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the ResourceAttribute builder - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the ResourceAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - } - - protected ResourceAttribute() { } - - protected ResourceAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - name = builder.name; - value = builder.value; - operator = builder.operator; - } - - /** - * New builder. - * - * @return a ResourceAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * The name of an attribute. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the value. - * - * The value of an attribute. - * - * @return the value - */ - public String value() { - return value; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java deleted file mode 100644 index 7da4cffee56..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A tag associated with a resource. - */ -public class ResourceTag extends GenericModel { - - protected String name; - protected String value; - protected String operator; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String value; - private String operator; - - /** - * Instantiates a new Builder from an existing ResourceTag instance. - * - * @param resourceTag the instance to initialize the Builder with - */ - private Builder(ResourceTag resourceTag) { - this.name = resourceTag.name; - this.value = resourceTag.value; - this.operator = resourceTag.operator; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param value the value - */ - public Builder(String name, String value) { - this.name = name; - this.value = value; - } - - /** - * Builds a ResourceTag. - * - * @return the new ResourceTag instance - */ - public ResourceTag build() { - return new ResourceTag(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the ResourceTag builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the ResourceTag builder - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the ResourceTag builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - } - - protected ResourceTag() { } - - protected ResourceTag(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - name = builder.name; - value = builder.value; - operator = builder.operator; - } - - /** - * New builder. - * - * @return a ResourceTag builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * The name of an access management tag. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the value. - * - * The value of an access management tag. - * - * @return the value - */ - public String value() { - return value; - } - - /** - * Gets the operator. - * - * The operator of an access management tag. - * - * @return the operator - */ - public String operator() { - return operator; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java deleted file mode 100644 index 24b99c9bd08..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role resource. - */ -public class Role extends GenericModel { - - @SerializedName("display_name") - protected String displayName; - protected String description; - protected List actions; - protected String crn; - - /** - * Builder. - */ - public static class Builder { - private String displayName; - private String description; - private List actions; - - /** - * Instantiates a new Builder from an existing Role instance. - * - * @param role the instance to initialize the Builder with - */ - private Builder(Role role) { - this.displayName = role.displayName; - this.description = role.description; - this.actions = role.actions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param displayName the displayName - * @param actions the actions - */ - public Builder(String displayName, List actions) { - this.displayName = displayName; - this.actions = actions; - } - - /** - * Builds a Role. - * - * @return the new Role instance - */ - public Role build() { - return new Role(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the Role builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the Role builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the Role builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the Role builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - } - - protected Role() { } - - protected Role(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - displayName = builder.displayName; - description = builder.description; - actions = builder.actions; - } - - /** - * New builder. - * - * @return a Role builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List actions() { - return actions; - } - - /** - * Gets the crn. - * - * The role Cloud Resource Name (CRN). Example CRN: - * 'crn:v1:ibmcloud:public:iam-access-management::a/exampleAccountId::customRole:ExampleRoleName'. - * - * @return the crn - */ - public String crn() { - return crn; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java deleted file mode 100644 index 9169fc88572..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * An action that can be performed by the policy subject when assigned a role. - */ -public class RoleAction extends GenericModel { - - protected String id; - @SerializedName("display_name") - protected String displayName; - protected String description; - - protected RoleAction() { } - - /** - * Gets the id. - * - * Unique identifier for action with structure service.resource.action. For example, cbr.rule.read. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the displayName. - * - * Services defined display name for action. - * - * @return the displayName - */ - public String getDisplayName() { - return displayName; - } - - /** - * Gets the description. - * - * Service defined description for action. - * - * @return the description - */ - public String getDescription() { - return description; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java deleted file mode 100644 index 23bb4b65c6f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the assigned role template. - */ -public class RoleAssignment extends GenericModel { - - /** - * The current operation of the role assignment. - */ - public interface Operation { - /** create. */ - String CREATE = "create"; - /** apply. */ - String APPLY = "apply"; - /** update. */ - String UPDATE = "update"; - /** remove. */ - String REMOVE = "remove"; - } - - /** - * The role assignment status. - */ - public interface Status { - /** accepted. */ - String ACCEPTED = "accepted"; - /** failure. */ - String FAILURE = "failure"; - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** superseded. */ - String SUPERSEDED = "superseded"; - } - - protected String id; - @SerializedName("account_id") - protected String accountId; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String operation; - protected List resources; - protected RoleAssignmentTemplate template; - protected AssignmentTargetDetails target; - protected String status; - - protected RoleAssignment() { } - - /** - * Gets the id. - * - * Action control assignment ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the accountId. - * - * The account GUID that the role assignments belong to. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the href. - * - * The href URL that links to the role assignments API by role assignment ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the role assignment was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the role assignment. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the role assignment was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the role assignment. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the operation. - * - * The current operation of the role assignment. - * - * @return the operation - */ - public String getOperation() { - return operation; - } - - /** - * Gets the resources. - * - * Resources created when role template is assigned. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the template. - * - * The role template id and version that will be assigned. - * - * @return the template - */ - public RoleAssignmentTemplate getTemplate() { - return template; - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the status. - * - * The role assignment status. - * - * @return the status - */ - public String getStatus() { - return status; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java deleted file mode 100644 index 658ac5b8c99..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of role assignments. - */ -public class RoleAssignmentCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List assignments; - - protected RoleAssignmentCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the assignments. - * - * List of role assignments. - * - * @return the assignments - */ - public List getAssignments() { - return assignments; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java deleted file mode 100644 index 60d7a02d604..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The role assignment resources and target where the template is assigned. - */ -public class RoleAssignmentResource extends GenericModel { - - protected AssignmentTargetDetails target; - protected RoleAssignmentResourceRole role; - - protected RoleAssignmentResource() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the role. - * - * Set of properties of the assigned resource or error message if assignment failed. - * - * @return the role - */ - public RoleAssignmentResourceRole getRole() { - return role; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java deleted file mode 100644 index 9ea359d63fb..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * On success, it includes the role assigned. - */ -public class RoleAssignmentResourceCreated extends GenericModel { - - protected String id; - - protected RoleAssignmentResourceCreated() { } - - /** - * Gets the id. - * - * role id. - * - * @return the id - */ - public String getId() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java deleted file mode 100644 index 22d40bdaef4..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Set of properties of the assigned resource or error message if assignment failed. - */ -public class RoleAssignmentResourceRole extends GenericModel { - - @SerializedName("resource_created") - protected RoleAssignmentResourceCreated resourceCreated; - @SerializedName("error_message") - protected AssignmentResourceError errorMessage; - - protected RoleAssignmentResourceRole() { } - - /** - * Gets the resourceCreated. - * - * On success, it includes the role assigned. - * - * @return the resourceCreated - */ - public RoleAssignmentResourceCreated getResourceCreated() { - return resourceCreated; - } - - /** - * Gets the errorMessage. - * - * Body parameters for assignment error. - * - * @return the errorMessage - */ - public AssignmentResourceError getErrorMessage() { - return errorMessage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java deleted file mode 100644 index 3524b91f4d5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The role template id and version that will be assigned. - */ -public class RoleAssignmentTemplate extends GenericModel { - - protected String id; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String version; - - /** - * Instantiates a new Builder from an existing RoleAssignmentTemplate instance. - * - * @param roleAssignmentTemplate the instance to initialize the Builder with - */ - private Builder(RoleAssignmentTemplate roleAssignmentTemplate) { - this.id = roleAssignmentTemplate.id; - this.version = roleAssignmentTemplate.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param id the id - * @param version the version - */ - public Builder(String id, String version) { - this.id = id; - this.version = version; - } - - /** - * Builds a RoleAssignmentTemplate. - * - * @return the new RoleAssignmentTemplate instance - */ - public RoleAssignmentTemplate build() { - return new RoleAssignmentTemplate(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the RoleAssignmentTemplate builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the RoleAssignmentTemplate builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected RoleAssignmentTemplate() { } - - protected RoleAssignmentTemplate(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - id = builder.id; - version = builder.version; - } - - /** - * New builder. - * - * @return a RoleAssignmentTemplate builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * Action control template ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java deleted file mode 100644 index 16296a82e40..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * RoleAssignmentsPager can be used to simplify the use of the "listRoleAssignments" method. - */ -public class RoleAssignmentsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListRoleAssignmentsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected RoleAssignmentsPager() { } - - /** - * Constructs a new RoleAssignmentsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listRoleAssignments" method - * @param options the ListRoleAssignmentsOptions instance to be used to invoke the "listRoleAssignments" method - */ - public RoleAssignmentsPager(IamPolicyManagement client, ListRoleAssignmentsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<RoleAssignment> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListRoleAssignmentsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - RoleAssignmentCollection result = client.listRoleAssignments(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getAssignments(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<RoleAssignment> containing all results returned by the "listRoleAssignments" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java deleted file mode 100644 index 282730a2dfc..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of roles returned by the 'list roles' operation. - */ -public class RoleCollection extends GenericModel { - - @SerializedName("custom_roles") - protected List customRoles; - @SerializedName("service_roles") - protected List serviceRoles; - @SerializedName("system_roles") - protected List systemRoles; - - protected RoleCollection() { } - - /** - * Gets the customRoles. - * - * List of custom roles. - * - * @return the customRoles - */ - public List getCustomRoles() { - return customRoles; - } - - /** - * Gets the serviceRoles. - * - * List of service roles. - * - * @return the serviceRoles - */ - public List getServiceRoles() { - return serviceRoles; - } - - /** - * Gets the systemRoles. - * - * List of system roles. - * - * @return the systemRoles - */ - public List getSystemRoles() { - return systemRoles; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java deleted file mode 100644 index 663d0f7f1d0..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the role template. - */ -public class RoleTemplate extends GenericModel { - - /** - * State of role template. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String name; - protected String description; - @SerializedName("account_id") - protected String accountId; - protected Boolean committed; - protected RoleTemplatePrototypeRole role; - protected String id; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String version; - protected String state; - - protected RoleTemplate() { } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the description. - * - * Description of the role template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the role for enterprise users managing IAM templates. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the committed. - * - * Committed status of the template. If committed is set to true, then the template version can no longer be updated. - * - * @return the committed - */ - public Boolean isCommitted() { - return committed; - } - - /** - * Gets the role. - * - * The role properties that are created in an action resource when the template is assigned. - * - * @return the role - */ - public RoleTemplatePrototypeRole getRole() { - return role; - } - - /** - * Gets the id. - * - * The role template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the role templates API by role template ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the role template was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the role template. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the role template was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the role template. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the version. - * - * The version number of the template used to identify different versions of same template. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the state. - * - * State of role template. - * - * @return the state - */ - public String getState() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java deleted file mode 100644 index 22a739b4a58..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of role templates. - */ -public class RoleTemplateCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - @SerializedName("role_templates") - protected List roleTemplates; - - protected RoleTemplateCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the roleTemplates. - * - * List of role templates. - * - * @return the roleTemplates - */ - public List getRoleTemplates() { - return roleTemplates; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java deleted file mode 100644 index 43197620689..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java +++ /dev/null @@ -1,239 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The role properties that are created in an action resource when the template is assigned. - */ -public class RoleTemplatePrototypeRole extends GenericModel { - - protected String name; - @SerializedName("display_name") - protected String displayName; - @SerializedName("service_name") - protected String serviceName; - protected String description; - protected List actions; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String displayName; - private String serviceName; - private String description; - private List actions; - - /** - * Instantiates a new Builder from an existing RoleTemplatePrototypeRole instance. - * - * @param roleTemplatePrototypeRole the instance to initialize the Builder with - */ - private Builder(RoleTemplatePrototypeRole roleTemplatePrototypeRole) { - this.name = roleTemplatePrototypeRole.name; - this.displayName = roleTemplatePrototypeRole.displayName; - this.serviceName = roleTemplatePrototypeRole.serviceName; - this.description = roleTemplatePrototypeRole.description; - this.actions = roleTemplatePrototypeRole.actions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param displayName the displayName - * @param actions the actions - */ - public Builder(String name, String displayName, List actions) { - this.name = name; - this.displayName = displayName; - this.actions = actions; - } - - /** - * Builds a RoleTemplatePrototypeRole. - * - * @return the new RoleTemplatePrototypeRole instance - */ - public RoleTemplatePrototypeRole build() { - return new RoleTemplatePrototypeRole(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the RoleTemplatePrototypeRole builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the RoleTemplatePrototypeRole builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the RoleTemplatePrototypeRole builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the RoleTemplatePrototypeRole builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the RoleTemplatePrototypeRole builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the RoleTemplatePrototypeRole builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - } - - protected RoleTemplatePrototypeRole() { } - - protected RoleTemplatePrototypeRole(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - name = builder.name; - displayName = builder.displayName; - serviceName = builder.serviceName; - description = builder.description; - actions = builder.actions; - } - - /** - * New builder. - * - * @return a RoleTemplatePrototypeRole builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the serviceName. - * - * The service name that the role refers. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the description. - * - * Description of the role. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. - * - * @return the actions - */ - public List actions() { - return actions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java deleted file mode 100644 index 673ff7f9750..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role template reference associated with a policy template. - */ -public class RoleTemplateReferencesItem extends GenericModel { - - protected String id; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String version; - - /** - * Instantiates a new Builder from an existing RoleTemplateReferencesItem instance. - * - * @param roleTemplateReferencesItem the instance to initialize the Builder with - */ - private Builder(RoleTemplateReferencesItem roleTemplateReferencesItem) { - this.id = roleTemplateReferencesItem.id; - this.version = roleTemplateReferencesItem.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param id the id - * @param version the version - */ - public Builder(String id, String version) { - this.id = id; - this.version = version; - } - - /** - * Builds a RoleTemplateReferencesItem. - * - * @return the new RoleTemplateReferencesItem instance - */ - public RoleTemplateReferencesItem build() { - return new RoleTemplateReferencesItem(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the RoleTemplateReferencesItem builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the RoleTemplateReferencesItem builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected RoleTemplateReferencesItem() { } - - protected RoleTemplateReferencesItem(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - id = builder.id; - version = builder.version; - } - - /** - * New builder. - * - * @return a RoleTemplateReferencesItem builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * The role template ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the version. - * - * Role template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java deleted file mode 100644 index a983208afe3..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of versions for a specific role template. - */ -public class RoleTemplateVersionsCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List versions; - - protected RoleTemplateVersionsCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the versions. - * - * List of role templates versions. - * - * @return the versions - */ - public List getVersions() { - return versions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java deleted file mode 100644 index 7af200cd72f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * RoleTemplateVersionsPager can be used to simplify the use of the "listRoleTemplateVersions" method. - */ -public class RoleTemplateVersionsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListRoleTemplateVersionsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected RoleTemplateVersionsPager() { } - - /** - * Constructs a new RoleTemplateVersionsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listRoleTemplateVersions" method - * @param options the ListRoleTemplateVersionsOptions instance to be used to invoke the "listRoleTemplateVersions" method - */ - public RoleTemplateVersionsPager(IamPolicyManagement client, ListRoleTemplateVersionsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<RoleTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListRoleTemplateVersionsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - RoleTemplateVersionsCollection result = client.listRoleTemplateVersions(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getVersions(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<RoleTemplate> containing all results returned by the "listRoleTemplateVersions" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java deleted file mode 100644 index 3654e0757ba..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * RoleTemplatesPager can be used to simplify the use of the "listRoleTemplates" method. - */ -public class RoleTemplatesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListRoleTemplatesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected RoleTemplatesPager() { } - - /** - * Constructs a new RoleTemplatesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listRoleTemplates" method - * @param options the ListRoleTemplatesOptions instance to be used to invoke the "listRoleTemplates" method - */ - public RoleTemplatesPager(IamPolicyManagement client, ListRoleTemplatesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<RoleTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListRoleTemplatesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - RoleTemplateCollection result = client.listRoleTemplates(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getRoleTemplates(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<RoleTemplate> containing all results returned by the "listRoleTemplates" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java deleted file mode 100644 index 03b6ff75eb1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role associated with a policy. - */ -public class Roles extends GenericModel { - - @SerializedName("role_id") - protected String roleId; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - - /** - * Instantiates a new Builder from an existing Roles instance. - * - * @param roles the instance to initialize the Builder with - */ - private Builder(Roles roles) { - this.roleId = roles.roleId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - */ - public Builder(String roleId) { - this.roleId = roleId; - } - - /** - * Builds a Roles. - * - * @return the new Roles instance - */ - public Roles build() { - return new Roles(this); - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the Roles builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - } - - protected Roles() { } - - protected Roles(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleId, - "roleId cannot be null"); - roleId = builder.roleId; - } - - /** - * New builder. - * - * @return a Roles builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java deleted file mode 100644 index fbf66d53ae1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Rule that specifies additional access that is granted (For example, time-based condition). - */ -public class RuleAttribute extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - protected String key; - protected String operator; - protected Object value; - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing RuleAttribute instance. - * - * @param ruleAttribute the instance to initialize the Builder with - */ - private Builder(RuleAttribute ruleAttribute) { - this.key = ruleAttribute.key; - this.operator = ruleAttribute.operator; - this.value = ruleAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a RuleAttribute. - * - * @return the new RuleAttribute instance - */ - public RuleAttribute build() { - return new RuleAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the RuleAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the RuleAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the RuleAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected RuleAttribute() { } - - protected RuleAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a RuleAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the key. - * - * The name of an attribute. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java deleted file mode 100644 index d7e54e112c5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * An attribute associated with a subject. - */ -public class SubjectAttribute extends GenericModel { - - protected String name; - protected String value; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String value; - - /** - * Instantiates a new Builder from an existing SubjectAttribute instance. - * - * @param subjectAttribute the instance to initialize the Builder with - */ - private Builder(SubjectAttribute subjectAttribute) { - this.name = subjectAttribute.name; - this.value = subjectAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param value the value - */ - public Builder(String name, String value) { - this.name = name; - this.value = value; - } - - /** - * Builds a SubjectAttribute. - * - * @return the new SubjectAttribute instance - */ - public SubjectAttribute build() { - return new SubjectAttribute(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the SubjectAttribute builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the SubjectAttribute builder - */ - public Builder value(String value) { - this.value = value; - return this; - } - } - - protected SubjectAttribute() { } - - protected SubjectAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - name = builder.name; - value = builder.value; - } - - /** - * New builder. - * - * @return a SubjectAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * The name of an attribute. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the value. - * - * The value of an attribute. - * - * @return the value - */ - public String value() { - return value; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java deleted file mode 100644 index 62f4bd77f87..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The action control properties that are created in an action resource when the template is assigned. - */ -public class TemplateActionControl extends GenericModel { - - @SerializedName("service_name") - protected String serviceName; - protected String description; - protected List actions; - - /** - * Builder. - */ - public static class Builder { - private String serviceName; - private String description; - private List actions; - - /** - * Instantiates a new Builder from an existing TemplateActionControl instance. - * - * @param templateActionControl the instance to initialize the Builder with - */ - private Builder(TemplateActionControl templateActionControl) { - this.serviceName = templateActionControl.serviceName; - this.description = templateActionControl.description; - this.actions = templateActionControl.actions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param serviceName the serviceName - * @param actions the actions - */ - public Builder(String serviceName, List actions) { - this.serviceName = serviceName; - this.actions = actions; - } - - /** - * Builds a TemplateActionControl. - * - * @return the new TemplateActionControl instance - */ - public TemplateActionControl build() { - return new TemplateActionControl(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the TemplateActionControl builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the TemplateActionControl builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the TemplateActionControl builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the TemplateActionControl builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - } - - protected TemplateActionControl() { } - - protected TemplateActionControl(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, - "serviceName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - serviceName = builder.serviceName; - description = builder.description; - actions = builder.actions; - } - - /** - * New builder. - * - * @return a TemplateActionControl builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the serviceName. - * - * The service name that the action control refers. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the description. - * - * Description of the action control. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actions. - * - * List of actions to control access. - * - * @return the actions - */ - public List actions() { - return actions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java deleted file mode 100644 index c74a77d9b6d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Specifies the type of access that is granted by the policy. - */ -public class TemplateControl extends GenericModel { - - protected TemplateGrant grant; - - /** - * Builder. - */ - public static class Builder { - private TemplateGrant grant; - - /** - * Instantiates a new Builder from an existing TemplateControl instance. - * - * @param templateControl the instance to initialize the Builder with - */ - private Builder(TemplateControl templateControl) { - this.grant = templateControl.grant; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param grant the grant - */ - public Builder(TemplateGrant grant) { - this.grant = grant; - } - - /** - * Builds a TemplateControl. - * - * @return the new TemplateControl instance - */ - public TemplateControl build() { - return new TemplateControl(this); - } - - /** - * Set the grant. - * - * @param grant the grant - * @return the TemplateControl builder - */ - public Builder grant(TemplateGrant grant) { - this.grant = grant; - return this; - } - } - - protected TemplateControl() { } - - protected TemplateControl(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.grant, - "grant cannot be null"); - grant = builder.grant; - } - - /** - * New builder. - * - * @return a TemplateControl builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the grant. - * - * Permission is granted by the policy. - * - * @return the grant - */ - public TemplateGrant grant() { - return grant; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java deleted file mode 100644 index edb134e1270..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * policy template count details. - */ -public class TemplateCountData extends GenericModel { - - protected LimitData template; - protected LimitData version; - - protected TemplateCountData() { } - - /** - * Gets the template. - * - * policy template current and limit details with in an account. - * - * @return the template - */ - public LimitData getTemplate() { - return template; - } - - /** - * Gets the version. - * - * policy template current and limit details with in an account. - * - * @return the version - */ - public LimitData getVersion() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java deleted file mode 100644 index fd0daff9665..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Permission is granted by the policy. - * - * Classes which extend this class: - * - TemplateGrantRoles - * - TemplateGrantRoleReferences - */ -public class TemplateGrant extends GenericModel { - - protected List roles; - @SerializedName("role_template_references") - protected List roleTemplateReferences; - - protected TemplateGrant() { } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List roles() { - return roles; - } - - /** - * Gets the roleTemplateReferences. - * - * A set of role template reference IDs granted by the policy. - * - * @return the roleTemplateReferences - */ - public List roleTemplateReferences() { - return roleTemplateReferences; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java deleted file mode 100644 index 248eb121b72..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * TemplateGrantRoleReferences. - */ -public class TemplateGrantRoleReferences extends TemplateGrant { - - - /** - * Builder. - */ - public static class Builder { - private List roleTemplateReferences; - - /** - * Instantiates a new Builder from an existing TemplateGrantRoleReferences instance. - * - * @param templateGrantRoleReferences the instance to initialize the Builder with - */ - public Builder(TemplateGrant templateGrantRoleReferences) { - this.roleTemplateReferences = templateGrantRoleReferences.roleTemplateReferences; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateReferences the roleTemplateReferences - */ - public Builder(List roleTemplateReferences) { - this.roleTemplateReferences = roleTemplateReferences; - } - - /** - * Builds a TemplateGrantRoleReferences. - * - * @return the new TemplateGrantRoleReferences instance - */ - public TemplateGrantRoleReferences build() { - return new TemplateGrantRoleReferences(this); - } - - /** - * Adds a new element to roleTemplateReferences. - * - * @param roleTemplateReferences the new element to be added - * @return the TemplateGrantRoleReferences builder - */ - public Builder addRoleTemplateReferences(RoleTemplateReferencesItem roleTemplateReferences) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roleTemplateReferences, - "roleTemplateReferences cannot be null"); - if (this.roleTemplateReferences == null) { - this.roleTemplateReferences = new ArrayList(); - } - this.roleTemplateReferences.add(roleTemplateReferences); - return this; - } - - /** - * Set the roleTemplateReferences. - * Existing roleTemplateReferences will be replaced. - * - * @param roleTemplateReferences the roleTemplateReferences - * @return the TemplateGrantRoleReferences builder - */ - public Builder roleTemplateReferences(List roleTemplateReferences) { - this.roleTemplateReferences = roleTemplateReferences; - return this; - } - } - - protected TemplateGrantRoleReferences() { } - - protected TemplateGrantRoleReferences(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleTemplateReferences, - "roleTemplateReferences cannot be null"); - roleTemplateReferences = builder.roleTemplateReferences; - } - - /** - * New builder. - * - * @return a TemplateGrantRoleReferences builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java deleted file mode 100644 index 6524b3645eb..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * TemplateGrantRoles. - */ -public class TemplateGrantRoles extends TemplateGrant { - - - /** - * Builder. - */ - public static class Builder { - private List roles; - - /** - * Instantiates a new Builder from an existing TemplateGrantRoles instance. - * - * @param templateGrantRoles the instance to initialize the Builder with - */ - public Builder(TemplateGrant templateGrantRoles) { - this.roles = templateGrantRoles.roles; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roles the roles - */ - public Builder(List roles) { - this.roles = roles; - } - - /** - * Builds a TemplateGrantRoles. - * - * @return the new TemplateGrantRoles instance - */ - public TemplateGrantRoles build() { - return new TemplateGrantRoles(this); - } - - /** - * Adds a new element to roles. - * - * @param roles the new element to be added - * @return the TemplateGrantRoles builder - */ - public Builder addRoles(Roles roles) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roles, - "roles cannot be null"); - if (this.roles == null) { - this.roles = new ArrayList(); - } - this.roles.add(roles); - return this; - } - - /** - * Set the roles. - * Existing roles will be replaced. - * - * @param roles the roles - * @return the TemplateGrantRoles builder - */ - public Builder roles(List roles) { - this.roles = roles; - return this; - } - } - - protected TemplateGrantRoles() { } - - protected TemplateGrantRoles(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, - "roles cannot be null"); - roles = builder.roles; - } - - /** - * New builder. - * - * @return a TemplateGrantRoles builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java deleted file mode 100644 index 41f112312cd..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The details of the IAM template that was used to create an enterprise-managed policy in your account. When returned, - * this indicates that the policy is created from and managed by a template in the root enterprise account. - */ -public class TemplateMetadata extends GenericModel { - - protected String id; - protected String version; - @SerializedName("assignment_id") - protected String assignmentId; - @SerializedName("root_id") - protected String rootId; - @SerializedName("root_version") - protected String rootVersion; - - protected TemplateMetadata() { } - - /** - * Gets the id. - * - * The policy template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the version. - * - * Template version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the assignmentId. - * - * Policy assignment ID. - * - * @return the assignmentId - */ - public String getAssignmentId() { - return assignmentId; - } - - /** - * Gets the rootId. - * - * Orchestrator template ID. - * - * @return the rootId - */ - public String getRootId() { - return rootId; - } - - /** - * Gets the rootVersion. - * - * Orchestrator template version. - * - * @return the rootVersion - */ - public String getRootVersion() { - return rootVersion; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java deleted file mode 100644 index 496b2e70e40..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java +++ /dev/null @@ -1,272 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the template's policy object. - */ -public class TemplatePolicy extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - protected String type; - protected String description; - protected V2PolicyResource resource; - protected V2PolicySubject subject; - protected String pattern; - protected V2PolicyRule rule; - protected TemplateControl control; - - /** - * Builder. - */ - public static class Builder { - private String type; - private String description; - private V2PolicyResource resource; - private V2PolicySubject subject; - private String pattern; - private V2PolicyRule rule; - private TemplateControl control; - - /** - * Instantiates a new Builder from an existing TemplatePolicy instance. - * - * @param templatePolicy the instance to initialize the Builder with - */ - private Builder(TemplatePolicy templatePolicy) { - this.type = templatePolicy.type; - this.description = templatePolicy.description; - this.resource = templatePolicy.resource; - this.subject = templatePolicy.subject; - this.pattern = templatePolicy.pattern; - this.rule = templatePolicy.rule; - this.control = templatePolicy.control; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param type the type - */ - public Builder(String type) { - this.type = type; - } - - /** - * Builds a TemplatePolicy. - * - * @return the new TemplatePolicy instance - */ - public TemplatePolicy build() { - return new TemplatePolicy(this); - } - - /** - * Set the type. - * - * @param type the type - * @return the TemplatePolicy builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the TemplatePolicy builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the resource. - * - * @param resource the resource - * @return the TemplatePolicy builder - */ - public Builder resource(V2PolicyResource resource) { - this.resource = resource; - return this; - } - - /** - * Set the subject. - * - * @param subject the subject - * @return the TemplatePolicy builder - */ - public Builder subject(V2PolicySubject subject) { - this.subject = subject; - return this; - } - - /** - * Set the pattern. - * - * @param pattern the pattern - * @return the TemplatePolicy builder - */ - public Builder pattern(String pattern) { - this.pattern = pattern; - return this; - } - - /** - * Set the rule. - * - * @param rule the rule - * @return the TemplatePolicy builder - */ - public Builder rule(V2PolicyRule rule) { - this.rule = rule; - return this; - } - - /** - * Set the control. - * - * @param control the control - * @return the TemplatePolicy builder - */ - public Builder control(TemplateControl control) { - this.control = control; - return this; - } - } - - protected TemplatePolicy() { } - - protected TemplatePolicy(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - type = builder.type; - description = builder.description; - resource = builder.resource; - subject = builder.subject; - pattern = builder.pattern; - rule = builder.rule; - control = builder.control; - } - - /** - * New builder. - * - * @return a TemplatePolicy builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. This is shown in child accounts when an access group or trusted profile template uses - * the policy template to assign access. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource resource() { - return resource; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject subject() { - return subject; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String pattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule rule() { - return rule; - } - - /** - * Gets the control. - * - * Specifies the type of access that is granted by the policy. - * - * @return the control - */ - public TemplateControl control() { - return control; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java deleted file mode 100644 index b76beb3bddb..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The role properties that are created in an action resource when the template is assigned. - */ -public class TemplateRole extends GenericModel { - - @SerializedName("display_name") - protected String displayName; - @SerializedName("service_name") - protected String serviceName; - protected String description; - protected List actions; - - /** - * Builder. - */ - public static class Builder { - private String displayName; - private String serviceName; - private String description; - private List actions; - - /** - * Instantiates a new Builder from an existing TemplateRole instance. - * - * @param templateRole the instance to initialize the Builder with - */ - private Builder(TemplateRole templateRole) { - this.displayName = templateRole.displayName; - this.serviceName = templateRole.serviceName; - this.description = templateRole.description; - this.actions = templateRole.actions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param displayName the displayName - * @param actions the actions - */ - public Builder(String displayName, List actions) { - this.displayName = displayName; - this.actions = actions; - } - - /** - * Builds a TemplateRole. - * - * @return the new TemplateRole instance - */ - public TemplateRole build() { - return new TemplateRole(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the TemplateRole builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the TemplateRole builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the TemplateRole builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the TemplateRole builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the TemplateRole builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - } - - protected TemplateRole() { } - - protected TemplateRole(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - displayName = builder.displayName; - serviceName = builder.serviceName; - description = builder.description; - actions = builder.actions; - } - - /** - * New builder. - * - * @return a TemplateRole builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the serviceName. - * - * The service name that the role refers. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the description. - * - * Description of the role. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. - * - * @return the actions - */ - public List actions() { - return actions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java deleted file mode 100644 index caf2f737b55..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updateActionControlAssignment options. - */ -public class UpdateActionControlAssignmentOptions extends GenericModel { - - protected String assignmentId; - protected String ifMatch; - protected String templateVersion; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - private String ifMatch; - private String templateVersion; - - /** - * Instantiates a new Builder from an existing UpdateActionControlAssignmentOptions instance. - * - * @param updateActionControlAssignmentOptions the instance to initialize the Builder with - */ - private Builder(UpdateActionControlAssignmentOptions updateActionControlAssignmentOptions) { - this.assignmentId = updateActionControlAssignmentOptions.assignmentId; - this.ifMatch = updateActionControlAssignmentOptions.ifMatch; - this.templateVersion = updateActionControlAssignmentOptions.templateVersion; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - * @param ifMatch the ifMatch - * @param templateVersion the templateVersion - */ - public Builder(String assignmentId, String ifMatch, String templateVersion) { - this.assignmentId = assignmentId; - this.ifMatch = ifMatch; - this.templateVersion = templateVersion; - } - - /** - * Builds a UpdateActionControlAssignmentOptions. - * - * @return the new UpdateActionControlAssignmentOptions instance - */ - public UpdateActionControlAssignmentOptions build() { - return new UpdateActionControlAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the UpdateActionControlAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdateActionControlAssignmentOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the UpdateActionControlAssignmentOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - } - - protected UpdateActionControlAssignmentOptions() { } - - protected UpdateActionControlAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId 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.templateVersion, - "templateVersion cannot be null"); - assignmentId = builder.assignmentId; - ifMatch = builder.ifMatch; - templateVersion = builder.templateVersion; - } - - /** - * New builder. - * - * @return a UpdateActionControlAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Action control template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating an action control assignment and must match the Etag value of the existing action - * control assignment. The Etag can be retrieved using the GET /v1/action_control_assignments/{assignment_id} API and - * looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the templateVersion. - * - * The version number of the template used to identify different versions of same template. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java deleted file mode 100644 index 869eb357802..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updatePolicyAssignment options. - */ -public class UpdatePolicyAssignmentOptions extends GenericModel { - - protected String assignmentId; - protected String version; - protected String ifMatch; - protected String templateVersion; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - private String version; - private String ifMatch; - private String templateVersion; - - /** - * Instantiates a new Builder from an existing UpdatePolicyAssignmentOptions instance. - * - * @param updatePolicyAssignmentOptions the instance to initialize the Builder with - */ - private Builder(UpdatePolicyAssignmentOptions updatePolicyAssignmentOptions) { - this.assignmentId = updatePolicyAssignmentOptions.assignmentId; - this.version = updatePolicyAssignmentOptions.version; - this.ifMatch = updatePolicyAssignmentOptions.ifMatch; - this.templateVersion = updatePolicyAssignmentOptions.templateVersion; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - * @param version the version - * @param ifMatch the ifMatch - * @param templateVersion the templateVersion - */ - public Builder(String assignmentId, String version, String ifMatch, String templateVersion) { - this.assignmentId = assignmentId; - this.version = version; - this.ifMatch = ifMatch; - this.templateVersion = templateVersion; - } - - /** - * Builds a UpdatePolicyAssignmentOptions. - * - * @return the new UpdatePolicyAssignmentOptions instance - */ - public UpdatePolicyAssignmentOptions build() { - return new UpdatePolicyAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the UpdatePolicyAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the UpdatePolicyAssignmentOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdatePolicyAssignmentOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the UpdatePolicyAssignmentOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - } - - protected UpdatePolicyAssignmentOptions() { } - - protected UpdatePolicyAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templateVersion, - "templateVersion cannot be null"); - assignmentId = builder.assignmentId; - version = builder.version; - ifMatch = builder.ifMatch; - templateVersion = builder.templateVersion; - } - - /** - * New builder. - * - * @return a UpdatePolicyAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * The policy template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } - - /** - * Gets the version. - * - * specify version of response body format. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy assignment and must match the Etag value of the existing policy - * assignment. The Etag can be retrieved using the GET /v1/policy_assignments/{assignment_id} API and looking at the - * Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the templateVersion. - * - * The policy template version to update to. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java deleted file mode 100644 index a28b357641f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updatePolicyState options. - */ -public class UpdatePolicyStateOptions extends GenericModel { - - /** - * The policy state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String policyId; - protected String ifMatch; - protected String state; - - /** - * Builder. - */ - public static class Builder { - private String policyId; - private String ifMatch; - private String state; - - /** - * Instantiates a new Builder from an existing UpdatePolicyStateOptions instance. - * - * @param updatePolicyStateOptions the instance to initialize the Builder with - */ - private Builder(UpdatePolicyStateOptions updatePolicyStateOptions) { - this.policyId = updatePolicyStateOptions.policyId; - this.ifMatch = updatePolicyStateOptions.ifMatch; - this.state = updatePolicyStateOptions.state; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyId the policyId - * @param ifMatch the ifMatch - */ - public Builder(String policyId, String ifMatch) { - this.policyId = policyId; - this.ifMatch = ifMatch; - } - - /** - * Builds a UpdatePolicyStateOptions. - * - * @return the new UpdatePolicyStateOptions instance - */ - public UpdatePolicyStateOptions build() { - return new UpdatePolicyStateOptions(this); - } - - /** - * Set the policyId. - * - * @param policyId the policyId - * @return the UpdatePolicyStateOptions builder - */ - public Builder policyId(String policyId) { - this.policyId = policyId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdatePolicyStateOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the UpdatePolicyStateOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - } - - protected UpdatePolicyStateOptions() { } - - protected UpdatePolicyStateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, - "policyId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - policyId = builder.policyId; - ifMatch = builder.ifMatch; - state = builder.state; - } - - /** - * New builder. - * - * @return a UpdatePolicyStateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyId. - * - * The policy ID. - * - * @return the policyId - */ - public String policyId() { - return policyId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be - * retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the state. - * - * The policy state. - * - * @return the state - */ - public String state() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java deleted file mode 100644 index f10cba5fe93..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updateRoleAssignment options. - */ -public class UpdateRoleAssignmentOptions extends GenericModel { - - protected String assignmentId; - protected String ifMatch; - protected String templateVersion; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - private String ifMatch; - private String templateVersion; - - /** - * Instantiates a new Builder from an existing UpdateRoleAssignmentOptions instance. - * - * @param updateRoleAssignmentOptions the instance to initialize the Builder with - */ - private Builder(UpdateRoleAssignmentOptions updateRoleAssignmentOptions) { - this.assignmentId = updateRoleAssignmentOptions.assignmentId; - this.ifMatch = updateRoleAssignmentOptions.ifMatch; - this.templateVersion = updateRoleAssignmentOptions.templateVersion; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - * @param ifMatch the ifMatch - * @param templateVersion the templateVersion - */ - public Builder(String assignmentId, String ifMatch, String templateVersion) { - this.assignmentId = assignmentId; - this.ifMatch = ifMatch; - this.templateVersion = templateVersion; - } - - /** - * Builds a UpdateRoleAssignmentOptions. - * - * @return the new UpdateRoleAssignmentOptions instance - */ - public UpdateRoleAssignmentOptions build() { - return new UpdateRoleAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the UpdateRoleAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdateRoleAssignmentOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the UpdateRoleAssignmentOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - } - - protected UpdateRoleAssignmentOptions() { } - - protected UpdateRoleAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId 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.templateVersion, - "templateVersion cannot be null"); - assignmentId = builder.assignmentId; - ifMatch = builder.ifMatch; - templateVersion = builder.templateVersion; - } - - /** - * New builder. - * - * @return a UpdateRoleAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Role template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a role assignment and must match the Etag value of the existing role assignment. - * The Etag can be retrieved using the GET /v1/role_assignments/{assignment_id} API and looking at the Etag response - * header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the templateVersion. - * - * The version number of the template used to identify different versions of same template. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java deleted file mode 100644 index 3d9dbb43fb3..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updateSettings options. - */ -public class UpdateSettingsOptions extends GenericModel { - - protected String accountId; - protected String ifMatch; - protected ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String ifMatch; - private ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing UpdateSettingsOptions instance. - * - * @param updateSettingsOptions the instance to initialize the Builder with - */ - private Builder(UpdateSettingsOptions updateSettingsOptions) { - this.accountId = updateSettingsOptions.accountId; - this.ifMatch = updateSettingsOptions.ifMatch; - this.externalAccountIdentityInteraction = updateSettingsOptions.externalAccountIdentityInteraction; - this.acceptLanguage = updateSettingsOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - * @param ifMatch the ifMatch - */ - public Builder(String accountId, String ifMatch) { - this.accountId = accountId; - this.ifMatch = ifMatch; - } - - /** - * Builds a UpdateSettingsOptions. - * - * @return the new UpdateSettingsOptions instance - */ - public UpdateSettingsOptions build() { - return new UpdateSettingsOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the UpdateSettingsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdateSettingsOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the externalAccountIdentityInteraction. - * - * @param externalAccountIdentityInteraction the externalAccountIdentityInteraction - * @return the UpdateSettingsOptions builder - */ - public Builder externalAccountIdentityInteraction(ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction) { - this.externalAccountIdentityInteraction = externalAccountIdentityInteraction; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the UpdateSettingsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected UpdateSettingsOptions() { } - - protected UpdateSettingsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.accountId, - "accountId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - accountId = builder.accountId; - ifMatch = builder.ifMatch; - externalAccountIdentityInteraction = builder.externalAccountIdentityInteraction; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a UpdateSettingsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the settings belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating Access Management Account Settings and must match the Etag value of the existing - * Access Management Account Settings. The Etag can be retrieved using the GET - * /v1/accounts/{account_id}/settings/access_management API and looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the externalAccountIdentityInteraction. - * - * Update to how external accounts can interact in relation to the requested account. - * - * @return the externalAccountIdentityInteraction - */ - public ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction() { - return externalAccountIdentityInteraction; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java deleted file mode 100644 index fdae9e28c12..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * V2PoliciesPager can be used to simplify the use of the "listV2Policies" method. - */ -public class V2PoliciesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListV2PoliciesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected V2PoliciesPager() { } - - /** - * Constructs a new V2PoliciesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listV2Policies" method - * @param options the ListV2PoliciesOptions instance to be used to invoke the "listV2Policies" method - */ - public V2PoliciesPager(IamPolicyManagement client, ListV2PoliciesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<V2PolicyTemplateMetaData> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListV2PoliciesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - V2PolicyCollection result = client.listV2Policies(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getPolicies(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<V2PolicyTemplateMetaData> containing all results returned by the "listV2Policies" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java deleted file mode 100644 index 842a354b7b1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java +++ /dev/null @@ -1,247 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the policy. - */ -public class V2Policy extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - /** - * The policy state, either 'deleted' or 'active'. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String type; - protected String description; - protected V2PolicySubject subject; - protected V2PolicyResource resource; - protected String pattern; - protected V2PolicyRule rule; - protected String id; - protected String href; - protected ControlResponse control; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String state; - @SerializedName("last_permit_at") - protected String lastPermitAt; - @SerializedName("last_permit_frequency") - protected Long lastPermitFrequency; - - protected V2Policy() { } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject getSubject() { - return subject; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource getResource() { - return resource; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String getPattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule getRule() { - return rule; - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the policies API by policy ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the control. - * - * @return the control - */ - public ControlResponse getControl() { - return control; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the state. - * - * The policy state, either 'deleted' or 'active'. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the lastPermitAt. - * - * The optional last permit time of policy, when passing query parameter format=include_last_permit. - * - * @return the lastPermitAt - */ - public String getLastPermitAt() { - return lastPermitAt; - } - - /** - * Gets the lastPermitFrequency. - * - * The optional count of times that policy has provided a permit, when passing query parameter - * format=include_last_permit. - * - * @return the lastPermitFrequency - */ - public Long getLastPermitFrequency() { - return lastPermitFrequency; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java deleted file mode 100644 index d392025f8d8..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of policies. - */ -public class V2PolicyCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List policies; - - protected V2PolicyCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the policies. - * - * List of policies. - * - * @return the policies - */ - public List getPolicies() { - return policies; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java deleted file mode 100644 index caf8dd522a9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The resource attributes to which the policy grants access. - */ -public class V2PolicyResource extends GenericModel { - - protected List attributes; - protected List tags; - - /** - * Builder. - */ - public static class Builder { - private List attributes; - private List tags; - - /** - * Instantiates a new Builder from an existing V2PolicyResource instance. - * - * @param v2PolicyResource the instance to initialize the Builder with - */ - private Builder(V2PolicyResource v2PolicyResource) { - this.attributes = v2PolicyResource.attributes; - this.tags = v2PolicyResource.tags; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param attributes the attributes - */ - public Builder(List attributes) { - this.attributes = attributes; - } - - /** - * Builds a V2PolicyResource. - * - * @return the new V2PolicyResource instance - */ - public V2PolicyResource build() { - return new V2PolicyResource(this); - } - - /** - * Adds a new element to attributes. - * - * @param attributes the new element to be added - * @return the V2PolicyResource builder - */ - public Builder addAttributes(V2PolicyResourceAttribute attributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, - "attributes cannot be null"); - if (this.attributes == null) { - this.attributes = new ArrayList(); - } - this.attributes.add(attributes); - return this; - } - - /** - * Adds a new element to tags. - * - * @param tags the new element to be added - * @return the V2PolicyResource builder - */ - public Builder addTags(V2PolicyResourceTag tags) { - com.ibm.cloud.sdk.core.util.Validator.notNull(tags, - "tags cannot be null"); - if (this.tags == null) { - this.tags = new ArrayList(); - } - this.tags.add(tags); - return this; - } - - /** - * Set the attributes. - * Existing attributes will be replaced. - * - * @param attributes the attributes - * @return the V2PolicyResource builder - */ - public Builder attributes(List attributes) { - this.attributes = attributes; - return this; - } - - /** - * Set the tags. - * Existing tags will be replaced. - * - * @param tags the tags - * @return the V2PolicyResource builder - */ - public Builder tags(List tags) { - this.tags = tags; - return this; - } - } - - protected V2PolicyResource() { } - - protected V2PolicyResource(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, - "attributes cannot be null"); - attributes = builder.attributes; - tags = builder.tags; - } - - /** - * New builder. - * - * @return a V2PolicyResource builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the attributes. - * - * List of resource attributes to which the policy grants access. - * - * @return the attributes - */ - public List attributes() { - return attributes; - } - - /** - * Gets the tags. - * - * Optional list of resource tags to which the policy grants access. - * - * @return the tags - */ - public List tags() { - return tags; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java deleted file mode 100644 index 73e7cedd55e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Resource attribute to which the policy grants access. - */ -public class V2PolicyResourceAttribute extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - } - - protected String key; - protected String operator; - protected Object value; - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing V2PolicyResourceAttribute instance. - * - * @param v2PolicyResourceAttribute the instance to initialize the Builder with - */ - private Builder(V2PolicyResourceAttribute v2PolicyResourceAttribute) { - this.key = v2PolicyResourceAttribute.key; - this.operator = v2PolicyResourceAttribute.operator; - this.value = v2PolicyResourceAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a V2PolicyResourceAttribute. - * - * @return the new V2PolicyResourceAttribute instance - */ - public V2PolicyResourceAttribute build() { - return new V2PolicyResourceAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the V2PolicyResourceAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicyResourceAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the V2PolicyResourceAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected V2PolicyResourceAttribute() { } - - protected V2PolicyResourceAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a V2PolicyResourceAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the key. - * - * The name of a resource attribute. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java deleted file mode 100644 index bb32772b8dc..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A tag associated with a resource. - */ -public class V2PolicyResourceTag extends GenericModel { - - /** - * The operator of an access management tag. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - } - - protected String key; - protected String value; - protected String operator; - - /** - * Builder. - */ - public static class Builder { - private String key; - private String value; - private String operator; - - /** - * Instantiates a new Builder from an existing V2PolicyResourceTag instance. - * - * @param v2PolicyResourceTag the instance to initialize the Builder with - */ - private Builder(V2PolicyResourceTag v2PolicyResourceTag) { - this.key = v2PolicyResourceTag.key; - this.value = v2PolicyResourceTag.value; - this.operator = v2PolicyResourceTag.operator; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param value the value - * @param operator the operator - */ - public Builder(String key, String value, String operator) { - this.key = key; - this.value = value; - this.operator = operator; - } - - /** - * Builds a V2PolicyResourceTag. - * - * @return the new V2PolicyResourceTag instance - */ - public V2PolicyResourceTag build() { - return new V2PolicyResourceTag(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the V2PolicyResourceTag builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the V2PolicyResourceTag builder - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicyResourceTag builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - } - - protected V2PolicyResourceTag() { } - - protected V2PolicyResourceTag(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - key = builder.key; - value = builder.value; - operator = builder.operator; - } - - /** - * New builder. - * - * @return a V2PolicyResourceTag builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the key. - * - * The name of an access management tag. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the value. - * - * The value of an access management tag. - * - * @return the value - */ - public String value() { - return value; - } - - /** - * Gets the operator. - * - * The operator of an access management tag. - * - * @return the operator - */ - public String operator() { - return operator; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java deleted file mode 100644 index 13a9f5fbd94..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Additional access conditions associated with the policy. - * - * Classes which extend this class: - * - V2PolicyRuleRuleAttribute - * - V2PolicyRuleRuleWithNestedConditions - */ -public class V2PolicyRule extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - protected String key; - protected String operator; - protected Object value; - protected List conditions; - - protected V2PolicyRule() { } - - /** - * Gets the key. - * - * The name of an attribute. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } - - /** - * Gets the conditions. - * - * List of conditions associated with a policy. For example, time-based conditions that grant access over a certain - * time period. - * - * @return the conditions - */ - public List conditions() { - return conditions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java deleted file mode 100644 index c20b3a8cb0c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * Rule that specifies additional access that is granted (For example, time-based condition). - */ -public class V2PolicyRuleRuleAttribute extends V2PolicyRule { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing V2PolicyRuleRuleAttribute instance. - * - * @param v2PolicyRuleRuleAttribute the instance to initialize the Builder with - */ - public Builder(V2PolicyRule v2PolicyRuleRuleAttribute) { - this.key = v2PolicyRuleRuleAttribute.key; - this.operator = v2PolicyRuleRuleAttribute.operator; - this.value = v2PolicyRuleRuleAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a V2PolicyRuleRuleAttribute. - * - * @return the new V2PolicyRuleRuleAttribute instance - */ - public V2PolicyRuleRuleAttribute build() { - return new V2PolicyRuleRuleAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the V2PolicyRuleRuleAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicyRuleRuleAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the V2PolicyRuleRuleAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected V2PolicyRuleRuleAttribute() { } - - protected V2PolicyRuleRuleAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a V2PolicyRuleRuleAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java deleted file mode 100644 index 8d6e57920f9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * Rule that specifies additional access that is granted (for example, time-based condition) accross multiple - * conditions. - */ -public class V2PolicyRuleRuleWithNestedConditions extends V2PolicyRule { - - /** - * Operator to evaluate conditions. - */ - public interface Operator { - /** and. */ - String AND = "and"; - /** or. */ - String OR = "or"; - } - - - /** - * Builder. - */ - public static class Builder { - private String operator; - private List conditions; - - /** - * Instantiates a new Builder from an existing V2PolicyRuleRuleWithNestedConditions instance. - * - * @param v2PolicyRuleRuleWithNestedConditions the instance to initialize the Builder with - */ - public Builder(V2PolicyRule v2PolicyRuleRuleWithNestedConditions) { - this.operator = v2PolicyRuleRuleWithNestedConditions.operator; - this.conditions = v2PolicyRuleRuleWithNestedConditions.conditions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param operator the operator - * @param conditions the conditions - */ - public Builder(String operator, List conditions) { - this.operator = operator; - this.conditions = conditions; - } - - /** - * Builds a V2PolicyRuleRuleWithNestedConditions. - * - * @return the new V2PolicyRuleRuleWithNestedConditions instance - */ - public V2PolicyRuleRuleWithNestedConditions build() { - return new V2PolicyRuleRuleWithNestedConditions(this); - } - - /** - * Adds a new element to conditions. - * - * @param conditions the new element to be added - * @return the V2PolicyRuleRuleWithNestedConditions builder - */ - public Builder addConditions(NestedCondition conditions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(conditions, - "conditions cannot be null"); - if (this.conditions == null) { - this.conditions = new ArrayList(); - } - this.conditions.add(conditions); - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicyRuleRuleWithNestedConditions builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the conditions. - * Existing conditions will be replaced. - * - * @param conditions the conditions - * @return the V2PolicyRuleRuleWithNestedConditions builder - */ - public Builder conditions(List conditions) { - this.conditions = conditions; - return this; - } - } - - protected V2PolicyRuleRuleWithNestedConditions() { } - - protected V2PolicyRuleRuleWithNestedConditions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.conditions, - "conditions cannot be null"); - operator = builder.operator; - conditions = builder.conditions; - } - - /** - * New builder. - * - * @return a V2PolicyRuleRuleWithNestedConditions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java deleted file mode 100644 index 891513fd45a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The subject attributes for whom the policy grants access. - */ -public class V2PolicySubject extends GenericModel { - - protected List attributes; - - /** - * Builder. - */ - public static class Builder { - private List attributes; - - /** - * Instantiates a new Builder from an existing V2PolicySubject instance. - * - * @param v2PolicySubject the instance to initialize the Builder with - */ - private Builder(V2PolicySubject v2PolicySubject) { - this.attributes = v2PolicySubject.attributes; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param attributes the attributes - */ - public Builder(List attributes) { - this.attributes = attributes; - } - - /** - * Builds a V2PolicySubject. - * - * @return the new V2PolicySubject instance - */ - public V2PolicySubject build() { - return new V2PolicySubject(this); - } - - /** - * Adds a new element to attributes. - * - * @param attributes the new element to be added - * @return the V2PolicySubject builder - */ - public Builder addAttributes(V2PolicySubjectAttribute attributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, - "attributes cannot be null"); - if (this.attributes == null) { - this.attributes = new ArrayList(); - } - this.attributes.add(attributes); - return this; - } - - /** - * Set the attributes. - * Existing attributes will be replaced. - * - * @param attributes the attributes - * @return the V2PolicySubject builder - */ - public Builder attributes(List attributes) { - this.attributes = attributes; - return this; - } - } - - protected V2PolicySubject() { } - - protected V2PolicySubject(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, - "attributes cannot be null"); - attributes = builder.attributes; - } - - /** - * New builder. - * - * @return a V2PolicySubject builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the attributes. - * - * List of subject attributes associated with policy. - * - * @return the attributes - */ - public List attributes() { - return attributes; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java deleted file mode 100644 index c90606429df..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Subject attribute for whom the policy grants access. - */ -public class V2PolicySubjectAttribute extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - } - - protected String key; - protected String operator; - protected Object value; - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing V2PolicySubjectAttribute instance. - * - * @param v2PolicySubjectAttribute the instance to initialize the Builder with - */ - private Builder(V2PolicySubjectAttribute v2PolicySubjectAttribute) { - this.key = v2PolicySubjectAttribute.key; - this.operator = v2PolicySubjectAttribute.operator; - this.value = v2PolicySubjectAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a V2PolicySubjectAttribute. - * - * @return the new V2PolicySubjectAttribute instance - */ - public V2PolicySubjectAttribute build() { - return new V2PolicySubjectAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the V2PolicySubjectAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicySubjectAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the V2PolicySubjectAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected V2PolicySubjectAttribute() { } - - protected V2PolicySubjectAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a V2PolicySubjectAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the key. - * - * The name of a subject attribute. For example, iam_id, access_group_id. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java deleted file mode 100644 index 720f7b57d4e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the policy. - */ -public class V2PolicyTemplateMetaData extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - /** - * The policy state, either 'deleted' or 'active'. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String type; - protected String description; - protected V2PolicySubject subject; - protected V2PolicyResource resource; - protected String pattern; - protected V2PolicyRule rule; - protected String id; - protected String href; - protected ControlResponse control; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String state; - @SerializedName("last_permit_at") - protected String lastPermitAt; - @SerializedName("last_permit_frequency") - protected Long lastPermitFrequency; - protected TemplateMetadata template; - - protected V2PolicyTemplateMetaData() { } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject getSubject() { - return subject; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource getResource() { - return resource; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String getPattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule getRule() { - return rule; - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the policies API by policy ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the control. - * - * @return the control - */ - public ControlResponse getControl() { - return control; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the state. - * - * The policy state, either 'deleted' or 'active'. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the lastPermitAt. - * - * The optional last permit time of policy, when passing query parameter format=include_last_permit. - * - * @return the lastPermitAt - */ - public String getLastPermitAt() { - return lastPermitAt; - } - - /** - * Gets the lastPermitFrequency. - * - * The optional count of times that policy has provided a permit, when passing query parameter - * format=include_last_permit. - * - * @return the lastPermitFrequency - */ - public Long getLastPermitFrequency() { - return lastPermitFrequency; - } - - /** - * Gets the template. - * - * The details of the IAM template that was used to create an enterprise-managed policy in your account. When - * returned, this indicates that the policy is created from and managed by a template in the root enterprise account. - * - * @return the template - */ - public TemplateMetadata getTemplate() { - return template; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java deleted file mode 100644 index 63a87389391..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * (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. - */ - -/** - * IAM Policy Management v1. - */ -package com.ibm.cloud.platform_services.iam_policy_management.v1; diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java deleted file mode 100644 index b38933306a6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java +++ /dev/null @@ -1,5007 +0,0 @@ -/* - * (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_policy_management.v1; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplatesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponse; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControlWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedCondition; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleWithConditions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PoliciesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplatesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoleReferences; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PoliciesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRule; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleWithNestedConditions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.utils.TestUtilities; -import com.ibm.cloud.sdk.core.http.Response; -import com.ibm.cloud.sdk.core.security.Authenticator; -import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import okhttp3.mockwebserver.MockResponse; -import okhttp3.mockwebserver.MockWebServer; -import okhttp3.mockwebserver.RecordedRequest; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; -import static org.testng.Assert.*; - -/** - * Unit test class for the IamPolicyManagement service. - */ -public class IamPolicyManagementTest { - - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - protected MockWebServer server; - protected IamPolicyManagement iamPolicyManagementService; - - // Construct the service with a null authenticator (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testConstructorWithNullAuthenticator() throws Throwable { - final String serviceName = "testService"; - new IamPolicyManagement(serviceName, null); - } - - // Test the listPolicies operation with a valid options model parameter - @Test - public void testListPoliciesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policies\": [{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}]}"; - String listPoliciesPath = "/v1/policies"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListPoliciesOptions model - ListPoliciesOptions listPoliciesOptionsModel = new ListPoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .tagName("testString") - .tagValue("testString") - .sort("id") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listPolicies() with a valid options model and verify the result - Response response = iamPolicyManagementService.listPolicies(listPoliciesOptionsModel).execute(); - assertNotNull(response); - PolicyCollection 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, listPoliciesPath); - // 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("access_group_id"), "testString"); - assertEquals(query.get("type"), "access"); - assertEquals(query.get("service_type"), "service"); - assertEquals(query.get("tag_name"), "testString"); - assertEquals(query.get("tag_value"), "testString"); - assertEquals(query.get("sort"), "id"); - assertEquals(query.get("format"), "include_last_permit"); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listPolicies operation with and without retries enabled - @Test - public void testListPoliciesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListPoliciesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListPoliciesWOptions(); - } - - // Test the listPolicies operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPoliciesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listPolicies(null).execute(); - } - - // Test the listPolicies operation using the PoliciesPager.getNext() method - @Test - public void testListPoliciesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPoliciesOptions listPoliciesOptions = new ListPoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .tagName("testString") - .tagValue("testString") - .sort("id") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - PoliciesPager pager = new PoliciesPager(iamPolicyManagementService, listPoliciesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listPolicies operation using the PoliciesPager.getAll() method - @Test - public void testListPoliciesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPoliciesOptions listPoliciesOptions = new ListPoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .tagName("testString") - .tagValue("testString") - .sort("id") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - PoliciesPager pager = new PoliciesPager(iamPolicyManagementService, listPoliciesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createPolicy operation with a valid options model parameter - @Test - public void testCreatePolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; - String createPolicyPath = "/v1/policies"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the SubjectAttribute model - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - - // Construct an instance of the PolicySubject model - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - - // Construct an instance of the PolicyRole model - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the ResourceAttribute model - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - - // Construct an instance of the ResourceTag model - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - - // Construct an instance of the PolicyResource model - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - - // Construct an instance of the CreatePolicyOptions model - CreatePolicyOptions createPolicyOptionsModel = new CreatePolicyOptions.Builder() - .type("testString") - .subjects(java.util.Arrays.asList(policySubjectModel)) - .roles(java.util.Arrays.asList(policyRoleModel)) - .resources(java.util.Arrays.asList(policyResourceModel)) - .description("testString") - .acceptLanguage("default") - .build(); - - // Invoke createPolicy() with a valid options model and verify the result - Response response = iamPolicyManagementService.createPolicy(createPolicyOptionsModel).execute(); - assertNotNull(response); - Policy 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createPolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createPolicy operation with and without retries enabled - @Test - public void testCreatePolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreatePolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreatePolicyWOptions(); - } - - // Test the createPolicy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createPolicy(null).execute(); - } - - // Test the replacePolicy operation with a valid options model parameter - @Test - public void testReplacePolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; - String replacePolicyPath = "/v1/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the SubjectAttribute model - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - - // Construct an instance of the PolicySubject model - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - - // Construct an instance of the PolicyRole model - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the ResourceAttribute model - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - - // Construct an instance of the ResourceTag model - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - - // Construct an instance of the PolicyResource model - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - - // Construct an instance of the ReplacePolicyOptions model - ReplacePolicyOptions replacePolicyOptionsModel = new ReplacePolicyOptions.Builder() - .policyId("testString") - .ifMatch("testString") - .type("testString") - .subjects(java.util.Arrays.asList(policySubjectModel)) - .roles(java.util.Arrays.asList(policyRoleModel)) - .resources(java.util.Arrays.asList(policyResourceModel)) - .description("testString") - .build(); - - // Invoke replacePolicy() with a valid options model and verify the result - Response response = iamPolicyManagementService.replacePolicy(replacePolicyOptionsModel).execute(); - assertNotNull(response); - Policy 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, replacePolicyPath); - // 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 replacePolicy operation with and without retries enabled - @Test - public void testReplacePolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplacePolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplacePolicyWOptions(); - } - - // Test the replacePolicy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplacePolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replacePolicy(null).execute(); - } - - // Test the getPolicy operation with a valid options model parameter - @Test - public void testGetPolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}"; - String getPolicyPath = "/v1/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetPolicyOptions model - GetPolicyOptions getPolicyOptionsModel = new GetPolicyOptions.Builder() - .policyId("testString") - .build(); - - // Invoke getPolicy() with a valid options model and verify the result - Response response = iamPolicyManagementService.getPolicy(getPolicyOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateMetaData 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, getPolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getPolicy operation with and without retries enabled - @Test - public void testGetPolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetPolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetPolicyWOptions(); - } - - // Test the getPolicy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getPolicy(null).execute(); - } - - // Test the deletePolicy operation with a valid options model parameter - @Test - public void testDeletePolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deletePolicyPath = "/v1/policies/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeletePolicyOptions model - DeletePolicyOptions deletePolicyOptionsModel = new DeletePolicyOptions.Builder() - .policyId("testString") - .build(); - - // Invoke deletePolicy() with a valid options model and verify the result - Response response = iamPolicyManagementService.deletePolicy(deletePolicyOptionsModel).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, deletePolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deletePolicy operation with and without retries enabled - @Test - public void testDeletePolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeletePolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeletePolicyWOptions(); - } - - // Test the deletePolicy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deletePolicy(null).execute(); - } - - // Test the updatePolicyState operation with a valid options model parameter - @Test - public void testUpdatePolicyStateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; - String updatePolicyStatePath = "/v1/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdatePolicyStateOptions model - UpdatePolicyStateOptions updatePolicyStateOptionsModel = new UpdatePolicyStateOptions.Builder() - .policyId("testString") - .ifMatch("testString") - .state("active") - .build(); - - // Invoke updatePolicyState() with a valid options model and verify the result - Response response = iamPolicyManagementService.updatePolicyState(updatePolicyStateOptionsModel).execute(); - assertNotNull(response); - Policy 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updatePolicyStatePath); - // 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 updatePolicyState operation with and without retries enabled - @Test - public void testUpdatePolicyStateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdatePolicyStateWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdatePolicyStateWOptions(); - } - - // Test the updatePolicyState operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdatePolicyStateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updatePolicyState(null).execute(); - } - - // Test the listRoles operation with a valid options model parameter - @Test - public void testListRolesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"custom_roles\": [{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}], \"service_roles\": [{\"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\"}], \"system_roles\": [{\"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\"}]}"; - String listRolesPath = "/v2/roles"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListRolesOptions model - ListRolesOptions listRolesOptionsModel = new ListRolesOptions.Builder() - .acceptLanguage("default") - .accountId("testString") - .serviceName("iam-groups") - .sourceServiceName("iam-groups") - .policyType("authorization") - .serviceGroupId("IAM") - .build(); - - // Invoke listRoles() with a valid options model and verify the result - Response response = iamPolicyManagementService.listRoles(listRolesOptionsModel).execute(); - assertNotNull(response); - RoleCollection 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, listRolesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("service_name"), "iam-groups"); - assertEquals(query.get("source_service_name"), "iam-groups"); - assertEquals(query.get("policy_type"), "authorization"); - assertEquals(query.get("service_group_id"), "IAM"); - } - - // Test the listRoles operation with and without retries enabled - @Test - public void testListRolesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListRolesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListRolesWOptions(); - } - - // Test the createRole operation with a valid options model parameter - @Test - public void testCreateRoleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; - String createRolePath = "/v2/roles"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the CreateRoleOptions model - CreateRoleOptions createRoleOptionsModel = new CreateRoleOptions.Builder() - .displayName("testString") - .actions(java.util.Arrays.asList("testString")) - .name("Developer") - .accountId("testString") - .serviceName("iam-groups") - .description("testString") - .acceptLanguage("default") - .build(); - - // Invoke createRole() with a valid options model and verify the result - Response response = iamPolicyManagementService.createRole(createRoleOptionsModel).execute(); - assertNotNull(response); - CustomRole 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createRolePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createRole operation with and without retries enabled - @Test - public void testCreateRoleWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateRoleWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateRoleWOptions(); - } - - // Test the createRole operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createRole(null).execute(); - } - - // Test the replaceRole operation with a valid options model parameter - @Test - public void testReplaceRoleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; - String replaceRolePath = "/v2/roles/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ReplaceRoleOptions model - ReplaceRoleOptions replaceRoleOptionsModel = new ReplaceRoleOptions.Builder() - .roleId("testString") - .ifMatch("testString") - .displayName("testString") - .actions(java.util.Arrays.asList("testString")) - .description("testString") - .build(); - - // Invoke replaceRole() with a valid options model and verify the result - Response response = iamPolicyManagementService.replaceRole(replaceRoleOptionsModel).execute(); - assertNotNull(response); - CustomRole 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, replaceRolePath); - // 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 replaceRole operation with and without retries enabled - @Test - public void testReplaceRoleWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplaceRoleWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplaceRoleWOptions(); - } - - // Test the replaceRole operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceRoleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replaceRole(null).execute(); - } - - // Test the getRole operation with a valid options model parameter - @Test - public void testGetRoleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; - String getRolePath = "/v2/roles/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetRoleOptions model - GetRoleOptions getRoleOptionsModel = new GetRoleOptions.Builder() - .roleId("testString") - .build(); - - // Invoke getRole() with a valid options model and verify the result - Response response = iamPolicyManagementService.getRole(getRoleOptionsModel).execute(); - assertNotNull(response); - CustomRole 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, getRolePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getRole operation with and without retries enabled - @Test - public void testGetRoleWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetRoleWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetRoleWOptions(); - } - - // Test the getRole operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getRole(null).execute(); - } - - // Test the deleteRole operation with a valid options model parameter - @Test - public void testDeleteRoleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteRolePath = "/v2/roles/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteRoleOptions model - DeleteRoleOptions deleteRoleOptionsModel = new DeleteRoleOptions.Builder() - .roleId("testString") - .build(); - - // Invoke deleteRole() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteRole(deleteRoleOptionsModel).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, deleteRolePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteRole operation with and without retries enabled - @Test - public void testDeleteRoleWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteRoleWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteRoleWOptions(); - } - - // Test the deleteRole operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteRole(null).execute(); - } - - // Test the listV2Policies operation with a valid options model parameter - @Test - public void testListV2PoliciesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policies\": [{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19, \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}]}"; - String listV2PoliciesPath = "/v2/policies"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListV2PoliciesOptions model - ListV2PoliciesOptions listV2PoliciesOptionsModel = new ListV2PoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .serviceName("testString") - .serviceGroupId("testString") - .sort("testString") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listV2Policies() with a valid options model and verify the result - Response response = iamPolicyManagementService.listV2Policies(listV2PoliciesOptionsModel).execute(); - assertNotNull(response); - V2PolicyCollection 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, listV2PoliciesPath); - // 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("access_group_id"), "testString"); - assertEquals(query.get("type"), "access"); - assertEquals(query.get("service_type"), "service"); - assertEquals(query.get("service_name"), "testString"); - assertEquals(query.get("service_group_id"), "testString"); - assertEquals(query.get("sort"), "testString"); - assertEquals(query.get("format"), "include_last_permit"); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listV2Policies operation with and without retries enabled - @Test - public void testListV2PoliciesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListV2PoliciesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListV2PoliciesWOptions(); - } - - // Test the listV2Policies operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListV2PoliciesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listV2Policies(null).execute(); - } - - // Test the listV2Policies operation using the V2PoliciesPager.getNext() method - @Test - public void testListV2PoliciesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListV2PoliciesOptions listV2PoliciesOptions = new ListV2PoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .serviceName("testString") - .serviceGroupId("testString") - .sort("testString") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - V2PoliciesPager pager = new V2PoliciesPager(iamPolicyManagementService, listV2PoliciesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listV2Policies operation using the V2PoliciesPager.getAll() method - @Test - public void testListV2PoliciesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListV2PoliciesOptions listV2PoliciesOptions = new ListV2PoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .serviceName("testString") - .serviceGroupId("testString") - .sort("testString") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - V2PoliciesPager pager = new V2PoliciesPager(iamPolicyManagementService, listV2PoliciesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createV2Policy operation with a valid options model parameter - @Test - public void testCreateV2PolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19}"; - String createV2PolicyPath = "/v2/policies"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the Grant model - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the Control model - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the CreateV2PolicyOptions model - CreateV2PolicyOptions createV2PolicyOptionsModel = new CreateV2PolicyOptions.Builder() - .control(controlModel) - .type("access") - .description("testString") - .subject(v2PolicySubjectModel) - .resource(v2PolicyResourceModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .acceptLanguage("default") - .build(); - - // Invoke createV2Policy() with a valid options model and verify the result - Response response = iamPolicyManagementService.createV2Policy(createV2PolicyOptionsModel).execute(); - assertNotNull(response); - V2Policy 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createV2PolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createV2Policy operation with and without retries enabled - @Test - public void testCreateV2PolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateV2PolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateV2PolicyWOptions(); - } - - // Test the createV2Policy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateV2PolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createV2Policy(null).execute(); - } - - // Test the replaceV2Policy operation with a valid options model parameter - @Test - public void testReplaceV2PolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19}"; - String replaceV2PolicyPath = "/v2/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the Grant model - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the Control model - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the ReplaceV2PolicyOptions model - ReplaceV2PolicyOptions replaceV2PolicyOptionsModel = new ReplaceV2PolicyOptions.Builder() - .id("testString") - .ifMatch("testString") - .control(controlModel) - .type("access") - .description("testString") - .subject(v2PolicySubjectModel) - .resource(v2PolicyResourceModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .build(); - - // Invoke replaceV2Policy() with a valid options model and verify the result - Response response = iamPolicyManagementService.replaceV2Policy(replaceV2PolicyOptionsModel).execute(); - assertNotNull(response); - V2Policy 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, replaceV2PolicyPath); - // 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 replaceV2Policy operation with and without retries enabled - @Test - public void testReplaceV2PolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplaceV2PolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplaceV2PolicyWOptions(); - } - - // Test the replaceV2Policy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceV2PolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replaceV2Policy(null).execute(); - } - - // Test the getV2Policy operation with a valid options model parameter - @Test - public void testGetV2PolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19, \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}"; - String getV2PolicyPath = "/v2/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetV2PolicyOptions model - GetV2PolicyOptions getV2PolicyOptionsModel = new GetV2PolicyOptions.Builder() - .id("testString") - .format("include_last_permit") - .build(); - - // Invoke getV2Policy() with a valid options model and verify the result - Response response = iamPolicyManagementService.getV2Policy(getV2PolicyOptionsModel).execute(); - assertNotNull(response); - V2PolicyTemplateMetaData 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, getV2PolicyPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("format"), "include_last_permit"); - } - - // Test the getV2Policy operation with and without retries enabled - @Test - public void testGetV2PolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetV2PolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetV2PolicyWOptions(); - } - - // Test the getV2Policy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetV2PolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getV2Policy(null).execute(); - } - - // Test the deleteV2Policy operation with a valid options model parameter - @Test - public void testDeleteV2PolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteV2PolicyPath = "/v2/policies/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteV2PolicyOptions model - DeleteV2PolicyOptions deleteV2PolicyOptionsModel = new DeleteV2PolicyOptions.Builder() - .id("testString") - .build(); - - // Invoke deleteV2Policy() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteV2Policy(deleteV2PolicyOptionsModel).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, deleteV2PolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteV2Policy operation with and without retries enabled - @Test - public void testDeleteV2PolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteV2PolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteV2PolicyWOptions(); - } - - // Test the deleteV2Policy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteV2PolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteV2Policy(null).execute(); - } - - // Test the listPolicyTemplates operation with a valid options model parameter - @Test - public void testListPolicyTemplatesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policy_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; - String listPolicyTemplatesPath = "/v1/policy_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListPolicyTemplatesOptions model - ListPolicyTemplatesOptions listPolicyTemplatesOptionsModel = new ListPolicyTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .state("active") - .name("testString") - .policyServiceType("service") - .policyServiceName("testString") - .policyServiceGroupId("testString") - .policyType("access") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listPolicyTemplates() with a valid options model and verify the result - Response response = iamPolicyManagementService.listPolicyTemplates(listPolicyTemplatesOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateCollection 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, listPolicyTemplatesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("state"), "active"); - assertEquals(query.get("name"), "testString"); - assertEquals(query.get("policy_service_type"), "service"); - assertEquals(query.get("policy_service_name"), "testString"); - assertEquals(query.get("policy_service_group_id"), "testString"); - assertEquals(query.get("policy_type"), "access"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listPolicyTemplates operation with and without retries enabled - @Test - public void testListPolicyTemplatesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListPolicyTemplatesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListPolicyTemplatesWOptions(); - } - - // Test the listPolicyTemplates operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyTemplatesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listPolicyTemplates(null).execute(); - } - - // Test the listPolicyTemplates operation using the PolicyTemplatesPager.getNext() method - @Test - public void testListPolicyTemplatesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyTemplatesOptions listPolicyTemplatesOptions = new ListPolicyTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .state("active") - .name("testString") - .policyServiceType("service") - .policyServiceName("testString") - .policyServiceGroupId("testString") - .policyType("access") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - PolicyTemplatesPager pager = new PolicyTemplatesPager(iamPolicyManagementService, listPolicyTemplatesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listPolicyTemplates operation using the PolicyTemplatesPager.getAll() method - @Test - public void testListPolicyTemplatesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyTemplatesOptions listPolicyTemplatesOptions = new ListPolicyTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .state("active") - .name("testString") - .policyServiceType("service") - .policyServiceName("testString") - .policyServiceGroupId("testString") - .policyType("access") - .limit(Long.valueOf("10")) - .build(); - - PolicyTemplatesPager pager = new PolicyTemplatesPager(iamPolicyManagementService, listPolicyTemplatesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createPolicyTemplate operation with a valid options model parameter - @Test - public void testCreatePolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; - String createPolicyTemplatePath = "/v1/policy_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the TemplateGrantRoles model - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the TemplateControl model - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - - // Construct an instance of the TemplatePolicy model - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - - // Construct an instance of the CreatePolicyTemplateOptions model - CreatePolicyTemplateOptions createPolicyTemplateOptionsModel = new CreatePolicyTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .policy(templatePolicyModel) - .description("testString") - .committed(true) - .acceptLanguage("default") - .build(); - - // Invoke createPolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.createPolicyTemplate(createPolicyTemplateOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateLimitData 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createPolicyTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createPolicyTemplate operation with and without retries enabled - @Test - public void testCreatePolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreatePolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreatePolicyTemplateWOptions(); - } - - // Test the createPolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createPolicyTemplate(null).execute(); - } - - // Test the getPolicyTemplate operation with a valid options model parameter - @Test - public void testGetPolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String getPolicyTemplatePath = "/v1/policy_templates/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetPolicyTemplateOptions model - GetPolicyTemplateOptions getPolicyTemplateOptionsModel = new GetPolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .state("active") - .build(); - - // Invoke getPolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.getPolicyTemplate(getPolicyTemplateOptionsModel).execute(); - assertNotNull(response); - PolicyTemplate 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, getPolicyTemplatePath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - } - - // Test the getPolicyTemplate operation with and without retries enabled - @Test - public void testGetPolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetPolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetPolicyTemplateWOptions(); - } - - // Test the getPolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getPolicyTemplate(null).execute(); - } - - // Test the deletePolicyTemplate operation with a valid options model parameter - @Test - public void testDeletePolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deletePolicyTemplatePath = "/v1/policy_templates/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeletePolicyTemplateOptions model - DeletePolicyTemplateOptions deletePolicyTemplateOptionsModel = new DeletePolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .build(); - - // Invoke deletePolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.deletePolicyTemplate(deletePolicyTemplateOptionsModel).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, deletePolicyTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deletePolicyTemplate operation with and without retries enabled - @Test - public void testDeletePolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeletePolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeletePolicyTemplateWOptions(); - } - - // Test the deletePolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deletePolicyTemplate(null).execute(); - } - - // Test the createPolicyTemplateVersion operation with a valid options model parameter - @Test - public void testCreatePolicyTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; - String createPolicyTemplateVersionPath = "/v1/policy_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the TemplateGrantRoles model - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the TemplateControl model - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - - // Construct an instance of the TemplatePolicy model - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - - // Construct an instance of the CreatePolicyTemplateVersionOptions model - CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptionsModel = new CreatePolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .policy(templatePolicyModel) - .name("testString") - .description("testString") - .committed(true) - .build(); - - // Invoke createPolicyTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.createPolicyTemplateVersion(createPolicyTemplateVersionOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateLimitData 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createPolicyTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createPolicyTemplateVersion operation with and without retries enabled - @Test - public void testCreatePolicyTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreatePolicyTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreatePolicyTemplateVersionWOptions(); - } - - // Test the createPolicyTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createPolicyTemplateVersion(null).execute(); - } - - // Test the listPolicyTemplateVersions operation with a valid options model parameter - @Test - public void testListPolicyTemplateVersionsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; - String listPolicyTemplateVersionsPath = "/v1/policy_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListPolicyTemplateVersionsOptions model - ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptionsModel = new ListPolicyTemplateVersionsOptions.Builder() - .policyTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listPolicyTemplateVersions() with a valid options model and verify the result - Response response = iamPolicyManagementService.listPolicyTemplateVersions(listPolicyTemplateVersionsOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateVersionsCollection 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, listPolicyTemplateVersionsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listPolicyTemplateVersions operation with and without retries enabled - @Test - public void testListPolicyTemplateVersionsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListPolicyTemplateVersionsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListPolicyTemplateVersionsWOptions(); - } - - // Test the listPolicyTemplateVersions operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyTemplateVersionsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listPolicyTemplateVersions(null).execute(); - } - - // Test the listPolicyTemplateVersions operation using the PolicyTemplateVersionsPager.getNext() method - @Test - public void testListPolicyTemplateVersionsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions = new ListPolicyTemplateVersionsOptions.Builder() - .policyTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - PolicyTemplateVersionsPager pager = new PolicyTemplateVersionsPager(iamPolicyManagementService, listPolicyTemplateVersionsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listPolicyTemplateVersions operation using the PolicyTemplateVersionsPager.getAll() method - @Test - public void testListPolicyTemplateVersionsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions = new ListPolicyTemplateVersionsOptions.Builder() - .policyTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - PolicyTemplateVersionsPager pager = new PolicyTemplateVersionsPager(iamPolicyManagementService, listPolicyTemplateVersionsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the replacePolicyTemplate operation with a valid options model parameter - @Test - public void testReplacePolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String replacePolicyTemplatePath = "/v1/policy_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the TemplateGrantRoles model - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the TemplateControl model - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - - // Construct an instance of the TemplatePolicy model - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - - // Construct an instance of the ReplacePolicyTemplateOptions model - ReplacePolicyTemplateOptions replacePolicyTemplateOptionsModel = new ReplacePolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .ifMatch("testString") - .policy(templatePolicyModel) - .name("testString") - .description("testString") - .committed(true) - .build(); - - // Invoke replacePolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.replacePolicyTemplate(replacePolicyTemplateOptionsModel).execute(); - assertNotNull(response); - PolicyTemplate 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, replacePolicyTemplatePath); - // 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 replacePolicyTemplate operation with and without retries enabled - @Test - public void testReplacePolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplacePolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplacePolicyTemplateWOptions(); - } - - // Test the replacePolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplacePolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replacePolicyTemplate(null).execute(); - } - - // Test the deletePolicyTemplateVersion operation with a valid options model parameter - @Test - public void testDeletePolicyTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deletePolicyTemplateVersionPath = "/v1/policy_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeletePolicyTemplateVersionOptions model - DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptionsModel = new DeletePolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - - // Invoke deletePolicyTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.deletePolicyTemplateVersion(deletePolicyTemplateVersionOptionsModel).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, deletePolicyTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deletePolicyTemplateVersion operation with and without retries enabled - @Test - public void testDeletePolicyTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeletePolicyTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeletePolicyTemplateVersionWOptions(); - } - - // Test the deletePolicyTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deletePolicyTemplateVersion(null).execute(); - } - - // Test the getPolicyTemplateVersion operation with a valid options model parameter - @Test - public void testGetPolicyTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String getPolicyTemplateVersionPath = "/v1/policy_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetPolicyTemplateVersionOptions model - GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptionsModel = new GetPolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - - // Invoke getPolicyTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.getPolicyTemplateVersion(getPolicyTemplateVersionOptionsModel).execute(); - assertNotNull(response); - PolicyTemplate 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, getPolicyTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getPolicyTemplateVersion operation with and without retries enabled - @Test - public void testGetPolicyTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetPolicyTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetPolicyTemplateVersionWOptions(); - } - - // Test the getPolicyTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getPolicyTemplateVersion(null).execute(); - } - - // Test the commitPolicyTemplate operation with a valid options model parameter - @Test - public void testCommitPolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String commitPolicyTemplatePath = "/v1/policy_templates/testString/versions/testString/commit"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the CommitPolicyTemplateOptions model - CommitPolicyTemplateOptions commitPolicyTemplateOptionsModel = new CommitPolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - - // Invoke commitPolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.commitPolicyTemplate(commitPolicyTemplateOptionsModel).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, commitPolicyTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the commitPolicyTemplate operation with and without retries enabled - @Test - public void testCommitPolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCommitPolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCommitPolicyTemplateWOptions(); - } - - // Test the commitPolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitPolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.commitPolicyTemplate(null).execute(); - } - - // Test the listPolicyAssignments operation with a valid options model parameter - @Test - public void testListPolicyAssignmentsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}]}"; - String listPolicyAssignmentsPath = "/v1/policy_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListPolicyAssignmentsOptions model - ListPolicyAssignmentsOptions listPolicyAssignmentsOptionsModel = new ListPolicyAssignmentsOptions.Builder() - .version("1.0") - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listPolicyAssignments() with a valid options model and verify the result - Response response = iamPolicyManagementService.listPolicyAssignments(listPolicyAssignmentsOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateAssignmentCollection 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, listPolicyAssignmentsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "1.0"); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("template_id"), "testString"); - assertEquals(query.get("template_version"), "testString"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listPolicyAssignments operation with and without retries enabled - @Test - public void testListPolicyAssignmentsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListPolicyAssignmentsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListPolicyAssignmentsWOptions(); - } - - // Test the listPolicyAssignments operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyAssignmentsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listPolicyAssignments(null).execute(); - } - - // Test the listPolicyAssignments operation using the PolicyAssignmentsPager.getNext() method - @Test - public void testListPolicyAssignmentsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyAssignmentsOptions listPolicyAssignmentsOptions = new ListPolicyAssignmentsOptions.Builder() - .version("1.0") - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - PolicyAssignmentsPager pager = new PolicyAssignmentsPager(iamPolicyManagementService, listPolicyAssignmentsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listPolicyAssignments operation using the PolicyAssignmentsPager.getAll() method - @Test - public void testListPolicyAssignmentsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyAssignmentsOptions listPolicyAssignmentsOptions = new ListPolicyAssignmentsOptions.Builder() - .version("1.0") - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - PolicyAssignmentsPager pager = new PolicyAssignmentsPager(iamPolicyManagementService, listPolicyAssignmentsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createPolicyTemplateAssignment operation with a valid options model parameter - @Test - public void testCreatePolicyTemplateAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}]}"; - String createPolicyTemplateAssignmentPath = "/v1/policy_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the AssignmentTargetDetails model - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - - // Construct an instance of the AssignmentTemplateDetails model - AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() - .id("testString") - .version("testString") - .build(); - - // Construct an instance of the CreatePolicyTemplateAssignmentOptions model - CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptionsModel = new CreatePolicyTemplateAssignmentOptions.Builder() - .version("1.0") - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(assignmentTemplateDetailsModel)) - .acceptLanguage("default") - .build(); - - // Invoke createPolicyTemplateAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.createPolicyTemplateAssignment(createPolicyTemplateAssignmentOptionsModel).execute(); - assertNotNull(response); - PolicyAssignmentV1Collection 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createPolicyTemplateAssignmentPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "1.0"); - } - - // Test the createPolicyTemplateAssignment operation with and without retries enabled - @Test - public void testCreatePolicyTemplateAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreatePolicyTemplateAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreatePolicyTemplateAssignmentWOptions(); - } - - // Test the createPolicyTemplateAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createPolicyTemplateAssignment(null).execute(); - } - - // Test the getPolicyAssignment operation with a valid options model parameter - @Test - public void testGetPolicyAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}"; - String getPolicyAssignmentPath = "/v1/policy_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetPolicyAssignmentOptions model - GetPolicyAssignmentOptions getPolicyAssignmentOptionsModel = new GetPolicyAssignmentOptions.Builder() - .assignmentId("testString") - .version("1.0") - .build(); - - // Invoke getPolicyAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.getPolicyAssignment(getPolicyAssignmentOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateAssignmentItems 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, getPolicyAssignmentPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "1.0"); - } - - // Test the getPolicyAssignment operation with and without retries enabled - @Test - public void testGetPolicyAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetPolicyAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetPolicyAssignmentWOptions(); - } - - // Test the getPolicyAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getPolicyAssignment(null).execute(); - } - - // Test the updatePolicyAssignment operation with a valid options model parameter - @Test - public void testUpdatePolicyAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}"; - String updatePolicyAssignmentPath = "/v1/policy_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdatePolicyAssignmentOptions model - UpdatePolicyAssignmentOptions updatePolicyAssignmentOptionsModel = new UpdatePolicyAssignmentOptions.Builder() - .assignmentId("testString") - .version("1.0") - .ifMatch("testString") - .templateVersion("testString") - .build(); - - // Invoke updatePolicyAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.updatePolicyAssignment(updatePolicyAssignmentOptionsModel).execute(); - assertNotNull(response); - PolicyAssignmentV1 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updatePolicyAssignmentPath); - // Verify header parameters - assertEquals(request.getHeader("If-Match"), "testString"); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "1.0"); - } - - // Test the updatePolicyAssignment operation with and without retries enabled - @Test - public void testUpdatePolicyAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdatePolicyAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdatePolicyAssignmentWOptions(); - } - - // Test the updatePolicyAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdatePolicyAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updatePolicyAssignment(null).execute(); - } - - // Test the deletePolicyAssignment operation with a valid options model parameter - @Test - public void testDeletePolicyAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deletePolicyAssignmentPath = "/v1/policy_assignments/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeletePolicyAssignmentOptions model - DeletePolicyAssignmentOptions deletePolicyAssignmentOptionsModel = new DeletePolicyAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke deletePolicyAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.deletePolicyAssignment(deletePolicyAssignmentOptionsModel).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, deletePolicyAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deletePolicyAssignment operation with and without retries enabled - @Test - public void testDeletePolicyAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeletePolicyAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeletePolicyAssignmentWOptions(); - } - - // Test the deletePolicyAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deletePolicyAssignment(null).execute(); - } - - // Test the getSettings operation with a valid options model parameter - @Test - public void testGetSettingsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"external_account_identity_interaction\": {\"identity_types\": {\"user\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service_id\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}}}}"; - String getSettingsPath = "/v1/accounts/testString/settings/access_management"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetSettingsOptions model - GetSettingsOptions getSettingsOptionsModel = new GetSettingsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .build(); - - // Invoke getSettings() with a valid options model and verify the result - Response response = iamPolicyManagementService.getSettings(getSettingsOptionsModel).execute(); - assertNotNull(response); - AccountSettingsAccessManagement 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, getSettingsPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getSettings operation with and without retries enabled - @Test - public void testGetSettingsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetSettingsWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetSettingsWOptions(); - } - - // Test the getSettings operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetSettingsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getSettings(null).execute(); - } - - // Test the updateSettings operation with a valid options model parameter - @Test - public void testUpdateSettingsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"external_account_identity_interaction\": {\"identity_types\": {\"user\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service_id\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}}}}"; - String updateSettingsPath = "/v1/accounts/testString/settings/access_management"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the IdentityTypesBase model - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the IdentityTypesPatch model - IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() - .user(identityTypesBaseModel) - .serviceId(identityTypesBaseModel) - .service(identityTypesBaseModel) - .build(); - - // Construct an instance of the ExternalAccountIdentityInteractionPatch model - ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() - .identityTypes(identityTypesPatchModel) - .build(); - - // Construct an instance of the UpdateSettingsOptions model - UpdateSettingsOptions updateSettingsOptionsModel = new UpdateSettingsOptions.Builder() - .accountId("testString") - .ifMatch("testString") - .externalAccountIdentityInteraction(externalAccountIdentityInteractionPatchModel) - .acceptLanguage("default") - .build(); - - // Invoke updateSettings() with a valid options model and verify the result - Response response = iamPolicyManagementService.updateSettings(updateSettingsOptionsModel).execute(); - assertNotNull(response); - AccountSettingsAccessManagement 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateSettingsPath); - // 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 updateSettings operation with and without retries enabled - @Test - public void testUpdateSettingsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdateSettingsWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdateSettingsWOptions(); - } - - // Test the updateSettings operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateSettingsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updateSettings(null).execute(); - } - - // Test the listActionControlTemplates operation with a valid options model parameter - @Test - public void testListActionControlTemplatesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"action_control_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; - String listActionControlTemplatesPath = "/v1/action_control_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListActionControlTemplatesOptions model - ListActionControlTemplatesOptions listActionControlTemplatesOptionsModel = new ListActionControlTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listActionControlTemplates() with a valid options model and verify the result - Response response = iamPolicyManagementService.listActionControlTemplates(listActionControlTemplatesOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplateCollection 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, listActionControlTemplatesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listActionControlTemplates operation with and without retries enabled - @Test - public void testListActionControlTemplatesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListActionControlTemplatesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListActionControlTemplatesWOptions(); - } - - // Test the listActionControlTemplates operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlTemplatesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listActionControlTemplates(null).execute(); - } - - // Test the listActionControlTemplates operation using the ActionControlTemplatesPager.getNext() method - @Test - public void testListActionControlTemplatesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlTemplatesOptions listActionControlTemplatesOptions = new ListActionControlTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - ActionControlTemplatesPager pager = new ActionControlTemplatesPager(iamPolicyManagementService, listActionControlTemplatesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listActionControlTemplates operation using the ActionControlTemplatesPager.getAll() method - @Test - public void testListActionControlTemplatesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlTemplatesOptions listActionControlTemplatesOptions = new ListActionControlTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .limit(Long.valueOf("10")) - .build(); - - ActionControlTemplatesPager pager = new ActionControlTemplatesPager(iamPolicyManagementService, listActionControlTemplatesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createActionControlTemplate operation with a valid options model parameter - @Test - public void testCreateActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String createActionControlTemplatePath = "/v1/action_control_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateActionControl model - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the CreateActionControlTemplateOptions model - CreateActionControlTemplateOptions createActionControlTemplateOptionsModel = new CreateActionControlTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .description("testString") - .committed(true) - .actionControl(templateActionControlModel) - .acceptLanguage("default") - .build(); - - // Invoke createActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.createActionControlTemplate(createActionControlTemplateOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createActionControlTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createActionControlTemplate operation with and without retries enabled - @Test - public void testCreateActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateActionControlTemplateWOptions(); - } - - // Test the createActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createActionControlTemplate(null).execute(); - } - - // Test the getActionControlTemplate operation with a valid options model parameter - @Test - public void testGetActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String getActionControlTemplatePath = "/v1/action_control_templates/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetActionControlTemplateOptions model - GetActionControlTemplateOptions getActionControlTemplateOptionsModel = new GetActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .build(); - - // Invoke getActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.getActionControlTemplate(getActionControlTemplateOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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, getActionControlTemplatePath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - } - - // Test the getActionControlTemplate operation with and without retries enabled - @Test - public void testGetActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetActionControlTemplateWOptions(); - } - - // Test the getActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getActionControlTemplate(null).execute(); - } - - // Test the deleteActionControlTemplate operation with a valid options model parameter - @Test - public void testDeleteActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteActionControlTemplatePath = "/v1/action_control_templates/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteActionControlTemplateOptions model - DeleteActionControlTemplateOptions deleteActionControlTemplateOptionsModel = new DeleteActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .build(); - - // Invoke deleteActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteActionControlTemplate(deleteActionControlTemplateOptionsModel).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, deleteActionControlTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteActionControlTemplate operation with and without retries enabled - @Test - public void testDeleteActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteActionControlTemplateWOptions(); - } - - // Test the deleteActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteActionControlTemplate(null).execute(); - } - - // Test the createActionControlTemplateVersion operation with a valid options model parameter - @Test - public void testCreateActionControlTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String createActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateActionControl model - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the CreateActionControlTemplateVersionOptions model - CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptionsModel = new CreateActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .name("testString") - .description("testString") - .actionControl(templateActionControlModel) - .committed(true) - .build(); - - // Invoke createActionControlTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.createActionControlTemplateVersion(createActionControlTemplateVersionOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createActionControlTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createActionControlTemplateVersion operation with and without retries enabled - @Test - public void testCreateActionControlTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateActionControlTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateActionControlTemplateVersionWOptions(); - } - - // Test the createActionControlTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createActionControlTemplateVersion(null).execute(); - } - - // Test the listActionControlTemplateVersions operation with a valid options model parameter - @Test - public void testListActionControlTemplateVersionsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; - String listActionControlTemplateVersionsPath = "/v1/action_control_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListActionControlTemplateVersionsOptions model - ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptionsModel = new ListActionControlTemplateVersionsOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listActionControlTemplateVersions() with a valid options model and verify the result - Response response = iamPolicyManagementService.listActionControlTemplateVersions(listActionControlTemplateVersionsOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplateVersionsCollection 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, listActionControlTemplateVersionsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listActionControlTemplateVersions operation with and without retries enabled - @Test - public void testListActionControlTemplateVersionsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListActionControlTemplateVersionsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListActionControlTemplateVersionsWOptions(); - } - - // Test the listActionControlTemplateVersions operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlTemplateVersionsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listActionControlTemplateVersions(null).execute(); - } - - // Test the listActionControlTemplateVersions operation using the ActionControlTemplateVersionsPager.getNext() method - @Test - public void testListActionControlTemplateVersionsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions = new ListActionControlTemplateVersionsOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - ActionControlTemplateVersionsPager pager = new ActionControlTemplateVersionsPager(iamPolicyManagementService, listActionControlTemplateVersionsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listActionControlTemplateVersions operation using the ActionControlTemplateVersionsPager.getAll() method - @Test - public void testListActionControlTemplateVersionsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions = new ListActionControlTemplateVersionsOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - ActionControlTemplateVersionsPager pager = new ActionControlTemplateVersionsPager(iamPolicyManagementService, listActionControlTemplateVersionsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the replaceActionControlTemplate operation with a valid options model parameter - @Test - public void testReplaceActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String replaceActionControlTemplatePath = "/v1/action_control_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateActionControl model - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the ReplaceActionControlTemplateOptions model - ReplaceActionControlTemplateOptions replaceActionControlTemplateOptionsModel = new ReplaceActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .ifMatch("testString") - .name("testString") - .description("testString") - .actionControl(templateActionControlModel) - .committed(true) - .build(); - - // Invoke replaceActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.replaceActionControlTemplate(replaceActionControlTemplateOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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, replaceActionControlTemplatePath); - // 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 replaceActionControlTemplate operation with and without retries enabled - @Test - public void testReplaceActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplaceActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplaceActionControlTemplateWOptions(); - } - - // Test the replaceActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replaceActionControlTemplate(null).execute(); - } - - // Test the deleteActionControlTemplateVersion operation with a valid options model parameter - @Test - public void testDeleteActionControlTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteActionControlTemplateVersionOptions model - DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptionsModel = new DeleteActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - - // Invoke deleteActionControlTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteActionControlTemplateVersion(deleteActionControlTemplateVersionOptionsModel).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, deleteActionControlTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteActionControlTemplateVersion operation with and without retries enabled - @Test - public void testDeleteActionControlTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteActionControlTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteActionControlTemplateVersionWOptions(); - } - - // Test the deleteActionControlTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteActionControlTemplateVersion(null).execute(); - } - - // Test the getActionControlTemplateVersion operation with a valid options model parameter - @Test - public void testGetActionControlTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String getActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetActionControlTemplateVersionOptions model - GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptionsModel = new GetActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - - // Invoke getActionControlTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.getActionControlTemplateVersion(getActionControlTemplateVersionOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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, getActionControlTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getActionControlTemplateVersion operation with and without retries enabled - @Test - public void testGetActionControlTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetActionControlTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetActionControlTemplateVersionWOptions(); - } - - // Test the getActionControlTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getActionControlTemplateVersion(null).execute(); - } - - // Test the commitActionControlTemplate operation with a valid options model parameter - @Test - public void testCommitActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String commitActionControlTemplatePath = "/v1/action_control_templates/testString/versions/testString/commit"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the CommitActionControlTemplateOptions model - CommitActionControlTemplateOptions commitActionControlTemplateOptionsModel = new CommitActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - - // Invoke commitActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.commitActionControlTemplate(commitActionControlTemplateOptionsModel).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, commitActionControlTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the commitActionControlTemplate operation with and without retries enabled - @Test - public void testCommitActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCommitActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCommitActionControlTemplateWOptions(); - } - - // Test the commitActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.commitActionControlTemplate(null).execute(); - } - - // Test the listActionControlAssignments operation with a valid options model parameter - @Test - public void testListActionControlAssignmentsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; - String listActionControlAssignmentsPath = "/v1/action_control_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListActionControlAssignmentsOptions model - ListActionControlAssignmentsOptions listActionControlAssignmentsOptionsModel = new ListActionControlAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listActionControlAssignments() with a valid options model and verify the result - Response response = iamPolicyManagementService.listActionControlAssignments(listActionControlAssignmentsOptionsModel).execute(); - assertNotNull(response); - ActionControlAssignmentCollection 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, listActionControlAssignmentsPath); - // 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(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listActionControlAssignments operation with and without retries enabled - @Test - public void testListActionControlAssignmentsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListActionControlAssignmentsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListActionControlAssignmentsWOptions(); - } - - // Test the listActionControlAssignments operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlAssignmentsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listActionControlAssignments(null).execute(); - } - - // Test the listActionControlAssignments operation using the ActionControlAssignmentsPager.getNext() method - @Test - public void testListActionControlAssignmentsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlAssignmentsOptions listActionControlAssignmentsOptions = new ListActionControlAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - ActionControlAssignmentsPager pager = new ActionControlAssignmentsPager(iamPolicyManagementService, listActionControlAssignmentsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listActionControlAssignments operation using the ActionControlAssignmentsPager.getAll() method - @Test - public void testListActionControlAssignmentsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlAssignmentsOptions listActionControlAssignmentsOptions = new ListActionControlAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - ActionControlAssignmentsPager pager = new ActionControlAssignmentsPager(iamPolicyManagementService, listActionControlAssignmentsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createActionControlTemplateAssignment operation with a valid options model parameter - @Test - public void testCreateActionControlTemplateAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; - String createActionControlTemplateAssignmentPath = "/v1/action_control_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the AssignmentTargetDetails model - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - - // Construct an instance of the ActionControlAssignmentTemplate model - ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - - // Construct an instance of the CreateActionControlTemplateAssignmentOptions model - CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptionsModel = new CreateActionControlTemplateAssignmentOptions.Builder() - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(actionControlAssignmentTemplateModel)) - .acceptLanguage("default") - .build(); - - // Invoke createActionControlTemplateAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.createActionControlTemplateAssignment(createActionControlTemplateAssignmentOptionsModel).execute(); - assertNotNull(response); - ActionControlAssignmentCollection 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createActionControlTemplateAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createActionControlTemplateAssignment operation with and without retries enabled - @Test - public void testCreateActionControlTemplateAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateActionControlTemplateAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateActionControlTemplateAssignmentWOptions(); - } - - // Test the createActionControlTemplateAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createActionControlTemplateAssignment(null).execute(); - } - - // Test the getActionControlAssignment operation with a valid options model parameter - @Test - public void testGetActionControlAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; - String getActionControlAssignmentPath = "/v1/action_control_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetActionControlAssignmentOptions model - GetActionControlAssignmentOptions getActionControlAssignmentOptionsModel = new GetActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke getActionControlAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.getActionControlAssignment(getActionControlAssignmentOptionsModel).execute(); - assertNotNull(response); - ActionControlAssignment 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, getActionControlAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getActionControlAssignment operation with and without retries enabled - @Test - public void testGetActionControlAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetActionControlAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetActionControlAssignmentWOptions(); - } - - // Test the getActionControlAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getActionControlAssignment(null).execute(); - } - - // Test the updateActionControlAssignment operation with a valid options model parameter - @Test - public void testUpdateActionControlAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; - String updateActionControlAssignmentPath = "/v1/action_control_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdateActionControlAssignmentOptions model - UpdateActionControlAssignmentOptions updateActionControlAssignmentOptionsModel = new UpdateActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .ifMatch("testString") - .templateVersion("testString") - .build(); - - // Invoke updateActionControlAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.updateActionControlAssignment(updateActionControlAssignmentOptionsModel).execute(); - assertNotNull(response); - ActionControlAssignment 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateActionControlAssignmentPath); - // 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 updateActionControlAssignment operation with and without retries enabled - @Test - public void testUpdateActionControlAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdateActionControlAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdateActionControlAssignmentWOptions(); - } - - // Test the updateActionControlAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateActionControlAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updateActionControlAssignment(null).execute(); - } - - // Test the deleteActionControlAssignment operation with a valid options model parameter - @Test - public void testDeleteActionControlAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteActionControlAssignmentPath = "/v1/action_control_assignments/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteActionControlAssignmentOptions model - DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptionsModel = new DeleteActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke deleteActionControlAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteActionControlAssignment(deleteActionControlAssignmentOptionsModel).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, deleteActionControlAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteActionControlAssignment operation with and without retries enabled - @Test - public void testDeleteActionControlAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteActionControlAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteActionControlAssignmentWOptions(); - } - - // Test the deleteActionControlAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteActionControlAssignment(null).execute(); - } - - // Test the listRoleTemplates operation with a valid options model parameter - @Test - public void testListRoleTemplatesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"role_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; - String listRoleTemplatesPath = "/v1/role_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListRoleTemplatesOptions model - ListRoleTemplatesOptions listRoleTemplatesOptionsModel = new ListRoleTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .name("testString") - .roleName("testString") - .roleServiceName("testString") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listRoleTemplates() with a valid options model and verify the result - Response response = iamPolicyManagementService.listRoleTemplates(listRoleTemplatesOptionsModel).execute(); - assertNotNull(response); - RoleTemplateCollection 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, listRoleTemplatesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("name"), "testString"); - assertEquals(query.get("role_name"), "testString"); - assertEquals(query.get("role_service_name"), "testString"); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listRoleTemplates operation with and without retries enabled - @Test - public void testListRoleTemplatesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListRoleTemplatesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListRoleTemplatesWOptions(); - } - - // Test the listRoleTemplates operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleTemplatesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listRoleTemplates(null).execute(); - } - - // Test the listRoleTemplates operation using the RoleTemplatesPager.getNext() method - @Test - public void testListRoleTemplatesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleTemplatesOptions listRoleTemplatesOptions = new ListRoleTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .name("testString") - .roleName("testString") - .roleServiceName("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - RoleTemplatesPager pager = new RoleTemplatesPager(iamPolicyManagementService, listRoleTemplatesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listRoleTemplates operation using the RoleTemplatesPager.getAll() method - @Test - public void testListRoleTemplatesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleTemplatesOptions listRoleTemplatesOptions = new ListRoleTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .name("testString") - .roleName("testString") - .roleServiceName("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - RoleTemplatesPager pager = new RoleTemplatesPager(iamPolicyManagementService, listRoleTemplatesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createRoleTemplate operation with a valid options model parameter - @Test - public void testCreateRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String createRoleTemplatePath = "/v1/role_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the RoleTemplatePrototypeRole model - RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() - .name("testString") - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the CreateRoleTemplateOptions model - CreateRoleTemplateOptions createRoleTemplateOptionsModel = new CreateRoleTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .description("testString") - .committed(true) - .role(roleTemplatePrototypeRoleModel) - .acceptLanguage("default") - .build(); - - // Invoke createRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.createRoleTemplate(createRoleTemplateOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createRoleTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createRoleTemplate operation with and without retries enabled - @Test - public void testCreateRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateRoleTemplateWOptions(); - } - - // Test the createRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createRoleTemplate(null).execute(); - } - - // Test the getRoleTemplate operation with a valid options model parameter - @Test - public void testGetRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String getRoleTemplatePath = "/v1/role_templates/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetRoleTemplateOptions model - GetRoleTemplateOptions getRoleTemplateOptionsModel = new GetRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .state("active") - .build(); - - // Invoke getRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.getRoleTemplate(getRoleTemplateOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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, getRoleTemplatePath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - } - - // Test the getRoleTemplate operation with and without retries enabled - @Test - public void testGetRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetRoleTemplateWOptions(); - } - - // Test the getRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getRoleTemplate(null).execute(); - } - - // Test the deleteRoleTemplate operation with a valid options model parameter - @Test - public void testDeleteRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteRoleTemplatePath = "/v1/role_templates/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteRoleTemplateOptions model - DeleteRoleTemplateOptions deleteRoleTemplateOptionsModel = new DeleteRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .build(); - - // Invoke deleteRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteRoleTemplate(deleteRoleTemplateOptionsModel).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, deleteRoleTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteRoleTemplate operation with and without retries enabled - @Test - public void testDeleteRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteRoleTemplateWOptions(); - } - - // Test the deleteRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteRoleTemplate(null).execute(); - } - - // Test the createRoleTemplateVersion operation with a valid options model parameter - @Test - public void testCreateRoleTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String createRoleTemplateVersionPath = "/v1/role_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateRole model - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the CreateRoleTemplateVersionOptions model - CreateRoleTemplateVersionOptions createRoleTemplateVersionOptionsModel = new CreateRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .name("testString") - .description("testString") - .role(templateRoleModel) - .committed(true) - .build(); - - // Invoke createRoleTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.createRoleTemplateVersion(createRoleTemplateVersionOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createRoleTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createRoleTemplateVersion operation with and without retries enabled - @Test - public void testCreateRoleTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateRoleTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateRoleTemplateVersionWOptions(); - } - - // Test the createRoleTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createRoleTemplateVersion(null).execute(); - } - - // Test the listRoleTemplateVersions operation with a valid options model parameter - @Test - public void testListRoleTemplateVersionsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; - String listRoleTemplateVersionsPath = "/v1/role_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListRoleTemplateVersionsOptions model - ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptionsModel = new ListRoleTemplateVersionsOptions.Builder() - .roleTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listRoleTemplateVersions() with a valid options model and verify the result - Response response = iamPolicyManagementService.listRoleTemplateVersions(listRoleTemplateVersionsOptionsModel).execute(); - assertNotNull(response); - RoleTemplateVersionsCollection 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, listRoleTemplateVersionsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listRoleTemplateVersions operation with and without retries enabled - @Test - public void testListRoleTemplateVersionsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListRoleTemplateVersionsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListRoleTemplateVersionsWOptions(); - } - - // Test the listRoleTemplateVersions operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleTemplateVersionsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listRoleTemplateVersions(null).execute(); - } - - // Test the listRoleTemplateVersions operation using the RoleTemplateVersionsPager.getNext() method - @Test - public void testListRoleTemplateVersionsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions = new ListRoleTemplateVersionsOptions.Builder() - .roleTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - RoleTemplateVersionsPager pager = new RoleTemplateVersionsPager(iamPolicyManagementService, listRoleTemplateVersionsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listRoleTemplateVersions operation using the RoleTemplateVersionsPager.getAll() method - @Test - public void testListRoleTemplateVersionsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions = new ListRoleTemplateVersionsOptions.Builder() - .roleTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - RoleTemplateVersionsPager pager = new RoleTemplateVersionsPager(iamPolicyManagementService, listRoleTemplateVersionsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the replaceRoleTemplate operation with a valid options model parameter - @Test - public void testReplaceRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String replaceRoleTemplatePath = "/v1/role_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateRole model - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the ReplaceRoleTemplateOptions model - ReplaceRoleTemplateOptions replaceRoleTemplateOptionsModel = new ReplaceRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .ifMatch("testString") - .name("testString") - .description("testString") - .role(templateRoleModel) - .committed(true) - .build(); - - // Invoke replaceRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.replaceRoleTemplate(replaceRoleTemplateOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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, replaceRoleTemplatePath); - // 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 replaceRoleTemplate operation with and without retries enabled - @Test - public void testReplaceRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplaceRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplaceRoleTemplateWOptions(); - } - - // Test the replaceRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replaceRoleTemplate(null).execute(); - } - - // Test the deleteRoleTemplateVersion operation with a valid options model parameter - @Test - public void testDeleteRoleTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteRoleTemplateVersionPath = "/v1/role_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteRoleTemplateVersionOptions model - DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptionsModel = new DeleteRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - - // Invoke deleteRoleTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteRoleTemplateVersion(deleteRoleTemplateVersionOptionsModel).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, deleteRoleTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteRoleTemplateVersion operation with and without retries enabled - @Test - public void testDeleteRoleTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteRoleTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteRoleTemplateVersionWOptions(); - } - - // Test the deleteRoleTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteRoleTemplateVersion(null).execute(); - } - - // Test the getRoleTemplateVersion operation with a valid options model parameter - @Test - public void testGetRoleTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String getRoleTemplateVersionPath = "/v1/role_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetRoleTemplateVersionOptions model - GetRoleTemplateVersionOptions getRoleTemplateVersionOptionsModel = new GetRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - - // Invoke getRoleTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.getRoleTemplateVersion(getRoleTemplateVersionOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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, getRoleTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getRoleTemplateVersion operation with and without retries enabled - @Test - public void testGetRoleTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetRoleTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetRoleTemplateVersionWOptions(); - } - - // Test the getRoleTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getRoleTemplateVersion(null).execute(); - } - - // Test the commitRoleTemplate operation with a valid options model parameter - @Test - public void testCommitRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String commitRoleTemplatePath = "/v1/role_templates/testString/versions/testString/commit"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the CommitRoleTemplateOptions model - CommitRoleTemplateOptions commitRoleTemplateOptionsModel = new CommitRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - - // Invoke commitRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.commitRoleTemplate(commitRoleTemplateOptionsModel).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, commitRoleTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the commitRoleTemplate operation with and without retries enabled - @Test - public void testCommitRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCommitRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCommitRoleTemplateWOptions(); - } - - // Test the commitRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.commitRoleTemplate(null).execute(); - } - - // Test the listRoleAssignments operation with a valid options model parameter - @Test - public void testListRoleAssignmentsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; - String listRoleAssignmentsPath = "/v1/role_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListRoleAssignmentsOptions model - ListRoleAssignmentsOptions listRoleAssignmentsOptionsModel = new ListRoleAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listRoleAssignments() with a valid options model and verify the result - Response response = iamPolicyManagementService.listRoleAssignments(listRoleAssignmentsOptionsModel).execute(); - assertNotNull(response); - RoleAssignmentCollection 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, listRoleAssignmentsPath); - // 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(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listRoleAssignments operation with and without retries enabled - @Test - public void testListRoleAssignmentsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListRoleAssignmentsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListRoleAssignmentsWOptions(); - } - - // Test the listRoleAssignments operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleAssignmentsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listRoleAssignments(null).execute(); - } - - // Test the listRoleAssignments operation using the RoleAssignmentsPager.getNext() method - @Test - public void testListRoleAssignmentsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleAssignmentsOptions listRoleAssignmentsOptions = new ListRoleAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - RoleAssignmentsPager pager = new RoleAssignmentsPager(iamPolicyManagementService, listRoleAssignmentsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listRoleAssignments operation using the RoleAssignmentsPager.getAll() method - @Test - public void testListRoleAssignmentsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleAssignmentsOptions listRoleAssignmentsOptions = new ListRoleAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - RoleAssignmentsPager pager = new RoleAssignmentsPager(iamPolicyManagementService, listRoleAssignmentsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createRoleTemplateAssignment operation with a valid options model parameter - @Test - public void testCreateRoleTemplateAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; - String createRoleTemplateAssignmentPath = "/v1/role_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the AssignmentTargetDetails model - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - - // Construct an instance of the RoleAssignmentTemplate model - RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - - // Construct an instance of the CreateRoleTemplateAssignmentOptions model - CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptionsModel = new CreateRoleTemplateAssignmentOptions.Builder() - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(roleAssignmentTemplateModel)) - .acceptLanguage("default") - .build(); - - // Invoke createRoleTemplateAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.createRoleTemplateAssignment(createRoleTemplateAssignmentOptionsModel).execute(); - assertNotNull(response); - RoleAssignmentCollection 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createRoleTemplateAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createRoleTemplateAssignment operation with and without retries enabled - @Test - public void testCreateRoleTemplateAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateRoleTemplateAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateRoleTemplateAssignmentWOptions(); - } - - // Test the createRoleTemplateAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createRoleTemplateAssignment(null).execute(); - } - - // Test the getRoleAssignment operation with a valid options model parameter - @Test - public void testGetRoleAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; - String getRoleAssignmentPath = "/v1/role_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetRoleAssignmentOptions model - GetRoleAssignmentOptions getRoleAssignmentOptionsModel = new GetRoleAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke getRoleAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.getRoleAssignment(getRoleAssignmentOptionsModel).execute(); - assertNotNull(response); - RoleAssignment 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, getRoleAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getRoleAssignment operation with and without retries enabled - @Test - public void testGetRoleAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetRoleAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetRoleAssignmentWOptions(); - } - - // Test the getRoleAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getRoleAssignment(null).execute(); - } - - // Test the updateRoleAssignment operation with a valid options model parameter - @Test - public void testUpdateRoleAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; - String updateRoleAssignmentPath = "/v1/role_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdateRoleAssignmentOptions model - UpdateRoleAssignmentOptions updateRoleAssignmentOptionsModel = new UpdateRoleAssignmentOptions.Builder() - .assignmentId("testString") - .ifMatch("testString") - .templateVersion("testString") - .build(); - - // Invoke updateRoleAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.updateRoleAssignment(updateRoleAssignmentOptionsModel).execute(); - assertNotNull(response); - RoleAssignment 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateRoleAssignmentPath); - // 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 updateRoleAssignment operation with and without retries enabled - @Test - public void testUpdateRoleAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdateRoleAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdateRoleAssignmentWOptions(); - } - - // Test the updateRoleAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateRoleAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updateRoleAssignment(null).execute(); - } - - // Test the deleteRoleAssignment operation with a valid options model parameter - @Test - public void testDeleteRoleAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteRoleAssignmentPath = "/v1/role_assignments/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteRoleAssignmentOptions model - DeleteRoleAssignmentOptions deleteRoleAssignmentOptionsModel = new DeleteRoleAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke deleteRoleAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteRoleAssignment(deleteRoleAssignmentOptionsModel).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, deleteRoleAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteRoleAssignment operation with and without retries enabled - @Test - public void testDeleteRoleAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteRoleAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteRoleAssignmentWOptions(); - } - - // Test the deleteRoleAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteRoleAssignment(null).execute(); - } - - // Perform setup needed before each test method - @BeforeMethod - public void beforeEachTest() { - // Start the mock server. - try { - server = new MockWebServer(); - server.start(); - } catch (IOException err) { - fail("Failed to instantiate mock web server"); - } - - // Construct an instance of the service - constructClientService(); - } - - // Perform tear down after each test method - @AfterMethod - public void afterEachTest() throws IOException { - server.shutdown(); - iamPolicyManagementService = null; - } - - // Constructs an instance of the service to be used by the tests - public void constructClientService() { - System.setProperty("TESTSERVICE_AUTH_TYPE", "noAuth"); - final String serviceName = "testService"; - - iamPolicyManagementService = IamPolicyManagement.newInstance(serviceName); - String url = server.url("/").toString(); - iamPolicyManagementService.setServiceUrl(url); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java deleted file mode 100644 index 5630ccb0c03..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.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 AccountSettingsAccessManagement model. - */ -public class AccountSettingsAccessManagementTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAccountSettingsAccessManagement() throws Throwable { - AccountSettingsAccessManagement accountSettingsAccessManagementModel = new AccountSettingsAccessManagement(); - assertNull(accountSettingsAccessManagementModel.getExternalAccountIdentityInteraction()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java deleted file mode 100644 index d4dfc8863c6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentCollection model. - */ -public class ActionControlAssignmentCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentCollection() throws Throwable { - ActionControlAssignmentCollection actionControlAssignmentCollectionModel = new ActionControlAssignmentCollection(); - assertNull(actionControlAssignmentCollectionModel.getLimit()); - assertNull(actionControlAssignmentCollectionModel.getFirst()); - assertNull(actionControlAssignmentCollectionModel.getNext()); - assertNull(actionControlAssignmentCollectionModel.getPrevious()); - assertNull(actionControlAssignmentCollectionModel.getAssignments()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java deleted file mode 100644 index cb53bc44d1c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResourceActionControl model. - */ -public class ActionControlAssignmentResourceActionControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentResourceActionControl() throws Throwable { - ActionControlAssignmentResourceActionControl actionControlAssignmentResourceActionControlModel = new ActionControlAssignmentResourceActionControl(); - assertNull(actionControlAssignmentResourceActionControlModel.getResourceCreated()); - assertNull(actionControlAssignmentResourceActionControlModel.getErrorMessage()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java deleted file mode 100644 index 284ec17a0f0..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResourceCreated model. - */ -public class ActionControlAssignmentResourceCreatedTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentResourceCreated() throws Throwable { - ActionControlAssignmentResourceCreated actionControlAssignmentResourceCreatedModel = new ActionControlAssignmentResourceCreated(); - assertNull(actionControlAssignmentResourceCreatedModel.getId()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java deleted file mode 100644 index eaa560dce78..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResource model. - */ -public class ActionControlAssignmentResourceTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentResource() throws Throwable { - ActionControlAssignmentResource actionControlAssignmentResourceModel = new ActionControlAssignmentResource(); - assertNull(actionControlAssignmentResourceModel.getTarget()); - assertNull(actionControlAssignmentResourceModel.getActionControl()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java deleted file mode 100644 index 262a74bea45..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentTemplate model. - */ -public class ActionControlAssignmentTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentTemplate() throws Throwable { - ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(actionControlAssignmentTemplateModel.id(), "testString"); - assertEquals(actionControlAssignmentTemplateModel.version(), "testString"); - - String json = TestUtilities.serialize(actionControlAssignmentTemplateModel); - - ActionControlAssignmentTemplate actionControlAssignmentTemplateModelNew = TestUtilities.deserialize(json, ActionControlAssignmentTemplate.class); - assertTrue(actionControlAssignmentTemplateModelNew instanceof ActionControlAssignmentTemplate); - assertEquals(actionControlAssignmentTemplateModelNew.id(), "testString"); - assertEquals(actionControlAssignmentTemplateModelNew.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testActionControlAssignmentTemplateError() throws Throwable { - new ActionControlAssignmentTemplate.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java deleted file mode 100644 index c5173f940c4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignment model. - */ -public class ActionControlAssignmentTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignment() throws Throwable { - ActionControlAssignment actionControlAssignmentModel = new ActionControlAssignment(); - assertNull(actionControlAssignmentModel.getTemplate()); - assertNull(actionControlAssignmentModel.getTarget()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java deleted file mode 100644 index 58155ee1e7e..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplateCollection model. - */ -public class ActionControlTemplateCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlTemplateCollection() throws Throwable { - ActionControlTemplateCollection actionControlTemplateCollectionModel = new ActionControlTemplateCollection(); - assertNull(actionControlTemplateCollectionModel.getLimit()); - assertNull(actionControlTemplateCollectionModel.getFirst()); - assertNull(actionControlTemplateCollectionModel.getNext()); - assertNull(actionControlTemplateCollectionModel.getPrevious()); - assertNull(actionControlTemplateCollectionModel.getActionControlTemplates()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java deleted file mode 100644 index a086106a57e..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplate model. - */ -public class ActionControlTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlTemplate() throws Throwable { - ActionControlTemplate actionControlTemplateModel = new ActionControlTemplate(); - assertNull(actionControlTemplateModel.getName()); - assertNull(actionControlTemplateModel.getDescription()); - assertNull(actionControlTemplateModel.getAccountId()); - assertNull(actionControlTemplateModel.isCommitted()); - assertNull(actionControlTemplateModel.getActionControl()); - assertNull(actionControlTemplateModel.getVersion()); - assertNull(actionControlTemplateModel.getState()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java deleted file mode 100644 index 7b6bf014357..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplateVersionsCollection model. - */ -public class ActionControlTemplateVersionsCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlTemplateVersionsCollection() throws Throwable { - ActionControlTemplateVersionsCollection actionControlTemplateVersionsCollectionModel = new ActionControlTemplateVersionsCollection(); - assertNull(actionControlTemplateVersionsCollectionModel.getLimit()); - assertNull(actionControlTemplateVersionsCollectionModel.getFirst()); - assertNull(actionControlTemplateVersionsCollectionModel.getNext()); - assertNull(actionControlTemplateVersionsCollectionModel.getPrevious()); - assertNull(actionControlTemplateVersionsCollectionModel.getVersions()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java deleted file mode 100644 index 4038d52606c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentResourceCreated model. - */ -public class AssignmentResourceCreatedTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAssignmentResourceCreated() throws Throwable { - AssignmentResourceCreated assignmentResourceCreatedModel = new AssignmentResourceCreated(); - assertNull(assignmentResourceCreatedModel.getId()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java deleted file mode 100644 index 81e3799a42c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentResourceError model. - */ -public class AssignmentResourceErrorTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAssignmentResourceError() throws Throwable { - AssignmentResourceError assignmentResourceErrorModel = new AssignmentResourceError(); - assertNull(assignmentResourceErrorModel.getName()); - assertNull(assignmentResourceErrorModel.getErrorCode()); - assertNull(assignmentResourceErrorModel.getMessage()); - assertNull(assignmentResourceErrorModel.getCode()); - assertNull(assignmentResourceErrorModel.getErrors()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java deleted file mode 100644 index 48e4a605cbb..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentTargetDetails model. - */ -public class AssignmentTargetDetailsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAssignmentTargetDetails() throws Throwable { - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - assertEquals(assignmentTargetDetailsModel.type(), "Account"); - assertEquals(assignmentTargetDetailsModel.id(), "testString"); - - String json = TestUtilities.serialize(assignmentTargetDetailsModel); - - AssignmentTargetDetails assignmentTargetDetailsModelNew = TestUtilities.deserialize(json, AssignmentTargetDetails.class); - assertTrue(assignmentTargetDetailsModelNew instanceof AssignmentTargetDetails); - assertEquals(assignmentTargetDetailsModelNew.type(), "Account"); - assertEquals(assignmentTargetDetailsModelNew.id(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testAssignmentTargetDetailsError() throws Throwable { - new AssignmentTargetDetails.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java deleted file mode 100644 index bcecf27ed27..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentTemplateDetails model. - */ -public class AssignmentTemplateDetailsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAssignmentTemplateDetails() throws Throwable { - AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(assignmentTemplateDetailsModel.id(), "testString"); - assertEquals(assignmentTemplateDetailsModel.version(), "testString"); - - String json = TestUtilities.serialize(assignmentTemplateDetailsModel); - - AssignmentTemplateDetails assignmentTemplateDetailsModelNew = TestUtilities.deserialize(json, AssignmentTemplateDetails.class); - assertTrue(assignmentTemplateDetailsModelNew instanceof AssignmentTemplateDetails); - assertEquals(assignmentTemplateDetailsModelNew.id(), "testString"); - assertEquals(assignmentTemplateDetailsModelNew.version(), "testString"); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java deleted file mode 100644 index 2b5ed42c76a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CommitActionControlTemplateOptions model. - */ -public class CommitActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCommitActionControlTemplateOptions() throws Throwable { - CommitActionControlTemplateOptions commitActionControlTemplateOptionsModel = new CommitActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - assertEquals(commitActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(commitActionControlTemplateOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitActionControlTemplateOptionsError() throws Throwable { - new CommitActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java deleted file mode 100644 index 66cdca59588..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CommitPolicyTemplateOptions model. - */ -public class CommitPolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCommitPolicyTemplateOptions() throws Throwable { - CommitPolicyTemplateOptions commitPolicyTemplateOptionsModel = new CommitPolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - assertEquals(commitPolicyTemplateOptionsModel.policyTemplateId(), "testString"); - assertEquals(commitPolicyTemplateOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitPolicyTemplateOptionsError() throws Throwable { - new CommitPolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java deleted file mode 100644 index 09c48b8e80e..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CommitRoleTemplateOptions model. - */ -public class CommitRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCommitRoleTemplateOptions() throws Throwable { - CommitRoleTemplateOptions commitRoleTemplateOptionsModel = new CommitRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - assertEquals(commitRoleTemplateOptionsModel.roleTemplateId(), "testString"); - assertEquals(commitRoleTemplateOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitRoleTemplateOptionsError() throws Throwable { - new CommitRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java deleted file mode 100644 index 94ef6ce21e8..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.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 ConflictsWith model. - */ -public class ConflictsWithTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testConflictsWith() throws Throwable { - ConflictsWith conflictsWithModel = new ConflictsWith(); - assertNull(conflictsWithModel.getEtag()); - assertNull(conflictsWithModel.getRole()); - assertNull(conflictsWithModel.getPolicy()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java deleted file mode 100644 index bbe19a7b9b1..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponseControl model. - */ -public class ControlResponseControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testControlResponseControl() throws Throwable { - ControlResponseControl controlResponseControlModel = new ControlResponseControl(); - assertNull(controlResponseControlModel.getGrant()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java deleted file mode 100644 index 7b2fbfae90d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControlWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponseControlWithEnrichedRoles model. - */ -public class ControlResponseControlWithEnrichedRolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testControlResponseControlWithEnrichedRoles() throws Throwable { - ControlResponseControlWithEnrichedRoles controlResponseControlWithEnrichedRolesModel = new ControlResponseControlWithEnrichedRoles(); - assertNull(controlResponseControlWithEnrichedRolesModel.getGrant()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java deleted file mode 100644 index f42cbc0a2d8..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponse; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponse model. - */ -public class ControlResponseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testControlResponse() throws Throwable { - ControlResponse controlResponseModel = new ControlResponse(); - assertNotNull(controlResponseModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java deleted file mode 100644 index c8b1e3000f9..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 Control model. - */ -public class ControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testControl() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); - - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - assertEquals(controlModel.grant(), grantModel); - - String json = TestUtilities.serialize(controlModel); - - Control controlModelNew = TestUtilities.deserialize(json, Control.class); - assertTrue(controlModelNew instanceof Control); - assertEquals(controlModelNew.grant().toString(), grantModel.toString()); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testControlError() throws Throwable { - new Control.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java deleted file mode 100644 index f2557c8f64f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateAssignmentOptions model. - */ -public class CreateActionControlTemplateAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateActionControlTemplateAssignmentOptions() throws Throwable { - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - assertEquals(assignmentTargetDetailsModel.type(), "Account"); - assertEquals(assignmentTargetDetailsModel.id(), "testString"); - - ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(actionControlAssignmentTemplateModel.id(), "testString"); - assertEquals(actionControlAssignmentTemplateModel.version(), "testString"); - - CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptionsModel = new CreateActionControlTemplateAssignmentOptions.Builder() - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(actionControlAssignmentTemplateModel)) - .acceptLanguage("default") - .build(); - assertEquals(createActionControlTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); - assertEquals(createActionControlTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(actionControlAssignmentTemplateModel)); - assertEquals(createActionControlTemplateAssignmentOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateAssignmentOptionsError() throws Throwable { - new CreateActionControlTemplateAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java deleted file mode 100644 index 2508072a03c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateOptions model. - */ -public class CreateActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateActionControlTemplateOptions() throws Throwable { - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateActionControlModel.serviceName(), "testString"); - assertEquals(templateActionControlModel.description(), "testString"); - assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); - - CreateActionControlTemplateOptions createActionControlTemplateOptionsModel = new CreateActionControlTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .description("testString") - .committed(true) - .actionControl(templateActionControlModel) - .acceptLanguage("default") - .build(); - assertEquals(createActionControlTemplateOptionsModel.name(), "testString"); - assertEquals(createActionControlTemplateOptionsModel.accountId(), "testString"); - assertEquals(createActionControlTemplateOptionsModel.description(), "testString"); - assertEquals(createActionControlTemplateOptionsModel.committed(), Boolean.valueOf(true)); - assertEquals(createActionControlTemplateOptionsModel.actionControl(), templateActionControlModel); - assertEquals(createActionControlTemplateOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateOptionsError() throws Throwable { - new CreateActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java deleted file mode 100644 index d5070249115..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateVersionOptions model. - */ -public class CreateActionControlTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateActionControlTemplateVersionOptions() throws Throwable { - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateActionControlModel.serviceName(), "testString"); - assertEquals(templateActionControlModel.description(), "testString"); - assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); - - CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptionsModel = new CreateActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .name("testString") - .description("testString") - .actionControl(templateActionControlModel) - .committed(true) - .build(); - assertEquals(createActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(createActionControlTemplateVersionOptionsModel.name(), "testString"); - assertEquals(createActionControlTemplateVersionOptionsModel.description(), "testString"); - assertEquals(createActionControlTemplateVersionOptionsModel.actionControl(), templateActionControlModel); - assertEquals(createActionControlTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateVersionOptionsError() throws Throwable { - new CreateActionControlTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java deleted file mode 100644 index c2dd24fd213..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyOptions model. - */ -public class CreatePolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreatePolicyOptions() throws Throwable { - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - assertEquals(subjectAttributeModel.name(), "testString"); - assertEquals(subjectAttributeModel.value(), "testString"); - - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); - - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - assertEquals(policyRoleModel.roleId(), "testString"); - - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceAttributeModel.name(), "testString"); - assertEquals(resourceAttributeModel.value(), "testString"); - assertEquals(resourceAttributeModel.operator(), "testString"); - - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceTagModel.name(), "testString"); - assertEquals(resourceTagModel.value(), "testString"); - assertEquals(resourceTagModel.operator(), "testString"); - - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); - assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); - - CreatePolicyOptions createPolicyOptionsModel = new CreatePolicyOptions.Builder() - .type("testString") - .subjects(java.util.Arrays.asList(policySubjectModel)) - .roles(java.util.Arrays.asList(policyRoleModel)) - .resources(java.util.Arrays.asList(policyResourceModel)) - .description("testString") - .acceptLanguage("default") - .build(); - assertEquals(createPolicyOptionsModel.type(), "testString"); - assertEquals(createPolicyOptionsModel.subjects(), java.util.Arrays.asList(policySubjectModel)); - assertEquals(createPolicyOptionsModel.roles(), java.util.Arrays.asList(policyRoleModel)); - assertEquals(createPolicyOptionsModel.resources(), java.util.Arrays.asList(policyResourceModel)); - assertEquals(createPolicyOptionsModel.description(), "testString"); - assertEquals(createPolicyOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyOptionsError() throws Throwable { - new CreatePolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java deleted file mode 100644 index 5b08b4b398a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateAssignmentOptions model. - */ -public class CreatePolicyTemplateAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreatePolicyTemplateAssignmentOptions() throws Throwable { - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - assertEquals(assignmentTargetDetailsModel.type(), "Account"); - assertEquals(assignmentTargetDetailsModel.id(), "testString"); - - AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(assignmentTemplateDetailsModel.id(), "testString"); - assertEquals(assignmentTemplateDetailsModel.version(), "testString"); - - CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptionsModel = new CreatePolicyTemplateAssignmentOptions.Builder() - .version("1.0") - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(assignmentTemplateDetailsModel)) - .acceptLanguage("default") - .build(); - assertEquals(createPolicyTemplateAssignmentOptionsModel.version(), "1.0"); - assertEquals(createPolicyTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); - assertEquals(createPolicyTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(assignmentTemplateDetailsModel)); - assertEquals(createPolicyTemplateAssignmentOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateAssignmentOptionsError() throws Throwable { - new CreatePolicyTemplateAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java deleted file mode 100644 index 68617451831..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateOptions model. - */ -public class CreatePolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreatePolicyTemplateOptions() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - assertEquals(templatePolicyModel.type(), "access"); - assertEquals(templatePolicyModel.description(), "testString"); - assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); - assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); - assertEquals(templatePolicyModel.pattern(), "testString"); - assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), templateControlModel); - - CreatePolicyTemplateOptions createPolicyTemplateOptionsModel = new CreatePolicyTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .policy(templatePolicyModel) - .description("testString") - .committed(true) - .acceptLanguage("default") - .build(); - assertEquals(createPolicyTemplateOptionsModel.name(), "testString"); - assertEquals(createPolicyTemplateOptionsModel.accountId(), "testString"); - assertEquals(createPolicyTemplateOptionsModel.policy(), templatePolicyModel); - assertEquals(createPolicyTemplateOptionsModel.description(), "testString"); - assertEquals(createPolicyTemplateOptionsModel.committed(), Boolean.valueOf(true)); - assertEquals(createPolicyTemplateOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateOptionsError() throws Throwable { - new CreatePolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java deleted file mode 100644 index d6919e6e1b9..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateVersionOptions model. - */ -public class CreatePolicyTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreatePolicyTemplateVersionOptions() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - assertEquals(templatePolicyModel.type(), "access"); - assertEquals(templatePolicyModel.description(), "testString"); - assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); - assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); - assertEquals(templatePolicyModel.pattern(), "testString"); - assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), templateControlModel); - - CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptionsModel = new CreatePolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .policy(templatePolicyModel) - .name("testString") - .description("testString") - .committed(true) - .build(); - assertEquals(createPolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); - assertEquals(createPolicyTemplateVersionOptionsModel.policy(), templatePolicyModel); - assertEquals(createPolicyTemplateVersionOptionsModel.name(), "testString"); - assertEquals(createPolicyTemplateVersionOptionsModel.description(), "testString"); - assertEquals(createPolicyTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateVersionOptionsError() throws Throwable { - new CreatePolicyTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java deleted file mode 100644 index 849512f2bda..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleOptions model. - */ -public class CreateRoleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateRoleOptions() throws Throwable { - CreateRoleOptions createRoleOptionsModel = new CreateRoleOptions.Builder() - .displayName("testString") - .actions(java.util.Arrays.asList("testString")) - .name("Developer") - .accountId("testString") - .serviceName("iam-groups") - .description("testString") - .acceptLanguage("default") - .build(); - assertEquals(createRoleOptionsModel.displayName(), "testString"); - assertEquals(createRoleOptionsModel.actions(), java.util.Arrays.asList("testString")); - assertEquals(createRoleOptionsModel.name(), "Developer"); - assertEquals(createRoleOptionsModel.accountId(), "testString"); - assertEquals(createRoleOptionsModel.serviceName(), "iam-groups"); - assertEquals(createRoleOptionsModel.description(), "testString"); - assertEquals(createRoleOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleOptionsError() throws Throwable { - new CreateRoleOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java deleted file mode 100644 index bff414389a5..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateAssignmentOptions model. - */ -public class CreateRoleTemplateAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateRoleTemplateAssignmentOptions() throws Throwable { - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - assertEquals(assignmentTargetDetailsModel.type(), "Account"); - assertEquals(assignmentTargetDetailsModel.id(), "testString"); - - RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(roleAssignmentTemplateModel.id(), "testString"); - assertEquals(roleAssignmentTemplateModel.version(), "testString"); - - CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptionsModel = new CreateRoleTemplateAssignmentOptions.Builder() - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(roleAssignmentTemplateModel)) - .acceptLanguage("default") - .build(); - assertEquals(createRoleTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); - assertEquals(createRoleTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(roleAssignmentTemplateModel)); - assertEquals(createRoleTemplateAssignmentOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateAssignmentOptionsError() throws Throwable { - new CreateRoleTemplateAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java deleted file mode 100644 index 799743ddbf4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateOptions model. - */ -public class CreateRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateRoleTemplateOptions() throws Throwable { - RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() - .name("testString") - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(roleTemplatePrototypeRoleModel.name(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.displayName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.serviceName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.description(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.actions(), java.util.Arrays.asList("testString")); - - CreateRoleTemplateOptions createRoleTemplateOptionsModel = new CreateRoleTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .description("testString") - .committed(true) - .role(roleTemplatePrototypeRoleModel) - .acceptLanguage("default") - .build(); - assertEquals(createRoleTemplateOptionsModel.name(), "testString"); - assertEquals(createRoleTemplateOptionsModel.accountId(), "testString"); - assertEquals(createRoleTemplateOptionsModel.description(), "testString"); - assertEquals(createRoleTemplateOptionsModel.committed(), Boolean.valueOf(true)); - assertEquals(createRoleTemplateOptionsModel.role(), roleTemplatePrototypeRoleModel); - assertEquals(createRoleTemplateOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateOptionsError() throws Throwable { - new CreateRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java deleted file mode 100644 index a7d2d312afa..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateVersionOptions model. - */ -public class CreateRoleTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateRoleTemplateVersionOptions() throws Throwable { - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateRoleModel.displayName(), "testString"); - assertEquals(templateRoleModel.serviceName(), "testString"); - assertEquals(templateRoleModel.description(), "testString"); - assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); - - CreateRoleTemplateVersionOptions createRoleTemplateVersionOptionsModel = new CreateRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .name("testString") - .description("testString") - .role(templateRoleModel) - .committed(true) - .build(); - assertEquals(createRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); - assertEquals(createRoleTemplateVersionOptionsModel.name(), "testString"); - assertEquals(createRoleTemplateVersionOptionsModel.description(), "testString"); - assertEquals(createRoleTemplateVersionOptionsModel.role(), templateRoleModel); - assertEquals(createRoleTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateVersionOptionsError() throws Throwable { - new CreateRoleTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java deleted file mode 100644 index acce8b7b537..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateV2PolicyOptions model. - */ -public class CreateV2PolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateV2PolicyOptions() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); - - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - assertEquals(controlModel.grant(), grantModel); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - CreateV2PolicyOptions createV2PolicyOptionsModel = new CreateV2PolicyOptions.Builder() - .control(controlModel) - .type("access") - .description("testString") - .subject(v2PolicySubjectModel) - .resource(v2PolicyResourceModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .acceptLanguage("default") - .build(); - assertEquals(createV2PolicyOptionsModel.control(), controlModel); - assertEquals(createV2PolicyOptionsModel.type(), "access"); - assertEquals(createV2PolicyOptionsModel.description(), "testString"); - assertEquals(createV2PolicyOptionsModel.subject(), v2PolicySubjectModel); - assertEquals(createV2PolicyOptionsModel.resource(), v2PolicyResourceModel); - assertEquals(createV2PolicyOptionsModel.pattern(), "testString"); - assertEquals(createV2PolicyOptionsModel.rule(), v2PolicyRuleModel); - assertEquals(createV2PolicyOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateV2PolicyOptionsError() throws Throwable { - new CreateV2PolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java deleted file mode 100644 index acc0dc0a3c1..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 CustomRole model. - */ -public class CustomRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCustomRole() throws Throwable { - CustomRole customRoleModel = new CustomRole(); - assertNull(customRoleModel.getDisplayName()); - assertNull(customRoleModel.getDescription()); - assertNull(customRoleModel.getActions()); - assertNull(customRoleModel.getName()); - assertNull(customRoleModel.getAccountId()); - assertNull(customRoleModel.getServiceName()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java deleted file mode 100644 index 1a38606ede5..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlAssignmentOptions model. - */ -public class DeleteActionControlAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteActionControlAssignmentOptions() throws Throwable { - DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptionsModel = new DeleteActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(deleteActionControlAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlAssignmentOptionsError() throws Throwable { - new DeleteActionControlAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java deleted file mode 100644 index 75b111e9214..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlTemplateOptions model. - */ -public class DeleteActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteActionControlTemplateOptions() throws Throwable { - DeleteActionControlTemplateOptions deleteActionControlTemplateOptionsModel = new DeleteActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .build(); - assertEquals(deleteActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlTemplateOptionsError() throws Throwable { - new DeleteActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java deleted file mode 100644 index 64fb5790244..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlTemplateVersionOptions model. - */ -public class DeleteActionControlTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteActionControlTemplateVersionOptions() throws Throwable { - DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptionsModel = new DeleteActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - assertEquals(deleteActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(deleteActionControlTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlTemplateVersionOptionsError() throws Throwable { - new DeleteActionControlTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java deleted file mode 100644 index 75aed905222..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyAssignmentOptions model. - */ -public class DeletePolicyAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeletePolicyAssignmentOptions() throws Throwable { - DeletePolicyAssignmentOptions deletePolicyAssignmentOptionsModel = new DeletePolicyAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(deletePolicyAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyAssignmentOptionsError() throws Throwable { - new DeletePolicyAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java deleted file mode 100644 index 1b130eb0f79..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyOptions model. - */ -public class DeletePolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeletePolicyOptions() throws Throwable { - DeletePolicyOptions deletePolicyOptionsModel = new DeletePolicyOptions.Builder() - .policyId("testString") - .build(); - assertEquals(deletePolicyOptionsModel.policyId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyOptionsError() throws Throwable { - new DeletePolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java deleted file mode 100644 index 288517222aa..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyTemplateOptions model. - */ -public class DeletePolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeletePolicyTemplateOptions() throws Throwable { - DeletePolicyTemplateOptions deletePolicyTemplateOptionsModel = new DeletePolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .build(); - assertEquals(deletePolicyTemplateOptionsModel.policyTemplateId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyTemplateOptionsError() throws Throwable { - new DeletePolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java deleted file mode 100644 index 7b1c6cffa1d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyTemplateVersionOptions model. - */ -public class DeletePolicyTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeletePolicyTemplateVersionOptions() throws Throwable { - DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptionsModel = new DeletePolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - assertEquals(deletePolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); - assertEquals(deletePolicyTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyTemplateVersionOptionsError() throws Throwable { - new DeletePolicyTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java deleted file mode 100644 index 7f9b614304f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleAssignmentOptions model. - */ -public class DeleteRoleAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteRoleAssignmentOptions() throws Throwable { - DeleteRoleAssignmentOptions deleteRoleAssignmentOptionsModel = new DeleteRoleAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(deleteRoleAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleAssignmentOptionsError() throws Throwable { - new DeleteRoleAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java deleted file mode 100644 index 9c6690cda7b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleOptions model. - */ -public class DeleteRoleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteRoleOptions() throws Throwable { - DeleteRoleOptions deleteRoleOptionsModel = new DeleteRoleOptions.Builder() - .roleId("testString") - .build(); - assertEquals(deleteRoleOptionsModel.roleId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleOptionsError() throws Throwable { - new DeleteRoleOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java deleted file mode 100644 index 3fc04286ed3..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleTemplateOptions model. - */ -public class DeleteRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteRoleTemplateOptions() throws Throwable { - DeleteRoleTemplateOptions deleteRoleTemplateOptionsModel = new DeleteRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .build(); - assertEquals(deleteRoleTemplateOptionsModel.roleTemplateId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleTemplateOptionsError() throws Throwable { - new DeleteRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java deleted file mode 100644 index ff652fa335c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleTemplateVersionOptions model. - */ -public class DeleteRoleTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteRoleTemplateVersionOptions() throws Throwable { - DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptionsModel = new DeleteRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - assertEquals(deleteRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); - assertEquals(deleteRoleTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleTemplateVersionOptionsError() throws Throwable { - new DeleteRoleTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java deleted file mode 100644 index 6a33aa8f116..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteV2PolicyOptions model. - */ -public class DeleteV2PolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteV2PolicyOptions() throws Throwable { - DeleteV2PolicyOptions deleteV2PolicyOptionsModel = new DeleteV2PolicyOptions.Builder() - .id("testString") - .build(); - assertEquals(deleteV2PolicyOptionsModel.id(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteV2PolicyOptionsError() throws Throwable { - new DeleteV2PolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java deleted file mode 100644 index 104a5210ed9..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.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 EnrichedRoles model. - */ -public class EnrichedRolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testEnrichedRoles() throws Throwable { - EnrichedRoles enrichedRolesModel = new EnrichedRoles(); - assertNull(enrichedRolesModel.getRoleId()); - assertNull(enrichedRolesModel.getActions()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java deleted file mode 100644 index 460b37f8105..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.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 ErrorDetails model. - */ -public class ErrorDetailsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testErrorDetails() throws Throwable { - ErrorDetails errorDetailsModel = new ErrorDetails(); - assertNull(errorDetailsModel.getConflictsWith()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java deleted file mode 100644 index e7f7f9afbfc..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.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 ErrorObject model. - */ -public class ErrorObjectTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testErrorObject() throws Throwable { - ErrorObject errorObjectModel = new ErrorObject(); - assertNull(errorObjectModel.getCode()); - assertNull(errorObjectModel.getMessage()); - assertNull(errorObjectModel.getDetails()); - assertNull(errorObjectModel.getMoreInfo()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java deleted file mode 100644 index 90c91c8fcaf..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; -import com.ibm.cloud.platform_services.iam_policy_management.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 ExternalAccountIdentityInteractionPatch model. - */ -public class ExternalAccountIdentityInteractionPatchTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testExternalAccountIdentityInteractionPatch() throws Throwable { - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - assertEquals(identityTypesBaseModel.state(), "enabled"); - assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); - - IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() - .user(identityTypesBaseModel) - .serviceId(identityTypesBaseModel) - .service(identityTypesBaseModel) - .build(); - assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); - - ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() - .identityTypes(identityTypesPatchModel) - .build(); - assertEquals(externalAccountIdentityInteractionPatchModel.identityTypes(), identityTypesPatchModel); - - String json = TestUtilities.serialize(externalAccountIdentityInteractionPatchModel); - - ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModelNew = TestUtilities.deserialize(json, ExternalAccountIdentityInteractionPatch.class); - assertTrue(externalAccountIdentityInteractionPatchModelNew instanceof ExternalAccountIdentityInteractionPatch); - assertEquals(externalAccountIdentityInteractionPatchModelNew.identityTypes().toString(), identityTypesPatchModel.toString()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java deleted file mode 100644 index 2e4aaef7e07..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.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 ExternalAccountIdentityInteraction model. - */ -public class ExternalAccountIdentityInteractionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testExternalAccountIdentityInteraction() throws Throwable { - ExternalAccountIdentityInteraction externalAccountIdentityInteractionModel = new ExternalAccountIdentityInteraction(); - assertNull(externalAccountIdentityInteractionModel.getIdentityTypes()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java deleted file mode 100644 index b4d68673091..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.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 First model. - */ -public class FirstTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testFirst() throws Throwable { - First firstModel = new First(); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java deleted file mode 100644 index 73e66a5a756..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlAssignmentOptions model. - */ -public class GetActionControlAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetActionControlAssignmentOptions() throws Throwable { - GetActionControlAssignmentOptions getActionControlAssignmentOptionsModel = new GetActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(getActionControlAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlAssignmentOptionsError() throws Throwable { - new GetActionControlAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java deleted file mode 100644 index d6e66ce6939..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlTemplateOptions model. - */ -public class GetActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetActionControlTemplateOptions() throws Throwable { - GetActionControlTemplateOptions getActionControlTemplateOptionsModel = new GetActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .build(); - assertEquals(getActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(getActionControlTemplateOptionsModel.state(), "active"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlTemplateOptionsError() throws Throwable { - new GetActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java deleted file mode 100644 index ac8e17fe083..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlTemplateVersionOptions model. - */ -public class GetActionControlTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetActionControlTemplateVersionOptions() throws Throwable { - GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptionsModel = new GetActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - assertEquals(getActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(getActionControlTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlTemplateVersionOptionsError() throws Throwable { - new GetActionControlTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java deleted file mode 100644 index 6b2a479c37d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyAssignmentOptions model. - */ -public class GetPolicyAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetPolicyAssignmentOptions() throws Throwable { - GetPolicyAssignmentOptions getPolicyAssignmentOptionsModel = new GetPolicyAssignmentOptions.Builder() - .assignmentId("testString") - .version("1.0") - .build(); - assertEquals(getPolicyAssignmentOptionsModel.assignmentId(), "testString"); - assertEquals(getPolicyAssignmentOptionsModel.version(), "1.0"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyAssignmentOptionsError() throws Throwable { - new GetPolicyAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java deleted file mode 100644 index 2a7348c2c2d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyOptions model. - */ -public class GetPolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetPolicyOptions() throws Throwable { - GetPolicyOptions getPolicyOptionsModel = new GetPolicyOptions.Builder() - .policyId("testString") - .build(); - assertEquals(getPolicyOptionsModel.policyId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyOptionsError() throws Throwable { - new GetPolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java deleted file mode 100644 index 06535ed77ed..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyTemplateOptions model. - */ -public class GetPolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetPolicyTemplateOptions() throws Throwable { - GetPolicyTemplateOptions getPolicyTemplateOptionsModel = new GetPolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .state("active") - .build(); - assertEquals(getPolicyTemplateOptionsModel.policyTemplateId(), "testString"); - assertEquals(getPolicyTemplateOptionsModel.state(), "active"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyTemplateOptionsError() throws Throwable { - new GetPolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java deleted file mode 100644 index 264b5db4912..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyTemplateVersionOptions model. - */ -public class GetPolicyTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetPolicyTemplateVersionOptions() throws Throwable { - GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptionsModel = new GetPolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - assertEquals(getPolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); - assertEquals(getPolicyTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyTemplateVersionOptionsError() throws Throwable { - new GetPolicyTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java deleted file mode 100644 index 0c1f6b2bb5a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleAssignmentOptions model. - */ -public class GetRoleAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetRoleAssignmentOptions() throws Throwable { - GetRoleAssignmentOptions getRoleAssignmentOptionsModel = new GetRoleAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(getRoleAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleAssignmentOptionsError() throws Throwable { - new GetRoleAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java deleted file mode 100644 index e589b8d1285..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleOptions model. - */ -public class GetRoleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetRoleOptions() throws Throwable { - GetRoleOptions getRoleOptionsModel = new GetRoleOptions.Builder() - .roleId("testString") - .build(); - assertEquals(getRoleOptionsModel.roleId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleOptionsError() throws Throwable { - new GetRoleOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java deleted file mode 100644 index 3c10b5207dc..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleTemplateOptions model. - */ -public class GetRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetRoleTemplateOptions() throws Throwable { - GetRoleTemplateOptions getRoleTemplateOptionsModel = new GetRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .state("active") - .build(); - assertEquals(getRoleTemplateOptionsModel.roleTemplateId(), "testString"); - assertEquals(getRoleTemplateOptionsModel.state(), "active"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleTemplateOptionsError() throws Throwable { - new GetRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java deleted file mode 100644 index 3bd5d278630..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleTemplateVersionOptions model. - */ -public class GetRoleTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetRoleTemplateVersionOptions() throws Throwable { - GetRoleTemplateVersionOptions getRoleTemplateVersionOptionsModel = new GetRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - assertEquals(getRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); - assertEquals(getRoleTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleTemplateVersionOptionsError() throws Throwable { - new GetRoleTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java deleted file mode 100644 index 00f780c4153..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetSettingsOptions model. - */ -public class GetSettingsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetSettingsOptions() throws Throwable { - GetSettingsOptions getSettingsOptionsModel = new GetSettingsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .build(); - assertEquals(getSettingsOptionsModel.accountId(), "testString"); - assertEquals(getSettingsOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetSettingsOptionsError() throws Throwable { - new GetSettingsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java deleted file mode 100644 index ebad7af7371..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetV2PolicyOptions model. - */ -public class GetV2PolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetV2PolicyOptions() throws Throwable { - GetV2PolicyOptions getV2PolicyOptionsModel = new GetV2PolicyOptions.Builder() - .id("testString") - .format("include_last_permit") - .build(); - assertEquals(getV2PolicyOptionsModel.id(), "testString"); - assertEquals(getV2PolicyOptionsModel.format(), "include_last_permit"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetV2PolicyOptionsError() throws Throwable { - new GetV2PolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java deleted file mode 100644 index f627a54ecc2..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 Grant model. - */ -public class GrantTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGrant() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); - - String json = TestUtilities.serialize(grantModel); - - Grant grantModelNew = TestUtilities.deserialize(json, Grant.class); - assertTrue(grantModelNew instanceof Grant); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGrantError() throws Throwable { - new Grant.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java deleted file mode 100644 index f86af34fab8..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.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 GrantWithEnrichedRoles model. - */ -public class GrantWithEnrichedRolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGrantWithEnrichedRoles() throws Throwable { - GrantWithEnrichedRoles grantWithEnrichedRolesModel = new GrantWithEnrichedRoles(); - assertNull(grantWithEnrichedRolesModel.getRoles()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java deleted file mode 100644 index 2a4d38de51a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypesBase model. - */ -public class IdentityTypesBaseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testIdentityTypesBase() throws Throwable { - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - assertEquals(identityTypesBaseModel.state(), "enabled"); - assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(identityTypesBaseModel); - - IdentityTypesBase identityTypesBaseModelNew = TestUtilities.deserialize(json, IdentityTypesBase.class); - assertTrue(identityTypesBaseModelNew instanceof IdentityTypesBase); - assertEquals(identityTypesBaseModelNew.state(), "enabled"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testIdentityTypesBaseError() throws Throwable { - new IdentityTypesBase.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java deleted file mode 100644 index 3e762536695..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; -import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypesPatch model. - */ -public class IdentityTypesPatchTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testIdentityTypesPatch() throws Throwable { - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - assertEquals(identityTypesBaseModel.state(), "enabled"); - assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); - - IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() - .user(identityTypesBaseModel) - .serviceId(identityTypesBaseModel) - .service(identityTypesBaseModel) - .build(); - assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); - - String json = TestUtilities.serialize(identityTypesPatchModel); - - IdentityTypesPatch identityTypesPatchModelNew = TestUtilities.deserialize(json, IdentityTypesPatch.class); - assertTrue(identityTypesPatchModelNew instanceof IdentityTypesPatch); - assertEquals(identityTypesPatchModelNew.user().toString(), identityTypesBaseModel.toString()); - assertEquals(identityTypesPatchModelNew.serviceId().toString(), identityTypesBaseModel.toString()); - assertEquals(identityTypesPatchModelNew.service().toString(), identityTypesBaseModel.toString()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java deleted file mode 100644 index e2b6c77338f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypes model. - */ -public class IdentityTypesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testIdentityTypes() throws Throwable { - IdentityTypes identityTypesModel = new IdentityTypes(); - assertNull(identityTypesModel.getUser()); - assertNull(identityTypesModel.getServiceId()); - assertNull(identityTypesModel.getService()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java deleted file mode 100644 index c3f51516e25..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; -import com.ibm.cloud.platform_services.iam_policy_management.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 LimitData model. - */ -public class LimitDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testLimitData() throws Throwable { - LimitData limitDataModel = new LimitData(); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java deleted file mode 100644 index 0d64653d829..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlAssignmentsOptions model. - */ -public class ListActionControlAssignmentsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListActionControlAssignmentsOptions() throws Throwable { - ListActionControlAssignmentsOptions listActionControlAssignmentsOptionsModel = new ListActionControlAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listActionControlAssignmentsOptionsModel.accountId(), "testString"); - assertEquals(listActionControlAssignmentsOptionsModel.acceptLanguage(), "default"); - assertEquals(listActionControlAssignmentsOptionsModel.templateId(), "testString"); - assertEquals(listActionControlAssignmentsOptionsModel.templateVersion(), "testString"); - assertEquals(listActionControlAssignmentsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listActionControlAssignmentsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlAssignmentsOptionsError() throws Throwable { - new ListActionControlAssignmentsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java deleted file mode 100644 index dfe91662d83..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlTemplateVersionsOptions model. - */ -public class ListActionControlTemplateVersionsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListActionControlTemplateVersionsOptions() throws Throwable { - ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptionsModel = new ListActionControlTemplateVersionsOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listActionControlTemplateVersionsOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(listActionControlTemplateVersionsOptionsModel.state(), "active"); - assertEquals(listActionControlTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listActionControlTemplateVersionsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlTemplateVersionsOptionsError() throws Throwable { - new ListActionControlTemplateVersionsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java deleted file mode 100644 index 9e2e6a18158..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlTemplatesOptions model. - */ -public class ListActionControlTemplatesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListActionControlTemplatesOptions() throws Throwable { - ListActionControlTemplatesOptions listActionControlTemplatesOptionsModel = new ListActionControlTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listActionControlTemplatesOptionsModel.accountId(), "testString"); - assertEquals(listActionControlTemplatesOptionsModel.acceptLanguage(), "default"); - assertEquals(listActionControlTemplatesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listActionControlTemplatesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlTemplatesOptionsError() throws Throwable { - new ListActionControlTemplatesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java deleted file mode 100644 index 8bfe5000355..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListPoliciesOptions model. - */ -public class ListPoliciesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListPoliciesOptions() throws Throwable { - ListPoliciesOptions listPoliciesOptionsModel = new ListPoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .tagName("testString") - .tagValue("testString") - .sort("id") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listPoliciesOptionsModel.accountId(), "testString"); - assertEquals(listPoliciesOptionsModel.acceptLanguage(), "default"); - assertEquals(listPoliciesOptionsModel.iamId(), "testString"); - assertEquals(listPoliciesOptionsModel.accessGroupId(), "testString"); - assertEquals(listPoliciesOptionsModel.type(), "access"); - assertEquals(listPoliciesOptionsModel.serviceType(), "service"); - assertEquals(listPoliciesOptionsModel.tagName(), "testString"); - assertEquals(listPoliciesOptionsModel.tagValue(), "testString"); - assertEquals(listPoliciesOptionsModel.sort(), "id"); - assertEquals(listPoliciesOptionsModel.format(), "include_last_permit"); - assertEquals(listPoliciesOptionsModel.state(), "active"); - assertEquals(listPoliciesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listPoliciesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPoliciesOptionsError() throws Throwable { - new ListPoliciesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java deleted file mode 100644 index 32729befeda..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyAssignmentsOptions model. - */ -public class ListPolicyAssignmentsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListPolicyAssignmentsOptions() throws Throwable { - ListPolicyAssignmentsOptions listPolicyAssignmentsOptionsModel = new ListPolicyAssignmentsOptions.Builder() - .version("1.0") - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listPolicyAssignmentsOptionsModel.version(), "1.0"); - assertEquals(listPolicyAssignmentsOptionsModel.accountId(), "testString"); - assertEquals(listPolicyAssignmentsOptionsModel.acceptLanguage(), "default"); - assertEquals(listPolicyAssignmentsOptionsModel.templateId(), "testString"); - assertEquals(listPolicyAssignmentsOptionsModel.templateVersion(), "testString"); - assertEquals(listPolicyAssignmentsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listPolicyAssignmentsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyAssignmentsOptionsError() throws Throwable { - new ListPolicyAssignmentsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java deleted file mode 100644 index 1053d41b84b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyTemplateVersionsOptions model. - */ -public class ListPolicyTemplateVersionsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListPolicyTemplateVersionsOptions() throws Throwable { - ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptionsModel = new ListPolicyTemplateVersionsOptions.Builder() - .policyTemplateId("testString") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listPolicyTemplateVersionsOptionsModel.policyTemplateId(), "testString"); - assertEquals(listPolicyTemplateVersionsOptionsModel.state(), "active"); - assertEquals(listPolicyTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listPolicyTemplateVersionsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyTemplateVersionsOptionsError() throws Throwable { - new ListPolicyTemplateVersionsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java deleted file mode 100644 index 5065a9d9495..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyTemplatesOptions model. - */ -public class ListPolicyTemplatesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListPolicyTemplatesOptions() throws Throwable { - ListPolicyTemplatesOptions listPolicyTemplatesOptionsModel = new ListPolicyTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .state("active") - .name("testString") - .policyServiceType("service") - .policyServiceName("testString") - .policyServiceGroupId("testString") - .policyType("access") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listPolicyTemplatesOptionsModel.accountId(), "testString"); - assertEquals(listPolicyTemplatesOptionsModel.acceptLanguage(), "default"); - assertEquals(listPolicyTemplatesOptionsModel.state(), "active"); - assertEquals(listPolicyTemplatesOptionsModel.name(), "testString"); - assertEquals(listPolicyTemplatesOptionsModel.policyServiceType(), "service"); - assertEquals(listPolicyTemplatesOptionsModel.policyServiceName(), "testString"); - assertEquals(listPolicyTemplatesOptionsModel.policyServiceGroupId(), "testString"); - assertEquals(listPolicyTemplatesOptionsModel.policyType(), "access"); - assertEquals(listPolicyTemplatesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listPolicyTemplatesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyTemplatesOptionsError() throws Throwable { - new ListPolicyTemplatesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java deleted file mode 100644 index bd82df9bfd5..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleAssignmentsOptions model. - */ -public class ListRoleAssignmentsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListRoleAssignmentsOptions() throws Throwable { - ListRoleAssignmentsOptions listRoleAssignmentsOptionsModel = new ListRoleAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listRoleAssignmentsOptionsModel.accountId(), "testString"); - assertEquals(listRoleAssignmentsOptionsModel.acceptLanguage(), "default"); - assertEquals(listRoleAssignmentsOptionsModel.templateId(), "testString"); - assertEquals(listRoleAssignmentsOptionsModel.templateVersion(), "testString"); - assertEquals(listRoleAssignmentsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listRoleAssignmentsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleAssignmentsOptionsError() throws Throwable { - new ListRoleAssignmentsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java deleted file mode 100644 index 2e89527b653..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleTemplateVersionsOptions model. - */ -public class ListRoleTemplateVersionsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListRoleTemplateVersionsOptions() throws Throwable { - ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptionsModel = new ListRoleTemplateVersionsOptions.Builder() - .roleTemplateId("testString") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listRoleTemplateVersionsOptionsModel.roleTemplateId(), "testString"); - assertEquals(listRoleTemplateVersionsOptionsModel.state(), "active"); - assertEquals(listRoleTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listRoleTemplateVersionsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleTemplateVersionsOptionsError() throws Throwable { - new ListRoleTemplateVersionsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java deleted file mode 100644 index 21d23a7be0f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleTemplatesOptions model. - */ -public class ListRoleTemplatesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListRoleTemplatesOptions() throws Throwable { - ListRoleTemplatesOptions listRoleTemplatesOptionsModel = new ListRoleTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .name("testString") - .roleName("testString") - .roleServiceName("testString") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listRoleTemplatesOptionsModel.accountId(), "testString"); - assertEquals(listRoleTemplatesOptionsModel.acceptLanguage(), "default"); - assertEquals(listRoleTemplatesOptionsModel.name(), "testString"); - assertEquals(listRoleTemplatesOptionsModel.roleName(), "testString"); - assertEquals(listRoleTemplatesOptionsModel.roleServiceName(), "testString"); - assertEquals(listRoleTemplatesOptionsModel.state(), "active"); - assertEquals(listRoleTemplatesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listRoleTemplatesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleTemplatesOptionsError() throws Throwable { - new ListRoleTemplatesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java deleted file mode 100644 index 4fb97c7fc9a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListRolesOptions model. - */ -public class ListRolesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListRolesOptions() throws Throwable { - ListRolesOptions listRolesOptionsModel = new ListRolesOptions.Builder() - .acceptLanguage("default") - .accountId("testString") - .serviceName("iam-groups") - .sourceServiceName("iam-groups") - .policyType("authorization") - .serviceGroupId("IAM") - .build(); - assertEquals(listRolesOptionsModel.acceptLanguage(), "default"); - assertEquals(listRolesOptionsModel.accountId(), "testString"); - assertEquals(listRolesOptionsModel.serviceName(), "iam-groups"); - assertEquals(listRolesOptionsModel.sourceServiceName(), "iam-groups"); - assertEquals(listRolesOptionsModel.policyType(), "authorization"); - assertEquals(listRolesOptionsModel.serviceGroupId(), "IAM"); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java deleted file mode 100644 index 8c72945373b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListV2PoliciesOptions model. - */ -public class ListV2PoliciesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListV2PoliciesOptions() throws Throwable { - ListV2PoliciesOptions listV2PoliciesOptionsModel = new ListV2PoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .serviceName("testString") - .serviceGroupId("testString") - .sort("testString") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listV2PoliciesOptionsModel.accountId(), "testString"); - assertEquals(listV2PoliciesOptionsModel.acceptLanguage(), "default"); - assertEquals(listV2PoliciesOptionsModel.iamId(), "testString"); - assertEquals(listV2PoliciesOptionsModel.accessGroupId(), "testString"); - assertEquals(listV2PoliciesOptionsModel.type(), "access"); - assertEquals(listV2PoliciesOptionsModel.serviceType(), "service"); - assertEquals(listV2PoliciesOptionsModel.serviceName(), "testString"); - assertEquals(listV2PoliciesOptionsModel.serviceGroupId(), "testString"); - assertEquals(listV2PoliciesOptionsModel.sort(), "testString"); - assertEquals(listV2PoliciesOptionsModel.format(), "include_last_permit"); - assertEquals(listV2PoliciesOptionsModel.state(), "active"); - assertEquals(listV2PoliciesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listV2PoliciesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListV2PoliciesOptionsError() throws Throwable { - new ListV2PoliciesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java deleted file mode 100644 index 0661d4245a2..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 NestedConditionRuleAttribute model. - */ -public class NestedConditionRuleAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNestedConditionRuleAttribute() throws Throwable { - NestedConditionRuleAttribute nestedConditionRuleAttributeModel = new NestedConditionRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(nestedConditionRuleAttributeModel.key(), "testString"); - assertEquals(nestedConditionRuleAttributeModel.operator(), "stringEquals"); - assertEquals(nestedConditionRuleAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(nestedConditionRuleAttributeModel); - - NestedConditionRuleAttribute nestedConditionRuleAttributeModelNew = TestUtilities.deserialize(json, NestedConditionRuleAttribute.class); - assertTrue(nestedConditionRuleAttributeModelNew instanceof NestedConditionRuleAttribute); - assertEquals(nestedConditionRuleAttributeModelNew.key(), "testString"); - assertEquals(nestedConditionRuleAttributeModelNew.operator(), "stringEquals"); - assertEquals(nestedConditionRuleAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testNestedConditionRuleAttributeError() throws Throwable { - new NestedConditionRuleAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java deleted file mode 100644 index 1ba394dbb7d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleWithConditions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 NestedConditionRuleWithConditions model. - */ -public class NestedConditionRuleWithConditionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNestedConditionRuleWithConditions() throws Throwable { - RuleAttribute ruleAttributeModel = new RuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(ruleAttributeModel.key(), "testString"); - assertEquals(ruleAttributeModel.operator(), "stringEquals"); - assertEquals(ruleAttributeModel.value(), "testString"); - - NestedConditionRuleWithConditions nestedConditionRuleWithConditionsModel = new NestedConditionRuleWithConditions.Builder() - .operator("and") - .conditions(java.util.Arrays.asList(ruleAttributeModel)) - .build(); - assertEquals(nestedConditionRuleWithConditionsModel.operator(), "and"); - assertEquals(nestedConditionRuleWithConditionsModel.conditions(), java.util.Arrays.asList(ruleAttributeModel)); - - String json = TestUtilities.serialize(nestedConditionRuleWithConditionsModel); - - NestedConditionRuleWithConditions nestedConditionRuleWithConditionsModelNew = TestUtilities.deserialize(json, NestedConditionRuleWithConditions.class); - assertTrue(nestedConditionRuleWithConditionsModelNew instanceof NestedConditionRuleWithConditions); - assertEquals(nestedConditionRuleWithConditionsModelNew.operator(), "and"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testNestedConditionRuleWithConditionsError() throws Throwable { - new NestedConditionRuleWithConditions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java deleted file mode 100644 index 4956eea2675..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedCondition; -import com.ibm.cloud.platform_services.iam_policy_management.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 NestedCondition model. - */ -public class NestedConditionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testNestedCondition() throws Throwable { - NestedCondition nestedConditionModel = new NestedCondition(); - assertNotNull(nestedConditionModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java deleted file mode 100644 index c5e084a44d5..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.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 Next model. - */ -public class NextTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNext() throws Throwable { - Next nextModel = new Next(); - assertNull(nextModel.getStart()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java deleted file mode 100644 index d5b05ede760..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentResourcePolicy model. - */ -public class PolicyAssignmentResourcePolicyTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentResourcePolicy() throws Throwable { - PolicyAssignmentResourcePolicy policyAssignmentResourcePolicyModel = new PolicyAssignmentResourcePolicy(); - assertNull(policyAssignmentResourcePolicyModel.getResourceCreated()); - assertNull(policyAssignmentResourcePolicyModel.getStatus()); - assertNull(policyAssignmentResourcePolicyModel.getErrorMessage()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java deleted file mode 100644 index 8b146425617..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentResources model. - */ -public class PolicyAssignmentResourcesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentResources() throws Throwable { - PolicyAssignmentResources policyAssignmentResourcesModel = new PolicyAssignmentResources(); - assertNull(policyAssignmentResourcesModel.getTarget()); - assertNull(policyAssignmentResourcesModel.getPolicy()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java deleted file mode 100644 index 8a3a6b67703..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Collection model. - */ -public class PolicyAssignmentV1CollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentV1Collection() throws Throwable { - PolicyAssignmentV1Collection policyAssignmentV1CollectionModel = new PolicyAssignmentV1Collection(); - assertNull(policyAssignmentV1CollectionModel.getLimit()); - assertNull(policyAssignmentV1CollectionModel.getFirst()); - assertNull(policyAssignmentV1CollectionModel.getNext()); - assertNull(policyAssignmentV1CollectionModel.getPrevious()); - assertNull(policyAssignmentV1CollectionModel.getAssignments()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java deleted file mode 100644 index 56c843a232e..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Resources model. - */ -public class PolicyAssignmentV1ResourcesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentV1Resources() throws Throwable { - PolicyAssignmentV1Resources policyAssignmentV1ResourcesModel = new PolicyAssignmentV1Resources(); - assertNull(policyAssignmentV1ResourcesModel.getTarget()); - assertNull(policyAssignmentV1ResourcesModel.getPolicy()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java deleted file mode 100644 index f5d14b29447..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Subject model. - */ -public class PolicyAssignmentV1SubjectTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentV1Subject() throws Throwable { - PolicyAssignmentV1Subject policyAssignmentV1SubjectModel = new PolicyAssignmentV1Subject(); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java deleted file mode 100644 index d9889483421..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1 model. - */ -public class PolicyAssignmentV1Test { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentV1() throws Throwable { - PolicyAssignmentV1 policyAssignmentV1Model = new PolicyAssignmentV1(); - assertNull(policyAssignmentV1Model.getTarget()); - assertNull(policyAssignmentV1Model.getResources()); - assertNull(policyAssignmentV1Model.getSubject()); - assertNull(policyAssignmentV1Model.getTemplate()); - assertNull(policyAssignmentV1Model.getStatus()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java deleted file mode 100644 index 3d372dfaf20..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyCollection model. - */ -public class PolicyCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyCollection() throws Throwable { - PolicyCollection policyCollectionModel = new PolicyCollection(); - assertNull(policyCollectionModel.getLimit()); - assertNull(policyCollectionModel.getFirst()); - assertNull(policyCollectionModel.getNext()); - assertNull(policyCollectionModel.getPrevious()); - assertNull(policyCollectionModel.getPolicies()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java deleted file mode 100644 index cb2f203a5c3..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyResource model. - */ -public class PolicyResourceTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyResource() throws Throwable { - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceAttributeModel.name(), "testString"); - assertEquals(resourceAttributeModel.value(), "testString"); - assertEquals(resourceAttributeModel.operator(), "testString"); - - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceTagModel.name(), "testString"); - assertEquals(resourceTagModel.value(), "testString"); - assertEquals(resourceTagModel.operator(), "testString"); - - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); - assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); - - String json = TestUtilities.serialize(policyResourceModel); - - PolicyResource policyResourceModelNew = TestUtilities.deserialize(json, PolicyResource.class); - assertTrue(policyResourceModelNew instanceof PolicyResource); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testPolicyResourceError() throws Throwable { - new PolicyResource.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java deleted file mode 100644 index 299e15b1fd4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyRole model. - */ -public class PolicyRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyRole() throws Throwable { - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - assertEquals(policyRoleModel.roleId(), "testString"); - - String json = TestUtilities.serialize(policyRoleModel); - - PolicyRole policyRoleModelNew = TestUtilities.deserialize(json, PolicyRole.class); - assertTrue(policyRoleModelNew instanceof PolicyRole); - assertEquals(policyRoleModelNew.roleId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testPolicyRoleError() throws Throwable { - new PolicyRole.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java deleted file mode 100644 index 6d0a937bd53..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicySubject model. - */ -public class PolicySubjectTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicySubject() throws Throwable { - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - assertEquals(subjectAttributeModel.name(), "testString"); - assertEquals(subjectAttributeModel.value(), "testString"); - - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); - - String json = TestUtilities.serialize(policySubjectModel); - - PolicySubject policySubjectModelNew = TestUtilities.deserialize(json, PolicySubject.class); - assertTrue(policySubjectModelNew instanceof PolicySubject); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testPolicySubjectError() throws Throwable { - new PolicySubject.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java deleted file mode 100644 index 8cb98be3d32..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentCollection model. - */ -public class PolicyTemplateAssignmentCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateAssignmentCollection() throws Throwable { - PolicyTemplateAssignmentCollection policyTemplateAssignmentCollectionModel = new PolicyTemplateAssignmentCollection(); - assertNull(policyTemplateAssignmentCollectionModel.getLimit()); - assertNull(policyTemplateAssignmentCollectionModel.getFirst()); - assertNull(policyTemplateAssignmentCollectionModel.getNext()); - assertNull(policyTemplateAssignmentCollectionModel.getPrevious()); - assertNull(policyTemplateAssignmentCollectionModel.getAssignments()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java deleted file mode 100644 index fded12633d2..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItemsPolicyAssignment model. - */ -public class PolicyTemplateAssignmentItemsPolicyAssignmentTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateAssignmentItemsPolicyAssignment() throws Throwable { - PolicyTemplateAssignmentItemsPolicyAssignment policyTemplateAssignmentItemsPolicyAssignmentModel = new PolicyTemplateAssignmentItemsPolicyAssignment(); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTemplateId()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTemplateVersion()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getAssignmentId()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTargetType()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTarget()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getResources()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getStatus()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java deleted file mode 100644 index 6b74125d238..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItemsPolicyAssignmentV1 model. - */ -public class PolicyTemplateAssignmentItemsPolicyAssignmentV1Test { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateAssignmentItemsPolicyAssignmentV1() throws Throwable { - PolicyTemplateAssignmentItemsPolicyAssignmentV1 policyTemplateAssignmentItemsPolicyAssignmentV1Model = new PolicyTemplateAssignmentItemsPolicyAssignmentV1(); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getTarget()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getResources()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getSubject()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getTemplate()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getStatus()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java deleted file mode 100644 index 05b400e91c1..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItems model. - */ -public class PolicyTemplateAssignmentItemsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testPolicyTemplateAssignmentItems() throws Throwable { - PolicyTemplateAssignmentItems policyTemplateAssignmentItemsModel = new PolicyTemplateAssignmentItems(); - assertNotNull(policyTemplateAssignmentItemsModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java deleted file mode 100644 index 52041b1a6a3..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateCollection model. - */ -public class PolicyTemplateCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateCollection() throws Throwable { - PolicyTemplateCollection policyTemplateCollectionModel = new PolicyTemplateCollection(); - assertNull(policyTemplateCollectionModel.getLimit()); - assertNull(policyTemplateCollectionModel.getFirst()); - assertNull(policyTemplateCollectionModel.getNext()); - assertNull(policyTemplateCollectionModel.getPrevious()); - assertNull(policyTemplateCollectionModel.getPolicyTemplates()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java deleted file mode 100644 index b6ee06990a2..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateLimitData model. - */ -public class PolicyTemplateLimitDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateLimitData() throws Throwable { - PolicyTemplateLimitData policyTemplateLimitDataModel = new PolicyTemplateLimitData(); - assertNull(policyTemplateLimitDataModel.getName()); - assertNull(policyTemplateLimitDataModel.getDescription()); - assertNull(policyTemplateLimitDataModel.getAccountId()); - assertNull(policyTemplateLimitDataModel.getVersion()); - assertNull(policyTemplateLimitDataModel.isCommitted()); - assertNull(policyTemplateLimitDataModel.getPolicy()); - assertNull(policyTemplateLimitDataModel.getState()); - assertNull(policyTemplateLimitDataModel.getCounts()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java deleted file mode 100644 index edeb45c4d96..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateMetaData model. - */ -public class PolicyTemplateMetaDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateMetaData() throws Throwable { - PolicyTemplateMetaData policyTemplateMetaDataModel = new PolicyTemplateMetaData(); - assertNull(policyTemplateMetaDataModel.getType()); - assertNull(policyTemplateMetaDataModel.getDescription()); - assertNull(policyTemplateMetaDataModel.getSubjects()); - assertNull(policyTemplateMetaDataModel.getRoles()); - assertNull(policyTemplateMetaDataModel.getResources()); - assertNull(policyTemplateMetaDataModel.getState()); - assertNull(policyTemplateMetaDataModel.getTemplate()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java deleted file mode 100644 index c349e4a3415..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplate model. - */ -public class PolicyTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplate() throws Throwable { - PolicyTemplate policyTemplateModel = new PolicyTemplate(); - assertNull(policyTemplateModel.getName()); - assertNull(policyTemplateModel.getDescription()); - assertNull(policyTemplateModel.getAccountId()); - assertNull(policyTemplateModel.getVersion()); - assertNull(policyTemplateModel.isCommitted()); - assertNull(policyTemplateModel.getPolicy()); - assertNull(policyTemplateModel.getState()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java deleted file mode 100644 index da651956461..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateVersionsCollection model. - */ -public class PolicyTemplateVersionsCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateVersionsCollection() throws Throwable { - PolicyTemplateVersionsCollection policyTemplateVersionsCollectionModel = new PolicyTemplateVersionsCollection(); - assertNull(policyTemplateVersionsCollectionModel.getLimit()); - assertNull(policyTemplateVersionsCollectionModel.getFirst()); - assertNull(policyTemplateVersionsCollectionModel.getNext()); - assertNull(policyTemplateVersionsCollectionModel.getPrevious()); - assertNull(policyTemplateVersionsCollectionModel.getVersions()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java deleted file mode 100644 index 28eba4f9a85..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 Policy model. - */ -public class PolicyTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicy() throws Throwable { - Policy policyModel = new Policy(); - assertNull(policyModel.getType()); - assertNull(policyModel.getDescription()); - assertNull(policyModel.getSubjects()); - assertNull(policyModel.getRoles()); - assertNull(policyModel.getResources()); - assertNull(policyModel.getState()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java deleted file mode 100644 index e3788c51212..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.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 Previous model. - */ -public class PreviousTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPrevious() throws Throwable { - Previous previousModel = new Previous(); - assertNull(previousModel.getStart()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java deleted file mode 100644 index 430f5f63764..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceActionControlTemplateOptions model. - */ -public class ReplaceActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplaceActionControlTemplateOptions() throws Throwable { - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateActionControlModel.serviceName(), "testString"); - assertEquals(templateActionControlModel.description(), "testString"); - assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); - - ReplaceActionControlTemplateOptions replaceActionControlTemplateOptionsModel = new ReplaceActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .ifMatch("testString") - .name("testString") - .description("testString") - .actionControl(templateActionControlModel) - .committed(true) - .build(); - assertEquals(replaceActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.version(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.ifMatch(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.name(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.description(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.actionControl(), templateActionControlModel); - assertEquals(replaceActionControlTemplateOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceActionControlTemplateOptionsError() throws Throwable { - new ReplaceActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java deleted file mode 100644 index 2f20b05f37c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplacePolicyOptions model. - */ -public class ReplacePolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplacePolicyOptions() throws Throwable { - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - assertEquals(subjectAttributeModel.name(), "testString"); - assertEquals(subjectAttributeModel.value(), "testString"); - - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); - - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - assertEquals(policyRoleModel.roleId(), "testString"); - - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceAttributeModel.name(), "testString"); - assertEquals(resourceAttributeModel.value(), "testString"); - assertEquals(resourceAttributeModel.operator(), "testString"); - - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceTagModel.name(), "testString"); - assertEquals(resourceTagModel.value(), "testString"); - assertEquals(resourceTagModel.operator(), "testString"); - - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); - assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); - - ReplacePolicyOptions replacePolicyOptionsModel = new ReplacePolicyOptions.Builder() - .policyId("testString") - .ifMatch("testString") - .type("testString") - .subjects(java.util.Arrays.asList(policySubjectModel)) - .roles(java.util.Arrays.asList(policyRoleModel)) - .resources(java.util.Arrays.asList(policyResourceModel)) - .description("testString") - .build(); - assertEquals(replacePolicyOptionsModel.policyId(), "testString"); - assertEquals(replacePolicyOptionsModel.ifMatch(), "testString"); - assertEquals(replacePolicyOptionsModel.type(), "testString"); - assertEquals(replacePolicyOptionsModel.subjects(), java.util.Arrays.asList(policySubjectModel)); - assertEquals(replacePolicyOptionsModel.roles(), java.util.Arrays.asList(policyRoleModel)); - assertEquals(replacePolicyOptionsModel.resources(), java.util.Arrays.asList(policyResourceModel)); - assertEquals(replacePolicyOptionsModel.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplacePolicyOptionsError() throws Throwable { - new ReplacePolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java deleted file mode 100644 index 2dc2430daca..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplacePolicyTemplateOptions model. - */ -public class ReplacePolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplacePolicyTemplateOptions() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - assertEquals(templatePolicyModel.type(), "access"); - assertEquals(templatePolicyModel.description(), "testString"); - assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); - assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); - assertEquals(templatePolicyModel.pattern(), "testString"); - assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), templateControlModel); - - ReplacePolicyTemplateOptions replacePolicyTemplateOptionsModel = new ReplacePolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .ifMatch("testString") - .policy(templatePolicyModel) - .name("testString") - .description("testString") - .committed(true) - .build(); - assertEquals(replacePolicyTemplateOptionsModel.policyTemplateId(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.version(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.ifMatch(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.policy(), templatePolicyModel); - assertEquals(replacePolicyTemplateOptionsModel.name(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.description(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplacePolicyTemplateOptionsError() throws Throwable { - new ReplacePolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java deleted file mode 100644 index 9900abb2543..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceRoleOptions model. - */ -public class ReplaceRoleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplaceRoleOptions() throws Throwable { - ReplaceRoleOptions replaceRoleOptionsModel = new ReplaceRoleOptions.Builder() - .roleId("testString") - .ifMatch("testString") - .displayName("testString") - .actions(java.util.Arrays.asList("testString")) - .description("testString") - .build(); - assertEquals(replaceRoleOptionsModel.roleId(), "testString"); - assertEquals(replaceRoleOptionsModel.ifMatch(), "testString"); - assertEquals(replaceRoleOptionsModel.displayName(), "testString"); - assertEquals(replaceRoleOptionsModel.actions(), java.util.Arrays.asList("testString")); - assertEquals(replaceRoleOptionsModel.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceRoleOptionsError() throws Throwable { - new ReplaceRoleOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java deleted file mode 100644 index 2f731aea7d4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceRoleTemplateOptions model. - */ -public class ReplaceRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplaceRoleTemplateOptions() throws Throwable { - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateRoleModel.displayName(), "testString"); - assertEquals(templateRoleModel.serviceName(), "testString"); - assertEquals(templateRoleModel.description(), "testString"); - assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); - - ReplaceRoleTemplateOptions replaceRoleTemplateOptionsModel = new ReplaceRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .ifMatch("testString") - .name("testString") - .description("testString") - .role(templateRoleModel) - .committed(true) - .build(); - assertEquals(replaceRoleTemplateOptionsModel.roleTemplateId(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.version(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.ifMatch(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.name(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.description(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.role(), templateRoleModel); - assertEquals(replaceRoleTemplateOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceRoleTemplateOptionsError() throws Throwable { - new ReplaceRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java deleted file mode 100644 index 23690eda780..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceV2PolicyOptions model. - */ -public class ReplaceV2PolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplaceV2PolicyOptions() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); - - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - assertEquals(controlModel.grant(), grantModel); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - ReplaceV2PolicyOptions replaceV2PolicyOptionsModel = new ReplaceV2PolicyOptions.Builder() - .id("testString") - .ifMatch("testString") - .control(controlModel) - .type("access") - .description("testString") - .subject(v2PolicySubjectModel) - .resource(v2PolicyResourceModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .build(); - assertEquals(replaceV2PolicyOptionsModel.id(), "testString"); - assertEquals(replaceV2PolicyOptionsModel.ifMatch(), "testString"); - assertEquals(replaceV2PolicyOptionsModel.control(), controlModel); - assertEquals(replaceV2PolicyOptionsModel.type(), "access"); - assertEquals(replaceV2PolicyOptionsModel.description(), "testString"); - assertEquals(replaceV2PolicyOptionsModel.subject(), v2PolicySubjectModel); - assertEquals(replaceV2PolicyOptionsModel.resource(), v2PolicyResourceModel); - assertEquals(replaceV2PolicyOptionsModel.pattern(), "testString"); - assertEquals(replaceV2PolicyOptionsModel.rule(), v2PolicyRuleModel); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceV2PolicyOptionsError() throws Throwable { - new ReplaceV2PolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java deleted file mode 100644 index bd50b514f43..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 ResourceAttribute model. - */ -public class ResourceAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testResourceAttribute() throws Throwable { - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceAttributeModel.name(), "testString"); - assertEquals(resourceAttributeModel.value(), "testString"); - assertEquals(resourceAttributeModel.operator(), "testString"); - - String json = TestUtilities.serialize(resourceAttributeModel); - - ResourceAttribute resourceAttributeModelNew = TestUtilities.deserialize(json, ResourceAttribute.class); - assertTrue(resourceAttributeModelNew instanceof ResourceAttribute); - assertEquals(resourceAttributeModelNew.name(), "testString"); - assertEquals(resourceAttributeModelNew.value(), "testString"); - assertEquals(resourceAttributeModelNew.operator(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testResourceAttributeError() throws Throwable { - new ResourceAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java deleted file mode 100644 index 88a1eb5d5b6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.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 ResourceTag model. - */ -public class ResourceTagTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testResourceTag() throws Throwable { - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceTagModel.name(), "testString"); - assertEquals(resourceTagModel.value(), "testString"); - assertEquals(resourceTagModel.operator(), "testString"); - - String json = TestUtilities.serialize(resourceTagModel); - - ResourceTag resourceTagModelNew = TestUtilities.deserialize(json, ResourceTag.class); - assertTrue(resourceTagModelNew instanceof ResourceTag); - assertEquals(resourceTagModelNew.name(), "testString"); - assertEquals(resourceTagModelNew.value(), "testString"); - assertEquals(resourceTagModelNew.operator(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testResourceTagError() throws Throwable { - new ResourceTag.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java deleted file mode 100644 index e4c0bcc6f92..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAction model. - */ -public class RoleActionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAction() throws Throwable { - RoleAction roleActionModel = new RoleAction(); - assertNull(roleActionModel.getId()); - assertNull(roleActionModel.getDisplayName()); - assertNull(roleActionModel.getDescription()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java deleted file mode 100644 index 42801bc7771..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentCollection model. - */ -public class RoleAssignmentCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentCollection() throws Throwable { - RoleAssignmentCollection roleAssignmentCollectionModel = new RoleAssignmentCollection(); - assertNull(roleAssignmentCollectionModel.getLimit()); - assertNull(roleAssignmentCollectionModel.getFirst()); - assertNull(roleAssignmentCollectionModel.getNext()); - assertNull(roleAssignmentCollectionModel.getPrevious()); - assertNull(roleAssignmentCollectionModel.getAssignments()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java deleted file mode 100644 index bef8b71b0fa..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResourceCreated model. - */ -public class RoleAssignmentResourceCreatedTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentResourceCreated() throws Throwable { - RoleAssignmentResourceCreated roleAssignmentResourceCreatedModel = new RoleAssignmentResourceCreated(); - assertNull(roleAssignmentResourceCreatedModel.getId()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java deleted file mode 100644 index c346ca0f48f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResourceRole model. - */ -public class RoleAssignmentResourceRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentResourceRole() throws Throwable { - RoleAssignmentResourceRole roleAssignmentResourceRoleModel = new RoleAssignmentResourceRole(); - assertNull(roleAssignmentResourceRoleModel.getResourceCreated()); - assertNull(roleAssignmentResourceRoleModel.getErrorMessage()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java deleted file mode 100644 index 4fca1b25b5b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResource model. - */ -public class RoleAssignmentResourceTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentResource() throws Throwable { - RoleAssignmentResource roleAssignmentResourceModel = new RoleAssignmentResource(); - assertNull(roleAssignmentResourceModel.getTarget()); - assertNull(roleAssignmentResourceModel.getRole()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java deleted file mode 100644 index 4f2e3a37200..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentTemplate model. - */ -public class RoleAssignmentTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentTemplate() throws Throwable { - RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(roleAssignmentTemplateModel.id(), "testString"); - assertEquals(roleAssignmentTemplateModel.version(), "testString"); - - String json = TestUtilities.serialize(roleAssignmentTemplateModel); - - RoleAssignmentTemplate roleAssignmentTemplateModelNew = TestUtilities.deserialize(json, RoleAssignmentTemplate.class); - assertTrue(roleAssignmentTemplateModelNew instanceof RoleAssignmentTemplate); - assertEquals(roleAssignmentTemplateModelNew.id(), "testString"); - assertEquals(roleAssignmentTemplateModelNew.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRoleAssignmentTemplateError() throws Throwable { - new RoleAssignmentTemplate.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java deleted file mode 100644 index bd3bda7ce24..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignment model. - */ -public class RoleAssignmentTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignment() throws Throwable { - RoleAssignment roleAssignmentModel = new RoleAssignment(); - assertNull(roleAssignmentModel.getTemplate()); - assertNull(roleAssignmentModel.getTarget()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java deleted file mode 100644 index 812c2dcb131..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleCollection model. - */ -public class RoleCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleCollection() throws Throwable { - RoleCollection roleCollectionModel = new RoleCollection(); - assertNull(roleCollectionModel.getCustomRoles()); - assertNull(roleCollectionModel.getServiceRoles()); - assertNull(roleCollectionModel.getSystemRoles()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java deleted file mode 100644 index fde4d11ff4c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateCollection model. - */ -public class RoleTemplateCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplateCollection() throws Throwable { - RoleTemplateCollection roleTemplateCollectionModel = new RoleTemplateCollection(); - assertNull(roleTemplateCollectionModel.getLimit()); - assertNull(roleTemplateCollectionModel.getFirst()); - assertNull(roleTemplateCollectionModel.getNext()); - assertNull(roleTemplateCollectionModel.getPrevious()); - assertNull(roleTemplateCollectionModel.getRoleTemplates()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java deleted file mode 100644 index 6c208e1c38f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplatePrototypeRole model. - */ -public class RoleTemplatePrototypeRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplatePrototypeRole() throws Throwable { - RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() - .name("testString") - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(roleTemplatePrototypeRoleModel.name(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.displayName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.serviceName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.description(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.actions(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(roleTemplatePrototypeRoleModel); - - RoleTemplatePrototypeRole roleTemplatePrototypeRoleModelNew = TestUtilities.deserialize(json, RoleTemplatePrototypeRole.class); - assertTrue(roleTemplatePrototypeRoleModelNew instanceof RoleTemplatePrototypeRole); - assertEquals(roleTemplatePrototypeRoleModelNew.name(), "testString"); - assertEquals(roleTemplatePrototypeRoleModelNew.displayName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModelNew.serviceName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModelNew.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRoleTemplatePrototypeRoleError() throws Throwable { - new RoleTemplatePrototypeRole.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java deleted file mode 100644 index af9de718e23..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateReferencesItem model. - */ -public class RoleTemplateReferencesItemTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplateReferencesItem() throws Throwable { - RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(roleTemplateReferencesItemModel.id(), "testString"); - assertEquals(roleTemplateReferencesItemModel.version(), "testString"); - - String json = TestUtilities.serialize(roleTemplateReferencesItemModel); - - RoleTemplateReferencesItem roleTemplateReferencesItemModelNew = TestUtilities.deserialize(json, RoleTemplateReferencesItem.class); - assertTrue(roleTemplateReferencesItemModelNew instanceof RoleTemplateReferencesItem); - assertEquals(roleTemplateReferencesItemModelNew.id(), "testString"); - assertEquals(roleTemplateReferencesItemModelNew.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRoleTemplateReferencesItemError() throws Throwable { - new RoleTemplateReferencesItem.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java deleted file mode 100644 index 8bb27d8dd62..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplate model. - */ -public class RoleTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplate() throws Throwable { - RoleTemplate roleTemplateModel = new RoleTemplate(); - assertNull(roleTemplateModel.getName()); - assertNull(roleTemplateModel.getDescription()); - assertNull(roleTemplateModel.getAccountId()); - assertNull(roleTemplateModel.isCommitted()); - assertNull(roleTemplateModel.getRole()); - assertNull(roleTemplateModel.getVersion()); - assertNull(roleTemplateModel.getState()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java deleted file mode 100644 index 068cf309bd6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateVersionsCollection model. - */ -public class RoleTemplateVersionsCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplateVersionsCollection() throws Throwable { - RoleTemplateVersionsCollection roleTemplateVersionsCollectionModel = new RoleTemplateVersionsCollection(); - assertNull(roleTemplateVersionsCollectionModel.getLimit()); - assertNull(roleTemplateVersionsCollectionModel.getFirst()); - assertNull(roleTemplateVersionsCollectionModel.getNext()); - assertNull(roleTemplateVersionsCollectionModel.getPrevious()); - assertNull(roleTemplateVersionsCollectionModel.getVersions()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java deleted file mode 100644 index a632e63587f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; -import com.ibm.cloud.platform_services.iam_policy_management.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 Role model. - */ -public class RoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRole() throws Throwable { - Role roleModel = new Role.Builder() - .displayName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(roleModel.displayName(), "testString"); - assertEquals(roleModel.description(), "testString"); - assertEquals(roleModel.actions(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(roleModel); - - Role roleModelNew = TestUtilities.deserialize(json, Role.class); - assertTrue(roleModelNew instanceof Role); - assertEquals(roleModelNew.displayName(), "testString"); - assertEquals(roleModelNew.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRoleError() throws Throwable { - new Role.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java deleted file mode 100644 index 8383ef794a9..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 Roles model. - */ -public class RolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoles() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - String json = TestUtilities.serialize(rolesModel); - - Roles rolesModelNew = TestUtilities.deserialize(json, Roles.class); - assertTrue(rolesModelNew instanceof Roles); - assertEquals(rolesModelNew.roleId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRolesError() throws Throwable { - new Roles.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java deleted file mode 100644 index a05e5ee8704..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 RuleAttribute model. - */ -public class RuleAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRuleAttribute() throws Throwable { - RuleAttribute ruleAttributeModel = new RuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(ruleAttributeModel.key(), "testString"); - assertEquals(ruleAttributeModel.operator(), "stringEquals"); - assertEquals(ruleAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(ruleAttributeModel); - - RuleAttribute ruleAttributeModelNew = TestUtilities.deserialize(json, RuleAttribute.class); - assertTrue(ruleAttributeModelNew instanceof RuleAttribute); - assertEquals(ruleAttributeModelNew.key(), "testString"); - assertEquals(ruleAttributeModelNew.operator(), "stringEquals"); - assertEquals(ruleAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRuleAttributeError() throws Throwable { - new RuleAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java deleted file mode 100644 index 7bae03a42e0..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 SubjectAttribute model. - */ -public class SubjectAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testSubjectAttribute() throws Throwable { - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - assertEquals(subjectAttributeModel.name(), "testString"); - assertEquals(subjectAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(subjectAttributeModel); - - SubjectAttribute subjectAttributeModelNew = TestUtilities.deserialize(json, SubjectAttribute.class); - assertTrue(subjectAttributeModelNew instanceof SubjectAttribute); - assertEquals(subjectAttributeModelNew.name(), "testString"); - assertEquals(subjectAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testSubjectAttributeError() throws Throwable { - new SubjectAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java deleted file mode 100644 index d3a6d4ef53a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateActionControl model. - */ -public class TemplateActionControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateActionControl() throws Throwable { - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateActionControlModel.serviceName(), "testString"); - assertEquals(templateActionControlModel.description(), "testString"); - assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(templateActionControlModel); - - TemplateActionControl templateActionControlModelNew = TestUtilities.deserialize(json, TemplateActionControl.class); - assertTrue(templateActionControlModelNew instanceof TemplateActionControl); - assertEquals(templateActionControlModelNew.serviceName(), "testString"); - assertEquals(templateActionControlModelNew.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateActionControlError() throws Throwable { - new TemplateActionControl.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java deleted file mode 100644 index fba96e64cef..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateControl model. - */ -public class TemplateControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateControl() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - String json = TestUtilities.serialize(templateControlModel); - - TemplateControl templateControlModelNew = TestUtilities.deserialize(json, TemplateControl.class); - assertTrue(templateControlModelNew instanceof TemplateControl); - assertEquals(templateControlModelNew.grant().toString(), templateGrantModel.toString()); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateControlError() throws Throwable { - new TemplateControl.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java deleted file mode 100644 index b440cf19100..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateCountData model. - */ -public class TemplateCountDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateCountData() throws Throwable { - TemplateCountData templateCountDataModel = new TemplateCountData(); - assertNull(templateCountDataModel.getTemplate()); - assertNull(templateCountDataModel.getVersion()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java deleted file mode 100644 index e7759eacc21..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoleReferences; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrantRoleReferences model. - */ -public class TemplateGrantRoleReferencesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateGrantRoleReferences() throws Throwable { - RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(roleTemplateReferencesItemModel.id(), "testString"); - assertEquals(roleTemplateReferencesItemModel.version(), "testString"); - - TemplateGrantRoleReferences templateGrantRoleReferencesModel = new TemplateGrantRoleReferences.Builder() - .roleTemplateReferences(java.util.Arrays.asList(roleTemplateReferencesItemModel)) - .build(); - assertEquals(templateGrantRoleReferencesModel.roleTemplateReferences(), java.util.Arrays.asList(roleTemplateReferencesItemModel)); - - String json = TestUtilities.serialize(templateGrantRoleReferencesModel); - - TemplateGrantRoleReferences templateGrantRoleReferencesModelNew = TestUtilities.deserialize(json, TemplateGrantRoleReferences.class); - assertTrue(templateGrantRoleReferencesModelNew instanceof TemplateGrantRoleReferences); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateGrantRoleReferencesError() throws Throwable { - new TemplateGrantRoleReferences.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java deleted file mode 100644 index 8cddc6f9a19..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrantRoles model. - */ -public class TemplateGrantRolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateGrantRoles() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantRolesModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantRolesModel.roles(), java.util.Arrays.asList(rolesModel)); - - String json = TestUtilities.serialize(templateGrantRolesModel); - - TemplateGrantRoles templateGrantRolesModelNew = TestUtilities.deserialize(json, TemplateGrantRoles.class); - assertTrue(templateGrantRolesModelNew instanceof TemplateGrantRoles); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateGrantRolesError() throws Throwable { - new TemplateGrantRoles.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java deleted file mode 100644 index 90e6fdc2b9f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrant model. - */ -public class TemplateGrantTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testTemplateGrant() throws Throwable { - TemplateGrant templateGrantModel = new TemplateGrant(); - assertNotNull(templateGrantModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java deleted file mode 100644 index c2688232e2b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateMetadata model. - */ -public class TemplateMetadataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateMetadata() throws Throwable { - TemplateMetadata templateMetadataModel = new TemplateMetadata(); - assertNull(templateMetadataModel.getId()); - assertNull(templateMetadataModel.getVersion()); - assertNull(templateMetadataModel.getAssignmentId()); - assertNull(templateMetadataModel.getRootId()); - assertNull(templateMetadataModel.getRootVersion()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java deleted file mode 100644 index 0e256ffd599..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplatePolicy model. - */ -public class TemplatePolicyTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplatePolicy() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - assertEquals(templatePolicyModel.type(), "access"); - assertEquals(templatePolicyModel.description(), "testString"); - assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); - assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); - assertEquals(templatePolicyModel.pattern(), "testString"); - assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), templateControlModel); - - String json = TestUtilities.serialize(templatePolicyModel); - - TemplatePolicy templatePolicyModelNew = TestUtilities.deserialize(json, TemplatePolicy.class); - assertTrue(templatePolicyModelNew instanceof TemplatePolicy); - assertEquals(templatePolicyModelNew.type(), "access"); - assertEquals(templatePolicyModelNew.description(), "testString"); - assertEquals(templatePolicyModelNew.resource().toString(), v2PolicyResourceModel.toString()); - assertEquals(templatePolicyModelNew.subject().toString(), v2PolicySubjectModel.toString()); - assertEquals(templatePolicyModelNew.pattern(), "testString"); - assertEquals(templatePolicyModelNew.rule().toString(), v2PolicyRuleModel.toString()); - assertEquals(templatePolicyModelNew.control().toString(), templateControlModel.toString()); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplatePolicyError() throws Throwable { - new TemplatePolicy.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java deleted file mode 100644 index 1735364bc85..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateRole model. - */ -public class TemplateRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateRole() throws Throwable { - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateRoleModel.displayName(), "testString"); - assertEquals(templateRoleModel.serviceName(), "testString"); - assertEquals(templateRoleModel.description(), "testString"); - assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(templateRoleModel); - - TemplateRole templateRoleModelNew = TestUtilities.deserialize(json, TemplateRole.class); - assertTrue(templateRoleModelNew instanceof TemplateRole); - assertEquals(templateRoleModelNew.displayName(), "testString"); - assertEquals(templateRoleModelNew.serviceName(), "testString"); - assertEquals(templateRoleModelNew.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateRoleError() throws Throwable { - new TemplateRole.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java deleted file mode 100644 index df7a09c2829..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateActionControlAssignmentOptions model. - */ -public class UpdateActionControlAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdateActionControlAssignmentOptions() throws Throwable { - UpdateActionControlAssignmentOptions updateActionControlAssignmentOptionsModel = new UpdateActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .ifMatch("testString") - .templateVersion("testString") - .build(); - assertEquals(updateActionControlAssignmentOptionsModel.assignmentId(), "testString"); - assertEquals(updateActionControlAssignmentOptionsModel.ifMatch(), "testString"); - assertEquals(updateActionControlAssignmentOptionsModel.templateVersion(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateActionControlAssignmentOptionsError() throws Throwable { - new UpdateActionControlAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java deleted file mode 100644 index 0008325ffcf..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdatePolicyAssignmentOptions model. - */ -public class UpdatePolicyAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdatePolicyAssignmentOptions() throws Throwable { - UpdatePolicyAssignmentOptions updatePolicyAssignmentOptionsModel = new UpdatePolicyAssignmentOptions.Builder() - .assignmentId("testString") - .version("1.0") - .ifMatch("testString") - .templateVersion("testString") - .build(); - assertEquals(updatePolicyAssignmentOptionsModel.assignmentId(), "testString"); - assertEquals(updatePolicyAssignmentOptionsModel.version(), "1.0"); - assertEquals(updatePolicyAssignmentOptionsModel.ifMatch(), "testString"); - assertEquals(updatePolicyAssignmentOptionsModel.templateVersion(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdatePolicyAssignmentOptionsError() throws Throwable { - new UpdatePolicyAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java deleted file mode 100644 index de000e8c745..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdatePolicyStateOptions model. - */ -public class UpdatePolicyStateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdatePolicyStateOptions() throws Throwable { - UpdatePolicyStateOptions updatePolicyStateOptionsModel = new UpdatePolicyStateOptions.Builder() - .policyId("testString") - .ifMatch("testString") - .state("active") - .build(); - assertEquals(updatePolicyStateOptionsModel.policyId(), "testString"); - assertEquals(updatePolicyStateOptionsModel.ifMatch(), "testString"); - assertEquals(updatePolicyStateOptionsModel.state(), "active"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdatePolicyStateOptionsError() throws Throwable { - new UpdatePolicyStateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java deleted file mode 100644 index 879c3d5f456..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateRoleAssignmentOptions model. - */ -public class UpdateRoleAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdateRoleAssignmentOptions() throws Throwable { - UpdateRoleAssignmentOptions updateRoleAssignmentOptionsModel = new UpdateRoleAssignmentOptions.Builder() - .assignmentId("testString") - .ifMatch("testString") - .templateVersion("testString") - .build(); - assertEquals(updateRoleAssignmentOptionsModel.assignmentId(), "testString"); - assertEquals(updateRoleAssignmentOptionsModel.ifMatch(), "testString"); - assertEquals(updateRoleAssignmentOptionsModel.templateVersion(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateRoleAssignmentOptionsError() throws Throwable { - new UpdateRoleAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java deleted file mode 100644 index 1d69d016781..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateSettingsOptions model. - */ -public class UpdateSettingsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdateSettingsOptions() throws Throwable { - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - assertEquals(identityTypesBaseModel.state(), "enabled"); - assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); - - IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() - .user(identityTypesBaseModel) - .serviceId(identityTypesBaseModel) - .service(identityTypesBaseModel) - .build(); - assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); - - ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() - .identityTypes(identityTypesPatchModel) - .build(); - assertEquals(externalAccountIdentityInteractionPatchModel.identityTypes(), identityTypesPatchModel); - - UpdateSettingsOptions updateSettingsOptionsModel = new UpdateSettingsOptions.Builder() - .accountId("testString") - .ifMatch("testString") - .externalAccountIdentityInteraction(externalAccountIdentityInteractionPatchModel) - .acceptLanguage("default") - .build(); - assertEquals(updateSettingsOptionsModel.accountId(), "testString"); - assertEquals(updateSettingsOptionsModel.ifMatch(), "testString"); - assertEquals(updateSettingsOptionsModel.externalAccountIdentityInteraction(), externalAccountIdentityInteractionPatchModel); - assertEquals(updateSettingsOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateSettingsOptionsError() throws Throwable { - new UpdateSettingsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java deleted file mode 100644 index aff020c8985..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyCollection model. - */ -public class V2PolicyCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyCollection() throws Throwable { - V2PolicyCollection v2PolicyCollectionModel = new V2PolicyCollection(); - assertNull(v2PolicyCollectionModel.getLimit()); - assertNull(v2PolicyCollectionModel.getFirst()); - assertNull(v2PolicyCollectionModel.getNext()); - assertNull(v2PolicyCollectionModel.getPrevious()); - assertNull(v2PolicyCollectionModel.getPolicies()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java deleted file mode 100644 index 407eaadb155..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResourceAttribute model. - */ -public class V2PolicyResourceAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyResourceAttribute() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(v2PolicyResourceAttributeModel); - - V2PolicyResourceAttribute v2PolicyResourceAttributeModelNew = TestUtilities.deserialize(json, V2PolicyResourceAttribute.class); - assertTrue(v2PolicyResourceAttributeModelNew instanceof V2PolicyResourceAttribute); - assertEquals(v2PolicyResourceAttributeModelNew.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModelNew.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyResourceAttributeError() throws Throwable { - new V2PolicyResourceAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java deleted file mode 100644 index 97c9c813216..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResourceTag model. - */ -public class V2PolicyResourceTagTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyResourceTag() throws Throwable { - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - String json = TestUtilities.serialize(v2PolicyResourceTagModel); - - V2PolicyResourceTag v2PolicyResourceTagModelNew = TestUtilities.deserialize(json, V2PolicyResourceTag.class); - assertTrue(v2PolicyResourceTagModelNew instanceof V2PolicyResourceTag); - assertEquals(v2PolicyResourceTagModelNew.key(), "testString"); - assertEquals(v2PolicyResourceTagModelNew.value(), "testString"); - assertEquals(v2PolicyResourceTagModelNew.operator(), "stringEquals"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyResourceTagError() throws Throwable { - new V2PolicyResourceTag.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java deleted file mode 100644 index d153fd97be6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResource model. - */ -public class V2PolicyResourceTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyResource() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - String json = TestUtilities.serialize(v2PolicyResourceModel); - - V2PolicyResource v2PolicyResourceModelNew = TestUtilities.deserialize(json, V2PolicyResource.class); - assertTrue(v2PolicyResourceModelNew instanceof V2PolicyResource); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyResourceError() throws Throwable { - new V2PolicyResource.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java deleted file mode 100644 index 6d6da85f2b4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRuleRuleAttribute model. - */ -public class V2PolicyRuleRuleAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyRuleRuleAttribute() throws Throwable { - V2PolicyRuleRuleAttribute v2PolicyRuleRuleAttributeModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleRuleAttributeModel.key(), "testString"); - assertEquals(v2PolicyRuleRuleAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleRuleAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(v2PolicyRuleRuleAttributeModel); - - V2PolicyRuleRuleAttribute v2PolicyRuleRuleAttributeModelNew = TestUtilities.deserialize(json, V2PolicyRuleRuleAttribute.class); - assertTrue(v2PolicyRuleRuleAttributeModelNew instanceof V2PolicyRuleRuleAttribute); - assertEquals(v2PolicyRuleRuleAttributeModelNew.key(), "testString"); - assertEquals(v2PolicyRuleRuleAttributeModelNew.operator(), "stringEquals"); - assertEquals(v2PolicyRuleRuleAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyRuleRuleAttributeError() throws Throwable { - new V2PolicyRuleRuleAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java deleted file mode 100644 index fdf25669ef7..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleWithNestedConditions; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRuleRuleWithNestedConditions model. - */ -public class V2PolicyRuleRuleWithNestedConditionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyRuleRuleWithNestedConditions() throws Throwable { - NestedConditionRuleAttribute nestedConditionModel = new NestedConditionRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(nestedConditionModel.key(), "testString"); - assertEquals(nestedConditionModel.operator(), "stringEquals"); - assertEquals(nestedConditionModel.value(), "testString"); - - V2PolicyRuleRuleWithNestedConditions v2PolicyRuleRuleWithNestedConditionsModel = new V2PolicyRuleRuleWithNestedConditions.Builder() - .operator("and") - .conditions(java.util.Arrays.asList(nestedConditionModel)) - .build(); - assertEquals(v2PolicyRuleRuleWithNestedConditionsModel.operator(), "and"); - assertEquals(v2PolicyRuleRuleWithNestedConditionsModel.conditions(), java.util.Arrays.asList(nestedConditionModel)); - - String json = TestUtilities.serialize(v2PolicyRuleRuleWithNestedConditionsModel); - - V2PolicyRuleRuleWithNestedConditions v2PolicyRuleRuleWithNestedConditionsModelNew = TestUtilities.deserialize(json, V2PolicyRuleRuleWithNestedConditions.class); - assertTrue(v2PolicyRuleRuleWithNestedConditionsModelNew instanceof V2PolicyRuleRuleWithNestedConditions); - assertEquals(v2PolicyRuleRuleWithNestedConditionsModelNew.operator(), "and"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyRuleRuleWithNestedConditionsError() throws Throwable { - new V2PolicyRuleRuleWithNestedConditions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java deleted file mode 100644 index e0af599840c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRule; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRule model. - */ -public class V2PolicyRuleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testV2PolicyRule() throws Throwable { - V2PolicyRule v2PolicyRuleModel = new V2PolicyRule(); - assertNotNull(v2PolicyRuleModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java deleted file mode 100644 index a6e8f9d8922..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicySubjectAttribute model. - */ -public class V2PolicySubjectAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicySubjectAttribute() throws Throwable { - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(v2PolicySubjectAttributeModel); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModelNew = TestUtilities.deserialize(json, V2PolicySubjectAttribute.class); - assertTrue(v2PolicySubjectAttributeModelNew instanceof V2PolicySubjectAttribute); - assertEquals(v2PolicySubjectAttributeModelNew.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModelNew.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicySubjectAttributeError() throws Throwable { - new V2PolicySubjectAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java deleted file mode 100644 index 37adbaff5df..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicySubject model. - */ -public class V2PolicySubjectTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicySubject() throws Throwable { - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - String json = TestUtilities.serialize(v2PolicySubjectModel); - - V2PolicySubject v2PolicySubjectModelNew = TestUtilities.deserialize(json, V2PolicySubject.class); - assertTrue(v2PolicySubjectModelNew instanceof V2PolicySubject); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicySubjectError() throws Throwable { - new V2PolicySubject.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java deleted file mode 100644 index 2ffbe45575b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyTemplateMetaData model. - */ -public class V2PolicyTemplateMetaDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyTemplateMetaData() throws Throwable { - V2PolicyTemplateMetaData v2PolicyTemplateMetaDataModel = new V2PolicyTemplateMetaData(); - assertNull(v2PolicyTemplateMetaDataModel.getType()); - assertNull(v2PolicyTemplateMetaDataModel.getDescription()); - assertNull(v2PolicyTemplateMetaDataModel.getSubject()); - assertNull(v2PolicyTemplateMetaDataModel.getResource()); - assertNull(v2PolicyTemplateMetaDataModel.getPattern()); - assertNull(v2PolicyTemplateMetaDataModel.getRule()); - assertNull(v2PolicyTemplateMetaDataModel.getControl()); - assertNull(v2PolicyTemplateMetaDataModel.getState()); - assertNull(v2PolicyTemplateMetaDataModel.getLastPermitAt()); - assertNull(v2PolicyTemplateMetaDataModel.getLastPermitFrequency()); - assertNull(v2PolicyTemplateMetaDataModel.getTemplate()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java deleted file mode 100644 index 1630201062c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2Policy model. - */ -public class V2PolicyTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2Policy() throws Throwable { - V2Policy v2PolicyModel = new V2Policy(); - assertNull(v2PolicyModel.getType()); - assertNull(v2PolicyModel.getDescription()); - assertNull(v2PolicyModel.getSubject()); - assertNull(v2PolicyModel.getResource()); - assertNull(v2PolicyModel.getPattern()); - assertNull(v2PolicyModel.getRule()); - assertNull(v2PolicyModel.getControl()); - assertNull(v2PolicyModel.getState()); - assertNull(v2PolicyModel.getLastPermitAt()); - assertNull(v2PolicyModel.getLastPermitFrequency()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java deleted file mode 100644 index 04aaecc16ae..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * (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_policy_management.v1.utils; - -import java.util.Base64; -import java.util.Map; -import java.util.Set; -import java.util.List; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.io.InputStream; -import java.io.ByteArrayInputStream; - -import okhttp3.mockwebserver.RecordedRequest; -import okhttp3.HttpUrl; -import com.ibm.cloud.sdk.core.util.DateUtils; -import com.ibm.cloud.sdk.core.util.GsonSingleton; -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; - -/** - * A class used by the unit tests containing utility functions. - */ -public class TestUtilities { - public static Map createMockMap() { - Map mockMap = new HashMap<>(); - mockMap.put("foo", "bar"); - return mockMap; - } - - public static HashMap createMockStreamMap() { - return new HashMap() { - { put("key1", createMockStream("This is a mock file.")); } - }; - } - - public static Map parseQueryString(RecordedRequest req) { - Map queryMap = new HashMap<>(); - - try { - HttpUrl requestUrl = req.getRequestUrl(); - - if (requestUrl != null) { - Set queryParamsNames = requestUrl.queryParameterNames(); - // map the parameter name to its corresponding value - for (String p : queryParamsNames) { - // get the corresponding value for the parameter (p) - List val = requestUrl.queryParameterValues(p); - if (val != null && !val.isEmpty()) { - String joinedQuery = String.join(",", val); - queryMap.put(p, joinedQuery); - } - } - } - if (queryMap.isEmpty()) { - return null; - } - } catch (Exception e) { - return null; - } - - return queryMap; - } - - public static String parseReqPath(RecordedRequest req) { - String parsedPath = null; - - try { - String fullPath = req.getPath(); - if (fullPath != null && !fullPath.isEmpty()) { - // retrieve the path segment before the query parameter - parsedPath = fullPath.split("\\?", 2)[0]; - } - if (parsedPath.isEmpty() || parsedPath == null) { - return null; - } - - } catch (Exception e) { - return null; - } - - return parsedPath; - } - - public static String serialize(Object obj) { - return GsonSingleton.getGson().toJson(obj); - } - - public static T deserialize(String json, Class clazz) { - return GsonSingleton.getGson().fromJson(json, clazz); - } - - public static InputStream createMockStream(String s) { - return new ByteArrayInputStream(s.getBytes()); - } - - public static List creatMockListFileWithMetadata() { - List list = new ArrayList(); - byte[] fileBytes = {(byte) 0xde, (byte) 0xad, (byte) 0xbe, (byte) 0xef}; - InputStream inputStream = new ByteArrayInputStream(fileBytes); - FileWithMetadata.Builder builder = new FileWithMetadata.Builder(); - builder.data(inputStream); - FileWithMetadata fileWithMetadata = builder.build(); - list.add(fileWithMetadata); - - return list; - } - - public static byte[] createMockByteArray(String encodedString) throws Exception { - return Base64.getDecoder().decode(encodedString); - } - - public static Date createMockDate(String date) throws Exception { - return DateUtils.parseAsDate(date); - } - - public static Date createMockDateTime(String date) throws Exception { - return DateUtils.parseAsDateTime(date); - } -} \ No newline at end of file From 08862fdacfc0282af8e5a1f7bbc21387b7f59e73 Mon Sep 17 00:00:00 2001 From: Bhavana Bellamgari Date: Wed, 10 Dec 2025 12:50:38 +0530 Subject: [PATCH 04/13] Updated template grant schema Signed-off-by: Bhavana Bellamgari Signed-off-by: Bhavana Bellamgari --- .../v1/IamPolicyManagement.java | 2566 +++++++++ .../AccountSettingsAccessManagement.java | 40 + .../v1/model/ActionControlAssignment.java | 207 + .../ActionControlAssignmentCollection.java | 88 + .../ActionControlAssignmentResource.java | 52 + ...ontrolAssignmentResourceActionControl.java | 53 + ...ctionControlAssignmentResourceCreated.java | 38 + .../ActionControlAssignmentTemplate.java | 134 + .../model/ActionControlAssignmentsPager.java | 108 + .../v1/model/ActionControlTemplate.java | 203 + .../ActionControlTemplateCollection.java | 90 + ...tionControlTemplateVersionsCollection.java | 88 + .../ActionControlTemplateVersionsPager.java | 108 + .../v1/model/ActionControlTemplatesPager.java | 108 + .../v1/model/AssignmentResourceCreated.java | 38 + .../v1/model/AssignmentResourceError.java | 88 + .../v1/model/AssignmentTargetDetails.java | 142 + .../v1/model/AssignmentTemplateDetails.java | 119 + .../CommitActionControlTemplateOptions.java | 134 + .../v1/model/CommitPolicyTemplateOptions.java | 134 + .../v1/model/CommitRoleTemplateOptions.java | 134 + .../v1/model/ConflictsWith.java | 62 + .../v1/model/Control.java | 104 + .../v1/model/ControlResponse.java | 42 + .../v1/model/ControlResponseControl.java | 24 + ...ntrolResponseControlWithEnrichedRoles.java | 24 + ...ctionControlTemplateAssignmentOptions.java | 191 + .../CreateActionControlTemplateOptions.java | 251 + ...teActionControlTemplateVersionOptions.java | 211 + .../v1/model/CreatePolicyOptions.java | 311 + ...CreatePolicyTemplateAssignmentOptions.java | 221 + .../v1/model/CreatePolicyTemplateOptions.java | 255 + .../CreatePolicyTemplateVersionOptions.java | 214 + .../v1/model/CreateRoleOptions.java | 308 + .../CreateRoleTemplateAssignmentOptions.java | 191 + .../v1/model/CreateRoleTemplateOptions.java | 251 + .../CreateRoleTemplateVersionOptions.java | 211 + .../v1/model/CreateV2PolicyOptions.java | 312 + .../v1/model/CustomRole.java | 195 + .../DeleteActionControlAssignmentOptions.java | 104 + .../DeleteActionControlTemplateOptions.java | 104 + ...teActionControlTemplateVersionOptions.java | 134 + .../model/DeletePolicyAssignmentOptions.java | 104 + .../v1/model/DeletePolicyOptions.java | 104 + .../v1/model/DeletePolicyTemplateOptions.java | 104 + .../DeletePolicyTemplateVersionOptions.java | 134 + .../v1/model/DeleteRoleAssignmentOptions.java | 104 + .../v1/model/DeleteRoleOptions.java | 104 + .../v1/model/DeleteRoleTemplateOptions.java | 104 + .../DeleteRoleTemplateVersionOptions.java | 134 + .../v1/model/DeleteV2PolicyOptions.java | 104 + .../v1/model/EnrichedRoles.java | 81 + .../v1/model/ErrorDetails.java | 40 + .../v1/model/ErrorObject.java | 128 + .../ExternalAccountIdentityInteraction.java | 40 + ...ternalAccountIdentityInteractionPatch.java | 95 + .../iam_policy_management/v1/model/First.java | 38 + .../GetActionControlAssignmentOptions.java | 104 + .../GetActionControlTemplateOptions.java | 140 + ...etActionControlTemplateVersionOptions.java | 134 + .../v1/model/GetPolicyAssignmentOptions.java | 134 + .../v1/model/GetPolicyOptions.java | 104 + .../v1/model/GetPolicyTemplateOptions.java | 140 + .../GetPolicyTemplateVersionOptions.java | 134 + .../v1/model/GetRoleAssignmentOptions.java | 104 + .../v1/model/GetRoleOptions.java | 104 + .../v1/model/GetRoleTemplateOptions.java | 140 + .../model/GetRoleTemplateVersionOptions.java | 134 + .../v1/model/GetSettingsOptions.java | 141 + .../v1/model/GetV2PolicyOptions.java | 148 + .../iam_policy_management/v1/model/Grant.java | 124 + .../v1/model/GrantWithEnrichedRoles.java | 40 + .../v1/model/IdentityTypes.java | 64 + .../v1/model/IdentityTypesBase.java | 168 + .../v1/model/IdentityTypesPatch.java | 147 + .../v1/model/LimitData.java | 50 + .../ListActionControlAssignmentsOptions.java | 245 + ...tActionControlTemplateVersionsOptions.java | 192 + .../ListActionControlTemplatesOptions.java | 193 + .../v1/model/ListPoliciesOptions.java | 501 ++ .../model/ListPolicyAssignmentsOptions.java | 275 + .../ListPolicyTemplateVersionsOptions.java | 192 + .../v1/model/ListPolicyTemplatesOptions.java | 379 ++ .../v1/model/ListRoleAssignmentsOptions.java | 245 + .../ListRoleTemplateVersionsOptions.java | 192 + .../v1/model/ListRoleTemplatesOptions.java | 307 + .../v1/model/ListRolesOptions.java | 234 + .../v1/model/ListV2PoliciesOptions.java | 492 ++ .../v1/model/NestedCondition.java | 126 + .../model/NestedConditionRuleAttribute.java | 170 + .../NestedConditionRuleWithConditions.java | 139 + .../iam_policy_management/v1/model/Next.java | 50 + .../v1/model/PoliciesPager.java | 108 + .../v1/model/Policy.java | 188 + .../model/PolicyAssignmentResourcePolicy.java | 65 + .../v1/model/PolicyAssignmentResources.java | 50 + .../v1/model/PolicyAssignmentV1.java | 193 + .../model/PolicyAssignmentV1Collection.java | 88 + .../v1/model/PolicyAssignmentV1Resources.java | 50 + .../v1/model/PolicyAssignmentV1Subject.java | 60 + .../v1/model/PolicyAssignmentsPager.java | 108 + .../v1/model/PolicyCollection.java | 88 + .../v1/model/PolicyResource.java | 167 + .../v1/model/PolicyRole.java | 131 + .../v1/model/PolicySubject.java | 124 + .../v1/model/PolicyTemplate.java | 202 + .../PolicyTemplateAssignmentCollection.java | 88 + .../model/PolicyTemplateAssignmentItems.java | 261 + ...mplateAssignmentItemsPolicyAssignment.java | 50 + ...lateAssignmentItemsPolicyAssignmentV1.java | 38 + .../v1/model/PolicyTemplateCollection.java | 90 + .../v1/model/PolicyTemplateLimitData.java | 214 + .../v1/model/PolicyTemplateMetaData.java | 201 + .../PolicyTemplateVersionsCollection.java | 88 + .../v1/model/PolicyTemplateVersionsPager.java | 108 + .../v1/model/PolicyTemplatesPager.java | 108 + .../v1/model/Previous.java | 50 + .../ReplaceActionControlTemplateOptions.java | 273 + .../v1/model/ReplacePolicyOptions.java | 335 ++ .../model/ReplacePolicyTemplateOptions.java | 276 + .../v1/model/ReplaceRoleOptions.java | 255 + .../v1/model/ReplaceRoleTemplateOptions.java | 273 + .../v1/model/ReplaceV2PolicyOptions.java | 336 ++ .../v1/model/ResourceAttribute.java | 160 + .../v1/model/ResourceTag.java | 160 + .../iam_policy_management/v1/model/Role.java | 196 + .../v1/model/RoleAction.java | 64 + .../v1/model/RoleAssignment.java | 207 + .../v1/model/RoleAssignmentCollection.java | 88 + .../v1/model/RoleAssignmentResource.java | 50 + .../model/RoleAssignmentResourceCreated.java | 38 + .../v1/model/RoleAssignmentResourceRole.java | 53 + .../v1/model/RoleAssignmentTemplate.java | 134 + .../v1/model/RoleAssignmentsPager.java | 108 + .../v1/model/RoleCollection.java | 68 + .../v1/model/RoleTemplate.java | 202 + .../v1/model/RoleTemplateCollection.java | 90 + .../v1/model/RoleTemplatePrototypeRole.java | 239 + .../v1/model/RoleTemplateReferencesItem.java | 134 + .../model/RoleTemplateVersionsCollection.java | 88 + .../v1/model/RoleTemplateVersionsPager.java | 108 + .../v1/model/RoleTemplatesPager.java | 108 + .../iam_policy_management/v1/model/Roles.java | 106 + .../v1/model/RuleAttribute.java | 209 + .../v1/model/SubjectAttribute.java | 134 + .../v1/model/TemplateActionControl.java | 182 + .../v1/model/TemplateControl.java | 104 + .../v1/model/TemplateCountData.java | 50 + .../v1/model/TemplateGrant.java | 58 + .../v1/model/TemplateGrantRoleReferences.java | 110 + .../v1/model/TemplateGrantRoles.java | 110 + .../v1/model/TemplateMetadata.java | 91 + .../v1/model/TemplatePolicy.java | 272 + .../v1/model/TemplateRole.java | 209 + .../UpdateActionControlAssignmentOptions.java | 166 + .../model/UpdatePolicyAssignmentOptions.java | 196 + .../v1/model/UpdatePolicyStateOptions.java | 171 + .../v1/model/UpdateRoleAssignmentOptions.java | 166 + .../v1/model/UpdateSettingsOptions.java | 199 + .../v1/model/V2PoliciesPager.java | 108 + .../v1/model/V2Policy.java | 247 + .../v1/model/V2PolicyCollection.java | 88 + .../v1/model/V2PolicyResource.java | 167 + .../v1/model/V2PolicyResourceAttribute.java | 181 + .../v1/model/V2PolicyResourceTag.java | 174 + .../v1/model/V2PolicyRule.java | 126 + .../v1/model/V2PolicyRuleRuleAttribute.java | 170 + .../V2PolicyRuleRuleWithNestedConditions.java | 139 + .../v1/model/V2PolicySubject.java | 124 + .../v1/model/V2PolicySubjectAttribute.java | 175 + .../v1/model/V2PolicyTemplateMetaData.java | 260 + .../v1/package-info.java | 17 + .../v1/IamPolicyManagementTest.java | 5007 +++++++++++++++++ .../AccountSettingsAccessManagementTest.java | 40 + ...ActionControlAssignmentCollectionTest.java | 47 + ...olAssignmentResourceActionControlTest.java | 43 + ...nControlAssignmentResourceCreatedTest.java | 37 + .../ActionControlAssignmentResourceTest.java | 45 + .../ActionControlAssignmentTemplateTest.java | 54 + .../v1/model/ActionControlAssignmentTest.java | 40 + .../ActionControlTemplateCollectionTest.java | 46 + .../v1/model/ActionControlTemplateTest.java | 44 + ...ControlTemplateVersionsCollectionTest.java | 46 + .../model/AssignmentResourceCreatedTest.java | 37 + .../v1/model/AssignmentResourceErrorTest.java | 44 + .../v1/model/AssignmentTargetDetailsTest.java | 54 + .../model/AssignmentTemplateDetailsTest.java | 48 + ...ommitActionControlTemplateOptionsTest.java | 47 + .../CommitPolicyTemplateOptionsTest.java | 47 + .../model/CommitRoleTemplateOptionsTest.java | 47 + .../v1/model/ConflictsWithTest.java | 39 + .../v1/model/ControlResponseControlTest.java | 39 + ...lResponseControlWithEnrichedRolesTest.java | 40 + .../v1/model/ControlResponseTest.java | 40 + .../v1/model/ControlTest.java | 63 + ...nControlTemplateAssignmentOptionsTest.java | 65 + ...reateActionControlTemplateOptionsTest.java | 65 + ...tionControlTemplateVersionOptionsTest.java | 63 + .../v1/model/CreatePolicyOptionsTest.java | 103 + ...tePolicyTemplateAssignmentOptionsTest.java | 67 + .../CreatePolicyTemplateOptionsTest.java | 145 + ...reatePolicyTemplateVersionOptionsTest.java | 143 + .../v1/model/CreateRoleOptionsTest.java | 57 + ...eateRoleTemplateAssignmentOptionsTest.java | 65 + .../model/CreateRoleTemplateOptionsTest.java | 69 + .../CreateRoleTemplateVersionOptionsTest.java | 65 + .../v1/model/CreateV2PolicyOptionsTest.java | 131 + .../v1/model/CustomRoleTest.java | 42 + ...eteActionControlAssignmentOptionsTest.java | 45 + ...eleteActionControlTemplateOptionsTest.java | 45 + ...tionControlTemplateVersionOptionsTest.java | 47 + .../DeletePolicyAssignmentOptionsTest.java | 45 + .../v1/model/DeletePolicyOptionsTest.java | 45 + .../DeletePolicyTemplateOptionsTest.java | 45 + ...eletePolicyTemplateVersionOptionsTest.java | 47 + .../DeleteRoleAssignmentOptionsTest.java | 45 + .../v1/model/DeleteRoleOptionsTest.java | 45 + .../model/DeleteRoleTemplateOptionsTest.java | 45 + .../DeleteRoleTemplateVersionOptionsTest.java | 47 + .../v1/model/DeleteV2PolicyOptionsTest.java | 45 + .../v1/model/EnrichedRolesTest.java | 39 + .../v1/model/ErrorDetailsTest.java | 38 + .../v1/model/ErrorObjectTest.java | 42 + ...alAccountIdentityInteractionPatchTest.java | 63 + ...xternalAccountIdentityInteractionTest.java | 39 + .../v1/model/FirstTest.java | 36 + ...GetActionControlAssignmentOptionsTest.java | 45 + .../GetActionControlTemplateOptionsTest.java | 47 + ...tionControlTemplateVersionOptionsTest.java | 47 + .../model/GetPolicyAssignmentOptionsTest.java | 47 + .../v1/model/GetPolicyOptionsTest.java | 45 + .../model/GetPolicyTemplateOptionsTest.java | 47 + .../GetPolicyTemplateVersionOptionsTest.java | 47 + .../model/GetRoleAssignmentOptionsTest.java | 45 + .../v1/model/GetRoleOptionsTest.java | 45 + .../v1/model/GetRoleTemplateOptionsTest.java | 47 + .../GetRoleTemplateVersionOptionsTest.java | 47 + .../v1/model/GetSettingsOptionsTest.java | 47 + .../v1/model/GetV2PolicyOptionsTest.java | 47 + .../v1/model/GrantTest.java | 56 + .../v1/model/GrantWithEnrichedRolesTest.java | 39 + .../v1/model/IdentityTypesBaseTest.java | 53 + .../v1/model/IdentityTypesPatchTest.java | 59 + .../v1/model/IdentityTypesTest.java | 40 + .../v1/model/LimitDataTest.java | 36 + ...stActionControlAssignmentsOptionsTest.java | 55 + ...ionControlTemplateVersionsOptionsTest.java | 51 + ...ListActionControlTemplatesOptionsTest.java | 51 + .../v1/model/ListPoliciesOptionsTest.java | 69 + .../ListPolicyAssignmentsOptionsTest.java | 57 + ...ListPolicyTemplateVersionsOptionsTest.java | 51 + .../model/ListPolicyTemplatesOptionsTest.java | 63 + .../model/ListRoleAssignmentsOptionsTest.java | 55 + .../ListRoleTemplateVersionsOptionsTest.java | 51 + .../model/ListRoleTemplatesOptionsTest.java | 59 + .../v1/model/ListRolesOptionsTest.java | 49 + .../v1/model/ListV2PoliciesOptionsTest.java | 69 + .../NestedConditionRuleAttributeTest.java | 57 + ...NestedConditionRuleWithConditionsTest.java | 63 + .../v1/model/NestedConditionTest.java | 38 + .../v1/model/NextTest.java | 37 + .../PolicyAssignmentResourcePolicyTest.java | 44 + .../model/PolicyAssignmentResourcesTest.java | 44 + .../PolicyAssignmentV1CollectionTest.java | 55 + .../PolicyAssignmentV1ResourcesTest.java | 45 + .../model/PolicyAssignmentV1SubjectTest.java | 36 + .../v1/model/PolicyAssignmentV1Test.java | 51 + .../v1/model/PolicyCollectionTest.java | 52 + .../v1/model/PolicyResourceTest.java | 72 + .../v1/model/PolicyRoleTest.java | 51 + .../v1/model/PolicySubjectTest.java | 58 + ...olicyTemplateAssignmentCollectionTest.java | 55 + ...teAssignmentItemsPolicyAssignmentTest.java | 50 + ...AssignmentItemsPolicyAssignmentV1Test.java | 51 + .../PolicyTemplateAssignmentItemsTest.java | 48 + .../model/PolicyTemplateCollectionTest.java | 55 + .../v1/model/PolicyTemplateLimitDataTest.java | 56 + .../v1/model/PolicyTemplateMetaDataTest.java | 50 + .../v1/model/PolicyTemplateTest.java | 53 + .../PolicyTemplateVersionsCollectionTest.java | 55 + .../v1/model/PolicyTest.java | 48 + .../v1/model/PreviousTest.java | 37 + ...placeActionControlTemplateOptionsTest.java | 67 + .../v1/model/ReplacePolicyOptionsTest.java | 105 + .../ReplacePolicyTemplateOptionsTest.java | 147 + .../v1/model/ReplaceRoleOptionsTest.java | 53 + .../model/ReplaceRoleTemplateOptionsTest.java | 69 + .../v1/model/ReplaceV2PolicyOptionsTest.java | 133 + .../v1/model/ResourceAttributeTest.java | 57 + .../v1/model/ResourceTagTest.java | 57 + .../v1/model/RoleActionTest.java | 39 + .../model/RoleAssignmentCollectionTest.java | 47 + .../RoleAssignmentResourceCreatedTest.java | 37 + .../model/RoleAssignmentResourceRoleTest.java | 43 + .../v1/model/RoleAssignmentResourceTest.java | 45 + .../v1/model/RoleAssignmentTemplateTest.java | 54 + .../v1/model/RoleAssignmentTest.java | 40 + .../v1/model/RoleCollectionTest.java | 41 + .../v1/model/RoleTemplateCollectionTest.java | 46 + .../model/RoleTemplatePrototypeRoleTest.java | 62 + .../model/RoleTemplateReferencesItemTest.java | 54 + .../v1/model/RoleTemplateTest.java | 44 + .../RoleTemplateVersionsCollectionTest.java | 46 + .../v1/model/RoleTest.java | 56 + .../v1/model/RolesTest.java | 51 + .../v1/model/RuleAttributeTest.java | 57 + .../v1/model/SubjectAttributeTest.java | 54 + .../v1/model/TemplateActionControlTest.java | 56 + .../v1/model/TemplateControlTest.java | 63 + .../v1/model/TemplateCountDataTest.java | 39 + .../TemplateGrantRoleReferencesTest.java | 58 + .../v1/model/TemplateGrantRolesTest.java | 56 + .../v1/model/TemplateGrantTest.java | 39 + .../v1/model/TemplateMetadataTest.java | 41 + .../v1/model/TemplatePolicyTest.java | 141 + .../v1/model/TemplateRoleTest.java | 59 + ...ateActionControlAssignmentOptionsTest.java | 49 + .../UpdatePolicyAssignmentOptionsTest.java | 51 + .../model/UpdatePolicyStateOptionsTest.java | 49 + .../UpdateRoleAssignmentOptionsTest.java | 49 + .../v1/model/UpdateSettingsOptionsTest.java | 75 + .../v1/model/V2PolicyCollectionTest.java | 55 + .../model/V2PolicyResourceAttributeTest.java | 57 + .../v1/model/V2PolicyResourceTagTest.java | 57 + .../v1/model/V2PolicyResourceTest.java | 72 + .../model/V2PolicyRuleRuleAttributeTest.java | 57 + ...olicyRuleRuleWithNestedConditionsTest.java | 63 + .../v1/model/V2PolicyRuleTest.java | 38 + .../model/V2PolicySubjectAttributeTest.java | 57 + .../v1/model/V2PolicySubjectTest.java | 60 + .../model/V2PolicyTemplateMetaDataTest.java | 57 + .../v1/model/V2PolicyTest.java | 55 + .../v1/utils/TestUtilities.java | 131 + 333 files changed, 41258 insertions(+) create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java new file mode 100644 index 00000000000..2abe3baea4e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java @@ -0,0 +1,2566 @@ +/* + * (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. + */ + +/* + * IBM OpenAPI SDK Code Generator Version: 3.107.1-41b0fbd0-20250825-080732 + */ + +package com.ibm.cloud.platform_services.iam_policy_management.v1; + +import com.google.gson.JsonObject; +import com.ibm.cloud.platform_services.common.SdkCommon; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; +import com.ibm.cloud.sdk.core.http.RequestBuilder; +import com.ibm.cloud.sdk.core.http.ResponseConverter; +import com.ibm.cloud.sdk.core.http.ServiceCall; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.ConfigBasedAuthenticatorFactory; +import com.ibm.cloud.sdk.core.service.BaseService; +import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; + +/** + * IAM Policy Management API. + * + * API Version: 1.0.1 + */ +public class IamPolicyManagement extends BaseService { + + /** + * Default service name used when configuring the `IamPolicyManagement` client. + */ + public static final String DEFAULT_SERVICE_NAME = "iam_policy_management"; + + /** + * Default service endpoint URL. + */ + public static final String DEFAULT_SERVICE_URL = "https://iam.cloud.ibm.com"; + + /** + * Class method which constructs an instance of the `IamPolicyManagement` client. + * The default service name is used to configure the client instance. + * + * @return an instance of the `IamPolicyManagement` client using external configuration + */ + public static IamPolicyManagement newInstance() { + return newInstance(DEFAULT_SERVICE_NAME); + } + + /** + * Class method which constructs an instance of the `IamPolicyManagement` client. + * The specified service name is used to configure the client instance. + * + * @param serviceName the service name to be used when configuring the client instance + * @return an instance of the `IamPolicyManagement` client using external configuration + */ + public static IamPolicyManagement newInstance(String serviceName) { + Authenticator authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(serviceName); + IamPolicyManagement service = new IamPolicyManagement(serviceName, authenticator); + service.configureService(serviceName); + return service; + } + + /** + * Constructs an instance of the `IamPolicyManagement` client. + * The specified service name and authenticator are used to configure the client instance. + * + * @param serviceName the service name to be used when configuring the client instance + * @param authenticator the {@link Authenticator} instance to be configured for this client + */ + public IamPolicyManagement(String serviceName, Authenticator authenticator) { + super(serviceName, authenticator); + setServiceUrl(DEFAULT_SERVICE_URL); + } + + /** + * Get policies by attributes. + * + * Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account + * and filter by attribute values. This can be done through query parameters. The following attributes are supported: + * account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query + * parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If + * the caller does not have read access to any policies an empty array is returned. + * + * @param listPoliciesOptions the {@link ListPoliciesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyCollection} + */ + public ServiceCall listPolicies(ListPoliciesOptions listPoliciesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listPoliciesOptions, + "listPoliciesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicies"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listPoliciesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listPoliciesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listPoliciesOptions.accountId())); + if (listPoliciesOptions.iamId() != null) { + builder.query("iam_id", String.valueOf(listPoliciesOptions.iamId())); + } + if (listPoliciesOptions.accessGroupId() != null) { + builder.query("access_group_id", String.valueOf(listPoliciesOptions.accessGroupId())); + } + if (listPoliciesOptions.type() != null) { + builder.query("type", String.valueOf(listPoliciesOptions.type())); + } + if (listPoliciesOptions.serviceType() != null) { + builder.query("service_type", String.valueOf(listPoliciesOptions.serviceType())); + } + if (listPoliciesOptions.tagName() != null) { + builder.query("tag_name", String.valueOf(listPoliciesOptions.tagName())); + } + if (listPoliciesOptions.tagValue() != null) { + builder.query("tag_value", String.valueOf(listPoliciesOptions.tagValue())); + } + if (listPoliciesOptions.sort() != null) { + builder.query("sort", String.valueOf(listPoliciesOptions.sort())); + } + if (listPoliciesOptions.format() != null) { + builder.query("format", String.valueOf(listPoliciesOptions.format())); + } + if (listPoliciesOptions.state() != null) { + builder.query("state", String.valueOf(listPoliciesOptions.state())); + } + if (listPoliciesOptions.limit() != null) { + builder.query("limit", String.valueOf(listPoliciesOptions.limit())); + } + if (listPoliciesOptions.start() != null) { + builder.query("start", String.valueOf(listPoliciesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a policy. + * + * Creates a policy to grant access between a subject and a resource. There are two types of policies: **access** and + * **authorization**. A policy administrator might want to create an access policy which grants access to a user, + * service-id, or an access group. They might also want to create an authorization policy and setup access between + * services. + * + * ### Access + * + * To create an access policy, use **`"type": "access"`** in the body. The possible subject attributes are + * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or + * service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. Assign roles + * that are supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or + * **`service_group_id`** attribute and the **`accountId`** attribute. The IAM Services group (`IAM`) is a subset of + * account management services that includes the IAM platform services IAM Identity, IAM Access Management, IAM Users + * Management, IAM Groups, and future IAM services. If the subject is a locked service-id, the request will fail. + * + * ### Authorization + * + * Authorization policies are supported by services on a case by case basis. Refer to service documentation to verify + * their support of authorization policies. To create an authorization policy, use **`"type": "authorization"`** in + * the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject + * attributes might be provided. The following attributes are supported: + * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are + * supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access + * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject + * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. + * + * ### Attribute Operators + * + * Currently, only the `stringEquals` and the `stringMatch` operators are available. Resource attributes may support + * one or both operators. For more information, see [Assigning access by using wildcard + * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). + * + * ### Attribute Validations + * + * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like + * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated + * against Global Catalog locations. + * + * @param createPolicyOptions the {@link CreatePolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Policy} + */ + public ServiceCall createPolicy(CreatePolicyOptions createPolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyOptions, + "createPolicyOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createPolicyOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createPolicyOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("type", createPolicyOptions.type()); + contentJson.add("subjects", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.subjects())); + contentJson.add("roles", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.roles())); + contentJson.add("resources", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.resources())); + if (createPolicyOptions.description() != null) { + contentJson.addProperty("description", createPolicyOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a policy. + * + * Update a policy to grant access between a subject and a resource. A policy administrator might want to update an + * existing policy. The policy type cannot be changed (You cannot change an access policy to an authorization policy). + * + * ### Access + * + * To update an access policy, use **`"type": "access"`** in the body. The possible subject attributes are + * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or + * service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. Assign roles + * that are supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * The policy resource must include either the **`serviceType`**, **`serviceName`**, or **`resourceGroupId`** + * attribute and the **`accountId`** attribute.` If the subject is a locked service-id, the request will fail. + * + * ### Authorization + * + * To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match + * the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following + * attributes are supported: + * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are + * supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access + * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject + * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. + * + * ### Attribute Operators + * + * Currently, only the `stringEquals` and the `stringMatch` operators are available. Resource attributes might support + * one or both operators. For more information, see [Assigning access by using wildcard + * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). + * + * ### Attribute Validations + * + * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like + * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated + * against Global Catalog locations. + * + * @param replacePolicyOptions the {@link ReplacePolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Policy} + */ + public ServiceCall replacePolicy(ReplacePolicyOptions replacePolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replacePolicyOptions, + "replacePolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_id", replacePolicyOptions.policyId()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replacePolicy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replacePolicyOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("type", replacePolicyOptions.type()); + contentJson.add("subjects", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.subjects())); + contentJson.add("roles", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.roles())); + contentJson.add("resources", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.resources())); + if (replacePolicyOptions.description() != null) { + contentJson.addProperty("description", replacePolicyOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a policy by ID. + * + * Retrieve a policy by providing a policy ID. + * + * @param getPolicyOptions the {@link GetPolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateMetaData} + */ + public ServiceCall getPolicy(GetPolicyOptions getPolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyOptions, + "getPolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_id", getPolicyOptions.policyId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicy"); + 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); + } + + /** + * Delete a policy by ID. + * + * Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service + * ID. If the subject of the policy is a locked service-id, the request will fail. + * + * @param deletePolicyOptions the {@link DeletePolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deletePolicy(DeletePolicyOptions deletePolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyOptions, + "deletePolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_id", deletePolicyOptions.policyId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Restore a deleted policy by ID. + * + * Restore a policy that has recently been deleted. A policy administrator might want to restore a deleted policy. To + * restore a policy, use **`"state": "active"`** in the body. + * + * @param updatePolicyStateOptions the {@link UpdatePolicyStateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Policy} + */ + public ServiceCall updatePolicyState(UpdatePolicyStateOptions updatePolicyStateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updatePolicyStateOptions, + "updatePolicyStateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_id", updatePolicyStateOptions.policyId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updatePolicyState"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updatePolicyStateOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + if (updatePolicyStateOptions.state() != null) { + contentJson.addProperty("state", updatePolicyStateOptions.state()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get roles by filters. + * + * Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can + * be done through query parameters. Currently, we only support the following attributes: account_id, service_name, + * service_group_id, source_service_name and policy_type. Both service_name and service_group_id attributes are + * mutually exclusive. Only roles that match the filter and that the caller has read access to are returned. If the + * caller does not have read access to any roles an empty array is returned. + * + * @param listRolesOptions the {@link ListRolesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleCollection} + */ + public ServiceCall listRoles(ListRolesOptions listRolesOptions) { + if (listRolesOptions == null) { + listRolesOptions = new ListRolesOptions.Builder().build(); + } + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoles"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listRolesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listRolesOptions.acceptLanguage()); + } + if (listRolesOptions.accountId() != null) { + builder.query("account_id", String.valueOf(listRolesOptions.accountId())); + } + if (listRolesOptions.serviceName() != null) { + builder.query("service_name", String.valueOf(listRolesOptions.serviceName())); + } + if (listRolesOptions.sourceServiceName() != null) { + builder.query("source_service_name", String.valueOf(listRolesOptions.sourceServiceName())); + } + if (listRolesOptions.policyType() != null) { + builder.query("policy_type", String.valueOf(listRolesOptions.policyType())); + } + if (listRolesOptions.serviceGroupId() != null) { + builder.query("service_group_id", String.valueOf(listRolesOptions.serviceGroupId())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get roles by filters. + * + * Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can + * be done through query parameters. Currently, we only support the following attributes: account_id, service_name, + * service_group_id, source_service_name and policy_type. Both service_name and service_group_id attributes are + * mutually exclusive. Only roles that match the filter and that the caller has read access to are returned. If the + * caller does not have read access to any roles an empty array is returned. + * + * @return a {@link ServiceCall} with a result of type {@link RoleCollection} + */ + public ServiceCall listRoles() { + return listRoles(null); + } + + /** + * Create a role. + * + * Creates a custom role for a specific service within the account. An account owner or a user assigned the + * Administrator role on the Role management service can create a custom role. Any number of actions for a single + * service can be mapped to the new role, but there must be at least one service-defined action to successfully create + * the new role. + * + * @param createRoleOptions the {@link CreateRoleOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link CustomRole} + */ + public ServiceCall createRole(CreateRoleOptions createRoleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleOptions, + "createRoleOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRole"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createRoleOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createRoleOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("display_name", createRoleOptions.displayName()); + contentJson.add("actions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleOptions.actions())); + contentJson.addProperty("name", createRoleOptions.name()); + contentJson.addProperty("account_id", createRoleOptions.accountId()); + contentJson.addProperty("service_name", createRoleOptions.serviceName()); + if (createRoleOptions.description() != null) { + contentJson.addProperty("description", createRoleOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a role. + * + * Update a custom role. A role administrator might want to update an existing role by updating the display name, + * description, or the actions that are mapped to the role. The name, account_id, and service_name can't be changed. + * + * @param replaceRoleOptions the {@link ReplaceRoleOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link CustomRole} + */ + public ServiceCall replaceRole(ReplaceRoleOptions replaceRoleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceRoleOptions, + "replaceRoleOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_id", replaceRoleOptions.roleId()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceRole"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replaceRoleOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("display_name", replaceRoleOptions.displayName()); + contentJson.add("actions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRoleOptions.actions())); + if (replaceRoleOptions.description() != null) { + contentJson.addProperty("description", replaceRoleOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a role by ID. + * + * Retrieve a role by providing a role ID. + * + * @param getRoleOptions the {@link GetRoleOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link CustomRole} + */ + public ServiceCall getRole(GetRoleOptions getRoleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleOptions, + "getRoleOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_id", getRoleOptions.roleId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRole"); + 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); + } + + /** + * Delete a role by ID. + * + * Delete a role by providing a role ID. + * + * @param deleteRoleOptions the {@link DeleteRoleOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteRole(DeleteRoleOptions deleteRoleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleOptions, + "deleteRoleOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_id", deleteRoleOptions.roleId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRole"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get policies by attributes. + * + * Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account + * and filter by attribute values. This can be done through query parameters. The following attributes are supported: + * account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query + * parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If + * the caller does not have read access to any policies an empty array is returned. + * + * @param listV2PoliciesOptions the {@link ListV2PoliciesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link V2PolicyCollection} + */ + public ServiceCall listV2Policies(ListV2PoliciesOptions listV2PoliciesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listV2PoliciesOptions, + "listV2PoliciesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listV2Policies"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listV2PoliciesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listV2PoliciesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listV2PoliciesOptions.accountId())); + if (listV2PoliciesOptions.iamId() != null) { + builder.query("iam_id", String.valueOf(listV2PoliciesOptions.iamId())); + } + if (listV2PoliciesOptions.accessGroupId() != null) { + builder.query("access_group_id", String.valueOf(listV2PoliciesOptions.accessGroupId())); + } + if (listV2PoliciesOptions.type() != null) { + builder.query("type", String.valueOf(listV2PoliciesOptions.type())); + } + if (listV2PoliciesOptions.serviceType() != null) { + builder.query("service_type", String.valueOf(listV2PoliciesOptions.serviceType())); + } + if (listV2PoliciesOptions.serviceName() != null) { + builder.query("service_name", String.valueOf(listV2PoliciesOptions.serviceName())); + } + if (listV2PoliciesOptions.serviceGroupId() != null) { + builder.query("service_group_id", String.valueOf(listV2PoliciesOptions.serviceGroupId())); + } + if (listV2PoliciesOptions.sort() != null) { + builder.query("sort", String.valueOf(listV2PoliciesOptions.sort())); + } + if (listV2PoliciesOptions.format() != null) { + builder.query("format", String.valueOf(listV2PoliciesOptions.format())); + } + if (listV2PoliciesOptions.state() != null) { + builder.query("state", String.valueOf(listV2PoliciesOptions.state())); + } + if (listV2PoliciesOptions.limit() != null) { + builder.query("limit", String.valueOf(listV2PoliciesOptions.limit())); + } + if (listV2PoliciesOptions.start() != null) { + builder.query("start", String.valueOf(listV2PoliciesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a policy. + * + * Creates a policy to grant access between a subject and a resource. Currently, there is one type of a v2/policy: + * **access**. A policy administrator might want to create an access policy that grants access to a user, service-id, + * or an access group. + * + * ### Access + * + * To create an access policy, use **`"type": "access"`** in the body. The supported subject attributes are + * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute to assign access to a user or + * service-id. Use the **`access_group_id`** subject attribute to assign access to an access group. Assign roles that + * are supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or + * **`service_group_id`** attribute and the **`accountId`** attribute. In the rule field, you can specify a single + * condition by using **`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`** with a + * combination **`operator`**. The possible combination operators are **`and`** and **`or`**. + * + * Currently, we support two types of patterns: + * + * 1. `time-based`: Used to specify a time-based restriction + * + * Combine conditions to specify a time-based restriction (e.g., access only during business hours, during the + * Monday-Friday work week). For example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following + * rule: + * ```json + * "rule": { + * "operator": "and", + * "conditions": [{ + * "key": "{{environment.attributes.day_of_week}}", + * "operator": "dayOfWeekAnyOf", + * "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] + * }, + * "key": "{{environment.attributes.current_time}}", + * "operator": "timeGreaterThanOrEquals", + * "value": "09:00:00+00:00" + * }, + * "key": "{{environment.attributes.current_time}}", + * "operator": "timeLessThanOrEquals", + * "value": "17:00:00+00:00" + * }] + * } + * ``` You can use the following operators in the **`key`** and **`value`** pair: + * ``` + * 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', + * 'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan', 'dateGreaterThanOrEquals', + * 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', + * 'dayOfWeekEquals', 'dayOfWeekAnyOf' + * ``` + * + * The pattern field that matches the rule is required when rule is provided. For the business hour rule example + * above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions + * operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) and + * [Limiting access with time-based conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the + * subject is a locked service-id, the request will fail. + * + * 2. `attribute-based`: Used to specify a combination of OR/AND based conditions applied on resource attributes. + * + * Combine conditions to specify an attribute-based condition using AND/OR-based operators. + * + * For example, a policy can grant access based on multiple conditions applied on the resource attributes below: + * ```json + * "pattern": "attribute-based-condition:resource:literal-and-wildcard" + * "rule": { + * "operator": "or", + * "conditions": [ + * { + * "operator": "and", + * "conditions": [ + * { + * "key": "{{resource.attributes.prefix}}", + * "operator": "stringEquals", + * "value": "home/test" + * }, + * { + * "key": "{{environment.attributes.delimiter}}", + * "operator": "stringEquals", + * "value": "/" + * } + * ] + * }, + * { + * "key": "{{resource.attributes.path}}", + * "operator": "stringMatch", + * "value": "home/David/_*" + * } + * ] + * } + * ``` + * + * In addition to satisfying the `resources` section, the policy grants permission only if either the `path` begins + * with `home/David/` **OR** the `prefix` is `home/test` and the `delimiter` is `/`. This mechanism helps you + * consolidate multiple policies in to a single policy, making policies easier to administer and stay within the + * policy limit for an account. View the list of operators that can be used in the condition + * [here](/docs/account?topic=account-wildcard#string-comparisons). + * + * ### Authorization + * + * Authorization policies are supported by services on a case by case basis. Refer to service documentation to verify + * their support of authorization policies. To create an authorization policy, use **`"type": "authorization"`** in + * the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject + * attributes might be provided. The following attributes are supported: + * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are + * supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access + * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject + * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. + * + * ### Attribute Operators + * + * Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators are available. For more + * information, see [Assigning access by using wildcard + * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). + * + * ### Attribute Validations + * + * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like + * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated + * against Global Catalog locations. + * + * @param createV2PolicyOptions the {@link CreateV2PolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link V2Policy} + */ + public ServiceCall createV2Policy(CreateV2PolicyOptions createV2PolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createV2PolicyOptions, + "createV2PolicyOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createV2Policy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createV2PolicyOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createV2PolicyOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.add("control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.control())); + contentJson.addProperty("type", createV2PolicyOptions.type()); + if (createV2PolicyOptions.description() != null) { + contentJson.addProperty("description", createV2PolicyOptions.description()); + } + if (createV2PolicyOptions.subject() != null) { + contentJson.add("subject", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.subject())); + } + if (createV2PolicyOptions.resource() != null) { + contentJson.add("resource", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.resource())); + } + if (createV2PolicyOptions.pattern() != null) { + contentJson.addProperty("pattern", createV2PolicyOptions.pattern()); + } + if (createV2PolicyOptions.rule() != null) { + contentJson.add("rule", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.rule())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a policy. + * + * Update a policy to grant access between a subject and a resource. A policy administrator might want to update an + * existing policy. + * + * ### Access + * + * To update an access policy, use **`"type": "access"`** in the body. The supported subject attributes are + * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute to assign access to a user or + * service-id. Use the **`access_group_id`** subject attribute to assign access to an access group. Assign roles that + * are supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or + * **`service_group_id`** attribute and the **`accountId`** attribute. In the rule field, you can specify a single + * condition by using **`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`** with a + * combination **`operator`**. The possible combination operators are **`and`** and **`or`**. + * + * Currently, we support two types of patterns: + * + * 1. `time-based`: Used to specify a time-based restriction + * + * Combine conditions to specify a time-based restriction (e.g., access only during business hours, during the + * Monday-Friday work week). For example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following + * rule: + * ```json + * "rule": { + * "operator": "and", + * "conditions": [{ + * "key": "{{environment.attributes.day_of_week}}", + * "operator": "dayOfWeekAnyOf", + * "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] + * }, + * "key": "{{environment.attributes.current_time}}", + * "operator": "timeGreaterThanOrEquals", + * "value": "09:00:00+00:00" + * }, + * "key": "{{environment.attributes.current_time}}", + * "operator": "timeLessThanOrEquals", + * "value": "17:00:00+00:00" + * }] + * } + * ``` You can use the following operators in the **`key`** and **`value`** pair: + * ``` + * 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', + * 'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan', 'dateGreaterThanOrEquals', + * 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', + * 'dayOfWeekEquals', 'dayOfWeekAnyOf' + * ``` The pattern field that matches the rule is required when rule is provided. For the business hour rule example + * above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions + * operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) and + * [Limiting access with time-based conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the + * subject is a locked service-id, the request will fail. + * + * 2. `attribute-based`: Used to specify a combination of OR/AND based conditions applied on resource attributes. + * + * Combine conditions to specify an attribute-based condition using AND/OR-based operators. + * + * For example, a policy can grant access based on multiple conditions applied on the resource attributes below: + * ```json + * "pattern": "attribute-based-condition:resource:literal-and-wildcard" + * "rule": { + * "operator": "or", + * "conditions": [ + * { + * "operator": "and", + * "conditions": [ + * { + * "key": "{{resource.attributes.prefix}}", + * "operator": "stringEquals", + * "value": "home/test" + * }, + * { + * "key": "{{environment.attributes.delimiter}}", + * "operator": "stringEquals", + * "value": "/" + * } + * ] + * }, + * { + * "key": "{{resource.attributes.path}}", + * "operator": "stringMatch", + * "value": "home/David/_*" + * } + * ] + * } + * ``` + * + * In addition to satisfying the `resources` section, the policy grants permission only if either the `path` begins + * with `home/David/` **OR** the `prefix` is `home/test` and the `delimiter` is `/`. This mechanism helps you + * consolidate multiple policies in to a single policy, making policies easier to administer and stay within the + * policy limit for an account. View the list of operators that can be used in the condition + * [here](/docs/account?topic=account-wildcard#string-comparisons). + * + * ### Authorization + * + * To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match + * the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following + * attributes are supported: + * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are + * supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access + * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject + * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. + * + * ### Attribute Operators + * + * Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators are available. For more + * information, see [Assigning access by using wildcard + * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). + * + * ### Attribute Validations + * + * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like + * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated + * against Global Catalog locations. + * + * @param replaceV2PolicyOptions the {@link ReplaceV2PolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link V2Policy} + */ + public ServiceCall replaceV2Policy(ReplaceV2PolicyOptions replaceV2PolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceV2PolicyOptions, + "replaceV2PolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("id", replaceV2PolicyOptions.id()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceV2Policy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replaceV2PolicyOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.add("control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.control())); + contentJson.addProperty("type", replaceV2PolicyOptions.type()); + if (replaceV2PolicyOptions.description() != null) { + contentJson.addProperty("description", replaceV2PolicyOptions.description()); + } + if (replaceV2PolicyOptions.subject() != null) { + contentJson.add("subject", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.subject())); + } + if (replaceV2PolicyOptions.resource() != null) { + contentJson.add("resource", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.resource())); + } + if (replaceV2PolicyOptions.pattern() != null) { + contentJson.addProperty("pattern", replaceV2PolicyOptions.pattern()); + } + if (replaceV2PolicyOptions.rule() != null) { + contentJson.add("rule", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.rule())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a policy by ID. + * + * Retrieve a policy by providing a policy ID. + * + * @param getV2PolicyOptions the {@link GetV2PolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link V2PolicyTemplateMetaData} + */ + public ServiceCall getV2Policy(GetV2PolicyOptions getV2PolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getV2PolicyOptions, + "getV2PolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("id", getV2PolicyOptions.id()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getV2Policy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getV2PolicyOptions.format() != null) { + builder.query("format", String.valueOf(getV2PolicyOptions.format())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a policy by ID. + * + * Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service + * ID. If the subject of the policy is a locked service-id, the request will fail. + * + * @param deleteV2PolicyOptions the {@link DeleteV2PolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteV2Policy(DeleteV2PolicyOptions deleteV2PolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteV2PolicyOptions, + "deleteV2PolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("id", deleteV2PolicyOptions.id()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteV2Policy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * List policy templates by attributes. + * + * List policy templates and filter by attributes by using query parameters. The following attributes are supported: + * `account_id`, `policy_service_name`, `policy_service_type`, `policy_service_group_id` and `policy_type`. + * `account_id` is a required query parameter. These attributes `policy_service_name`, `policy_service_type` and + * `policy_service_group_id` are mutually exclusive. Only policy templates that have the specified attributes and that + * the caller has read access to are returned. If the caller does not have read access to any policy templates an + * empty array is returned. + * + * @param listPolicyTemplatesOptions the {@link ListPolicyTemplatesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateCollection} + */ + public ServiceCall listPolicyTemplates(ListPolicyTemplatesOptions listPolicyTemplatesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyTemplatesOptions, + "listPolicyTemplatesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyTemplates"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listPolicyTemplatesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listPolicyTemplatesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listPolicyTemplatesOptions.accountId())); + if (listPolicyTemplatesOptions.state() != null) { + builder.query("state", String.valueOf(listPolicyTemplatesOptions.state())); + } + if (listPolicyTemplatesOptions.name() != null) { + builder.query("name", String.valueOf(listPolicyTemplatesOptions.name())); + } + if (listPolicyTemplatesOptions.policyServiceType() != null) { + builder.query("policy_service_type", String.valueOf(listPolicyTemplatesOptions.policyServiceType())); + } + if (listPolicyTemplatesOptions.policyServiceName() != null) { + builder.query("policy_service_name", String.valueOf(listPolicyTemplatesOptions.policyServiceName())); + } + if (listPolicyTemplatesOptions.policyServiceGroupId() != null) { + builder.query("policy_service_group_id", String.valueOf(listPolicyTemplatesOptions.policyServiceGroupId())); + } + if (listPolicyTemplatesOptions.policyType() != null) { + builder.query("policy_type", String.valueOf(listPolicyTemplatesOptions.policyType())); + } + if (listPolicyTemplatesOptions.limit() != null) { + builder.query("limit", String.valueOf(listPolicyTemplatesOptions.limit())); + } + if (listPolicyTemplatesOptions.start() != null) { + builder.query("start", String.valueOf(listPolicyTemplatesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a policy template. + * + * Create a policy template. Policy templates define a policy without requiring a subject, and you can use them to + * grant access to multiple subjects. + * + * @param createPolicyTemplateOptions the {@link CreatePolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateLimitData} + */ + public ServiceCall createPolicyTemplate(CreatePolicyTemplateOptions createPolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateOptions, + "createPolicyTemplateOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createPolicyTemplateOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createPolicyTemplateOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("name", createPolicyTemplateOptions.name()); + contentJson.addProperty("account_id", createPolicyTemplateOptions.accountId()); + contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateOptions.policy())); + if (createPolicyTemplateOptions.description() != null) { + contentJson.addProperty("description", createPolicyTemplateOptions.description()); + } + if (createPolicyTemplateOptions.committed() != null) { + contentJson.addProperty("committed", createPolicyTemplateOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve latest version of a policy template. + * + * Retrieve the latest version of a policy template by providing a policy template ID. + * + * @param getPolicyTemplateOptions the {@link GetPolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} + */ + public ServiceCall getPolicyTemplate(GetPolicyTemplateOptions getPolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyTemplateOptions, + "getPolicyTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", getPolicyTemplateOptions.policyTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getPolicyTemplateOptions.state() != null) { + builder.query("state", String.valueOf(getPolicyTemplateOptions.state())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a policy template. + * + * Delete a policy template by providing the policy template ID. This deletes all versions of this template. A policy + * template can't be deleted if any version of the template is assigned to one or more child accounts. You must remove + * the policy assignments first. + * + * @param deletePolicyTemplateOptions the {@link DeletePolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deletePolicyTemplate(DeletePolicyTemplateOptions deletePolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyTemplateOptions, + "deletePolicyTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", deletePolicyTemplateOptions.policyTemplateId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a new policy template version. + * + * Create a new version of a policy template. Use this if you need to make updates to a policy template that is + * committed. + * + * @param createPolicyTemplateVersionOptions the {@link CreatePolicyTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateLimitData} + */ + public ServiceCall createPolicyTemplateVersion(CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateVersionOptions, + "createPolicyTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", createPolicyTemplateVersionOptions.policyTemplateId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateVersionOptions.policy())); + if (createPolicyTemplateVersionOptions.name() != null) { + contentJson.addProperty("name", createPolicyTemplateVersionOptions.name()); + } + if (createPolicyTemplateVersionOptions.description() != null) { + contentJson.addProperty("description", createPolicyTemplateVersionOptions.description()); + } + if (createPolicyTemplateVersionOptions.committed() != null) { + contentJson.addProperty("committed", createPolicyTemplateVersionOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve policy template versions. + * + * Retrieve the versions of a policy template by providing a policy template ID. + * + * @param listPolicyTemplateVersionsOptions the {@link ListPolicyTemplateVersionsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateVersionsCollection} + */ + public ServiceCall listPolicyTemplateVersions(ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyTemplateVersionsOptions, + "listPolicyTemplateVersionsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", listPolicyTemplateVersionsOptions.policyTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyTemplateVersions"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listPolicyTemplateVersionsOptions.state() != null) { + builder.query("state", String.valueOf(listPolicyTemplateVersionsOptions.state())); + } + if (listPolicyTemplateVersionsOptions.limit() != null) { + builder.query("limit", String.valueOf(listPolicyTemplateVersionsOptions.limit())); + } + if (listPolicyTemplateVersionsOptions.start() != null) { + builder.query("start", String.valueOf(listPolicyTemplateVersionsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a policy template version. + * + * Update a specific version of a policy template. You can use this only if the version isn't committed. + * + * @param replacePolicyTemplateOptions the {@link ReplacePolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} + */ + public ServiceCall replacePolicyTemplate(ReplacePolicyTemplateOptions replacePolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replacePolicyTemplateOptions, + "replacePolicyTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", replacePolicyTemplateOptions.policyTemplateId()); + pathParamsMap.put("version", replacePolicyTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replacePolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replacePolicyTemplateOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyTemplateOptions.policy())); + if (replacePolicyTemplateOptions.name() != null) { + contentJson.addProperty("name", replacePolicyTemplateOptions.name()); + } + if (replacePolicyTemplateOptions.description() != null) { + contentJson.addProperty("description", replacePolicyTemplateOptions.description()); + } + if (replacePolicyTemplateOptions.committed() != null) { + contentJson.addProperty("committed", replacePolicyTemplateOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a policy template version. + * + * Delete a specific version of a policy template by providing a policy template ID and version number. You can't + * delete a policy template version that is assigned to one or more child accounts. You must remove the policy + * assignments first. + * + * @param deletePolicyTemplateVersionOptions the {@link DeletePolicyTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deletePolicyTemplateVersion(DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyTemplateVersionOptions, + "deletePolicyTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", deletePolicyTemplateVersionOptions.policyTemplateId()); + pathParamsMap.put("version", deletePolicyTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a policy template version. + * + * Retrieve a policy template by providing a policy template ID and version number. + * + * @param getPolicyTemplateVersionOptions the {@link GetPolicyTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} + */ + public ServiceCall getPolicyTemplateVersion(GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyTemplateVersionOptions, + "getPolicyTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", getPolicyTemplateVersionOptions.policyTemplateId()); + pathParamsMap.put("version", getPolicyTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyTemplateVersion"); + 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); + } + + /** + * Commit a policy template version. + * + * Commit a policy template version. You can make no further changes to the policy template once it's committed. If + * you need to make updates after committing a version, create a new version. + * + * @param commitPolicyTemplateOptions the {@link CommitPolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall commitPolicyTemplate(CommitPolicyTemplateOptions commitPolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(commitPolicyTemplateOptions, + "commitPolicyTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", commitPolicyTemplateOptions.policyTemplateId()); + pathParamsMap.put("version", commitPolicyTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}/commit", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitPolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get policy template assignments. + * + * Get policy template assignments by attributes. The following attributes are supported: + * `account_id`, `template_id`, `template_version`, `sort`. + * `account_id` is a required query parameter. Only policy template assignments that have the specified attributes and + * that the caller has read access to are returned. If the caller does not have read access to any policy template + * assignments an empty array is returned. + * + * @param listPolicyAssignmentsOptions the {@link ListPolicyAssignmentsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateAssignmentCollection} + */ + public ServiceCall listPolicyAssignments(ListPolicyAssignmentsOptions listPolicyAssignmentsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyAssignmentsOptions, + "listPolicyAssignmentsOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyAssignments"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listPolicyAssignmentsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listPolicyAssignmentsOptions.acceptLanguage()); + } + builder.query("version", String.valueOf(listPolicyAssignmentsOptions.version())); + builder.query("account_id", String.valueOf(listPolicyAssignmentsOptions.accountId())); + if (listPolicyAssignmentsOptions.templateId() != null) { + builder.query("template_id", String.valueOf(listPolicyAssignmentsOptions.templateId())); + } + if (listPolicyAssignmentsOptions.templateVersion() != null) { + builder.query("template_version", String.valueOf(listPolicyAssignmentsOptions.templateVersion())); + } + if (listPolicyAssignmentsOptions.limit() != null) { + builder.query("limit", String.valueOf(listPolicyAssignmentsOptions.limit())); + } + if (listPolicyAssignmentsOptions.start() != null) { + builder.query("start", String.valueOf(listPolicyAssignmentsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a policy authorization template assignment. + * + * Assign a policy template to child accounts and account groups. This creates the policy in the accounts and account + * groups that you specify. + * + * @param createPolicyTemplateAssignmentOptions the {@link CreatePolicyTemplateAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyAssignmentV1Collection} + */ + public ServiceCall createPolicyTemplateAssignment(CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateAssignmentOptions, + "createPolicyTemplateAssignmentOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplateAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createPolicyTemplateAssignmentOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createPolicyTemplateAssignmentOptions.acceptLanguage()); + } + builder.query("version", String.valueOf(createPolicyTemplateAssignmentOptions.version())); + final JsonObject contentJson = new JsonObject(); + contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateAssignmentOptions.target())); + contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateAssignmentOptions.templates())); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a policy assignment. + * + * Retrieve a policy template assignment by providing a policy assignment ID. + * + * @param getPolicyAssignmentOptions the {@link GetPolicyAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateAssignmentItems} + */ + public ServiceCall getPolicyAssignment(GetPolicyAssignmentOptions getPolicyAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyAssignmentOptions, + "getPolicyAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", getPolicyAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.query("version", String.valueOf(getPolicyAssignmentOptions.version())); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a policy authorization type assignment. + * + * Update a policy assignment by providing a policy assignment ID. + * + * @param updatePolicyAssignmentOptions the {@link UpdatePolicyAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyAssignmentV1} + */ + public ServiceCall updatePolicyAssignment(UpdatePolicyAssignmentOptions updatePolicyAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updatePolicyAssignmentOptions, + "updatePolicyAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", updatePolicyAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updatePolicyAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updatePolicyAssignmentOptions.ifMatch()); + builder.query("version", String.valueOf(updatePolicyAssignmentOptions.version())); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("template_version", updatePolicyAssignmentOptions.templateVersion()); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Remove a policy assignment. + * + * Remove a policy template assignment by providing a policy assignment ID. You can't delete a policy assignment if + * the status is "in_progress". + * + * @param deletePolicyAssignmentOptions the {@link DeletePolicyAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deletePolicyAssignment(DeletePolicyAssignmentOptions deletePolicyAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyAssignmentOptions, + "deletePolicyAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", deletePolicyAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve Access Management account settings by account ID. + * + * Retrieve Access Management settings for an account by providing the account ID. + * + * @param getSettingsOptions the {@link GetSettingsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccountSettingsAccessManagement} + */ + public ServiceCall getSettings(GetSettingsOptions getSettingsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getSettingsOptions, + "getSettingsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("account_id", getSettingsOptions.accountId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/settings/access_management", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getSettings"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getSettingsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", getSettingsOptions.acceptLanguage()); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update Access Management account settings by account ID. + * + * Update access management settings for an account. + * + * ### External Account Identity Interaction + * + * Update the way identities within an external account are allowed to interact with the requested account by + * providing: + * * the `account_id` as a parameter + * * one or more external account ID(s) and state for the specific identity in the request body + * + * External account identity interaction includes the following `identity_types`: `user` (user identities that are + * defined as [IBMid's](https://cloud.ibm.com/docs/account?topic=account-identity-overview#users-bestpract)), + * `service_id` (defined as [IAM + * ServiceIds](https://cloud.ibm.com/docs/account?topic=account-identity-overview#serviceid-bestpract)), `service` + * (defined by a service’s [CRN](https://cloud.ibm.com/docs/account?topic=account-crn)). To update an Identity’s + * setting, the `state` and `external_allowed_accounts` fields are required. + * + * Different identity states are: + * * "enabled": An identity type is allowed to access resources in the account provided it has access policies on + * those resources. + * * "limited": An identity type is allowed to access resources in the account provided it has access policies on + * those resources AND it is associated with either the account the resources are in or one of the allowed accounts. + * This setting uses the "external_allowed_accounts" list. + * * "monitor": It has no direct impact on an Identity’s access. Instead, it creates AT events for access decisions as + * if the account were in a limited “state”. + * + * **Note**: The state "enabled" is a special case. In this case, access is given to all accounts and there is no need + * to specify a particular list. Therefore, when updating "state" to "enabled" for an identity type + * "external_allowed_accounts" should be left empty. + * + * @param updateSettingsOptions the {@link UpdateSettingsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccountSettingsAccessManagement} + */ + public ServiceCall updateSettings(UpdateSettingsOptions updateSettingsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateSettingsOptions, + "updateSettingsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("account_id", updateSettingsOptions.accountId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/settings/access_management", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateSettings"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updateSettingsOptions.ifMatch()); + if (updateSettingsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", updateSettingsOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + if (updateSettingsOptions.externalAccountIdentityInteraction() != null) { + contentJson.add("external_account_identity_interaction", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateSettingsOptions.externalAccountIdentityInteraction())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * List action control templates by attributes. + * + * List action control templates and filter by attributes by using query parameters. The following attributes are + * supported: + * `account_id` + * `account_id` is a required query parameter. Only action control templates that have the specified attributes and + * that the caller has read access to are returned. If the caller does not have read access to any action control + * templates an empty array is returned. + * + * @param listActionControlTemplatesOptions the {@link ListActionControlTemplatesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplateCollection} + */ + public ServiceCall listActionControlTemplates(ListActionControlTemplatesOptions listActionControlTemplatesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlTemplatesOptions, + "listActionControlTemplatesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlTemplates"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listActionControlTemplatesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listActionControlTemplatesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listActionControlTemplatesOptions.accountId())); + if (listActionControlTemplatesOptions.limit() != null) { + builder.query("limit", String.valueOf(listActionControlTemplatesOptions.limit())); + } + if (listActionControlTemplatesOptions.start() != null) { + builder.query("start", String.valueOf(listActionControlTemplatesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create an action control template. + * + * Create an action control template. Action control templates define a service action control. + * + * @param createActionControlTemplateOptions the {@link CreateActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall createActionControlTemplate(CreateActionControlTemplateOptions createActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateOptions, + "createActionControlTemplateOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createActionControlTemplateOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createActionControlTemplateOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("name", createActionControlTemplateOptions.name()); + contentJson.addProperty("account_id", createActionControlTemplateOptions.accountId()); + if (createActionControlTemplateOptions.description() != null) { + contentJson.addProperty("description", createActionControlTemplateOptions.description()); + } + if (createActionControlTemplateOptions.committed() != null) { + contentJson.addProperty("committed", createActionControlTemplateOptions.committed()); + } + if (createActionControlTemplateOptions.actionControl() != null) { + contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateOptions.actionControl())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve the latest version of an action control template. + * + * Retrieve the latest version of an action control template by providing an action control template ID. + * + * @param getActionControlTemplateOptions the {@link GetActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall getActionControlTemplate(GetActionControlTemplateOptions getActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlTemplateOptions, + "getActionControlTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", getActionControlTemplateOptions.actionControlTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getActionControlTemplateOptions.state() != null) { + builder.query("state", String.valueOf(getActionControlTemplateOptions.state())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete an action control template. + * + * Delete an action control template by providing the action control template ID. This deletes all versions of this + * template. An action control template can't be deleted if any version of the template is assigned to one or more + * child accounts. You must remove the action control assignments first. + * + * @param deleteActionControlTemplateOptions the {@link DeleteActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteActionControlTemplate(DeleteActionControlTemplateOptions deleteActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlTemplateOptions, + "deleteActionControlTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", deleteActionControlTemplateOptions.actionControlTemplateId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a new action control template version. + * + * Create a new version of an action control template. Use this if you need to make updates to an action control + * template that is committed. + * + * @param createActionControlTemplateVersionOptions the {@link CreateActionControlTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall createActionControlTemplateVersion(CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateVersionOptions, + "createActionControlTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", createActionControlTemplateVersionOptions.actionControlTemplateId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + if (createActionControlTemplateVersionOptions.name() != null) { + contentJson.addProperty("name", createActionControlTemplateVersionOptions.name()); + } + if (createActionControlTemplateVersionOptions.description() != null) { + contentJson.addProperty("description", createActionControlTemplateVersionOptions.description()); + } + if (createActionControlTemplateVersionOptions.actionControl() != null) { + contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateVersionOptions.actionControl())); + } + if (createActionControlTemplateVersionOptions.committed() != null) { + contentJson.addProperty("committed", createActionControlTemplateVersionOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve action control template versions. + * + * Retrieve the versions of an action control template by providing an action control template ID. + * + * @param listActionControlTemplateVersionsOptions the {@link ListActionControlTemplateVersionsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplateVersionsCollection} + */ + public ServiceCall listActionControlTemplateVersions(ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlTemplateVersionsOptions, + "listActionControlTemplateVersionsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", listActionControlTemplateVersionsOptions.actionControlTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlTemplateVersions"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listActionControlTemplateVersionsOptions.state() != null) { + builder.query("state", String.valueOf(listActionControlTemplateVersionsOptions.state())); + } + if (listActionControlTemplateVersionsOptions.limit() != null) { + builder.query("limit", String.valueOf(listActionControlTemplateVersionsOptions.limit())); + } + if (listActionControlTemplateVersionsOptions.start() != null) { + builder.query("start", String.valueOf(listActionControlTemplateVersionsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update an action control template version. + * + * Update a specific version of an action control template. You can use this only if the version isn't committed. + * + * @param replaceActionControlTemplateOptions the {@link ReplaceActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall replaceActionControlTemplate(ReplaceActionControlTemplateOptions replaceActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceActionControlTemplateOptions, + "replaceActionControlTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", replaceActionControlTemplateOptions.actionControlTemplateId()); + pathParamsMap.put("version", replaceActionControlTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replaceActionControlTemplateOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + if (replaceActionControlTemplateOptions.name() != null) { + contentJson.addProperty("name", replaceActionControlTemplateOptions.name()); + } + if (replaceActionControlTemplateOptions.description() != null) { + contentJson.addProperty("description", replaceActionControlTemplateOptions.description()); + } + if (replaceActionControlTemplateOptions.actionControl() != null) { + contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceActionControlTemplateOptions.actionControl())); + } + if (replaceActionControlTemplateOptions.committed() != null) { + contentJson.addProperty("committed", replaceActionControlTemplateOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete an action control template version. + * + * Delete a specific version of an action control template by providing an action control template ID and version + * number. You can't delete an action control template version that is assigned to one or more child accounts. You + * must remove the action control assignments first. + * + * @param deleteActionControlTemplateVersionOptions the {@link DeleteActionControlTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteActionControlTemplateVersion(DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlTemplateVersionOptions, + "deleteActionControlTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", deleteActionControlTemplateVersionOptions.actionControlTemplateId()); + pathParamsMap.put("version", deleteActionControlTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve an action control template version. + * + * Retrieve an action control template by providing an action control template ID and version number. + * + * @param getActionControlTemplateVersionOptions the {@link GetActionControlTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall getActionControlTemplateVersion(GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlTemplateVersionOptions, + "getActionControlTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", getActionControlTemplateVersionOptions.actionControlTemplateId()); + pathParamsMap.put("version", getActionControlTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlTemplateVersion"); + 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); + } + + /** + * Commit an action control template version. + * + * Commit an action control template version. You cannot make any further changes to the action control template once + * it's committed. If you have to make updates after committing a version, create a new version. + * + * @param commitActionControlTemplateOptions the {@link CommitActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall commitActionControlTemplate(CommitActionControlTemplateOptions commitActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(commitActionControlTemplateOptions, + "commitActionControlTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", commitActionControlTemplateOptions.actionControlTemplateId()); + pathParamsMap.put("version", commitActionControlTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}/commit", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get action control template assignments. + * + * Get action control template assignments by attributes. The following attributes are supported: + * `account_id`, `template_id`, `template_version`, `sort`. + * `account_id` is a required query parameter. Only action control template assignments with the specified attributes + * and accessible by the caller are returned. If the caller does not have read access to any action control template + * assignments, an empty array is returned. + * + * @param listActionControlAssignmentsOptions the {@link ListActionControlAssignmentsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignmentCollection} + */ + public ServiceCall listActionControlAssignments(ListActionControlAssignmentsOptions listActionControlAssignmentsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlAssignmentsOptions, + "listActionControlAssignmentsOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlAssignments"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listActionControlAssignmentsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listActionControlAssignmentsOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listActionControlAssignmentsOptions.accountId())); + if (listActionControlAssignmentsOptions.templateId() != null) { + builder.query("template_id", String.valueOf(listActionControlAssignmentsOptions.templateId())); + } + if (listActionControlAssignmentsOptions.templateVersion() != null) { + builder.query("template_version", String.valueOf(listActionControlAssignmentsOptions.templateVersion())); + } + if (listActionControlAssignmentsOptions.limit() != null) { + builder.query("limit", String.valueOf(listActionControlAssignmentsOptions.limit())); + } + if (listActionControlAssignmentsOptions.start() != null) { + builder.query("start", String.valueOf(listActionControlAssignmentsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create an action control template assignment. + * + * Assign an action control template to child accounts and account groups. This creates the action control in the + * accounts and account groups that you specify. + * + * @param createActionControlTemplateAssignmentOptions the {@link CreateActionControlTemplateAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignmentCollection} + */ + public ServiceCall createActionControlTemplateAssignment(CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateAssignmentOptions, + "createActionControlTemplateAssignmentOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplateAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createActionControlTemplateAssignmentOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createActionControlTemplateAssignmentOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateAssignmentOptions.target())); + contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateAssignmentOptions.templates())); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve an action control assignment. + * + * Retrieve an action control template assignment by providing an action control assignment ID. + * + * @param getActionControlAssignmentOptions the {@link GetActionControlAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignment} + */ + public ServiceCall getActionControlAssignment(GetActionControlAssignmentOptions getActionControlAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlAssignmentOptions, + "getActionControlAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", getActionControlAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlAssignment"); + 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 an action control assignment. + * + * Update an action control assignment by providing an action control assignment ID. + * + * @param updateActionControlAssignmentOptions the {@link UpdateActionControlAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignment} + */ + public ServiceCall updateActionControlAssignment(UpdateActionControlAssignmentOptions updateActionControlAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateActionControlAssignmentOptions, + "updateActionControlAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", updateActionControlAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateActionControlAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updateActionControlAssignmentOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("template_version", updateActionControlAssignmentOptions.templateVersion()); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Remove an action control assignment. + * + * Remove an action control template assignment by providing an action control assignment ID. You can't delete an + * action control assignment if the status is "in_progress". + * + * @param deleteActionControlAssignmentOptions the {@link DeleteActionControlAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteActionControlAssignment(DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlAssignmentOptions, + "deleteActionControlAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", deleteActionControlAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * List role templates by attributes. + * + * List role templates and filter by attributes by using query parameters. The following attributes are supported: + * `account_id`, `name`, `role_name`, `role_service_name`, `state`, `limit`, `start`. + * `account_id` is a required query parameter. Only role templates that have the specified attributes and that the + * caller has read access to are returned. If the caller does not have read access to any role templates an empty + * array is returned. + * + * @param listRoleTemplatesOptions the {@link ListRoleTemplatesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplateCollection} + */ + public ServiceCall listRoleTemplates(ListRoleTemplatesOptions listRoleTemplatesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleTemplatesOptions, + "listRoleTemplatesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleTemplates"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listRoleTemplatesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listRoleTemplatesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listRoleTemplatesOptions.accountId())); + if (listRoleTemplatesOptions.name() != null) { + builder.query("name", String.valueOf(listRoleTemplatesOptions.name())); + } + if (listRoleTemplatesOptions.roleName() != null) { + builder.query("role_name", String.valueOf(listRoleTemplatesOptions.roleName())); + } + if (listRoleTemplatesOptions.roleServiceName() != null) { + builder.query("role_service_name", String.valueOf(listRoleTemplatesOptions.roleServiceName())); + } + if (listRoleTemplatesOptions.state() != null) { + builder.query("state", String.valueOf(listRoleTemplatesOptions.state())); + } + if (listRoleTemplatesOptions.limit() != null) { + builder.query("limit", String.valueOf(listRoleTemplatesOptions.limit())); + } + if (listRoleTemplatesOptions.start() != null) { + builder.query("start", String.valueOf(listRoleTemplatesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create role template. + * + * Create a role template. Role templates define roles from an existing system or service defined role. + * + * @param createRoleTemplateOptions the {@link CreateRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall createRoleTemplate(CreateRoleTemplateOptions createRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateOptions, + "createRoleTemplateOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createRoleTemplateOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createRoleTemplateOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("name", createRoleTemplateOptions.name()); + contentJson.addProperty("account_id", createRoleTemplateOptions.accountId()); + if (createRoleTemplateOptions.description() != null) { + contentJson.addProperty("description", createRoleTemplateOptions.description()); + } + if (createRoleTemplateOptions.committed() != null) { + contentJson.addProperty("committed", createRoleTemplateOptions.committed()); + } + if (createRoleTemplateOptions.role() != null) { + contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateOptions.role())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve the latest version of a role template. + * + * Retrieve the latest version of a role template by providing a role template ID. + * + * @param getRoleTemplateOptions the {@link GetRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall getRoleTemplate(GetRoleTemplateOptions getRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleTemplateOptions, + "getRoleTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", getRoleTemplateOptions.roleTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getRoleTemplateOptions.state() != null) { + builder.query("state", String.valueOf(getRoleTemplateOptions.state())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a Role template. + * + * Delete a role template by providing the role template ID. This deletes all versions of this template. A role + * template can't be deleted if any version of the template is assigned to one or more child accounts. You must remove + * the role assignments first. + * + * @param deleteRoleTemplateOptions the {@link DeleteRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteRoleTemplate(DeleteRoleTemplateOptions deleteRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleTemplateOptions, + "deleteRoleTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", deleteRoleTemplateOptions.roleTemplateId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a new role template version. + * + * Create a new version of a role template. Use this if you need to make updates to a role template that is committed. + * + * @param createRoleTemplateVersionOptions the {@link CreateRoleTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall createRoleTemplateVersion(CreateRoleTemplateVersionOptions createRoleTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateVersionOptions, + "createRoleTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", createRoleTemplateVersionOptions.roleTemplateId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + if (createRoleTemplateVersionOptions.name() != null) { + contentJson.addProperty("name", createRoleTemplateVersionOptions.name()); + } + if (createRoleTemplateVersionOptions.description() != null) { + contentJson.addProperty("description", createRoleTemplateVersionOptions.description()); + } + if (createRoleTemplateVersionOptions.role() != null) { + contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateVersionOptions.role())); + } + if (createRoleTemplateVersionOptions.committed() != null) { + contentJson.addProperty("committed", createRoleTemplateVersionOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve role template versions. + * + * Retrieve the versions of a role template by providing a role template ID. + * + * @param listRoleTemplateVersionsOptions the {@link ListRoleTemplateVersionsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplateVersionsCollection} + */ + public ServiceCall listRoleTemplateVersions(ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleTemplateVersionsOptions, + "listRoleTemplateVersionsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", listRoleTemplateVersionsOptions.roleTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleTemplateVersions"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listRoleTemplateVersionsOptions.state() != null) { + builder.query("state", String.valueOf(listRoleTemplateVersionsOptions.state())); + } + if (listRoleTemplateVersionsOptions.limit() != null) { + builder.query("limit", String.valueOf(listRoleTemplateVersionsOptions.limit())); + } + if (listRoleTemplateVersionsOptions.start() != null) { + builder.query("start", String.valueOf(listRoleTemplateVersionsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a role template version. + * + * Update a specific version of a role template. You can use this only if the version isn't committed. + * + * @param replaceRoleTemplateOptions the {@link ReplaceRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall replaceRoleTemplate(ReplaceRoleTemplateOptions replaceRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceRoleTemplateOptions, + "replaceRoleTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", replaceRoleTemplateOptions.roleTemplateId()); + pathParamsMap.put("version", replaceRoleTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replaceRoleTemplateOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + if (replaceRoleTemplateOptions.name() != null) { + contentJson.addProperty("name", replaceRoleTemplateOptions.name()); + } + if (replaceRoleTemplateOptions.description() != null) { + contentJson.addProperty("description", replaceRoleTemplateOptions.description()); + } + if (replaceRoleTemplateOptions.role() != null) { + contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRoleTemplateOptions.role())); + } + if (replaceRoleTemplateOptions.committed() != null) { + contentJson.addProperty("committed", replaceRoleTemplateOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a role template version. + * + * Delete a specific version of a role template by providing a role template ID and version number. You can't delete a + * role template version that is assigned to one or more child accounts. You must remove the role assignments first. + * + * @param deleteRoleTemplateVersionOptions the {@link DeleteRoleTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteRoleTemplateVersion(DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleTemplateVersionOptions, + "deleteRoleTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", deleteRoleTemplateVersionOptions.roleTemplateId()); + pathParamsMap.put("version", deleteRoleTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a role template version. + * + * Retrieve a role template by providing a role template ID and version number. + * + * @param getRoleTemplateVersionOptions the {@link GetRoleTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall getRoleTemplateVersion(GetRoleTemplateVersionOptions getRoleTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleTemplateVersionOptions, + "getRoleTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", getRoleTemplateVersionOptions.roleTemplateId()); + pathParamsMap.put("version", getRoleTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleTemplateVersion"); + 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); + } + + /** + * Commit a role template version. + * + * Commit a role template version. You cannot make any further changes to the role template once it's committed. If + * you have to make updates after committing a version, create a new version. + * + * @param commitRoleTemplateOptions the {@link CommitRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall commitRoleTemplate(CommitRoleTemplateOptions commitRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(commitRoleTemplateOptions, + "commitRoleTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", commitRoleTemplateOptions.roleTemplateId()); + pathParamsMap.put("version", commitRoleTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}/commit", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get role template assignments. + * + * Get role template assignments by attributes. The following attributes are supported: + * `account_id`, `template_id`, `template_version`, `target`, `target_type`, `limit`, `start`. + * `account_id` is a required query parameter. Only role template assignments with the specified attributes and + * accessible by the caller are returned. If the caller does not have read access to any role template assignments, an + * empty array is returned. + * + * @param listRoleAssignmentsOptions the {@link ListRoleAssignmentsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleAssignmentCollection} + */ + public ServiceCall listRoleAssignments(ListRoleAssignmentsOptions listRoleAssignmentsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleAssignmentsOptions, + "listRoleAssignmentsOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleAssignments"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listRoleAssignmentsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listRoleAssignmentsOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listRoleAssignmentsOptions.accountId())); + if (listRoleAssignmentsOptions.templateId() != null) { + builder.query("template_id", String.valueOf(listRoleAssignmentsOptions.templateId())); + } + if (listRoleAssignmentsOptions.templateVersion() != null) { + builder.query("template_version", String.valueOf(listRoleAssignmentsOptions.templateVersion())); + } + if (listRoleAssignmentsOptions.limit() != null) { + builder.query("limit", String.valueOf(listRoleAssignmentsOptions.limit())); + } + if (listRoleAssignmentsOptions.start() != null) { + builder.query("start", String.valueOf(listRoleAssignmentsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a role template assignment. + * + * Assign a role template to child accounts and account groups. This creates the role in the accounts and account + * groups that you specify. + * + * @param createRoleTemplateAssignmentOptions the {@link CreateRoleTemplateAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleAssignmentCollection} + */ + public ServiceCall createRoleTemplateAssignment(CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateAssignmentOptions, + "createRoleTemplateAssignmentOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplateAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createRoleTemplateAssignmentOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createRoleTemplateAssignmentOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateAssignmentOptions.target())); + contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateAssignmentOptions.templates())); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a role assignment. + * + * Retrieve a role template assignment by providing a role assignment ID. + * + * @param getRoleAssignmentOptions the {@link GetRoleAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleAssignment} + */ + public ServiceCall getRoleAssignment(GetRoleAssignmentOptions getRoleAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleAssignmentOptions, + "getRoleAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", getRoleAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleAssignment"); + 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 a role assignment. + * + * Update a role assignment by providing a role assignment ID. + * + * @param updateRoleAssignmentOptions the {@link UpdateRoleAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleAssignment} + */ + public ServiceCall updateRoleAssignment(UpdateRoleAssignmentOptions updateRoleAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateRoleAssignmentOptions, + "updateRoleAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", updateRoleAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateRoleAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updateRoleAssignmentOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("template_version", updateRoleAssignmentOptions.templateVersion()); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Remove a role assignment. + * + * Remove a role template assignment by providing a role assignment ID. You can't delete a role assignment if the + * status is "in_progress". + * + * @param deleteRoleAssignmentOptions the {@link DeleteRoleAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteRoleAssignment(DeleteRoleAssignmentOptions deleteRoleAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleAssignmentOptions, + "deleteRoleAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", deleteRoleAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java new file mode 100644 index 00000000000..af82ea2abe8 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The Access Management Account Settings that are currently set for the requested account. + */ +public class AccountSettingsAccessManagement extends GenericModel { + + @SerializedName("external_account_identity_interaction") + protected ExternalAccountIdentityInteraction externalAccountIdentityInteraction; + + protected AccountSettingsAccessManagement() { } + + /** + * Gets the externalAccountIdentityInteraction. + * + * How external accounts can interact in relation to the requested account. + * + * @return the externalAccountIdentityInteraction + */ + public ExternalAccountIdentityInteraction getExternalAccountIdentityInteraction() { + return externalAccountIdentityInteraction; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java new file mode 100644 index 00000000000..ea230f57263 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java @@ -0,0 +1,207 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the assigned action control template. + */ +public class ActionControlAssignment extends GenericModel { + + /** + * The current operation of the action control assignment. + */ + public interface Operation { + /** create. */ + String CREATE = "create"; + /** apply. */ + String APPLY = "apply"; + /** update. */ + String UPDATE = "update"; + /** remove. */ + String REMOVE = "remove"; + } + + /** + * The action control assignment status. + */ + public interface Status { + /** accepted. */ + String ACCEPTED = "accepted"; + /** failure. */ + String FAILURE = "failure"; + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** superseded. */ + String SUPERSEDED = "superseded"; + } + + protected String id; + @SerializedName("account_id") + protected String accountId; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String operation; + protected List resources; + protected ActionControlAssignmentTemplate template; + protected AssignmentTargetDetails target; + protected String status; + + protected ActionControlAssignment() { } + + /** + * Gets the id. + * + * Action control assignment ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the accountId. + * + * The account GUID that the action control assignments belong to. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the href. + * + * The href URL that links to the action control assignments API by action control assignment ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the action control assignment was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the action control assignment. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the action control assignment was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the action control assignment. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the operation. + * + * The current operation of the action control assignment. + * + * @return the operation + */ + public String getOperation() { + return operation; + } + + /** + * Gets the resources. + * + * Resources created when action control template is assigned. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the template. + * + * The action control template id and version that will be assigned. + * + * @return the template + */ + public ActionControlAssignmentTemplate getTemplate() { + return template; + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the status. + * + * The action control assignment status. + * + * @return the status + */ + public String getStatus() { + return status; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java new file mode 100644 index 00000000000..a9d6b28ce39 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of action control assignments. + */ +public class ActionControlAssignmentCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List assignments; + + protected ActionControlAssignmentCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the assignments. + * + * List of action control assignments. + * + * @return the assignments + */ + public List getAssignments() { + return assignments; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java new file mode 100644 index 00000000000..122d3c8277b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java @@ -0,0 +1,52 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The action control assignment resources and target where the template is assigned. + */ +public class ActionControlAssignmentResource extends GenericModel { + + protected AssignmentTargetDetails target; + @SerializedName("action_control") + protected ActionControlAssignmentResourceActionControl actionControl; + + protected ActionControlAssignmentResource() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the actionControl. + * + * Set of properties of the assigned resource or error message if assignment failed. + * + * @return the actionControl + */ + public ActionControlAssignmentResourceActionControl getActionControl() { + return actionControl; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java new file mode 100644 index 00000000000..0e5550eb4da --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Set of properties of the assigned resource or error message if assignment failed. + */ +public class ActionControlAssignmentResourceActionControl extends GenericModel { + + @SerializedName("resource_created") + protected ActionControlAssignmentResourceCreated resourceCreated; + @SerializedName("error_message") + protected AssignmentResourceError errorMessage; + + protected ActionControlAssignmentResourceActionControl() { } + + /** + * Gets the resourceCreated. + * + * On success, it includes the action control assigned. + * + * @return the resourceCreated + */ + public ActionControlAssignmentResourceCreated getResourceCreated() { + return resourceCreated; + } + + /** + * Gets the errorMessage. + * + * Body parameters for assignment error. + * + * @return the errorMessage + */ + public AssignmentResourceError getErrorMessage() { + return errorMessage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java new file mode 100644 index 00000000000..6ecbd23392a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * On success, it includes the action control assigned. + */ +public class ActionControlAssignmentResourceCreated extends GenericModel { + + protected String id; + + protected ActionControlAssignmentResourceCreated() { } + + /** + * Gets the id. + * + * action control id. + * + * @return the id + */ + public String getId() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java new file mode 100644 index 00000000000..4e6d2543e18 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The action control template id and version that will be assigned. + */ +public class ActionControlAssignmentTemplate extends GenericModel { + + protected String id; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String version; + + /** + * Instantiates a new Builder from an existing ActionControlAssignmentTemplate instance. + * + * @param actionControlAssignmentTemplate the instance to initialize the Builder with + */ + private Builder(ActionControlAssignmentTemplate actionControlAssignmentTemplate) { + this.id = actionControlAssignmentTemplate.id; + this.version = actionControlAssignmentTemplate.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + * @param version the version + */ + public Builder(String id, String version) { + this.id = id; + this.version = version; + } + + /** + * Builds a ActionControlAssignmentTemplate. + * + * @return the new ActionControlAssignmentTemplate instance + */ + public ActionControlAssignmentTemplate build() { + return new ActionControlAssignmentTemplate(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the ActionControlAssignmentTemplate builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the ActionControlAssignmentTemplate builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected ActionControlAssignmentTemplate() { } + + protected ActionControlAssignmentTemplate(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, + "id cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + id = builder.id; + version = builder.version; + } + + /** + * New builder. + * + * @return a ActionControlAssignmentTemplate builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * Action control template ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java new file mode 100644 index 00000000000..78b6d56be6d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * ActionControlAssignmentsPager can be used to simplify the use of the "listActionControlAssignments" method. + */ +public class ActionControlAssignmentsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListActionControlAssignmentsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected ActionControlAssignmentsPager() { } + + /** + * Constructs a new ActionControlAssignmentsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlAssignments" method + * @param options the ListActionControlAssignmentsOptions instance to be used to invoke the "listActionControlAssignments" method + */ + public ActionControlAssignmentsPager(IamPolicyManagement client, ListActionControlAssignmentsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<ActionControlAssignment> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListActionControlAssignmentsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + ActionControlAssignmentCollection result = client.listActionControlAssignments(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getAssignments(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<ActionControlAssignment> containing all results returned by the "listActionControlAssignments" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java new file mode 100644 index 00000000000..157c9f6a390 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java @@ -0,0 +1,203 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the action control template. + */ +public class ActionControlTemplate extends GenericModel { + + /** + * State of action control template. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String name; + protected String description; + @SerializedName("account_id") + protected String accountId; + protected Boolean committed; + @SerializedName("action_control") + protected TemplateActionControl actionControl; + protected String id; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String version; + protected String state; + + protected ActionControlTemplate() { } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Description of the action control template. This is shown to users in the enterprise account. Use this to describe + * the purpose or context of the action control for enterprise users managing IAM templates. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the committed. + * + * Committed status of the template. If committed is set to true, then the template version can no longer be updated. + * + * @return the committed + */ + public Boolean isCommitted() { + return committed; + } + + /** + * Gets the actionControl. + * + * The action control properties that are created in an action resource when the template is assigned. + * + * @return the actionControl + */ + public TemplateActionControl getActionControl() { + return actionControl; + } + + /** + * Gets the id. + * + * The action control template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the action control templates API by action control template ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the action control template was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the action control template. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the action control template was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the action control template. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the version. + * + * The version number of the template used to identify different versions of same template. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the state. + * + * State of action control template. + * + * @return the state + */ + public String getState() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java new file mode 100644 index 00000000000..e7536d2c9ae --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java @@ -0,0 +1,90 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of action control templates. + */ +public class ActionControlTemplateCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + @SerializedName("action_control_templates") + protected List actionControlTemplates; + + protected ActionControlTemplateCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the actionControlTemplates. + * + * List of action control templates. + * + * @return the actionControlTemplates + */ + public List getActionControlTemplates() { + return actionControlTemplates; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java new file mode 100644 index 00000000000..5e26f45cf46 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of versions for a specific action control template. + */ +public class ActionControlTemplateVersionsCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List versions; + + protected ActionControlTemplateVersionsCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the versions. + * + * List of action control templates versions. + * + * @return the versions + */ + public List getVersions() { + return versions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java new file mode 100644 index 00000000000..660aefe11ba --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * ActionControlTemplateVersionsPager can be used to simplify the use of the "listActionControlTemplateVersions" method. + */ +public class ActionControlTemplateVersionsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListActionControlTemplateVersionsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected ActionControlTemplateVersionsPager() { } + + /** + * Constructs a new ActionControlTemplateVersionsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlTemplateVersions" method + * @param options the ListActionControlTemplateVersionsOptions instance to be used to invoke the "listActionControlTemplateVersions" method + */ + public ActionControlTemplateVersionsPager(IamPolicyManagement client, ListActionControlTemplateVersionsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<ActionControlTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListActionControlTemplateVersionsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + ActionControlTemplateVersionsCollection result = client.listActionControlTemplateVersions(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getVersions(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<ActionControlTemplate> containing all results returned by the "listActionControlTemplateVersions" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java new file mode 100644 index 00000000000..bd326c8d7ec --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * ActionControlTemplatesPager can be used to simplify the use of the "listActionControlTemplates" method. + */ +public class ActionControlTemplatesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListActionControlTemplatesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected ActionControlTemplatesPager() { } + + /** + * Constructs a new ActionControlTemplatesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlTemplates" method + * @param options the ListActionControlTemplatesOptions instance to be used to invoke the "listActionControlTemplates" method + */ + public ActionControlTemplatesPager(IamPolicyManagement client, ListActionControlTemplatesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<ActionControlTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListActionControlTemplatesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + ActionControlTemplateCollection result = client.listActionControlTemplates(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getActionControlTemplates(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<ActionControlTemplate> containing all results returned by the "listActionControlTemplates" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java new file mode 100644 index 00000000000..c454c7a3ef5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * On success, includes the policy that is assigned. + */ +public class AssignmentResourceCreated extends GenericModel { + + protected String id; + + protected AssignmentResourceCreated() { } + + /** + * Gets the id. + * + * Policy id. + * + * @return the id + */ + public String getId() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java new file mode 100644 index 00000000000..e74dbe58b3a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Body parameters for assignment error. + */ +public class AssignmentResourceError extends GenericModel { + + protected String name; + protected String errorCode; + protected String message; + protected String code; + protected List errors; + + protected AssignmentResourceError() { } + + /** + * Gets the name. + * + * Name of the error. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the errorCode. + * + * error code. + * + * @return the errorCode + */ + public String getErrorCode() { + return errorCode; + } + + /** + * Gets the message. + * + * Error message detailing the nature of the error. + * + * @return the message + */ + public String getMessage() { + return message; + } + + /** + * Gets the code. + * + * Internal status code for the error. + * + * @return the code + */ + public String getCode() { + return code; + } + + /** + * Gets the errors. + * + * The errors encountered during the response. + * + * @return the errors + */ + public List getErrors() { + return errors; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java new file mode 100644 index 00000000000..893d528604c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java @@ -0,0 +1,142 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * assignment target account and type. + */ +public class AssignmentTargetDetails extends GenericModel { + + /** + * Assignment target type. + */ + public interface Type { + /** Account. */ + String ACCOUNT = "Account"; + } + + protected String type; + protected String id; + + /** + * Builder. + */ + public static class Builder { + private String type; + private String id; + + /** + * Instantiates a new Builder from an existing AssignmentTargetDetails instance. + * + * @param assignmentTargetDetails the instance to initialize the Builder with + */ + private Builder(AssignmentTargetDetails assignmentTargetDetails) { + this.type = assignmentTargetDetails.type; + this.id = assignmentTargetDetails.id; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param type the type + * @param id the id + */ + public Builder(String type, String id) { + this.type = type; + this.id = id; + } + + /** + * Builds a AssignmentTargetDetails. + * + * @return the new AssignmentTargetDetails instance + */ + public AssignmentTargetDetails build() { + return new AssignmentTargetDetails(this); + } + + /** + * Set the type. + * + * @param type the type + * @return the AssignmentTargetDetails builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the id. + * + * @param id the id + * @return the AssignmentTargetDetails builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + } + + protected AssignmentTargetDetails() { } + + protected AssignmentTargetDetails(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, + "id cannot be null"); + type = builder.type; + id = builder.id; + } + + /** + * New builder. + * + * @return a AssignmentTargetDetails builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the type. + * + * Assignment target type. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the id. + * + * ID of the target account. + * + * @return the id + */ + public String id() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java new file mode 100644 index 00000000000..b8025e305a9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java @@ -0,0 +1,119 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * policy template details. + */ +public class AssignmentTemplateDetails extends GenericModel { + + protected String id; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String version; + + /** + * Instantiates a new Builder from an existing AssignmentTemplateDetails instance. + * + * @param assignmentTemplateDetails the instance to initialize the Builder with + */ + private Builder(AssignmentTemplateDetails assignmentTemplateDetails) { + this.id = assignmentTemplateDetails.id; + this.version = assignmentTemplateDetails.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a AssignmentTemplateDetails. + * + * @return the new AssignmentTemplateDetails instance + */ + public AssignmentTemplateDetails build() { + return new AssignmentTemplateDetails(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the AssignmentTemplateDetails builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the AssignmentTemplateDetails builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected AssignmentTemplateDetails() { } + + protected AssignmentTemplateDetails(Builder builder) { + id = builder.id; + version = builder.version; + } + + /** + * New builder. + * + * @return a AssignmentTemplateDetails builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * Policy template ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the version. + * + * Policy template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java new file mode 100644 index 00000000000..78291e6c2c5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The commitActionControlTemplate options. + */ +public class CommitActionControlTemplateOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing CommitActionControlTemplateOptions instance. + * + * @param commitActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(CommitActionControlTemplateOptions commitActionControlTemplateOptions) { + this.actionControlTemplateId = commitActionControlTemplateOptions.actionControlTemplateId; + this.version = commitActionControlTemplateOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + * @param version the version + */ + public Builder(String actionControlTemplateId, String version) { + this.actionControlTemplateId = actionControlTemplateId; + this.version = version; + } + + /** + * Builds a CommitActionControlTemplateOptions. + * + * @return the new CommitActionControlTemplateOptions instance + */ + public CommitActionControlTemplateOptions build() { + return new CommitActionControlTemplateOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the CommitActionControlTemplateOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the CommitActionControlTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected CommitActionControlTemplateOptions() { } + + protected CommitActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a CommitActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the version. + * + * The action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java new file mode 100644 index 00000000000..61283194c44 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The commitPolicyTemplate options. + */ +public class CommitPolicyTemplateOptions extends GenericModel { + + protected String policyTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing CommitPolicyTemplateOptions instance. + * + * @param commitPolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(CommitPolicyTemplateOptions commitPolicyTemplateOptions) { + this.policyTemplateId = commitPolicyTemplateOptions.policyTemplateId; + this.version = commitPolicyTemplateOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param version the version + */ + public Builder(String policyTemplateId, String version) { + this.policyTemplateId = policyTemplateId; + this.version = version; + } + + /** + * Builds a CommitPolicyTemplateOptions. + * + * @return the new CommitPolicyTemplateOptions instance + */ + public CommitPolicyTemplateOptions build() { + return new CommitPolicyTemplateOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the CommitPolicyTemplateOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the CommitPolicyTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected CommitPolicyTemplateOptions() { } + + protected CommitPolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + policyTemplateId = builder.policyTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a CommitPolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the version. + * + * The policy template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java new file mode 100644 index 00000000000..7e93c92fb0b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The commitRoleTemplate options. + */ +public class CommitRoleTemplateOptions extends GenericModel { + + protected String roleTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing CommitRoleTemplateOptions instance. + * + * @param commitRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(CommitRoleTemplateOptions commitRoleTemplateOptions) { + this.roleTemplateId = commitRoleTemplateOptions.roleTemplateId; + this.version = commitRoleTemplateOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + * @param version the version + */ + public Builder(String roleTemplateId, String version) { + this.roleTemplateId = roleTemplateId; + this.version = version; + } + + /** + * Builds a CommitRoleTemplateOptions. + * + * @return the new CommitRoleTemplateOptions instance + */ + public CommitRoleTemplateOptions build() { + return new CommitRoleTemplateOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the CommitRoleTemplateOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the CommitRoleTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected CommitRoleTemplateOptions() { } + + protected CommitRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + roleTemplateId = builder.roleTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a CommitRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the version. + * + * The role template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java new file mode 100644 index 00000000000..be0c3d0aa98 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java @@ -0,0 +1,62 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Details of conflicting resource. + */ +public class ConflictsWith extends GenericModel { + + protected String etag; + protected String role; + protected String policy; + + protected ConflictsWith() { } + + /** + * Gets the etag. + * + * The revision number of the resource. + * + * @return the etag + */ + public String getEtag() { + return etag; + } + + /** + * Gets the role. + * + * The conflicting role of ID. + * + * @return the role + */ + public String getRole() { + return role; + } + + /** + * Gets the policy. + * + * The conflicting policy ID. + * + * @return the policy + */ + public String getPolicy() { + return policy; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java new file mode 100644 index 00000000000..15e502ac214 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Specifies the type of access that is granted by the policy. + */ +public class Control extends GenericModel { + + protected Grant grant; + + /** + * Builder. + */ + public static class Builder { + private Grant grant; + + /** + * Instantiates a new Builder from an existing Control instance. + * + * @param control the instance to initialize the Builder with + */ + private Builder(Control control) { + this.grant = control.grant; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param grant the grant + */ + public Builder(Grant grant) { + this.grant = grant; + } + + /** + * Builds a Control. + * + * @return the new Control instance + */ + public Control build() { + return new Control(this); + } + + /** + * Set the grant. + * + * @param grant the grant + * @return the Control builder + */ + public Builder grant(Grant grant) { + this.grant = grant; + return this; + } + } + + protected Control() { } + + protected Control(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.grant, + "grant cannot be null"); + grant = builder.grant; + } + + /** + * New builder. + * + * @return a Control builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the grant. + * + * Permission is granted by the policy. + * + * @return the grant + */ + public Grant grant() { + return grant; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java new file mode 100644 index 00000000000..5055d290c80 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * ControlResponse. + * + * Classes which extend this class: + * - ControlResponseControl + * - ControlResponseControlWithEnrichedRoles + */ +public class ControlResponse extends GenericModel { + + protected Grant grant; + + protected ControlResponse() { } + + /** + * Gets the grant. + * + * Permission is granted by the policy. + * + * @return the grant + */ + public Grant getGrant() { + return grant; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java new file mode 100644 index 00000000000..5934ebf7c76 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java @@ -0,0 +1,24 @@ +/* + * (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_policy_management.v1.model; + +/** + * Specifies the type of access that is granted by the policy. + */ +public class ControlResponseControl extends ControlResponse { + + + protected ControlResponseControl() { } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java new file mode 100644 index 00000000000..8b3c73d73c0 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java @@ -0,0 +1,24 @@ +/* + * (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_policy_management.v1.model; + +/** + * Specifies the type of access that is granted by the policy with additional role information. + */ +public class ControlResponseControlWithEnrichedRoles extends ControlResponse { + + + protected ControlResponseControlWithEnrichedRoles() { } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java new file mode 100644 index 00000000000..1ccd3f8b4dd --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java @@ -0,0 +1,191 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createActionControlTemplateAssignment options. + */ +public class CreateActionControlTemplateAssignmentOptions extends GenericModel { + + protected AssignmentTargetDetails target; + protected List templates; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private AssignmentTargetDetails target; + private List templates; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateActionControlTemplateAssignmentOptions instance. + * + * @param createActionControlTemplateAssignmentOptions the instance to initialize the Builder with + */ + private Builder(CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptions) { + this.target = createActionControlTemplateAssignmentOptions.target; + this.templates = createActionControlTemplateAssignmentOptions.templates; + this.acceptLanguage = createActionControlTemplateAssignmentOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param target the target + * @param templates the templates + */ + public Builder(AssignmentTargetDetails target, List templates) { + this.target = target; + this.templates = templates; + } + + /** + * Builds a CreateActionControlTemplateAssignmentOptions. + * + * @return the new CreateActionControlTemplateAssignmentOptions instance + */ + public CreateActionControlTemplateAssignmentOptions build() { + return new CreateActionControlTemplateAssignmentOptions(this); + } + + /** + * Adds a new element to templates. + * + * @param templates the new element to be added + * @return the CreateActionControlTemplateAssignmentOptions builder + */ + public Builder addTemplates(ActionControlAssignmentTemplate templates) { + com.ibm.cloud.sdk.core.util.Validator.notNull(templates, + "templates cannot be null"); + if (this.templates == null) { + this.templates = new ArrayList(); + } + this.templates.add(templates); + return this; + } + + /** + * Set the target. + * + * @param target the target + * @return the CreateActionControlTemplateAssignmentOptions builder + */ + public Builder target(AssignmentTargetDetails target) { + this.target = target; + return this; + } + + /** + * Set the templates. + * Existing templates will be replaced. + * + * @param templates the templates + * @return the CreateActionControlTemplateAssignmentOptions builder + */ + public Builder templates(List templates) { + this.templates = templates; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateActionControlTemplateAssignmentOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateActionControlTemplateAssignmentOptions() { } + + protected CreateActionControlTemplateAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, + "target cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, + "templates cannot be null"); + target = builder.target; + templates = builder.templates; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateActionControlTemplateAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails target() { + return target; + } + + /** + * Gets the templates. + * + * List of action control template details for action control assignment. + * + * @return the templates + */ + public List templates() { + return templates; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java new file mode 100644 index 00000000000..37594a7a440 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java @@ -0,0 +1,251 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createActionControlTemplate options. + */ +public class CreateActionControlTemplateOptions extends GenericModel { + + protected String name; + protected String accountId; + protected String description; + protected Boolean committed; + protected TemplateActionControl actionControl; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String accountId; + private String description; + private Boolean committed; + private TemplateActionControl actionControl; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateActionControlTemplateOptions instance. + * + * @param createActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(CreateActionControlTemplateOptions createActionControlTemplateOptions) { + this.name = createActionControlTemplateOptions.name; + this.accountId = createActionControlTemplateOptions.accountId; + this.description = createActionControlTemplateOptions.description; + this.committed = createActionControlTemplateOptions.committed; + this.actionControl = createActionControlTemplateOptions.actionControl; + this.acceptLanguage = createActionControlTemplateOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param accountId the accountId + */ + public Builder(String name, String accountId) { + this.name = name; + this.accountId = accountId; + } + + /** + * Builds a CreateActionControlTemplateOptions. + * + * @return the new CreateActionControlTemplateOptions instance + */ + public CreateActionControlTemplateOptions build() { + return new CreateActionControlTemplateOptions(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateActionControlTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreateActionControlTemplateOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateActionControlTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreateActionControlTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + + /** + * Set the actionControl. + * + * @param actionControl the actionControl + * @return the CreateActionControlTemplateOptions builder + */ + public Builder actionControl(TemplateActionControl actionControl) { + this.actionControl = actionControl; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateActionControlTemplateOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateActionControlTemplateOptions() { } + + protected CreateActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + name = builder.name; + accountId = builder.accountId; + description = builder.description; + committed = builder.committed; + actionControl = builder.actionControl; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the description. + * + * Description of the action control template. This is shown to users in the enterprise account. Use this to describe + * the purpose or context of the action control for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template. If committed is set to true, then the template version can no longer be updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } + + /** + * Gets the actionControl. + * + * The action control properties that are created in an action resource when the template is assigned. + * + * @return the actionControl + */ + public TemplateActionControl actionControl() { + return actionControl; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java new file mode 100644 index 00000000000..13ce1a8e60f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java @@ -0,0 +1,211 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createActionControlTemplateVersion options. + */ +public class CreateActionControlTemplateVersionOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String name; + protected String description; + protected TemplateActionControl actionControl; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String name; + private String description; + private TemplateActionControl actionControl; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing CreateActionControlTemplateVersionOptions instance. + * + * @param createActionControlTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptions) { + this.actionControlTemplateId = createActionControlTemplateVersionOptions.actionControlTemplateId; + this.name = createActionControlTemplateVersionOptions.name; + this.description = createActionControlTemplateVersionOptions.description; + this.actionControl = createActionControlTemplateVersionOptions.actionControl; + this.committed = createActionControlTemplateVersionOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + */ + public Builder(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + } + + /** + * Builds a CreateActionControlTemplateVersionOptions. + * + * @return the new CreateActionControlTemplateVersionOptions instance + */ + public CreateActionControlTemplateVersionOptions build() { + return new CreateActionControlTemplateVersionOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actionControl. + * + * @param actionControl the actionControl + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder actionControl(TemplateActionControl actionControl) { + this.actionControl = actionControl; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected CreateActionControlTemplateVersionOptions() { } + + protected CreateActionControlTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + name = builder.name; + description = builder.description; + actionControl = builder.actionControl; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a CreateActionControlTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * The action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will + * change the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the action control template. This is shown to users in the enterprise account. Use this to describe + * the purpose or context of the action control for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actionControl. + * + * The action control properties that are created in an action resource when the template is assigned. + * + * @return the actionControl + */ + public TemplateActionControl actionControl() { + return actionControl; + } + + /** + * Gets the committed. + * + * Committed status of the template version. If committed is set to true, then the template version can no longer be + * updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java new file mode 100644 index 00000000000..b6ec9f78c02 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java @@ -0,0 +1,311 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createPolicy options. + */ +public class CreatePolicyOptions extends GenericModel { + + protected String type; + protected List subjects; + protected List roles; + protected List resources; + protected String description; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String type; + private List subjects; + private List roles; + private List resources; + private String description; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreatePolicyOptions instance. + * + * @param createPolicyOptions the instance to initialize the Builder with + */ + private Builder(CreatePolicyOptions createPolicyOptions) { + this.type = createPolicyOptions.type; + this.subjects = createPolicyOptions.subjects; + this.roles = createPolicyOptions.roles; + this.resources = createPolicyOptions.resources; + this.description = createPolicyOptions.description; + this.acceptLanguage = createPolicyOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param type the type + * @param subjects the subjects + * @param roles the roles + * @param resources the resources + */ + public Builder(String type, List subjects, List roles, List resources) { + this.type = type; + this.subjects = subjects; + this.roles = roles; + this.resources = resources; + } + + /** + * Builds a CreatePolicyOptions. + * + * @return the new CreatePolicyOptions instance + */ + public CreatePolicyOptions build() { + return new CreatePolicyOptions(this); + } + + /** + * Adds a new element to subjects. + * + * @param subjects the new element to be added + * @return the CreatePolicyOptions builder + */ + public Builder addSubjects(PolicySubject subjects) { + com.ibm.cloud.sdk.core.util.Validator.notNull(subjects, + "subjects cannot be null"); + if (this.subjects == null) { + this.subjects = new ArrayList(); + } + this.subjects.add(subjects); + return this; + } + + /** + * Adds a new element to roles. + * + * @param roles the new element to be added + * @return the CreatePolicyOptions builder + */ + public Builder addRoles(PolicyRole roles) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roles, + "roles cannot be null"); + if (this.roles == null) { + this.roles = new ArrayList(); + } + this.roles.add(roles); + return this; + } + + /** + * Adds a new element to resources. + * + * @param resources the new element to be added + * @return the CreatePolicyOptions builder + */ + public Builder addResources(PolicyResource resources) { + com.ibm.cloud.sdk.core.util.Validator.notNull(resources, + "resources cannot be null"); + if (this.resources == null) { + this.resources = new ArrayList(); + } + this.resources.add(resources); + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the CreatePolicyOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the subjects. + * Existing subjects will be replaced. + * + * @param subjects the subjects + * @return the CreatePolicyOptions builder + */ + public Builder subjects(List subjects) { + this.subjects = subjects; + return this; + } + + /** + * Set the roles. + * Existing roles will be replaced. + * + * @param roles the roles + * @return the CreatePolicyOptions builder + */ + public Builder roles(List roles) { + this.roles = roles; + return this; + } + + /** + * Set the resources. + * Existing resources will be replaced. + * + * @param resources the resources + * @return the CreatePolicyOptions builder + */ + public Builder resources(List resources) { + this.resources = resources; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreatePolicyOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreatePolicyOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreatePolicyOptions() { } + + protected CreatePolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subjects, + "subjects cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, + "roles cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resources, + "resources cannot be null"); + type = builder.type; + subjects = builder.subjects; + roles = builder.roles; + resources = builder.resources; + description = builder.description; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreatePolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the subjects. + * + * The subjects associated with a policy. + * + * @return the subjects + */ + public List subjects() { + return subjects; + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List roles() { + return roles; + } + + /** + * Gets the resources. + * + * The resources associated with a policy. + * + * @return the resources + */ + public List resources() { + return resources; + } + + /** + * Gets the description. + * + * Customer-defined description. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java new file mode 100644 index 00000000000..b71ca393f11 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java @@ -0,0 +1,221 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createPolicyTemplateAssignment options. + */ +public class CreatePolicyTemplateAssignmentOptions extends GenericModel { + + protected String version; + protected AssignmentTargetDetails target; + protected List templates; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String version; + private AssignmentTargetDetails target; + private List templates; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreatePolicyTemplateAssignmentOptions instance. + * + * @param createPolicyTemplateAssignmentOptions the instance to initialize the Builder with + */ + private Builder(CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptions) { + this.version = createPolicyTemplateAssignmentOptions.version; + this.target = createPolicyTemplateAssignmentOptions.target; + this.templates = createPolicyTemplateAssignmentOptions.templates; + this.acceptLanguage = createPolicyTemplateAssignmentOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param version the version + * @param target the target + * @param templates the templates + */ + public Builder(String version, AssignmentTargetDetails target, List templates) { + this.version = version; + this.target = target; + this.templates = templates; + } + + /** + * Builds a CreatePolicyTemplateAssignmentOptions. + * + * @return the new CreatePolicyTemplateAssignmentOptions instance + */ + public CreatePolicyTemplateAssignmentOptions build() { + return new CreatePolicyTemplateAssignmentOptions(this); + } + + /** + * Adds a new element to templates. + * + * @param templates the new element to be added + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder addTemplates(AssignmentTemplateDetails templates) { + com.ibm.cloud.sdk.core.util.Validator.notNull(templates, + "templates cannot be null"); + if (this.templates == null) { + this.templates = new ArrayList(); + } + this.templates.add(templates); + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the target. + * + * @param target the target + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder target(AssignmentTargetDetails target) { + this.target = target; + return this; + } + + /** + * Set the templates. + * Existing templates will be replaced. + * + * @param templates the templates + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder templates(List templates) { + this.templates = templates; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreatePolicyTemplateAssignmentOptions() { } + + protected CreatePolicyTemplateAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, + "target cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, + "templates cannot be null"); + version = builder.version; + target = builder.target; + templates = builder.templates; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreatePolicyTemplateAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the version. + * + * specify version of response body format. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails target() { + return target; + } + + /** + * Gets the templates. + * + * List of template details for policy assignment. + * + * @return the templates + */ + public List templates() { + return templates; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java new file mode 100644 index 00000000000..72944308428 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java @@ -0,0 +1,255 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createPolicyTemplate options. + */ +public class CreatePolicyTemplateOptions extends GenericModel { + + protected String name; + protected String accountId; + protected TemplatePolicy policy; + protected String description; + protected Boolean committed; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String accountId; + private TemplatePolicy policy; + private String description; + private Boolean committed; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreatePolicyTemplateOptions instance. + * + * @param createPolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(CreatePolicyTemplateOptions createPolicyTemplateOptions) { + this.name = createPolicyTemplateOptions.name; + this.accountId = createPolicyTemplateOptions.accountId; + this.policy = createPolicyTemplateOptions.policy; + this.description = createPolicyTemplateOptions.description; + this.committed = createPolicyTemplateOptions.committed; + this.acceptLanguage = createPolicyTemplateOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param accountId the accountId + * @param policy the policy + */ + public Builder(String name, String accountId, TemplatePolicy policy) { + this.name = name; + this.accountId = accountId; + this.policy = policy; + } + + /** + * Builds a CreatePolicyTemplateOptions. + * + * @return the new CreatePolicyTemplateOptions instance + */ + public CreatePolicyTemplateOptions build() { + return new CreatePolicyTemplateOptions(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the CreatePolicyTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreatePolicyTemplateOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the policy. + * + * @param policy the policy + * @return the CreatePolicyTemplateOptions builder + */ + public Builder policy(TemplatePolicy policy) { + this.policy = policy; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreatePolicyTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreatePolicyTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreatePolicyTemplateOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreatePolicyTemplateOptions() { } + + protected CreatePolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.policy, + "policy cannot be null"); + name = builder.name; + accountId = builder.accountId; + policy = builder.policy; + description = builder.description; + committed = builder.committed; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreatePolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy policy() { + return policy; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java new file mode 100644 index 00000000000..6903774c335 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java @@ -0,0 +1,214 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createPolicyTemplateVersion options. + */ +public class CreatePolicyTemplateVersionOptions extends GenericModel { + + protected String policyTemplateId; + protected TemplatePolicy policy; + protected String name; + protected String description; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private TemplatePolicy policy; + private String name; + private String description; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing CreatePolicyTemplateVersionOptions instance. + * + * @param createPolicyTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptions) { + this.policyTemplateId = createPolicyTemplateVersionOptions.policyTemplateId; + this.policy = createPolicyTemplateVersionOptions.policy; + this.name = createPolicyTemplateVersionOptions.name; + this.description = createPolicyTemplateVersionOptions.description; + this.committed = createPolicyTemplateVersionOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param policy the policy + */ + public Builder(String policyTemplateId, TemplatePolicy policy) { + this.policyTemplateId = policyTemplateId; + this.policy = policy; + } + + /** + * Builds a CreatePolicyTemplateVersionOptions. + * + * @return the new CreatePolicyTemplateVersionOptions instance + */ + public CreatePolicyTemplateVersionOptions build() { + return new CreatePolicyTemplateVersionOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the policy. + * + * @param policy the policy + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder policy(TemplatePolicy policy) { + this.policy = policy; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected CreatePolicyTemplateVersionOptions() { } + + protected CreatePolicyTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.policy, + "policy cannot be null"); + policyTemplateId = builder.policyTemplateId; + policy = builder.policy; + name = builder.name; + description = builder.description; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a CreatePolicyTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy policy() { + return policy; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template version. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java new file mode 100644 index 00000000000..725ec5d8a53 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java @@ -0,0 +1,308 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createRole options. + */ +public class CreateRoleOptions extends GenericModel { + + protected String displayName; + protected List actions; + protected String name; + protected String accountId; + protected String serviceName; + protected String description; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String displayName; + private List actions; + private String name; + private String accountId; + private String serviceName; + private String description; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateRoleOptions instance. + * + * @param createRoleOptions the instance to initialize the Builder with + */ + private Builder(CreateRoleOptions createRoleOptions) { + this.displayName = createRoleOptions.displayName; + this.actions = createRoleOptions.actions; + this.name = createRoleOptions.name; + this.accountId = createRoleOptions.accountId; + this.serviceName = createRoleOptions.serviceName; + this.description = createRoleOptions.description; + this.acceptLanguage = createRoleOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param displayName the displayName + * @param actions the actions + * @param name the name + * @param accountId the accountId + * @param serviceName the serviceName + */ + public Builder(String displayName, List actions, String name, String accountId, String serviceName) { + this.displayName = displayName; + this.actions = actions; + this.name = name; + this.accountId = accountId; + this.serviceName = serviceName; + } + + /** + * Builds a CreateRoleOptions. + * + * @return the new CreateRoleOptions instance + */ + public CreateRoleOptions build() { + return new CreateRoleOptions(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the CreateRoleOptions builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the CreateRoleOptions builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the CreateRoleOptions builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateRoleOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreateRoleOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the CreateRoleOptions builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateRoleOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateRoleOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateRoleOptions() { } + + protected CreateRoleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, + "serviceName cannot be null"); + displayName = builder.displayName; + actions = builder.actions; + name = builder.name; + accountId = builder.accountId; + serviceName = builder.serviceName; + description = builder.description; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateRoleOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List actions() { + return actions; + } + + /** + * Gets the name. + * + * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the accountId. + * + * The account GUID. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the serviceName. + * + * The service name. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java new file mode 100644 index 00000000000..c9bef88e703 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java @@ -0,0 +1,191 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createRoleTemplateAssignment options. + */ +public class CreateRoleTemplateAssignmentOptions extends GenericModel { + + protected AssignmentTargetDetails target; + protected List templates; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private AssignmentTargetDetails target; + private List templates; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateRoleTemplateAssignmentOptions instance. + * + * @param createRoleTemplateAssignmentOptions the instance to initialize the Builder with + */ + private Builder(CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptions) { + this.target = createRoleTemplateAssignmentOptions.target; + this.templates = createRoleTemplateAssignmentOptions.templates; + this.acceptLanguage = createRoleTemplateAssignmentOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param target the target + * @param templates the templates + */ + public Builder(AssignmentTargetDetails target, List templates) { + this.target = target; + this.templates = templates; + } + + /** + * Builds a CreateRoleTemplateAssignmentOptions. + * + * @return the new CreateRoleTemplateAssignmentOptions instance + */ + public CreateRoleTemplateAssignmentOptions build() { + return new CreateRoleTemplateAssignmentOptions(this); + } + + /** + * Adds a new element to templates. + * + * @param templates the new element to be added + * @return the CreateRoleTemplateAssignmentOptions builder + */ + public Builder addTemplates(RoleAssignmentTemplate templates) { + com.ibm.cloud.sdk.core.util.Validator.notNull(templates, + "templates cannot be null"); + if (this.templates == null) { + this.templates = new ArrayList(); + } + this.templates.add(templates); + return this; + } + + /** + * Set the target. + * + * @param target the target + * @return the CreateRoleTemplateAssignmentOptions builder + */ + public Builder target(AssignmentTargetDetails target) { + this.target = target; + return this; + } + + /** + * Set the templates. + * Existing templates will be replaced. + * + * @param templates the templates + * @return the CreateRoleTemplateAssignmentOptions builder + */ + public Builder templates(List templates) { + this.templates = templates; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateRoleTemplateAssignmentOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateRoleTemplateAssignmentOptions() { } + + protected CreateRoleTemplateAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, + "target cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, + "templates cannot be null"); + target = builder.target; + templates = builder.templates; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateRoleTemplateAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails target() { + return target; + } + + /** + * Gets the templates. + * + * List of role template details for role assignment. + * + * @return the templates + */ + public List templates() { + return templates; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java new file mode 100644 index 00000000000..baf82e17961 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java @@ -0,0 +1,251 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createRoleTemplate options. + */ +public class CreateRoleTemplateOptions extends GenericModel { + + protected String name; + protected String accountId; + protected String description; + protected Boolean committed; + protected RoleTemplatePrototypeRole role; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String accountId; + private String description; + private Boolean committed; + private RoleTemplatePrototypeRole role; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateRoleTemplateOptions instance. + * + * @param createRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(CreateRoleTemplateOptions createRoleTemplateOptions) { + this.name = createRoleTemplateOptions.name; + this.accountId = createRoleTemplateOptions.accountId; + this.description = createRoleTemplateOptions.description; + this.committed = createRoleTemplateOptions.committed; + this.role = createRoleTemplateOptions.role; + this.acceptLanguage = createRoleTemplateOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param accountId the accountId + */ + public Builder(String name, String accountId) { + this.name = name; + this.accountId = accountId; + } + + /** + * Builds a CreateRoleTemplateOptions. + * + * @return the new CreateRoleTemplateOptions instance + */ + public CreateRoleTemplateOptions build() { + return new CreateRoleTemplateOptions(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateRoleTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreateRoleTemplateOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateRoleTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreateRoleTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + + /** + * Set the role. + * + * @param role the role + * @return the CreateRoleTemplateOptions builder + */ + public Builder role(RoleTemplatePrototypeRole role) { + this.role = role; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateRoleTemplateOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateRoleTemplateOptions() { } + + protected CreateRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + name = builder.name; + accountId = builder.accountId; + description = builder.description; + committed = builder.committed; + role = builder.role; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the description. + * + * Description of the role template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the role for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template. If committed is set to true, then the template version can no longer be updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } + + /** + * Gets the role. + * + * The role properties that are created in an action resource when the template is assigned. + * + * @return the role + */ + public RoleTemplatePrototypeRole role() { + return role; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java new file mode 100644 index 00000000000..c322c5a332d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java @@ -0,0 +1,211 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createRoleTemplateVersion options. + */ +public class CreateRoleTemplateVersionOptions extends GenericModel { + + protected String roleTemplateId; + protected String name; + protected String description; + protected TemplateRole role; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String name; + private String description; + private TemplateRole role; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing CreateRoleTemplateVersionOptions instance. + * + * @param createRoleTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(CreateRoleTemplateVersionOptions createRoleTemplateVersionOptions) { + this.roleTemplateId = createRoleTemplateVersionOptions.roleTemplateId; + this.name = createRoleTemplateVersionOptions.name; + this.description = createRoleTemplateVersionOptions.description; + this.role = createRoleTemplateVersionOptions.role; + this.committed = createRoleTemplateVersionOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + */ + public Builder(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + } + + /** + * Builds a CreateRoleTemplateVersionOptions. + * + * @return the new CreateRoleTemplateVersionOptions instance + */ + public CreateRoleTemplateVersionOptions build() { + return new CreateRoleTemplateVersionOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the role. + * + * @param role the role + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder role(TemplateRole role) { + this.role = role; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected CreateRoleTemplateVersionOptions() { } + + protected CreateRoleTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + roleTemplateId = builder.roleTemplateId; + name = builder.name; + description = builder.description; + role = builder.role; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a CreateRoleTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * The role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will + * change the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the role template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the role for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the role. + * + * The role properties that are created in an action resource when the template is assigned. + * + * @return the role + */ + public TemplateRole role() { + return role; + } + + /** + * Gets the committed. + * + * Committed status of the template version. If committed is set to true, then the template version can no longer be + * updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java new file mode 100644 index 00000000000..59ccb4b908a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java @@ -0,0 +1,312 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createV2Policy options. + */ +public class CreateV2PolicyOptions extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + protected Control control; + protected String type; + protected String description; + protected V2PolicySubject subject; + protected V2PolicyResource resource; + protected String pattern; + protected V2PolicyRule rule; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private Control control; + private String type; + private String description; + private V2PolicySubject subject; + private V2PolicyResource resource; + private String pattern; + private V2PolicyRule rule; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateV2PolicyOptions instance. + * + * @param createV2PolicyOptions the instance to initialize the Builder with + */ + private Builder(CreateV2PolicyOptions createV2PolicyOptions) { + this.control = createV2PolicyOptions.control; + this.type = createV2PolicyOptions.type; + this.description = createV2PolicyOptions.description; + this.subject = createV2PolicyOptions.subject; + this.resource = createV2PolicyOptions.resource; + this.pattern = createV2PolicyOptions.pattern; + this.rule = createV2PolicyOptions.rule; + this.acceptLanguage = createV2PolicyOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param control the control + * @param type the type + */ + public Builder(Control control, String type) { + this.control = control; + this.type = type; + } + + /** + * Builds a CreateV2PolicyOptions. + * + * @return the new CreateV2PolicyOptions instance + */ + public CreateV2PolicyOptions build() { + return new CreateV2PolicyOptions(this); + } + + /** + * Set the control. + * + * @param control the control + * @return the CreateV2PolicyOptions builder + */ + public Builder control(Control control) { + this.control = control; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the CreateV2PolicyOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateV2PolicyOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the subject. + * + * @param subject the subject + * @return the CreateV2PolicyOptions builder + */ + public Builder subject(V2PolicySubject subject) { + this.subject = subject; + return this; + } + + /** + * Set the resource. + * + * @param resource the resource + * @return the CreateV2PolicyOptions builder + */ + public Builder resource(V2PolicyResource resource) { + this.resource = resource; + return this; + } + + /** + * Set the pattern. + * + * @param pattern the pattern + * @return the CreateV2PolicyOptions builder + */ + public Builder pattern(String pattern) { + this.pattern = pattern; + return this; + } + + /** + * Set the rule. + * + * @param rule the rule + * @return the CreateV2PolicyOptions builder + */ + public Builder rule(V2PolicyRule rule) { + this.rule = rule; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateV2PolicyOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateV2PolicyOptions() { } + + protected CreateV2PolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.control, + "control cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + control = builder.control; + type = builder.type; + description = builder.description; + subject = builder.subject; + resource = builder.resource; + pattern = builder.pattern; + rule = builder.rule; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateV2PolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the control. + * + * Specifies the type of access that is granted by the policy. + * + * @return the control + */ + public Control control() { + return control; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject subject() { + return subject; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource resource() { + return resource; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String pattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule rule() { + return rule; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java new file mode 100644 index 00000000000..f5e35c13d9f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java @@ -0,0 +1,195 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * An additional set of properties associated with a role. + */ +public class CustomRole extends GenericModel { + + protected String id; + @SerializedName("display_name") + protected String displayName; + protected String description; + protected List actions; + protected String crn; + protected String name; + @SerializedName("account_id") + protected String accountId; + @SerializedName("service_name") + protected String serviceName; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String href; + + protected CustomRole() { } + + /** + * Gets the id. + * + * The role ID. Composed of hexadecimal characters. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String getDisplayName() { + return displayName; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List getActions() { + return actions; + } + + /** + * Gets the crn. + * + * The role Cloud Resource Name (CRN). Example CRN: + * 'crn:v1:ibmcloud:public:iam-access-management::a/exampleAccountId::customRole:ExampleRoleName'. + * + * @return the crn + */ + public String getCrn() { + return crn; + } + + /** + * Gets the name. + * + * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the accountId. + * + * The account GUID. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the serviceName. + * + * The service name. + * + * @return the serviceName + */ + public String getServiceName() { + return serviceName; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the role was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the role. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the role was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the href. + * + * The href links back to the role. + * + * @return the href + */ + public String getHref() { + return href; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java new file mode 100644 index 00000000000..f71d2c2ab9d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteActionControlAssignment options. + */ +public class DeleteActionControlAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing DeleteActionControlAssignmentOptions instance. + * + * @param deleteActionControlAssignmentOptions the instance to initialize the Builder with + */ + private Builder(DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptions) { + this.assignmentId = deleteActionControlAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a DeleteActionControlAssignmentOptions. + * + * @return the new DeleteActionControlAssignmentOptions instance + */ + public DeleteActionControlAssignmentOptions build() { + return new DeleteActionControlAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the DeleteActionControlAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected DeleteActionControlAssignmentOptions() { } + + protected DeleteActionControlAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a DeleteActionControlAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Action control template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java new file mode 100644 index 00000000000..6ff35d83603 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteActionControlTemplate options. + */ +public class DeleteActionControlTemplateOptions extends GenericModel { + + protected String actionControlTemplateId; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + + /** + * Instantiates a new Builder from an existing DeleteActionControlTemplateOptions instance. + * + * @param deleteActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(DeleteActionControlTemplateOptions deleteActionControlTemplateOptions) { + this.actionControlTemplateId = deleteActionControlTemplateOptions.actionControlTemplateId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + */ + public Builder(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + } + + /** + * Builds a DeleteActionControlTemplateOptions. + * + * @return the new DeleteActionControlTemplateOptions instance + */ + public DeleteActionControlTemplateOptions build() { + return new DeleteActionControlTemplateOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the DeleteActionControlTemplateOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + } + + protected DeleteActionControlTemplateOptions() { } + + protected DeleteActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + } + + /** + * New builder. + * + * @return a DeleteActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java new file mode 100644 index 00000000000..69aca0555a1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteActionControlTemplateVersion options. + */ +public class DeleteActionControlTemplateVersionOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing DeleteActionControlTemplateVersionOptions instance. + * + * @param deleteActionControlTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptions) { + this.actionControlTemplateId = deleteActionControlTemplateVersionOptions.actionControlTemplateId; + this.version = deleteActionControlTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + * @param version the version + */ + public Builder(String actionControlTemplateId, String version) { + this.actionControlTemplateId = actionControlTemplateId; + this.version = version; + } + + /** + * Builds a DeleteActionControlTemplateVersionOptions. + * + * @return the new DeleteActionControlTemplateVersionOptions instance + */ + public DeleteActionControlTemplateVersionOptions build() { + return new DeleteActionControlTemplateVersionOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the DeleteActionControlTemplateVersionOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the DeleteActionControlTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected DeleteActionControlTemplateVersionOptions() { } + + protected DeleteActionControlTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a DeleteActionControlTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java new file mode 100644 index 00000000000..3ab2cf17469 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deletePolicyAssignment options. + */ +public class DeletePolicyAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing DeletePolicyAssignmentOptions instance. + * + * @param deletePolicyAssignmentOptions the instance to initialize the Builder with + */ + private Builder(DeletePolicyAssignmentOptions deletePolicyAssignmentOptions) { + this.assignmentId = deletePolicyAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a DeletePolicyAssignmentOptions. + * + * @return the new DeletePolicyAssignmentOptions instance + */ + public DeletePolicyAssignmentOptions build() { + return new DeletePolicyAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the DeletePolicyAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected DeletePolicyAssignmentOptions() { } + + protected DeletePolicyAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a DeletePolicyAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * The policy template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java new file mode 100644 index 00000000000..fe070b2064a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deletePolicy options. + */ +public class DeletePolicyOptions extends GenericModel { + + protected String policyId; + + /** + * Builder. + */ + public static class Builder { + private String policyId; + + /** + * Instantiates a new Builder from an existing DeletePolicyOptions instance. + * + * @param deletePolicyOptions the instance to initialize the Builder with + */ + private Builder(DeletePolicyOptions deletePolicyOptions) { + this.policyId = deletePolicyOptions.policyId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyId the policyId + */ + public Builder(String policyId) { + this.policyId = policyId; + } + + /** + * Builds a DeletePolicyOptions. + * + * @return the new DeletePolicyOptions instance + */ + public DeletePolicyOptions build() { + return new DeletePolicyOptions(this); + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the DeletePolicyOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + } + + protected DeletePolicyOptions() { } + + protected DeletePolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId cannot be empty"); + policyId = builder.policyId; + } + + /** + * New builder. + * + * @return a DeletePolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyId. + * + * The policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java new file mode 100644 index 00000000000..bb70b0d6727 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deletePolicyTemplate options. + */ +public class DeletePolicyTemplateOptions extends GenericModel { + + protected String policyTemplateId; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + + /** + * Instantiates a new Builder from an existing DeletePolicyTemplateOptions instance. + * + * @param deletePolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(DeletePolicyTemplateOptions deletePolicyTemplateOptions) { + this.policyTemplateId = deletePolicyTemplateOptions.policyTemplateId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + */ + public Builder(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + } + + /** + * Builds a DeletePolicyTemplateOptions. + * + * @return the new DeletePolicyTemplateOptions instance + */ + public DeletePolicyTemplateOptions build() { + return new DeletePolicyTemplateOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the DeletePolicyTemplateOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + } + + protected DeletePolicyTemplateOptions() { } + + protected DeletePolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + policyTemplateId = builder.policyTemplateId; + } + + /** + * New builder. + * + * @return a DeletePolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java new file mode 100644 index 00000000000..9a04a5157b6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deletePolicyTemplateVersion options. + */ +public class DeletePolicyTemplateVersionOptions extends GenericModel { + + protected String policyTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing DeletePolicyTemplateVersionOptions instance. + * + * @param deletePolicyTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptions) { + this.policyTemplateId = deletePolicyTemplateVersionOptions.policyTemplateId; + this.version = deletePolicyTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param version the version + */ + public Builder(String policyTemplateId, String version) { + this.policyTemplateId = policyTemplateId; + this.version = version; + } + + /** + * Builds a DeletePolicyTemplateVersionOptions. + * + * @return the new DeletePolicyTemplateVersionOptions instance + */ + public DeletePolicyTemplateVersionOptions build() { + return new DeletePolicyTemplateVersionOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the DeletePolicyTemplateVersionOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the DeletePolicyTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected DeletePolicyTemplateVersionOptions() { } + + protected DeletePolicyTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + policyTemplateId = builder.policyTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a DeletePolicyTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the version. + * + * The policy template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java new file mode 100644 index 00000000000..b9341a9f414 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteRoleAssignment options. + */ +public class DeleteRoleAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing DeleteRoleAssignmentOptions instance. + * + * @param deleteRoleAssignmentOptions the instance to initialize the Builder with + */ + private Builder(DeleteRoleAssignmentOptions deleteRoleAssignmentOptions) { + this.assignmentId = deleteRoleAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a DeleteRoleAssignmentOptions. + * + * @return the new DeleteRoleAssignmentOptions instance + */ + public DeleteRoleAssignmentOptions build() { + return new DeleteRoleAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the DeleteRoleAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected DeleteRoleAssignmentOptions() { } + + protected DeleteRoleAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a DeleteRoleAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Role template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java new file mode 100644 index 00000000000..8675777719e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteRole options. + */ +public class DeleteRoleOptions extends GenericModel { + + protected String roleId; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + + /** + * Instantiates a new Builder from an existing DeleteRoleOptions instance. + * + * @param deleteRoleOptions the instance to initialize the Builder with + */ + private Builder(DeleteRoleOptions deleteRoleOptions) { + this.roleId = deleteRoleOptions.roleId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + */ + public Builder(String roleId) { + this.roleId = roleId; + } + + /** + * Builds a DeleteRoleOptions. + * + * @return the new DeleteRoleOptions instance + */ + public DeleteRoleOptions build() { + return new DeleteRoleOptions(this); + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the DeleteRoleOptions builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + } + + protected DeleteRoleOptions() { } + + protected DeleteRoleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, + "roleId cannot be empty"); + roleId = builder.roleId; + } + + /** + * New builder. + * + * @return a DeleteRoleOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role ID. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java new file mode 100644 index 00000000000..c76bf3bfda4 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteRoleTemplate options. + */ +public class DeleteRoleTemplateOptions extends GenericModel { + + protected String roleTemplateId; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + + /** + * Instantiates a new Builder from an existing DeleteRoleTemplateOptions instance. + * + * @param deleteRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(DeleteRoleTemplateOptions deleteRoleTemplateOptions) { + this.roleTemplateId = deleteRoleTemplateOptions.roleTemplateId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + */ + public Builder(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + } + + /** + * Builds a DeleteRoleTemplateOptions. + * + * @return the new DeleteRoleTemplateOptions instance + */ + public DeleteRoleTemplateOptions build() { + return new DeleteRoleTemplateOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the DeleteRoleTemplateOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + } + + protected DeleteRoleTemplateOptions() { } + + protected DeleteRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + roleTemplateId = builder.roleTemplateId; + } + + /** + * New builder. + * + * @return a DeleteRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java new file mode 100644 index 00000000000..9f974213165 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteRoleTemplateVersion options. + */ +public class DeleteRoleTemplateVersionOptions extends GenericModel { + + protected String roleTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing DeleteRoleTemplateVersionOptions instance. + * + * @param deleteRoleTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptions) { + this.roleTemplateId = deleteRoleTemplateVersionOptions.roleTemplateId; + this.version = deleteRoleTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + * @param version the version + */ + public Builder(String roleTemplateId, String version) { + this.roleTemplateId = roleTemplateId; + this.version = version; + } + + /** + * Builds a DeleteRoleTemplateVersionOptions. + * + * @return the new DeleteRoleTemplateVersionOptions instance + */ + public DeleteRoleTemplateVersionOptions build() { + return new DeleteRoleTemplateVersionOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the DeleteRoleTemplateVersionOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the DeleteRoleTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected DeleteRoleTemplateVersionOptions() { } + + protected DeleteRoleTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + roleTemplateId = builder.roleTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a DeleteRoleTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the version. + * + * Role template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java new file mode 100644 index 00000000000..92c1caaa34c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteV2Policy options. + */ +public class DeleteV2PolicyOptions extends GenericModel { + + protected String id; + + /** + * Builder. + */ + public static class Builder { + private String id; + + /** + * Instantiates a new Builder from an existing DeleteV2PolicyOptions instance. + * + * @param deleteV2PolicyOptions the instance to initialize the Builder with + */ + private Builder(DeleteV2PolicyOptions deleteV2PolicyOptions) { + this.id = deleteV2PolicyOptions.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 DeleteV2PolicyOptions. + * + * @return the new DeleteV2PolicyOptions instance + */ + public DeleteV2PolicyOptions build() { + return new DeleteV2PolicyOptions(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the DeleteV2PolicyOptions builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + } + + protected DeleteV2PolicyOptions() { } + + protected DeleteV2PolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, + "id cannot be empty"); + id = builder.id; + } + + /** + * New builder. + * + * @return a DeleteV2PolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String id() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java new file mode 100644 index 00000000000..0978eb1040b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java @@ -0,0 +1,81 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role associated with a policy with additional information (display_name, description, actions) when + * `format=display`. + */ +public class EnrichedRoles extends GenericModel { + + @SerializedName("role_id") + protected String roleId; + @SerializedName("display_name") + protected String displayName; + protected String description; + protected List actions; + + protected EnrichedRoles() { } + + /** + * Gets the roleId. + * + * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. + * + * @return the roleId + */ + public String getRoleId() { + return roleId; + } + + /** + * Gets the displayName. + * + * The display name of the role, either service-defined or user-defined for custom roles. + * + * @return the displayName + */ + public String getDisplayName() { + return displayName; + } + + /** + * Gets the description. + * + * The role description, either service-defined or user-defined for custom roles. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List getActions() { + return actions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java new file mode 100644 index 00000000000..e99ea48f5f6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Additional error details. + */ +public class ErrorDetails extends GenericModel { + + @SerializedName("conflicts_with") + protected ConflictsWith conflictsWith; + + protected ErrorDetails() { } + + /** + * Gets the conflictsWith. + * + * Details of conflicting resource. + * + * @return the conflictsWith + */ + public ConflictsWith getConflictsWith() { + return conflictsWith; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java new file mode 100644 index 00000000000..b5411a7bb36 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java @@ -0,0 +1,128 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * ErrorObject. + */ +public class ErrorObject extends GenericModel { + + /** + * The API error code for the error. + */ + public interface Code { + /** insufficent_permissions. */ + String INSUFFICENT_PERMISSIONS = "insufficent_permissions"; + /** invalid_body. */ + String INVALID_BODY = "invalid_body"; + /** invalid_token. */ + String INVALID_TOKEN = "invalid_token"; + /** missing_required_query_parameter. */ + String MISSING_REQUIRED_QUERY_PARAMETER = "missing_required_query_parameter"; + /** not_found. */ + String NOT_FOUND = "not_found"; + /** policy_conflict_error. */ + String POLICY_CONFLICT_ERROR = "policy_conflict_error"; + /** policy_not_found. */ + String POLICY_NOT_FOUND = "policy_not_found"; + /** request_not_processed. */ + String REQUEST_NOT_PROCESSED = "request_not_processed"; + /** role_conflict_error. */ + String ROLE_CONFLICT_ERROR = "role_conflict_error"; + /** role_not_found. */ + String ROLE_NOT_FOUND = "role_not_found"; + /** too_many_requests. */ + String TOO_MANY_REQUESTS = "too_many_requests"; + /** unable_to_process. */ + String UNABLE_TO_PROCESS = "unable_to_process"; + /** unsupported_content_type. */ + String UNSUPPORTED_CONTENT_TYPE = "unsupported_content_type"; + /** policy_template_conflict_error. */ + String POLICY_TEMPLATE_CONFLICT_ERROR = "policy_template_conflict_error"; + /** policy_template_not_found. */ + String POLICY_TEMPLATE_NOT_FOUND = "policy_template_not_found"; + /** policy_assignment_not_found. */ + String POLICY_ASSIGNMENT_NOT_FOUND = "policy_assignment_not_found"; + /** policy_assignment_conflict_error. */ + String POLICY_ASSIGNMENT_CONFLICT_ERROR = "policy_assignment_conflict_error"; + /** resource_not_found. */ + String RESOURCE_NOT_FOUND = "resource_not_found"; + /** action_control_template_not_found. */ + String ACTION_CONTROL_TEMPLATE_NOT_FOUND = "action_control_template_not_found"; + /** action_control_assignment_not_found. */ + String ACTION_CONTROL_ASSIGNMENT_NOT_FOUND = "action_control_assignment_not_found"; + /** role_template_conflict_error. */ + String ROLE_TEMPLATE_CONFLICT_ERROR = "role_template_conflict_error"; + /** role_template_not_found. */ + String ROLE_TEMPLATE_NOT_FOUND = "role_template_not_found"; + /** role_assignment_not_found. */ + String ROLE_ASSIGNMENT_NOT_FOUND = "role_assignment_not_found"; + } + + protected String code; + protected String message; + protected ErrorDetails details; + @SerializedName("more_info") + protected String moreInfo; + + protected ErrorObject() { } + + /** + * Gets the code. + * + * The API error code for the error. + * + * @return the code + */ + public String getCode() { + return code; + } + + /** + * Gets the message. + * + * The error message returned by the API. + * + * @return the message + */ + public String getMessage() { + return message; + } + + /** + * Gets the details. + * + * Additional error details. + * + * @return the details + */ + public ErrorDetails getDetails() { + return details; + } + + /** + * Gets the moreInfo. + * + * Additional info for error. + * + * @return the moreInfo + */ + public String getMoreInfo() { + return moreInfo; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java new file mode 100644 index 00000000000..5c1c9a9fad6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * How external accounts can interact in relation to the requested account. + */ +public class ExternalAccountIdentityInteraction extends GenericModel { + + @SerializedName("identity_types") + protected IdentityTypes identityTypes; + + protected ExternalAccountIdentityInteraction() { } + + /** + * Gets the identityTypes. + * + * The settings for each identity type. + * + * @return the identityTypes + */ + public IdentityTypes getIdentityTypes() { + return identityTypes; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java new file mode 100644 index 00000000000..1efd0673e9d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java @@ -0,0 +1,95 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Update to how external accounts can interact in relation to the requested account. + */ +public class ExternalAccountIdentityInteractionPatch extends GenericModel { + + @SerializedName("identity_types") + protected IdentityTypesPatch identityTypes; + + /** + * Builder. + */ + public static class Builder { + private IdentityTypesPatch identityTypes; + + /** + * Instantiates a new Builder from an existing ExternalAccountIdentityInteractionPatch instance. + * + * @param externalAccountIdentityInteractionPatch the instance to initialize the Builder with + */ + private Builder(ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatch) { + this.identityTypes = externalAccountIdentityInteractionPatch.identityTypes; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ExternalAccountIdentityInteractionPatch. + * + * @return the new ExternalAccountIdentityInteractionPatch instance + */ + public ExternalAccountIdentityInteractionPatch build() { + return new ExternalAccountIdentityInteractionPatch(this); + } + + /** + * Set the identityTypes. + * + * @param identityTypes the identityTypes + * @return the ExternalAccountIdentityInteractionPatch builder + */ + public Builder identityTypes(IdentityTypesPatch identityTypes) { + this.identityTypes = identityTypes; + return this; + } + } + + protected ExternalAccountIdentityInteractionPatch() { } + + protected ExternalAccountIdentityInteractionPatch(Builder builder) { + identityTypes = builder.identityTypes; + } + + /** + * New builder. + * + * @return a ExternalAccountIdentityInteractionPatch builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the identityTypes. + * + * The settings to apply for each identity type for a request. + * + * @return the identityTypes + */ + public IdentityTypesPatch identityTypes() { + return identityTypes; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java new file mode 100644 index 00000000000..83cd67d33c9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Details with linking href to first page of requested collection. + */ +public class First extends GenericModel { + + protected String href; + + protected First() { } + + /** + * Gets the href. + * + * The href linking to the page of requested collection. + * + * @return the href + */ + public String getHref() { + return href; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java new file mode 100644 index 00000000000..f87e7d741a4 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getActionControlAssignment options. + */ +public class GetActionControlAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing GetActionControlAssignmentOptions instance. + * + * @param getActionControlAssignmentOptions the instance to initialize the Builder with + */ + private Builder(GetActionControlAssignmentOptions getActionControlAssignmentOptions) { + this.assignmentId = getActionControlAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a GetActionControlAssignmentOptions. + * + * @return the new GetActionControlAssignmentOptions instance + */ + public GetActionControlAssignmentOptions build() { + return new GetActionControlAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the GetActionControlAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected GetActionControlAssignmentOptions() { } + + protected GetActionControlAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a GetActionControlAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Action control template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java new file mode 100644 index 00000000000..963c68e8876 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java @@ -0,0 +1,140 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getActionControlTemplate options. + */ +public class GetActionControlTemplateOptions extends GenericModel { + + /** + * The action control template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String actionControlTemplateId; + protected String state; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String state; + + /** + * Instantiates a new Builder from an existing GetActionControlTemplateOptions instance. + * + * @param getActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(GetActionControlTemplateOptions getActionControlTemplateOptions) { + this.actionControlTemplateId = getActionControlTemplateOptions.actionControlTemplateId; + this.state = getActionControlTemplateOptions.state; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + */ + public Builder(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + } + + /** + * Builds a GetActionControlTemplateOptions. + * + * @return the new GetActionControlTemplateOptions instance + */ + public GetActionControlTemplateOptions build() { + return new GetActionControlTemplateOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the GetActionControlTemplateOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the GetActionControlTemplateOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + } + + protected GetActionControlTemplateOptions() { } + + protected GetActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + state = builder.state; + } + + /** + * New builder. + * + * @return a GetActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the state. + * + * The action control template state. + * + * @return the state + */ + public String state() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java new file mode 100644 index 00000000000..95bc94950bb --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getActionControlTemplateVersion options. + */ +public class GetActionControlTemplateVersionOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing GetActionControlTemplateVersionOptions instance. + * + * @param getActionControlTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptions) { + this.actionControlTemplateId = getActionControlTemplateVersionOptions.actionControlTemplateId; + this.version = getActionControlTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + * @param version the version + */ + public Builder(String actionControlTemplateId, String version) { + this.actionControlTemplateId = actionControlTemplateId; + this.version = version; + } + + /** + * Builds a GetActionControlTemplateVersionOptions. + * + * @return the new GetActionControlTemplateVersionOptions instance + */ + public GetActionControlTemplateVersionOptions build() { + return new GetActionControlTemplateVersionOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the GetActionControlTemplateVersionOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the GetActionControlTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected GetActionControlTemplateVersionOptions() { } + + protected GetActionControlTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a GetActionControlTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java new file mode 100644 index 00000000000..d1c7c359003 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getPolicyAssignment options. + */ +public class GetPolicyAssignmentOptions extends GenericModel { + + protected String assignmentId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + private String version; + + /** + * Instantiates a new Builder from an existing GetPolicyAssignmentOptions instance. + * + * @param getPolicyAssignmentOptions the instance to initialize the Builder with + */ + private Builder(GetPolicyAssignmentOptions getPolicyAssignmentOptions) { + this.assignmentId = getPolicyAssignmentOptions.assignmentId; + this.version = getPolicyAssignmentOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + * @param version the version + */ + public Builder(String assignmentId, String version) { + this.assignmentId = assignmentId; + this.version = version; + } + + /** + * Builds a GetPolicyAssignmentOptions. + * + * @return the new GetPolicyAssignmentOptions instance + */ + public GetPolicyAssignmentOptions build() { + return new GetPolicyAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the GetPolicyAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the GetPolicyAssignmentOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected GetPolicyAssignmentOptions() { } + + protected GetPolicyAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + assignmentId = builder.assignmentId; + version = builder.version; + } + + /** + * New builder. + * + * @return a GetPolicyAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * The policy template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } + + /** + * Gets the version. + * + * specify version of response body format. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java new file mode 100644 index 00000000000..e780ac06896 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getPolicy options. + */ +public class GetPolicyOptions extends GenericModel { + + protected String policyId; + + /** + * Builder. + */ + public static class Builder { + private String policyId; + + /** + * Instantiates a new Builder from an existing GetPolicyOptions instance. + * + * @param getPolicyOptions the instance to initialize the Builder with + */ + private Builder(GetPolicyOptions getPolicyOptions) { + this.policyId = getPolicyOptions.policyId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyId the policyId + */ + public Builder(String policyId) { + this.policyId = policyId; + } + + /** + * Builds a GetPolicyOptions. + * + * @return the new GetPolicyOptions instance + */ + public GetPolicyOptions build() { + return new GetPolicyOptions(this); + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the GetPolicyOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + } + + protected GetPolicyOptions() { } + + protected GetPolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId cannot be empty"); + policyId = builder.policyId; + } + + /** + * New builder. + * + * @return a GetPolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyId. + * + * The policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java new file mode 100644 index 00000000000..ee604554a85 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java @@ -0,0 +1,140 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getPolicyTemplate options. + */ +public class GetPolicyTemplateOptions extends GenericModel { + + /** + * The policy template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String policyTemplateId; + protected String state; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String state; + + /** + * Instantiates a new Builder from an existing GetPolicyTemplateOptions instance. + * + * @param getPolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(GetPolicyTemplateOptions getPolicyTemplateOptions) { + this.policyTemplateId = getPolicyTemplateOptions.policyTemplateId; + this.state = getPolicyTemplateOptions.state; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + */ + public Builder(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + } + + /** + * Builds a GetPolicyTemplateOptions. + * + * @return the new GetPolicyTemplateOptions instance + */ + public GetPolicyTemplateOptions build() { + return new GetPolicyTemplateOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the GetPolicyTemplateOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the GetPolicyTemplateOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + } + + protected GetPolicyTemplateOptions() { } + + protected GetPolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + policyTemplateId = builder.policyTemplateId; + state = builder.state; + } + + /** + * New builder. + * + * @return a GetPolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the state. + * + * The policy template state. + * + * @return the state + */ + public String state() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java new file mode 100644 index 00000000000..8741f83357d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getPolicyTemplateVersion options. + */ +public class GetPolicyTemplateVersionOptions extends GenericModel { + + protected String policyTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing GetPolicyTemplateVersionOptions instance. + * + * @param getPolicyTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptions) { + this.policyTemplateId = getPolicyTemplateVersionOptions.policyTemplateId; + this.version = getPolicyTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param version the version + */ + public Builder(String policyTemplateId, String version) { + this.policyTemplateId = policyTemplateId; + this.version = version; + } + + /** + * Builds a GetPolicyTemplateVersionOptions. + * + * @return the new GetPolicyTemplateVersionOptions instance + */ + public GetPolicyTemplateVersionOptions build() { + return new GetPolicyTemplateVersionOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the GetPolicyTemplateVersionOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the GetPolicyTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected GetPolicyTemplateVersionOptions() { } + + protected GetPolicyTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + policyTemplateId = builder.policyTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a GetPolicyTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the version. + * + * The policy template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java new file mode 100644 index 00000000000..35313b9b746 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getRoleAssignment options. + */ +public class GetRoleAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing GetRoleAssignmentOptions instance. + * + * @param getRoleAssignmentOptions the instance to initialize the Builder with + */ + private Builder(GetRoleAssignmentOptions getRoleAssignmentOptions) { + this.assignmentId = getRoleAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a GetRoleAssignmentOptions. + * + * @return the new GetRoleAssignmentOptions instance + */ + public GetRoleAssignmentOptions build() { + return new GetRoleAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the GetRoleAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected GetRoleAssignmentOptions() { } + + protected GetRoleAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a GetRoleAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Role template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java new file mode 100644 index 00000000000..8c56ac7f58a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getRole options. + */ +public class GetRoleOptions extends GenericModel { + + protected String roleId; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + + /** + * Instantiates a new Builder from an existing GetRoleOptions instance. + * + * @param getRoleOptions the instance to initialize the Builder with + */ + private Builder(GetRoleOptions getRoleOptions) { + this.roleId = getRoleOptions.roleId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + */ + public Builder(String roleId) { + this.roleId = roleId; + } + + /** + * Builds a GetRoleOptions. + * + * @return the new GetRoleOptions instance + */ + public GetRoleOptions build() { + return new GetRoleOptions(this); + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the GetRoleOptions builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + } + + protected GetRoleOptions() { } + + protected GetRoleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, + "roleId cannot be empty"); + roleId = builder.roleId; + } + + /** + * New builder. + * + * @return a GetRoleOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role ID. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java new file mode 100644 index 00000000000..e33fcf29b32 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java @@ -0,0 +1,140 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getRoleTemplate options. + */ +public class GetRoleTemplateOptions extends GenericModel { + + /** + * The role template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String roleTemplateId; + protected String state; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String state; + + /** + * Instantiates a new Builder from an existing GetRoleTemplateOptions instance. + * + * @param getRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(GetRoleTemplateOptions getRoleTemplateOptions) { + this.roleTemplateId = getRoleTemplateOptions.roleTemplateId; + this.state = getRoleTemplateOptions.state; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + */ + public Builder(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + } + + /** + * Builds a GetRoleTemplateOptions. + * + * @return the new GetRoleTemplateOptions instance + */ + public GetRoleTemplateOptions build() { + return new GetRoleTemplateOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the GetRoleTemplateOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the GetRoleTemplateOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + } + + protected GetRoleTemplateOptions() { } + + protected GetRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + roleTemplateId = builder.roleTemplateId; + state = builder.state; + } + + /** + * New builder. + * + * @return a GetRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the state. + * + * The role template state. + * + * @return the state + */ + public String state() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java new file mode 100644 index 00000000000..4757484f969 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getRoleTemplateVersion options. + */ +public class GetRoleTemplateVersionOptions extends GenericModel { + + protected String roleTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing GetRoleTemplateVersionOptions instance. + * + * @param getRoleTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(GetRoleTemplateVersionOptions getRoleTemplateVersionOptions) { + this.roleTemplateId = getRoleTemplateVersionOptions.roleTemplateId; + this.version = getRoleTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + * @param version the version + */ + public Builder(String roleTemplateId, String version) { + this.roleTemplateId = roleTemplateId; + this.version = version; + } + + /** + * Builds a GetRoleTemplateVersionOptions. + * + * @return the new GetRoleTemplateVersionOptions instance + */ + public GetRoleTemplateVersionOptions build() { + return new GetRoleTemplateVersionOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the GetRoleTemplateVersionOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the GetRoleTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected GetRoleTemplateVersionOptions() { } + + protected GetRoleTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + roleTemplateId = builder.roleTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a GetRoleTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the version. + * + * Role template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java new file mode 100644 index 00000000000..ebc88bbf45c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getSettings options. + */ +public class GetSettingsOptions extends GenericModel { + + protected String accountId; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing GetSettingsOptions instance. + * + * @param getSettingsOptions the instance to initialize the Builder with + */ + private Builder(GetSettingsOptions getSettingsOptions) { + this.accountId = getSettingsOptions.accountId; + this.acceptLanguage = getSettingsOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a GetSettingsOptions. + * + * @return the new GetSettingsOptions instance + */ + public GetSettingsOptions build() { + return new GetSettingsOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the GetSettingsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the GetSettingsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected GetSettingsOptions() { } + + protected GetSettingsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.accountId, + "accountId cannot be empty"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a GetSettingsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the settings belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java new file mode 100644 index 00000000000..23a950cc815 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java @@ -0,0 +1,148 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getV2Policy options. + */ +public class GetV2PolicyOptions extends GenericModel { + + /** + * Include additional data for policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles and translations for all + * relevant fields. + */ + public interface Format { + /** include_last_permit. */ + String INCLUDE_LAST_PERMIT = "include_last_permit"; + /** display. */ + String DISPLAY = "display"; + } + + protected String id; + protected String format; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String format; + + /** + * Instantiates a new Builder from an existing GetV2PolicyOptions instance. + * + * @param getV2PolicyOptions the instance to initialize the Builder with + */ + private Builder(GetV2PolicyOptions getV2PolicyOptions) { + this.id = getV2PolicyOptions.id; + this.format = getV2PolicyOptions.format; + } + + /** + * 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 GetV2PolicyOptions. + * + * @return the new GetV2PolicyOptions instance + */ + public GetV2PolicyOptions build() { + return new GetV2PolicyOptions(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the GetV2PolicyOptions builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the format. + * + * @param format the format + * @return the GetV2PolicyOptions builder + */ + public Builder format(String format) { + this.format = format; + return this; + } + } + + protected GetV2PolicyOptions() { } + + protected GetV2PolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, + "id cannot be empty"); + id = builder.id; + format = builder.format; + } + + /** + * New builder. + * + * @return a GetV2PolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the format. + * + * Include additional data for policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles and translations for all + * relevant fields. + * + * @return the format + */ + public String format() { + return format; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java new file mode 100644 index 00000000000..d8439c9d6f7 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java @@ -0,0 +1,124 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Permission is granted by the policy. + */ +public class Grant extends GenericModel { + + protected List roles; + + /** + * Builder. + */ + public static class Builder { + private List roles; + + /** + * Instantiates a new Builder from an existing Grant instance. + * + * @param grant the instance to initialize the Builder with + */ + private Builder(Grant grant) { + this.roles = grant.roles; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roles the roles + */ + public Builder(List roles) { + this.roles = roles; + } + + /** + * Builds a Grant. + * + * @return the new Grant instance + */ + public Grant build() { + return new Grant(this); + } + + /** + * Adds a new element to roles. + * + * @param roles the new element to be added + * @return the Grant builder + */ + public Builder addRoles(Roles roles) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roles, + "roles cannot be null"); + if (this.roles == null) { + this.roles = new ArrayList(); + } + this.roles.add(roles); + return this; + } + + /** + * Set the roles. + * Existing roles will be replaced. + * + * @param roles the roles + * @return the Grant builder + */ + public Builder roles(List roles) { + this.roles = roles; + return this; + } + } + + protected Grant() { } + + protected Grant(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, + "roles cannot be null"); + roles = builder.roles; + } + + /** + * New builder. + * + * @return a Grant builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List roles() { + return roles; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java new file mode 100644 index 00000000000..1dbc53fefb6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Permission granted by the policy with translated roles and additional role information. + */ +public class GrantWithEnrichedRoles extends GenericModel { + + protected List roles; + + protected GrantWithEnrichedRoles() { } + + /** + * Gets the roles. + * + * A set of roles granted by the policy. + * + * @return the roles + */ + public List getRoles() { + return roles; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java new file mode 100644 index 00000000000..0ac71d8192b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java @@ -0,0 +1,64 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The settings for each identity type. + */ +public class IdentityTypes extends GenericModel { + + protected IdentityTypesBase user; + @SerializedName("service_id") + protected IdentityTypesBase serviceId; + protected IdentityTypesBase service; + + protected IdentityTypes() { } + + /** + * Gets the user. + * + * The core set of properties associated with an identity type. + * + * @return the user + */ + public IdentityTypesBase getUser() { + return user; + } + + /** + * Gets the serviceId. + * + * The core set of properties associated with an identity type. + * + * @return the serviceId + */ + public IdentityTypesBase getServiceId() { + return serviceId; + } + + /** + * Gets the service. + * + * The core set of properties associated with an identity type. + * + * @return the service + */ + public IdentityTypesBase getService() { + return service; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java new file mode 100644 index 00000000000..e8df91a1e5d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java @@ -0,0 +1,168 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with an identity type. + */ +public class IdentityTypesBase extends GenericModel { + + /** + * The state of the identity type. + */ + public interface State { + /** enabled. */ + String ENABLED = "enabled"; + /** monitor. */ + String MONITOR = "monitor"; + /** limited. */ + String LIMITED = "limited"; + } + + protected String state; + @SerializedName("external_allowed_accounts") + protected List externalAllowedAccounts; + + /** + * Builder. + */ + public static class Builder { + private String state; + private List externalAllowedAccounts; + + /** + * Instantiates a new Builder from an existing IdentityTypesBase instance. + * + * @param identityTypesBase the instance to initialize the Builder with + */ + private Builder(IdentityTypesBase identityTypesBase) { + this.state = identityTypesBase.state; + this.externalAllowedAccounts = identityTypesBase.externalAllowedAccounts; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param state the state + * @param externalAllowedAccounts the externalAllowedAccounts + */ + public Builder(String state, List externalAllowedAccounts) { + this.state = state; + this.externalAllowedAccounts = externalAllowedAccounts; + } + + /** + * Builds a IdentityTypesBase. + * + * @return the new IdentityTypesBase instance + */ + public IdentityTypesBase build() { + return new IdentityTypesBase(this); + } + + /** + * Adds a new element to externalAllowedAccounts. + * + * @param externalAllowedAccounts the new element to be added + * @return the IdentityTypesBase builder + */ + public Builder addExternalAllowedAccounts(String externalAllowedAccounts) { + com.ibm.cloud.sdk.core.util.Validator.notNull(externalAllowedAccounts, + "externalAllowedAccounts cannot be null"); + if (this.externalAllowedAccounts == null) { + this.externalAllowedAccounts = new ArrayList(); + } + this.externalAllowedAccounts.add(externalAllowedAccounts); + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the IdentityTypesBase builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the externalAllowedAccounts. + * Existing externalAllowedAccounts will be replaced. + * + * @param externalAllowedAccounts the externalAllowedAccounts + * @return the IdentityTypesBase builder + */ + public Builder externalAllowedAccounts(List externalAllowedAccounts) { + this.externalAllowedAccounts = externalAllowedAccounts; + return this; + } + } + + protected IdentityTypesBase() { } + + protected IdentityTypesBase(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.state, + "state cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.externalAllowedAccounts, + "externalAllowedAccounts cannot be null"); + state = builder.state; + externalAllowedAccounts = builder.externalAllowedAccounts; + } + + /** + * New builder. + * + * @return a IdentityTypesBase builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the state. + * + * The state of the identity type. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the externalAllowedAccounts. + * + * List of accounts that the state applies to for a given identity. + * + * @return the externalAllowedAccounts + */ + public List externalAllowedAccounts() { + return externalAllowedAccounts; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java new file mode 100644 index 00000000000..77aa5a26366 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java @@ -0,0 +1,147 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The settings to apply for each identity type for a request. + */ +public class IdentityTypesPatch extends GenericModel { + + protected IdentityTypesBase user; + @SerializedName("service_id") + protected IdentityTypesBase serviceId; + protected IdentityTypesBase service; + + /** + * Builder. + */ + public static class Builder { + private IdentityTypesBase user; + private IdentityTypesBase serviceId; + private IdentityTypesBase service; + + /** + * Instantiates a new Builder from an existing IdentityTypesPatch instance. + * + * @param identityTypesPatch the instance to initialize the Builder with + */ + private Builder(IdentityTypesPatch identityTypesPatch) { + this.user = identityTypesPatch.user; + this.serviceId = identityTypesPatch.serviceId; + this.service = identityTypesPatch.service; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a IdentityTypesPatch. + * + * @return the new IdentityTypesPatch instance + */ + public IdentityTypesPatch build() { + return new IdentityTypesPatch(this); + } + + /** + * Set the user. + * + * @param user the user + * @return the IdentityTypesPatch builder + */ + public Builder user(IdentityTypesBase user) { + this.user = user; + return this; + } + + /** + * Set the serviceId. + * + * @param serviceId the serviceId + * @return the IdentityTypesPatch builder + */ + public Builder serviceId(IdentityTypesBase serviceId) { + this.serviceId = serviceId; + return this; + } + + /** + * Set the service. + * + * @param service the service + * @return the IdentityTypesPatch builder + */ + public Builder service(IdentityTypesBase service) { + this.service = service; + return this; + } + } + + protected IdentityTypesPatch() { } + + protected IdentityTypesPatch(Builder builder) { + user = builder.user; + serviceId = builder.serviceId; + service = builder.service; + } + + /** + * New builder. + * + * @return a IdentityTypesPatch builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the user. + * + * The core set of properties associated with an identity type. + * + * @return the user + */ + public IdentityTypesBase user() { + return user; + } + + /** + * Gets the serviceId. + * + * The core set of properties associated with an identity type. + * + * @return the serviceId + */ + public IdentityTypesBase serviceId() { + return serviceId; + } + + /** + * Gets the service. + * + * The core set of properties associated with an identity type. + * + * @return the service + */ + public IdentityTypesBase service() { + return service; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java new file mode 100644 index 00000000000..5aa0b39573b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * policy template current and limit details with in an account. + */ +public class LimitData extends GenericModel { + + protected Long current; + protected Long limit; + + protected LimitData() { } + + /** + * Gets the current. + * + * policy template current count. + * + * @return the current + */ + public Long getCurrent() { + return current; + } + + /** + * Gets the limit. + * + * policy template limit count. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java new file mode 100644 index 00000000000..6835f5afccc --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java @@ -0,0 +1,245 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listActionControlAssignments options. + */ +public class ListActionControlAssignmentsOptions extends GenericModel { + + protected String accountId; + protected String acceptLanguage; + protected String templateId; + protected String templateVersion; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String templateId; + private String templateVersion; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListActionControlAssignmentsOptions instance. + * + * @param listActionControlAssignmentsOptions the instance to initialize the Builder with + */ + private Builder(ListActionControlAssignmentsOptions listActionControlAssignmentsOptions) { + this.accountId = listActionControlAssignmentsOptions.accountId; + this.acceptLanguage = listActionControlAssignmentsOptions.acceptLanguage; + this.templateId = listActionControlAssignmentsOptions.templateId; + this.templateVersion = listActionControlAssignmentsOptions.templateVersion; + this.limit = listActionControlAssignmentsOptions.limit; + this.start = listActionControlAssignmentsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListActionControlAssignmentsOptions. + * + * @return the new ListActionControlAssignmentsOptions instance + */ + public ListActionControlAssignmentsOptions build() { + return new ListActionControlAssignmentsOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the templateId. + * + * @param templateId the templateId + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder templateId(String templateId) { + this.templateId = templateId; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListActionControlAssignmentsOptions() { } + + protected ListActionControlAssignmentsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + templateId = builder.templateId; + templateVersion = builder.templateVersion; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListActionControlAssignmentsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID in which the action control assignment belongs to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the templateId. + * + * Optional template ID. + * + * @return the templateId + */ + public String templateId() { + return templateId; + } + + /** + * Gets the templateVersion. + * + * Optional action control template version. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java new file mode 100644 index 00000000000..984d1060c83 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listActionControlTemplateVersions options. + */ +public class ListActionControlTemplateVersionsOptions extends GenericModel { + + /** + * Action control template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String actionControlTemplateId; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListActionControlTemplateVersionsOptions instance. + * + * @param listActionControlTemplateVersionsOptions the instance to initialize the Builder with + */ + private Builder(ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions) { + this.actionControlTemplateId = listActionControlTemplateVersionsOptions.actionControlTemplateId; + this.state = listActionControlTemplateVersionsOptions.state; + this.limit = listActionControlTemplateVersionsOptions.limit; + this.start = listActionControlTemplateVersionsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + */ + public Builder(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + } + + /** + * Builds a ListActionControlTemplateVersionsOptions. + * + * @return the new ListActionControlTemplateVersionsOptions instance + */ + public ListActionControlTemplateVersionsOptions build() { + return new ListActionControlTemplateVersionsOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the ListActionControlTemplateVersionsOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListActionControlTemplateVersionsOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListActionControlTemplateVersionsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListActionControlTemplateVersionsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListActionControlTemplateVersionsOptions() { } + + protected ListActionControlTemplateVersionsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListActionControlTemplateVersionsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * The action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the state. + * + * Action control template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java new file mode 100644 index 00000000000..d019db6119f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java @@ -0,0 +1,193 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listActionControlTemplates options. + */ +public class ListActionControlTemplatesOptions extends GenericModel { + + protected String accountId; + protected String acceptLanguage; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListActionControlTemplatesOptions instance. + * + * @param listActionControlTemplatesOptions the instance to initialize the Builder with + */ + private Builder(ListActionControlTemplatesOptions listActionControlTemplatesOptions) { + this.accountId = listActionControlTemplatesOptions.accountId; + this.acceptLanguage = listActionControlTemplatesOptions.acceptLanguage; + this.limit = listActionControlTemplatesOptions.limit; + this.start = listActionControlTemplatesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListActionControlTemplatesOptions. + * + * @return the new ListActionControlTemplatesOptions instance + */ + public ListActionControlTemplatesOptions build() { + return new ListActionControlTemplatesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListActionControlTemplatesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListActionControlTemplatesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListActionControlTemplatesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListActionControlTemplatesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListActionControlTemplatesOptions() { } + + protected ListActionControlTemplatesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListActionControlTemplatesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the action control templates belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java new file mode 100644 index 00000000000..90ecb352c37 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java @@ -0,0 +1,501 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listPolicies options. + */ +public class ListPoliciesOptions extends GenericModel { + + /** + * Optional type of policy. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + /** + * Optional type of service. + */ + public interface ServiceType { + /** service. */ + String SERVICE = "service"; + /** platform_service. */ + String PLATFORM_SERVICE = "platform_service"; + } + + /** + * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending + * '-' to field. Example '-last_modified_at'. + */ + public interface Sort { + /** id. */ + String ID = "id"; + /** type. */ + String TYPE = "type"; + /** href. */ + String HREF = "href"; + /** created_at. */ + String CREATED_AT = "created_at"; + /** created_by_id. */ + String CREATED_BY_ID = "created_by_id"; + /** last_modified_at. */ + String LAST_MODIFIED_AT = "last_modified_at"; + /** last_modified_by_id. */ + String LAST_MODIFIED_BY_ID = "last_modified_by_id"; + /** state. */ + String STATE = "state"; + } + + /** + * Include additional data per policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles. + */ + public interface Format { + /** include_last_permit. */ + String INCLUDE_LAST_PERMIT = "include_last_permit"; + /** display. */ + String DISPLAY = "display"; + } + + /** + * The state of the policy. + * * `active` - returns active policies + * * `deleted` - returns non-active policies. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String accountId; + protected String acceptLanguage; + protected String iamId; + protected String accessGroupId; + protected String type; + protected String serviceType; + protected String tagName; + protected String tagValue; + protected String sort; + protected String format; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String iamId; + private String accessGroupId; + private String type; + private String serviceType; + private String tagName; + private String tagValue; + private String sort; + private String format; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListPoliciesOptions instance. + * + * @param listPoliciesOptions the instance to initialize the Builder with + */ + private Builder(ListPoliciesOptions listPoliciesOptions) { + this.accountId = listPoliciesOptions.accountId; + this.acceptLanguage = listPoliciesOptions.acceptLanguage; + this.iamId = listPoliciesOptions.iamId; + this.accessGroupId = listPoliciesOptions.accessGroupId; + this.type = listPoliciesOptions.type; + this.serviceType = listPoliciesOptions.serviceType; + this.tagName = listPoliciesOptions.tagName; + this.tagValue = listPoliciesOptions.tagValue; + this.sort = listPoliciesOptions.sort; + this.format = listPoliciesOptions.format; + this.state = listPoliciesOptions.state; + this.limit = listPoliciesOptions.limit; + this.start = listPoliciesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListPoliciesOptions. + * + * @return the new ListPoliciesOptions instance + */ + public ListPoliciesOptions build() { + return new ListPoliciesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListPoliciesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListPoliciesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the iamId. + * + * @param iamId the iamId + * @return the ListPoliciesOptions builder + */ + public Builder iamId(String iamId) { + this.iamId = iamId; + return this; + } + + /** + * Set the accessGroupId. + * + * @param accessGroupId the accessGroupId + * @return the ListPoliciesOptions builder + */ + public Builder accessGroupId(String accessGroupId) { + this.accessGroupId = accessGroupId; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the ListPoliciesOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the serviceType. + * + * @param serviceType the serviceType + * @return the ListPoliciesOptions builder + */ + public Builder serviceType(String serviceType) { + this.serviceType = serviceType; + return this; + } + + /** + * Set the tagName. + * + * @param tagName the tagName + * @return the ListPoliciesOptions builder + */ + public Builder tagName(String tagName) { + this.tagName = tagName; + return this; + } + + /** + * Set the tagValue. + * + * @param tagValue the tagValue + * @return the ListPoliciesOptions builder + */ + public Builder tagValue(String tagValue) { + this.tagValue = tagValue; + return this; + } + + /** + * Set the sort. + * + * @param sort the sort + * @return the ListPoliciesOptions builder + */ + public Builder sort(String sort) { + this.sort = sort; + return this; + } + + /** + * Set the format. + * + * @param format the format + * @return the ListPoliciesOptions builder + */ + public Builder format(String format) { + this.format = format; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListPoliciesOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListPoliciesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListPoliciesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListPoliciesOptions() { } + + protected ListPoliciesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + iamId = builder.iamId; + accessGroupId = builder.accessGroupId; + type = builder.type; + serviceType = builder.serviceType; + tagName = builder.tagName; + tagValue = builder.tagValue; + sort = builder.sort; + format = builder.format; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListPoliciesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the policies belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the iamId. + * + * Optional IAM ID used to identify the subject. + * + * @return the iamId + */ + public String iamId() { + return iamId; + } + + /** + * Gets the accessGroupId. + * + * Optional access group id. + * + * @return the accessGroupId + */ + public String accessGroupId() { + return accessGroupId; + } + + /** + * Gets the type. + * + * Optional type of policy. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the serviceType. + * + * Optional type of service. + * + * @return the serviceType + */ + public String serviceType() { + return serviceType; + } + + /** + * Gets the tagName. + * + * Optional name of the access tag in the policy. + * + * @return the tagName + */ + public String tagName() { + return tagName; + } + + /** + * Gets the tagValue. + * + * Optional value of the access tag in the policy. + * + * @return the tagValue + */ + public String tagValue() { + return tagValue; + } + + /** + * Gets the sort. + * + * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending + * '-' to field. Example '-last_modified_at'. + * + * @return the sort + */ + public String sort() { + return sort; + } + + /** + * Gets the format. + * + * Include additional data per policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles. + * + * @return the format + */ + public String format() { + return format; + } + + /** + * Gets the state. + * + * The state of the policy. + * * `active` - returns active policies + * * `deleted` - returns non-active policies. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java new file mode 100644 index 00000000000..9362749c670 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java @@ -0,0 +1,275 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listPolicyAssignments options. + */ +public class ListPolicyAssignmentsOptions extends GenericModel { + + protected String version; + protected String accountId; + protected String acceptLanguage; + protected String templateId; + protected String templateVersion; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String version; + private String accountId; + private String acceptLanguage; + private String templateId; + private String templateVersion; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListPolicyAssignmentsOptions instance. + * + * @param listPolicyAssignmentsOptions the instance to initialize the Builder with + */ + private Builder(ListPolicyAssignmentsOptions listPolicyAssignmentsOptions) { + this.version = listPolicyAssignmentsOptions.version; + this.accountId = listPolicyAssignmentsOptions.accountId; + this.acceptLanguage = listPolicyAssignmentsOptions.acceptLanguage; + this.templateId = listPolicyAssignmentsOptions.templateId; + this.templateVersion = listPolicyAssignmentsOptions.templateVersion; + this.limit = listPolicyAssignmentsOptions.limit; + this.start = listPolicyAssignmentsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param version the version + * @param accountId the accountId + */ + public Builder(String version, String accountId) { + this.version = version; + this.accountId = accountId; + } + + /** + * Builds a ListPolicyAssignmentsOptions. + * + * @return the new ListPolicyAssignmentsOptions instance + */ + public ListPolicyAssignmentsOptions build() { + return new ListPolicyAssignmentsOptions(this); + } + + /** + * Set the version. + * + * @param version the version + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the templateId. + * + * @param templateId the templateId + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder templateId(String templateId) { + this.templateId = templateId; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListPolicyAssignmentsOptions() { } + + protected ListPolicyAssignmentsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + version = builder.version; + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + templateId = builder.templateId; + templateVersion = builder.templateVersion; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListPolicyAssignmentsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the version. + * + * specify version of response body format. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the accountId. + * + * The account GUID in which the policies belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the templateId. + * + * Optional template id. + * + * @return the templateId + */ + public String templateId() { + return templateId; + } + + /** + * Gets the templateVersion. + * + * Optional policy template version. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java new file mode 100644 index 00000000000..c7965ba6c31 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listPolicyTemplateVersions options. + */ +public class ListPolicyTemplateVersionsOptions extends GenericModel { + + /** + * The policy template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String policyTemplateId; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListPolicyTemplateVersionsOptions instance. + * + * @param listPolicyTemplateVersionsOptions the instance to initialize the Builder with + */ + private Builder(ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions) { + this.policyTemplateId = listPolicyTemplateVersionsOptions.policyTemplateId; + this.state = listPolicyTemplateVersionsOptions.state; + this.limit = listPolicyTemplateVersionsOptions.limit; + this.start = listPolicyTemplateVersionsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + */ + public Builder(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + } + + /** + * Builds a ListPolicyTemplateVersionsOptions. + * + * @return the new ListPolicyTemplateVersionsOptions instance + */ + public ListPolicyTemplateVersionsOptions build() { + return new ListPolicyTemplateVersionsOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the ListPolicyTemplateVersionsOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListPolicyTemplateVersionsOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListPolicyTemplateVersionsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListPolicyTemplateVersionsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListPolicyTemplateVersionsOptions() { } + + protected ListPolicyTemplateVersionsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + policyTemplateId = builder.policyTemplateId; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListPolicyTemplateVersionsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the state. + * + * The policy template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java new file mode 100644 index 00000000000..f230c9bd549 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java @@ -0,0 +1,379 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listPolicyTemplates options. + */ +public class ListPolicyTemplatesOptions extends GenericModel { + + /** + * The policy template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + /** + * Service type, Optional. + */ + public interface PolicyServiceType { + /** service. */ + String SERVICE = "service"; + /** platform_service. */ + String PLATFORM_SERVICE = "platform_service"; + } + + /** + * Policy type, Optional. + */ + public interface PolicyType { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + protected String accountId; + protected String acceptLanguage; + protected String state; + protected String name; + protected String policyServiceType; + protected String policyServiceName; + protected String policyServiceGroupId; + protected String policyType; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String state; + private String name; + private String policyServiceType; + private String policyServiceName; + private String policyServiceGroupId; + private String policyType; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListPolicyTemplatesOptions instance. + * + * @param listPolicyTemplatesOptions the instance to initialize the Builder with + */ + private Builder(ListPolicyTemplatesOptions listPolicyTemplatesOptions) { + this.accountId = listPolicyTemplatesOptions.accountId; + this.acceptLanguage = listPolicyTemplatesOptions.acceptLanguage; + this.state = listPolicyTemplatesOptions.state; + this.name = listPolicyTemplatesOptions.name; + this.policyServiceType = listPolicyTemplatesOptions.policyServiceType; + this.policyServiceName = listPolicyTemplatesOptions.policyServiceName; + this.policyServiceGroupId = listPolicyTemplatesOptions.policyServiceGroupId; + this.policyType = listPolicyTemplatesOptions.policyType; + this.limit = listPolicyTemplatesOptions.limit; + this.start = listPolicyTemplatesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListPolicyTemplatesOptions. + * + * @return the new ListPolicyTemplatesOptions instance + */ + public ListPolicyTemplatesOptions build() { + return new ListPolicyTemplatesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListPolicyTemplatesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListPolicyTemplatesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListPolicyTemplatesOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ListPolicyTemplatesOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the policyServiceType. + * + * @param policyServiceType the policyServiceType + * @return the ListPolicyTemplatesOptions builder + */ + public Builder policyServiceType(String policyServiceType) { + this.policyServiceType = policyServiceType; + return this; + } + + /** + * Set the policyServiceName. + * + * @param policyServiceName the policyServiceName + * @return the ListPolicyTemplatesOptions builder + */ + public Builder policyServiceName(String policyServiceName) { + this.policyServiceName = policyServiceName; + return this; + } + + /** + * Set the policyServiceGroupId. + * + * @param policyServiceGroupId the policyServiceGroupId + * @return the ListPolicyTemplatesOptions builder + */ + public Builder policyServiceGroupId(String policyServiceGroupId) { + this.policyServiceGroupId = policyServiceGroupId; + return this; + } + + /** + * Set the policyType. + * + * @param policyType the policyType + * @return the ListPolicyTemplatesOptions builder + */ + public Builder policyType(String policyType) { + this.policyType = policyType; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListPolicyTemplatesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListPolicyTemplatesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListPolicyTemplatesOptions() { } + + protected ListPolicyTemplatesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + state = builder.state; + name = builder.name; + policyServiceType = builder.policyServiceType; + policyServiceName = builder.policyServiceName; + policyServiceGroupId = builder.policyServiceGroupId; + policyType = builder.policyType; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListPolicyTemplatesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the policy templates belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the state. + * + * The policy template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the name. + * + * The policy template name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the policyServiceType. + * + * Service type, Optional. + * + * @return the policyServiceType + */ + public String policyServiceType() { + return policyServiceType; + } + + /** + * Gets the policyServiceName. + * + * Service name, Optional. + * + * @return the policyServiceName + */ + public String policyServiceName() { + return policyServiceName; + } + + /** + * Gets the policyServiceGroupId. + * + * Service group id, Optional. + * + * @return the policyServiceGroupId + */ + public String policyServiceGroupId() { + return policyServiceGroupId; + } + + /** + * Gets the policyType. + * + * Policy type, Optional. + * + * @return the policyType + */ + public String policyType() { + return policyType; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java new file mode 100644 index 00000000000..adcb3f0cc90 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java @@ -0,0 +1,245 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listRoleAssignments options. + */ +public class ListRoleAssignmentsOptions extends GenericModel { + + protected String accountId; + protected String acceptLanguage; + protected String templateId; + protected String templateVersion; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String templateId; + private String templateVersion; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListRoleAssignmentsOptions instance. + * + * @param listRoleAssignmentsOptions the instance to initialize the Builder with + */ + private Builder(ListRoleAssignmentsOptions listRoleAssignmentsOptions) { + this.accountId = listRoleAssignmentsOptions.accountId; + this.acceptLanguage = listRoleAssignmentsOptions.acceptLanguage; + this.templateId = listRoleAssignmentsOptions.templateId; + this.templateVersion = listRoleAssignmentsOptions.templateVersion; + this.limit = listRoleAssignmentsOptions.limit; + this.start = listRoleAssignmentsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListRoleAssignmentsOptions. + * + * @return the new ListRoleAssignmentsOptions instance + */ + public ListRoleAssignmentsOptions build() { + return new ListRoleAssignmentsOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListRoleAssignmentsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListRoleAssignmentsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the templateId. + * + * @param templateId the templateId + * @return the ListRoleAssignmentsOptions builder + */ + public Builder templateId(String templateId) { + this.templateId = templateId; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the ListRoleAssignmentsOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListRoleAssignmentsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListRoleAssignmentsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListRoleAssignmentsOptions() { } + + protected ListRoleAssignmentsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + templateId = builder.templateId; + templateVersion = builder.templateVersion; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListRoleAssignmentsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID in which the role assignment belongs to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the templateId. + * + * Optional template ID. + * + * @return the templateId + */ + public String templateId() { + return templateId; + } + + /** + * Gets the templateVersion. + * + * Optional role template version. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java new file mode 100644 index 00000000000..e22751433e5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listRoleTemplateVersions options. + */ +public class ListRoleTemplateVersionsOptions extends GenericModel { + + /** + * Role template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String roleTemplateId; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListRoleTemplateVersionsOptions instance. + * + * @param listRoleTemplateVersionsOptions the instance to initialize the Builder with + */ + private Builder(ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions) { + this.roleTemplateId = listRoleTemplateVersionsOptions.roleTemplateId; + this.state = listRoleTemplateVersionsOptions.state; + this.limit = listRoleTemplateVersionsOptions.limit; + this.start = listRoleTemplateVersionsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + */ + public Builder(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + } + + /** + * Builds a ListRoleTemplateVersionsOptions. + * + * @return the new ListRoleTemplateVersionsOptions instance + */ + public ListRoleTemplateVersionsOptions build() { + return new ListRoleTemplateVersionsOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the ListRoleTemplateVersionsOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListRoleTemplateVersionsOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListRoleTemplateVersionsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListRoleTemplateVersionsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListRoleTemplateVersionsOptions() { } + + protected ListRoleTemplateVersionsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + roleTemplateId = builder.roleTemplateId; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListRoleTemplateVersionsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * The role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the state. + * + * Role template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java new file mode 100644 index 00000000000..8f889bdce96 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java @@ -0,0 +1,307 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listRoleTemplates options. + */ +public class ListRoleTemplatesOptions extends GenericModel { + + /** + * The role template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String accountId; + protected String acceptLanguage; + protected String name; + protected String roleName; + protected String roleServiceName; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String name; + private String roleName; + private String roleServiceName; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListRoleTemplatesOptions instance. + * + * @param listRoleTemplatesOptions the instance to initialize the Builder with + */ + private Builder(ListRoleTemplatesOptions listRoleTemplatesOptions) { + this.accountId = listRoleTemplatesOptions.accountId; + this.acceptLanguage = listRoleTemplatesOptions.acceptLanguage; + this.name = listRoleTemplatesOptions.name; + this.roleName = listRoleTemplatesOptions.roleName; + this.roleServiceName = listRoleTemplatesOptions.roleServiceName; + this.state = listRoleTemplatesOptions.state; + this.limit = listRoleTemplatesOptions.limit; + this.start = listRoleTemplatesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListRoleTemplatesOptions. + * + * @return the new ListRoleTemplatesOptions instance + */ + public ListRoleTemplatesOptions build() { + return new ListRoleTemplatesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListRoleTemplatesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListRoleTemplatesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ListRoleTemplatesOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the roleName. + * + * @param roleName the roleName + * @return the ListRoleTemplatesOptions builder + */ + public Builder roleName(String roleName) { + this.roleName = roleName; + return this; + } + + /** + * Set the roleServiceName. + * + * @param roleServiceName the roleServiceName + * @return the ListRoleTemplatesOptions builder + */ + public Builder roleServiceName(String roleServiceName) { + this.roleServiceName = roleServiceName; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListRoleTemplatesOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListRoleTemplatesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListRoleTemplatesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListRoleTemplatesOptions() { } + + protected ListRoleTemplatesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + name = builder.name; + roleName = builder.roleName; + roleServiceName = builder.roleServiceName; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListRoleTemplatesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the role templates belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the name. + * + * The role template name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the roleName. + * + * The template role name. + * + * @return the roleName + */ + public String roleName() { + return roleName; + } + + /** + * Gets the roleServiceName. + * + * The template role service name. + * + * @return the roleServiceName + */ + public String roleServiceName() { + return roleServiceName; + } + + /** + * Gets the state. + * + * The role template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java new file mode 100644 index 00000000000..2ca364c53a3 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java @@ -0,0 +1,234 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listRoles options. + */ +public class ListRolesOptions extends GenericModel { + + protected String acceptLanguage; + protected String accountId; + protected String serviceName; + protected String sourceServiceName; + protected String policyType; + protected String serviceGroupId; + + /** + * Builder. + */ + public static class Builder { + private String acceptLanguage; + private String accountId; + private String serviceName; + private String sourceServiceName; + private String policyType; + private String serviceGroupId; + + /** + * Instantiates a new Builder from an existing ListRolesOptions instance. + * + * @param listRolesOptions the instance to initialize the Builder with + */ + private Builder(ListRolesOptions listRolesOptions) { + this.acceptLanguage = listRolesOptions.acceptLanguage; + this.accountId = listRolesOptions.accountId; + this.serviceName = listRolesOptions.serviceName; + this.sourceServiceName = listRolesOptions.sourceServiceName; + this.policyType = listRolesOptions.policyType; + this.serviceGroupId = listRolesOptions.serviceGroupId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ListRolesOptions. + * + * @return the new ListRolesOptions instance + */ + public ListRolesOptions build() { + return new ListRolesOptions(this); + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListRolesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListRolesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the ListRolesOptions builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the sourceServiceName. + * + * @param sourceServiceName the sourceServiceName + * @return the ListRolesOptions builder + */ + public Builder sourceServiceName(String sourceServiceName) { + this.sourceServiceName = sourceServiceName; + return this; + } + + /** + * Set the policyType. + * + * @param policyType the policyType + * @return the ListRolesOptions builder + */ + public Builder policyType(String policyType) { + this.policyType = policyType; + return this; + } + + /** + * Set the serviceGroupId. + * + * @param serviceGroupId the serviceGroupId + * @return the ListRolesOptions builder + */ + public Builder serviceGroupId(String serviceGroupId) { + this.serviceGroupId = serviceGroupId; + return this; + } + } + + protected ListRolesOptions() { } + + protected ListRolesOptions(Builder builder) { + acceptLanguage = builder.acceptLanguage; + accountId = builder.accountId; + serviceName = builder.serviceName; + sourceServiceName = builder.sourceServiceName; + policyType = builder.policyType; + serviceGroupId = builder.serviceGroupId; + } + + /** + * New builder. + * + * @return a ListRolesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the accountId. + * + * Optional account GUID in which the roles belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the serviceName. + * + * Optional name of IAM enabled service. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the sourceServiceName. + * + * Optional name of source IAM enabled service. + * + * @return the sourceServiceName + */ + public String sourceServiceName() { + return sourceServiceName; + } + + /** + * Gets the policyType. + * + * Optional Policy Type. + * + * @return the policyType + */ + public String policyType() { + return policyType; + } + + /** + * Gets the serviceGroupId. + * + * Optional id of service group. + * + * @return the serviceGroupId + */ + public String serviceGroupId() { + return serviceGroupId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java new file mode 100644 index 00000000000..65849c3d9a6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java @@ -0,0 +1,492 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listV2Policies options. + */ +public class ListV2PoliciesOptions extends GenericModel { + + /** + * Optional type of policy. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + /** + * Optional type of service. + */ + public interface ServiceType { + /** service. */ + String SERVICE = "service"; + /** platform_service. */ + String PLATFORM_SERVICE = "platform_service"; + } + + /** + * Include additional data per policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles and translations for all + * relevant fields. + */ + public interface Format { + /** include_last_permit. */ + String INCLUDE_LAST_PERMIT = "include_last_permit"; + /** display. */ + String DISPLAY = "display"; + } + + /** + * The state of the policy. + * * `active` - returns active policies + * * `deleted` - returns non-active policies. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String accountId; + protected String acceptLanguage; + protected String iamId; + protected String accessGroupId; + protected String type; + protected String serviceType; + protected String serviceName; + protected String serviceGroupId; + protected String sort; + protected String format; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String iamId; + private String accessGroupId; + private String type; + private String serviceType; + private String serviceName; + private String serviceGroupId; + private String sort; + private String format; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListV2PoliciesOptions instance. + * + * @param listV2PoliciesOptions the instance to initialize the Builder with + */ + private Builder(ListV2PoliciesOptions listV2PoliciesOptions) { + this.accountId = listV2PoliciesOptions.accountId; + this.acceptLanguage = listV2PoliciesOptions.acceptLanguage; + this.iamId = listV2PoliciesOptions.iamId; + this.accessGroupId = listV2PoliciesOptions.accessGroupId; + this.type = listV2PoliciesOptions.type; + this.serviceType = listV2PoliciesOptions.serviceType; + this.serviceName = listV2PoliciesOptions.serviceName; + this.serviceGroupId = listV2PoliciesOptions.serviceGroupId; + this.sort = listV2PoliciesOptions.sort; + this.format = listV2PoliciesOptions.format; + this.state = listV2PoliciesOptions.state; + this.limit = listV2PoliciesOptions.limit; + this.start = listV2PoliciesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListV2PoliciesOptions. + * + * @return the new ListV2PoliciesOptions instance + */ + public ListV2PoliciesOptions build() { + return new ListV2PoliciesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListV2PoliciesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListV2PoliciesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the iamId. + * + * @param iamId the iamId + * @return the ListV2PoliciesOptions builder + */ + public Builder iamId(String iamId) { + this.iamId = iamId; + return this; + } + + /** + * Set the accessGroupId. + * + * @param accessGroupId the accessGroupId + * @return the ListV2PoliciesOptions builder + */ + public Builder accessGroupId(String accessGroupId) { + this.accessGroupId = accessGroupId; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the ListV2PoliciesOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the serviceType. + * + * @param serviceType the serviceType + * @return the ListV2PoliciesOptions builder + */ + public Builder serviceType(String serviceType) { + this.serviceType = serviceType; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the ListV2PoliciesOptions builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the serviceGroupId. + * + * @param serviceGroupId the serviceGroupId + * @return the ListV2PoliciesOptions builder + */ + public Builder serviceGroupId(String serviceGroupId) { + this.serviceGroupId = serviceGroupId; + return this; + } + + /** + * Set the sort. + * + * @param sort the sort + * @return the ListV2PoliciesOptions builder + */ + public Builder sort(String sort) { + this.sort = sort; + return this; + } + + /** + * Set the format. + * + * @param format the format + * @return the ListV2PoliciesOptions builder + */ + public Builder format(String format) { + this.format = format; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListV2PoliciesOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListV2PoliciesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListV2PoliciesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListV2PoliciesOptions() { } + + protected ListV2PoliciesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + iamId = builder.iamId; + accessGroupId = builder.accessGroupId; + type = builder.type; + serviceType = builder.serviceType; + serviceName = builder.serviceName; + serviceGroupId = builder.serviceGroupId; + sort = builder.sort; + format = builder.format; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListV2PoliciesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID in which the policies belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the iamId. + * + * Optional IAM ID used to identify the subject. + * + * @return the iamId + */ + public String iamId() { + return iamId; + } + + /** + * Gets the accessGroupId. + * + * Optional access group id. + * + * @return the accessGroupId + */ + public String accessGroupId() { + return accessGroupId; + } + + /** + * Gets the type. + * + * Optional type of policy. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the serviceType. + * + * Optional type of service. + * + * @return the serviceType + */ + public String serviceType() { + return serviceType; + } + + /** + * Gets the serviceName. + * + * Optional name of service. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the serviceGroupId. + * + * Optional ID of service group. + * + * @return the serviceGroupId + */ + public String serviceGroupId() { + return serviceGroupId; + } + + /** + * Gets the sort. + * + * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending + * '-' to field, for example, '-last_modified_at'. Note that last permit information is only included when + * 'format=include_last_permit', for example, "format=include_last_permit&sort=last_permit_at" Example fields that + * can be sorted on: + * - 'id' + * - 'type' + * - 'href' + * - 'created_at' + * - 'created_by_id' + * - 'last_modified_at' + * - 'last_modified_by_id' + * - 'state' + * - 'last_permit_at' + * - 'last_permit_frequency'. + * + * @return the sort + */ + public String sort() { + return sort; + } + + /** + * Gets the format. + * + * Include additional data per policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles and translations for all + * relevant fields. + * + * @return the format + */ + public String format() { + return format; + } + + /** + * Gets the state. + * + * The state of the policy. + * * `active` - returns active policies + * * `deleted` - returns non-active policies. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java new file mode 100644 index 00000000000..4d43d84dbba --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java @@ -0,0 +1,126 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Condition that specifies additional conditions or RuleAttribute to grant access. + * + * Classes which extend this class: + * - NestedConditionRuleAttribute + * - NestedConditionRuleWithConditions + */ +public class NestedCondition extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + protected String key; + protected String operator; + protected Object value; + protected List conditions; + + protected NestedCondition() { } + + /** + * Gets the key. + * + * The name of an attribute. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } + + /** + * Gets the conditions. + * + * List of conditions associated with a policy. For example, time-based conditions that grant access over a certain + * time period. + * + * @return the conditions + */ + public List conditions() { + return conditions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java new file mode 100644 index 00000000000..b1d44da3f6b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java @@ -0,0 +1,170 @@ +/* + * (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_policy_management.v1.model; + +/** + * Rule that specifies additional access that is granted (For example, time-based condition). + */ +public class NestedConditionRuleAttribute extends NestedCondition { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing NestedConditionRuleAttribute instance. + * + * @param nestedConditionRuleAttribute the instance to initialize the Builder with + */ + public Builder(NestedCondition nestedConditionRuleAttribute) { + this.key = nestedConditionRuleAttribute.key; + this.operator = nestedConditionRuleAttribute.operator; + this.value = nestedConditionRuleAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a NestedConditionRuleAttribute. + * + * @return the new NestedConditionRuleAttribute instance + */ + public NestedConditionRuleAttribute build() { + return new NestedConditionRuleAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the NestedConditionRuleAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the NestedConditionRuleAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the NestedConditionRuleAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected NestedConditionRuleAttribute() { } + + protected NestedConditionRuleAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a NestedConditionRuleAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java new file mode 100644 index 00000000000..20d0faac795 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java @@ -0,0 +1,139 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * Rule that specifies additional access that is granted (for example, time-based condition) accross multiple + * conditions. + */ +public class NestedConditionRuleWithConditions extends NestedCondition { + + /** + * Operator to evaluate conditions. + */ + public interface Operator { + /** and. */ + String AND = "and"; + /** or. */ + String OR = "or"; + } + + + /** + * Builder. + */ + public static class Builder { + private String operator; + private List conditions; + + /** + * Instantiates a new Builder from an existing NestedConditionRuleWithConditions instance. + * + * @param nestedConditionRuleWithConditions the instance to initialize the Builder with + */ + public Builder(NestedCondition nestedConditionRuleWithConditions) { + this.operator = nestedConditionRuleWithConditions.operator; + this.conditions = nestedConditionRuleWithConditions.conditions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param operator the operator + * @param conditions the conditions + */ + public Builder(String operator, List conditions) { + this.operator = operator; + this.conditions = conditions; + } + + /** + * Builds a NestedConditionRuleWithConditions. + * + * @return the new NestedConditionRuleWithConditions instance + */ + public NestedConditionRuleWithConditions build() { + return new NestedConditionRuleWithConditions(this); + } + + /** + * Adds a new element to conditions. + * + * @param conditions the new element to be added + * @return the NestedConditionRuleWithConditions builder + */ + public Builder addConditions(RuleAttribute conditions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(conditions, + "conditions cannot be null"); + if (this.conditions == null) { + this.conditions = new ArrayList(); + } + this.conditions.add(conditions); + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the NestedConditionRuleWithConditions builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the conditions. + * Existing conditions will be replaced. + * + * @param conditions the conditions + * @return the NestedConditionRuleWithConditions builder + */ + public Builder conditions(List conditions) { + this.conditions = conditions; + return this; + } + } + + protected NestedConditionRuleWithConditions() { } + + protected NestedConditionRuleWithConditions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.conditions, + "conditions cannot be null"); + operator = builder.operator; + conditions = builder.conditions; + } + + /** + * New builder. + * + * @return a NestedConditionRuleWithConditions builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java new file mode 100644 index 00000000000..b0442f902bc --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Details with href linking to the following page of requested collection. + */ +public class Next extends GenericModel { + + protected String href; + protected String start; + + protected Next() { } + + /** + * Gets the href. + * + * The href linking to the page of requested collection. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection. + * + * @return the start + */ + public String getStart() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java new file mode 100644 index 00000000000..8f12053c72e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * PoliciesPager can be used to simplify the use of the "listPolicies" method. + */ +public class PoliciesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListPoliciesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected PoliciesPager() { } + + /** + * Constructs a new PoliciesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listPolicies" method + * @param options the ListPoliciesOptions instance to be used to invoke the "listPolicies" method + */ + public PoliciesPager(IamPolicyManagement client, ListPoliciesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<PolicyTemplateMetaData> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListPoliciesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + PolicyCollection result = client.listPolicies(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getPolicies(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<PolicyTemplateMetaData> containing all results returned by the "listPolicies" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java new file mode 100644 index 00000000000..af852b7cd74 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java @@ -0,0 +1,188 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with a policy. + */ +public class Policy extends GenericModel { + + /** + * The policy state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String id; + protected String type; + protected String description; + protected List subjects; + protected List roles; + protected List resources; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String state; + + protected Policy() { } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the description. + * + * Customer-defined description. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the subjects. + * + * The subjects associated with a policy. + * + * @return the subjects + */ + public List getSubjects() { + return subjects; + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List getRoles() { + return roles; + } + + /** + * Gets the resources. + * + * The resources associated with a policy. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the href. + * + * The href links back to the policy. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the state. + * + * The policy state. + * + * @return the state + */ + public String getState() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java new file mode 100644 index 00000000000..3e566ce7bdf --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Set of properties for the assigned resource. + */ +public class PolicyAssignmentResourcePolicy extends GenericModel { + + @SerializedName("resource_created") + protected AssignmentResourceCreated resourceCreated; + protected String status; + @SerializedName("error_message") + protected AssignmentResourceError errorMessage; + + protected PolicyAssignmentResourcePolicy() { } + + /** + * Gets the resourceCreated. + * + * On success, includes the policy that is assigned. + * + * @return the resourceCreated + */ + public AssignmentResourceCreated getResourceCreated() { + return resourceCreated; + } + + /** + * Gets the status. + * + * policy status. + * + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * Gets the errorMessage. + * + * Body parameters for assignment error. + * + * @return the errorMessage + */ + public AssignmentResourceError getErrorMessage() { + return errorMessage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java new file mode 100644 index 00000000000..ad944536b0d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The policy assignment resources. + */ +public class PolicyAssignmentResources extends GenericModel { + + protected String target; + protected PolicyAssignmentResourcePolicy policy; + + protected PolicyAssignmentResources() { } + + /** + * Gets the target. + * + * Account ID where resources are assigned. + * + * @return the target + */ + public String getTarget() { + return target; + } + + /** + * Gets the policy. + * + * Set of properties for the assigned resource. + * + * @return the policy + */ + public PolicyAssignmentResourcePolicy getPolicy() { + return policy; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java new file mode 100644 index 00000000000..f1ea295713c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java @@ -0,0 +1,193 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the policy template assignment. + */ +public class PolicyAssignmentV1 extends GenericModel { + + /** + * The policy assignment status. + */ + public interface Status { + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** succeeded. */ + String SUCCEEDED = "succeeded"; + /** succeed_with_errors. */ + String SUCCEED_WITH_ERRORS = "succeed_with_errors"; + /** failed. */ + String FAILED = "failed"; + } + + protected AssignmentTargetDetails target; + protected String id; + @SerializedName("account_id") + protected String accountId; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected List resources; + protected PolicyAssignmentV1Subject subject; + protected AssignmentTemplateDetails template; + protected String status; + + protected PolicyAssignmentV1() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the id. + * + * Policy assignment ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the accountId. + * + * The account GUID that the policies assignments belong to. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the href. + * + * The href URL that links to the policies assignments API by policy assignment ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy assignment was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy assignment. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy assignment was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy assignment. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the resources. + * + * Object for each account assigned. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the subject. + * + * Subject details of access type assignment. + * + * @return the subject + */ + public PolicyAssignmentV1Subject getSubject() { + return subject; + } + + /** + * Gets the template. + * + * policy template details. + * + * @return the template + */ + public AssignmentTemplateDetails getTemplate() { + return template; + } + + /** + * Gets the status. + * + * The policy assignment status. + * + * @return the status + */ + public String getStatus() { + return status; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java new file mode 100644 index 00000000000..7331ee5a854 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Policy assignment response. + */ +public class PolicyAssignmentV1Collection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List assignments; + + protected PolicyAssignmentV1Collection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the assignments. + * + * Response of policy assignments. + * + * @return the assignments + */ + public List getAssignments() { + return assignments; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java new file mode 100644 index 00000000000..c05eb90816b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The policy assignment resources. + */ +public class PolicyAssignmentV1Resources extends GenericModel { + + protected AssignmentTargetDetails target; + protected PolicyAssignmentResourcePolicy policy; + + protected PolicyAssignmentV1Resources() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the policy. + * + * Set of properties for the assigned resource. + * + * @return the policy + */ + public PolicyAssignmentResourcePolicy getPolicy() { + return policy; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java new file mode 100644 index 00000000000..58b2cd240ba --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java @@ -0,0 +1,60 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Subject details of access type assignment. + */ +public class PolicyAssignmentV1Subject extends GenericModel { + + /** + * The identity type of the subject of the assignment. + */ + public interface Type { + /** iam_id. */ + String IAM_ID = "iam_id"; + /** access_group_id. */ + String ACCESS_GROUP_ID = "access_group_id"; + } + + protected String id; + protected String type; + + protected PolicyAssignmentV1Subject() { } + + /** + * Gets the id. + * + * The unique identifier of the subject of the assignment. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the type. + * + * The identity type of the subject of the assignment. + * + * @return the type + */ + public String getType() { + return type; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java new file mode 100644 index 00000000000..931769daed5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * PolicyAssignmentsPager can be used to simplify the use of the "listPolicyAssignments" method. + */ +public class PolicyAssignmentsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListPolicyAssignmentsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected PolicyAssignmentsPager() { } + + /** + * Constructs a new PolicyAssignmentsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyAssignments" method + * @param options the ListPolicyAssignmentsOptions instance to be used to invoke the "listPolicyAssignments" method + */ + public PolicyAssignmentsPager(IamPolicyManagement client, ListPolicyAssignmentsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<PolicyTemplateAssignmentItems> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListPolicyAssignmentsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + PolicyTemplateAssignmentCollection result = client.listPolicyAssignments(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getAssignments(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<PolicyTemplateAssignmentItems> containing all results returned by the "listPolicyAssignments" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java new file mode 100644 index 00000000000..25062dd0a52 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of policies. + */ +public class PolicyCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List policies; + + protected PolicyCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the policies. + * + * List of policies. + * + * @return the policies + */ + public List getPolicies() { + return policies; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java new file mode 100644 index 00000000000..4033f2dbc9d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java @@ -0,0 +1,167 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The attributes of the resource. Note that only one resource is allowed in a policy. + */ +public class PolicyResource extends GenericModel { + + protected List attributes; + protected List tags; + + /** + * Builder. + */ + public static class Builder { + private List attributes; + private List tags; + + /** + * Instantiates a new Builder from an existing PolicyResource instance. + * + * @param policyResource the instance to initialize the Builder with + */ + private Builder(PolicyResource policyResource) { + this.attributes = policyResource.attributes; + this.tags = policyResource.tags; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param attributes the attributes + */ + public Builder(List attributes) { + this.attributes = attributes; + } + + /** + * Builds a PolicyResource. + * + * @return the new PolicyResource instance + */ + public PolicyResource build() { + return new PolicyResource(this); + } + + /** + * Adds a new element to attributes. + * + * @param attributes the new element to be added + * @return the PolicyResource builder + */ + public Builder addAttributes(ResourceAttribute attributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, + "attributes cannot be null"); + if (this.attributes == null) { + this.attributes = new ArrayList(); + } + this.attributes.add(attributes); + return this; + } + + /** + * Adds a new element to tags. + * + * @param tags the new element to be added + * @return the PolicyResource builder + */ + public Builder addTags(ResourceTag tags) { + com.ibm.cloud.sdk.core.util.Validator.notNull(tags, + "tags cannot be null"); + if (this.tags == null) { + this.tags = new ArrayList(); + } + this.tags.add(tags); + return this; + } + + /** + * Set the attributes. + * Existing attributes will be replaced. + * + * @param attributes the attributes + * @return the PolicyResource builder + */ + public Builder attributes(List attributes) { + this.attributes = attributes; + return this; + } + + /** + * Set the tags. + * Existing tags will be replaced. + * + * @param tags the tags + * @return the PolicyResource builder + */ + public Builder tags(List tags) { + this.tags = tags; + return this; + } + } + + protected PolicyResource() { } + + protected PolicyResource(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, + "attributes cannot be null"); + attributes = builder.attributes; + tags = builder.tags; + } + + /** + * New builder. + * + * @return a PolicyResource builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the attributes. + * + * List of resource attributes. + * + * @return the attributes + */ + public List attributes() { + return attributes; + } + + /** + * Gets the tags. + * + * List of access management tags. + * + * @return the tags + */ + public List tags() { + return tags; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java new file mode 100644 index 00000000000..7319eabce7b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java @@ -0,0 +1,131 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role associated with a policy. + */ +public class PolicyRole extends GenericModel { + + @SerializedName("role_id") + protected String roleId; + @SerializedName("display_name") + protected String displayName; + protected String description; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + + /** + * Instantiates a new Builder from an existing PolicyRole instance. + * + * @param policyRole the instance to initialize the Builder with + */ + private Builder(PolicyRole policyRole) { + this.roleId = policyRole.roleId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + */ + public Builder(String roleId) { + this.roleId = roleId; + } + + /** + * Builds a PolicyRole. + * + * @return the new PolicyRole instance + */ + public PolicyRole build() { + return new PolicyRole(this); + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the PolicyRole builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + } + + protected PolicyRole() { } + + protected PolicyRole(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleId, + "roleId cannot be null"); + roleId = builder.roleId; + } + + /** + * New builder. + * + * @return a PolicyRole builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } + + /** + * Gets the displayName. + * + * The display name of the role. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String description() { + return description; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java new file mode 100644 index 00000000000..bf1b035a6b7 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java @@ -0,0 +1,124 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The subject attribute values that must match in order for this policy to apply in a permission decision. + */ +public class PolicySubject extends GenericModel { + + protected List attributes; + + /** + * Builder. + */ + public static class Builder { + private List attributes; + + /** + * Instantiates a new Builder from an existing PolicySubject instance. + * + * @param policySubject the instance to initialize the Builder with + */ + private Builder(PolicySubject policySubject) { + this.attributes = policySubject.attributes; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param attributes the attributes + */ + public Builder(List attributes) { + this.attributes = attributes; + } + + /** + * Builds a PolicySubject. + * + * @return the new PolicySubject instance + */ + public PolicySubject build() { + return new PolicySubject(this); + } + + /** + * Adds a new element to attributes. + * + * @param attributes the new element to be added + * @return the PolicySubject builder + */ + public Builder addAttributes(SubjectAttribute attributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, + "attributes cannot be null"); + if (this.attributes == null) { + this.attributes = new ArrayList(); + } + this.attributes.add(attributes); + return this; + } + + /** + * Set the attributes. + * Existing attributes will be replaced. + * + * @param attributes the attributes + * @return the PolicySubject builder + */ + public Builder attributes(List attributes) { + this.attributes = attributes; + return this; + } + } + + protected PolicySubject() { } + + protected PolicySubject(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, + "attributes cannot be null"); + attributes = builder.attributes; + } + + /** + * New builder. + * + * @return a PolicySubject builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the attributes. + * + * List of subject attributes. + * + * @return the attributes + */ + public List attributes() { + return attributes; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java new file mode 100644 index 00000000000..bdffbe98c10 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java @@ -0,0 +1,202 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the policy template. + */ +public class PolicyTemplate extends GenericModel { + + /** + * State of policy template. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String name; + protected String description; + @SerializedName("account_id") + protected String accountId; + protected String version; + protected Boolean committed; + protected TemplatePolicy policy; + protected String state; + protected String id; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + + protected PolicyTemplate() { } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the version. + * + * Template version. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the committed. + * + * Committed status of the template version. + * + * @return the committed + */ + public Boolean isCommitted() { + return committed; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy getPolicy() { + return policy; + } + + /** + * Gets the state. + * + * State of policy template. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the id. + * + * The policy template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the policy templates API by policy template ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy template was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy template. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy template was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy template. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java new file mode 100644 index 00000000000..54727eadf4d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of policies assignments. + */ +public class PolicyTemplateAssignmentCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List assignments; + + protected PolicyTemplateAssignmentCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the assignments. + * + * List of policy assignments. + * + * @return the assignments + */ + public List getAssignments() { + return assignments; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java new file mode 100644 index 00000000000..2c8e82df441 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java @@ -0,0 +1,261 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * PolicyTemplateAssignmentItems. + * + * Classes which extend this class: + * - PolicyTemplateAssignmentItemsPolicyAssignmentV1 + * - PolicyTemplateAssignmentItemsPolicyAssignment + */ +public class PolicyTemplateAssignmentItems extends GenericModel { + + /** + * The policy assignment status. + */ + public interface Status { + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** succeeded. */ + String SUCCEEDED = "succeeded"; + /** succeed_with_errors. */ + String SUCCEED_WITH_ERRORS = "succeed_with_errors"; + /** failed. */ + String FAILED = "failed"; + } + + /** + * Assignment target type. + */ + public interface TargetType { + /** Account. */ + String ACCOUNT = "Account"; + /** AccountGroup. */ + String ACCOUNTGROUP = "AccountGroup"; + /** Enterprise. */ + String ENTERPRISE = "Enterprise"; + } + + protected AssignmentTargetDetails target; + protected String id; + @SerializedName("account_id") + protected String accountId; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected List resources; + protected PolicyAssignmentV1Subject subject; + protected AssignmentTemplateDetails template; + protected String status; + @SerializedName("template_id") + protected String templateId; + @SerializedName("template_version") + protected String templateVersion; + @SerializedName("assignment_id") + protected String assignmentId; + @SerializedName("target_type") + protected String targetType; + + protected PolicyTemplateAssignmentItems() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the id. + * + * Policy assignment ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the accountId. + * + * The account GUID that the policies assignments belong to. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the href. + * + * The href URL that links to the policies assignments API by policy assignment ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy assignment was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy assignment. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy assignment was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy assignment. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the resources. + * + * Object for each account assigned. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the subject. + * + * Subject details of access type assignment. + * + * @return the subject + */ + public PolicyAssignmentV1Subject getSubject() { + return subject; + } + + /** + * Gets the template. + * + * policy template details. + * + * @return the template + */ + public AssignmentTemplateDetails getTemplate() { + return template; + } + + /** + * Gets the status. + * + * The policy assignment status. + * + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * Gets the templateId. + * + * policy template ID. + * + * @return the templateId + */ + public String getTemplateId() { + return templateId; + } + + /** + * Gets the templateVersion. + * + * policy template version. + * + * @return the templateVersion + */ + public String getTemplateVersion() { + return templateVersion; + } + + /** + * Gets the assignmentId. + * + * Passed in value to correlate with other assignments. + * + * @return the assignmentId + */ + public String getAssignmentId() { + return assignmentId; + } + + /** + * Gets the targetType. + * + * Assignment target type. + * + * @return the targetType + */ + public String getTargetType() { + return targetType; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java new file mode 100644 index 00000000000..ec9c32e5bdd --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +/** + * The set of properties associated with the policy template assignment. + */ +public class PolicyTemplateAssignmentItemsPolicyAssignment extends PolicyTemplateAssignmentItems { + + /** + * Assignment target type. + */ + public interface TargetType { + /** Account. */ + String ACCOUNT = "Account"; + /** AccountGroup. */ + String ACCOUNTGROUP = "AccountGroup"; + /** Enterprise. */ + String ENTERPRISE = "Enterprise"; + } + + /** + * The policy assignment status. + */ + public interface Status { + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** succeeded. */ + String SUCCEEDED = "succeeded"; + /** succeed_with_errors. */ + String SUCCEED_WITH_ERRORS = "succeed_with_errors"; + /** failed. */ + String FAILED = "failed"; + } + + + protected PolicyTemplateAssignmentItemsPolicyAssignment() { } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java new file mode 100644 index 00000000000..4cebdbb17b1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.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_policy_management.v1.model; + +/** + * The set of properties associated with the policy template assignment. + */ +public class PolicyTemplateAssignmentItemsPolicyAssignmentV1 extends PolicyTemplateAssignmentItems { + + /** + * The policy assignment status. + */ + public interface Status { + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** succeeded. */ + String SUCCEEDED = "succeeded"; + /** succeed_with_errors. */ + String SUCCEED_WITH_ERRORS = "succeed_with_errors"; + /** failed. */ + String FAILED = "failed"; + } + + + protected PolicyTemplateAssignmentItemsPolicyAssignmentV1() { } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java new file mode 100644 index 00000000000..2a262c584b5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java @@ -0,0 +1,90 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of policy Templates. + */ +public class PolicyTemplateCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + @SerializedName("policy_templates") + protected List policyTemplates; + + protected PolicyTemplateCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the policyTemplates. + * + * List of policy templates. + * + * @return the policyTemplates + */ + public List getPolicyTemplates() { + return policyTemplates; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java new file mode 100644 index 00000000000..5a2876dfe28 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java @@ -0,0 +1,214 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the policy template. + */ +public class PolicyTemplateLimitData extends GenericModel { + + /** + * State of policy template. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String name; + protected String description; + @SerializedName("account_id") + protected String accountId; + protected String version; + protected Boolean committed; + protected TemplatePolicy policy; + protected String state; + protected String id; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected TemplateCountData counts; + + protected PolicyTemplateLimitData() { } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the version. + * + * Template version. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the committed. + * + * Committed status of the template version. + * + * @return the committed + */ + public Boolean isCommitted() { + return committed; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy getPolicy() { + return policy; + } + + /** + * Gets the state. + * + * State of policy template. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the id. + * + * The policy template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the policy templates API by policy template ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy template was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy template. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy template was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy template. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the counts. + * + * policy template count details. + * + * @return the counts + */ + public TemplateCountData getCounts() { + return counts; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java new file mode 100644 index 00000000000..07effc5b3ad --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java @@ -0,0 +1,201 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with a policy. + */ +public class PolicyTemplateMetaData extends GenericModel { + + /** + * The policy state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String id; + protected String type; + protected String description; + protected List subjects; + protected List roles; + protected List resources; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String state; + protected TemplateMetadata template; + + protected PolicyTemplateMetaData() { } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the description. + * + * Customer-defined description. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the subjects. + * + * The subjects associated with a policy. + * + * @return the subjects + */ + public List getSubjects() { + return subjects; + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List getRoles() { + return roles; + } + + /** + * Gets the resources. + * + * The resources associated with a policy. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the href. + * + * The href links back to the policy. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the state. + * + * The policy state. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the template. + * + * The details of the IAM template that was used to create an enterprise-managed policy in your account. When + * returned, this indicates that the policy is created from and managed by a template in the root enterprise account. + * + * @return the template + */ + public TemplateMetadata getTemplate() { + return template; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java new file mode 100644 index 00000000000..a4f95bc6562 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of versions for a specific policy template. + */ +public class PolicyTemplateVersionsCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List versions; + + protected PolicyTemplateVersionsCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the versions. + * + * List of policy templates versions. + * + * @return the versions + */ + public List getVersions() { + return versions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java new file mode 100644 index 00000000000..f6a2496cf91 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * PolicyTemplateVersionsPager can be used to simplify the use of the "listPolicyTemplateVersions" method. + */ +public class PolicyTemplateVersionsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListPolicyTemplateVersionsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected PolicyTemplateVersionsPager() { } + + /** + * Constructs a new PolicyTemplateVersionsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyTemplateVersions" method + * @param options the ListPolicyTemplateVersionsOptions instance to be used to invoke the "listPolicyTemplateVersions" method + */ + public PolicyTemplateVersionsPager(IamPolicyManagement client, ListPolicyTemplateVersionsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<PolicyTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListPolicyTemplateVersionsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + PolicyTemplateVersionsCollection result = client.listPolicyTemplateVersions(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getVersions(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<PolicyTemplate> containing all results returned by the "listPolicyTemplateVersions" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java new file mode 100644 index 00000000000..eba6e6c8fad --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * PolicyTemplatesPager can be used to simplify the use of the "listPolicyTemplates" method. + */ +public class PolicyTemplatesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListPolicyTemplatesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected PolicyTemplatesPager() { } + + /** + * Constructs a new PolicyTemplatesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyTemplates" method + * @param options the ListPolicyTemplatesOptions instance to be used to invoke the "listPolicyTemplates" method + */ + public PolicyTemplatesPager(IamPolicyManagement client, ListPolicyTemplatesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<PolicyTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListPolicyTemplatesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + PolicyTemplateCollection result = client.listPolicyTemplates(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getPolicyTemplates(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<PolicyTemplate> containing all results returned by the "listPolicyTemplates" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java new file mode 100644 index 00000000000..2656f3fb790 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Details with linking href to previous page of requested collection. + */ +public class Previous extends GenericModel { + + protected String href; + protected String start; + + protected Previous() { } + + /** + * Gets the href. + * + * The href linking to the page of requested collection. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection. + * + * @return the start + */ + public String getStart() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java new file mode 100644 index 00000000000..151a77e8cb9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java @@ -0,0 +1,273 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replaceActionControlTemplate options. + */ +public class ReplaceActionControlTemplateOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String version; + protected String ifMatch; + protected String name; + protected String description; + protected TemplateActionControl actionControl; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String version; + private String ifMatch; + private String name; + private String description; + private TemplateActionControl actionControl; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing ReplaceActionControlTemplateOptions instance. + * + * @param replaceActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(ReplaceActionControlTemplateOptions replaceActionControlTemplateOptions) { + this.actionControlTemplateId = replaceActionControlTemplateOptions.actionControlTemplateId; + this.version = replaceActionControlTemplateOptions.version; + this.ifMatch = replaceActionControlTemplateOptions.ifMatch; + this.name = replaceActionControlTemplateOptions.name; + this.description = replaceActionControlTemplateOptions.description; + this.actionControl = replaceActionControlTemplateOptions.actionControl; + this.committed = replaceActionControlTemplateOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + * @param version the version + * @param ifMatch the ifMatch + */ + public Builder(String actionControlTemplateId, String version, String ifMatch) { + this.actionControlTemplateId = actionControlTemplateId; + this.version = version; + this.ifMatch = ifMatch; + } + + /** + * Builds a ReplaceActionControlTemplateOptions. + * + * @return the new ReplaceActionControlTemplateOptions instance + */ + public ReplaceActionControlTemplateOptions build() { + return new ReplaceActionControlTemplateOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actionControl. + * + * @param actionControl the actionControl + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder actionControl(TemplateActionControl actionControl) { + this.actionControl = actionControl; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected ReplaceActionControlTemplateOptions() { } + + protected ReplaceActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + actionControlTemplateId = builder.actionControlTemplateId; + version = builder.version; + ifMatch = builder.ifMatch; + name = builder.name; + description = builder.description; + actionControl = builder.actionControl; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a ReplaceActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating an action control template version must match the Etag value of the existing + * action control template version. The Etag can be retrieved using the GET + * /v1/action_control_templates/{template_id}/versions/{version} API and looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will + * change the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the action control template. This is shown to users in the enterprise account. Use this to describe + * the purpose or context of the action control for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actionControl. + * + * The action control properties that are created in an action resource when the template is assigned. + * + * @return the actionControl + */ + public TemplateActionControl actionControl() { + return actionControl; + } + + /** + * Gets the committed. + * + * Committed status of the template version. If committed is set to true, then the template version can no longer be + * updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java new file mode 100644 index 00000000000..80cbe9e4c79 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java @@ -0,0 +1,335 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replacePolicy options. + */ +public class ReplacePolicyOptions extends GenericModel { + + protected String policyId; + protected String ifMatch; + protected String type; + protected List subjects; + protected List roles; + protected List resources; + protected String description; + + /** + * Builder. + */ + public static class Builder { + private String policyId; + private String ifMatch; + private String type; + private List subjects; + private List roles; + private List resources; + private String description; + + /** + * Instantiates a new Builder from an existing ReplacePolicyOptions instance. + * + * @param replacePolicyOptions the instance to initialize the Builder with + */ + private Builder(ReplacePolicyOptions replacePolicyOptions) { + this.policyId = replacePolicyOptions.policyId; + this.ifMatch = replacePolicyOptions.ifMatch; + this.type = replacePolicyOptions.type; + this.subjects = replacePolicyOptions.subjects; + this.roles = replacePolicyOptions.roles; + this.resources = replacePolicyOptions.resources; + this.description = replacePolicyOptions.description; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyId the policyId + * @param ifMatch the ifMatch + * @param type the type + * @param subjects the subjects + * @param roles the roles + * @param resources the resources + */ + public Builder(String policyId, String ifMatch, String type, List subjects, List roles, List resources) { + this.policyId = policyId; + this.ifMatch = ifMatch; + this.type = type; + this.subjects = subjects; + this.roles = roles; + this.resources = resources; + } + + /** + * Builds a ReplacePolicyOptions. + * + * @return the new ReplacePolicyOptions instance + */ + public ReplacePolicyOptions build() { + return new ReplacePolicyOptions(this); + } + + /** + * Adds a new element to subjects. + * + * @param subjects the new element to be added + * @return the ReplacePolicyOptions builder + */ + public Builder addSubjects(PolicySubject subjects) { + com.ibm.cloud.sdk.core.util.Validator.notNull(subjects, + "subjects cannot be null"); + if (this.subjects == null) { + this.subjects = new ArrayList(); + } + this.subjects.add(subjects); + return this; + } + + /** + * Adds a new element to roles. + * + * @param roles the new element to be added + * @return the ReplacePolicyOptions builder + */ + public Builder addRoles(PolicyRole roles) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roles, + "roles cannot be null"); + if (this.roles == null) { + this.roles = new ArrayList(); + } + this.roles.add(roles); + return this; + } + + /** + * Adds a new element to resources. + * + * @param resources the new element to be added + * @return the ReplacePolicyOptions builder + */ + public Builder addResources(PolicyResource resources) { + com.ibm.cloud.sdk.core.util.Validator.notNull(resources, + "resources cannot be null"); + if (this.resources == null) { + this.resources = new ArrayList(); + } + this.resources.add(resources); + return this; + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the ReplacePolicyOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplacePolicyOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the ReplacePolicyOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the subjects. + * Existing subjects will be replaced. + * + * @param subjects the subjects + * @return the ReplacePolicyOptions builder + */ + public Builder subjects(List subjects) { + this.subjects = subjects; + return this; + } + + /** + * Set the roles. + * Existing roles will be replaced. + * + * @param roles the roles + * @return the ReplacePolicyOptions builder + */ + public Builder roles(List roles) { + this.roles = roles; + return this; + } + + /** + * Set the resources. + * Existing resources will be replaced. + * + * @param resources the resources + * @return the ReplacePolicyOptions builder + */ + public Builder resources(List resources) { + this.resources = resources; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplacePolicyOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + } + + protected ReplacePolicyOptions() { } + + protected ReplacePolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId 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.type, + "type cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subjects, + "subjects cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, + "roles cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resources, + "resources cannot be null"); + policyId = builder.policyId; + ifMatch = builder.ifMatch; + type = builder.type; + subjects = builder.subjects; + roles = builder.roles; + resources = builder.resources; + description = builder.description; + } + + /** + * New builder. + * + * @return a ReplacePolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyId. + * + * The policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be + * retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the subjects. + * + * The subjects associated with a policy. + * + * @return the subjects + */ + public List subjects() { + return subjects; + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List roles() { + return roles; + } + + /** + * Gets the resources. + * + * The resources associated with a policy. + * + * @return the resources + */ + public List resources() { + return resources; + } + + /** + * Gets the description. + * + * Customer-defined description. + * + * @return the description + */ + public String description() { + return description; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java new file mode 100644 index 00000000000..5a55c4898e5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java @@ -0,0 +1,276 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replacePolicyTemplate options. + */ +public class ReplacePolicyTemplateOptions extends GenericModel { + + protected String policyTemplateId; + protected String version; + protected String ifMatch; + protected TemplatePolicy policy; + protected String name; + protected String description; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String version; + private String ifMatch; + private TemplatePolicy policy; + private String name; + private String description; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing ReplacePolicyTemplateOptions instance. + * + * @param replacePolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(ReplacePolicyTemplateOptions replacePolicyTemplateOptions) { + this.policyTemplateId = replacePolicyTemplateOptions.policyTemplateId; + this.version = replacePolicyTemplateOptions.version; + this.ifMatch = replacePolicyTemplateOptions.ifMatch; + this.policy = replacePolicyTemplateOptions.policy; + this.name = replacePolicyTemplateOptions.name; + this.description = replacePolicyTemplateOptions.description; + this.committed = replacePolicyTemplateOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param version the version + * @param ifMatch the ifMatch + * @param policy the policy + */ + public Builder(String policyTemplateId, String version, String ifMatch, TemplatePolicy policy) { + this.policyTemplateId = policyTemplateId; + this.version = version; + this.ifMatch = ifMatch; + this.policy = policy; + } + + /** + * Builds a ReplacePolicyTemplateOptions. + * + * @return the new ReplacePolicyTemplateOptions instance + */ + public ReplacePolicyTemplateOptions build() { + return new ReplacePolicyTemplateOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the policy. + * + * @param policy the policy + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder policy(TemplatePolicy policy) { + this.policy = policy; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected ReplacePolicyTemplateOptions() { } + + protected ReplacePolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version 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.policy, + "policy cannot be null"); + policyTemplateId = builder.policyTemplateId; + version = builder.version; + ifMatch = builder.ifMatch; + policy = builder.policy; + name = builder.name; + description = builder.description; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a ReplacePolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the version. + * + * The policy template version. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy template version and must match the Etag value of the existing policy + * template version. The Etag can be retrieved using the GET + * /v1/policy_templates/{policy_template_id}/versions/{version} API and looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy policy() { + return policy; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template version. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java new file mode 100644 index 00000000000..fc4b536103d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java @@ -0,0 +1,255 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replaceRole options. + */ +public class ReplaceRoleOptions extends GenericModel { + + protected String roleId; + protected String ifMatch; + protected String displayName; + protected List actions; + protected String description; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + private String ifMatch; + private String displayName; + private List actions; + private String description; + + /** + * Instantiates a new Builder from an existing ReplaceRoleOptions instance. + * + * @param replaceRoleOptions the instance to initialize the Builder with + */ + private Builder(ReplaceRoleOptions replaceRoleOptions) { + this.roleId = replaceRoleOptions.roleId; + this.ifMatch = replaceRoleOptions.ifMatch; + this.displayName = replaceRoleOptions.displayName; + this.actions = replaceRoleOptions.actions; + this.description = replaceRoleOptions.description; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + * @param ifMatch the ifMatch + * @param displayName the displayName + * @param actions the actions + */ + public Builder(String roleId, String ifMatch, String displayName, List actions) { + this.roleId = roleId; + this.ifMatch = ifMatch; + this.displayName = displayName; + this.actions = actions; + } + + /** + * Builds a ReplaceRoleOptions. + * + * @return the new ReplaceRoleOptions instance + */ + public ReplaceRoleOptions build() { + return new ReplaceRoleOptions(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the ReplaceRoleOptions builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the ReplaceRoleOptions builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplaceRoleOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the ReplaceRoleOptions builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the ReplaceRoleOptions builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplaceRoleOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the role. + * + * @param role the role + * @return the ReplaceRoleOptions builder + */ + public Builder role(Role role) { + this.displayName = role.displayName(); + this.actions = role.actions(); + this.description = role.description(); + return this; + } + } + + protected ReplaceRoleOptions() { } + + protected ReplaceRoleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, + "roleId 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.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + roleId = builder.roleId; + ifMatch = builder.ifMatch; + displayName = builder.displayName; + actions = builder.actions; + description = builder.description; + } + + /** + * New builder. + * + * @return a ReplaceRoleOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role ID. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a role and must match the ETag value of the existing role. The Etag can be + * retrieved using the GET /v2/roles/{role_id} API and looking at the ETag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List actions() { + return actions; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String description() { + return description; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java new file mode 100644 index 00000000000..9a69b13326c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java @@ -0,0 +1,273 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replaceRoleTemplate options. + */ +public class ReplaceRoleTemplateOptions extends GenericModel { + + protected String roleTemplateId; + protected String version; + protected String ifMatch; + protected String name; + protected String description; + protected TemplateRole role; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String version; + private String ifMatch; + private String name; + private String description; + private TemplateRole role; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing ReplaceRoleTemplateOptions instance. + * + * @param replaceRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(ReplaceRoleTemplateOptions replaceRoleTemplateOptions) { + this.roleTemplateId = replaceRoleTemplateOptions.roleTemplateId; + this.version = replaceRoleTemplateOptions.version; + this.ifMatch = replaceRoleTemplateOptions.ifMatch; + this.name = replaceRoleTemplateOptions.name; + this.description = replaceRoleTemplateOptions.description; + this.role = replaceRoleTemplateOptions.role; + this.committed = replaceRoleTemplateOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + * @param version the version + * @param ifMatch the ifMatch + */ + public Builder(String roleTemplateId, String version, String ifMatch) { + this.roleTemplateId = roleTemplateId; + this.version = version; + this.ifMatch = ifMatch; + } + + /** + * Builds a ReplaceRoleTemplateOptions. + * + * @return the new ReplaceRoleTemplateOptions instance + */ + public ReplaceRoleTemplateOptions build() { + return new ReplaceRoleTemplateOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the role. + * + * @param role the role + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder role(TemplateRole role) { + this.role = role; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected ReplaceRoleTemplateOptions() { } + + protected ReplaceRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + roleTemplateId = builder.roleTemplateId; + version = builder.version; + ifMatch = builder.ifMatch; + name = builder.name; + description = builder.description; + role = builder.role; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a ReplaceRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the version. + * + * Role template version. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a role template version must match the Etag value of the existing role template + * version. The Etag can be retrieved using the GET /v1/role_templates/{template_id}/versions/{version} API and + * looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will + * change the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the role template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the role for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the role. + * + * The role properties that are created in an action resource when the template is assigned. + * + * @return the role + */ + public TemplateRole role() { + return role; + } + + /** + * Gets the committed. + * + * Committed status of the template version. If committed is set to true, then the template version can no longer be + * updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java new file mode 100644 index 00000000000..960f4782635 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java @@ -0,0 +1,336 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replaceV2Policy options. + */ +public class ReplaceV2PolicyOptions extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + protected String id; + protected String ifMatch; + protected Control control; + protected String type; + protected String description; + protected V2PolicySubject subject; + protected V2PolicyResource resource; + protected String pattern; + protected V2PolicyRule rule; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String ifMatch; + private Control control; + private String type; + private String description; + private V2PolicySubject subject; + private V2PolicyResource resource; + private String pattern; + private V2PolicyRule rule; + + /** + * Instantiates a new Builder from an existing ReplaceV2PolicyOptions instance. + * + * @param replaceV2PolicyOptions the instance to initialize the Builder with + */ + private Builder(ReplaceV2PolicyOptions replaceV2PolicyOptions) { + this.id = replaceV2PolicyOptions.id; + this.ifMatch = replaceV2PolicyOptions.ifMatch; + this.control = replaceV2PolicyOptions.control; + this.type = replaceV2PolicyOptions.type; + this.description = replaceV2PolicyOptions.description; + this.subject = replaceV2PolicyOptions.subject; + this.resource = replaceV2PolicyOptions.resource; + this.pattern = replaceV2PolicyOptions.pattern; + this.rule = replaceV2PolicyOptions.rule; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + * @param ifMatch the ifMatch + * @param control the control + * @param type the type + */ + public Builder(String id, String ifMatch, Control control, String type) { + this.id = id; + this.ifMatch = ifMatch; + this.control = control; + this.type = type; + } + + /** + * Builds a ReplaceV2PolicyOptions. + * + * @return the new ReplaceV2PolicyOptions instance + */ + public ReplaceV2PolicyOptions build() { + return new ReplaceV2PolicyOptions(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the ReplaceV2PolicyOptions builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplaceV2PolicyOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the control. + * + * @param control the control + * @return the ReplaceV2PolicyOptions builder + */ + public Builder control(Control control) { + this.control = control; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the ReplaceV2PolicyOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplaceV2PolicyOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the subject. + * + * @param subject the subject + * @return the ReplaceV2PolicyOptions builder + */ + public Builder subject(V2PolicySubject subject) { + this.subject = subject; + return this; + } + + /** + * Set the resource. + * + * @param resource the resource + * @return the ReplaceV2PolicyOptions builder + */ + public Builder resource(V2PolicyResource resource) { + this.resource = resource; + return this; + } + + /** + * Set the pattern. + * + * @param pattern the pattern + * @return the ReplaceV2PolicyOptions builder + */ + public Builder pattern(String pattern) { + this.pattern = pattern; + return this; + } + + /** + * Set the rule. + * + * @param rule the rule + * @return the ReplaceV2PolicyOptions builder + */ + public Builder rule(V2PolicyRule rule) { + this.rule = rule; + return this; + } + } + + protected ReplaceV2PolicyOptions() { } + + protected ReplaceV2PolicyOptions(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.control, + "control cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + id = builder.id; + ifMatch = builder.ifMatch; + control = builder.control; + type = builder.type; + description = builder.description; + subject = builder.subject; + resource = builder.resource; + pattern = builder.pattern; + rule = builder.rule; + } + + /** + * New builder. + * + * @return a ReplaceV2PolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be + * retrieved using the GET /v2/policies/{id} API and looking at the ETag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the control. + * + * Specifies the type of access that is granted by the policy. + * + * @return the control + */ + public Control control() { + return control; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject subject() { + return subject; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource resource() { + return resource; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String pattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule rule() { + return rule; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java new file mode 100644 index 00000000000..3a8b7e87b9e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * An attribute associated with a resource. + */ +public class ResourceAttribute extends GenericModel { + + protected String name; + protected String value; + protected String operator; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String value; + private String operator; + + /** + * Instantiates a new Builder from an existing ResourceAttribute instance. + * + * @param resourceAttribute the instance to initialize the Builder with + */ + private Builder(ResourceAttribute resourceAttribute) { + this.name = resourceAttribute.name; + this.value = resourceAttribute.value; + this.operator = resourceAttribute.operator; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param value the value + */ + public Builder(String name, String value) { + this.name = name; + this.value = value; + } + + /** + * Builds a ResourceAttribute. + * + * @return the new ResourceAttribute instance + */ + public ResourceAttribute build() { + return new ResourceAttribute(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the ResourceAttribute builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the ResourceAttribute builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the ResourceAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + } + + protected ResourceAttribute() { } + + protected ResourceAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + name = builder.name; + value = builder.value; + operator = builder.operator; + } + + /** + * New builder. + * + * @return a ResourceAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The name of an attribute. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the value. + * + * The value of an attribute. + * + * @return the value + */ + public String value() { + return value; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java new file mode 100644 index 00000000000..7da4cffee56 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A tag associated with a resource. + */ +public class ResourceTag extends GenericModel { + + protected String name; + protected String value; + protected String operator; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String value; + private String operator; + + /** + * Instantiates a new Builder from an existing ResourceTag instance. + * + * @param resourceTag the instance to initialize the Builder with + */ + private Builder(ResourceTag resourceTag) { + this.name = resourceTag.name; + this.value = resourceTag.value; + this.operator = resourceTag.operator; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param value the value + */ + public Builder(String name, String value) { + this.name = name; + this.value = value; + } + + /** + * Builds a ResourceTag. + * + * @return the new ResourceTag instance + */ + public ResourceTag build() { + return new ResourceTag(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the ResourceTag builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the ResourceTag builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the ResourceTag builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + } + + protected ResourceTag() { } + + protected ResourceTag(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + name = builder.name; + value = builder.value; + operator = builder.operator; + } + + /** + * New builder. + * + * @return a ResourceTag builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The name of an access management tag. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the value. + * + * The value of an access management tag. + * + * @return the value + */ + public String value() { + return value; + } + + /** + * Gets the operator. + * + * The operator of an access management tag. + * + * @return the operator + */ + public String operator() { + return operator; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java new file mode 100644 index 00000000000..24b99c9bd08 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java @@ -0,0 +1,196 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role resource. + */ +public class Role extends GenericModel { + + @SerializedName("display_name") + protected String displayName; + protected String description; + protected List actions; + protected String crn; + + /** + * Builder. + */ + public static class Builder { + private String displayName; + private String description; + private List actions; + + /** + * Instantiates a new Builder from an existing Role instance. + * + * @param role the instance to initialize the Builder with + */ + private Builder(Role role) { + this.displayName = role.displayName; + this.description = role.description; + this.actions = role.actions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param displayName the displayName + * @param actions the actions + */ + public Builder(String displayName, List actions) { + this.displayName = displayName; + this.actions = actions; + } + + /** + * Builds a Role. + * + * @return the new Role instance + */ + public Role build() { + return new Role(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the Role builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the Role builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the Role builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the Role builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + } + + protected Role() { } + + protected Role(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + displayName = builder.displayName; + description = builder.description; + actions = builder.actions; + } + + /** + * New builder. + * + * @return a Role builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List actions() { + return actions; + } + + /** + * Gets the crn. + * + * The role Cloud Resource Name (CRN). Example CRN: + * 'crn:v1:ibmcloud:public:iam-access-management::a/exampleAccountId::customRole:ExampleRoleName'. + * + * @return the crn + */ + public String crn() { + return crn; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java new file mode 100644 index 00000000000..9169fc88572 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java @@ -0,0 +1,64 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * An action that can be performed by the policy subject when assigned a role. + */ +public class RoleAction extends GenericModel { + + protected String id; + @SerializedName("display_name") + protected String displayName; + protected String description; + + protected RoleAction() { } + + /** + * Gets the id. + * + * Unique identifier for action with structure service.resource.action. For example, cbr.rule.read. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the displayName. + * + * Services defined display name for action. + * + * @return the displayName + */ + public String getDisplayName() { + return displayName; + } + + /** + * Gets the description. + * + * Service defined description for action. + * + * @return the description + */ + public String getDescription() { + return description; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java new file mode 100644 index 00000000000..23bb4b65c6f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java @@ -0,0 +1,207 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the assigned role template. + */ +public class RoleAssignment extends GenericModel { + + /** + * The current operation of the role assignment. + */ + public interface Operation { + /** create. */ + String CREATE = "create"; + /** apply. */ + String APPLY = "apply"; + /** update. */ + String UPDATE = "update"; + /** remove. */ + String REMOVE = "remove"; + } + + /** + * The role assignment status. + */ + public interface Status { + /** accepted. */ + String ACCEPTED = "accepted"; + /** failure. */ + String FAILURE = "failure"; + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** superseded. */ + String SUPERSEDED = "superseded"; + } + + protected String id; + @SerializedName("account_id") + protected String accountId; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String operation; + protected List resources; + protected RoleAssignmentTemplate template; + protected AssignmentTargetDetails target; + protected String status; + + protected RoleAssignment() { } + + /** + * Gets the id. + * + * Action control assignment ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the accountId. + * + * The account GUID that the role assignments belong to. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the href. + * + * The href URL that links to the role assignments API by role assignment ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the role assignment was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the role assignment. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the role assignment was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the role assignment. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the operation. + * + * The current operation of the role assignment. + * + * @return the operation + */ + public String getOperation() { + return operation; + } + + /** + * Gets the resources. + * + * Resources created when role template is assigned. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the template. + * + * The role template id and version that will be assigned. + * + * @return the template + */ + public RoleAssignmentTemplate getTemplate() { + return template; + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the status. + * + * The role assignment status. + * + * @return the status + */ + public String getStatus() { + return status; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java new file mode 100644 index 00000000000..658ac5b8c99 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of role assignments. + */ +public class RoleAssignmentCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List assignments; + + protected RoleAssignmentCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the assignments. + * + * List of role assignments. + * + * @return the assignments + */ + public List getAssignments() { + return assignments; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java new file mode 100644 index 00000000000..60d7a02d604 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The role assignment resources and target where the template is assigned. + */ +public class RoleAssignmentResource extends GenericModel { + + protected AssignmentTargetDetails target; + protected RoleAssignmentResourceRole role; + + protected RoleAssignmentResource() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the role. + * + * Set of properties of the assigned resource or error message if assignment failed. + * + * @return the role + */ + public RoleAssignmentResourceRole getRole() { + return role; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java new file mode 100644 index 00000000000..9ea359d63fb --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * On success, it includes the role assigned. + */ +public class RoleAssignmentResourceCreated extends GenericModel { + + protected String id; + + protected RoleAssignmentResourceCreated() { } + + /** + * Gets the id. + * + * role id. + * + * @return the id + */ + public String getId() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java new file mode 100644 index 00000000000..22d40bdaef4 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Set of properties of the assigned resource or error message if assignment failed. + */ +public class RoleAssignmentResourceRole extends GenericModel { + + @SerializedName("resource_created") + protected RoleAssignmentResourceCreated resourceCreated; + @SerializedName("error_message") + protected AssignmentResourceError errorMessage; + + protected RoleAssignmentResourceRole() { } + + /** + * Gets the resourceCreated. + * + * On success, it includes the role assigned. + * + * @return the resourceCreated + */ + public RoleAssignmentResourceCreated getResourceCreated() { + return resourceCreated; + } + + /** + * Gets the errorMessage. + * + * Body parameters for assignment error. + * + * @return the errorMessage + */ + public AssignmentResourceError getErrorMessage() { + return errorMessage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java new file mode 100644 index 00000000000..3524b91f4d5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The role template id and version that will be assigned. + */ +public class RoleAssignmentTemplate extends GenericModel { + + protected String id; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String version; + + /** + * Instantiates a new Builder from an existing RoleAssignmentTemplate instance. + * + * @param roleAssignmentTemplate the instance to initialize the Builder with + */ + private Builder(RoleAssignmentTemplate roleAssignmentTemplate) { + this.id = roleAssignmentTemplate.id; + this.version = roleAssignmentTemplate.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + * @param version the version + */ + public Builder(String id, String version) { + this.id = id; + this.version = version; + } + + /** + * Builds a RoleAssignmentTemplate. + * + * @return the new RoleAssignmentTemplate instance + */ + public RoleAssignmentTemplate build() { + return new RoleAssignmentTemplate(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the RoleAssignmentTemplate builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the RoleAssignmentTemplate builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected RoleAssignmentTemplate() { } + + protected RoleAssignmentTemplate(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, + "id cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + id = builder.id; + version = builder.version; + } + + /** + * New builder. + * + * @return a RoleAssignmentTemplate builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * Action control template ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java new file mode 100644 index 00000000000..16296a82e40 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * RoleAssignmentsPager can be used to simplify the use of the "listRoleAssignments" method. + */ +public class RoleAssignmentsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListRoleAssignmentsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected RoleAssignmentsPager() { } + + /** + * Constructs a new RoleAssignmentsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listRoleAssignments" method + * @param options the ListRoleAssignmentsOptions instance to be used to invoke the "listRoleAssignments" method + */ + public RoleAssignmentsPager(IamPolicyManagement client, ListRoleAssignmentsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<RoleAssignment> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListRoleAssignmentsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + RoleAssignmentCollection result = client.listRoleAssignments(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getAssignments(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<RoleAssignment> containing all results returned by the "listRoleAssignments" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java new file mode 100644 index 00000000000..282730a2dfc --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java @@ -0,0 +1,68 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of roles returned by the 'list roles' operation. + */ +public class RoleCollection extends GenericModel { + + @SerializedName("custom_roles") + protected List customRoles; + @SerializedName("service_roles") + protected List serviceRoles; + @SerializedName("system_roles") + protected List systemRoles; + + protected RoleCollection() { } + + /** + * Gets the customRoles. + * + * List of custom roles. + * + * @return the customRoles + */ + public List getCustomRoles() { + return customRoles; + } + + /** + * Gets the serviceRoles. + * + * List of service roles. + * + * @return the serviceRoles + */ + public List getServiceRoles() { + return serviceRoles; + } + + /** + * Gets the systemRoles. + * + * List of system roles. + * + * @return the systemRoles + */ + public List getSystemRoles() { + return systemRoles; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java new file mode 100644 index 00000000000..663d0f7f1d0 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java @@ -0,0 +1,202 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the role template. + */ +public class RoleTemplate extends GenericModel { + + /** + * State of role template. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String name; + protected String description; + @SerializedName("account_id") + protected String accountId; + protected Boolean committed; + protected RoleTemplatePrototypeRole role; + protected String id; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String version; + protected String state; + + protected RoleTemplate() { } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Description of the role template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the role for enterprise users managing IAM templates. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the committed. + * + * Committed status of the template. If committed is set to true, then the template version can no longer be updated. + * + * @return the committed + */ + public Boolean isCommitted() { + return committed; + } + + /** + * Gets the role. + * + * The role properties that are created in an action resource when the template is assigned. + * + * @return the role + */ + public RoleTemplatePrototypeRole getRole() { + return role; + } + + /** + * Gets the id. + * + * The role template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the role templates API by role template ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the role template was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the role template. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the role template was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the role template. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the version. + * + * The version number of the template used to identify different versions of same template. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the state. + * + * State of role template. + * + * @return the state + */ + public String getState() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java new file mode 100644 index 00000000000..22a739b4a58 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java @@ -0,0 +1,90 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of role templates. + */ +public class RoleTemplateCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + @SerializedName("role_templates") + protected List roleTemplates; + + protected RoleTemplateCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the roleTemplates. + * + * List of role templates. + * + * @return the roleTemplates + */ + public List getRoleTemplates() { + return roleTemplates; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java new file mode 100644 index 00000000000..43197620689 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java @@ -0,0 +1,239 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The role properties that are created in an action resource when the template is assigned. + */ +public class RoleTemplatePrototypeRole extends GenericModel { + + protected String name; + @SerializedName("display_name") + protected String displayName; + @SerializedName("service_name") + protected String serviceName; + protected String description; + protected List actions; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String displayName; + private String serviceName; + private String description; + private List actions; + + /** + * Instantiates a new Builder from an existing RoleTemplatePrototypeRole instance. + * + * @param roleTemplatePrototypeRole the instance to initialize the Builder with + */ + private Builder(RoleTemplatePrototypeRole roleTemplatePrototypeRole) { + this.name = roleTemplatePrototypeRole.name; + this.displayName = roleTemplatePrototypeRole.displayName; + this.serviceName = roleTemplatePrototypeRole.serviceName; + this.description = roleTemplatePrototypeRole.description; + this.actions = roleTemplatePrototypeRole.actions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param displayName the displayName + * @param actions the actions + */ + public Builder(String name, String displayName, List actions) { + this.name = name; + this.displayName = displayName; + this.actions = actions; + } + + /** + * Builds a RoleTemplatePrototypeRole. + * + * @return the new RoleTemplatePrototypeRole instance + */ + public RoleTemplatePrototypeRole build() { + return new RoleTemplatePrototypeRole(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the RoleTemplatePrototypeRole builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the RoleTemplatePrototypeRole builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the RoleTemplatePrototypeRole builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the RoleTemplatePrototypeRole builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the RoleTemplatePrototypeRole builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the RoleTemplatePrototypeRole builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + } + + protected RoleTemplatePrototypeRole() { } + + protected RoleTemplatePrototypeRole(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + name = builder.name; + displayName = builder.displayName; + serviceName = builder.serviceName; + description = builder.description; + actions = builder.actions; + } + + /** + * New builder. + * + * @return a RoleTemplatePrototypeRole builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the serviceName. + * + * The service name that the role refers. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the description. + * + * Description of the role. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. + * + * @return the actions + */ + public List actions() { + return actions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java new file mode 100644 index 00000000000..673ff7f9750 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role template reference associated with a policy template. + */ +public class RoleTemplateReferencesItem extends GenericModel { + + protected String id; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String version; + + /** + * Instantiates a new Builder from an existing RoleTemplateReferencesItem instance. + * + * @param roleTemplateReferencesItem the instance to initialize the Builder with + */ + private Builder(RoleTemplateReferencesItem roleTemplateReferencesItem) { + this.id = roleTemplateReferencesItem.id; + this.version = roleTemplateReferencesItem.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + * @param version the version + */ + public Builder(String id, String version) { + this.id = id; + this.version = version; + } + + /** + * Builds a RoleTemplateReferencesItem. + * + * @return the new RoleTemplateReferencesItem instance + */ + public RoleTemplateReferencesItem build() { + return new RoleTemplateReferencesItem(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the RoleTemplateReferencesItem builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the RoleTemplateReferencesItem builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected RoleTemplateReferencesItem() { } + + protected RoleTemplateReferencesItem(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, + "id cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + id = builder.id; + version = builder.version; + } + + /** + * New builder. + * + * @return a RoleTemplateReferencesItem builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The role template ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the version. + * + * Role template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java new file mode 100644 index 00000000000..a983208afe3 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of versions for a specific role template. + */ +public class RoleTemplateVersionsCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List versions; + + protected RoleTemplateVersionsCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the versions. + * + * List of role templates versions. + * + * @return the versions + */ + public List getVersions() { + return versions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java new file mode 100644 index 00000000000..7af200cd72f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * RoleTemplateVersionsPager can be used to simplify the use of the "listRoleTemplateVersions" method. + */ +public class RoleTemplateVersionsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListRoleTemplateVersionsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected RoleTemplateVersionsPager() { } + + /** + * Constructs a new RoleTemplateVersionsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listRoleTemplateVersions" method + * @param options the ListRoleTemplateVersionsOptions instance to be used to invoke the "listRoleTemplateVersions" method + */ + public RoleTemplateVersionsPager(IamPolicyManagement client, ListRoleTemplateVersionsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<RoleTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListRoleTemplateVersionsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + RoleTemplateVersionsCollection result = client.listRoleTemplateVersions(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getVersions(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<RoleTemplate> containing all results returned by the "listRoleTemplateVersions" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java new file mode 100644 index 00000000000..3654e0757ba --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * RoleTemplatesPager can be used to simplify the use of the "listRoleTemplates" method. + */ +public class RoleTemplatesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListRoleTemplatesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected RoleTemplatesPager() { } + + /** + * Constructs a new RoleTemplatesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listRoleTemplates" method + * @param options the ListRoleTemplatesOptions instance to be used to invoke the "listRoleTemplates" method + */ + public RoleTemplatesPager(IamPolicyManagement client, ListRoleTemplatesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<RoleTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListRoleTemplatesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + RoleTemplateCollection result = client.listRoleTemplates(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getRoleTemplates(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<RoleTemplate> containing all results returned by the "listRoleTemplates" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java new file mode 100644 index 00000000000..03b6ff75eb1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java @@ -0,0 +1,106 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role associated with a policy. + */ +public class Roles extends GenericModel { + + @SerializedName("role_id") + protected String roleId; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + + /** + * Instantiates a new Builder from an existing Roles instance. + * + * @param roles the instance to initialize the Builder with + */ + private Builder(Roles roles) { + this.roleId = roles.roleId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + */ + public Builder(String roleId) { + this.roleId = roleId; + } + + /** + * Builds a Roles. + * + * @return the new Roles instance + */ + public Roles build() { + return new Roles(this); + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the Roles builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + } + + protected Roles() { } + + protected Roles(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleId, + "roleId cannot be null"); + roleId = builder.roleId; + } + + /** + * New builder. + * + * @return a Roles builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java new file mode 100644 index 00000000000..fbf66d53ae1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java @@ -0,0 +1,209 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Rule that specifies additional access that is granted (For example, time-based condition). + */ +public class RuleAttribute extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + protected String key; + protected String operator; + protected Object value; + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing RuleAttribute instance. + * + * @param ruleAttribute the instance to initialize the Builder with + */ + private Builder(RuleAttribute ruleAttribute) { + this.key = ruleAttribute.key; + this.operator = ruleAttribute.operator; + this.value = ruleAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a RuleAttribute. + * + * @return the new RuleAttribute instance + */ + public RuleAttribute build() { + return new RuleAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the RuleAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the RuleAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the RuleAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected RuleAttribute() { } + + protected RuleAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a RuleAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the key. + * + * The name of an attribute. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java new file mode 100644 index 00000000000..d7e54e112c5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * An attribute associated with a subject. + */ +public class SubjectAttribute extends GenericModel { + + protected String name; + protected String value; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String value; + + /** + * Instantiates a new Builder from an existing SubjectAttribute instance. + * + * @param subjectAttribute the instance to initialize the Builder with + */ + private Builder(SubjectAttribute subjectAttribute) { + this.name = subjectAttribute.name; + this.value = subjectAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param value the value + */ + public Builder(String name, String value) { + this.name = name; + this.value = value; + } + + /** + * Builds a SubjectAttribute. + * + * @return the new SubjectAttribute instance + */ + public SubjectAttribute build() { + return new SubjectAttribute(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the SubjectAttribute builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the SubjectAttribute builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + } + + protected SubjectAttribute() { } + + protected SubjectAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + name = builder.name; + value = builder.value; + } + + /** + * New builder. + * + * @return a SubjectAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The name of an attribute. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the value. + * + * The value of an attribute. + * + * @return the value + */ + public String value() { + return value; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java new file mode 100644 index 00000000000..62f4bd77f87 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java @@ -0,0 +1,182 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The action control properties that are created in an action resource when the template is assigned. + */ +public class TemplateActionControl extends GenericModel { + + @SerializedName("service_name") + protected String serviceName; + protected String description; + protected List actions; + + /** + * Builder. + */ + public static class Builder { + private String serviceName; + private String description; + private List actions; + + /** + * Instantiates a new Builder from an existing TemplateActionControl instance. + * + * @param templateActionControl the instance to initialize the Builder with + */ + private Builder(TemplateActionControl templateActionControl) { + this.serviceName = templateActionControl.serviceName; + this.description = templateActionControl.description; + this.actions = templateActionControl.actions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param serviceName the serviceName + * @param actions the actions + */ + public Builder(String serviceName, List actions) { + this.serviceName = serviceName; + this.actions = actions; + } + + /** + * Builds a TemplateActionControl. + * + * @return the new TemplateActionControl instance + */ + public TemplateActionControl build() { + return new TemplateActionControl(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the TemplateActionControl builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the TemplateActionControl builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the TemplateActionControl builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the TemplateActionControl builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + } + + protected TemplateActionControl() { } + + protected TemplateActionControl(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, + "serviceName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + serviceName = builder.serviceName; + description = builder.description; + actions = builder.actions; + } + + /** + * New builder. + * + * @return a TemplateActionControl builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the serviceName. + * + * The service name that the action control refers. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the description. + * + * Description of the action control. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actions. + * + * List of actions to control access. + * + * @return the actions + */ + public List actions() { + return actions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java new file mode 100644 index 00000000000..c74a77d9b6d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Specifies the type of access that is granted by the policy. + */ +public class TemplateControl extends GenericModel { + + protected TemplateGrant grant; + + /** + * Builder. + */ + public static class Builder { + private TemplateGrant grant; + + /** + * Instantiates a new Builder from an existing TemplateControl instance. + * + * @param templateControl the instance to initialize the Builder with + */ + private Builder(TemplateControl templateControl) { + this.grant = templateControl.grant; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param grant the grant + */ + public Builder(TemplateGrant grant) { + this.grant = grant; + } + + /** + * Builds a TemplateControl. + * + * @return the new TemplateControl instance + */ + public TemplateControl build() { + return new TemplateControl(this); + } + + /** + * Set the grant. + * + * @param grant the grant + * @return the TemplateControl builder + */ + public Builder grant(TemplateGrant grant) { + this.grant = grant; + return this; + } + } + + protected TemplateControl() { } + + protected TemplateControl(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.grant, + "grant cannot be null"); + grant = builder.grant; + } + + /** + * New builder. + * + * @return a TemplateControl builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the grant. + * + * Permission is granted by the policy. + * + * @return the grant + */ + public TemplateGrant grant() { + return grant; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java new file mode 100644 index 00000000000..edb134e1270 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * policy template count details. + */ +public class TemplateCountData extends GenericModel { + + protected LimitData template; + protected LimitData version; + + protected TemplateCountData() { } + + /** + * Gets the template. + * + * policy template current and limit details with in an account. + * + * @return the template + */ + public LimitData getTemplate() { + return template; + } + + /** + * Gets the version. + * + * policy template current and limit details with in an account. + * + * @return the version + */ + public LimitData getVersion() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java new file mode 100644 index 00000000000..fd0daff9665 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java @@ -0,0 +1,58 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Permission is granted by the policy. + * + * Classes which extend this class: + * - TemplateGrantRoles + * - TemplateGrantRoleReferences + */ +public class TemplateGrant extends GenericModel { + + protected List roles; + @SerializedName("role_template_references") + protected List roleTemplateReferences; + + protected TemplateGrant() { } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List roles() { + return roles; + } + + /** + * Gets the roleTemplateReferences. + * + * A set of role template reference IDs granted by the policy. + * + * @return the roleTemplateReferences + */ + public List roleTemplateReferences() { + return roleTemplateReferences; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java new file mode 100644 index 00000000000..248eb121b72 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java @@ -0,0 +1,110 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * TemplateGrantRoleReferences. + */ +public class TemplateGrantRoleReferences extends TemplateGrant { + + + /** + * Builder. + */ + public static class Builder { + private List roleTemplateReferences; + + /** + * Instantiates a new Builder from an existing TemplateGrantRoleReferences instance. + * + * @param templateGrantRoleReferences the instance to initialize the Builder with + */ + public Builder(TemplateGrant templateGrantRoleReferences) { + this.roleTemplateReferences = templateGrantRoleReferences.roleTemplateReferences; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateReferences the roleTemplateReferences + */ + public Builder(List roleTemplateReferences) { + this.roleTemplateReferences = roleTemplateReferences; + } + + /** + * Builds a TemplateGrantRoleReferences. + * + * @return the new TemplateGrantRoleReferences instance + */ + public TemplateGrantRoleReferences build() { + return new TemplateGrantRoleReferences(this); + } + + /** + * Adds a new element to roleTemplateReferences. + * + * @param roleTemplateReferences the new element to be added + * @return the TemplateGrantRoleReferences builder + */ + public Builder addRoleTemplateReferences(RoleTemplateReferencesItem roleTemplateReferences) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roleTemplateReferences, + "roleTemplateReferences cannot be null"); + if (this.roleTemplateReferences == null) { + this.roleTemplateReferences = new ArrayList(); + } + this.roleTemplateReferences.add(roleTemplateReferences); + return this; + } + + /** + * Set the roleTemplateReferences. + * Existing roleTemplateReferences will be replaced. + * + * @param roleTemplateReferences the roleTemplateReferences + * @return the TemplateGrantRoleReferences builder + */ + public Builder roleTemplateReferences(List roleTemplateReferences) { + this.roleTemplateReferences = roleTemplateReferences; + return this; + } + } + + protected TemplateGrantRoleReferences() { } + + protected TemplateGrantRoleReferences(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleTemplateReferences, + "roleTemplateReferences cannot be null"); + roleTemplateReferences = builder.roleTemplateReferences; + } + + /** + * New builder. + * + * @return a TemplateGrantRoleReferences builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java new file mode 100644 index 00000000000..6524b3645eb --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java @@ -0,0 +1,110 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * TemplateGrantRoles. + */ +public class TemplateGrantRoles extends TemplateGrant { + + + /** + * Builder. + */ + public static class Builder { + private List roles; + + /** + * Instantiates a new Builder from an existing TemplateGrantRoles instance. + * + * @param templateGrantRoles the instance to initialize the Builder with + */ + public Builder(TemplateGrant templateGrantRoles) { + this.roles = templateGrantRoles.roles; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roles the roles + */ + public Builder(List roles) { + this.roles = roles; + } + + /** + * Builds a TemplateGrantRoles. + * + * @return the new TemplateGrantRoles instance + */ + public TemplateGrantRoles build() { + return new TemplateGrantRoles(this); + } + + /** + * Adds a new element to roles. + * + * @param roles the new element to be added + * @return the TemplateGrantRoles builder + */ + public Builder addRoles(Roles roles) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roles, + "roles cannot be null"); + if (this.roles == null) { + this.roles = new ArrayList(); + } + this.roles.add(roles); + return this; + } + + /** + * Set the roles. + * Existing roles will be replaced. + * + * @param roles the roles + * @return the TemplateGrantRoles builder + */ + public Builder roles(List roles) { + this.roles = roles; + return this; + } + } + + protected TemplateGrantRoles() { } + + protected TemplateGrantRoles(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, + "roles cannot be null"); + roles = builder.roles; + } + + /** + * New builder. + * + * @return a TemplateGrantRoles builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java new file mode 100644 index 00000000000..41f112312cd --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java @@ -0,0 +1,91 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The details of the IAM template that was used to create an enterprise-managed policy in your account. When returned, + * this indicates that the policy is created from and managed by a template in the root enterprise account. + */ +public class TemplateMetadata extends GenericModel { + + protected String id; + protected String version; + @SerializedName("assignment_id") + protected String assignmentId; + @SerializedName("root_id") + protected String rootId; + @SerializedName("root_version") + protected String rootVersion; + + protected TemplateMetadata() { } + + /** + * Gets the id. + * + * The policy template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the version. + * + * Template version. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the assignmentId. + * + * Policy assignment ID. + * + * @return the assignmentId + */ + public String getAssignmentId() { + return assignmentId; + } + + /** + * Gets the rootId. + * + * Orchestrator template ID. + * + * @return the rootId + */ + public String getRootId() { + return rootId; + } + + /** + * Gets the rootVersion. + * + * Orchestrator template version. + * + * @return the rootVersion + */ + public String getRootVersion() { + return rootVersion; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java new file mode 100644 index 00000000000..496b2e70e40 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java @@ -0,0 +1,272 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the template's policy object. + */ +public class TemplatePolicy extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + protected String type; + protected String description; + protected V2PolicyResource resource; + protected V2PolicySubject subject; + protected String pattern; + protected V2PolicyRule rule; + protected TemplateControl control; + + /** + * Builder. + */ + public static class Builder { + private String type; + private String description; + private V2PolicyResource resource; + private V2PolicySubject subject; + private String pattern; + private V2PolicyRule rule; + private TemplateControl control; + + /** + * Instantiates a new Builder from an existing TemplatePolicy instance. + * + * @param templatePolicy the instance to initialize the Builder with + */ + private Builder(TemplatePolicy templatePolicy) { + this.type = templatePolicy.type; + this.description = templatePolicy.description; + this.resource = templatePolicy.resource; + this.subject = templatePolicy.subject; + this.pattern = templatePolicy.pattern; + this.rule = templatePolicy.rule; + this.control = templatePolicy.control; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param type the type + */ + public Builder(String type) { + this.type = type; + } + + /** + * Builds a TemplatePolicy. + * + * @return the new TemplatePolicy instance + */ + public TemplatePolicy build() { + return new TemplatePolicy(this); + } + + /** + * Set the type. + * + * @param type the type + * @return the TemplatePolicy builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the TemplatePolicy builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the resource. + * + * @param resource the resource + * @return the TemplatePolicy builder + */ + public Builder resource(V2PolicyResource resource) { + this.resource = resource; + return this; + } + + /** + * Set the subject. + * + * @param subject the subject + * @return the TemplatePolicy builder + */ + public Builder subject(V2PolicySubject subject) { + this.subject = subject; + return this; + } + + /** + * Set the pattern. + * + * @param pattern the pattern + * @return the TemplatePolicy builder + */ + public Builder pattern(String pattern) { + this.pattern = pattern; + return this; + } + + /** + * Set the rule. + * + * @param rule the rule + * @return the TemplatePolicy builder + */ + public Builder rule(V2PolicyRule rule) { + this.rule = rule; + return this; + } + + /** + * Set the control. + * + * @param control the control + * @return the TemplatePolicy builder + */ + public Builder control(TemplateControl control) { + this.control = control; + return this; + } + } + + protected TemplatePolicy() { } + + protected TemplatePolicy(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + type = builder.type; + description = builder.description; + resource = builder.resource; + subject = builder.subject; + pattern = builder.pattern; + rule = builder.rule; + control = builder.control; + } + + /** + * New builder. + * + * @return a TemplatePolicy builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. This is shown in child accounts when an access group or trusted profile template uses + * the policy template to assign access. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource resource() { + return resource; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject subject() { + return subject; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String pattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule rule() { + return rule; + } + + /** + * Gets the control. + * + * Specifies the type of access that is granted by the policy. + * + * @return the control + */ + public TemplateControl control() { + return control; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java new file mode 100644 index 00000000000..b76beb3bddb --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java @@ -0,0 +1,209 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The role properties that are created in an action resource when the template is assigned. + */ +public class TemplateRole extends GenericModel { + + @SerializedName("display_name") + protected String displayName; + @SerializedName("service_name") + protected String serviceName; + protected String description; + protected List actions; + + /** + * Builder. + */ + public static class Builder { + private String displayName; + private String serviceName; + private String description; + private List actions; + + /** + * Instantiates a new Builder from an existing TemplateRole instance. + * + * @param templateRole the instance to initialize the Builder with + */ + private Builder(TemplateRole templateRole) { + this.displayName = templateRole.displayName; + this.serviceName = templateRole.serviceName; + this.description = templateRole.description; + this.actions = templateRole.actions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param displayName the displayName + * @param actions the actions + */ + public Builder(String displayName, List actions) { + this.displayName = displayName; + this.actions = actions; + } + + /** + * Builds a TemplateRole. + * + * @return the new TemplateRole instance + */ + public TemplateRole build() { + return new TemplateRole(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the TemplateRole builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the TemplateRole builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the TemplateRole builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the TemplateRole builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the TemplateRole builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + } + + protected TemplateRole() { } + + protected TemplateRole(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + displayName = builder.displayName; + serviceName = builder.serviceName; + description = builder.description; + actions = builder.actions; + } + + /** + * New builder. + * + * @return a TemplateRole builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the serviceName. + * + * The service name that the role refers. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the description. + * + * Description of the role. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. + * + * @return the actions + */ + public List actions() { + return actions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java new file mode 100644 index 00000000000..caf2f737b55 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java @@ -0,0 +1,166 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updateActionControlAssignment options. + */ +public class UpdateActionControlAssignmentOptions extends GenericModel { + + protected String assignmentId; + protected String ifMatch; + protected String templateVersion; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + private String ifMatch; + private String templateVersion; + + /** + * Instantiates a new Builder from an existing UpdateActionControlAssignmentOptions instance. + * + * @param updateActionControlAssignmentOptions the instance to initialize the Builder with + */ + private Builder(UpdateActionControlAssignmentOptions updateActionControlAssignmentOptions) { + this.assignmentId = updateActionControlAssignmentOptions.assignmentId; + this.ifMatch = updateActionControlAssignmentOptions.ifMatch; + this.templateVersion = updateActionControlAssignmentOptions.templateVersion; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + * @param ifMatch the ifMatch + * @param templateVersion the templateVersion + */ + public Builder(String assignmentId, String ifMatch, String templateVersion) { + this.assignmentId = assignmentId; + this.ifMatch = ifMatch; + this.templateVersion = templateVersion; + } + + /** + * Builds a UpdateActionControlAssignmentOptions. + * + * @return the new UpdateActionControlAssignmentOptions instance + */ + public UpdateActionControlAssignmentOptions build() { + return new UpdateActionControlAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the UpdateActionControlAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdateActionControlAssignmentOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the UpdateActionControlAssignmentOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + } + + protected UpdateActionControlAssignmentOptions() { } + + protected UpdateActionControlAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId 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.templateVersion, + "templateVersion cannot be null"); + assignmentId = builder.assignmentId; + ifMatch = builder.ifMatch; + templateVersion = builder.templateVersion; + } + + /** + * New builder. + * + * @return a UpdateActionControlAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Action control template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating an action control assignment and must match the Etag value of the existing action + * control assignment. The Etag can be retrieved using the GET /v1/action_control_assignments/{assignment_id} API and + * looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the templateVersion. + * + * The version number of the template used to identify different versions of same template. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java new file mode 100644 index 00000000000..869eb357802 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java @@ -0,0 +1,196 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updatePolicyAssignment options. + */ +public class UpdatePolicyAssignmentOptions extends GenericModel { + + protected String assignmentId; + protected String version; + protected String ifMatch; + protected String templateVersion; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + private String version; + private String ifMatch; + private String templateVersion; + + /** + * Instantiates a new Builder from an existing UpdatePolicyAssignmentOptions instance. + * + * @param updatePolicyAssignmentOptions the instance to initialize the Builder with + */ + private Builder(UpdatePolicyAssignmentOptions updatePolicyAssignmentOptions) { + this.assignmentId = updatePolicyAssignmentOptions.assignmentId; + this.version = updatePolicyAssignmentOptions.version; + this.ifMatch = updatePolicyAssignmentOptions.ifMatch; + this.templateVersion = updatePolicyAssignmentOptions.templateVersion; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + * @param version the version + * @param ifMatch the ifMatch + * @param templateVersion the templateVersion + */ + public Builder(String assignmentId, String version, String ifMatch, String templateVersion) { + this.assignmentId = assignmentId; + this.version = version; + this.ifMatch = ifMatch; + this.templateVersion = templateVersion; + } + + /** + * Builds a UpdatePolicyAssignmentOptions. + * + * @return the new UpdatePolicyAssignmentOptions instance + */ + public UpdatePolicyAssignmentOptions build() { + return new UpdatePolicyAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the UpdatePolicyAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the UpdatePolicyAssignmentOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdatePolicyAssignmentOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the UpdatePolicyAssignmentOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + } + + protected UpdatePolicyAssignmentOptions() { } + + protected UpdatePolicyAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templateVersion, + "templateVersion cannot be null"); + assignmentId = builder.assignmentId; + version = builder.version; + ifMatch = builder.ifMatch; + templateVersion = builder.templateVersion; + } + + /** + * New builder. + * + * @return a UpdatePolicyAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * The policy template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } + + /** + * Gets the version. + * + * specify version of response body format. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy assignment and must match the Etag value of the existing policy + * assignment. The Etag can be retrieved using the GET /v1/policy_assignments/{assignment_id} API and looking at the + * Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the templateVersion. + * + * The policy template version to update to. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java new file mode 100644 index 00000000000..a28b357641f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java @@ -0,0 +1,171 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updatePolicyState options. + */ +public class UpdatePolicyStateOptions extends GenericModel { + + /** + * The policy state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String policyId; + protected String ifMatch; + protected String state; + + /** + * Builder. + */ + public static class Builder { + private String policyId; + private String ifMatch; + private String state; + + /** + * Instantiates a new Builder from an existing UpdatePolicyStateOptions instance. + * + * @param updatePolicyStateOptions the instance to initialize the Builder with + */ + private Builder(UpdatePolicyStateOptions updatePolicyStateOptions) { + this.policyId = updatePolicyStateOptions.policyId; + this.ifMatch = updatePolicyStateOptions.ifMatch; + this.state = updatePolicyStateOptions.state; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyId the policyId + * @param ifMatch the ifMatch + */ + public Builder(String policyId, String ifMatch) { + this.policyId = policyId; + this.ifMatch = ifMatch; + } + + /** + * Builds a UpdatePolicyStateOptions. + * + * @return the new UpdatePolicyStateOptions instance + */ + public UpdatePolicyStateOptions build() { + return new UpdatePolicyStateOptions(this); + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the UpdatePolicyStateOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdatePolicyStateOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the UpdatePolicyStateOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + } + + protected UpdatePolicyStateOptions() { } + + protected UpdatePolicyStateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + policyId = builder.policyId; + ifMatch = builder.ifMatch; + state = builder.state; + } + + /** + * New builder. + * + * @return a UpdatePolicyStateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyId. + * + * The policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be + * retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the state. + * + * The policy state. + * + * @return the state + */ + public String state() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java new file mode 100644 index 00000000000..f10cba5fe93 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java @@ -0,0 +1,166 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updateRoleAssignment options. + */ +public class UpdateRoleAssignmentOptions extends GenericModel { + + protected String assignmentId; + protected String ifMatch; + protected String templateVersion; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + private String ifMatch; + private String templateVersion; + + /** + * Instantiates a new Builder from an existing UpdateRoleAssignmentOptions instance. + * + * @param updateRoleAssignmentOptions the instance to initialize the Builder with + */ + private Builder(UpdateRoleAssignmentOptions updateRoleAssignmentOptions) { + this.assignmentId = updateRoleAssignmentOptions.assignmentId; + this.ifMatch = updateRoleAssignmentOptions.ifMatch; + this.templateVersion = updateRoleAssignmentOptions.templateVersion; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + * @param ifMatch the ifMatch + * @param templateVersion the templateVersion + */ + public Builder(String assignmentId, String ifMatch, String templateVersion) { + this.assignmentId = assignmentId; + this.ifMatch = ifMatch; + this.templateVersion = templateVersion; + } + + /** + * Builds a UpdateRoleAssignmentOptions. + * + * @return the new UpdateRoleAssignmentOptions instance + */ + public UpdateRoleAssignmentOptions build() { + return new UpdateRoleAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the UpdateRoleAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdateRoleAssignmentOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the UpdateRoleAssignmentOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + } + + protected UpdateRoleAssignmentOptions() { } + + protected UpdateRoleAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId 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.templateVersion, + "templateVersion cannot be null"); + assignmentId = builder.assignmentId; + ifMatch = builder.ifMatch; + templateVersion = builder.templateVersion; + } + + /** + * New builder. + * + * @return a UpdateRoleAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Role template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a role assignment and must match the Etag value of the existing role assignment. + * The Etag can be retrieved using the GET /v1/role_assignments/{assignment_id} API and looking at the Etag response + * header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the templateVersion. + * + * The version number of the template used to identify different versions of same template. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java new file mode 100644 index 00000000000..3d9dbb43fb3 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java @@ -0,0 +1,199 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updateSettings options. + */ +public class UpdateSettingsOptions extends GenericModel { + + protected String accountId; + protected String ifMatch; + protected ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String ifMatch; + private ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing UpdateSettingsOptions instance. + * + * @param updateSettingsOptions the instance to initialize the Builder with + */ + private Builder(UpdateSettingsOptions updateSettingsOptions) { + this.accountId = updateSettingsOptions.accountId; + this.ifMatch = updateSettingsOptions.ifMatch; + this.externalAccountIdentityInteraction = updateSettingsOptions.externalAccountIdentityInteraction; + this.acceptLanguage = updateSettingsOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + * @param ifMatch the ifMatch + */ + public Builder(String accountId, String ifMatch) { + this.accountId = accountId; + this.ifMatch = ifMatch; + } + + /** + * Builds a UpdateSettingsOptions. + * + * @return the new UpdateSettingsOptions instance + */ + public UpdateSettingsOptions build() { + return new UpdateSettingsOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the UpdateSettingsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdateSettingsOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the externalAccountIdentityInteraction. + * + * @param externalAccountIdentityInteraction the externalAccountIdentityInteraction + * @return the UpdateSettingsOptions builder + */ + public Builder externalAccountIdentityInteraction(ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction) { + this.externalAccountIdentityInteraction = externalAccountIdentityInteraction; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the UpdateSettingsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected UpdateSettingsOptions() { } + + protected UpdateSettingsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.accountId, + "accountId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + accountId = builder.accountId; + ifMatch = builder.ifMatch; + externalAccountIdentityInteraction = builder.externalAccountIdentityInteraction; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a UpdateSettingsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the settings belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating Access Management Account Settings and must match the Etag value of the existing + * Access Management Account Settings. The Etag can be retrieved using the GET + * /v1/accounts/{account_id}/settings/access_management API and looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the externalAccountIdentityInteraction. + * + * Update to how external accounts can interact in relation to the requested account. + * + * @return the externalAccountIdentityInteraction + */ + public ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction() { + return externalAccountIdentityInteraction; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java new file mode 100644 index 00000000000..fdae9e28c12 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * V2PoliciesPager can be used to simplify the use of the "listV2Policies" method. + */ +public class V2PoliciesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListV2PoliciesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected V2PoliciesPager() { } + + /** + * Constructs a new V2PoliciesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listV2Policies" method + * @param options the ListV2PoliciesOptions instance to be used to invoke the "listV2Policies" method + */ + public V2PoliciesPager(IamPolicyManagement client, ListV2PoliciesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<V2PolicyTemplateMetaData> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListV2PoliciesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + V2PolicyCollection result = client.listV2Policies(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getPolicies(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<V2PolicyTemplateMetaData> containing all results returned by the "listV2Policies" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java new file mode 100644 index 00000000000..842a354b7b1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java @@ -0,0 +1,247 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the policy. + */ +public class V2Policy extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + /** + * The policy state, either 'deleted' or 'active'. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String type; + protected String description; + protected V2PolicySubject subject; + protected V2PolicyResource resource; + protected String pattern; + protected V2PolicyRule rule; + protected String id; + protected String href; + protected ControlResponse control; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String state; + @SerializedName("last_permit_at") + protected String lastPermitAt; + @SerializedName("last_permit_frequency") + protected Long lastPermitFrequency; + + protected V2Policy() { } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject getSubject() { + return subject; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource getResource() { + return resource; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String getPattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule getRule() { + return rule; + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the policies API by policy ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the control. + * + * @return the control + */ + public ControlResponse getControl() { + return control; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the state. + * + * The policy state, either 'deleted' or 'active'. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the lastPermitAt. + * + * The optional last permit time of policy, when passing query parameter format=include_last_permit. + * + * @return the lastPermitAt + */ + public String getLastPermitAt() { + return lastPermitAt; + } + + /** + * Gets the lastPermitFrequency. + * + * The optional count of times that policy has provided a permit, when passing query parameter + * format=include_last_permit. + * + * @return the lastPermitFrequency + */ + public Long getLastPermitFrequency() { + return lastPermitFrequency; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java new file mode 100644 index 00000000000..d392025f8d8 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of policies. + */ +public class V2PolicyCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List policies; + + protected V2PolicyCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the policies. + * + * List of policies. + * + * @return the policies + */ + public List getPolicies() { + return policies; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java new file mode 100644 index 00000000000..caf8dd522a9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java @@ -0,0 +1,167 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The resource attributes to which the policy grants access. + */ +public class V2PolicyResource extends GenericModel { + + protected List attributes; + protected List tags; + + /** + * Builder. + */ + public static class Builder { + private List attributes; + private List tags; + + /** + * Instantiates a new Builder from an existing V2PolicyResource instance. + * + * @param v2PolicyResource the instance to initialize the Builder with + */ + private Builder(V2PolicyResource v2PolicyResource) { + this.attributes = v2PolicyResource.attributes; + this.tags = v2PolicyResource.tags; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param attributes the attributes + */ + public Builder(List attributes) { + this.attributes = attributes; + } + + /** + * Builds a V2PolicyResource. + * + * @return the new V2PolicyResource instance + */ + public V2PolicyResource build() { + return new V2PolicyResource(this); + } + + /** + * Adds a new element to attributes. + * + * @param attributes the new element to be added + * @return the V2PolicyResource builder + */ + public Builder addAttributes(V2PolicyResourceAttribute attributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, + "attributes cannot be null"); + if (this.attributes == null) { + this.attributes = new ArrayList(); + } + this.attributes.add(attributes); + return this; + } + + /** + * Adds a new element to tags. + * + * @param tags the new element to be added + * @return the V2PolicyResource builder + */ + public Builder addTags(V2PolicyResourceTag tags) { + com.ibm.cloud.sdk.core.util.Validator.notNull(tags, + "tags cannot be null"); + if (this.tags == null) { + this.tags = new ArrayList(); + } + this.tags.add(tags); + return this; + } + + /** + * Set the attributes. + * Existing attributes will be replaced. + * + * @param attributes the attributes + * @return the V2PolicyResource builder + */ + public Builder attributes(List attributes) { + this.attributes = attributes; + return this; + } + + /** + * Set the tags. + * Existing tags will be replaced. + * + * @param tags the tags + * @return the V2PolicyResource builder + */ + public Builder tags(List tags) { + this.tags = tags; + return this; + } + } + + protected V2PolicyResource() { } + + protected V2PolicyResource(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, + "attributes cannot be null"); + attributes = builder.attributes; + tags = builder.tags; + } + + /** + * New builder. + * + * @return a V2PolicyResource builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the attributes. + * + * List of resource attributes to which the policy grants access. + * + * @return the attributes + */ + public List attributes() { + return attributes; + } + + /** + * Gets the tags. + * + * Optional list of resource tags to which the policy grants access. + * + * @return the tags + */ + public List tags() { + return tags; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java new file mode 100644 index 00000000000..73e7cedd55e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java @@ -0,0 +1,181 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Resource attribute to which the policy grants access. + */ +public class V2PolicyResourceAttribute extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + } + + protected String key; + protected String operator; + protected Object value; + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing V2PolicyResourceAttribute instance. + * + * @param v2PolicyResourceAttribute the instance to initialize the Builder with + */ + private Builder(V2PolicyResourceAttribute v2PolicyResourceAttribute) { + this.key = v2PolicyResourceAttribute.key; + this.operator = v2PolicyResourceAttribute.operator; + this.value = v2PolicyResourceAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a V2PolicyResourceAttribute. + * + * @return the new V2PolicyResourceAttribute instance + */ + public V2PolicyResourceAttribute build() { + return new V2PolicyResourceAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the V2PolicyResourceAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicyResourceAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the V2PolicyResourceAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected V2PolicyResourceAttribute() { } + + protected V2PolicyResourceAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a V2PolicyResourceAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the key. + * + * The name of a resource attribute. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java new file mode 100644 index 00000000000..bb32772b8dc --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java @@ -0,0 +1,174 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A tag associated with a resource. + */ +public class V2PolicyResourceTag extends GenericModel { + + /** + * The operator of an access management tag. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + } + + protected String key; + protected String value; + protected String operator; + + /** + * Builder. + */ + public static class Builder { + private String key; + private String value; + private String operator; + + /** + * Instantiates a new Builder from an existing V2PolicyResourceTag instance. + * + * @param v2PolicyResourceTag the instance to initialize the Builder with + */ + private Builder(V2PolicyResourceTag v2PolicyResourceTag) { + this.key = v2PolicyResourceTag.key; + this.value = v2PolicyResourceTag.value; + this.operator = v2PolicyResourceTag.operator; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param value the value + * @param operator the operator + */ + public Builder(String key, String value, String operator) { + this.key = key; + this.value = value; + this.operator = operator; + } + + /** + * Builds a V2PolicyResourceTag. + * + * @return the new V2PolicyResourceTag instance + */ + public V2PolicyResourceTag build() { + return new V2PolicyResourceTag(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the V2PolicyResourceTag builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the V2PolicyResourceTag builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicyResourceTag builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + } + + protected V2PolicyResourceTag() { } + + protected V2PolicyResourceTag(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + key = builder.key; + value = builder.value; + operator = builder.operator; + } + + /** + * New builder. + * + * @return a V2PolicyResourceTag builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the key. + * + * The name of an access management tag. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the value. + * + * The value of an access management tag. + * + * @return the value + */ + public String value() { + return value; + } + + /** + * Gets the operator. + * + * The operator of an access management tag. + * + * @return the operator + */ + public String operator() { + return operator; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java new file mode 100644 index 00000000000..13a9f5fbd94 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java @@ -0,0 +1,126 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Additional access conditions associated with the policy. + * + * Classes which extend this class: + * - V2PolicyRuleRuleAttribute + * - V2PolicyRuleRuleWithNestedConditions + */ +public class V2PolicyRule extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + protected String key; + protected String operator; + protected Object value; + protected List conditions; + + protected V2PolicyRule() { } + + /** + * Gets the key. + * + * The name of an attribute. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } + + /** + * Gets the conditions. + * + * List of conditions associated with a policy. For example, time-based conditions that grant access over a certain + * time period. + * + * @return the conditions + */ + public List conditions() { + return conditions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java new file mode 100644 index 00000000000..c20b3a8cb0c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java @@ -0,0 +1,170 @@ +/* + * (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_policy_management.v1.model; + +/** + * Rule that specifies additional access that is granted (For example, time-based condition). + */ +public class V2PolicyRuleRuleAttribute extends V2PolicyRule { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing V2PolicyRuleRuleAttribute instance. + * + * @param v2PolicyRuleRuleAttribute the instance to initialize the Builder with + */ + public Builder(V2PolicyRule v2PolicyRuleRuleAttribute) { + this.key = v2PolicyRuleRuleAttribute.key; + this.operator = v2PolicyRuleRuleAttribute.operator; + this.value = v2PolicyRuleRuleAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a V2PolicyRuleRuleAttribute. + * + * @return the new V2PolicyRuleRuleAttribute instance + */ + public V2PolicyRuleRuleAttribute build() { + return new V2PolicyRuleRuleAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the V2PolicyRuleRuleAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicyRuleRuleAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the V2PolicyRuleRuleAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected V2PolicyRuleRuleAttribute() { } + + protected V2PolicyRuleRuleAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a V2PolicyRuleRuleAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java new file mode 100644 index 00000000000..8d6e57920f9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java @@ -0,0 +1,139 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * Rule that specifies additional access that is granted (for example, time-based condition) accross multiple + * conditions. + */ +public class V2PolicyRuleRuleWithNestedConditions extends V2PolicyRule { + + /** + * Operator to evaluate conditions. + */ + public interface Operator { + /** and. */ + String AND = "and"; + /** or. */ + String OR = "or"; + } + + + /** + * Builder. + */ + public static class Builder { + private String operator; + private List conditions; + + /** + * Instantiates a new Builder from an existing V2PolicyRuleRuleWithNestedConditions instance. + * + * @param v2PolicyRuleRuleWithNestedConditions the instance to initialize the Builder with + */ + public Builder(V2PolicyRule v2PolicyRuleRuleWithNestedConditions) { + this.operator = v2PolicyRuleRuleWithNestedConditions.operator; + this.conditions = v2PolicyRuleRuleWithNestedConditions.conditions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param operator the operator + * @param conditions the conditions + */ + public Builder(String operator, List conditions) { + this.operator = operator; + this.conditions = conditions; + } + + /** + * Builds a V2PolicyRuleRuleWithNestedConditions. + * + * @return the new V2PolicyRuleRuleWithNestedConditions instance + */ + public V2PolicyRuleRuleWithNestedConditions build() { + return new V2PolicyRuleRuleWithNestedConditions(this); + } + + /** + * Adds a new element to conditions. + * + * @param conditions the new element to be added + * @return the V2PolicyRuleRuleWithNestedConditions builder + */ + public Builder addConditions(NestedCondition conditions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(conditions, + "conditions cannot be null"); + if (this.conditions == null) { + this.conditions = new ArrayList(); + } + this.conditions.add(conditions); + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicyRuleRuleWithNestedConditions builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the conditions. + * Existing conditions will be replaced. + * + * @param conditions the conditions + * @return the V2PolicyRuleRuleWithNestedConditions builder + */ + public Builder conditions(List conditions) { + this.conditions = conditions; + return this; + } + } + + protected V2PolicyRuleRuleWithNestedConditions() { } + + protected V2PolicyRuleRuleWithNestedConditions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.conditions, + "conditions cannot be null"); + operator = builder.operator; + conditions = builder.conditions; + } + + /** + * New builder. + * + * @return a V2PolicyRuleRuleWithNestedConditions builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java new file mode 100644 index 00000000000..891513fd45a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java @@ -0,0 +1,124 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The subject attributes for whom the policy grants access. + */ +public class V2PolicySubject extends GenericModel { + + protected List attributes; + + /** + * Builder. + */ + public static class Builder { + private List attributes; + + /** + * Instantiates a new Builder from an existing V2PolicySubject instance. + * + * @param v2PolicySubject the instance to initialize the Builder with + */ + private Builder(V2PolicySubject v2PolicySubject) { + this.attributes = v2PolicySubject.attributes; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param attributes the attributes + */ + public Builder(List attributes) { + this.attributes = attributes; + } + + /** + * Builds a V2PolicySubject. + * + * @return the new V2PolicySubject instance + */ + public V2PolicySubject build() { + return new V2PolicySubject(this); + } + + /** + * Adds a new element to attributes. + * + * @param attributes the new element to be added + * @return the V2PolicySubject builder + */ + public Builder addAttributes(V2PolicySubjectAttribute attributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, + "attributes cannot be null"); + if (this.attributes == null) { + this.attributes = new ArrayList(); + } + this.attributes.add(attributes); + return this; + } + + /** + * Set the attributes. + * Existing attributes will be replaced. + * + * @param attributes the attributes + * @return the V2PolicySubject builder + */ + public Builder attributes(List attributes) { + this.attributes = attributes; + return this; + } + } + + protected V2PolicySubject() { } + + protected V2PolicySubject(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, + "attributes cannot be null"); + attributes = builder.attributes; + } + + /** + * New builder. + * + * @return a V2PolicySubject builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the attributes. + * + * List of subject attributes associated with policy. + * + * @return the attributes + */ + public List attributes() { + return attributes; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java new file mode 100644 index 00000000000..c90606429df --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java @@ -0,0 +1,175 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Subject attribute for whom the policy grants access. + */ +public class V2PolicySubjectAttribute extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + } + + protected String key; + protected String operator; + protected Object value; + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing V2PolicySubjectAttribute instance. + * + * @param v2PolicySubjectAttribute the instance to initialize the Builder with + */ + private Builder(V2PolicySubjectAttribute v2PolicySubjectAttribute) { + this.key = v2PolicySubjectAttribute.key; + this.operator = v2PolicySubjectAttribute.operator; + this.value = v2PolicySubjectAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a V2PolicySubjectAttribute. + * + * @return the new V2PolicySubjectAttribute instance + */ + public V2PolicySubjectAttribute build() { + return new V2PolicySubjectAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the V2PolicySubjectAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicySubjectAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the V2PolicySubjectAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected V2PolicySubjectAttribute() { } + + protected V2PolicySubjectAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a V2PolicySubjectAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the key. + * + * The name of a subject attribute. For example, iam_id, access_group_id. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java new file mode 100644 index 00000000000..720f7b57d4e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java @@ -0,0 +1,260 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the policy. + */ +public class V2PolicyTemplateMetaData extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + /** + * The policy state, either 'deleted' or 'active'. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String type; + protected String description; + protected V2PolicySubject subject; + protected V2PolicyResource resource; + protected String pattern; + protected V2PolicyRule rule; + protected String id; + protected String href; + protected ControlResponse control; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String state; + @SerializedName("last_permit_at") + protected String lastPermitAt; + @SerializedName("last_permit_frequency") + protected Long lastPermitFrequency; + protected TemplateMetadata template; + + protected V2PolicyTemplateMetaData() { } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject getSubject() { + return subject; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource getResource() { + return resource; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String getPattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule getRule() { + return rule; + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the policies API by policy ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the control. + * + * @return the control + */ + public ControlResponse getControl() { + return control; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the state. + * + * The policy state, either 'deleted' or 'active'. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the lastPermitAt. + * + * The optional last permit time of policy, when passing query parameter format=include_last_permit. + * + * @return the lastPermitAt + */ + public String getLastPermitAt() { + return lastPermitAt; + } + + /** + * Gets the lastPermitFrequency. + * + * The optional count of times that policy has provided a permit, when passing query parameter + * format=include_last_permit. + * + * @return the lastPermitFrequency + */ + public Long getLastPermitFrequency() { + return lastPermitFrequency; + } + + /** + * Gets the template. + * + * The details of the IAM template that was used to create an enterprise-managed policy in your account. When + * returned, this indicates that the policy is created from and managed by a template in the root enterprise account. + * + * @return the template + */ + public TemplateMetadata getTemplate() { + return template; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java new file mode 100644 index 00000000000..63a87389391 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java @@ -0,0 +1,17 @@ +/* + * (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. + */ + +/** + * IAM Policy Management v1. + */ +package com.ibm.cloud.platform_services.iam_policy_management.v1; diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java new file mode 100644 index 00000000000..b38933306a6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java @@ -0,0 +1,5007 @@ +/* + * (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_policy_management.v1; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplatesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponse; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControlWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedCondition; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleWithConditions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PoliciesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplatesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoleReferences; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PoliciesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRule; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleWithNestedConditions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.http.Response; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import okhttp3.mockwebserver.RecordedRequest; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the IamPolicyManagement service. + */ +public class IamPolicyManagementTest { + + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + protected MockWebServer server; + protected IamPolicyManagement iamPolicyManagementService; + + // Construct the service with a null authenticator (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testConstructorWithNullAuthenticator() throws Throwable { + final String serviceName = "testService"; + new IamPolicyManagement(serviceName, null); + } + + // Test the listPolicies operation with a valid options model parameter + @Test + public void testListPoliciesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policies\": [{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}]}"; + String listPoliciesPath = "/v1/policies"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListPoliciesOptions model + ListPoliciesOptions listPoliciesOptionsModel = new ListPoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .tagName("testString") + .tagValue("testString") + .sort("id") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listPolicies() with a valid options model and verify the result + Response response = iamPolicyManagementService.listPolicies(listPoliciesOptionsModel).execute(); + assertNotNull(response); + PolicyCollection 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, listPoliciesPath); + // 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("access_group_id"), "testString"); + assertEquals(query.get("type"), "access"); + assertEquals(query.get("service_type"), "service"); + assertEquals(query.get("tag_name"), "testString"); + assertEquals(query.get("tag_value"), "testString"); + assertEquals(query.get("sort"), "id"); + assertEquals(query.get("format"), "include_last_permit"); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listPolicies operation with and without retries enabled + @Test + public void testListPoliciesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListPoliciesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListPoliciesWOptions(); + } + + // Test the listPolicies operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPoliciesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listPolicies(null).execute(); + } + + // Test the listPolicies operation using the PoliciesPager.getNext() method + @Test + public void testListPoliciesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPoliciesOptions listPoliciesOptions = new ListPoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .tagName("testString") + .tagValue("testString") + .sort("id") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + PoliciesPager pager = new PoliciesPager(iamPolicyManagementService, listPoliciesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listPolicies operation using the PoliciesPager.getAll() method + @Test + public void testListPoliciesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPoliciesOptions listPoliciesOptions = new ListPoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .tagName("testString") + .tagValue("testString") + .sort("id") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + PoliciesPager pager = new PoliciesPager(iamPolicyManagementService, listPoliciesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createPolicy operation with a valid options model parameter + @Test + public void testCreatePolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; + String createPolicyPath = "/v1/policies"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the SubjectAttribute model + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + + // Construct an instance of the PolicySubject model + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + + // Construct an instance of the PolicyRole model + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the ResourceAttribute model + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + + // Construct an instance of the ResourceTag model + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + + // Construct an instance of the PolicyResource model + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + + // Construct an instance of the CreatePolicyOptions model + CreatePolicyOptions createPolicyOptionsModel = new CreatePolicyOptions.Builder() + .type("testString") + .subjects(java.util.Arrays.asList(policySubjectModel)) + .roles(java.util.Arrays.asList(policyRoleModel)) + .resources(java.util.Arrays.asList(policyResourceModel)) + .description("testString") + .acceptLanguage("default") + .build(); + + // Invoke createPolicy() with a valid options model and verify the result + Response response = iamPolicyManagementService.createPolicy(createPolicyOptionsModel).execute(); + assertNotNull(response); + Policy 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createPolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createPolicy operation with and without retries enabled + @Test + public void testCreatePolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreatePolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreatePolicyWOptions(); + } + + // Test the createPolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createPolicy(null).execute(); + } + + // Test the replacePolicy operation with a valid options model parameter + @Test + public void testReplacePolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; + String replacePolicyPath = "/v1/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the SubjectAttribute model + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + + // Construct an instance of the PolicySubject model + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + + // Construct an instance of the PolicyRole model + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the ResourceAttribute model + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + + // Construct an instance of the ResourceTag model + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + + // Construct an instance of the PolicyResource model + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + + // Construct an instance of the ReplacePolicyOptions model + ReplacePolicyOptions replacePolicyOptionsModel = new ReplacePolicyOptions.Builder() + .policyId("testString") + .ifMatch("testString") + .type("testString") + .subjects(java.util.Arrays.asList(policySubjectModel)) + .roles(java.util.Arrays.asList(policyRoleModel)) + .resources(java.util.Arrays.asList(policyResourceModel)) + .description("testString") + .build(); + + // Invoke replacePolicy() with a valid options model and verify the result + Response response = iamPolicyManagementService.replacePolicy(replacePolicyOptionsModel).execute(); + assertNotNull(response); + Policy 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, replacePolicyPath); + // 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 replacePolicy operation with and without retries enabled + @Test + public void testReplacePolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplacePolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplacePolicyWOptions(); + } + + // Test the replacePolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplacePolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replacePolicy(null).execute(); + } + + // Test the getPolicy operation with a valid options model parameter + @Test + public void testGetPolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}"; + String getPolicyPath = "/v1/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetPolicyOptions model + GetPolicyOptions getPolicyOptionsModel = new GetPolicyOptions.Builder() + .policyId("testString") + .build(); + + // Invoke getPolicy() with a valid options model and verify the result + Response response = iamPolicyManagementService.getPolicy(getPolicyOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateMetaData 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, getPolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getPolicy operation with and without retries enabled + @Test + public void testGetPolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetPolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetPolicyWOptions(); + } + + // Test the getPolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getPolicy(null).execute(); + } + + // Test the deletePolicy operation with a valid options model parameter + @Test + public void testDeletePolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deletePolicyPath = "/v1/policies/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeletePolicyOptions model + DeletePolicyOptions deletePolicyOptionsModel = new DeletePolicyOptions.Builder() + .policyId("testString") + .build(); + + // Invoke deletePolicy() with a valid options model and verify the result + Response response = iamPolicyManagementService.deletePolicy(deletePolicyOptionsModel).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, deletePolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deletePolicy operation with and without retries enabled + @Test + public void testDeletePolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeletePolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeletePolicyWOptions(); + } + + // Test the deletePolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deletePolicy(null).execute(); + } + + // Test the updatePolicyState operation with a valid options model parameter + @Test + public void testUpdatePolicyStateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; + String updatePolicyStatePath = "/v1/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdatePolicyStateOptions model + UpdatePolicyStateOptions updatePolicyStateOptionsModel = new UpdatePolicyStateOptions.Builder() + .policyId("testString") + .ifMatch("testString") + .state("active") + .build(); + + // Invoke updatePolicyState() with a valid options model and verify the result + Response response = iamPolicyManagementService.updatePolicyState(updatePolicyStateOptionsModel).execute(); + assertNotNull(response); + Policy 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updatePolicyStatePath); + // 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 updatePolicyState operation with and without retries enabled + @Test + public void testUpdatePolicyStateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdatePolicyStateWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdatePolicyStateWOptions(); + } + + // Test the updatePolicyState operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdatePolicyStateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updatePolicyState(null).execute(); + } + + // Test the listRoles operation with a valid options model parameter + @Test + public void testListRolesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"custom_roles\": [{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}], \"service_roles\": [{\"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\"}], \"system_roles\": [{\"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\"}]}"; + String listRolesPath = "/v2/roles"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListRolesOptions model + ListRolesOptions listRolesOptionsModel = new ListRolesOptions.Builder() + .acceptLanguage("default") + .accountId("testString") + .serviceName("iam-groups") + .sourceServiceName("iam-groups") + .policyType("authorization") + .serviceGroupId("IAM") + .build(); + + // Invoke listRoles() with a valid options model and verify the result + Response response = iamPolicyManagementService.listRoles(listRolesOptionsModel).execute(); + assertNotNull(response); + RoleCollection 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, listRolesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("service_name"), "iam-groups"); + assertEquals(query.get("source_service_name"), "iam-groups"); + assertEquals(query.get("policy_type"), "authorization"); + assertEquals(query.get("service_group_id"), "IAM"); + } + + // Test the listRoles operation with and without retries enabled + @Test + public void testListRolesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListRolesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListRolesWOptions(); + } + + // Test the createRole operation with a valid options model parameter + @Test + public void testCreateRoleWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; + String createRolePath = "/v2/roles"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the CreateRoleOptions model + CreateRoleOptions createRoleOptionsModel = new CreateRoleOptions.Builder() + .displayName("testString") + .actions(java.util.Arrays.asList("testString")) + .name("Developer") + .accountId("testString") + .serviceName("iam-groups") + .description("testString") + .acceptLanguage("default") + .build(); + + // Invoke createRole() with a valid options model and verify the result + Response response = iamPolicyManagementService.createRole(createRoleOptionsModel).execute(); + assertNotNull(response); + CustomRole 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createRolePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createRole operation with and without retries enabled + @Test + public void testCreateRoleWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateRoleWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateRoleWOptions(); + } + + // Test the createRole operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createRole(null).execute(); + } + + // Test the replaceRole operation with a valid options model parameter + @Test + public void testReplaceRoleWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; + String replaceRolePath = "/v2/roles/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ReplaceRoleOptions model + ReplaceRoleOptions replaceRoleOptionsModel = new ReplaceRoleOptions.Builder() + .roleId("testString") + .ifMatch("testString") + .displayName("testString") + .actions(java.util.Arrays.asList("testString")) + .description("testString") + .build(); + + // Invoke replaceRole() with a valid options model and verify the result + Response response = iamPolicyManagementService.replaceRole(replaceRoleOptionsModel).execute(); + assertNotNull(response); + CustomRole 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, replaceRolePath); + // 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 replaceRole operation with and without retries enabled + @Test + public void testReplaceRoleWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplaceRoleWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplaceRoleWOptions(); + } + + // Test the replaceRole operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceRoleNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replaceRole(null).execute(); + } + + // Test the getRole operation with a valid options model parameter + @Test + public void testGetRoleWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; + String getRolePath = "/v2/roles/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetRoleOptions model + GetRoleOptions getRoleOptionsModel = new GetRoleOptions.Builder() + .roleId("testString") + .build(); + + // Invoke getRole() with a valid options model and verify the result + Response response = iamPolicyManagementService.getRole(getRoleOptionsModel).execute(); + assertNotNull(response); + CustomRole 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, getRolePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getRole operation with and without retries enabled + @Test + public void testGetRoleWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetRoleWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetRoleWOptions(); + } + + // Test the getRole operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getRole(null).execute(); + } + + // Test the deleteRole operation with a valid options model parameter + @Test + public void testDeleteRoleWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteRolePath = "/v2/roles/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteRoleOptions model + DeleteRoleOptions deleteRoleOptionsModel = new DeleteRoleOptions.Builder() + .roleId("testString") + .build(); + + // Invoke deleteRole() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteRole(deleteRoleOptionsModel).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, deleteRolePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteRole operation with and without retries enabled + @Test + public void testDeleteRoleWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteRoleWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteRoleWOptions(); + } + + // Test the deleteRole operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteRole(null).execute(); + } + + // Test the listV2Policies operation with a valid options model parameter + @Test + public void testListV2PoliciesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policies\": [{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19, \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}]}"; + String listV2PoliciesPath = "/v2/policies"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListV2PoliciesOptions model + ListV2PoliciesOptions listV2PoliciesOptionsModel = new ListV2PoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .serviceName("testString") + .serviceGroupId("testString") + .sort("testString") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listV2Policies() with a valid options model and verify the result + Response response = iamPolicyManagementService.listV2Policies(listV2PoliciesOptionsModel).execute(); + assertNotNull(response); + V2PolicyCollection 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, listV2PoliciesPath); + // 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("access_group_id"), "testString"); + assertEquals(query.get("type"), "access"); + assertEquals(query.get("service_type"), "service"); + assertEquals(query.get("service_name"), "testString"); + assertEquals(query.get("service_group_id"), "testString"); + assertEquals(query.get("sort"), "testString"); + assertEquals(query.get("format"), "include_last_permit"); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listV2Policies operation with and without retries enabled + @Test + public void testListV2PoliciesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListV2PoliciesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListV2PoliciesWOptions(); + } + + // Test the listV2Policies operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListV2PoliciesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listV2Policies(null).execute(); + } + + // Test the listV2Policies operation using the V2PoliciesPager.getNext() method + @Test + public void testListV2PoliciesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListV2PoliciesOptions listV2PoliciesOptions = new ListV2PoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .serviceName("testString") + .serviceGroupId("testString") + .sort("testString") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + V2PoliciesPager pager = new V2PoliciesPager(iamPolicyManagementService, listV2PoliciesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listV2Policies operation using the V2PoliciesPager.getAll() method + @Test + public void testListV2PoliciesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListV2PoliciesOptions listV2PoliciesOptions = new ListV2PoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .serviceName("testString") + .serviceGroupId("testString") + .sort("testString") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + V2PoliciesPager pager = new V2PoliciesPager(iamPolicyManagementService, listV2PoliciesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createV2Policy operation with a valid options model parameter + @Test + public void testCreateV2PolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19}"; + String createV2PolicyPath = "/v2/policies"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the Grant model + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the Control model + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the CreateV2PolicyOptions model + CreateV2PolicyOptions createV2PolicyOptionsModel = new CreateV2PolicyOptions.Builder() + .control(controlModel) + .type("access") + .description("testString") + .subject(v2PolicySubjectModel) + .resource(v2PolicyResourceModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .acceptLanguage("default") + .build(); + + // Invoke createV2Policy() with a valid options model and verify the result + Response response = iamPolicyManagementService.createV2Policy(createV2PolicyOptionsModel).execute(); + assertNotNull(response); + V2Policy 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createV2PolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createV2Policy operation with and without retries enabled + @Test + public void testCreateV2PolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateV2PolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateV2PolicyWOptions(); + } + + // Test the createV2Policy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateV2PolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createV2Policy(null).execute(); + } + + // Test the replaceV2Policy operation with a valid options model parameter + @Test + public void testReplaceV2PolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19}"; + String replaceV2PolicyPath = "/v2/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the Grant model + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the Control model + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the ReplaceV2PolicyOptions model + ReplaceV2PolicyOptions replaceV2PolicyOptionsModel = new ReplaceV2PolicyOptions.Builder() + .id("testString") + .ifMatch("testString") + .control(controlModel) + .type("access") + .description("testString") + .subject(v2PolicySubjectModel) + .resource(v2PolicyResourceModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .build(); + + // Invoke replaceV2Policy() with a valid options model and verify the result + Response response = iamPolicyManagementService.replaceV2Policy(replaceV2PolicyOptionsModel).execute(); + assertNotNull(response); + V2Policy 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, replaceV2PolicyPath); + // 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 replaceV2Policy operation with and without retries enabled + @Test + public void testReplaceV2PolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplaceV2PolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplaceV2PolicyWOptions(); + } + + // Test the replaceV2Policy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceV2PolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replaceV2Policy(null).execute(); + } + + // Test the getV2Policy operation with a valid options model parameter + @Test + public void testGetV2PolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19, \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}"; + String getV2PolicyPath = "/v2/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetV2PolicyOptions model + GetV2PolicyOptions getV2PolicyOptionsModel = new GetV2PolicyOptions.Builder() + .id("testString") + .format("include_last_permit") + .build(); + + // Invoke getV2Policy() with a valid options model and verify the result + Response response = iamPolicyManagementService.getV2Policy(getV2PolicyOptionsModel).execute(); + assertNotNull(response); + V2PolicyTemplateMetaData 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, getV2PolicyPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("format"), "include_last_permit"); + } + + // Test the getV2Policy operation with and without retries enabled + @Test + public void testGetV2PolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetV2PolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetV2PolicyWOptions(); + } + + // Test the getV2Policy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetV2PolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getV2Policy(null).execute(); + } + + // Test the deleteV2Policy operation with a valid options model parameter + @Test + public void testDeleteV2PolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteV2PolicyPath = "/v2/policies/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteV2PolicyOptions model + DeleteV2PolicyOptions deleteV2PolicyOptionsModel = new DeleteV2PolicyOptions.Builder() + .id("testString") + .build(); + + // Invoke deleteV2Policy() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteV2Policy(deleteV2PolicyOptionsModel).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, deleteV2PolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteV2Policy operation with and without retries enabled + @Test + public void testDeleteV2PolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteV2PolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteV2PolicyWOptions(); + } + + // Test the deleteV2Policy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteV2PolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteV2Policy(null).execute(); + } + + // Test the listPolicyTemplates operation with a valid options model parameter + @Test + public void testListPolicyTemplatesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policy_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; + String listPolicyTemplatesPath = "/v1/policy_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListPolicyTemplatesOptions model + ListPolicyTemplatesOptions listPolicyTemplatesOptionsModel = new ListPolicyTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .state("active") + .name("testString") + .policyServiceType("service") + .policyServiceName("testString") + .policyServiceGroupId("testString") + .policyType("access") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listPolicyTemplates() with a valid options model and verify the result + Response response = iamPolicyManagementService.listPolicyTemplates(listPolicyTemplatesOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateCollection 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, listPolicyTemplatesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("state"), "active"); + assertEquals(query.get("name"), "testString"); + assertEquals(query.get("policy_service_type"), "service"); + assertEquals(query.get("policy_service_name"), "testString"); + assertEquals(query.get("policy_service_group_id"), "testString"); + assertEquals(query.get("policy_type"), "access"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listPolicyTemplates operation with and without retries enabled + @Test + public void testListPolicyTemplatesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListPolicyTemplatesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListPolicyTemplatesWOptions(); + } + + // Test the listPolicyTemplates operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyTemplatesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listPolicyTemplates(null).execute(); + } + + // Test the listPolicyTemplates operation using the PolicyTemplatesPager.getNext() method + @Test + public void testListPolicyTemplatesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyTemplatesOptions listPolicyTemplatesOptions = new ListPolicyTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .state("active") + .name("testString") + .policyServiceType("service") + .policyServiceName("testString") + .policyServiceGroupId("testString") + .policyType("access") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + PolicyTemplatesPager pager = new PolicyTemplatesPager(iamPolicyManagementService, listPolicyTemplatesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listPolicyTemplates operation using the PolicyTemplatesPager.getAll() method + @Test + public void testListPolicyTemplatesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyTemplatesOptions listPolicyTemplatesOptions = new ListPolicyTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .state("active") + .name("testString") + .policyServiceType("service") + .policyServiceName("testString") + .policyServiceGroupId("testString") + .policyType("access") + .limit(Long.valueOf("10")) + .build(); + + PolicyTemplatesPager pager = new PolicyTemplatesPager(iamPolicyManagementService, listPolicyTemplatesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createPolicyTemplate operation with a valid options model parameter + @Test + public void testCreatePolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; + String createPolicyTemplatePath = "/v1/policy_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the TemplateGrantRoles model + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the TemplateControl model + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + + // Construct an instance of the TemplatePolicy model + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + + // Construct an instance of the CreatePolicyTemplateOptions model + CreatePolicyTemplateOptions createPolicyTemplateOptionsModel = new CreatePolicyTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .policy(templatePolicyModel) + .description("testString") + .committed(true) + .acceptLanguage("default") + .build(); + + // Invoke createPolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.createPolicyTemplate(createPolicyTemplateOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateLimitData 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createPolicyTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createPolicyTemplate operation with and without retries enabled + @Test + public void testCreatePolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreatePolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreatePolicyTemplateWOptions(); + } + + // Test the createPolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createPolicyTemplate(null).execute(); + } + + // Test the getPolicyTemplate operation with a valid options model parameter + @Test + public void testGetPolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String getPolicyTemplatePath = "/v1/policy_templates/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetPolicyTemplateOptions model + GetPolicyTemplateOptions getPolicyTemplateOptionsModel = new GetPolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .state("active") + .build(); + + // Invoke getPolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.getPolicyTemplate(getPolicyTemplateOptionsModel).execute(); + assertNotNull(response); + PolicyTemplate 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, getPolicyTemplatePath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + } + + // Test the getPolicyTemplate operation with and without retries enabled + @Test + public void testGetPolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetPolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetPolicyTemplateWOptions(); + } + + // Test the getPolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getPolicyTemplate(null).execute(); + } + + // Test the deletePolicyTemplate operation with a valid options model parameter + @Test + public void testDeletePolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deletePolicyTemplatePath = "/v1/policy_templates/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeletePolicyTemplateOptions model + DeletePolicyTemplateOptions deletePolicyTemplateOptionsModel = new DeletePolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .build(); + + // Invoke deletePolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.deletePolicyTemplate(deletePolicyTemplateOptionsModel).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, deletePolicyTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deletePolicyTemplate operation with and without retries enabled + @Test + public void testDeletePolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeletePolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeletePolicyTemplateWOptions(); + } + + // Test the deletePolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deletePolicyTemplate(null).execute(); + } + + // Test the createPolicyTemplateVersion operation with a valid options model parameter + @Test + public void testCreatePolicyTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; + String createPolicyTemplateVersionPath = "/v1/policy_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the TemplateGrantRoles model + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the TemplateControl model + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + + // Construct an instance of the TemplatePolicy model + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + + // Construct an instance of the CreatePolicyTemplateVersionOptions model + CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptionsModel = new CreatePolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .policy(templatePolicyModel) + .name("testString") + .description("testString") + .committed(true) + .build(); + + // Invoke createPolicyTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.createPolicyTemplateVersion(createPolicyTemplateVersionOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateLimitData 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createPolicyTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createPolicyTemplateVersion operation with and without retries enabled + @Test + public void testCreatePolicyTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreatePolicyTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreatePolicyTemplateVersionWOptions(); + } + + // Test the createPolicyTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createPolicyTemplateVersion(null).execute(); + } + + // Test the listPolicyTemplateVersions operation with a valid options model parameter + @Test + public void testListPolicyTemplateVersionsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; + String listPolicyTemplateVersionsPath = "/v1/policy_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListPolicyTemplateVersionsOptions model + ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptionsModel = new ListPolicyTemplateVersionsOptions.Builder() + .policyTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listPolicyTemplateVersions() with a valid options model and verify the result + Response response = iamPolicyManagementService.listPolicyTemplateVersions(listPolicyTemplateVersionsOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateVersionsCollection 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, listPolicyTemplateVersionsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listPolicyTemplateVersions operation with and without retries enabled + @Test + public void testListPolicyTemplateVersionsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListPolicyTemplateVersionsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListPolicyTemplateVersionsWOptions(); + } + + // Test the listPolicyTemplateVersions operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyTemplateVersionsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listPolicyTemplateVersions(null).execute(); + } + + // Test the listPolicyTemplateVersions operation using the PolicyTemplateVersionsPager.getNext() method + @Test + public void testListPolicyTemplateVersionsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions = new ListPolicyTemplateVersionsOptions.Builder() + .policyTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + PolicyTemplateVersionsPager pager = new PolicyTemplateVersionsPager(iamPolicyManagementService, listPolicyTemplateVersionsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listPolicyTemplateVersions operation using the PolicyTemplateVersionsPager.getAll() method + @Test + public void testListPolicyTemplateVersionsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions = new ListPolicyTemplateVersionsOptions.Builder() + .policyTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + PolicyTemplateVersionsPager pager = new PolicyTemplateVersionsPager(iamPolicyManagementService, listPolicyTemplateVersionsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the replacePolicyTemplate operation with a valid options model parameter + @Test + public void testReplacePolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String replacePolicyTemplatePath = "/v1/policy_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the TemplateGrantRoles model + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the TemplateControl model + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + + // Construct an instance of the TemplatePolicy model + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + + // Construct an instance of the ReplacePolicyTemplateOptions model + ReplacePolicyTemplateOptions replacePolicyTemplateOptionsModel = new ReplacePolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .ifMatch("testString") + .policy(templatePolicyModel) + .name("testString") + .description("testString") + .committed(true) + .build(); + + // Invoke replacePolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.replacePolicyTemplate(replacePolicyTemplateOptionsModel).execute(); + assertNotNull(response); + PolicyTemplate 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, replacePolicyTemplatePath); + // 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 replacePolicyTemplate operation with and without retries enabled + @Test + public void testReplacePolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplacePolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplacePolicyTemplateWOptions(); + } + + // Test the replacePolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplacePolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replacePolicyTemplate(null).execute(); + } + + // Test the deletePolicyTemplateVersion operation with a valid options model parameter + @Test + public void testDeletePolicyTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deletePolicyTemplateVersionPath = "/v1/policy_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeletePolicyTemplateVersionOptions model + DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptionsModel = new DeletePolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + + // Invoke deletePolicyTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.deletePolicyTemplateVersion(deletePolicyTemplateVersionOptionsModel).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, deletePolicyTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deletePolicyTemplateVersion operation with and without retries enabled + @Test + public void testDeletePolicyTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeletePolicyTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeletePolicyTemplateVersionWOptions(); + } + + // Test the deletePolicyTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deletePolicyTemplateVersion(null).execute(); + } + + // Test the getPolicyTemplateVersion operation with a valid options model parameter + @Test + public void testGetPolicyTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String getPolicyTemplateVersionPath = "/v1/policy_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetPolicyTemplateVersionOptions model + GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptionsModel = new GetPolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + + // Invoke getPolicyTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.getPolicyTemplateVersion(getPolicyTemplateVersionOptionsModel).execute(); + assertNotNull(response); + PolicyTemplate 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, getPolicyTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getPolicyTemplateVersion operation with and without retries enabled + @Test + public void testGetPolicyTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetPolicyTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetPolicyTemplateVersionWOptions(); + } + + // Test the getPolicyTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getPolicyTemplateVersion(null).execute(); + } + + // Test the commitPolicyTemplate operation with a valid options model parameter + @Test + public void testCommitPolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String commitPolicyTemplatePath = "/v1/policy_templates/testString/versions/testString/commit"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the CommitPolicyTemplateOptions model + CommitPolicyTemplateOptions commitPolicyTemplateOptionsModel = new CommitPolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + + // Invoke commitPolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.commitPolicyTemplate(commitPolicyTemplateOptionsModel).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, commitPolicyTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the commitPolicyTemplate operation with and without retries enabled + @Test + public void testCommitPolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCommitPolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCommitPolicyTemplateWOptions(); + } + + // Test the commitPolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitPolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.commitPolicyTemplate(null).execute(); + } + + // Test the listPolicyAssignments operation with a valid options model parameter + @Test + public void testListPolicyAssignmentsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}]}"; + String listPolicyAssignmentsPath = "/v1/policy_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListPolicyAssignmentsOptions model + ListPolicyAssignmentsOptions listPolicyAssignmentsOptionsModel = new ListPolicyAssignmentsOptions.Builder() + .version("1.0") + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listPolicyAssignments() with a valid options model and verify the result + Response response = iamPolicyManagementService.listPolicyAssignments(listPolicyAssignmentsOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateAssignmentCollection 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, listPolicyAssignmentsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "1.0"); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("template_id"), "testString"); + assertEquals(query.get("template_version"), "testString"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listPolicyAssignments operation with and without retries enabled + @Test + public void testListPolicyAssignmentsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListPolicyAssignmentsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListPolicyAssignmentsWOptions(); + } + + // Test the listPolicyAssignments operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyAssignmentsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listPolicyAssignments(null).execute(); + } + + // Test the listPolicyAssignments operation using the PolicyAssignmentsPager.getNext() method + @Test + public void testListPolicyAssignmentsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyAssignmentsOptions listPolicyAssignmentsOptions = new ListPolicyAssignmentsOptions.Builder() + .version("1.0") + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + PolicyAssignmentsPager pager = new PolicyAssignmentsPager(iamPolicyManagementService, listPolicyAssignmentsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listPolicyAssignments operation using the PolicyAssignmentsPager.getAll() method + @Test + public void testListPolicyAssignmentsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyAssignmentsOptions listPolicyAssignmentsOptions = new ListPolicyAssignmentsOptions.Builder() + .version("1.0") + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + PolicyAssignmentsPager pager = new PolicyAssignmentsPager(iamPolicyManagementService, listPolicyAssignmentsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createPolicyTemplateAssignment operation with a valid options model parameter + @Test + public void testCreatePolicyTemplateAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}]}"; + String createPolicyTemplateAssignmentPath = "/v1/policy_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the AssignmentTargetDetails model + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + + // Construct an instance of the AssignmentTemplateDetails model + AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() + .id("testString") + .version("testString") + .build(); + + // Construct an instance of the CreatePolicyTemplateAssignmentOptions model + CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptionsModel = new CreatePolicyTemplateAssignmentOptions.Builder() + .version("1.0") + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(assignmentTemplateDetailsModel)) + .acceptLanguage("default") + .build(); + + // Invoke createPolicyTemplateAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.createPolicyTemplateAssignment(createPolicyTemplateAssignmentOptionsModel).execute(); + assertNotNull(response); + PolicyAssignmentV1Collection 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createPolicyTemplateAssignmentPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "1.0"); + } + + // Test the createPolicyTemplateAssignment operation with and without retries enabled + @Test + public void testCreatePolicyTemplateAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreatePolicyTemplateAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreatePolicyTemplateAssignmentWOptions(); + } + + // Test the createPolicyTemplateAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createPolicyTemplateAssignment(null).execute(); + } + + // Test the getPolicyAssignment operation with a valid options model parameter + @Test + public void testGetPolicyAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}"; + String getPolicyAssignmentPath = "/v1/policy_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetPolicyAssignmentOptions model + GetPolicyAssignmentOptions getPolicyAssignmentOptionsModel = new GetPolicyAssignmentOptions.Builder() + .assignmentId("testString") + .version("1.0") + .build(); + + // Invoke getPolicyAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.getPolicyAssignment(getPolicyAssignmentOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateAssignmentItems 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, getPolicyAssignmentPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "1.0"); + } + + // Test the getPolicyAssignment operation with and without retries enabled + @Test + public void testGetPolicyAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetPolicyAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetPolicyAssignmentWOptions(); + } + + // Test the getPolicyAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getPolicyAssignment(null).execute(); + } + + // Test the updatePolicyAssignment operation with a valid options model parameter + @Test + public void testUpdatePolicyAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}"; + String updatePolicyAssignmentPath = "/v1/policy_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdatePolicyAssignmentOptions model + UpdatePolicyAssignmentOptions updatePolicyAssignmentOptionsModel = new UpdatePolicyAssignmentOptions.Builder() + .assignmentId("testString") + .version("1.0") + .ifMatch("testString") + .templateVersion("testString") + .build(); + + // Invoke updatePolicyAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.updatePolicyAssignment(updatePolicyAssignmentOptionsModel).execute(); + assertNotNull(response); + PolicyAssignmentV1 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updatePolicyAssignmentPath); + // Verify header parameters + assertEquals(request.getHeader("If-Match"), "testString"); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "1.0"); + } + + // Test the updatePolicyAssignment operation with and without retries enabled + @Test + public void testUpdatePolicyAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdatePolicyAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdatePolicyAssignmentWOptions(); + } + + // Test the updatePolicyAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdatePolicyAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updatePolicyAssignment(null).execute(); + } + + // Test the deletePolicyAssignment operation with a valid options model parameter + @Test + public void testDeletePolicyAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deletePolicyAssignmentPath = "/v1/policy_assignments/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeletePolicyAssignmentOptions model + DeletePolicyAssignmentOptions deletePolicyAssignmentOptionsModel = new DeletePolicyAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke deletePolicyAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.deletePolicyAssignment(deletePolicyAssignmentOptionsModel).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, deletePolicyAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deletePolicyAssignment operation with and without retries enabled + @Test + public void testDeletePolicyAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeletePolicyAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeletePolicyAssignmentWOptions(); + } + + // Test the deletePolicyAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deletePolicyAssignment(null).execute(); + } + + // Test the getSettings operation with a valid options model parameter + @Test + public void testGetSettingsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"external_account_identity_interaction\": {\"identity_types\": {\"user\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service_id\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}}}}"; + String getSettingsPath = "/v1/accounts/testString/settings/access_management"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetSettingsOptions model + GetSettingsOptions getSettingsOptionsModel = new GetSettingsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .build(); + + // Invoke getSettings() with a valid options model and verify the result + Response response = iamPolicyManagementService.getSettings(getSettingsOptionsModel).execute(); + assertNotNull(response); + AccountSettingsAccessManagement 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, getSettingsPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getSettings operation with and without retries enabled + @Test + public void testGetSettingsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetSettingsWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetSettingsWOptions(); + } + + // Test the getSettings operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetSettingsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getSettings(null).execute(); + } + + // Test the updateSettings operation with a valid options model parameter + @Test + public void testUpdateSettingsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"external_account_identity_interaction\": {\"identity_types\": {\"user\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service_id\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}}}}"; + String updateSettingsPath = "/v1/accounts/testString/settings/access_management"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the IdentityTypesBase model + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the IdentityTypesPatch model + IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() + .user(identityTypesBaseModel) + .serviceId(identityTypesBaseModel) + .service(identityTypesBaseModel) + .build(); + + // Construct an instance of the ExternalAccountIdentityInteractionPatch model + ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() + .identityTypes(identityTypesPatchModel) + .build(); + + // Construct an instance of the UpdateSettingsOptions model + UpdateSettingsOptions updateSettingsOptionsModel = new UpdateSettingsOptions.Builder() + .accountId("testString") + .ifMatch("testString") + .externalAccountIdentityInteraction(externalAccountIdentityInteractionPatchModel) + .acceptLanguage("default") + .build(); + + // Invoke updateSettings() with a valid options model and verify the result + Response response = iamPolicyManagementService.updateSettings(updateSettingsOptionsModel).execute(); + assertNotNull(response); + AccountSettingsAccessManagement 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updateSettingsPath); + // 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 updateSettings operation with and without retries enabled + @Test + public void testUpdateSettingsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdateSettingsWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdateSettingsWOptions(); + } + + // Test the updateSettings operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateSettingsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updateSettings(null).execute(); + } + + // Test the listActionControlTemplates operation with a valid options model parameter + @Test + public void testListActionControlTemplatesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"action_control_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; + String listActionControlTemplatesPath = "/v1/action_control_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListActionControlTemplatesOptions model + ListActionControlTemplatesOptions listActionControlTemplatesOptionsModel = new ListActionControlTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listActionControlTemplates() with a valid options model and verify the result + Response response = iamPolicyManagementService.listActionControlTemplates(listActionControlTemplatesOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplateCollection 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, listActionControlTemplatesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listActionControlTemplates operation with and without retries enabled + @Test + public void testListActionControlTemplatesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListActionControlTemplatesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListActionControlTemplatesWOptions(); + } + + // Test the listActionControlTemplates operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlTemplatesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listActionControlTemplates(null).execute(); + } + + // Test the listActionControlTemplates operation using the ActionControlTemplatesPager.getNext() method + @Test + public void testListActionControlTemplatesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlTemplatesOptions listActionControlTemplatesOptions = new ListActionControlTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + ActionControlTemplatesPager pager = new ActionControlTemplatesPager(iamPolicyManagementService, listActionControlTemplatesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listActionControlTemplates operation using the ActionControlTemplatesPager.getAll() method + @Test + public void testListActionControlTemplatesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlTemplatesOptions listActionControlTemplatesOptions = new ListActionControlTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .limit(Long.valueOf("10")) + .build(); + + ActionControlTemplatesPager pager = new ActionControlTemplatesPager(iamPolicyManagementService, listActionControlTemplatesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createActionControlTemplate operation with a valid options model parameter + @Test + public void testCreateActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String createActionControlTemplatePath = "/v1/action_control_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateActionControl model + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the CreateActionControlTemplateOptions model + CreateActionControlTemplateOptions createActionControlTemplateOptionsModel = new CreateActionControlTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .description("testString") + .committed(true) + .actionControl(templateActionControlModel) + .acceptLanguage("default") + .build(); + + // Invoke createActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.createActionControlTemplate(createActionControlTemplateOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createActionControlTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createActionControlTemplate operation with and without retries enabled + @Test + public void testCreateActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateActionControlTemplateWOptions(); + } + + // Test the createActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createActionControlTemplate(null).execute(); + } + + // Test the getActionControlTemplate operation with a valid options model parameter + @Test + public void testGetActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String getActionControlTemplatePath = "/v1/action_control_templates/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetActionControlTemplateOptions model + GetActionControlTemplateOptions getActionControlTemplateOptionsModel = new GetActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .build(); + + // Invoke getActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.getActionControlTemplate(getActionControlTemplateOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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, getActionControlTemplatePath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + } + + // Test the getActionControlTemplate operation with and without retries enabled + @Test + public void testGetActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetActionControlTemplateWOptions(); + } + + // Test the getActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getActionControlTemplate(null).execute(); + } + + // Test the deleteActionControlTemplate operation with a valid options model parameter + @Test + public void testDeleteActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteActionControlTemplatePath = "/v1/action_control_templates/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteActionControlTemplateOptions model + DeleteActionControlTemplateOptions deleteActionControlTemplateOptionsModel = new DeleteActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .build(); + + // Invoke deleteActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteActionControlTemplate(deleteActionControlTemplateOptionsModel).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, deleteActionControlTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteActionControlTemplate operation with and without retries enabled + @Test + public void testDeleteActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteActionControlTemplateWOptions(); + } + + // Test the deleteActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteActionControlTemplate(null).execute(); + } + + // Test the createActionControlTemplateVersion operation with a valid options model parameter + @Test + public void testCreateActionControlTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String createActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateActionControl model + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the CreateActionControlTemplateVersionOptions model + CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptionsModel = new CreateActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .name("testString") + .description("testString") + .actionControl(templateActionControlModel) + .committed(true) + .build(); + + // Invoke createActionControlTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.createActionControlTemplateVersion(createActionControlTemplateVersionOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createActionControlTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createActionControlTemplateVersion operation with and without retries enabled + @Test + public void testCreateActionControlTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateActionControlTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateActionControlTemplateVersionWOptions(); + } + + // Test the createActionControlTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createActionControlTemplateVersion(null).execute(); + } + + // Test the listActionControlTemplateVersions operation with a valid options model parameter + @Test + public void testListActionControlTemplateVersionsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; + String listActionControlTemplateVersionsPath = "/v1/action_control_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListActionControlTemplateVersionsOptions model + ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptionsModel = new ListActionControlTemplateVersionsOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listActionControlTemplateVersions() with a valid options model and verify the result + Response response = iamPolicyManagementService.listActionControlTemplateVersions(listActionControlTemplateVersionsOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplateVersionsCollection 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, listActionControlTemplateVersionsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listActionControlTemplateVersions operation with and without retries enabled + @Test + public void testListActionControlTemplateVersionsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListActionControlTemplateVersionsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListActionControlTemplateVersionsWOptions(); + } + + // Test the listActionControlTemplateVersions operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlTemplateVersionsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listActionControlTemplateVersions(null).execute(); + } + + // Test the listActionControlTemplateVersions operation using the ActionControlTemplateVersionsPager.getNext() method + @Test + public void testListActionControlTemplateVersionsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions = new ListActionControlTemplateVersionsOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + ActionControlTemplateVersionsPager pager = new ActionControlTemplateVersionsPager(iamPolicyManagementService, listActionControlTemplateVersionsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listActionControlTemplateVersions operation using the ActionControlTemplateVersionsPager.getAll() method + @Test + public void testListActionControlTemplateVersionsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions = new ListActionControlTemplateVersionsOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + ActionControlTemplateVersionsPager pager = new ActionControlTemplateVersionsPager(iamPolicyManagementService, listActionControlTemplateVersionsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the replaceActionControlTemplate operation with a valid options model parameter + @Test + public void testReplaceActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String replaceActionControlTemplatePath = "/v1/action_control_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateActionControl model + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the ReplaceActionControlTemplateOptions model + ReplaceActionControlTemplateOptions replaceActionControlTemplateOptionsModel = new ReplaceActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .actionControl(templateActionControlModel) + .committed(true) + .build(); + + // Invoke replaceActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.replaceActionControlTemplate(replaceActionControlTemplateOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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, replaceActionControlTemplatePath); + // 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 replaceActionControlTemplate operation with and without retries enabled + @Test + public void testReplaceActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplaceActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplaceActionControlTemplateWOptions(); + } + + // Test the replaceActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replaceActionControlTemplate(null).execute(); + } + + // Test the deleteActionControlTemplateVersion operation with a valid options model parameter + @Test + public void testDeleteActionControlTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteActionControlTemplateVersionOptions model + DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptionsModel = new DeleteActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + + // Invoke deleteActionControlTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteActionControlTemplateVersion(deleteActionControlTemplateVersionOptionsModel).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, deleteActionControlTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteActionControlTemplateVersion operation with and without retries enabled + @Test + public void testDeleteActionControlTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteActionControlTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteActionControlTemplateVersionWOptions(); + } + + // Test the deleteActionControlTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteActionControlTemplateVersion(null).execute(); + } + + // Test the getActionControlTemplateVersion operation with a valid options model parameter + @Test + public void testGetActionControlTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String getActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetActionControlTemplateVersionOptions model + GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptionsModel = new GetActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + + // Invoke getActionControlTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.getActionControlTemplateVersion(getActionControlTemplateVersionOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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, getActionControlTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getActionControlTemplateVersion operation with and without retries enabled + @Test + public void testGetActionControlTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetActionControlTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetActionControlTemplateVersionWOptions(); + } + + // Test the getActionControlTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getActionControlTemplateVersion(null).execute(); + } + + // Test the commitActionControlTemplate operation with a valid options model parameter + @Test + public void testCommitActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String commitActionControlTemplatePath = "/v1/action_control_templates/testString/versions/testString/commit"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the CommitActionControlTemplateOptions model + CommitActionControlTemplateOptions commitActionControlTemplateOptionsModel = new CommitActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + + // Invoke commitActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.commitActionControlTemplate(commitActionControlTemplateOptionsModel).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, commitActionControlTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the commitActionControlTemplate operation with and without retries enabled + @Test + public void testCommitActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCommitActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCommitActionControlTemplateWOptions(); + } + + // Test the commitActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.commitActionControlTemplate(null).execute(); + } + + // Test the listActionControlAssignments operation with a valid options model parameter + @Test + public void testListActionControlAssignmentsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; + String listActionControlAssignmentsPath = "/v1/action_control_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListActionControlAssignmentsOptions model + ListActionControlAssignmentsOptions listActionControlAssignmentsOptionsModel = new ListActionControlAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listActionControlAssignments() with a valid options model and verify the result + Response response = iamPolicyManagementService.listActionControlAssignments(listActionControlAssignmentsOptionsModel).execute(); + assertNotNull(response); + ActionControlAssignmentCollection 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, listActionControlAssignmentsPath); + // 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(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listActionControlAssignments operation with and without retries enabled + @Test + public void testListActionControlAssignmentsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListActionControlAssignmentsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListActionControlAssignmentsWOptions(); + } + + // Test the listActionControlAssignments operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlAssignmentsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listActionControlAssignments(null).execute(); + } + + // Test the listActionControlAssignments operation using the ActionControlAssignmentsPager.getNext() method + @Test + public void testListActionControlAssignmentsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlAssignmentsOptions listActionControlAssignmentsOptions = new ListActionControlAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + ActionControlAssignmentsPager pager = new ActionControlAssignmentsPager(iamPolicyManagementService, listActionControlAssignmentsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listActionControlAssignments operation using the ActionControlAssignmentsPager.getAll() method + @Test + public void testListActionControlAssignmentsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlAssignmentsOptions listActionControlAssignmentsOptions = new ListActionControlAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + ActionControlAssignmentsPager pager = new ActionControlAssignmentsPager(iamPolicyManagementService, listActionControlAssignmentsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createActionControlTemplateAssignment operation with a valid options model parameter + @Test + public void testCreateActionControlTemplateAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; + String createActionControlTemplateAssignmentPath = "/v1/action_control_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the AssignmentTargetDetails model + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + + // Construct an instance of the ActionControlAssignmentTemplate model + ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + + // Construct an instance of the CreateActionControlTemplateAssignmentOptions model + CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptionsModel = new CreateActionControlTemplateAssignmentOptions.Builder() + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(actionControlAssignmentTemplateModel)) + .acceptLanguage("default") + .build(); + + // Invoke createActionControlTemplateAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.createActionControlTemplateAssignment(createActionControlTemplateAssignmentOptionsModel).execute(); + assertNotNull(response); + ActionControlAssignmentCollection 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createActionControlTemplateAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createActionControlTemplateAssignment operation with and without retries enabled + @Test + public void testCreateActionControlTemplateAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateActionControlTemplateAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateActionControlTemplateAssignmentWOptions(); + } + + // Test the createActionControlTemplateAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createActionControlTemplateAssignment(null).execute(); + } + + // Test the getActionControlAssignment operation with a valid options model parameter + @Test + public void testGetActionControlAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; + String getActionControlAssignmentPath = "/v1/action_control_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetActionControlAssignmentOptions model + GetActionControlAssignmentOptions getActionControlAssignmentOptionsModel = new GetActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke getActionControlAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.getActionControlAssignment(getActionControlAssignmentOptionsModel).execute(); + assertNotNull(response); + ActionControlAssignment 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, getActionControlAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getActionControlAssignment operation with and without retries enabled + @Test + public void testGetActionControlAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetActionControlAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetActionControlAssignmentWOptions(); + } + + // Test the getActionControlAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getActionControlAssignment(null).execute(); + } + + // Test the updateActionControlAssignment operation with a valid options model parameter + @Test + public void testUpdateActionControlAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; + String updateActionControlAssignmentPath = "/v1/action_control_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdateActionControlAssignmentOptions model + UpdateActionControlAssignmentOptions updateActionControlAssignmentOptionsModel = new UpdateActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .ifMatch("testString") + .templateVersion("testString") + .build(); + + // Invoke updateActionControlAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.updateActionControlAssignment(updateActionControlAssignmentOptionsModel).execute(); + assertNotNull(response); + ActionControlAssignment 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updateActionControlAssignmentPath); + // 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 updateActionControlAssignment operation with and without retries enabled + @Test + public void testUpdateActionControlAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdateActionControlAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdateActionControlAssignmentWOptions(); + } + + // Test the updateActionControlAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateActionControlAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updateActionControlAssignment(null).execute(); + } + + // Test the deleteActionControlAssignment operation with a valid options model parameter + @Test + public void testDeleteActionControlAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteActionControlAssignmentPath = "/v1/action_control_assignments/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteActionControlAssignmentOptions model + DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptionsModel = new DeleteActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke deleteActionControlAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteActionControlAssignment(deleteActionControlAssignmentOptionsModel).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, deleteActionControlAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteActionControlAssignment operation with and without retries enabled + @Test + public void testDeleteActionControlAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteActionControlAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteActionControlAssignmentWOptions(); + } + + // Test the deleteActionControlAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteActionControlAssignment(null).execute(); + } + + // Test the listRoleTemplates operation with a valid options model parameter + @Test + public void testListRoleTemplatesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"role_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; + String listRoleTemplatesPath = "/v1/role_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListRoleTemplatesOptions model + ListRoleTemplatesOptions listRoleTemplatesOptionsModel = new ListRoleTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .name("testString") + .roleName("testString") + .roleServiceName("testString") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listRoleTemplates() with a valid options model and verify the result + Response response = iamPolicyManagementService.listRoleTemplates(listRoleTemplatesOptionsModel).execute(); + assertNotNull(response); + RoleTemplateCollection 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, listRoleTemplatesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("name"), "testString"); + assertEquals(query.get("role_name"), "testString"); + assertEquals(query.get("role_service_name"), "testString"); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listRoleTemplates operation with and without retries enabled + @Test + public void testListRoleTemplatesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListRoleTemplatesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListRoleTemplatesWOptions(); + } + + // Test the listRoleTemplates operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleTemplatesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listRoleTemplates(null).execute(); + } + + // Test the listRoleTemplates operation using the RoleTemplatesPager.getNext() method + @Test + public void testListRoleTemplatesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleTemplatesOptions listRoleTemplatesOptions = new ListRoleTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .name("testString") + .roleName("testString") + .roleServiceName("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + RoleTemplatesPager pager = new RoleTemplatesPager(iamPolicyManagementService, listRoleTemplatesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listRoleTemplates operation using the RoleTemplatesPager.getAll() method + @Test + public void testListRoleTemplatesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleTemplatesOptions listRoleTemplatesOptions = new ListRoleTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .name("testString") + .roleName("testString") + .roleServiceName("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + RoleTemplatesPager pager = new RoleTemplatesPager(iamPolicyManagementService, listRoleTemplatesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createRoleTemplate operation with a valid options model parameter + @Test + public void testCreateRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String createRoleTemplatePath = "/v1/role_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the RoleTemplatePrototypeRole model + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() + .name("testString") + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the CreateRoleTemplateOptions model + CreateRoleTemplateOptions createRoleTemplateOptionsModel = new CreateRoleTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .description("testString") + .committed(true) + .role(roleTemplatePrototypeRoleModel) + .acceptLanguage("default") + .build(); + + // Invoke createRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.createRoleTemplate(createRoleTemplateOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createRoleTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createRoleTemplate operation with and without retries enabled + @Test + public void testCreateRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateRoleTemplateWOptions(); + } + + // Test the createRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createRoleTemplate(null).execute(); + } + + // Test the getRoleTemplate operation with a valid options model parameter + @Test + public void testGetRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String getRoleTemplatePath = "/v1/role_templates/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetRoleTemplateOptions model + GetRoleTemplateOptions getRoleTemplateOptionsModel = new GetRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .state("active") + .build(); + + // Invoke getRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.getRoleTemplate(getRoleTemplateOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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, getRoleTemplatePath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + } + + // Test the getRoleTemplate operation with and without retries enabled + @Test + public void testGetRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetRoleTemplateWOptions(); + } + + // Test the getRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getRoleTemplate(null).execute(); + } + + // Test the deleteRoleTemplate operation with a valid options model parameter + @Test + public void testDeleteRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteRoleTemplatePath = "/v1/role_templates/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteRoleTemplateOptions model + DeleteRoleTemplateOptions deleteRoleTemplateOptionsModel = new DeleteRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .build(); + + // Invoke deleteRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteRoleTemplate(deleteRoleTemplateOptionsModel).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, deleteRoleTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteRoleTemplate operation with and without retries enabled + @Test + public void testDeleteRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteRoleTemplateWOptions(); + } + + // Test the deleteRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteRoleTemplate(null).execute(); + } + + // Test the createRoleTemplateVersion operation with a valid options model parameter + @Test + public void testCreateRoleTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String createRoleTemplateVersionPath = "/v1/role_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateRole model + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the CreateRoleTemplateVersionOptions model + CreateRoleTemplateVersionOptions createRoleTemplateVersionOptionsModel = new CreateRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .name("testString") + .description("testString") + .role(templateRoleModel) + .committed(true) + .build(); + + // Invoke createRoleTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.createRoleTemplateVersion(createRoleTemplateVersionOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createRoleTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createRoleTemplateVersion operation with and without retries enabled + @Test + public void testCreateRoleTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateRoleTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateRoleTemplateVersionWOptions(); + } + + // Test the createRoleTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createRoleTemplateVersion(null).execute(); + } + + // Test the listRoleTemplateVersions operation with a valid options model parameter + @Test + public void testListRoleTemplateVersionsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; + String listRoleTemplateVersionsPath = "/v1/role_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListRoleTemplateVersionsOptions model + ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptionsModel = new ListRoleTemplateVersionsOptions.Builder() + .roleTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listRoleTemplateVersions() with a valid options model and verify the result + Response response = iamPolicyManagementService.listRoleTemplateVersions(listRoleTemplateVersionsOptionsModel).execute(); + assertNotNull(response); + RoleTemplateVersionsCollection 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, listRoleTemplateVersionsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listRoleTemplateVersions operation with and without retries enabled + @Test + public void testListRoleTemplateVersionsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListRoleTemplateVersionsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListRoleTemplateVersionsWOptions(); + } + + // Test the listRoleTemplateVersions operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleTemplateVersionsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listRoleTemplateVersions(null).execute(); + } + + // Test the listRoleTemplateVersions operation using the RoleTemplateVersionsPager.getNext() method + @Test + public void testListRoleTemplateVersionsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions = new ListRoleTemplateVersionsOptions.Builder() + .roleTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + RoleTemplateVersionsPager pager = new RoleTemplateVersionsPager(iamPolicyManagementService, listRoleTemplateVersionsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listRoleTemplateVersions operation using the RoleTemplateVersionsPager.getAll() method + @Test + public void testListRoleTemplateVersionsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions = new ListRoleTemplateVersionsOptions.Builder() + .roleTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + RoleTemplateVersionsPager pager = new RoleTemplateVersionsPager(iamPolicyManagementService, listRoleTemplateVersionsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the replaceRoleTemplate operation with a valid options model parameter + @Test + public void testReplaceRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String replaceRoleTemplatePath = "/v1/role_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateRole model + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the ReplaceRoleTemplateOptions model + ReplaceRoleTemplateOptions replaceRoleTemplateOptionsModel = new ReplaceRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .role(templateRoleModel) + .committed(true) + .build(); + + // Invoke replaceRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.replaceRoleTemplate(replaceRoleTemplateOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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, replaceRoleTemplatePath); + // 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 replaceRoleTemplate operation with and without retries enabled + @Test + public void testReplaceRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplaceRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplaceRoleTemplateWOptions(); + } + + // Test the replaceRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replaceRoleTemplate(null).execute(); + } + + // Test the deleteRoleTemplateVersion operation with a valid options model parameter + @Test + public void testDeleteRoleTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteRoleTemplateVersionPath = "/v1/role_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteRoleTemplateVersionOptions model + DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptionsModel = new DeleteRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + + // Invoke deleteRoleTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteRoleTemplateVersion(deleteRoleTemplateVersionOptionsModel).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, deleteRoleTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteRoleTemplateVersion operation with and without retries enabled + @Test + public void testDeleteRoleTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteRoleTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteRoleTemplateVersionWOptions(); + } + + // Test the deleteRoleTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteRoleTemplateVersion(null).execute(); + } + + // Test the getRoleTemplateVersion operation with a valid options model parameter + @Test + public void testGetRoleTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String getRoleTemplateVersionPath = "/v1/role_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetRoleTemplateVersionOptions model + GetRoleTemplateVersionOptions getRoleTemplateVersionOptionsModel = new GetRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + + // Invoke getRoleTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.getRoleTemplateVersion(getRoleTemplateVersionOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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, getRoleTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getRoleTemplateVersion operation with and without retries enabled + @Test + public void testGetRoleTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetRoleTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetRoleTemplateVersionWOptions(); + } + + // Test the getRoleTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getRoleTemplateVersion(null).execute(); + } + + // Test the commitRoleTemplate operation with a valid options model parameter + @Test + public void testCommitRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String commitRoleTemplatePath = "/v1/role_templates/testString/versions/testString/commit"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the CommitRoleTemplateOptions model + CommitRoleTemplateOptions commitRoleTemplateOptionsModel = new CommitRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + + // Invoke commitRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.commitRoleTemplate(commitRoleTemplateOptionsModel).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, commitRoleTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the commitRoleTemplate operation with and without retries enabled + @Test + public void testCommitRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCommitRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCommitRoleTemplateWOptions(); + } + + // Test the commitRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.commitRoleTemplate(null).execute(); + } + + // Test the listRoleAssignments operation with a valid options model parameter + @Test + public void testListRoleAssignmentsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; + String listRoleAssignmentsPath = "/v1/role_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListRoleAssignmentsOptions model + ListRoleAssignmentsOptions listRoleAssignmentsOptionsModel = new ListRoleAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listRoleAssignments() with a valid options model and verify the result + Response response = iamPolicyManagementService.listRoleAssignments(listRoleAssignmentsOptionsModel).execute(); + assertNotNull(response); + RoleAssignmentCollection 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, listRoleAssignmentsPath); + // 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(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listRoleAssignments operation with and without retries enabled + @Test + public void testListRoleAssignmentsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListRoleAssignmentsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListRoleAssignmentsWOptions(); + } + + // Test the listRoleAssignments operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleAssignmentsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listRoleAssignments(null).execute(); + } + + // Test the listRoleAssignments operation using the RoleAssignmentsPager.getNext() method + @Test + public void testListRoleAssignmentsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleAssignmentsOptions listRoleAssignmentsOptions = new ListRoleAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + RoleAssignmentsPager pager = new RoleAssignmentsPager(iamPolicyManagementService, listRoleAssignmentsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listRoleAssignments operation using the RoleAssignmentsPager.getAll() method + @Test + public void testListRoleAssignmentsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleAssignmentsOptions listRoleAssignmentsOptions = new ListRoleAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + RoleAssignmentsPager pager = new RoleAssignmentsPager(iamPolicyManagementService, listRoleAssignmentsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createRoleTemplateAssignment operation with a valid options model parameter + @Test + public void testCreateRoleTemplateAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; + String createRoleTemplateAssignmentPath = "/v1/role_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the AssignmentTargetDetails model + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + + // Construct an instance of the RoleAssignmentTemplate model + RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + + // Construct an instance of the CreateRoleTemplateAssignmentOptions model + CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptionsModel = new CreateRoleTemplateAssignmentOptions.Builder() + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(roleAssignmentTemplateModel)) + .acceptLanguage("default") + .build(); + + // Invoke createRoleTemplateAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.createRoleTemplateAssignment(createRoleTemplateAssignmentOptionsModel).execute(); + assertNotNull(response); + RoleAssignmentCollection 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createRoleTemplateAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createRoleTemplateAssignment operation with and without retries enabled + @Test + public void testCreateRoleTemplateAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateRoleTemplateAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateRoleTemplateAssignmentWOptions(); + } + + // Test the createRoleTemplateAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createRoleTemplateAssignment(null).execute(); + } + + // Test the getRoleAssignment operation with a valid options model parameter + @Test + public void testGetRoleAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; + String getRoleAssignmentPath = "/v1/role_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetRoleAssignmentOptions model + GetRoleAssignmentOptions getRoleAssignmentOptionsModel = new GetRoleAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke getRoleAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.getRoleAssignment(getRoleAssignmentOptionsModel).execute(); + assertNotNull(response); + RoleAssignment 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, getRoleAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getRoleAssignment operation with and without retries enabled + @Test + public void testGetRoleAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetRoleAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetRoleAssignmentWOptions(); + } + + // Test the getRoleAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getRoleAssignment(null).execute(); + } + + // Test the updateRoleAssignment operation with a valid options model parameter + @Test + public void testUpdateRoleAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; + String updateRoleAssignmentPath = "/v1/role_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdateRoleAssignmentOptions model + UpdateRoleAssignmentOptions updateRoleAssignmentOptionsModel = new UpdateRoleAssignmentOptions.Builder() + .assignmentId("testString") + .ifMatch("testString") + .templateVersion("testString") + .build(); + + // Invoke updateRoleAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.updateRoleAssignment(updateRoleAssignmentOptionsModel).execute(); + assertNotNull(response); + RoleAssignment 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updateRoleAssignmentPath); + // 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 updateRoleAssignment operation with and without retries enabled + @Test + public void testUpdateRoleAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdateRoleAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdateRoleAssignmentWOptions(); + } + + // Test the updateRoleAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateRoleAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updateRoleAssignment(null).execute(); + } + + // Test the deleteRoleAssignment operation with a valid options model parameter + @Test + public void testDeleteRoleAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteRoleAssignmentPath = "/v1/role_assignments/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteRoleAssignmentOptions model + DeleteRoleAssignmentOptions deleteRoleAssignmentOptionsModel = new DeleteRoleAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke deleteRoleAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteRoleAssignment(deleteRoleAssignmentOptionsModel).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, deleteRoleAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteRoleAssignment operation with and without retries enabled + @Test + public void testDeleteRoleAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteRoleAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteRoleAssignmentWOptions(); + } + + // Test the deleteRoleAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteRoleAssignment(null).execute(); + } + + // Perform setup needed before each test method + @BeforeMethod + public void beforeEachTest() { + // Start the mock server. + try { + server = new MockWebServer(); + server.start(); + } catch (IOException err) { + fail("Failed to instantiate mock web server"); + } + + // Construct an instance of the service + constructClientService(); + } + + // Perform tear down after each test method + @AfterMethod + public void afterEachTest() throws IOException { + server.shutdown(); + iamPolicyManagementService = null; + } + + // Constructs an instance of the service to be used by the tests + public void constructClientService() { + System.setProperty("TESTSERVICE_AUTH_TYPE", "noAuth"); + final String serviceName = "testService"; + + iamPolicyManagementService = IamPolicyManagement.newInstance(serviceName); + String url = server.url("/").toString(); + iamPolicyManagementService.setServiceUrl(url); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java new file mode 100644 index 00000000000..5630ccb0c03 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.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 AccountSettingsAccessManagement model. + */ +public class AccountSettingsAccessManagementTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAccountSettingsAccessManagement() throws Throwable { + AccountSettingsAccessManagement accountSettingsAccessManagementModel = new AccountSettingsAccessManagement(); + assertNull(accountSettingsAccessManagementModel.getExternalAccountIdentityInteraction()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java new file mode 100644 index 00000000000..d4dfc8863c6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentCollection model. + */ +public class ActionControlAssignmentCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentCollection() throws Throwable { + ActionControlAssignmentCollection actionControlAssignmentCollectionModel = new ActionControlAssignmentCollection(); + assertNull(actionControlAssignmentCollectionModel.getLimit()); + assertNull(actionControlAssignmentCollectionModel.getFirst()); + assertNull(actionControlAssignmentCollectionModel.getNext()); + assertNull(actionControlAssignmentCollectionModel.getPrevious()); + assertNull(actionControlAssignmentCollectionModel.getAssignments()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java new file mode 100644 index 00000000000..cb53bc44d1c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java @@ -0,0 +1,43 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResourceActionControl model. + */ +public class ActionControlAssignmentResourceActionControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentResourceActionControl() throws Throwable { + ActionControlAssignmentResourceActionControl actionControlAssignmentResourceActionControlModel = new ActionControlAssignmentResourceActionControl(); + assertNull(actionControlAssignmentResourceActionControlModel.getResourceCreated()); + assertNull(actionControlAssignmentResourceActionControlModel.getErrorMessage()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java new file mode 100644 index 00000000000..284ec17a0f0 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResourceCreated model. + */ +public class ActionControlAssignmentResourceCreatedTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentResourceCreated() throws Throwable { + ActionControlAssignmentResourceCreated actionControlAssignmentResourceCreatedModel = new ActionControlAssignmentResourceCreated(); + assertNull(actionControlAssignmentResourceCreatedModel.getId()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java new file mode 100644 index 00000000000..eaa560dce78 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResource model. + */ +public class ActionControlAssignmentResourceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentResource() throws Throwable { + ActionControlAssignmentResource actionControlAssignmentResourceModel = new ActionControlAssignmentResource(); + assertNull(actionControlAssignmentResourceModel.getTarget()); + assertNull(actionControlAssignmentResourceModel.getActionControl()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java new file mode 100644 index 00000000000..262a74bea45 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentTemplate model. + */ +public class ActionControlAssignmentTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentTemplate() throws Throwable { + ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(actionControlAssignmentTemplateModel.id(), "testString"); + assertEquals(actionControlAssignmentTemplateModel.version(), "testString"); + + String json = TestUtilities.serialize(actionControlAssignmentTemplateModel); + + ActionControlAssignmentTemplate actionControlAssignmentTemplateModelNew = TestUtilities.deserialize(json, ActionControlAssignmentTemplate.class); + assertTrue(actionControlAssignmentTemplateModelNew instanceof ActionControlAssignmentTemplate); + assertEquals(actionControlAssignmentTemplateModelNew.id(), "testString"); + assertEquals(actionControlAssignmentTemplateModelNew.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testActionControlAssignmentTemplateError() throws Throwable { + new ActionControlAssignmentTemplate.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java new file mode 100644 index 00000000000..c5173f940c4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignment model. + */ +public class ActionControlAssignmentTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignment() throws Throwable { + ActionControlAssignment actionControlAssignmentModel = new ActionControlAssignment(); + assertNull(actionControlAssignmentModel.getTemplate()); + assertNull(actionControlAssignmentModel.getTarget()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java new file mode 100644 index 00000000000..58155ee1e7e --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java @@ -0,0 +1,46 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplateCollection model. + */ +public class ActionControlTemplateCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlTemplateCollection() throws Throwable { + ActionControlTemplateCollection actionControlTemplateCollectionModel = new ActionControlTemplateCollection(); + assertNull(actionControlTemplateCollectionModel.getLimit()); + assertNull(actionControlTemplateCollectionModel.getFirst()); + assertNull(actionControlTemplateCollectionModel.getNext()); + assertNull(actionControlTemplateCollectionModel.getPrevious()); + assertNull(actionControlTemplateCollectionModel.getActionControlTemplates()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java new file mode 100644 index 00000000000..a086106a57e --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplate model. + */ +public class ActionControlTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlTemplate() throws Throwable { + ActionControlTemplate actionControlTemplateModel = new ActionControlTemplate(); + assertNull(actionControlTemplateModel.getName()); + assertNull(actionControlTemplateModel.getDescription()); + assertNull(actionControlTemplateModel.getAccountId()); + assertNull(actionControlTemplateModel.isCommitted()); + assertNull(actionControlTemplateModel.getActionControl()); + assertNull(actionControlTemplateModel.getVersion()); + assertNull(actionControlTemplateModel.getState()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java new file mode 100644 index 00000000000..7b6bf014357 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java @@ -0,0 +1,46 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplateVersionsCollection model. + */ +public class ActionControlTemplateVersionsCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlTemplateVersionsCollection() throws Throwable { + ActionControlTemplateVersionsCollection actionControlTemplateVersionsCollectionModel = new ActionControlTemplateVersionsCollection(); + assertNull(actionControlTemplateVersionsCollectionModel.getLimit()); + assertNull(actionControlTemplateVersionsCollectionModel.getFirst()); + assertNull(actionControlTemplateVersionsCollectionModel.getNext()); + assertNull(actionControlTemplateVersionsCollectionModel.getPrevious()); + assertNull(actionControlTemplateVersionsCollectionModel.getVersions()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java new file mode 100644 index 00000000000..4038d52606c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentResourceCreated model. + */ +public class AssignmentResourceCreatedTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAssignmentResourceCreated() throws Throwable { + AssignmentResourceCreated assignmentResourceCreatedModel = new AssignmentResourceCreated(); + assertNull(assignmentResourceCreatedModel.getId()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java new file mode 100644 index 00000000000..81e3799a42c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentResourceError model. + */ +public class AssignmentResourceErrorTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAssignmentResourceError() throws Throwable { + AssignmentResourceError assignmentResourceErrorModel = new AssignmentResourceError(); + assertNull(assignmentResourceErrorModel.getName()); + assertNull(assignmentResourceErrorModel.getErrorCode()); + assertNull(assignmentResourceErrorModel.getMessage()); + assertNull(assignmentResourceErrorModel.getCode()); + assertNull(assignmentResourceErrorModel.getErrors()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java new file mode 100644 index 00000000000..48e4a605cbb --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentTargetDetails model. + */ +public class AssignmentTargetDetailsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAssignmentTargetDetails() throws Throwable { + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + assertEquals(assignmentTargetDetailsModel.type(), "Account"); + assertEquals(assignmentTargetDetailsModel.id(), "testString"); + + String json = TestUtilities.serialize(assignmentTargetDetailsModel); + + AssignmentTargetDetails assignmentTargetDetailsModelNew = TestUtilities.deserialize(json, AssignmentTargetDetails.class); + assertTrue(assignmentTargetDetailsModelNew instanceof AssignmentTargetDetails); + assertEquals(assignmentTargetDetailsModelNew.type(), "Account"); + assertEquals(assignmentTargetDetailsModelNew.id(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testAssignmentTargetDetailsError() throws Throwable { + new AssignmentTargetDetails.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java new file mode 100644 index 00000000000..bcecf27ed27 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java @@ -0,0 +1,48 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentTemplateDetails model. + */ +public class AssignmentTemplateDetailsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAssignmentTemplateDetails() throws Throwable { + AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(assignmentTemplateDetailsModel.id(), "testString"); + assertEquals(assignmentTemplateDetailsModel.version(), "testString"); + + String json = TestUtilities.serialize(assignmentTemplateDetailsModel); + + AssignmentTemplateDetails assignmentTemplateDetailsModelNew = TestUtilities.deserialize(json, AssignmentTemplateDetails.class); + assertTrue(assignmentTemplateDetailsModelNew instanceof AssignmentTemplateDetails); + assertEquals(assignmentTemplateDetailsModelNew.id(), "testString"); + assertEquals(assignmentTemplateDetailsModelNew.version(), "testString"); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..2b5ed42c76a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CommitActionControlTemplateOptions model. + */ +public class CommitActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCommitActionControlTemplateOptions() throws Throwable { + CommitActionControlTemplateOptions commitActionControlTemplateOptionsModel = new CommitActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + assertEquals(commitActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(commitActionControlTemplateOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitActionControlTemplateOptionsError() throws Throwable { + new CommitActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..66cdca59588 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CommitPolicyTemplateOptions model. + */ +public class CommitPolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCommitPolicyTemplateOptions() throws Throwable { + CommitPolicyTemplateOptions commitPolicyTemplateOptionsModel = new CommitPolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + assertEquals(commitPolicyTemplateOptionsModel.policyTemplateId(), "testString"); + assertEquals(commitPolicyTemplateOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitPolicyTemplateOptionsError() throws Throwable { + new CommitPolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..09c48b8e80e --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CommitRoleTemplateOptions model. + */ +public class CommitRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCommitRoleTemplateOptions() throws Throwable { + CommitRoleTemplateOptions commitRoleTemplateOptionsModel = new CommitRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + assertEquals(commitRoleTemplateOptionsModel.roleTemplateId(), "testString"); + assertEquals(commitRoleTemplateOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitRoleTemplateOptionsError() throws Throwable { + new CommitRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java new file mode 100644 index 00000000000..94ef6ce21e8 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.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 ConflictsWith model. + */ +public class ConflictsWithTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testConflictsWith() throws Throwable { + ConflictsWith conflictsWithModel = new ConflictsWith(); + assertNull(conflictsWithModel.getEtag()); + assertNull(conflictsWithModel.getRole()); + assertNull(conflictsWithModel.getPolicy()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java new file mode 100644 index 00000000000..bbe19a7b9b1 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponseControl model. + */ +public class ControlResponseControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testControlResponseControl() throws Throwable { + ControlResponseControl controlResponseControlModel = new ControlResponseControl(); + assertNull(controlResponseControlModel.getGrant()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java new file mode 100644 index 00000000000..7b2fbfae90d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControlWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponseControlWithEnrichedRoles model. + */ +public class ControlResponseControlWithEnrichedRolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testControlResponseControlWithEnrichedRoles() throws Throwable { + ControlResponseControlWithEnrichedRoles controlResponseControlWithEnrichedRolesModel = new ControlResponseControlWithEnrichedRoles(); + assertNull(controlResponseControlWithEnrichedRolesModel.getGrant()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java new file mode 100644 index 00000000000..f42cbc0a2d8 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponse; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponse model. + */ +public class ControlResponseTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testControlResponse() throws Throwable { + ControlResponse controlResponseModel = new ControlResponse(); + assertNotNull(controlResponseModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java new file mode 100644 index 00000000000..c8b1e3000f9 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 Control model. + */ +public class ControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testControl() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + assertEquals(controlModel.grant(), grantModel); + + String json = TestUtilities.serialize(controlModel); + + Control controlModelNew = TestUtilities.deserialize(json, Control.class); + assertTrue(controlModelNew instanceof Control); + assertEquals(controlModelNew.grant().toString(), grantModel.toString()); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testControlError() throws Throwable { + new Control.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java new file mode 100644 index 00000000000..f2557c8f64f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateAssignmentOptions model. + */ +public class CreateActionControlTemplateAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateActionControlTemplateAssignmentOptions() throws Throwable { + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + assertEquals(assignmentTargetDetailsModel.type(), "Account"); + assertEquals(assignmentTargetDetailsModel.id(), "testString"); + + ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(actionControlAssignmentTemplateModel.id(), "testString"); + assertEquals(actionControlAssignmentTemplateModel.version(), "testString"); + + CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptionsModel = new CreateActionControlTemplateAssignmentOptions.Builder() + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(actionControlAssignmentTemplateModel)) + .acceptLanguage("default") + .build(); + assertEquals(createActionControlTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); + assertEquals(createActionControlTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(actionControlAssignmentTemplateModel)); + assertEquals(createActionControlTemplateAssignmentOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateAssignmentOptionsError() throws Throwable { + new CreateActionControlTemplateAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..2508072a03c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateOptions model. + */ +public class CreateActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateActionControlTemplateOptions() throws Throwable { + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateActionControlModel.serviceName(), "testString"); + assertEquals(templateActionControlModel.description(), "testString"); + assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); + + CreateActionControlTemplateOptions createActionControlTemplateOptionsModel = new CreateActionControlTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .description("testString") + .committed(true) + .actionControl(templateActionControlModel) + .acceptLanguage("default") + .build(); + assertEquals(createActionControlTemplateOptionsModel.name(), "testString"); + assertEquals(createActionControlTemplateOptionsModel.accountId(), "testString"); + assertEquals(createActionControlTemplateOptionsModel.description(), "testString"); + assertEquals(createActionControlTemplateOptionsModel.committed(), Boolean.valueOf(true)); + assertEquals(createActionControlTemplateOptionsModel.actionControl(), templateActionControlModel); + assertEquals(createActionControlTemplateOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateOptionsError() throws Throwable { + new CreateActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..d5070249115 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateVersionOptions model. + */ +public class CreateActionControlTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateActionControlTemplateVersionOptions() throws Throwable { + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateActionControlModel.serviceName(), "testString"); + assertEquals(templateActionControlModel.description(), "testString"); + assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); + + CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptionsModel = new CreateActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .name("testString") + .description("testString") + .actionControl(templateActionControlModel) + .committed(true) + .build(); + assertEquals(createActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(createActionControlTemplateVersionOptionsModel.name(), "testString"); + assertEquals(createActionControlTemplateVersionOptionsModel.description(), "testString"); + assertEquals(createActionControlTemplateVersionOptionsModel.actionControl(), templateActionControlModel); + assertEquals(createActionControlTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateVersionOptionsError() throws Throwable { + new CreateActionControlTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java new file mode 100644 index 00000000000..c2dd24fd213 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java @@ -0,0 +1,103 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyOptions model. + */ +public class CreatePolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreatePolicyOptions() throws Throwable { + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(subjectAttributeModel.name(), "testString"); + assertEquals(subjectAttributeModel.value(), "testString"); + + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); + + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + assertEquals(policyRoleModel.roleId(), "testString"); + + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceAttributeModel.name(), "testString"); + assertEquals(resourceAttributeModel.value(), "testString"); + assertEquals(resourceAttributeModel.operator(), "testString"); + + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceTagModel.name(), "testString"); + assertEquals(resourceTagModel.value(), "testString"); + assertEquals(resourceTagModel.operator(), "testString"); + + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); + assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); + + CreatePolicyOptions createPolicyOptionsModel = new CreatePolicyOptions.Builder() + .type("testString") + .subjects(java.util.Arrays.asList(policySubjectModel)) + .roles(java.util.Arrays.asList(policyRoleModel)) + .resources(java.util.Arrays.asList(policyResourceModel)) + .description("testString") + .acceptLanguage("default") + .build(); + assertEquals(createPolicyOptionsModel.type(), "testString"); + assertEquals(createPolicyOptionsModel.subjects(), java.util.Arrays.asList(policySubjectModel)); + assertEquals(createPolicyOptionsModel.roles(), java.util.Arrays.asList(policyRoleModel)); + assertEquals(createPolicyOptionsModel.resources(), java.util.Arrays.asList(policyResourceModel)); + assertEquals(createPolicyOptionsModel.description(), "testString"); + assertEquals(createPolicyOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyOptionsError() throws Throwable { + new CreatePolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java new file mode 100644 index 00000000000..5b08b4b398a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java @@ -0,0 +1,67 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateAssignmentOptions model. + */ +public class CreatePolicyTemplateAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreatePolicyTemplateAssignmentOptions() throws Throwable { + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + assertEquals(assignmentTargetDetailsModel.type(), "Account"); + assertEquals(assignmentTargetDetailsModel.id(), "testString"); + + AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(assignmentTemplateDetailsModel.id(), "testString"); + assertEquals(assignmentTemplateDetailsModel.version(), "testString"); + + CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptionsModel = new CreatePolicyTemplateAssignmentOptions.Builder() + .version("1.0") + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(assignmentTemplateDetailsModel)) + .acceptLanguage("default") + .build(); + assertEquals(createPolicyTemplateAssignmentOptionsModel.version(), "1.0"); + assertEquals(createPolicyTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); + assertEquals(createPolicyTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(assignmentTemplateDetailsModel)); + assertEquals(createPolicyTemplateAssignmentOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateAssignmentOptionsError() throws Throwable { + new CreatePolicyTemplateAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..68617451831 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java @@ -0,0 +1,145 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateOptions model. + */ +public class CreatePolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreatePolicyTemplateOptions() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + assertEquals(templatePolicyModel.type(), "access"); + assertEquals(templatePolicyModel.description(), "testString"); + assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); + assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); + assertEquals(templatePolicyModel.pattern(), "testString"); + assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); + assertEquals(templatePolicyModel.control(), templateControlModel); + + CreatePolicyTemplateOptions createPolicyTemplateOptionsModel = new CreatePolicyTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .policy(templatePolicyModel) + .description("testString") + .committed(true) + .acceptLanguage("default") + .build(); + assertEquals(createPolicyTemplateOptionsModel.name(), "testString"); + assertEquals(createPolicyTemplateOptionsModel.accountId(), "testString"); + assertEquals(createPolicyTemplateOptionsModel.policy(), templatePolicyModel); + assertEquals(createPolicyTemplateOptionsModel.description(), "testString"); + assertEquals(createPolicyTemplateOptionsModel.committed(), Boolean.valueOf(true)); + assertEquals(createPolicyTemplateOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateOptionsError() throws Throwable { + new CreatePolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..d6919e6e1b9 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java @@ -0,0 +1,143 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateVersionOptions model. + */ +public class CreatePolicyTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreatePolicyTemplateVersionOptions() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + assertEquals(templatePolicyModel.type(), "access"); + assertEquals(templatePolicyModel.description(), "testString"); + assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); + assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); + assertEquals(templatePolicyModel.pattern(), "testString"); + assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); + assertEquals(templatePolicyModel.control(), templateControlModel); + + CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptionsModel = new CreatePolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .policy(templatePolicyModel) + .name("testString") + .description("testString") + .committed(true) + .build(); + assertEquals(createPolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); + assertEquals(createPolicyTemplateVersionOptionsModel.policy(), templatePolicyModel); + assertEquals(createPolicyTemplateVersionOptionsModel.name(), "testString"); + assertEquals(createPolicyTemplateVersionOptionsModel.description(), "testString"); + assertEquals(createPolicyTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateVersionOptionsError() throws Throwable { + new CreatePolicyTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java new file mode 100644 index 00000000000..849512f2bda --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleOptions model. + */ +public class CreateRoleOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateRoleOptions() throws Throwable { + CreateRoleOptions createRoleOptionsModel = new CreateRoleOptions.Builder() + .displayName("testString") + .actions(java.util.Arrays.asList("testString")) + .name("Developer") + .accountId("testString") + .serviceName("iam-groups") + .description("testString") + .acceptLanguage("default") + .build(); + assertEquals(createRoleOptionsModel.displayName(), "testString"); + assertEquals(createRoleOptionsModel.actions(), java.util.Arrays.asList("testString")); + assertEquals(createRoleOptionsModel.name(), "Developer"); + assertEquals(createRoleOptionsModel.accountId(), "testString"); + assertEquals(createRoleOptionsModel.serviceName(), "iam-groups"); + assertEquals(createRoleOptionsModel.description(), "testString"); + assertEquals(createRoleOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleOptionsError() throws Throwable { + new CreateRoleOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java new file mode 100644 index 00000000000..bff414389a5 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateAssignmentOptions model. + */ +public class CreateRoleTemplateAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateRoleTemplateAssignmentOptions() throws Throwable { + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + assertEquals(assignmentTargetDetailsModel.type(), "Account"); + assertEquals(assignmentTargetDetailsModel.id(), "testString"); + + RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleAssignmentTemplateModel.id(), "testString"); + assertEquals(roleAssignmentTemplateModel.version(), "testString"); + + CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptionsModel = new CreateRoleTemplateAssignmentOptions.Builder() + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(roleAssignmentTemplateModel)) + .acceptLanguage("default") + .build(); + assertEquals(createRoleTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); + assertEquals(createRoleTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(roleAssignmentTemplateModel)); + assertEquals(createRoleTemplateAssignmentOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateAssignmentOptionsError() throws Throwable { + new CreateRoleTemplateAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..799743ddbf4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateOptions model. + */ +public class CreateRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateRoleTemplateOptions() throws Throwable { + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() + .name("testString") + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(roleTemplatePrototypeRoleModel.name(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.displayName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.serviceName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.description(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.actions(), java.util.Arrays.asList("testString")); + + CreateRoleTemplateOptions createRoleTemplateOptionsModel = new CreateRoleTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .description("testString") + .committed(true) + .role(roleTemplatePrototypeRoleModel) + .acceptLanguage("default") + .build(); + assertEquals(createRoleTemplateOptionsModel.name(), "testString"); + assertEquals(createRoleTemplateOptionsModel.accountId(), "testString"); + assertEquals(createRoleTemplateOptionsModel.description(), "testString"); + assertEquals(createRoleTemplateOptionsModel.committed(), Boolean.valueOf(true)); + assertEquals(createRoleTemplateOptionsModel.role(), roleTemplatePrototypeRoleModel); + assertEquals(createRoleTemplateOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateOptionsError() throws Throwable { + new CreateRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..a7d2d312afa --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateVersionOptions model. + */ +public class CreateRoleTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateRoleTemplateVersionOptions() throws Throwable { + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateRoleModel.displayName(), "testString"); + assertEquals(templateRoleModel.serviceName(), "testString"); + assertEquals(templateRoleModel.description(), "testString"); + assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); + + CreateRoleTemplateVersionOptions createRoleTemplateVersionOptionsModel = new CreateRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .name("testString") + .description("testString") + .role(templateRoleModel) + .committed(true) + .build(); + assertEquals(createRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); + assertEquals(createRoleTemplateVersionOptionsModel.name(), "testString"); + assertEquals(createRoleTemplateVersionOptionsModel.description(), "testString"); + assertEquals(createRoleTemplateVersionOptionsModel.role(), templateRoleModel); + assertEquals(createRoleTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateVersionOptionsError() throws Throwable { + new CreateRoleTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java new file mode 100644 index 00000000000..acce8b7b537 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java @@ -0,0 +1,131 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateV2PolicyOptions model. + */ +public class CreateV2PolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateV2PolicyOptions() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + assertEquals(controlModel.grant(), grantModel); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + CreateV2PolicyOptions createV2PolicyOptionsModel = new CreateV2PolicyOptions.Builder() + .control(controlModel) + .type("access") + .description("testString") + .subject(v2PolicySubjectModel) + .resource(v2PolicyResourceModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .acceptLanguage("default") + .build(); + assertEquals(createV2PolicyOptionsModel.control(), controlModel); + assertEquals(createV2PolicyOptionsModel.type(), "access"); + assertEquals(createV2PolicyOptionsModel.description(), "testString"); + assertEquals(createV2PolicyOptionsModel.subject(), v2PolicySubjectModel); + assertEquals(createV2PolicyOptionsModel.resource(), v2PolicyResourceModel); + assertEquals(createV2PolicyOptionsModel.pattern(), "testString"); + assertEquals(createV2PolicyOptionsModel.rule(), v2PolicyRuleModel); + assertEquals(createV2PolicyOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateV2PolicyOptionsError() throws Throwable { + new CreateV2PolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java new file mode 100644 index 00000000000..acc0dc0a3c1 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 CustomRole model. + */ +public class CustomRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCustomRole() throws Throwable { + CustomRole customRoleModel = new CustomRole(); + assertNull(customRoleModel.getDisplayName()); + assertNull(customRoleModel.getDescription()); + assertNull(customRoleModel.getActions()); + assertNull(customRoleModel.getName()); + assertNull(customRoleModel.getAccountId()); + assertNull(customRoleModel.getServiceName()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java new file mode 100644 index 00000000000..1a38606ede5 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlAssignmentOptions model. + */ +public class DeleteActionControlAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteActionControlAssignmentOptions() throws Throwable { + DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptionsModel = new DeleteActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(deleteActionControlAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlAssignmentOptionsError() throws Throwable { + new DeleteActionControlAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..75b111e9214 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlTemplateOptions model. + */ +public class DeleteActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteActionControlTemplateOptions() throws Throwable { + DeleteActionControlTemplateOptions deleteActionControlTemplateOptionsModel = new DeleteActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .build(); + assertEquals(deleteActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlTemplateOptionsError() throws Throwable { + new DeleteActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..64fb5790244 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlTemplateVersionOptions model. + */ +public class DeleteActionControlTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteActionControlTemplateVersionOptions() throws Throwable { + DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptionsModel = new DeleteActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + assertEquals(deleteActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(deleteActionControlTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlTemplateVersionOptionsError() throws Throwable { + new DeleteActionControlTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java new file mode 100644 index 00000000000..75aed905222 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyAssignmentOptions model. + */ +public class DeletePolicyAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeletePolicyAssignmentOptions() throws Throwable { + DeletePolicyAssignmentOptions deletePolicyAssignmentOptionsModel = new DeletePolicyAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(deletePolicyAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyAssignmentOptionsError() throws Throwable { + new DeletePolicyAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java new file mode 100644 index 00000000000..1b130eb0f79 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyOptions model. + */ +public class DeletePolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeletePolicyOptions() throws Throwable { + DeletePolicyOptions deletePolicyOptionsModel = new DeletePolicyOptions.Builder() + .policyId("testString") + .build(); + assertEquals(deletePolicyOptionsModel.policyId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyOptionsError() throws Throwable { + new DeletePolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..288517222aa --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyTemplateOptions model. + */ +public class DeletePolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeletePolicyTemplateOptions() throws Throwable { + DeletePolicyTemplateOptions deletePolicyTemplateOptionsModel = new DeletePolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .build(); + assertEquals(deletePolicyTemplateOptionsModel.policyTemplateId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyTemplateOptionsError() throws Throwable { + new DeletePolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..7b1c6cffa1d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyTemplateVersionOptions model. + */ +public class DeletePolicyTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeletePolicyTemplateVersionOptions() throws Throwable { + DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptionsModel = new DeletePolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + assertEquals(deletePolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); + assertEquals(deletePolicyTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyTemplateVersionOptionsError() throws Throwable { + new DeletePolicyTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java new file mode 100644 index 00000000000..7f9b614304f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleAssignmentOptions model. + */ +public class DeleteRoleAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteRoleAssignmentOptions() throws Throwable { + DeleteRoleAssignmentOptions deleteRoleAssignmentOptionsModel = new DeleteRoleAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(deleteRoleAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleAssignmentOptionsError() throws Throwable { + new DeleteRoleAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java new file mode 100644 index 00000000000..9c6690cda7b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleOptions model. + */ +public class DeleteRoleOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteRoleOptions() throws Throwable { + DeleteRoleOptions deleteRoleOptionsModel = new DeleteRoleOptions.Builder() + .roleId("testString") + .build(); + assertEquals(deleteRoleOptionsModel.roleId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleOptionsError() throws Throwable { + new DeleteRoleOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..3fc04286ed3 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleTemplateOptions model. + */ +public class DeleteRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteRoleTemplateOptions() throws Throwable { + DeleteRoleTemplateOptions deleteRoleTemplateOptionsModel = new DeleteRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .build(); + assertEquals(deleteRoleTemplateOptionsModel.roleTemplateId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleTemplateOptionsError() throws Throwable { + new DeleteRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..ff652fa335c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleTemplateVersionOptions model. + */ +public class DeleteRoleTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteRoleTemplateVersionOptions() throws Throwable { + DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptionsModel = new DeleteRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + assertEquals(deleteRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); + assertEquals(deleteRoleTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleTemplateVersionOptionsError() throws Throwable { + new DeleteRoleTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java new file mode 100644 index 00000000000..6a33aa8f116 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteV2PolicyOptions model. + */ +public class DeleteV2PolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteV2PolicyOptions() throws Throwable { + DeleteV2PolicyOptions deleteV2PolicyOptionsModel = new DeleteV2PolicyOptions.Builder() + .id("testString") + .build(); + assertEquals(deleteV2PolicyOptionsModel.id(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteV2PolicyOptionsError() throws Throwable { + new DeleteV2PolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java new file mode 100644 index 00000000000..104a5210ed9 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.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 EnrichedRoles model. + */ +public class EnrichedRolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testEnrichedRoles() throws Throwable { + EnrichedRoles enrichedRolesModel = new EnrichedRoles(); + assertNull(enrichedRolesModel.getRoleId()); + assertNull(enrichedRolesModel.getActions()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java new file mode 100644 index 00000000000..460b37f8105 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.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 ErrorDetails model. + */ +public class ErrorDetailsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testErrorDetails() throws Throwable { + ErrorDetails errorDetailsModel = new ErrorDetails(); + assertNull(errorDetailsModel.getConflictsWith()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java new file mode 100644 index 00000000000..e7f7f9afbfc --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.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 ErrorObject model. + */ +public class ErrorObjectTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testErrorObject() throws Throwable { + ErrorObject errorObjectModel = new ErrorObject(); + assertNull(errorObjectModel.getCode()); + assertNull(errorObjectModel.getMessage()); + assertNull(errorObjectModel.getDetails()); + assertNull(errorObjectModel.getMoreInfo()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java new file mode 100644 index 00000000000..90c91c8fcaf --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; +import com.ibm.cloud.platform_services.iam_policy_management.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 ExternalAccountIdentityInteractionPatch model. + */ +public class ExternalAccountIdentityInteractionPatchTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testExternalAccountIdentityInteractionPatch() throws Throwable { + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + assertEquals(identityTypesBaseModel.state(), "enabled"); + assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); + + IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() + .user(identityTypesBaseModel) + .serviceId(identityTypesBaseModel) + .service(identityTypesBaseModel) + .build(); + assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); + + ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() + .identityTypes(identityTypesPatchModel) + .build(); + assertEquals(externalAccountIdentityInteractionPatchModel.identityTypes(), identityTypesPatchModel); + + String json = TestUtilities.serialize(externalAccountIdentityInteractionPatchModel); + + ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModelNew = TestUtilities.deserialize(json, ExternalAccountIdentityInteractionPatch.class); + assertTrue(externalAccountIdentityInteractionPatchModelNew instanceof ExternalAccountIdentityInteractionPatch); + assertEquals(externalAccountIdentityInteractionPatchModelNew.identityTypes().toString(), identityTypesPatchModel.toString()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java new file mode 100644 index 00000000000..2e4aaef7e07 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.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 ExternalAccountIdentityInteraction model. + */ +public class ExternalAccountIdentityInteractionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testExternalAccountIdentityInteraction() throws Throwable { + ExternalAccountIdentityInteraction externalAccountIdentityInteractionModel = new ExternalAccountIdentityInteraction(); + assertNull(externalAccountIdentityInteractionModel.getIdentityTypes()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java new file mode 100644 index 00000000000..b4d68673091 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java @@ -0,0 +1,36 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.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 First model. + */ +public class FirstTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testFirst() throws Throwable { + First firstModel = new First(); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java new file mode 100644 index 00000000000..73e66a5a756 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlAssignmentOptions model. + */ +public class GetActionControlAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetActionControlAssignmentOptions() throws Throwable { + GetActionControlAssignmentOptions getActionControlAssignmentOptionsModel = new GetActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(getActionControlAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlAssignmentOptionsError() throws Throwable { + new GetActionControlAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..d6e66ce6939 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlTemplateOptions model. + */ +public class GetActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetActionControlTemplateOptions() throws Throwable { + GetActionControlTemplateOptions getActionControlTemplateOptionsModel = new GetActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .build(); + assertEquals(getActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(getActionControlTemplateOptionsModel.state(), "active"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlTemplateOptionsError() throws Throwable { + new GetActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..ac8e17fe083 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlTemplateVersionOptions model. + */ +public class GetActionControlTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetActionControlTemplateVersionOptions() throws Throwable { + GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptionsModel = new GetActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + assertEquals(getActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(getActionControlTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlTemplateVersionOptionsError() throws Throwable { + new GetActionControlTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java new file mode 100644 index 00000000000..6b2a479c37d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyAssignmentOptions model. + */ +public class GetPolicyAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetPolicyAssignmentOptions() throws Throwable { + GetPolicyAssignmentOptions getPolicyAssignmentOptionsModel = new GetPolicyAssignmentOptions.Builder() + .assignmentId("testString") + .version("1.0") + .build(); + assertEquals(getPolicyAssignmentOptionsModel.assignmentId(), "testString"); + assertEquals(getPolicyAssignmentOptionsModel.version(), "1.0"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyAssignmentOptionsError() throws Throwable { + new GetPolicyAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java new file mode 100644 index 00000000000..2a7348c2c2d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyOptions model. + */ +public class GetPolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetPolicyOptions() throws Throwable { + GetPolicyOptions getPolicyOptionsModel = new GetPolicyOptions.Builder() + .policyId("testString") + .build(); + assertEquals(getPolicyOptionsModel.policyId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyOptionsError() throws Throwable { + new GetPolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..06535ed77ed --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyTemplateOptions model. + */ +public class GetPolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetPolicyTemplateOptions() throws Throwable { + GetPolicyTemplateOptions getPolicyTemplateOptionsModel = new GetPolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .state("active") + .build(); + assertEquals(getPolicyTemplateOptionsModel.policyTemplateId(), "testString"); + assertEquals(getPolicyTemplateOptionsModel.state(), "active"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyTemplateOptionsError() throws Throwable { + new GetPolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..264b5db4912 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyTemplateVersionOptions model. + */ +public class GetPolicyTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetPolicyTemplateVersionOptions() throws Throwable { + GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptionsModel = new GetPolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + assertEquals(getPolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); + assertEquals(getPolicyTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyTemplateVersionOptionsError() throws Throwable { + new GetPolicyTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java new file mode 100644 index 00000000000..0c1f6b2bb5a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleAssignmentOptions model. + */ +public class GetRoleAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetRoleAssignmentOptions() throws Throwable { + GetRoleAssignmentOptions getRoleAssignmentOptionsModel = new GetRoleAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(getRoleAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleAssignmentOptionsError() throws Throwable { + new GetRoleAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java new file mode 100644 index 00000000000..e589b8d1285 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleOptions model. + */ +public class GetRoleOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetRoleOptions() throws Throwable { + GetRoleOptions getRoleOptionsModel = new GetRoleOptions.Builder() + .roleId("testString") + .build(); + assertEquals(getRoleOptionsModel.roleId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleOptionsError() throws Throwable { + new GetRoleOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..3c10b5207dc --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleTemplateOptions model. + */ +public class GetRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetRoleTemplateOptions() throws Throwable { + GetRoleTemplateOptions getRoleTemplateOptionsModel = new GetRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .state("active") + .build(); + assertEquals(getRoleTemplateOptionsModel.roleTemplateId(), "testString"); + assertEquals(getRoleTemplateOptionsModel.state(), "active"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleTemplateOptionsError() throws Throwable { + new GetRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..3bd5d278630 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleTemplateVersionOptions model. + */ +public class GetRoleTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetRoleTemplateVersionOptions() throws Throwable { + GetRoleTemplateVersionOptions getRoleTemplateVersionOptionsModel = new GetRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + assertEquals(getRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); + assertEquals(getRoleTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleTemplateVersionOptionsError() throws Throwable { + new GetRoleTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java new file mode 100644 index 00000000000..00f780c4153 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetSettingsOptions model. + */ +public class GetSettingsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetSettingsOptions() throws Throwable { + GetSettingsOptions getSettingsOptionsModel = new GetSettingsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .build(); + assertEquals(getSettingsOptionsModel.accountId(), "testString"); + assertEquals(getSettingsOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetSettingsOptionsError() throws Throwable { + new GetSettingsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java new file mode 100644 index 00000000000..ebad7af7371 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetV2PolicyOptions model. + */ +public class GetV2PolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetV2PolicyOptions() throws Throwable { + GetV2PolicyOptions getV2PolicyOptionsModel = new GetV2PolicyOptions.Builder() + .id("testString") + .format("include_last_permit") + .build(); + assertEquals(getV2PolicyOptionsModel.id(), "testString"); + assertEquals(getV2PolicyOptionsModel.format(), "include_last_permit"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetV2PolicyOptionsError() throws Throwable { + new GetV2PolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java new file mode 100644 index 00000000000..f627a54ecc2 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 Grant model. + */ +public class GrantTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGrant() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + + String json = TestUtilities.serialize(grantModel); + + Grant grantModelNew = TestUtilities.deserialize(json, Grant.class); + assertTrue(grantModelNew instanceof Grant); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGrantError() throws Throwable { + new Grant.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java new file mode 100644 index 00000000000..f86af34fab8 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.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 GrantWithEnrichedRoles model. + */ +public class GrantWithEnrichedRolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGrantWithEnrichedRoles() throws Throwable { + GrantWithEnrichedRoles grantWithEnrichedRolesModel = new GrantWithEnrichedRoles(); + assertNull(grantWithEnrichedRolesModel.getRoles()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java new file mode 100644 index 00000000000..2a4d38de51a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypesBase model. + */ +public class IdentityTypesBaseTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testIdentityTypesBase() throws Throwable { + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + assertEquals(identityTypesBaseModel.state(), "enabled"); + assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(identityTypesBaseModel); + + IdentityTypesBase identityTypesBaseModelNew = TestUtilities.deserialize(json, IdentityTypesBase.class); + assertTrue(identityTypesBaseModelNew instanceof IdentityTypesBase); + assertEquals(identityTypesBaseModelNew.state(), "enabled"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testIdentityTypesBaseError() throws Throwable { + new IdentityTypesBase.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java new file mode 100644 index 00000000000..3e762536695 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java @@ -0,0 +1,59 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; +import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypesPatch model. + */ +public class IdentityTypesPatchTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testIdentityTypesPatch() throws Throwable { + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + assertEquals(identityTypesBaseModel.state(), "enabled"); + assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); + + IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() + .user(identityTypesBaseModel) + .serviceId(identityTypesBaseModel) + .service(identityTypesBaseModel) + .build(); + assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); + + String json = TestUtilities.serialize(identityTypesPatchModel); + + IdentityTypesPatch identityTypesPatchModelNew = TestUtilities.deserialize(json, IdentityTypesPatch.class); + assertTrue(identityTypesPatchModelNew instanceof IdentityTypesPatch); + assertEquals(identityTypesPatchModelNew.user().toString(), identityTypesBaseModel.toString()); + assertEquals(identityTypesPatchModelNew.serviceId().toString(), identityTypesBaseModel.toString()); + assertEquals(identityTypesPatchModelNew.service().toString(), identityTypesBaseModel.toString()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java new file mode 100644 index 00000000000..e2b6c77338f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypes model. + */ +public class IdentityTypesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testIdentityTypes() throws Throwable { + IdentityTypes identityTypesModel = new IdentityTypes(); + assertNull(identityTypesModel.getUser()); + assertNull(identityTypesModel.getServiceId()); + assertNull(identityTypesModel.getService()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java new file mode 100644 index 00000000000..c3f51516e25 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java @@ -0,0 +1,36 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; +import com.ibm.cloud.platform_services.iam_policy_management.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 LimitData model. + */ +public class LimitDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testLimitData() throws Throwable { + LimitData limitDataModel = new LimitData(); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java new file mode 100644 index 00000000000..0d64653d829 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlAssignmentsOptions model. + */ +public class ListActionControlAssignmentsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListActionControlAssignmentsOptions() throws Throwable { + ListActionControlAssignmentsOptions listActionControlAssignmentsOptionsModel = new ListActionControlAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listActionControlAssignmentsOptionsModel.accountId(), "testString"); + assertEquals(listActionControlAssignmentsOptionsModel.acceptLanguage(), "default"); + assertEquals(listActionControlAssignmentsOptionsModel.templateId(), "testString"); + assertEquals(listActionControlAssignmentsOptionsModel.templateVersion(), "testString"); + assertEquals(listActionControlAssignmentsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listActionControlAssignmentsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlAssignmentsOptionsError() throws Throwable { + new ListActionControlAssignmentsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java new file mode 100644 index 00000000000..dfe91662d83 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlTemplateVersionsOptions model. + */ +public class ListActionControlTemplateVersionsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListActionControlTemplateVersionsOptions() throws Throwable { + ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptionsModel = new ListActionControlTemplateVersionsOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listActionControlTemplateVersionsOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(listActionControlTemplateVersionsOptionsModel.state(), "active"); + assertEquals(listActionControlTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listActionControlTemplateVersionsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlTemplateVersionsOptionsError() throws Throwable { + new ListActionControlTemplateVersionsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java new file mode 100644 index 00000000000..9e2e6a18158 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlTemplatesOptions model. + */ +public class ListActionControlTemplatesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListActionControlTemplatesOptions() throws Throwable { + ListActionControlTemplatesOptions listActionControlTemplatesOptionsModel = new ListActionControlTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listActionControlTemplatesOptionsModel.accountId(), "testString"); + assertEquals(listActionControlTemplatesOptionsModel.acceptLanguage(), "default"); + assertEquals(listActionControlTemplatesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listActionControlTemplatesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlTemplatesOptionsError() throws Throwable { + new ListActionControlTemplatesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java new file mode 100644 index 00000000000..8bfe5000355 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListPoliciesOptions model. + */ +public class ListPoliciesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListPoliciesOptions() throws Throwable { + ListPoliciesOptions listPoliciesOptionsModel = new ListPoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .tagName("testString") + .tagValue("testString") + .sort("id") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listPoliciesOptionsModel.accountId(), "testString"); + assertEquals(listPoliciesOptionsModel.acceptLanguage(), "default"); + assertEquals(listPoliciesOptionsModel.iamId(), "testString"); + assertEquals(listPoliciesOptionsModel.accessGroupId(), "testString"); + assertEquals(listPoliciesOptionsModel.type(), "access"); + assertEquals(listPoliciesOptionsModel.serviceType(), "service"); + assertEquals(listPoliciesOptionsModel.tagName(), "testString"); + assertEquals(listPoliciesOptionsModel.tagValue(), "testString"); + assertEquals(listPoliciesOptionsModel.sort(), "id"); + assertEquals(listPoliciesOptionsModel.format(), "include_last_permit"); + assertEquals(listPoliciesOptionsModel.state(), "active"); + assertEquals(listPoliciesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listPoliciesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPoliciesOptionsError() throws Throwable { + new ListPoliciesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java new file mode 100644 index 00000000000..32729befeda --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyAssignmentsOptions model. + */ +public class ListPolicyAssignmentsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListPolicyAssignmentsOptions() throws Throwable { + ListPolicyAssignmentsOptions listPolicyAssignmentsOptionsModel = new ListPolicyAssignmentsOptions.Builder() + .version("1.0") + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listPolicyAssignmentsOptionsModel.version(), "1.0"); + assertEquals(listPolicyAssignmentsOptionsModel.accountId(), "testString"); + assertEquals(listPolicyAssignmentsOptionsModel.acceptLanguage(), "default"); + assertEquals(listPolicyAssignmentsOptionsModel.templateId(), "testString"); + assertEquals(listPolicyAssignmentsOptionsModel.templateVersion(), "testString"); + assertEquals(listPolicyAssignmentsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listPolicyAssignmentsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyAssignmentsOptionsError() throws Throwable { + new ListPolicyAssignmentsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java new file mode 100644 index 00000000000..1053d41b84b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyTemplateVersionsOptions model. + */ +public class ListPolicyTemplateVersionsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListPolicyTemplateVersionsOptions() throws Throwable { + ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptionsModel = new ListPolicyTemplateVersionsOptions.Builder() + .policyTemplateId("testString") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listPolicyTemplateVersionsOptionsModel.policyTemplateId(), "testString"); + assertEquals(listPolicyTemplateVersionsOptionsModel.state(), "active"); + assertEquals(listPolicyTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listPolicyTemplateVersionsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyTemplateVersionsOptionsError() throws Throwable { + new ListPolicyTemplateVersionsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java new file mode 100644 index 00000000000..5065a9d9495 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyTemplatesOptions model. + */ +public class ListPolicyTemplatesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListPolicyTemplatesOptions() throws Throwable { + ListPolicyTemplatesOptions listPolicyTemplatesOptionsModel = new ListPolicyTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .state("active") + .name("testString") + .policyServiceType("service") + .policyServiceName("testString") + .policyServiceGroupId("testString") + .policyType("access") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listPolicyTemplatesOptionsModel.accountId(), "testString"); + assertEquals(listPolicyTemplatesOptionsModel.acceptLanguage(), "default"); + assertEquals(listPolicyTemplatesOptionsModel.state(), "active"); + assertEquals(listPolicyTemplatesOptionsModel.name(), "testString"); + assertEquals(listPolicyTemplatesOptionsModel.policyServiceType(), "service"); + assertEquals(listPolicyTemplatesOptionsModel.policyServiceName(), "testString"); + assertEquals(listPolicyTemplatesOptionsModel.policyServiceGroupId(), "testString"); + assertEquals(listPolicyTemplatesOptionsModel.policyType(), "access"); + assertEquals(listPolicyTemplatesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listPolicyTemplatesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyTemplatesOptionsError() throws Throwable { + new ListPolicyTemplatesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java new file mode 100644 index 00000000000..bd82df9bfd5 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleAssignmentsOptions model. + */ +public class ListRoleAssignmentsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListRoleAssignmentsOptions() throws Throwable { + ListRoleAssignmentsOptions listRoleAssignmentsOptionsModel = new ListRoleAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listRoleAssignmentsOptionsModel.accountId(), "testString"); + assertEquals(listRoleAssignmentsOptionsModel.acceptLanguage(), "default"); + assertEquals(listRoleAssignmentsOptionsModel.templateId(), "testString"); + assertEquals(listRoleAssignmentsOptionsModel.templateVersion(), "testString"); + assertEquals(listRoleAssignmentsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listRoleAssignmentsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleAssignmentsOptionsError() throws Throwable { + new ListRoleAssignmentsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java new file mode 100644 index 00000000000..2e89527b653 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleTemplateVersionsOptions model. + */ +public class ListRoleTemplateVersionsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListRoleTemplateVersionsOptions() throws Throwable { + ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptionsModel = new ListRoleTemplateVersionsOptions.Builder() + .roleTemplateId("testString") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listRoleTemplateVersionsOptionsModel.roleTemplateId(), "testString"); + assertEquals(listRoleTemplateVersionsOptionsModel.state(), "active"); + assertEquals(listRoleTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listRoleTemplateVersionsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleTemplateVersionsOptionsError() throws Throwable { + new ListRoleTemplateVersionsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java new file mode 100644 index 00000000000..21d23a7be0f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java @@ -0,0 +1,59 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleTemplatesOptions model. + */ +public class ListRoleTemplatesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListRoleTemplatesOptions() throws Throwable { + ListRoleTemplatesOptions listRoleTemplatesOptionsModel = new ListRoleTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .name("testString") + .roleName("testString") + .roleServiceName("testString") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listRoleTemplatesOptionsModel.accountId(), "testString"); + assertEquals(listRoleTemplatesOptionsModel.acceptLanguage(), "default"); + assertEquals(listRoleTemplatesOptionsModel.name(), "testString"); + assertEquals(listRoleTemplatesOptionsModel.roleName(), "testString"); + assertEquals(listRoleTemplatesOptionsModel.roleServiceName(), "testString"); + assertEquals(listRoleTemplatesOptionsModel.state(), "active"); + assertEquals(listRoleTemplatesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listRoleTemplatesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleTemplatesOptionsError() throws Throwable { + new ListRoleTemplatesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java new file mode 100644 index 00000000000..4fb97c7fc9a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListRolesOptions model. + */ +public class ListRolesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListRolesOptions() throws Throwable { + ListRolesOptions listRolesOptionsModel = new ListRolesOptions.Builder() + .acceptLanguage("default") + .accountId("testString") + .serviceName("iam-groups") + .sourceServiceName("iam-groups") + .policyType("authorization") + .serviceGroupId("IAM") + .build(); + assertEquals(listRolesOptionsModel.acceptLanguage(), "default"); + assertEquals(listRolesOptionsModel.accountId(), "testString"); + assertEquals(listRolesOptionsModel.serviceName(), "iam-groups"); + assertEquals(listRolesOptionsModel.sourceServiceName(), "iam-groups"); + assertEquals(listRolesOptionsModel.policyType(), "authorization"); + assertEquals(listRolesOptionsModel.serviceGroupId(), "IAM"); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java new file mode 100644 index 00000000000..8c72945373b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListV2PoliciesOptions model. + */ +public class ListV2PoliciesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListV2PoliciesOptions() throws Throwable { + ListV2PoliciesOptions listV2PoliciesOptionsModel = new ListV2PoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .serviceName("testString") + .serviceGroupId("testString") + .sort("testString") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listV2PoliciesOptionsModel.accountId(), "testString"); + assertEquals(listV2PoliciesOptionsModel.acceptLanguage(), "default"); + assertEquals(listV2PoliciesOptionsModel.iamId(), "testString"); + assertEquals(listV2PoliciesOptionsModel.accessGroupId(), "testString"); + assertEquals(listV2PoliciesOptionsModel.type(), "access"); + assertEquals(listV2PoliciesOptionsModel.serviceType(), "service"); + assertEquals(listV2PoliciesOptionsModel.serviceName(), "testString"); + assertEquals(listV2PoliciesOptionsModel.serviceGroupId(), "testString"); + assertEquals(listV2PoliciesOptionsModel.sort(), "testString"); + assertEquals(listV2PoliciesOptionsModel.format(), "include_last_permit"); + assertEquals(listV2PoliciesOptionsModel.state(), "active"); + assertEquals(listV2PoliciesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listV2PoliciesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListV2PoliciesOptionsError() throws Throwable { + new ListV2PoliciesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java new file mode 100644 index 00000000000..0661d4245a2 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 NestedConditionRuleAttribute model. + */ +public class NestedConditionRuleAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testNestedConditionRuleAttribute() throws Throwable { + NestedConditionRuleAttribute nestedConditionRuleAttributeModel = new NestedConditionRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(nestedConditionRuleAttributeModel.key(), "testString"); + assertEquals(nestedConditionRuleAttributeModel.operator(), "stringEquals"); + assertEquals(nestedConditionRuleAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(nestedConditionRuleAttributeModel); + + NestedConditionRuleAttribute nestedConditionRuleAttributeModelNew = TestUtilities.deserialize(json, NestedConditionRuleAttribute.class); + assertTrue(nestedConditionRuleAttributeModelNew instanceof NestedConditionRuleAttribute); + assertEquals(nestedConditionRuleAttributeModelNew.key(), "testString"); + assertEquals(nestedConditionRuleAttributeModelNew.operator(), "stringEquals"); + assertEquals(nestedConditionRuleAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testNestedConditionRuleAttributeError() throws Throwable { + new NestedConditionRuleAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java new file mode 100644 index 00000000000..1ba394dbb7d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleWithConditions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 NestedConditionRuleWithConditions model. + */ +public class NestedConditionRuleWithConditionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testNestedConditionRuleWithConditions() throws Throwable { + RuleAttribute ruleAttributeModel = new RuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(ruleAttributeModel.key(), "testString"); + assertEquals(ruleAttributeModel.operator(), "stringEquals"); + assertEquals(ruleAttributeModel.value(), "testString"); + + NestedConditionRuleWithConditions nestedConditionRuleWithConditionsModel = new NestedConditionRuleWithConditions.Builder() + .operator("and") + .conditions(java.util.Arrays.asList(ruleAttributeModel)) + .build(); + assertEquals(nestedConditionRuleWithConditionsModel.operator(), "and"); + assertEquals(nestedConditionRuleWithConditionsModel.conditions(), java.util.Arrays.asList(ruleAttributeModel)); + + String json = TestUtilities.serialize(nestedConditionRuleWithConditionsModel); + + NestedConditionRuleWithConditions nestedConditionRuleWithConditionsModelNew = TestUtilities.deserialize(json, NestedConditionRuleWithConditions.class); + assertTrue(nestedConditionRuleWithConditionsModelNew instanceof NestedConditionRuleWithConditions); + assertEquals(nestedConditionRuleWithConditionsModelNew.operator(), "and"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testNestedConditionRuleWithConditionsError() throws Throwable { + new NestedConditionRuleWithConditions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java new file mode 100644 index 00000000000..4956eea2675 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedCondition; +import com.ibm.cloud.platform_services.iam_policy_management.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 NestedCondition model. + */ +public class NestedConditionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testNestedCondition() throws Throwable { + NestedCondition nestedConditionModel = new NestedCondition(); + assertNotNull(nestedConditionModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java new file mode 100644 index 00000000000..c5e084a44d5 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.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 Next model. + */ +public class NextTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testNext() throws Throwable { + Next nextModel = new Next(); + assertNull(nextModel.getStart()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java new file mode 100644 index 00000000000..d5b05ede760 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentResourcePolicy model. + */ +public class PolicyAssignmentResourcePolicyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentResourcePolicy() throws Throwable { + PolicyAssignmentResourcePolicy policyAssignmentResourcePolicyModel = new PolicyAssignmentResourcePolicy(); + assertNull(policyAssignmentResourcePolicyModel.getResourceCreated()); + assertNull(policyAssignmentResourcePolicyModel.getStatus()); + assertNull(policyAssignmentResourcePolicyModel.getErrorMessage()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java new file mode 100644 index 00000000000..8b146425617 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentResources model. + */ +public class PolicyAssignmentResourcesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentResources() throws Throwable { + PolicyAssignmentResources policyAssignmentResourcesModel = new PolicyAssignmentResources(); + assertNull(policyAssignmentResourcesModel.getTarget()); + assertNull(policyAssignmentResourcesModel.getPolicy()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java new file mode 100644 index 00000000000..8a3a6b67703 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Collection model. + */ +public class PolicyAssignmentV1CollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentV1Collection() throws Throwable { + PolicyAssignmentV1Collection policyAssignmentV1CollectionModel = new PolicyAssignmentV1Collection(); + assertNull(policyAssignmentV1CollectionModel.getLimit()); + assertNull(policyAssignmentV1CollectionModel.getFirst()); + assertNull(policyAssignmentV1CollectionModel.getNext()); + assertNull(policyAssignmentV1CollectionModel.getPrevious()); + assertNull(policyAssignmentV1CollectionModel.getAssignments()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java new file mode 100644 index 00000000000..56c843a232e --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Resources model. + */ +public class PolicyAssignmentV1ResourcesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentV1Resources() throws Throwable { + PolicyAssignmentV1Resources policyAssignmentV1ResourcesModel = new PolicyAssignmentV1Resources(); + assertNull(policyAssignmentV1ResourcesModel.getTarget()); + assertNull(policyAssignmentV1ResourcesModel.getPolicy()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java new file mode 100644 index 00000000000..f5d14b29447 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java @@ -0,0 +1,36 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Subject model. + */ +public class PolicyAssignmentV1SubjectTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentV1Subject() throws Throwable { + PolicyAssignmentV1Subject policyAssignmentV1SubjectModel = new PolicyAssignmentV1Subject(); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java new file mode 100644 index 00000000000..d9889483421 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1 model. + */ +public class PolicyAssignmentV1Test { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentV1() throws Throwable { + PolicyAssignmentV1 policyAssignmentV1Model = new PolicyAssignmentV1(); + assertNull(policyAssignmentV1Model.getTarget()); + assertNull(policyAssignmentV1Model.getResources()); + assertNull(policyAssignmentV1Model.getSubject()); + assertNull(policyAssignmentV1Model.getTemplate()); + assertNull(policyAssignmentV1Model.getStatus()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java new file mode 100644 index 00000000000..3d372dfaf20 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java @@ -0,0 +1,52 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyCollection model. + */ +public class PolicyCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyCollection() throws Throwable { + PolicyCollection policyCollectionModel = new PolicyCollection(); + assertNull(policyCollectionModel.getLimit()); + assertNull(policyCollectionModel.getFirst()); + assertNull(policyCollectionModel.getNext()); + assertNull(policyCollectionModel.getPrevious()); + assertNull(policyCollectionModel.getPolicies()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java new file mode 100644 index 00000000000..cb2f203a5c3 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java @@ -0,0 +1,72 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyResource model. + */ +public class PolicyResourceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyResource() throws Throwable { + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceAttributeModel.name(), "testString"); + assertEquals(resourceAttributeModel.value(), "testString"); + assertEquals(resourceAttributeModel.operator(), "testString"); + + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceTagModel.name(), "testString"); + assertEquals(resourceTagModel.value(), "testString"); + assertEquals(resourceTagModel.operator(), "testString"); + + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); + assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); + + String json = TestUtilities.serialize(policyResourceModel); + + PolicyResource policyResourceModelNew = TestUtilities.deserialize(json, PolicyResource.class); + assertTrue(policyResourceModelNew instanceof PolicyResource); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPolicyResourceError() throws Throwable { + new PolicyResource.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java new file mode 100644 index 00000000000..299e15b1fd4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyRole model. + */ +public class PolicyRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyRole() throws Throwable { + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + assertEquals(policyRoleModel.roleId(), "testString"); + + String json = TestUtilities.serialize(policyRoleModel); + + PolicyRole policyRoleModelNew = TestUtilities.deserialize(json, PolicyRole.class); + assertTrue(policyRoleModelNew instanceof PolicyRole); + assertEquals(policyRoleModelNew.roleId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPolicyRoleError() throws Throwable { + new PolicyRole.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java new file mode 100644 index 00000000000..6d0a937bd53 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java @@ -0,0 +1,58 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicySubject model. + */ +public class PolicySubjectTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicySubject() throws Throwable { + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(subjectAttributeModel.name(), "testString"); + assertEquals(subjectAttributeModel.value(), "testString"); + + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); + + String json = TestUtilities.serialize(policySubjectModel); + + PolicySubject policySubjectModelNew = TestUtilities.deserialize(json, PolicySubject.class); + assertTrue(policySubjectModelNew instanceof PolicySubject); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPolicySubjectError() throws Throwable { + new PolicySubject.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java new file mode 100644 index 00000000000..8cb98be3d32 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentCollection model. + */ +public class PolicyTemplateAssignmentCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateAssignmentCollection() throws Throwable { + PolicyTemplateAssignmentCollection policyTemplateAssignmentCollectionModel = new PolicyTemplateAssignmentCollection(); + assertNull(policyTemplateAssignmentCollectionModel.getLimit()); + assertNull(policyTemplateAssignmentCollectionModel.getFirst()); + assertNull(policyTemplateAssignmentCollectionModel.getNext()); + assertNull(policyTemplateAssignmentCollectionModel.getPrevious()); + assertNull(policyTemplateAssignmentCollectionModel.getAssignments()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java new file mode 100644 index 00000000000..fded12633d2 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItemsPolicyAssignment model. + */ +public class PolicyTemplateAssignmentItemsPolicyAssignmentTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateAssignmentItemsPolicyAssignment() throws Throwable { + PolicyTemplateAssignmentItemsPolicyAssignment policyTemplateAssignmentItemsPolicyAssignmentModel = new PolicyTemplateAssignmentItemsPolicyAssignment(); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTemplateId()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTemplateVersion()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getAssignmentId()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTargetType()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTarget()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getResources()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getStatus()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java new file mode 100644 index 00000000000..6b74125d238 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItemsPolicyAssignmentV1 model. + */ +public class PolicyTemplateAssignmentItemsPolicyAssignmentV1Test { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateAssignmentItemsPolicyAssignmentV1() throws Throwable { + PolicyTemplateAssignmentItemsPolicyAssignmentV1 policyTemplateAssignmentItemsPolicyAssignmentV1Model = new PolicyTemplateAssignmentItemsPolicyAssignmentV1(); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getTarget()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getResources()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getSubject()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getTemplate()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getStatus()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java new file mode 100644 index 00000000000..05b400e91c1 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java @@ -0,0 +1,48 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItems model. + */ +public class PolicyTemplateAssignmentItemsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testPolicyTemplateAssignmentItems() throws Throwable { + PolicyTemplateAssignmentItems policyTemplateAssignmentItemsModel = new PolicyTemplateAssignmentItems(); + assertNotNull(policyTemplateAssignmentItemsModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java new file mode 100644 index 00000000000..52041b1a6a3 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateCollection model. + */ +public class PolicyTemplateCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateCollection() throws Throwable { + PolicyTemplateCollection policyTemplateCollectionModel = new PolicyTemplateCollection(); + assertNull(policyTemplateCollectionModel.getLimit()); + assertNull(policyTemplateCollectionModel.getFirst()); + assertNull(policyTemplateCollectionModel.getNext()); + assertNull(policyTemplateCollectionModel.getPrevious()); + assertNull(policyTemplateCollectionModel.getPolicyTemplates()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java new file mode 100644 index 00000000000..b6ee06990a2 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateLimitData model. + */ +public class PolicyTemplateLimitDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateLimitData() throws Throwable { + PolicyTemplateLimitData policyTemplateLimitDataModel = new PolicyTemplateLimitData(); + assertNull(policyTemplateLimitDataModel.getName()); + assertNull(policyTemplateLimitDataModel.getDescription()); + assertNull(policyTemplateLimitDataModel.getAccountId()); + assertNull(policyTemplateLimitDataModel.getVersion()); + assertNull(policyTemplateLimitDataModel.isCommitted()); + assertNull(policyTemplateLimitDataModel.getPolicy()); + assertNull(policyTemplateLimitDataModel.getState()); + assertNull(policyTemplateLimitDataModel.getCounts()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java new file mode 100644 index 00000000000..edeb45c4d96 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateMetaData model. + */ +public class PolicyTemplateMetaDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateMetaData() throws Throwable { + PolicyTemplateMetaData policyTemplateMetaDataModel = new PolicyTemplateMetaData(); + assertNull(policyTemplateMetaDataModel.getType()); + assertNull(policyTemplateMetaDataModel.getDescription()); + assertNull(policyTemplateMetaDataModel.getSubjects()); + assertNull(policyTemplateMetaDataModel.getRoles()); + assertNull(policyTemplateMetaDataModel.getResources()); + assertNull(policyTemplateMetaDataModel.getState()); + assertNull(policyTemplateMetaDataModel.getTemplate()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java new file mode 100644 index 00000000000..c349e4a3415 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplate model. + */ +public class PolicyTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplate() throws Throwable { + PolicyTemplate policyTemplateModel = new PolicyTemplate(); + assertNull(policyTemplateModel.getName()); + assertNull(policyTemplateModel.getDescription()); + assertNull(policyTemplateModel.getAccountId()); + assertNull(policyTemplateModel.getVersion()); + assertNull(policyTemplateModel.isCommitted()); + assertNull(policyTemplateModel.getPolicy()); + assertNull(policyTemplateModel.getState()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java new file mode 100644 index 00000000000..da651956461 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateVersionsCollection model. + */ +public class PolicyTemplateVersionsCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateVersionsCollection() throws Throwable { + PolicyTemplateVersionsCollection policyTemplateVersionsCollectionModel = new PolicyTemplateVersionsCollection(); + assertNull(policyTemplateVersionsCollectionModel.getLimit()); + assertNull(policyTemplateVersionsCollectionModel.getFirst()); + assertNull(policyTemplateVersionsCollectionModel.getNext()); + assertNull(policyTemplateVersionsCollectionModel.getPrevious()); + assertNull(policyTemplateVersionsCollectionModel.getVersions()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java new file mode 100644 index 00000000000..28eba4f9a85 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java @@ -0,0 +1,48 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 Policy model. + */ +public class PolicyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicy() throws Throwable { + Policy policyModel = new Policy(); + assertNull(policyModel.getType()); + assertNull(policyModel.getDescription()); + assertNull(policyModel.getSubjects()); + assertNull(policyModel.getRoles()); + assertNull(policyModel.getResources()); + assertNull(policyModel.getState()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java new file mode 100644 index 00000000000..e3788c51212 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.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 Previous model. + */ +public class PreviousTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPrevious() throws Throwable { + Previous previousModel = new Previous(); + assertNull(previousModel.getStart()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..430f5f63764 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java @@ -0,0 +1,67 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceActionControlTemplateOptions model. + */ +public class ReplaceActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplaceActionControlTemplateOptions() throws Throwable { + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateActionControlModel.serviceName(), "testString"); + assertEquals(templateActionControlModel.description(), "testString"); + assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); + + ReplaceActionControlTemplateOptions replaceActionControlTemplateOptionsModel = new ReplaceActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .actionControl(templateActionControlModel) + .committed(true) + .build(); + assertEquals(replaceActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.version(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.ifMatch(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.name(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.description(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.actionControl(), templateActionControlModel); + assertEquals(replaceActionControlTemplateOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceActionControlTemplateOptionsError() throws Throwable { + new ReplaceActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java new file mode 100644 index 00000000000..2f20b05f37c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java @@ -0,0 +1,105 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplacePolicyOptions model. + */ +public class ReplacePolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplacePolicyOptions() throws Throwable { + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(subjectAttributeModel.name(), "testString"); + assertEquals(subjectAttributeModel.value(), "testString"); + + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); + + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + assertEquals(policyRoleModel.roleId(), "testString"); + + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceAttributeModel.name(), "testString"); + assertEquals(resourceAttributeModel.value(), "testString"); + assertEquals(resourceAttributeModel.operator(), "testString"); + + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceTagModel.name(), "testString"); + assertEquals(resourceTagModel.value(), "testString"); + assertEquals(resourceTagModel.operator(), "testString"); + + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); + assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); + + ReplacePolicyOptions replacePolicyOptionsModel = new ReplacePolicyOptions.Builder() + .policyId("testString") + .ifMatch("testString") + .type("testString") + .subjects(java.util.Arrays.asList(policySubjectModel)) + .roles(java.util.Arrays.asList(policyRoleModel)) + .resources(java.util.Arrays.asList(policyResourceModel)) + .description("testString") + .build(); + assertEquals(replacePolicyOptionsModel.policyId(), "testString"); + assertEquals(replacePolicyOptionsModel.ifMatch(), "testString"); + assertEquals(replacePolicyOptionsModel.type(), "testString"); + assertEquals(replacePolicyOptionsModel.subjects(), java.util.Arrays.asList(policySubjectModel)); + assertEquals(replacePolicyOptionsModel.roles(), java.util.Arrays.asList(policyRoleModel)); + assertEquals(replacePolicyOptionsModel.resources(), java.util.Arrays.asList(policyResourceModel)); + assertEquals(replacePolicyOptionsModel.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplacePolicyOptionsError() throws Throwable { + new ReplacePolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..2dc2430daca --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java @@ -0,0 +1,147 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplacePolicyTemplateOptions model. + */ +public class ReplacePolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplacePolicyTemplateOptions() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + assertEquals(templatePolicyModel.type(), "access"); + assertEquals(templatePolicyModel.description(), "testString"); + assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); + assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); + assertEquals(templatePolicyModel.pattern(), "testString"); + assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); + assertEquals(templatePolicyModel.control(), templateControlModel); + + ReplacePolicyTemplateOptions replacePolicyTemplateOptionsModel = new ReplacePolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .ifMatch("testString") + .policy(templatePolicyModel) + .name("testString") + .description("testString") + .committed(true) + .build(); + assertEquals(replacePolicyTemplateOptionsModel.policyTemplateId(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.version(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.ifMatch(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.policy(), templatePolicyModel); + assertEquals(replacePolicyTemplateOptionsModel.name(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.description(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplacePolicyTemplateOptionsError() throws Throwable { + new ReplacePolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java new file mode 100644 index 00000000000..9900abb2543 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceRoleOptions model. + */ +public class ReplaceRoleOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplaceRoleOptions() throws Throwable { + ReplaceRoleOptions replaceRoleOptionsModel = new ReplaceRoleOptions.Builder() + .roleId("testString") + .ifMatch("testString") + .displayName("testString") + .actions(java.util.Arrays.asList("testString")) + .description("testString") + .build(); + assertEquals(replaceRoleOptionsModel.roleId(), "testString"); + assertEquals(replaceRoleOptionsModel.ifMatch(), "testString"); + assertEquals(replaceRoleOptionsModel.displayName(), "testString"); + assertEquals(replaceRoleOptionsModel.actions(), java.util.Arrays.asList("testString")); + assertEquals(replaceRoleOptionsModel.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceRoleOptionsError() throws Throwable { + new ReplaceRoleOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..2f731aea7d4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceRoleTemplateOptions model. + */ +public class ReplaceRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplaceRoleTemplateOptions() throws Throwable { + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateRoleModel.displayName(), "testString"); + assertEquals(templateRoleModel.serviceName(), "testString"); + assertEquals(templateRoleModel.description(), "testString"); + assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); + + ReplaceRoleTemplateOptions replaceRoleTemplateOptionsModel = new ReplaceRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .role(templateRoleModel) + .committed(true) + .build(); + assertEquals(replaceRoleTemplateOptionsModel.roleTemplateId(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.version(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.ifMatch(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.name(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.description(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.role(), templateRoleModel); + assertEquals(replaceRoleTemplateOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceRoleTemplateOptionsError() throws Throwable { + new ReplaceRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java new file mode 100644 index 00000000000..23690eda780 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java @@ -0,0 +1,133 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceV2PolicyOptions model. + */ +public class ReplaceV2PolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplaceV2PolicyOptions() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + assertEquals(controlModel.grant(), grantModel); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + ReplaceV2PolicyOptions replaceV2PolicyOptionsModel = new ReplaceV2PolicyOptions.Builder() + .id("testString") + .ifMatch("testString") + .control(controlModel) + .type("access") + .description("testString") + .subject(v2PolicySubjectModel) + .resource(v2PolicyResourceModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .build(); + assertEquals(replaceV2PolicyOptionsModel.id(), "testString"); + assertEquals(replaceV2PolicyOptionsModel.ifMatch(), "testString"); + assertEquals(replaceV2PolicyOptionsModel.control(), controlModel); + assertEquals(replaceV2PolicyOptionsModel.type(), "access"); + assertEquals(replaceV2PolicyOptionsModel.description(), "testString"); + assertEquals(replaceV2PolicyOptionsModel.subject(), v2PolicySubjectModel); + assertEquals(replaceV2PolicyOptionsModel.resource(), v2PolicyResourceModel); + assertEquals(replaceV2PolicyOptionsModel.pattern(), "testString"); + assertEquals(replaceV2PolicyOptionsModel.rule(), v2PolicyRuleModel); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceV2PolicyOptionsError() throws Throwable { + new ReplaceV2PolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java new file mode 100644 index 00000000000..bd50b514f43 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 ResourceAttribute model. + */ +public class ResourceAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testResourceAttribute() throws Throwable { + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceAttributeModel.name(), "testString"); + assertEquals(resourceAttributeModel.value(), "testString"); + assertEquals(resourceAttributeModel.operator(), "testString"); + + String json = TestUtilities.serialize(resourceAttributeModel); + + ResourceAttribute resourceAttributeModelNew = TestUtilities.deserialize(json, ResourceAttribute.class); + assertTrue(resourceAttributeModelNew instanceof ResourceAttribute); + assertEquals(resourceAttributeModelNew.name(), "testString"); + assertEquals(resourceAttributeModelNew.value(), "testString"); + assertEquals(resourceAttributeModelNew.operator(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testResourceAttributeError() throws Throwable { + new ResourceAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java new file mode 100644 index 00000000000..88a1eb5d5b6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.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 ResourceTag model. + */ +public class ResourceTagTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testResourceTag() throws Throwable { + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceTagModel.name(), "testString"); + assertEquals(resourceTagModel.value(), "testString"); + assertEquals(resourceTagModel.operator(), "testString"); + + String json = TestUtilities.serialize(resourceTagModel); + + ResourceTag resourceTagModelNew = TestUtilities.deserialize(json, ResourceTag.class); + assertTrue(resourceTagModelNew instanceof ResourceTag); + assertEquals(resourceTagModelNew.name(), "testString"); + assertEquals(resourceTagModelNew.value(), "testString"); + assertEquals(resourceTagModelNew.operator(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testResourceTagError() throws Throwable { + new ResourceTag.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java new file mode 100644 index 00000000000..e4c0bcc6f92 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAction model. + */ +public class RoleActionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAction() throws Throwable { + RoleAction roleActionModel = new RoleAction(); + assertNull(roleActionModel.getId()); + assertNull(roleActionModel.getDisplayName()); + assertNull(roleActionModel.getDescription()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java new file mode 100644 index 00000000000..42801bc7771 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentCollection model. + */ +public class RoleAssignmentCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentCollection() throws Throwable { + RoleAssignmentCollection roleAssignmentCollectionModel = new RoleAssignmentCollection(); + assertNull(roleAssignmentCollectionModel.getLimit()); + assertNull(roleAssignmentCollectionModel.getFirst()); + assertNull(roleAssignmentCollectionModel.getNext()); + assertNull(roleAssignmentCollectionModel.getPrevious()); + assertNull(roleAssignmentCollectionModel.getAssignments()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java new file mode 100644 index 00000000000..bef8b71b0fa --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResourceCreated model. + */ +public class RoleAssignmentResourceCreatedTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentResourceCreated() throws Throwable { + RoleAssignmentResourceCreated roleAssignmentResourceCreatedModel = new RoleAssignmentResourceCreated(); + assertNull(roleAssignmentResourceCreatedModel.getId()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java new file mode 100644 index 00000000000..c346ca0f48f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java @@ -0,0 +1,43 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResourceRole model. + */ +public class RoleAssignmentResourceRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentResourceRole() throws Throwable { + RoleAssignmentResourceRole roleAssignmentResourceRoleModel = new RoleAssignmentResourceRole(); + assertNull(roleAssignmentResourceRoleModel.getResourceCreated()); + assertNull(roleAssignmentResourceRoleModel.getErrorMessage()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java new file mode 100644 index 00000000000..4fca1b25b5b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResource model. + */ +public class RoleAssignmentResourceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentResource() throws Throwable { + RoleAssignmentResource roleAssignmentResourceModel = new RoleAssignmentResource(); + assertNull(roleAssignmentResourceModel.getTarget()); + assertNull(roleAssignmentResourceModel.getRole()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java new file mode 100644 index 00000000000..4f2e3a37200 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentTemplate model. + */ +public class RoleAssignmentTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentTemplate() throws Throwable { + RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleAssignmentTemplateModel.id(), "testString"); + assertEquals(roleAssignmentTemplateModel.version(), "testString"); + + String json = TestUtilities.serialize(roleAssignmentTemplateModel); + + RoleAssignmentTemplate roleAssignmentTemplateModelNew = TestUtilities.deserialize(json, RoleAssignmentTemplate.class); + assertTrue(roleAssignmentTemplateModelNew instanceof RoleAssignmentTemplate); + assertEquals(roleAssignmentTemplateModelNew.id(), "testString"); + assertEquals(roleAssignmentTemplateModelNew.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRoleAssignmentTemplateError() throws Throwable { + new RoleAssignmentTemplate.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java new file mode 100644 index 00000000000..bd3bda7ce24 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignment model. + */ +public class RoleAssignmentTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignment() throws Throwable { + RoleAssignment roleAssignmentModel = new RoleAssignment(); + assertNull(roleAssignmentModel.getTemplate()); + assertNull(roleAssignmentModel.getTarget()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java new file mode 100644 index 00000000000..812c2dcb131 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java @@ -0,0 +1,41 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleCollection model. + */ +public class RoleCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleCollection() throws Throwable { + RoleCollection roleCollectionModel = new RoleCollection(); + assertNull(roleCollectionModel.getCustomRoles()); + assertNull(roleCollectionModel.getServiceRoles()); + assertNull(roleCollectionModel.getSystemRoles()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java new file mode 100644 index 00000000000..fde4d11ff4c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java @@ -0,0 +1,46 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateCollection model. + */ +public class RoleTemplateCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplateCollection() throws Throwable { + RoleTemplateCollection roleTemplateCollectionModel = new RoleTemplateCollection(); + assertNull(roleTemplateCollectionModel.getLimit()); + assertNull(roleTemplateCollectionModel.getFirst()); + assertNull(roleTemplateCollectionModel.getNext()); + assertNull(roleTemplateCollectionModel.getPrevious()); + assertNull(roleTemplateCollectionModel.getRoleTemplates()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java new file mode 100644 index 00000000000..6c208e1c38f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java @@ -0,0 +1,62 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplatePrototypeRole model. + */ +public class RoleTemplatePrototypeRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplatePrototypeRole() throws Throwable { + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() + .name("testString") + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(roleTemplatePrototypeRoleModel.name(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.displayName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.serviceName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.description(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.actions(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(roleTemplatePrototypeRoleModel); + + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModelNew = TestUtilities.deserialize(json, RoleTemplatePrototypeRole.class); + assertTrue(roleTemplatePrototypeRoleModelNew instanceof RoleTemplatePrototypeRole); + assertEquals(roleTemplatePrototypeRoleModelNew.name(), "testString"); + assertEquals(roleTemplatePrototypeRoleModelNew.displayName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModelNew.serviceName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModelNew.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRoleTemplatePrototypeRoleError() throws Throwable { + new RoleTemplatePrototypeRole.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java new file mode 100644 index 00000000000..af9de718e23 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateReferencesItem model. + */ +public class RoleTemplateReferencesItemTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplateReferencesItem() throws Throwable { + RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleTemplateReferencesItemModel.id(), "testString"); + assertEquals(roleTemplateReferencesItemModel.version(), "testString"); + + String json = TestUtilities.serialize(roleTemplateReferencesItemModel); + + RoleTemplateReferencesItem roleTemplateReferencesItemModelNew = TestUtilities.deserialize(json, RoleTemplateReferencesItem.class); + assertTrue(roleTemplateReferencesItemModelNew instanceof RoleTemplateReferencesItem); + assertEquals(roleTemplateReferencesItemModelNew.id(), "testString"); + assertEquals(roleTemplateReferencesItemModelNew.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRoleTemplateReferencesItemError() throws Throwable { + new RoleTemplateReferencesItem.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java new file mode 100644 index 00000000000..8bb27d8dd62 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplate model. + */ +public class RoleTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplate() throws Throwable { + RoleTemplate roleTemplateModel = new RoleTemplate(); + assertNull(roleTemplateModel.getName()); + assertNull(roleTemplateModel.getDescription()); + assertNull(roleTemplateModel.getAccountId()); + assertNull(roleTemplateModel.isCommitted()); + assertNull(roleTemplateModel.getRole()); + assertNull(roleTemplateModel.getVersion()); + assertNull(roleTemplateModel.getState()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java new file mode 100644 index 00000000000..068cf309bd6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java @@ -0,0 +1,46 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateVersionsCollection model. + */ +public class RoleTemplateVersionsCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplateVersionsCollection() throws Throwable { + RoleTemplateVersionsCollection roleTemplateVersionsCollectionModel = new RoleTemplateVersionsCollection(); + assertNull(roleTemplateVersionsCollectionModel.getLimit()); + assertNull(roleTemplateVersionsCollectionModel.getFirst()); + assertNull(roleTemplateVersionsCollectionModel.getNext()); + assertNull(roleTemplateVersionsCollectionModel.getPrevious()); + assertNull(roleTemplateVersionsCollectionModel.getVersions()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java new file mode 100644 index 00000000000..a632e63587f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; +import com.ibm.cloud.platform_services.iam_policy_management.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 Role model. + */ +public class RoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRole() throws Throwable { + Role roleModel = new Role.Builder() + .displayName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(roleModel.displayName(), "testString"); + assertEquals(roleModel.description(), "testString"); + assertEquals(roleModel.actions(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(roleModel); + + Role roleModelNew = TestUtilities.deserialize(json, Role.class); + assertTrue(roleModelNew instanceof Role); + assertEquals(roleModelNew.displayName(), "testString"); + assertEquals(roleModelNew.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRoleError() throws Throwable { + new Role.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java new file mode 100644 index 00000000000..8383ef794a9 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 Roles model. + */ +public class RolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoles() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + String json = TestUtilities.serialize(rolesModel); + + Roles rolesModelNew = TestUtilities.deserialize(json, Roles.class); + assertTrue(rolesModelNew instanceof Roles); + assertEquals(rolesModelNew.roleId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRolesError() throws Throwable { + new Roles.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java new file mode 100644 index 00000000000..a05e5ee8704 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 RuleAttribute model. + */ +public class RuleAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRuleAttribute() throws Throwable { + RuleAttribute ruleAttributeModel = new RuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(ruleAttributeModel.key(), "testString"); + assertEquals(ruleAttributeModel.operator(), "stringEquals"); + assertEquals(ruleAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(ruleAttributeModel); + + RuleAttribute ruleAttributeModelNew = TestUtilities.deserialize(json, RuleAttribute.class); + assertTrue(ruleAttributeModelNew instanceof RuleAttribute); + assertEquals(ruleAttributeModelNew.key(), "testString"); + assertEquals(ruleAttributeModelNew.operator(), "stringEquals"); + assertEquals(ruleAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRuleAttributeError() throws Throwable { + new RuleAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java new file mode 100644 index 00000000000..7bae03a42e0 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 SubjectAttribute model. + */ +public class SubjectAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testSubjectAttribute() throws Throwable { + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(subjectAttributeModel.name(), "testString"); + assertEquals(subjectAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(subjectAttributeModel); + + SubjectAttribute subjectAttributeModelNew = TestUtilities.deserialize(json, SubjectAttribute.class); + assertTrue(subjectAttributeModelNew instanceof SubjectAttribute); + assertEquals(subjectAttributeModelNew.name(), "testString"); + assertEquals(subjectAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testSubjectAttributeError() throws Throwable { + new SubjectAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java new file mode 100644 index 00000000000..d3a6d4ef53a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateActionControl model. + */ +public class TemplateActionControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateActionControl() throws Throwable { + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateActionControlModel.serviceName(), "testString"); + assertEquals(templateActionControlModel.description(), "testString"); + assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(templateActionControlModel); + + TemplateActionControl templateActionControlModelNew = TestUtilities.deserialize(json, TemplateActionControl.class); + assertTrue(templateActionControlModelNew instanceof TemplateActionControl); + assertEquals(templateActionControlModelNew.serviceName(), "testString"); + assertEquals(templateActionControlModelNew.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateActionControlError() throws Throwable { + new TemplateActionControl.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java new file mode 100644 index 00000000000..fba96e64cef --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateControl model. + */ +public class TemplateControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateControl() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + String json = TestUtilities.serialize(templateControlModel); + + TemplateControl templateControlModelNew = TestUtilities.deserialize(json, TemplateControl.class); + assertTrue(templateControlModelNew instanceof TemplateControl); + assertEquals(templateControlModelNew.grant().toString(), templateGrantModel.toString()); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateControlError() throws Throwable { + new TemplateControl.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java new file mode 100644 index 00000000000..b440cf19100 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateCountData model. + */ +public class TemplateCountDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateCountData() throws Throwable { + TemplateCountData templateCountDataModel = new TemplateCountData(); + assertNull(templateCountDataModel.getTemplate()); + assertNull(templateCountDataModel.getVersion()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java new file mode 100644 index 00000000000..e7759eacc21 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java @@ -0,0 +1,58 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoleReferences; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrantRoleReferences model. + */ +public class TemplateGrantRoleReferencesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateGrantRoleReferences() throws Throwable { + RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleTemplateReferencesItemModel.id(), "testString"); + assertEquals(roleTemplateReferencesItemModel.version(), "testString"); + + TemplateGrantRoleReferences templateGrantRoleReferencesModel = new TemplateGrantRoleReferences.Builder() + .roleTemplateReferences(java.util.Arrays.asList(roleTemplateReferencesItemModel)) + .build(); + assertEquals(templateGrantRoleReferencesModel.roleTemplateReferences(), java.util.Arrays.asList(roleTemplateReferencesItemModel)); + + String json = TestUtilities.serialize(templateGrantRoleReferencesModel); + + TemplateGrantRoleReferences templateGrantRoleReferencesModelNew = TestUtilities.deserialize(json, TemplateGrantRoleReferences.class); + assertTrue(templateGrantRoleReferencesModelNew instanceof TemplateGrantRoleReferences); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateGrantRoleReferencesError() throws Throwable { + new TemplateGrantRoleReferences.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java new file mode 100644 index 00000000000..8cddc6f9a19 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrantRoles model. + */ +public class TemplateGrantRolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateGrantRoles() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantRolesModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantRolesModel.roles(), java.util.Arrays.asList(rolesModel)); + + String json = TestUtilities.serialize(templateGrantRolesModel); + + TemplateGrantRoles templateGrantRolesModelNew = TestUtilities.deserialize(json, TemplateGrantRoles.class); + assertTrue(templateGrantRolesModelNew instanceof TemplateGrantRoles); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateGrantRolesError() throws Throwable { + new TemplateGrantRoles.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java new file mode 100644 index 00000000000..90e6fdc2b9f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrant model. + */ +public class TemplateGrantTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testTemplateGrant() throws Throwable { + TemplateGrant templateGrantModel = new TemplateGrant(); + assertNotNull(templateGrantModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java new file mode 100644 index 00000000000..c2688232e2b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java @@ -0,0 +1,41 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateMetadata model. + */ +public class TemplateMetadataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateMetadata() throws Throwable { + TemplateMetadata templateMetadataModel = new TemplateMetadata(); + assertNull(templateMetadataModel.getId()); + assertNull(templateMetadataModel.getVersion()); + assertNull(templateMetadataModel.getAssignmentId()); + assertNull(templateMetadataModel.getRootId()); + assertNull(templateMetadataModel.getRootVersion()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java new file mode 100644 index 00000000000..0e256ffd599 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplatePolicy model. + */ +public class TemplatePolicyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplatePolicy() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + assertEquals(templatePolicyModel.type(), "access"); + assertEquals(templatePolicyModel.description(), "testString"); + assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); + assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); + assertEquals(templatePolicyModel.pattern(), "testString"); + assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); + assertEquals(templatePolicyModel.control(), templateControlModel); + + String json = TestUtilities.serialize(templatePolicyModel); + + TemplatePolicy templatePolicyModelNew = TestUtilities.deserialize(json, TemplatePolicy.class); + assertTrue(templatePolicyModelNew instanceof TemplatePolicy); + assertEquals(templatePolicyModelNew.type(), "access"); + assertEquals(templatePolicyModelNew.description(), "testString"); + assertEquals(templatePolicyModelNew.resource().toString(), v2PolicyResourceModel.toString()); + assertEquals(templatePolicyModelNew.subject().toString(), v2PolicySubjectModel.toString()); + assertEquals(templatePolicyModelNew.pattern(), "testString"); + assertEquals(templatePolicyModelNew.rule().toString(), v2PolicyRuleModel.toString()); + assertEquals(templatePolicyModelNew.control().toString(), templateControlModel.toString()); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplatePolicyError() throws Throwable { + new TemplatePolicy.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java new file mode 100644 index 00000000000..1735364bc85 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java @@ -0,0 +1,59 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateRole model. + */ +public class TemplateRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateRole() throws Throwable { + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateRoleModel.displayName(), "testString"); + assertEquals(templateRoleModel.serviceName(), "testString"); + assertEquals(templateRoleModel.description(), "testString"); + assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(templateRoleModel); + + TemplateRole templateRoleModelNew = TestUtilities.deserialize(json, TemplateRole.class); + assertTrue(templateRoleModelNew instanceof TemplateRole); + assertEquals(templateRoleModelNew.displayName(), "testString"); + assertEquals(templateRoleModelNew.serviceName(), "testString"); + assertEquals(templateRoleModelNew.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateRoleError() throws Throwable { + new TemplateRole.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java new file mode 100644 index 00000000000..df7a09c2829 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateActionControlAssignmentOptions model. + */ +public class UpdateActionControlAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateActionControlAssignmentOptions() throws Throwable { + UpdateActionControlAssignmentOptions updateActionControlAssignmentOptionsModel = new UpdateActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .ifMatch("testString") + .templateVersion("testString") + .build(); + assertEquals(updateActionControlAssignmentOptionsModel.assignmentId(), "testString"); + assertEquals(updateActionControlAssignmentOptionsModel.ifMatch(), "testString"); + assertEquals(updateActionControlAssignmentOptionsModel.templateVersion(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateActionControlAssignmentOptionsError() throws Throwable { + new UpdateActionControlAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java new file mode 100644 index 00000000000..0008325ffcf --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdatePolicyAssignmentOptions model. + */ +public class UpdatePolicyAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdatePolicyAssignmentOptions() throws Throwable { + UpdatePolicyAssignmentOptions updatePolicyAssignmentOptionsModel = new UpdatePolicyAssignmentOptions.Builder() + .assignmentId("testString") + .version("1.0") + .ifMatch("testString") + .templateVersion("testString") + .build(); + assertEquals(updatePolicyAssignmentOptionsModel.assignmentId(), "testString"); + assertEquals(updatePolicyAssignmentOptionsModel.version(), "1.0"); + assertEquals(updatePolicyAssignmentOptionsModel.ifMatch(), "testString"); + assertEquals(updatePolicyAssignmentOptionsModel.templateVersion(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdatePolicyAssignmentOptionsError() throws Throwable { + new UpdatePolicyAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java new file mode 100644 index 00000000000..de000e8c745 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdatePolicyStateOptions model. + */ +public class UpdatePolicyStateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdatePolicyStateOptions() throws Throwable { + UpdatePolicyStateOptions updatePolicyStateOptionsModel = new UpdatePolicyStateOptions.Builder() + .policyId("testString") + .ifMatch("testString") + .state("active") + .build(); + assertEquals(updatePolicyStateOptionsModel.policyId(), "testString"); + assertEquals(updatePolicyStateOptionsModel.ifMatch(), "testString"); + assertEquals(updatePolicyStateOptionsModel.state(), "active"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdatePolicyStateOptionsError() throws Throwable { + new UpdatePolicyStateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java new file mode 100644 index 00000000000..879c3d5f456 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateRoleAssignmentOptions model. + */ +public class UpdateRoleAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateRoleAssignmentOptions() throws Throwable { + UpdateRoleAssignmentOptions updateRoleAssignmentOptionsModel = new UpdateRoleAssignmentOptions.Builder() + .assignmentId("testString") + .ifMatch("testString") + .templateVersion("testString") + .build(); + assertEquals(updateRoleAssignmentOptionsModel.assignmentId(), "testString"); + assertEquals(updateRoleAssignmentOptionsModel.ifMatch(), "testString"); + assertEquals(updateRoleAssignmentOptionsModel.templateVersion(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateRoleAssignmentOptionsError() throws Throwable { + new UpdateRoleAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java new file mode 100644 index 00000000000..1d69d016781 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java @@ -0,0 +1,75 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateSettingsOptions model. + */ +public class UpdateSettingsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateSettingsOptions() throws Throwable { + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + assertEquals(identityTypesBaseModel.state(), "enabled"); + assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); + + IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() + .user(identityTypesBaseModel) + .serviceId(identityTypesBaseModel) + .service(identityTypesBaseModel) + .build(); + assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); + + ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() + .identityTypes(identityTypesPatchModel) + .build(); + assertEquals(externalAccountIdentityInteractionPatchModel.identityTypes(), identityTypesPatchModel); + + UpdateSettingsOptions updateSettingsOptionsModel = new UpdateSettingsOptions.Builder() + .accountId("testString") + .ifMatch("testString") + .externalAccountIdentityInteraction(externalAccountIdentityInteractionPatchModel) + .acceptLanguage("default") + .build(); + assertEquals(updateSettingsOptionsModel.accountId(), "testString"); + assertEquals(updateSettingsOptionsModel.ifMatch(), "testString"); + assertEquals(updateSettingsOptionsModel.externalAccountIdentityInteraction(), externalAccountIdentityInteractionPatchModel); + assertEquals(updateSettingsOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateSettingsOptionsError() throws Throwable { + new UpdateSettingsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java new file mode 100644 index 00000000000..aff020c8985 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyCollection model. + */ +public class V2PolicyCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyCollection() throws Throwable { + V2PolicyCollection v2PolicyCollectionModel = new V2PolicyCollection(); + assertNull(v2PolicyCollectionModel.getLimit()); + assertNull(v2PolicyCollectionModel.getFirst()); + assertNull(v2PolicyCollectionModel.getNext()); + assertNull(v2PolicyCollectionModel.getPrevious()); + assertNull(v2PolicyCollectionModel.getPolicies()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java new file mode 100644 index 00000000000..407eaadb155 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResourceAttribute model. + */ +public class V2PolicyResourceAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyResourceAttribute() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(v2PolicyResourceAttributeModel); + + V2PolicyResourceAttribute v2PolicyResourceAttributeModelNew = TestUtilities.deserialize(json, V2PolicyResourceAttribute.class); + assertTrue(v2PolicyResourceAttributeModelNew instanceof V2PolicyResourceAttribute); + assertEquals(v2PolicyResourceAttributeModelNew.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModelNew.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyResourceAttributeError() throws Throwable { + new V2PolicyResourceAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java new file mode 100644 index 00000000000..97c9c813216 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResourceTag model. + */ +public class V2PolicyResourceTagTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyResourceTag() throws Throwable { + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + String json = TestUtilities.serialize(v2PolicyResourceTagModel); + + V2PolicyResourceTag v2PolicyResourceTagModelNew = TestUtilities.deserialize(json, V2PolicyResourceTag.class); + assertTrue(v2PolicyResourceTagModelNew instanceof V2PolicyResourceTag); + assertEquals(v2PolicyResourceTagModelNew.key(), "testString"); + assertEquals(v2PolicyResourceTagModelNew.value(), "testString"); + assertEquals(v2PolicyResourceTagModelNew.operator(), "stringEquals"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyResourceTagError() throws Throwable { + new V2PolicyResourceTag.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java new file mode 100644 index 00000000000..d153fd97be6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java @@ -0,0 +1,72 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResource model. + */ +public class V2PolicyResourceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyResource() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + String json = TestUtilities.serialize(v2PolicyResourceModel); + + V2PolicyResource v2PolicyResourceModelNew = TestUtilities.deserialize(json, V2PolicyResource.class); + assertTrue(v2PolicyResourceModelNew instanceof V2PolicyResource); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyResourceError() throws Throwable { + new V2PolicyResource.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java new file mode 100644 index 00000000000..6d6da85f2b4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRuleRuleAttribute model. + */ +public class V2PolicyRuleRuleAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyRuleRuleAttribute() throws Throwable { + V2PolicyRuleRuleAttribute v2PolicyRuleRuleAttributeModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleRuleAttributeModel.key(), "testString"); + assertEquals(v2PolicyRuleRuleAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleRuleAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(v2PolicyRuleRuleAttributeModel); + + V2PolicyRuleRuleAttribute v2PolicyRuleRuleAttributeModelNew = TestUtilities.deserialize(json, V2PolicyRuleRuleAttribute.class); + assertTrue(v2PolicyRuleRuleAttributeModelNew instanceof V2PolicyRuleRuleAttribute); + assertEquals(v2PolicyRuleRuleAttributeModelNew.key(), "testString"); + assertEquals(v2PolicyRuleRuleAttributeModelNew.operator(), "stringEquals"); + assertEquals(v2PolicyRuleRuleAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyRuleRuleAttributeError() throws Throwable { + new V2PolicyRuleRuleAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java new file mode 100644 index 00000000000..fdf25669ef7 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleWithNestedConditions; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRuleRuleWithNestedConditions model. + */ +public class V2PolicyRuleRuleWithNestedConditionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyRuleRuleWithNestedConditions() throws Throwable { + NestedConditionRuleAttribute nestedConditionModel = new NestedConditionRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(nestedConditionModel.key(), "testString"); + assertEquals(nestedConditionModel.operator(), "stringEquals"); + assertEquals(nestedConditionModel.value(), "testString"); + + V2PolicyRuleRuleWithNestedConditions v2PolicyRuleRuleWithNestedConditionsModel = new V2PolicyRuleRuleWithNestedConditions.Builder() + .operator("and") + .conditions(java.util.Arrays.asList(nestedConditionModel)) + .build(); + assertEquals(v2PolicyRuleRuleWithNestedConditionsModel.operator(), "and"); + assertEquals(v2PolicyRuleRuleWithNestedConditionsModel.conditions(), java.util.Arrays.asList(nestedConditionModel)); + + String json = TestUtilities.serialize(v2PolicyRuleRuleWithNestedConditionsModel); + + V2PolicyRuleRuleWithNestedConditions v2PolicyRuleRuleWithNestedConditionsModelNew = TestUtilities.deserialize(json, V2PolicyRuleRuleWithNestedConditions.class); + assertTrue(v2PolicyRuleRuleWithNestedConditionsModelNew instanceof V2PolicyRuleRuleWithNestedConditions); + assertEquals(v2PolicyRuleRuleWithNestedConditionsModelNew.operator(), "and"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyRuleRuleWithNestedConditionsError() throws Throwable { + new V2PolicyRuleRuleWithNestedConditions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java new file mode 100644 index 00000000000..e0af599840c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRule; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRule model. + */ +public class V2PolicyRuleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testV2PolicyRule() throws Throwable { + V2PolicyRule v2PolicyRuleModel = new V2PolicyRule(); + assertNotNull(v2PolicyRuleModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java new file mode 100644 index 00000000000..a6e8f9d8922 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicySubjectAttribute model. + */ +public class V2PolicySubjectAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicySubjectAttribute() throws Throwable { + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(v2PolicySubjectAttributeModel); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModelNew = TestUtilities.deserialize(json, V2PolicySubjectAttribute.class); + assertTrue(v2PolicySubjectAttributeModelNew instanceof V2PolicySubjectAttribute); + assertEquals(v2PolicySubjectAttributeModelNew.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModelNew.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicySubjectAttributeError() throws Throwable { + new V2PolicySubjectAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java new file mode 100644 index 00000000000..37adbaff5df --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java @@ -0,0 +1,60 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicySubject model. + */ +public class V2PolicySubjectTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicySubject() throws Throwable { + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + String json = TestUtilities.serialize(v2PolicySubjectModel); + + V2PolicySubject v2PolicySubjectModelNew = TestUtilities.deserialize(json, V2PolicySubject.class); + assertTrue(v2PolicySubjectModelNew instanceof V2PolicySubject); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicySubjectError() throws Throwable { + new V2PolicySubject.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java new file mode 100644 index 00000000000..2ffbe45575b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyTemplateMetaData model. + */ +public class V2PolicyTemplateMetaDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyTemplateMetaData() throws Throwable { + V2PolicyTemplateMetaData v2PolicyTemplateMetaDataModel = new V2PolicyTemplateMetaData(); + assertNull(v2PolicyTemplateMetaDataModel.getType()); + assertNull(v2PolicyTemplateMetaDataModel.getDescription()); + assertNull(v2PolicyTemplateMetaDataModel.getSubject()); + assertNull(v2PolicyTemplateMetaDataModel.getResource()); + assertNull(v2PolicyTemplateMetaDataModel.getPattern()); + assertNull(v2PolicyTemplateMetaDataModel.getRule()); + assertNull(v2PolicyTemplateMetaDataModel.getControl()); + assertNull(v2PolicyTemplateMetaDataModel.getState()); + assertNull(v2PolicyTemplateMetaDataModel.getLastPermitAt()); + assertNull(v2PolicyTemplateMetaDataModel.getLastPermitFrequency()); + assertNull(v2PolicyTemplateMetaDataModel.getTemplate()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java new file mode 100644 index 00000000000..1630201062c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2Policy model. + */ +public class V2PolicyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2Policy() throws Throwable { + V2Policy v2PolicyModel = new V2Policy(); + assertNull(v2PolicyModel.getType()); + assertNull(v2PolicyModel.getDescription()); + assertNull(v2PolicyModel.getSubject()); + assertNull(v2PolicyModel.getResource()); + assertNull(v2PolicyModel.getPattern()); + assertNull(v2PolicyModel.getRule()); + assertNull(v2PolicyModel.getControl()); + assertNull(v2PolicyModel.getState()); + assertNull(v2PolicyModel.getLastPermitAt()); + assertNull(v2PolicyModel.getLastPermitFrequency()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java new file mode 100644 index 00000000000..04aaecc16ae --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java @@ -0,0 +1,131 @@ +/* + * (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_policy_management.v1.utils; + +import java.util.Base64; +import java.util.Map; +import java.util.Set; +import java.util.List; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.io.InputStream; +import java.io.ByteArrayInputStream; + +import okhttp3.mockwebserver.RecordedRequest; +import okhttp3.HttpUrl; +import com.ibm.cloud.sdk.core.util.DateUtils; +import com.ibm.cloud.sdk.core.util.GsonSingleton; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; + +/** + * A class used by the unit tests containing utility functions. + */ +public class TestUtilities { + public static Map createMockMap() { + Map mockMap = new HashMap<>(); + mockMap.put("foo", "bar"); + return mockMap; + } + + public static HashMap createMockStreamMap() { + return new HashMap() { + { put("key1", createMockStream("This is a mock file.")); } + }; + } + + public static Map parseQueryString(RecordedRequest req) { + Map queryMap = new HashMap<>(); + + try { + HttpUrl requestUrl = req.getRequestUrl(); + + if (requestUrl != null) { + Set queryParamsNames = requestUrl.queryParameterNames(); + // map the parameter name to its corresponding value + for (String p : queryParamsNames) { + // get the corresponding value for the parameter (p) + List val = requestUrl.queryParameterValues(p); + if (val != null && !val.isEmpty()) { + String joinedQuery = String.join(",", val); + queryMap.put(p, joinedQuery); + } + } + } + if (queryMap.isEmpty()) { + return null; + } + } catch (Exception e) { + return null; + } + + return queryMap; + } + + public static String parseReqPath(RecordedRequest req) { + String parsedPath = null; + + try { + String fullPath = req.getPath(); + if (fullPath != null && !fullPath.isEmpty()) { + // retrieve the path segment before the query parameter + parsedPath = fullPath.split("\\?", 2)[0]; + } + if (parsedPath.isEmpty() || parsedPath == null) { + return null; + } + + } catch (Exception e) { + return null; + } + + return parsedPath; + } + + public static String serialize(Object obj) { + return GsonSingleton.getGson().toJson(obj); + } + + public static T deserialize(String json, Class clazz) { + return GsonSingleton.getGson().fromJson(json, clazz); + } + + public static InputStream createMockStream(String s) { + return new ByteArrayInputStream(s.getBytes()); + } + + public static List creatMockListFileWithMetadata() { + List list = new ArrayList(); + byte[] fileBytes = {(byte) 0xde, (byte) 0xad, (byte) 0xbe, (byte) 0xef}; + InputStream inputStream = new ByteArrayInputStream(fileBytes); + FileWithMetadata.Builder builder = new FileWithMetadata.Builder(); + builder.data(inputStream); + FileWithMetadata fileWithMetadata = builder.build(); + list.add(fileWithMetadata); + + return list; + } + + public static byte[] createMockByteArray(String encodedString) throws Exception { + return Base64.getDecoder().decode(encodedString); + } + + public static Date createMockDate(String date) throws Exception { + return DateUtils.parseAsDate(date); + } + + public static Date createMockDateTime(String date) throws Exception { + return DateUtils.parseAsDateTime(date); + } +} \ No newline at end of file From d57957b00c69eb36ce5a5e157c62c852bcbe8e33 Mon Sep 17 00:00:00 2001 From: Bhavana Bellamgari Date: Wed, 10 Dec 2025 13:12:17 +0530 Subject: [PATCH 05/13] Removed the wrongly generated code Signed-off-by: Bhavana Bellamgari Signed-off-by: Bhavana Bellamgari --- .../v1/IamPolicyManagement.java | 2566 --------- .../AccountSettingsAccessManagement.java | 40 - .../v1/model/ActionControlAssignment.java | 207 - .../ActionControlAssignmentCollection.java | 88 - .../ActionControlAssignmentResource.java | 52 - ...ontrolAssignmentResourceActionControl.java | 53 - ...ctionControlAssignmentResourceCreated.java | 38 - .../ActionControlAssignmentTemplate.java | 134 - .../model/ActionControlAssignmentsPager.java | 108 - .../v1/model/ActionControlTemplate.java | 203 - .../ActionControlTemplateCollection.java | 90 - ...tionControlTemplateVersionsCollection.java | 88 - .../ActionControlTemplateVersionsPager.java | 108 - .../v1/model/ActionControlTemplatesPager.java | 108 - .../v1/model/AssignmentResourceCreated.java | 38 - .../v1/model/AssignmentResourceError.java | 88 - .../v1/model/AssignmentTargetDetails.java | 142 - .../v1/model/AssignmentTemplateDetails.java | 119 - .../CommitActionControlTemplateOptions.java | 134 - .../v1/model/CommitPolicyTemplateOptions.java | 134 - .../v1/model/CommitRoleTemplateOptions.java | 134 - .../v1/model/ConflictsWith.java | 62 - .../v1/model/Control.java | 104 - .../v1/model/ControlResponse.java | 42 - .../v1/model/ControlResponseControl.java | 24 - ...ntrolResponseControlWithEnrichedRoles.java | 24 - ...ctionControlTemplateAssignmentOptions.java | 191 - .../CreateActionControlTemplateOptions.java | 251 - ...teActionControlTemplateVersionOptions.java | 211 - .../v1/model/CreatePolicyOptions.java | 311 - ...CreatePolicyTemplateAssignmentOptions.java | 221 - .../v1/model/CreatePolicyTemplateOptions.java | 255 - .../CreatePolicyTemplateVersionOptions.java | 214 - .../v1/model/CreateRoleOptions.java | 308 - .../CreateRoleTemplateAssignmentOptions.java | 191 - .../v1/model/CreateRoleTemplateOptions.java | 251 - .../CreateRoleTemplateVersionOptions.java | 211 - .../v1/model/CreateV2PolicyOptions.java | 312 - .../v1/model/CustomRole.java | 195 - .../DeleteActionControlAssignmentOptions.java | 104 - .../DeleteActionControlTemplateOptions.java | 104 - ...teActionControlTemplateVersionOptions.java | 134 - .../model/DeletePolicyAssignmentOptions.java | 104 - .../v1/model/DeletePolicyOptions.java | 104 - .../v1/model/DeletePolicyTemplateOptions.java | 104 - .../DeletePolicyTemplateVersionOptions.java | 134 - .../v1/model/DeleteRoleAssignmentOptions.java | 104 - .../v1/model/DeleteRoleOptions.java | 104 - .../v1/model/DeleteRoleTemplateOptions.java | 104 - .../DeleteRoleTemplateVersionOptions.java | 134 - .../v1/model/DeleteV2PolicyOptions.java | 104 - .../v1/model/EnrichedRoles.java | 81 - .../v1/model/ErrorDetails.java | 40 - .../v1/model/ErrorObject.java | 128 - .../ExternalAccountIdentityInteraction.java | 40 - ...ternalAccountIdentityInteractionPatch.java | 95 - .../iam_policy_management/v1/model/First.java | 38 - .../GetActionControlAssignmentOptions.java | 104 - .../GetActionControlTemplateOptions.java | 140 - ...etActionControlTemplateVersionOptions.java | 134 - .../v1/model/GetPolicyAssignmentOptions.java | 134 - .../v1/model/GetPolicyOptions.java | 104 - .../v1/model/GetPolicyTemplateOptions.java | 140 - .../GetPolicyTemplateVersionOptions.java | 134 - .../v1/model/GetRoleAssignmentOptions.java | 104 - .../v1/model/GetRoleOptions.java | 104 - .../v1/model/GetRoleTemplateOptions.java | 140 - .../model/GetRoleTemplateVersionOptions.java | 134 - .../v1/model/GetSettingsOptions.java | 141 - .../v1/model/GetV2PolicyOptions.java | 148 - .../iam_policy_management/v1/model/Grant.java | 124 - .../v1/model/GrantWithEnrichedRoles.java | 40 - .../v1/model/IdentityTypes.java | 64 - .../v1/model/IdentityTypesBase.java | 168 - .../v1/model/IdentityTypesPatch.java | 147 - .../v1/model/LimitData.java | 50 - .../ListActionControlAssignmentsOptions.java | 245 - ...tActionControlTemplateVersionsOptions.java | 192 - .../ListActionControlTemplatesOptions.java | 193 - .../v1/model/ListPoliciesOptions.java | 501 -- .../model/ListPolicyAssignmentsOptions.java | 275 - .../ListPolicyTemplateVersionsOptions.java | 192 - .../v1/model/ListPolicyTemplatesOptions.java | 379 -- .../v1/model/ListRoleAssignmentsOptions.java | 245 - .../ListRoleTemplateVersionsOptions.java | 192 - .../v1/model/ListRoleTemplatesOptions.java | 307 - .../v1/model/ListRolesOptions.java | 234 - .../v1/model/ListV2PoliciesOptions.java | 492 -- .../v1/model/NestedCondition.java | 126 - .../model/NestedConditionRuleAttribute.java | 170 - .../NestedConditionRuleWithConditions.java | 139 - .../iam_policy_management/v1/model/Next.java | 50 - .../v1/model/PoliciesPager.java | 108 - .../v1/model/Policy.java | 188 - .../model/PolicyAssignmentResourcePolicy.java | 65 - .../v1/model/PolicyAssignmentResources.java | 50 - .../v1/model/PolicyAssignmentV1.java | 193 - .../model/PolicyAssignmentV1Collection.java | 88 - .../v1/model/PolicyAssignmentV1Resources.java | 50 - .../v1/model/PolicyAssignmentV1Subject.java | 60 - .../v1/model/PolicyAssignmentsPager.java | 108 - .../v1/model/PolicyCollection.java | 88 - .../v1/model/PolicyResource.java | 167 - .../v1/model/PolicyRole.java | 131 - .../v1/model/PolicySubject.java | 124 - .../v1/model/PolicyTemplate.java | 202 - .../PolicyTemplateAssignmentCollection.java | 88 - .../model/PolicyTemplateAssignmentItems.java | 261 - ...mplateAssignmentItemsPolicyAssignment.java | 50 - ...lateAssignmentItemsPolicyAssignmentV1.java | 38 - .../v1/model/PolicyTemplateCollection.java | 90 - .../v1/model/PolicyTemplateLimitData.java | 214 - .../v1/model/PolicyTemplateMetaData.java | 201 - .../PolicyTemplateVersionsCollection.java | 88 - .../v1/model/PolicyTemplateVersionsPager.java | 108 - .../v1/model/PolicyTemplatesPager.java | 108 - .../v1/model/Previous.java | 50 - .../ReplaceActionControlTemplateOptions.java | 273 - .../v1/model/ReplacePolicyOptions.java | 335 -- .../model/ReplacePolicyTemplateOptions.java | 276 - .../v1/model/ReplaceRoleOptions.java | 255 - .../v1/model/ReplaceRoleTemplateOptions.java | 273 - .../v1/model/ReplaceV2PolicyOptions.java | 336 -- .../v1/model/ResourceAttribute.java | 160 - .../v1/model/ResourceTag.java | 160 - .../iam_policy_management/v1/model/Role.java | 196 - .../v1/model/RoleAction.java | 64 - .../v1/model/RoleAssignment.java | 207 - .../v1/model/RoleAssignmentCollection.java | 88 - .../v1/model/RoleAssignmentResource.java | 50 - .../model/RoleAssignmentResourceCreated.java | 38 - .../v1/model/RoleAssignmentResourceRole.java | 53 - .../v1/model/RoleAssignmentTemplate.java | 134 - .../v1/model/RoleAssignmentsPager.java | 108 - .../v1/model/RoleCollection.java | 68 - .../v1/model/RoleTemplate.java | 202 - .../v1/model/RoleTemplateCollection.java | 90 - .../v1/model/RoleTemplatePrototypeRole.java | 239 - .../v1/model/RoleTemplateReferencesItem.java | 134 - .../model/RoleTemplateVersionsCollection.java | 88 - .../v1/model/RoleTemplateVersionsPager.java | 108 - .../v1/model/RoleTemplatesPager.java | 108 - .../iam_policy_management/v1/model/Roles.java | 106 - .../v1/model/RuleAttribute.java | 209 - .../v1/model/SubjectAttribute.java | 134 - .../v1/model/TemplateActionControl.java | 182 - .../v1/model/TemplateControl.java | 104 - .../v1/model/TemplateCountData.java | 50 - .../v1/model/TemplateGrant.java | 58 - .../v1/model/TemplateGrantRoleReferences.java | 110 - .../v1/model/TemplateGrantRoles.java | 110 - .../v1/model/TemplateMetadata.java | 91 - .../v1/model/TemplatePolicy.java | 272 - .../v1/model/TemplateRole.java | 209 - .../UpdateActionControlAssignmentOptions.java | 166 - .../model/UpdatePolicyAssignmentOptions.java | 196 - .../v1/model/UpdatePolicyStateOptions.java | 171 - .../v1/model/UpdateRoleAssignmentOptions.java | 166 - .../v1/model/UpdateSettingsOptions.java | 199 - .../v1/model/V2PoliciesPager.java | 108 - .../v1/model/V2Policy.java | 247 - .../v1/model/V2PolicyCollection.java | 88 - .../v1/model/V2PolicyResource.java | 167 - .../v1/model/V2PolicyResourceAttribute.java | 181 - .../v1/model/V2PolicyResourceTag.java | 174 - .../v1/model/V2PolicyRule.java | 126 - .../v1/model/V2PolicyRuleRuleAttribute.java | 170 - .../V2PolicyRuleRuleWithNestedConditions.java | 139 - .../v1/model/V2PolicySubject.java | 124 - .../v1/model/V2PolicySubjectAttribute.java | 175 - .../v1/model/V2PolicyTemplateMetaData.java | 260 - .../v1/package-info.java | 17 - .../v1/IamPolicyManagementTest.java | 5007 ----------------- .../AccountSettingsAccessManagementTest.java | 40 - ...ActionControlAssignmentCollectionTest.java | 47 - ...olAssignmentResourceActionControlTest.java | 43 - ...nControlAssignmentResourceCreatedTest.java | 37 - .../ActionControlAssignmentResourceTest.java | 45 - .../ActionControlAssignmentTemplateTest.java | 54 - .../v1/model/ActionControlAssignmentTest.java | 40 - .../ActionControlTemplateCollectionTest.java | 46 - .../v1/model/ActionControlTemplateTest.java | 44 - ...ControlTemplateVersionsCollectionTest.java | 46 - .../model/AssignmentResourceCreatedTest.java | 37 - .../v1/model/AssignmentResourceErrorTest.java | 44 - .../v1/model/AssignmentTargetDetailsTest.java | 54 - .../model/AssignmentTemplateDetailsTest.java | 48 - ...ommitActionControlTemplateOptionsTest.java | 47 - .../CommitPolicyTemplateOptionsTest.java | 47 - .../model/CommitRoleTemplateOptionsTest.java | 47 - .../v1/model/ConflictsWithTest.java | 39 - .../v1/model/ControlResponseControlTest.java | 39 - ...lResponseControlWithEnrichedRolesTest.java | 40 - .../v1/model/ControlResponseTest.java | 40 - .../v1/model/ControlTest.java | 63 - ...nControlTemplateAssignmentOptionsTest.java | 65 - ...reateActionControlTemplateOptionsTest.java | 65 - ...tionControlTemplateVersionOptionsTest.java | 63 - .../v1/model/CreatePolicyOptionsTest.java | 103 - ...tePolicyTemplateAssignmentOptionsTest.java | 67 - .../CreatePolicyTemplateOptionsTest.java | 145 - ...reatePolicyTemplateVersionOptionsTest.java | 143 - .../v1/model/CreateRoleOptionsTest.java | 57 - ...eateRoleTemplateAssignmentOptionsTest.java | 65 - .../model/CreateRoleTemplateOptionsTest.java | 69 - .../CreateRoleTemplateVersionOptionsTest.java | 65 - .../v1/model/CreateV2PolicyOptionsTest.java | 131 - .../v1/model/CustomRoleTest.java | 42 - ...eteActionControlAssignmentOptionsTest.java | 45 - ...eleteActionControlTemplateOptionsTest.java | 45 - ...tionControlTemplateVersionOptionsTest.java | 47 - .../DeletePolicyAssignmentOptionsTest.java | 45 - .../v1/model/DeletePolicyOptionsTest.java | 45 - .../DeletePolicyTemplateOptionsTest.java | 45 - ...eletePolicyTemplateVersionOptionsTest.java | 47 - .../DeleteRoleAssignmentOptionsTest.java | 45 - .../v1/model/DeleteRoleOptionsTest.java | 45 - .../model/DeleteRoleTemplateOptionsTest.java | 45 - .../DeleteRoleTemplateVersionOptionsTest.java | 47 - .../v1/model/DeleteV2PolicyOptionsTest.java | 45 - .../v1/model/EnrichedRolesTest.java | 39 - .../v1/model/ErrorDetailsTest.java | 38 - .../v1/model/ErrorObjectTest.java | 42 - ...alAccountIdentityInteractionPatchTest.java | 63 - ...xternalAccountIdentityInteractionTest.java | 39 - .../v1/model/FirstTest.java | 36 - ...GetActionControlAssignmentOptionsTest.java | 45 - .../GetActionControlTemplateOptionsTest.java | 47 - ...tionControlTemplateVersionOptionsTest.java | 47 - .../model/GetPolicyAssignmentOptionsTest.java | 47 - .../v1/model/GetPolicyOptionsTest.java | 45 - .../model/GetPolicyTemplateOptionsTest.java | 47 - .../GetPolicyTemplateVersionOptionsTest.java | 47 - .../model/GetRoleAssignmentOptionsTest.java | 45 - .../v1/model/GetRoleOptionsTest.java | 45 - .../v1/model/GetRoleTemplateOptionsTest.java | 47 - .../GetRoleTemplateVersionOptionsTest.java | 47 - .../v1/model/GetSettingsOptionsTest.java | 47 - .../v1/model/GetV2PolicyOptionsTest.java | 47 - .../v1/model/GrantTest.java | 56 - .../v1/model/GrantWithEnrichedRolesTest.java | 39 - .../v1/model/IdentityTypesBaseTest.java | 53 - .../v1/model/IdentityTypesPatchTest.java | 59 - .../v1/model/IdentityTypesTest.java | 40 - .../v1/model/LimitDataTest.java | 36 - ...stActionControlAssignmentsOptionsTest.java | 55 - ...ionControlTemplateVersionsOptionsTest.java | 51 - ...ListActionControlTemplatesOptionsTest.java | 51 - .../v1/model/ListPoliciesOptionsTest.java | 69 - .../ListPolicyAssignmentsOptionsTest.java | 57 - ...ListPolicyTemplateVersionsOptionsTest.java | 51 - .../model/ListPolicyTemplatesOptionsTest.java | 63 - .../model/ListRoleAssignmentsOptionsTest.java | 55 - .../ListRoleTemplateVersionsOptionsTest.java | 51 - .../model/ListRoleTemplatesOptionsTest.java | 59 - .../v1/model/ListRolesOptionsTest.java | 49 - .../v1/model/ListV2PoliciesOptionsTest.java | 69 - .../NestedConditionRuleAttributeTest.java | 57 - ...NestedConditionRuleWithConditionsTest.java | 63 - .../v1/model/NestedConditionTest.java | 38 - .../v1/model/NextTest.java | 37 - .../PolicyAssignmentResourcePolicyTest.java | 44 - .../model/PolicyAssignmentResourcesTest.java | 44 - .../PolicyAssignmentV1CollectionTest.java | 55 - .../PolicyAssignmentV1ResourcesTest.java | 45 - .../model/PolicyAssignmentV1SubjectTest.java | 36 - .../v1/model/PolicyAssignmentV1Test.java | 51 - .../v1/model/PolicyCollectionTest.java | 52 - .../v1/model/PolicyResourceTest.java | 72 - .../v1/model/PolicyRoleTest.java | 51 - .../v1/model/PolicySubjectTest.java | 58 - ...olicyTemplateAssignmentCollectionTest.java | 55 - ...teAssignmentItemsPolicyAssignmentTest.java | 50 - ...AssignmentItemsPolicyAssignmentV1Test.java | 51 - .../PolicyTemplateAssignmentItemsTest.java | 48 - .../model/PolicyTemplateCollectionTest.java | 55 - .../v1/model/PolicyTemplateLimitDataTest.java | 56 - .../v1/model/PolicyTemplateMetaDataTest.java | 50 - .../v1/model/PolicyTemplateTest.java | 53 - .../PolicyTemplateVersionsCollectionTest.java | 55 - .../v1/model/PolicyTest.java | 48 - .../v1/model/PreviousTest.java | 37 - ...placeActionControlTemplateOptionsTest.java | 67 - .../v1/model/ReplacePolicyOptionsTest.java | 105 - .../ReplacePolicyTemplateOptionsTest.java | 147 - .../v1/model/ReplaceRoleOptionsTest.java | 53 - .../model/ReplaceRoleTemplateOptionsTest.java | 69 - .../v1/model/ReplaceV2PolicyOptionsTest.java | 133 - .../v1/model/ResourceAttributeTest.java | 57 - .../v1/model/ResourceTagTest.java | 57 - .../v1/model/RoleActionTest.java | 39 - .../model/RoleAssignmentCollectionTest.java | 47 - .../RoleAssignmentResourceCreatedTest.java | 37 - .../model/RoleAssignmentResourceRoleTest.java | 43 - .../v1/model/RoleAssignmentResourceTest.java | 45 - .../v1/model/RoleAssignmentTemplateTest.java | 54 - .../v1/model/RoleAssignmentTest.java | 40 - .../v1/model/RoleCollectionTest.java | 41 - .../v1/model/RoleTemplateCollectionTest.java | 46 - .../model/RoleTemplatePrototypeRoleTest.java | 62 - .../model/RoleTemplateReferencesItemTest.java | 54 - .../v1/model/RoleTemplateTest.java | 44 - .../RoleTemplateVersionsCollectionTest.java | 46 - .../v1/model/RoleTest.java | 56 - .../v1/model/RolesTest.java | 51 - .../v1/model/RuleAttributeTest.java | 57 - .../v1/model/SubjectAttributeTest.java | 54 - .../v1/model/TemplateActionControlTest.java | 56 - .../v1/model/TemplateControlTest.java | 63 - .../v1/model/TemplateCountDataTest.java | 39 - .../TemplateGrantRoleReferencesTest.java | 58 - .../v1/model/TemplateGrantRolesTest.java | 56 - .../v1/model/TemplateGrantTest.java | 39 - .../v1/model/TemplateMetadataTest.java | 41 - .../v1/model/TemplatePolicyTest.java | 141 - .../v1/model/TemplateRoleTest.java | 59 - ...ateActionControlAssignmentOptionsTest.java | 49 - .../UpdatePolicyAssignmentOptionsTest.java | 51 - .../model/UpdatePolicyStateOptionsTest.java | 49 - .../UpdateRoleAssignmentOptionsTest.java | 49 - .../v1/model/UpdateSettingsOptionsTest.java | 75 - .../v1/model/V2PolicyCollectionTest.java | 55 - .../model/V2PolicyResourceAttributeTest.java | 57 - .../v1/model/V2PolicyResourceTagTest.java | 57 - .../v1/model/V2PolicyResourceTest.java | 72 - .../model/V2PolicyRuleRuleAttributeTest.java | 57 - ...olicyRuleRuleWithNestedConditionsTest.java | 63 - .../v1/model/V2PolicyRuleTest.java | 38 - .../model/V2PolicySubjectAttributeTest.java | 57 - .../v1/model/V2PolicySubjectTest.java | 60 - .../model/V2PolicyTemplateMetaDataTest.java | 57 - .../v1/model/V2PolicyTest.java | 55 - .../v1/utils/TestUtilities.java | 131 - 333 files changed, 41258 deletions(-) delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java deleted file mode 100644 index 2abe3baea4e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java +++ /dev/null @@ -1,2566 +0,0 @@ -/* - * (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. - */ - -/* - * IBM OpenAPI SDK Code Generator Version: 3.107.1-41b0fbd0-20250825-080732 - */ - -package com.ibm.cloud.platform_services.iam_policy_management.v1; - -import com.google.gson.JsonObject; -import com.ibm.cloud.platform_services.common.SdkCommon; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; -import com.ibm.cloud.sdk.core.http.RequestBuilder; -import com.ibm.cloud.sdk.core.http.ResponseConverter; -import com.ibm.cloud.sdk.core.http.ServiceCall; -import com.ibm.cloud.sdk.core.security.Authenticator; -import com.ibm.cloud.sdk.core.security.ConfigBasedAuthenticatorFactory; -import com.ibm.cloud.sdk.core.service.BaseService; -import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -/** - * IAM Policy Management API. - * - * API Version: 1.0.1 - */ -public class IamPolicyManagement extends BaseService { - - /** - * Default service name used when configuring the `IamPolicyManagement` client. - */ - public static final String DEFAULT_SERVICE_NAME = "iam_policy_management"; - - /** - * Default service endpoint URL. - */ - public static final String DEFAULT_SERVICE_URL = "https://iam.cloud.ibm.com"; - - /** - * Class method which constructs an instance of the `IamPolicyManagement` client. - * The default service name is used to configure the client instance. - * - * @return an instance of the `IamPolicyManagement` client using external configuration - */ - public static IamPolicyManagement newInstance() { - return newInstance(DEFAULT_SERVICE_NAME); - } - - /** - * Class method which constructs an instance of the `IamPolicyManagement` client. - * The specified service name is used to configure the client instance. - * - * @param serviceName the service name to be used when configuring the client instance - * @return an instance of the `IamPolicyManagement` client using external configuration - */ - public static IamPolicyManagement newInstance(String serviceName) { - Authenticator authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(serviceName); - IamPolicyManagement service = new IamPolicyManagement(serviceName, authenticator); - service.configureService(serviceName); - return service; - } - - /** - * Constructs an instance of the `IamPolicyManagement` client. - * The specified service name and authenticator are used to configure the client instance. - * - * @param serviceName the service name to be used when configuring the client instance - * @param authenticator the {@link Authenticator} instance to be configured for this client - */ - public IamPolicyManagement(String serviceName, Authenticator authenticator) { - super(serviceName, authenticator); - setServiceUrl(DEFAULT_SERVICE_URL); - } - - /** - * Get policies by attributes. - * - * Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account - * and filter by attribute values. This can be done through query parameters. The following attributes are supported: - * account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query - * parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If - * the caller does not have read access to any policies an empty array is returned. - * - * @param listPoliciesOptions the {@link ListPoliciesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyCollection} - */ - public ServiceCall listPolicies(ListPoliciesOptions listPoliciesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listPoliciesOptions, - "listPoliciesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicies"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listPoliciesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listPoliciesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listPoliciesOptions.accountId())); - if (listPoliciesOptions.iamId() != null) { - builder.query("iam_id", String.valueOf(listPoliciesOptions.iamId())); - } - if (listPoliciesOptions.accessGroupId() != null) { - builder.query("access_group_id", String.valueOf(listPoliciesOptions.accessGroupId())); - } - if (listPoliciesOptions.type() != null) { - builder.query("type", String.valueOf(listPoliciesOptions.type())); - } - if (listPoliciesOptions.serviceType() != null) { - builder.query("service_type", String.valueOf(listPoliciesOptions.serviceType())); - } - if (listPoliciesOptions.tagName() != null) { - builder.query("tag_name", String.valueOf(listPoliciesOptions.tagName())); - } - if (listPoliciesOptions.tagValue() != null) { - builder.query("tag_value", String.valueOf(listPoliciesOptions.tagValue())); - } - if (listPoliciesOptions.sort() != null) { - builder.query("sort", String.valueOf(listPoliciesOptions.sort())); - } - if (listPoliciesOptions.format() != null) { - builder.query("format", String.valueOf(listPoliciesOptions.format())); - } - if (listPoliciesOptions.state() != null) { - builder.query("state", String.valueOf(listPoliciesOptions.state())); - } - if (listPoliciesOptions.limit() != null) { - builder.query("limit", String.valueOf(listPoliciesOptions.limit())); - } - if (listPoliciesOptions.start() != null) { - builder.query("start", String.valueOf(listPoliciesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a policy. - * - * Creates a policy to grant access between a subject and a resource. There are two types of policies: **access** and - * **authorization**. A policy administrator might want to create an access policy which grants access to a user, - * service-id, or an access group. They might also want to create an authorization policy and setup access between - * services. - * - * ### Access - * - * To create an access policy, use **`"type": "access"`** in the body. The possible subject attributes are - * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or - * service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. Assign roles - * that are supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or - * **`service_group_id`** attribute and the **`accountId`** attribute. The IAM Services group (`IAM`) is a subset of - * account management services that includes the IAM platform services IAM Identity, IAM Access Management, IAM Users - * Management, IAM Groups, and future IAM services. If the subject is a locked service-id, the request will fail. - * - * ### Authorization - * - * Authorization policies are supported by services on a case by case basis. Refer to service documentation to verify - * their support of authorization policies. To create an authorization policy, use **`"type": "authorization"`** in - * the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject - * attributes might be provided. The following attributes are supported: - * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are - * supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access - * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject - * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. - * - * ### Attribute Operators - * - * Currently, only the `stringEquals` and the `stringMatch` operators are available. Resource attributes may support - * one or both operators. For more information, see [Assigning access by using wildcard - * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). - * - * ### Attribute Validations - * - * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like - * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated - * against Global Catalog locations. - * - * @param createPolicyOptions the {@link CreatePolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Policy} - */ - public ServiceCall createPolicy(CreatePolicyOptions createPolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyOptions, - "createPolicyOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createPolicyOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createPolicyOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("type", createPolicyOptions.type()); - contentJson.add("subjects", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.subjects())); - contentJson.add("roles", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.roles())); - contentJson.add("resources", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.resources())); - if (createPolicyOptions.description() != null) { - contentJson.addProperty("description", createPolicyOptions.description()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a policy. - * - * Update a policy to grant access between a subject and a resource. A policy administrator might want to update an - * existing policy. The policy type cannot be changed (You cannot change an access policy to an authorization policy). - * - * ### Access - * - * To update an access policy, use **`"type": "access"`** in the body. The possible subject attributes are - * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or - * service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. Assign roles - * that are supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * The policy resource must include either the **`serviceType`**, **`serviceName`**, or **`resourceGroupId`** - * attribute and the **`accountId`** attribute.` If the subject is a locked service-id, the request will fail. - * - * ### Authorization - * - * To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match - * the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following - * attributes are supported: - * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are - * supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access - * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject - * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. - * - * ### Attribute Operators - * - * Currently, only the `stringEquals` and the `stringMatch` operators are available. Resource attributes might support - * one or both operators. For more information, see [Assigning access by using wildcard - * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). - * - * ### Attribute Validations - * - * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like - * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated - * against Global Catalog locations. - * - * @param replacePolicyOptions the {@link ReplacePolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Policy} - */ - public ServiceCall replacePolicy(ReplacePolicyOptions replacePolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replacePolicyOptions, - "replacePolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_id", replacePolicyOptions.policyId()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replacePolicy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replacePolicyOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("type", replacePolicyOptions.type()); - contentJson.add("subjects", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.subjects())); - contentJson.add("roles", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.roles())); - contentJson.add("resources", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.resources())); - if (replacePolicyOptions.description() != null) { - contentJson.addProperty("description", replacePolicyOptions.description()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a policy by ID. - * - * Retrieve a policy by providing a policy ID. - * - * @param getPolicyOptions the {@link GetPolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateMetaData} - */ - public ServiceCall getPolicy(GetPolicyOptions getPolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyOptions, - "getPolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_id", getPolicyOptions.policyId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicy"); - 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); - } - - /** - * Delete a policy by ID. - * - * Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service - * ID. If the subject of the policy is a locked service-id, the request will fail. - * - * @param deletePolicyOptions the {@link DeletePolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deletePolicy(DeletePolicyOptions deletePolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyOptions, - "deletePolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_id", deletePolicyOptions.policyId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Restore a deleted policy by ID. - * - * Restore a policy that has recently been deleted. A policy administrator might want to restore a deleted policy. To - * restore a policy, use **`"state": "active"`** in the body. - * - * @param updatePolicyStateOptions the {@link UpdatePolicyStateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Policy} - */ - public ServiceCall updatePolicyState(UpdatePolicyStateOptions updatePolicyStateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updatePolicyStateOptions, - "updatePolicyStateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_id", updatePolicyStateOptions.policyId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updatePolicyState"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updatePolicyStateOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - if (updatePolicyStateOptions.state() != null) { - contentJson.addProperty("state", updatePolicyStateOptions.state()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get roles by filters. - * - * Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can - * be done through query parameters. Currently, we only support the following attributes: account_id, service_name, - * service_group_id, source_service_name and policy_type. Both service_name and service_group_id attributes are - * mutually exclusive. Only roles that match the filter and that the caller has read access to are returned. If the - * caller does not have read access to any roles an empty array is returned. - * - * @param listRolesOptions the {@link ListRolesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleCollection} - */ - public ServiceCall listRoles(ListRolesOptions listRolesOptions) { - if (listRolesOptions == null) { - listRolesOptions = new ListRolesOptions.Builder().build(); - } - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoles"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listRolesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listRolesOptions.acceptLanguage()); - } - if (listRolesOptions.accountId() != null) { - builder.query("account_id", String.valueOf(listRolesOptions.accountId())); - } - if (listRolesOptions.serviceName() != null) { - builder.query("service_name", String.valueOf(listRolesOptions.serviceName())); - } - if (listRolesOptions.sourceServiceName() != null) { - builder.query("source_service_name", String.valueOf(listRolesOptions.sourceServiceName())); - } - if (listRolesOptions.policyType() != null) { - builder.query("policy_type", String.valueOf(listRolesOptions.policyType())); - } - if (listRolesOptions.serviceGroupId() != null) { - builder.query("service_group_id", String.valueOf(listRolesOptions.serviceGroupId())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get roles by filters. - * - * Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can - * be done through query parameters. Currently, we only support the following attributes: account_id, service_name, - * service_group_id, source_service_name and policy_type. Both service_name and service_group_id attributes are - * mutually exclusive. Only roles that match the filter and that the caller has read access to are returned. If the - * caller does not have read access to any roles an empty array is returned. - * - * @return a {@link ServiceCall} with a result of type {@link RoleCollection} - */ - public ServiceCall listRoles() { - return listRoles(null); - } - - /** - * Create a role. - * - * Creates a custom role for a specific service within the account. An account owner or a user assigned the - * Administrator role on the Role management service can create a custom role. Any number of actions for a single - * service can be mapped to the new role, but there must be at least one service-defined action to successfully create - * the new role. - * - * @param createRoleOptions the {@link CreateRoleOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link CustomRole} - */ - public ServiceCall createRole(CreateRoleOptions createRoleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleOptions, - "createRoleOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRole"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createRoleOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createRoleOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("display_name", createRoleOptions.displayName()); - contentJson.add("actions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleOptions.actions())); - contentJson.addProperty("name", createRoleOptions.name()); - contentJson.addProperty("account_id", createRoleOptions.accountId()); - contentJson.addProperty("service_name", createRoleOptions.serviceName()); - if (createRoleOptions.description() != null) { - contentJson.addProperty("description", createRoleOptions.description()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a role. - * - * Update a custom role. A role administrator might want to update an existing role by updating the display name, - * description, or the actions that are mapped to the role. The name, account_id, and service_name can't be changed. - * - * @param replaceRoleOptions the {@link ReplaceRoleOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link CustomRole} - */ - public ServiceCall replaceRole(ReplaceRoleOptions replaceRoleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceRoleOptions, - "replaceRoleOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_id", replaceRoleOptions.roleId()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceRole"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replaceRoleOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("display_name", replaceRoleOptions.displayName()); - contentJson.add("actions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRoleOptions.actions())); - if (replaceRoleOptions.description() != null) { - contentJson.addProperty("description", replaceRoleOptions.description()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a role by ID. - * - * Retrieve a role by providing a role ID. - * - * @param getRoleOptions the {@link GetRoleOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link CustomRole} - */ - public ServiceCall getRole(GetRoleOptions getRoleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleOptions, - "getRoleOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_id", getRoleOptions.roleId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRole"); - 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); - } - - /** - * Delete a role by ID. - * - * Delete a role by providing a role ID. - * - * @param deleteRoleOptions the {@link DeleteRoleOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteRole(DeleteRoleOptions deleteRoleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleOptions, - "deleteRoleOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_id", deleteRoleOptions.roleId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRole"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get policies by attributes. - * - * Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account - * and filter by attribute values. This can be done through query parameters. The following attributes are supported: - * account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query - * parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If - * the caller does not have read access to any policies an empty array is returned. - * - * @param listV2PoliciesOptions the {@link ListV2PoliciesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link V2PolicyCollection} - */ - public ServiceCall listV2Policies(ListV2PoliciesOptions listV2PoliciesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listV2PoliciesOptions, - "listV2PoliciesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listV2Policies"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listV2PoliciesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listV2PoliciesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listV2PoliciesOptions.accountId())); - if (listV2PoliciesOptions.iamId() != null) { - builder.query("iam_id", String.valueOf(listV2PoliciesOptions.iamId())); - } - if (listV2PoliciesOptions.accessGroupId() != null) { - builder.query("access_group_id", String.valueOf(listV2PoliciesOptions.accessGroupId())); - } - if (listV2PoliciesOptions.type() != null) { - builder.query("type", String.valueOf(listV2PoliciesOptions.type())); - } - if (listV2PoliciesOptions.serviceType() != null) { - builder.query("service_type", String.valueOf(listV2PoliciesOptions.serviceType())); - } - if (listV2PoliciesOptions.serviceName() != null) { - builder.query("service_name", String.valueOf(listV2PoliciesOptions.serviceName())); - } - if (listV2PoliciesOptions.serviceGroupId() != null) { - builder.query("service_group_id", String.valueOf(listV2PoliciesOptions.serviceGroupId())); - } - if (listV2PoliciesOptions.sort() != null) { - builder.query("sort", String.valueOf(listV2PoliciesOptions.sort())); - } - if (listV2PoliciesOptions.format() != null) { - builder.query("format", String.valueOf(listV2PoliciesOptions.format())); - } - if (listV2PoliciesOptions.state() != null) { - builder.query("state", String.valueOf(listV2PoliciesOptions.state())); - } - if (listV2PoliciesOptions.limit() != null) { - builder.query("limit", String.valueOf(listV2PoliciesOptions.limit())); - } - if (listV2PoliciesOptions.start() != null) { - builder.query("start", String.valueOf(listV2PoliciesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a policy. - * - * Creates a policy to grant access between a subject and a resource. Currently, there is one type of a v2/policy: - * **access**. A policy administrator might want to create an access policy that grants access to a user, service-id, - * or an access group. - * - * ### Access - * - * To create an access policy, use **`"type": "access"`** in the body. The supported subject attributes are - * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute to assign access to a user or - * service-id. Use the **`access_group_id`** subject attribute to assign access to an access group. Assign roles that - * are supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or - * **`service_group_id`** attribute and the **`accountId`** attribute. In the rule field, you can specify a single - * condition by using **`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`** with a - * combination **`operator`**. The possible combination operators are **`and`** and **`or`**. - * - * Currently, we support two types of patterns: - * - * 1. `time-based`: Used to specify a time-based restriction - * - * Combine conditions to specify a time-based restriction (e.g., access only during business hours, during the - * Monday-Friday work week). For example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following - * rule: - * ```json - * "rule": { - * "operator": "and", - * "conditions": [{ - * "key": "{{environment.attributes.day_of_week}}", - * "operator": "dayOfWeekAnyOf", - * "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] - * }, - * "key": "{{environment.attributes.current_time}}", - * "operator": "timeGreaterThanOrEquals", - * "value": "09:00:00+00:00" - * }, - * "key": "{{environment.attributes.current_time}}", - * "operator": "timeLessThanOrEquals", - * "value": "17:00:00+00:00" - * }] - * } - * ``` You can use the following operators in the **`key`** and **`value`** pair: - * ``` - * 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', - * 'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan', 'dateGreaterThanOrEquals', - * 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', - * 'dayOfWeekEquals', 'dayOfWeekAnyOf' - * ``` - * - * The pattern field that matches the rule is required when rule is provided. For the business hour rule example - * above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions - * operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) and - * [Limiting access with time-based conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the - * subject is a locked service-id, the request will fail. - * - * 2. `attribute-based`: Used to specify a combination of OR/AND based conditions applied on resource attributes. - * - * Combine conditions to specify an attribute-based condition using AND/OR-based operators. - * - * For example, a policy can grant access based on multiple conditions applied on the resource attributes below: - * ```json - * "pattern": "attribute-based-condition:resource:literal-and-wildcard" - * "rule": { - * "operator": "or", - * "conditions": [ - * { - * "operator": "and", - * "conditions": [ - * { - * "key": "{{resource.attributes.prefix}}", - * "operator": "stringEquals", - * "value": "home/test" - * }, - * { - * "key": "{{environment.attributes.delimiter}}", - * "operator": "stringEquals", - * "value": "/" - * } - * ] - * }, - * { - * "key": "{{resource.attributes.path}}", - * "operator": "stringMatch", - * "value": "home/David/_*" - * } - * ] - * } - * ``` - * - * In addition to satisfying the `resources` section, the policy grants permission only if either the `path` begins - * with `home/David/` **OR** the `prefix` is `home/test` and the `delimiter` is `/`. This mechanism helps you - * consolidate multiple policies in to a single policy, making policies easier to administer and stay within the - * policy limit for an account. View the list of operators that can be used in the condition - * [here](/docs/account?topic=account-wildcard#string-comparisons). - * - * ### Authorization - * - * Authorization policies are supported by services on a case by case basis. Refer to service documentation to verify - * their support of authorization policies. To create an authorization policy, use **`"type": "authorization"`** in - * the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject - * attributes might be provided. The following attributes are supported: - * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are - * supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access - * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject - * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. - * - * ### Attribute Operators - * - * Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators are available. For more - * information, see [Assigning access by using wildcard - * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). - * - * ### Attribute Validations - * - * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like - * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated - * against Global Catalog locations. - * - * @param createV2PolicyOptions the {@link CreateV2PolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link V2Policy} - */ - public ServiceCall createV2Policy(CreateV2PolicyOptions createV2PolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createV2PolicyOptions, - "createV2PolicyOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createV2Policy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createV2PolicyOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createV2PolicyOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.add("control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.control())); - contentJson.addProperty("type", createV2PolicyOptions.type()); - if (createV2PolicyOptions.description() != null) { - contentJson.addProperty("description", createV2PolicyOptions.description()); - } - if (createV2PolicyOptions.subject() != null) { - contentJson.add("subject", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.subject())); - } - if (createV2PolicyOptions.resource() != null) { - contentJson.add("resource", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.resource())); - } - if (createV2PolicyOptions.pattern() != null) { - contentJson.addProperty("pattern", createV2PolicyOptions.pattern()); - } - if (createV2PolicyOptions.rule() != null) { - contentJson.add("rule", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.rule())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a policy. - * - * Update a policy to grant access between a subject and a resource. A policy administrator might want to update an - * existing policy. - * - * ### Access - * - * To update an access policy, use **`"type": "access"`** in the body. The supported subject attributes are - * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute to assign access to a user or - * service-id. Use the **`access_group_id`** subject attribute to assign access to an access group. Assign roles that - * are supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or - * **`service_group_id`** attribute and the **`accountId`** attribute. In the rule field, you can specify a single - * condition by using **`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`** with a - * combination **`operator`**. The possible combination operators are **`and`** and **`or`**. - * - * Currently, we support two types of patterns: - * - * 1. `time-based`: Used to specify a time-based restriction - * - * Combine conditions to specify a time-based restriction (e.g., access only during business hours, during the - * Monday-Friday work week). For example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following - * rule: - * ```json - * "rule": { - * "operator": "and", - * "conditions": [{ - * "key": "{{environment.attributes.day_of_week}}", - * "operator": "dayOfWeekAnyOf", - * "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] - * }, - * "key": "{{environment.attributes.current_time}}", - * "operator": "timeGreaterThanOrEquals", - * "value": "09:00:00+00:00" - * }, - * "key": "{{environment.attributes.current_time}}", - * "operator": "timeLessThanOrEquals", - * "value": "17:00:00+00:00" - * }] - * } - * ``` You can use the following operators in the **`key`** and **`value`** pair: - * ``` - * 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', - * 'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan', 'dateGreaterThanOrEquals', - * 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', - * 'dayOfWeekEquals', 'dayOfWeekAnyOf' - * ``` The pattern field that matches the rule is required when rule is provided. For the business hour rule example - * above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions - * operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) and - * [Limiting access with time-based conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the - * subject is a locked service-id, the request will fail. - * - * 2. `attribute-based`: Used to specify a combination of OR/AND based conditions applied on resource attributes. - * - * Combine conditions to specify an attribute-based condition using AND/OR-based operators. - * - * For example, a policy can grant access based on multiple conditions applied on the resource attributes below: - * ```json - * "pattern": "attribute-based-condition:resource:literal-and-wildcard" - * "rule": { - * "operator": "or", - * "conditions": [ - * { - * "operator": "and", - * "conditions": [ - * { - * "key": "{{resource.attributes.prefix}}", - * "operator": "stringEquals", - * "value": "home/test" - * }, - * { - * "key": "{{environment.attributes.delimiter}}", - * "operator": "stringEquals", - * "value": "/" - * } - * ] - * }, - * { - * "key": "{{resource.attributes.path}}", - * "operator": "stringMatch", - * "value": "home/David/_*" - * } - * ] - * } - * ``` - * - * In addition to satisfying the `resources` section, the policy grants permission only if either the `path` begins - * with `home/David/` **OR** the `prefix` is `home/test` and the `delimiter` is `/`. This mechanism helps you - * consolidate multiple policies in to a single policy, making policies easier to administer and stay within the - * policy limit for an account. View the list of operators that can be used in the condition - * [here](/docs/account?topic=account-wildcard#string-comparisons). - * - * ### Authorization - * - * To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match - * the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following - * attributes are supported: - * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are - * supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access - * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject - * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. - * - * ### Attribute Operators - * - * Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators are available. For more - * information, see [Assigning access by using wildcard - * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). - * - * ### Attribute Validations - * - * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like - * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated - * against Global Catalog locations. - * - * @param replaceV2PolicyOptions the {@link ReplaceV2PolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link V2Policy} - */ - public ServiceCall replaceV2Policy(ReplaceV2PolicyOptions replaceV2PolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceV2PolicyOptions, - "replaceV2PolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", replaceV2PolicyOptions.id()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceV2Policy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replaceV2PolicyOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.add("control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.control())); - contentJson.addProperty("type", replaceV2PolicyOptions.type()); - if (replaceV2PolicyOptions.description() != null) { - contentJson.addProperty("description", replaceV2PolicyOptions.description()); - } - if (replaceV2PolicyOptions.subject() != null) { - contentJson.add("subject", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.subject())); - } - if (replaceV2PolicyOptions.resource() != null) { - contentJson.add("resource", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.resource())); - } - if (replaceV2PolicyOptions.pattern() != null) { - contentJson.addProperty("pattern", replaceV2PolicyOptions.pattern()); - } - if (replaceV2PolicyOptions.rule() != null) { - contentJson.add("rule", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.rule())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a policy by ID. - * - * Retrieve a policy by providing a policy ID. - * - * @param getV2PolicyOptions the {@link GetV2PolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link V2PolicyTemplateMetaData} - */ - public ServiceCall getV2Policy(GetV2PolicyOptions getV2PolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getV2PolicyOptions, - "getV2PolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", getV2PolicyOptions.id()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getV2Policy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getV2PolicyOptions.format() != null) { - builder.query("format", String.valueOf(getV2PolicyOptions.format())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a policy by ID. - * - * Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service - * ID. If the subject of the policy is a locked service-id, the request will fail. - * - * @param deleteV2PolicyOptions the {@link DeleteV2PolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteV2Policy(DeleteV2PolicyOptions deleteV2PolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteV2PolicyOptions, - "deleteV2PolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", deleteV2PolicyOptions.id()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteV2Policy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List policy templates by attributes. - * - * List policy templates and filter by attributes by using query parameters. The following attributes are supported: - * `account_id`, `policy_service_name`, `policy_service_type`, `policy_service_group_id` and `policy_type`. - * `account_id` is a required query parameter. These attributes `policy_service_name`, `policy_service_type` and - * `policy_service_group_id` are mutually exclusive. Only policy templates that have the specified attributes and that - * the caller has read access to are returned. If the caller does not have read access to any policy templates an - * empty array is returned. - * - * @param listPolicyTemplatesOptions the {@link ListPolicyTemplatesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateCollection} - */ - public ServiceCall listPolicyTemplates(ListPolicyTemplatesOptions listPolicyTemplatesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyTemplatesOptions, - "listPolicyTemplatesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyTemplates"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listPolicyTemplatesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listPolicyTemplatesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listPolicyTemplatesOptions.accountId())); - if (listPolicyTemplatesOptions.state() != null) { - builder.query("state", String.valueOf(listPolicyTemplatesOptions.state())); - } - if (listPolicyTemplatesOptions.name() != null) { - builder.query("name", String.valueOf(listPolicyTemplatesOptions.name())); - } - if (listPolicyTemplatesOptions.policyServiceType() != null) { - builder.query("policy_service_type", String.valueOf(listPolicyTemplatesOptions.policyServiceType())); - } - if (listPolicyTemplatesOptions.policyServiceName() != null) { - builder.query("policy_service_name", String.valueOf(listPolicyTemplatesOptions.policyServiceName())); - } - if (listPolicyTemplatesOptions.policyServiceGroupId() != null) { - builder.query("policy_service_group_id", String.valueOf(listPolicyTemplatesOptions.policyServiceGroupId())); - } - if (listPolicyTemplatesOptions.policyType() != null) { - builder.query("policy_type", String.valueOf(listPolicyTemplatesOptions.policyType())); - } - if (listPolicyTemplatesOptions.limit() != null) { - builder.query("limit", String.valueOf(listPolicyTemplatesOptions.limit())); - } - if (listPolicyTemplatesOptions.start() != null) { - builder.query("start", String.valueOf(listPolicyTemplatesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a policy template. - * - * Create a policy template. Policy templates define a policy without requiring a subject, and you can use them to - * grant access to multiple subjects. - * - * @param createPolicyTemplateOptions the {@link CreatePolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateLimitData} - */ - public ServiceCall createPolicyTemplate(CreatePolicyTemplateOptions createPolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateOptions, - "createPolicyTemplateOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createPolicyTemplateOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createPolicyTemplateOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("name", createPolicyTemplateOptions.name()); - contentJson.addProperty("account_id", createPolicyTemplateOptions.accountId()); - contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateOptions.policy())); - if (createPolicyTemplateOptions.description() != null) { - contentJson.addProperty("description", createPolicyTemplateOptions.description()); - } - if (createPolicyTemplateOptions.committed() != null) { - contentJson.addProperty("committed", createPolicyTemplateOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve latest version of a policy template. - * - * Retrieve the latest version of a policy template by providing a policy template ID. - * - * @param getPolicyTemplateOptions the {@link GetPolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} - */ - public ServiceCall getPolicyTemplate(GetPolicyTemplateOptions getPolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyTemplateOptions, - "getPolicyTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", getPolicyTemplateOptions.policyTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getPolicyTemplateOptions.state() != null) { - builder.query("state", String.valueOf(getPolicyTemplateOptions.state())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a policy template. - * - * Delete a policy template by providing the policy template ID. This deletes all versions of this template. A policy - * template can't be deleted if any version of the template is assigned to one or more child accounts. You must remove - * the policy assignments first. - * - * @param deletePolicyTemplateOptions the {@link DeletePolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deletePolicyTemplate(DeletePolicyTemplateOptions deletePolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyTemplateOptions, - "deletePolicyTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", deletePolicyTemplateOptions.policyTemplateId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a new policy template version. - * - * Create a new version of a policy template. Use this if you need to make updates to a policy template that is - * committed. - * - * @param createPolicyTemplateVersionOptions the {@link CreatePolicyTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateLimitData} - */ - public ServiceCall createPolicyTemplateVersion(CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateVersionOptions, - "createPolicyTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", createPolicyTemplateVersionOptions.policyTemplateId()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - final JsonObject contentJson = new JsonObject(); - contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateVersionOptions.policy())); - if (createPolicyTemplateVersionOptions.name() != null) { - contentJson.addProperty("name", createPolicyTemplateVersionOptions.name()); - } - if (createPolicyTemplateVersionOptions.description() != null) { - contentJson.addProperty("description", createPolicyTemplateVersionOptions.description()); - } - if (createPolicyTemplateVersionOptions.committed() != null) { - contentJson.addProperty("committed", createPolicyTemplateVersionOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve policy template versions. - * - * Retrieve the versions of a policy template by providing a policy template ID. - * - * @param listPolicyTemplateVersionsOptions the {@link ListPolicyTemplateVersionsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateVersionsCollection} - */ - public ServiceCall listPolicyTemplateVersions(ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyTemplateVersionsOptions, - "listPolicyTemplateVersionsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", listPolicyTemplateVersionsOptions.policyTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyTemplateVersions"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listPolicyTemplateVersionsOptions.state() != null) { - builder.query("state", String.valueOf(listPolicyTemplateVersionsOptions.state())); - } - if (listPolicyTemplateVersionsOptions.limit() != null) { - builder.query("limit", String.valueOf(listPolicyTemplateVersionsOptions.limit())); - } - if (listPolicyTemplateVersionsOptions.start() != null) { - builder.query("start", String.valueOf(listPolicyTemplateVersionsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a policy template version. - * - * Update a specific version of a policy template. You can use this only if the version isn't committed. - * - * @param replacePolicyTemplateOptions the {@link ReplacePolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} - */ - public ServiceCall replacePolicyTemplate(ReplacePolicyTemplateOptions replacePolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replacePolicyTemplateOptions, - "replacePolicyTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", replacePolicyTemplateOptions.policyTemplateId()); - pathParamsMap.put("version", replacePolicyTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replacePolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replacePolicyTemplateOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyTemplateOptions.policy())); - if (replacePolicyTemplateOptions.name() != null) { - contentJson.addProperty("name", replacePolicyTemplateOptions.name()); - } - if (replacePolicyTemplateOptions.description() != null) { - contentJson.addProperty("description", replacePolicyTemplateOptions.description()); - } - if (replacePolicyTemplateOptions.committed() != null) { - contentJson.addProperty("committed", replacePolicyTemplateOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a policy template version. - * - * Delete a specific version of a policy template by providing a policy template ID and version number. You can't - * delete a policy template version that is assigned to one or more child accounts. You must remove the policy - * assignments first. - * - * @param deletePolicyTemplateVersionOptions the {@link DeletePolicyTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deletePolicyTemplateVersion(DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyTemplateVersionOptions, - "deletePolicyTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", deletePolicyTemplateVersionOptions.policyTemplateId()); - pathParamsMap.put("version", deletePolicyTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a policy template version. - * - * Retrieve a policy template by providing a policy template ID and version number. - * - * @param getPolicyTemplateVersionOptions the {@link GetPolicyTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} - */ - public ServiceCall getPolicyTemplateVersion(GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyTemplateVersionOptions, - "getPolicyTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", getPolicyTemplateVersionOptions.policyTemplateId()); - pathParamsMap.put("version", getPolicyTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyTemplateVersion"); - 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); - } - - /** - * Commit a policy template version. - * - * Commit a policy template version. You can make no further changes to the policy template once it's committed. If - * you need to make updates after committing a version, create a new version. - * - * @param commitPolicyTemplateOptions the {@link CommitPolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall commitPolicyTemplate(CommitPolicyTemplateOptions commitPolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(commitPolicyTemplateOptions, - "commitPolicyTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", commitPolicyTemplateOptions.policyTemplateId()); - pathParamsMap.put("version", commitPolicyTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}/commit", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitPolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get policy template assignments. - * - * Get policy template assignments by attributes. The following attributes are supported: - * `account_id`, `template_id`, `template_version`, `sort`. - * `account_id` is a required query parameter. Only policy template assignments that have the specified attributes and - * that the caller has read access to are returned. If the caller does not have read access to any policy template - * assignments an empty array is returned. - * - * @param listPolicyAssignmentsOptions the {@link ListPolicyAssignmentsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateAssignmentCollection} - */ - public ServiceCall listPolicyAssignments(ListPolicyAssignmentsOptions listPolicyAssignmentsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyAssignmentsOptions, - "listPolicyAssignmentsOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyAssignments"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listPolicyAssignmentsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listPolicyAssignmentsOptions.acceptLanguage()); - } - builder.query("version", String.valueOf(listPolicyAssignmentsOptions.version())); - builder.query("account_id", String.valueOf(listPolicyAssignmentsOptions.accountId())); - if (listPolicyAssignmentsOptions.templateId() != null) { - builder.query("template_id", String.valueOf(listPolicyAssignmentsOptions.templateId())); - } - if (listPolicyAssignmentsOptions.templateVersion() != null) { - builder.query("template_version", String.valueOf(listPolicyAssignmentsOptions.templateVersion())); - } - if (listPolicyAssignmentsOptions.limit() != null) { - builder.query("limit", String.valueOf(listPolicyAssignmentsOptions.limit())); - } - if (listPolicyAssignmentsOptions.start() != null) { - builder.query("start", String.valueOf(listPolicyAssignmentsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a policy authorization template assignment. - * - * Assign a policy template to child accounts and account groups. This creates the policy in the accounts and account - * groups that you specify. - * - * @param createPolicyTemplateAssignmentOptions the {@link CreatePolicyTemplateAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyAssignmentV1Collection} - */ - public ServiceCall createPolicyTemplateAssignment(CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateAssignmentOptions, - "createPolicyTemplateAssignmentOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplateAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createPolicyTemplateAssignmentOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createPolicyTemplateAssignmentOptions.acceptLanguage()); - } - builder.query("version", String.valueOf(createPolicyTemplateAssignmentOptions.version())); - final JsonObject contentJson = new JsonObject(); - contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateAssignmentOptions.target())); - contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateAssignmentOptions.templates())); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a policy assignment. - * - * Retrieve a policy template assignment by providing a policy assignment ID. - * - * @param getPolicyAssignmentOptions the {@link GetPolicyAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateAssignmentItems} - */ - public ServiceCall getPolicyAssignment(GetPolicyAssignmentOptions getPolicyAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyAssignmentOptions, - "getPolicyAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", getPolicyAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(getPolicyAssignmentOptions.version())); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a policy authorization type assignment. - * - * Update a policy assignment by providing a policy assignment ID. - * - * @param updatePolicyAssignmentOptions the {@link UpdatePolicyAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyAssignmentV1} - */ - public ServiceCall updatePolicyAssignment(UpdatePolicyAssignmentOptions updatePolicyAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updatePolicyAssignmentOptions, - "updatePolicyAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", updatePolicyAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updatePolicyAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updatePolicyAssignmentOptions.ifMatch()); - builder.query("version", String.valueOf(updatePolicyAssignmentOptions.version())); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("template_version", updatePolicyAssignmentOptions.templateVersion()); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Remove a policy assignment. - * - * Remove a policy template assignment by providing a policy assignment ID. You can't delete a policy assignment if - * the status is "in_progress". - * - * @param deletePolicyAssignmentOptions the {@link DeletePolicyAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deletePolicyAssignment(DeletePolicyAssignmentOptions deletePolicyAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyAssignmentOptions, - "deletePolicyAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", deletePolicyAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve Access Management account settings by account ID. - * - * Retrieve Access Management settings for an account by providing the account ID. - * - * @param getSettingsOptions the {@link GetSettingsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AccountSettingsAccessManagement} - */ - public ServiceCall getSettings(GetSettingsOptions getSettingsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getSettingsOptions, - "getSettingsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", getSettingsOptions.accountId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/settings/access_management", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getSettings"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getSettingsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", getSettingsOptions.acceptLanguage()); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update Access Management account settings by account ID. - * - * Update access management settings for an account. - * - * ### External Account Identity Interaction - * - * Update the way identities within an external account are allowed to interact with the requested account by - * providing: - * * the `account_id` as a parameter - * * one or more external account ID(s) and state for the specific identity in the request body - * - * External account identity interaction includes the following `identity_types`: `user` (user identities that are - * defined as [IBMid's](https://cloud.ibm.com/docs/account?topic=account-identity-overview#users-bestpract)), - * `service_id` (defined as [IAM - * ServiceIds](https://cloud.ibm.com/docs/account?topic=account-identity-overview#serviceid-bestpract)), `service` - * (defined by a service’s [CRN](https://cloud.ibm.com/docs/account?topic=account-crn)). To update an Identity’s - * setting, the `state` and `external_allowed_accounts` fields are required. - * - * Different identity states are: - * * "enabled": An identity type is allowed to access resources in the account provided it has access policies on - * those resources. - * * "limited": An identity type is allowed to access resources in the account provided it has access policies on - * those resources AND it is associated with either the account the resources are in or one of the allowed accounts. - * This setting uses the "external_allowed_accounts" list. - * * "monitor": It has no direct impact on an Identity’s access. Instead, it creates AT events for access decisions as - * if the account were in a limited “state”. - * - * **Note**: The state "enabled" is a special case. In this case, access is given to all accounts and there is no need - * to specify a particular list. Therefore, when updating "state" to "enabled" for an identity type - * "external_allowed_accounts" should be left empty. - * - * @param updateSettingsOptions the {@link UpdateSettingsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AccountSettingsAccessManagement} - */ - public ServiceCall updateSettings(UpdateSettingsOptions updateSettingsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateSettingsOptions, - "updateSettingsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", updateSettingsOptions.accountId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/settings/access_management", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateSettings"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updateSettingsOptions.ifMatch()); - if (updateSettingsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", updateSettingsOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - if (updateSettingsOptions.externalAccountIdentityInteraction() != null) { - contentJson.add("external_account_identity_interaction", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateSettingsOptions.externalAccountIdentityInteraction())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List action control templates by attributes. - * - * List action control templates and filter by attributes by using query parameters. The following attributes are - * supported: - * `account_id` - * `account_id` is a required query parameter. Only action control templates that have the specified attributes and - * that the caller has read access to are returned. If the caller does not have read access to any action control - * templates an empty array is returned. - * - * @param listActionControlTemplatesOptions the {@link ListActionControlTemplatesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplateCollection} - */ - public ServiceCall listActionControlTemplates(ListActionControlTemplatesOptions listActionControlTemplatesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlTemplatesOptions, - "listActionControlTemplatesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlTemplates"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listActionControlTemplatesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listActionControlTemplatesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listActionControlTemplatesOptions.accountId())); - if (listActionControlTemplatesOptions.limit() != null) { - builder.query("limit", String.valueOf(listActionControlTemplatesOptions.limit())); - } - if (listActionControlTemplatesOptions.start() != null) { - builder.query("start", String.valueOf(listActionControlTemplatesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create an action control template. - * - * Create an action control template. Action control templates define a service action control. - * - * @param createActionControlTemplateOptions the {@link CreateActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall createActionControlTemplate(CreateActionControlTemplateOptions createActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateOptions, - "createActionControlTemplateOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createActionControlTemplateOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createActionControlTemplateOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("name", createActionControlTemplateOptions.name()); - contentJson.addProperty("account_id", createActionControlTemplateOptions.accountId()); - if (createActionControlTemplateOptions.description() != null) { - contentJson.addProperty("description", createActionControlTemplateOptions.description()); - } - if (createActionControlTemplateOptions.committed() != null) { - contentJson.addProperty("committed", createActionControlTemplateOptions.committed()); - } - if (createActionControlTemplateOptions.actionControl() != null) { - contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateOptions.actionControl())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve the latest version of an action control template. - * - * Retrieve the latest version of an action control template by providing an action control template ID. - * - * @param getActionControlTemplateOptions the {@link GetActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall getActionControlTemplate(GetActionControlTemplateOptions getActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlTemplateOptions, - "getActionControlTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", getActionControlTemplateOptions.actionControlTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getActionControlTemplateOptions.state() != null) { - builder.query("state", String.valueOf(getActionControlTemplateOptions.state())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete an action control template. - * - * Delete an action control template by providing the action control template ID. This deletes all versions of this - * template. An action control template can't be deleted if any version of the template is assigned to one or more - * child accounts. You must remove the action control assignments first. - * - * @param deleteActionControlTemplateOptions the {@link DeleteActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteActionControlTemplate(DeleteActionControlTemplateOptions deleteActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlTemplateOptions, - "deleteActionControlTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", deleteActionControlTemplateOptions.actionControlTemplateId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a new action control template version. - * - * Create a new version of an action control template. Use this if you need to make updates to an action control - * template that is committed. - * - * @param createActionControlTemplateVersionOptions the {@link CreateActionControlTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall createActionControlTemplateVersion(CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateVersionOptions, - "createActionControlTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", createActionControlTemplateVersionOptions.actionControlTemplateId()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - final JsonObject contentJson = new JsonObject(); - if (createActionControlTemplateVersionOptions.name() != null) { - contentJson.addProperty("name", createActionControlTemplateVersionOptions.name()); - } - if (createActionControlTemplateVersionOptions.description() != null) { - contentJson.addProperty("description", createActionControlTemplateVersionOptions.description()); - } - if (createActionControlTemplateVersionOptions.actionControl() != null) { - contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateVersionOptions.actionControl())); - } - if (createActionControlTemplateVersionOptions.committed() != null) { - contentJson.addProperty("committed", createActionControlTemplateVersionOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve action control template versions. - * - * Retrieve the versions of an action control template by providing an action control template ID. - * - * @param listActionControlTemplateVersionsOptions the {@link ListActionControlTemplateVersionsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplateVersionsCollection} - */ - public ServiceCall listActionControlTemplateVersions(ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlTemplateVersionsOptions, - "listActionControlTemplateVersionsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", listActionControlTemplateVersionsOptions.actionControlTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlTemplateVersions"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listActionControlTemplateVersionsOptions.state() != null) { - builder.query("state", String.valueOf(listActionControlTemplateVersionsOptions.state())); - } - if (listActionControlTemplateVersionsOptions.limit() != null) { - builder.query("limit", String.valueOf(listActionControlTemplateVersionsOptions.limit())); - } - if (listActionControlTemplateVersionsOptions.start() != null) { - builder.query("start", String.valueOf(listActionControlTemplateVersionsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update an action control template version. - * - * Update a specific version of an action control template. You can use this only if the version isn't committed. - * - * @param replaceActionControlTemplateOptions the {@link ReplaceActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall replaceActionControlTemplate(ReplaceActionControlTemplateOptions replaceActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceActionControlTemplateOptions, - "replaceActionControlTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", replaceActionControlTemplateOptions.actionControlTemplateId()); - pathParamsMap.put("version", replaceActionControlTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replaceActionControlTemplateOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - if (replaceActionControlTemplateOptions.name() != null) { - contentJson.addProperty("name", replaceActionControlTemplateOptions.name()); - } - if (replaceActionControlTemplateOptions.description() != null) { - contentJson.addProperty("description", replaceActionControlTemplateOptions.description()); - } - if (replaceActionControlTemplateOptions.actionControl() != null) { - contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceActionControlTemplateOptions.actionControl())); - } - if (replaceActionControlTemplateOptions.committed() != null) { - contentJson.addProperty("committed", replaceActionControlTemplateOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete an action control template version. - * - * Delete a specific version of an action control template by providing an action control template ID and version - * number. You can't delete an action control template version that is assigned to one or more child accounts. You - * must remove the action control assignments first. - * - * @param deleteActionControlTemplateVersionOptions the {@link DeleteActionControlTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteActionControlTemplateVersion(DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlTemplateVersionOptions, - "deleteActionControlTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", deleteActionControlTemplateVersionOptions.actionControlTemplateId()); - pathParamsMap.put("version", deleteActionControlTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve an action control template version. - * - * Retrieve an action control template by providing an action control template ID and version number. - * - * @param getActionControlTemplateVersionOptions the {@link GetActionControlTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall getActionControlTemplateVersion(GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlTemplateVersionOptions, - "getActionControlTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", getActionControlTemplateVersionOptions.actionControlTemplateId()); - pathParamsMap.put("version", getActionControlTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlTemplateVersion"); - 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); - } - - /** - * Commit an action control template version. - * - * Commit an action control template version. You cannot make any further changes to the action control template once - * it's committed. If you have to make updates after committing a version, create a new version. - * - * @param commitActionControlTemplateOptions the {@link CommitActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall commitActionControlTemplate(CommitActionControlTemplateOptions commitActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(commitActionControlTemplateOptions, - "commitActionControlTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", commitActionControlTemplateOptions.actionControlTemplateId()); - pathParamsMap.put("version", commitActionControlTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}/commit", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get action control template assignments. - * - * Get action control template assignments by attributes. The following attributes are supported: - * `account_id`, `template_id`, `template_version`, `sort`. - * `account_id` is a required query parameter. Only action control template assignments with the specified attributes - * and accessible by the caller are returned. If the caller does not have read access to any action control template - * assignments, an empty array is returned. - * - * @param listActionControlAssignmentsOptions the {@link ListActionControlAssignmentsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignmentCollection} - */ - public ServiceCall listActionControlAssignments(ListActionControlAssignmentsOptions listActionControlAssignmentsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlAssignmentsOptions, - "listActionControlAssignmentsOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlAssignments"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listActionControlAssignmentsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listActionControlAssignmentsOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listActionControlAssignmentsOptions.accountId())); - if (listActionControlAssignmentsOptions.templateId() != null) { - builder.query("template_id", String.valueOf(listActionControlAssignmentsOptions.templateId())); - } - if (listActionControlAssignmentsOptions.templateVersion() != null) { - builder.query("template_version", String.valueOf(listActionControlAssignmentsOptions.templateVersion())); - } - if (listActionControlAssignmentsOptions.limit() != null) { - builder.query("limit", String.valueOf(listActionControlAssignmentsOptions.limit())); - } - if (listActionControlAssignmentsOptions.start() != null) { - builder.query("start", String.valueOf(listActionControlAssignmentsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create an action control template assignment. - * - * Assign an action control template to child accounts and account groups. This creates the action control in the - * accounts and account groups that you specify. - * - * @param createActionControlTemplateAssignmentOptions the {@link CreateActionControlTemplateAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignmentCollection} - */ - public ServiceCall createActionControlTemplateAssignment(CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateAssignmentOptions, - "createActionControlTemplateAssignmentOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplateAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createActionControlTemplateAssignmentOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createActionControlTemplateAssignmentOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateAssignmentOptions.target())); - contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateAssignmentOptions.templates())); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve an action control assignment. - * - * Retrieve an action control template assignment by providing an action control assignment ID. - * - * @param getActionControlAssignmentOptions the {@link GetActionControlAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignment} - */ - public ServiceCall getActionControlAssignment(GetActionControlAssignmentOptions getActionControlAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlAssignmentOptions, - "getActionControlAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", getActionControlAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlAssignment"); - 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 an action control assignment. - * - * Update an action control assignment by providing an action control assignment ID. - * - * @param updateActionControlAssignmentOptions the {@link UpdateActionControlAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignment} - */ - public ServiceCall updateActionControlAssignment(UpdateActionControlAssignmentOptions updateActionControlAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateActionControlAssignmentOptions, - "updateActionControlAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", updateActionControlAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateActionControlAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updateActionControlAssignmentOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("template_version", updateActionControlAssignmentOptions.templateVersion()); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Remove an action control assignment. - * - * Remove an action control template assignment by providing an action control assignment ID. You can't delete an - * action control assignment if the status is "in_progress". - * - * @param deleteActionControlAssignmentOptions the {@link DeleteActionControlAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteActionControlAssignment(DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlAssignmentOptions, - "deleteActionControlAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", deleteActionControlAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List role templates by attributes. - * - * List role templates and filter by attributes by using query parameters. The following attributes are supported: - * `account_id`, `name`, `role_name`, `role_service_name`, `state`, `limit`, `start`. - * `account_id` is a required query parameter. Only role templates that have the specified attributes and that the - * caller has read access to are returned. If the caller does not have read access to any role templates an empty - * array is returned. - * - * @param listRoleTemplatesOptions the {@link ListRoleTemplatesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplateCollection} - */ - public ServiceCall listRoleTemplates(ListRoleTemplatesOptions listRoleTemplatesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleTemplatesOptions, - "listRoleTemplatesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleTemplates"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listRoleTemplatesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listRoleTemplatesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listRoleTemplatesOptions.accountId())); - if (listRoleTemplatesOptions.name() != null) { - builder.query("name", String.valueOf(listRoleTemplatesOptions.name())); - } - if (listRoleTemplatesOptions.roleName() != null) { - builder.query("role_name", String.valueOf(listRoleTemplatesOptions.roleName())); - } - if (listRoleTemplatesOptions.roleServiceName() != null) { - builder.query("role_service_name", String.valueOf(listRoleTemplatesOptions.roleServiceName())); - } - if (listRoleTemplatesOptions.state() != null) { - builder.query("state", String.valueOf(listRoleTemplatesOptions.state())); - } - if (listRoleTemplatesOptions.limit() != null) { - builder.query("limit", String.valueOf(listRoleTemplatesOptions.limit())); - } - if (listRoleTemplatesOptions.start() != null) { - builder.query("start", String.valueOf(listRoleTemplatesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create role template. - * - * Create a role template. Role templates define roles from an existing system or service defined role. - * - * @param createRoleTemplateOptions the {@link CreateRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall createRoleTemplate(CreateRoleTemplateOptions createRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateOptions, - "createRoleTemplateOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createRoleTemplateOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createRoleTemplateOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("name", createRoleTemplateOptions.name()); - contentJson.addProperty("account_id", createRoleTemplateOptions.accountId()); - if (createRoleTemplateOptions.description() != null) { - contentJson.addProperty("description", createRoleTemplateOptions.description()); - } - if (createRoleTemplateOptions.committed() != null) { - contentJson.addProperty("committed", createRoleTemplateOptions.committed()); - } - if (createRoleTemplateOptions.role() != null) { - contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateOptions.role())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve the latest version of a role template. - * - * Retrieve the latest version of a role template by providing a role template ID. - * - * @param getRoleTemplateOptions the {@link GetRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall getRoleTemplate(GetRoleTemplateOptions getRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleTemplateOptions, - "getRoleTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", getRoleTemplateOptions.roleTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getRoleTemplateOptions.state() != null) { - builder.query("state", String.valueOf(getRoleTemplateOptions.state())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a Role template. - * - * Delete a role template by providing the role template ID. This deletes all versions of this template. A role - * template can't be deleted if any version of the template is assigned to one or more child accounts. You must remove - * the role assignments first. - * - * @param deleteRoleTemplateOptions the {@link DeleteRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteRoleTemplate(DeleteRoleTemplateOptions deleteRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleTemplateOptions, - "deleteRoleTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", deleteRoleTemplateOptions.roleTemplateId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a new role template version. - * - * Create a new version of a role template. Use this if you need to make updates to a role template that is committed. - * - * @param createRoleTemplateVersionOptions the {@link CreateRoleTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall createRoleTemplateVersion(CreateRoleTemplateVersionOptions createRoleTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateVersionOptions, - "createRoleTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", createRoleTemplateVersionOptions.roleTemplateId()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - final JsonObject contentJson = new JsonObject(); - if (createRoleTemplateVersionOptions.name() != null) { - contentJson.addProperty("name", createRoleTemplateVersionOptions.name()); - } - if (createRoleTemplateVersionOptions.description() != null) { - contentJson.addProperty("description", createRoleTemplateVersionOptions.description()); - } - if (createRoleTemplateVersionOptions.role() != null) { - contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateVersionOptions.role())); - } - if (createRoleTemplateVersionOptions.committed() != null) { - contentJson.addProperty("committed", createRoleTemplateVersionOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve role template versions. - * - * Retrieve the versions of a role template by providing a role template ID. - * - * @param listRoleTemplateVersionsOptions the {@link ListRoleTemplateVersionsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplateVersionsCollection} - */ - public ServiceCall listRoleTemplateVersions(ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleTemplateVersionsOptions, - "listRoleTemplateVersionsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", listRoleTemplateVersionsOptions.roleTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleTemplateVersions"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listRoleTemplateVersionsOptions.state() != null) { - builder.query("state", String.valueOf(listRoleTemplateVersionsOptions.state())); - } - if (listRoleTemplateVersionsOptions.limit() != null) { - builder.query("limit", String.valueOf(listRoleTemplateVersionsOptions.limit())); - } - if (listRoleTemplateVersionsOptions.start() != null) { - builder.query("start", String.valueOf(listRoleTemplateVersionsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a role template version. - * - * Update a specific version of a role template. You can use this only if the version isn't committed. - * - * @param replaceRoleTemplateOptions the {@link ReplaceRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall replaceRoleTemplate(ReplaceRoleTemplateOptions replaceRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceRoleTemplateOptions, - "replaceRoleTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", replaceRoleTemplateOptions.roleTemplateId()); - pathParamsMap.put("version", replaceRoleTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replaceRoleTemplateOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - if (replaceRoleTemplateOptions.name() != null) { - contentJson.addProperty("name", replaceRoleTemplateOptions.name()); - } - if (replaceRoleTemplateOptions.description() != null) { - contentJson.addProperty("description", replaceRoleTemplateOptions.description()); - } - if (replaceRoleTemplateOptions.role() != null) { - contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRoleTemplateOptions.role())); - } - if (replaceRoleTemplateOptions.committed() != null) { - contentJson.addProperty("committed", replaceRoleTemplateOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a role template version. - * - * Delete a specific version of a role template by providing a role template ID and version number. You can't delete a - * role template version that is assigned to one or more child accounts. You must remove the role assignments first. - * - * @param deleteRoleTemplateVersionOptions the {@link DeleteRoleTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteRoleTemplateVersion(DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleTemplateVersionOptions, - "deleteRoleTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", deleteRoleTemplateVersionOptions.roleTemplateId()); - pathParamsMap.put("version", deleteRoleTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a role template version. - * - * Retrieve a role template by providing a role template ID and version number. - * - * @param getRoleTemplateVersionOptions the {@link GetRoleTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall getRoleTemplateVersion(GetRoleTemplateVersionOptions getRoleTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleTemplateVersionOptions, - "getRoleTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", getRoleTemplateVersionOptions.roleTemplateId()); - pathParamsMap.put("version", getRoleTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleTemplateVersion"); - 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); - } - - /** - * Commit a role template version. - * - * Commit a role template version. You cannot make any further changes to the role template once it's committed. If - * you have to make updates after committing a version, create a new version. - * - * @param commitRoleTemplateOptions the {@link CommitRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall commitRoleTemplate(CommitRoleTemplateOptions commitRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(commitRoleTemplateOptions, - "commitRoleTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", commitRoleTemplateOptions.roleTemplateId()); - pathParamsMap.put("version", commitRoleTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}/commit", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get role template assignments. - * - * Get role template assignments by attributes. The following attributes are supported: - * `account_id`, `template_id`, `template_version`, `target`, `target_type`, `limit`, `start`. - * `account_id` is a required query parameter. Only role template assignments with the specified attributes and - * accessible by the caller are returned. If the caller does not have read access to any role template assignments, an - * empty array is returned. - * - * @param listRoleAssignmentsOptions the {@link ListRoleAssignmentsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleAssignmentCollection} - */ - public ServiceCall listRoleAssignments(ListRoleAssignmentsOptions listRoleAssignmentsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleAssignmentsOptions, - "listRoleAssignmentsOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleAssignments"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listRoleAssignmentsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listRoleAssignmentsOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listRoleAssignmentsOptions.accountId())); - if (listRoleAssignmentsOptions.templateId() != null) { - builder.query("template_id", String.valueOf(listRoleAssignmentsOptions.templateId())); - } - if (listRoleAssignmentsOptions.templateVersion() != null) { - builder.query("template_version", String.valueOf(listRoleAssignmentsOptions.templateVersion())); - } - if (listRoleAssignmentsOptions.limit() != null) { - builder.query("limit", String.valueOf(listRoleAssignmentsOptions.limit())); - } - if (listRoleAssignmentsOptions.start() != null) { - builder.query("start", String.valueOf(listRoleAssignmentsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a role template assignment. - * - * Assign a role template to child accounts and account groups. This creates the role in the accounts and account - * groups that you specify. - * - * @param createRoleTemplateAssignmentOptions the {@link CreateRoleTemplateAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleAssignmentCollection} - */ - public ServiceCall createRoleTemplateAssignment(CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateAssignmentOptions, - "createRoleTemplateAssignmentOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplateAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createRoleTemplateAssignmentOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createRoleTemplateAssignmentOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateAssignmentOptions.target())); - contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateAssignmentOptions.templates())); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a role assignment. - * - * Retrieve a role template assignment by providing a role assignment ID. - * - * @param getRoleAssignmentOptions the {@link GetRoleAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleAssignment} - */ - public ServiceCall getRoleAssignment(GetRoleAssignmentOptions getRoleAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleAssignmentOptions, - "getRoleAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", getRoleAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleAssignment"); - 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 a role assignment. - * - * Update a role assignment by providing a role assignment ID. - * - * @param updateRoleAssignmentOptions the {@link UpdateRoleAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleAssignment} - */ - public ServiceCall updateRoleAssignment(UpdateRoleAssignmentOptions updateRoleAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateRoleAssignmentOptions, - "updateRoleAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", updateRoleAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateRoleAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updateRoleAssignmentOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("template_version", updateRoleAssignmentOptions.templateVersion()); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Remove a role assignment. - * - * Remove a role template assignment by providing a role assignment ID. You can't delete a role assignment if the - * status is "in_progress". - * - * @param deleteRoleAssignmentOptions the {@link DeleteRoleAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteRoleAssignment(DeleteRoleAssignmentOptions deleteRoleAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleAssignmentOptions, - "deleteRoleAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", deleteRoleAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java deleted file mode 100644 index af82ea2abe8..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The Access Management Account Settings that are currently set for the requested account. - */ -public class AccountSettingsAccessManagement extends GenericModel { - - @SerializedName("external_account_identity_interaction") - protected ExternalAccountIdentityInteraction externalAccountIdentityInteraction; - - protected AccountSettingsAccessManagement() { } - - /** - * Gets the externalAccountIdentityInteraction. - * - * How external accounts can interact in relation to the requested account. - * - * @return the externalAccountIdentityInteraction - */ - public ExternalAccountIdentityInteraction getExternalAccountIdentityInteraction() { - return externalAccountIdentityInteraction; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java deleted file mode 100644 index ea230f57263..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the assigned action control template. - */ -public class ActionControlAssignment extends GenericModel { - - /** - * The current operation of the action control assignment. - */ - public interface Operation { - /** create. */ - String CREATE = "create"; - /** apply. */ - String APPLY = "apply"; - /** update. */ - String UPDATE = "update"; - /** remove. */ - String REMOVE = "remove"; - } - - /** - * The action control assignment status. - */ - public interface Status { - /** accepted. */ - String ACCEPTED = "accepted"; - /** failure. */ - String FAILURE = "failure"; - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** superseded. */ - String SUPERSEDED = "superseded"; - } - - protected String id; - @SerializedName("account_id") - protected String accountId; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String operation; - protected List resources; - protected ActionControlAssignmentTemplate template; - protected AssignmentTargetDetails target; - protected String status; - - protected ActionControlAssignment() { } - - /** - * Gets the id. - * - * Action control assignment ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the accountId. - * - * The account GUID that the action control assignments belong to. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the href. - * - * The href URL that links to the action control assignments API by action control assignment ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the action control assignment was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the action control assignment. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the action control assignment was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the action control assignment. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the operation. - * - * The current operation of the action control assignment. - * - * @return the operation - */ - public String getOperation() { - return operation; - } - - /** - * Gets the resources. - * - * Resources created when action control template is assigned. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the template. - * - * The action control template id and version that will be assigned. - * - * @return the template - */ - public ActionControlAssignmentTemplate getTemplate() { - return template; - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the status. - * - * The action control assignment status. - * - * @return the status - */ - public String getStatus() { - return status; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java deleted file mode 100644 index a9d6b28ce39..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of action control assignments. - */ -public class ActionControlAssignmentCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List assignments; - - protected ActionControlAssignmentCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the assignments. - * - * List of action control assignments. - * - * @return the assignments - */ - public List getAssignments() { - return assignments; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java deleted file mode 100644 index 122d3c8277b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The action control assignment resources and target where the template is assigned. - */ -public class ActionControlAssignmentResource extends GenericModel { - - protected AssignmentTargetDetails target; - @SerializedName("action_control") - protected ActionControlAssignmentResourceActionControl actionControl; - - protected ActionControlAssignmentResource() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the actionControl. - * - * Set of properties of the assigned resource or error message if assignment failed. - * - * @return the actionControl - */ - public ActionControlAssignmentResourceActionControl getActionControl() { - return actionControl; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java deleted file mode 100644 index 0e5550eb4da..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Set of properties of the assigned resource or error message if assignment failed. - */ -public class ActionControlAssignmentResourceActionControl extends GenericModel { - - @SerializedName("resource_created") - protected ActionControlAssignmentResourceCreated resourceCreated; - @SerializedName("error_message") - protected AssignmentResourceError errorMessage; - - protected ActionControlAssignmentResourceActionControl() { } - - /** - * Gets the resourceCreated. - * - * On success, it includes the action control assigned. - * - * @return the resourceCreated - */ - public ActionControlAssignmentResourceCreated getResourceCreated() { - return resourceCreated; - } - - /** - * Gets the errorMessage. - * - * Body parameters for assignment error. - * - * @return the errorMessage - */ - public AssignmentResourceError getErrorMessage() { - return errorMessage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java deleted file mode 100644 index 6ecbd23392a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * On success, it includes the action control assigned. - */ -public class ActionControlAssignmentResourceCreated extends GenericModel { - - protected String id; - - protected ActionControlAssignmentResourceCreated() { } - - /** - * Gets the id. - * - * action control id. - * - * @return the id - */ - public String getId() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java deleted file mode 100644 index 4e6d2543e18..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The action control template id and version that will be assigned. - */ -public class ActionControlAssignmentTemplate extends GenericModel { - - protected String id; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String version; - - /** - * Instantiates a new Builder from an existing ActionControlAssignmentTemplate instance. - * - * @param actionControlAssignmentTemplate the instance to initialize the Builder with - */ - private Builder(ActionControlAssignmentTemplate actionControlAssignmentTemplate) { - this.id = actionControlAssignmentTemplate.id; - this.version = actionControlAssignmentTemplate.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param id the id - * @param version the version - */ - public Builder(String id, String version) { - this.id = id; - this.version = version; - } - - /** - * Builds a ActionControlAssignmentTemplate. - * - * @return the new ActionControlAssignmentTemplate instance - */ - public ActionControlAssignmentTemplate build() { - return new ActionControlAssignmentTemplate(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the ActionControlAssignmentTemplate builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the ActionControlAssignmentTemplate builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected ActionControlAssignmentTemplate() { } - - protected ActionControlAssignmentTemplate(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - id = builder.id; - version = builder.version; - } - - /** - * New builder. - * - * @return a ActionControlAssignmentTemplate builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * Action control template ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java deleted file mode 100644 index 78b6d56be6d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * ActionControlAssignmentsPager can be used to simplify the use of the "listActionControlAssignments" method. - */ -public class ActionControlAssignmentsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListActionControlAssignmentsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected ActionControlAssignmentsPager() { } - - /** - * Constructs a new ActionControlAssignmentsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlAssignments" method - * @param options the ListActionControlAssignmentsOptions instance to be used to invoke the "listActionControlAssignments" method - */ - public ActionControlAssignmentsPager(IamPolicyManagement client, ListActionControlAssignmentsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<ActionControlAssignment> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListActionControlAssignmentsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - ActionControlAssignmentCollection result = client.listActionControlAssignments(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getAssignments(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<ActionControlAssignment> containing all results returned by the "listActionControlAssignments" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java deleted file mode 100644 index 157c9f6a390..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the action control template. - */ -public class ActionControlTemplate extends GenericModel { - - /** - * State of action control template. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String name; - protected String description; - @SerializedName("account_id") - protected String accountId; - protected Boolean committed; - @SerializedName("action_control") - protected TemplateActionControl actionControl; - protected String id; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String version; - protected String state; - - protected ActionControlTemplate() { } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the description. - * - * Description of the action control template. This is shown to users in the enterprise account. Use this to describe - * the purpose or context of the action control for enterprise users managing IAM templates. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the committed. - * - * Committed status of the template. If committed is set to true, then the template version can no longer be updated. - * - * @return the committed - */ - public Boolean isCommitted() { - return committed; - } - - /** - * Gets the actionControl. - * - * The action control properties that are created in an action resource when the template is assigned. - * - * @return the actionControl - */ - public TemplateActionControl getActionControl() { - return actionControl; - } - - /** - * Gets the id. - * - * The action control template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the action control templates API by action control template ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the action control template was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the action control template. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the action control template was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the action control template. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the version. - * - * The version number of the template used to identify different versions of same template. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the state. - * - * State of action control template. - * - * @return the state - */ - public String getState() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java deleted file mode 100644 index e7536d2c9ae..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of action control templates. - */ -public class ActionControlTemplateCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - @SerializedName("action_control_templates") - protected List actionControlTemplates; - - protected ActionControlTemplateCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the actionControlTemplates. - * - * List of action control templates. - * - * @return the actionControlTemplates - */ - public List getActionControlTemplates() { - return actionControlTemplates; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java deleted file mode 100644 index 5e26f45cf46..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of versions for a specific action control template. - */ -public class ActionControlTemplateVersionsCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List versions; - - protected ActionControlTemplateVersionsCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the versions. - * - * List of action control templates versions. - * - * @return the versions - */ - public List getVersions() { - return versions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java deleted file mode 100644 index 660aefe11ba..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * ActionControlTemplateVersionsPager can be used to simplify the use of the "listActionControlTemplateVersions" method. - */ -public class ActionControlTemplateVersionsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListActionControlTemplateVersionsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected ActionControlTemplateVersionsPager() { } - - /** - * Constructs a new ActionControlTemplateVersionsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlTemplateVersions" method - * @param options the ListActionControlTemplateVersionsOptions instance to be used to invoke the "listActionControlTemplateVersions" method - */ - public ActionControlTemplateVersionsPager(IamPolicyManagement client, ListActionControlTemplateVersionsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<ActionControlTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListActionControlTemplateVersionsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - ActionControlTemplateVersionsCollection result = client.listActionControlTemplateVersions(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getVersions(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<ActionControlTemplate> containing all results returned by the "listActionControlTemplateVersions" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java deleted file mode 100644 index bd326c8d7ec..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * ActionControlTemplatesPager can be used to simplify the use of the "listActionControlTemplates" method. - */ -public class ActionControlTemplatesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListActionControlTemplatesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected ActionControlTemplatesPager() { } - - /** - * Constructs a new ActionControlTemplatesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlTemplates" method - * @param options the ListActionControlTemplatesOptions instance to be used to invoke the "listActionControlTemplates" method - */ - public ActionControlTemplatesPager(IamPolicyManagement client, ListActionControlTemplatesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<ActionControlTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListActionControlTemplatesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - ActionControlTemplateCollection result = client.listActionControlTemplates(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getActionControlTemplates(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<ActionControlTemplate> containing all results returned by the "listActionControlTemplates" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java deleted file mode 100644 index c454c7a3ef5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * On success, includes the policy that is assigned. - */ -public class AssignmentResourceCreated extends GenericModel { - - protected String id; - - protected AssignmentResourceCreated() { } - - /** - * Gets the id. - * - * Policy id. - * - * @return the id - */ - public String getId() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java deleted file mode 100644 index e74dbe58b3a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Body parameters for assignment error. - */ -public class AssignmentResourceError extends GenericModel { - - protected String name; - protected String errorCode; - protected String message; - protected String code; - protected List errors; - - protected AssignmentResourceError() { } - - /** - * Gets the name. - * - * Name of the error. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the errorCode. - * - * error code. - * - * @return the errorCode - */ - public String getErrorCode() { - return errorCode; - } - - /** - * Gets the message. - * - * Error message detailing the nature of the error. - * - * @return the message - */ - public String getMessage() { - return message; - } - - /** - * Gets the code. - * - * Internal status code for the error. - * - * @return the code - */ - public String getCode() { - return code; - } - - /** - * Gets the errors. - * - * The errors encountered during the response. - * - * @return the errors - */ - public List getErrors() { - return errors; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java deleted file mode 100644 index 893d528604c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * assignment target account and type. - */ -public class AssignmentTargetDetails extends GenericModel { - - /** - * Assignment target type. - */ - public interface Type { - /** Account. */ - String ACCOUNT = "Account"; - } - - protected String type; - protected String id; - - /** - * Builder. - */ - public static class Builder { - private String type; - private String id; - - /** - * Instantiates a new Builder from an existing AssignmentTargetDetails instance. - * - * @param assignmentTargetDetails the instance to initialize the Builder with - */ - private Builder(AssignmentTargetDetails assignmentTargetDetails) { - this.type = assignmentTargetDetails.type; - this.id = assignmentTargetDetails.id; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param type the type - * @param id the id - */ - public Builder(String type, String id) { - this.type = type; - this.id = id; - } - - /** - * Builds a AssignmentTargetDetails. - * - * @return the new AssignmentTargetDetails instance - */ - public AssignmentTargetDetails build() { - return new AssignmentTargetDetails(this); - } - - /** - * Set the type. - * - * @param type the type - * @return the AssignmentTargetDetails builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the id. - * - * @param id the id - * @return the AssignmentTargetDetails builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - } - - protected AssignmentTargetDetails() { } - - protected AssignmentTargetDetails(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - type = builder.type; - id = builder.id; - } - - /** - * New builder. - * - * @return a AssignmentTargetDetails builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the type. - * - * Assignment target type. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the id. - * - * ID of the target account. - * - * @return the id - */ - public String id() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java deleted file mode 100644 index b8025e305a9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * policy template details. - */ -public class AssignmentTemplateDetails extends GenericModel { - - protected String id; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String version; - - /** - * Instantiates a new Builder from an existing AssignmentTemplateDetails instance. - * - * @param assignmentTemplateDetails the instance to initialize the Builder with - */ - private Builder(AssignmentTemplateDetails assignmentTemplateDetails) { - this.id = assignmentTemplateDetails.id; - this.version = assignmentTemplateDetails.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a AssignmentTemplateDetails. - * - * @return the new AssignmentTemplateDetails instance - */ - public AssignmentTemplateDetails build() { - return new AssignmentTemplateDetails(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the AssignmentTemplateDetails builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the AssignmentTemplateDetails builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected AssignmentTemplateDetails() { } - - protected AssignmentTemplateDetails(Builder builder) { - id = builder.id; - version = builder.version; - } - - /** - * New builder. - * - * @return a AssignmentTemplateDetails builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * Policy template ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the version. - * - * Policy template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java deleted file mode 100644 index 78291e6c2c5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The commitActionControlTemplate options. - */ -public class CommitActionControlTemplateOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing CommitActionControlTemplateOptions instance. - * - * @param commitActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(CommitActionControlTemplateOptions commitActionControlTemplateOptions) { - this.actionControlTemplateId = commitActionControlTemplateOptions.actionControlTemplateId; - this.version = commitActionControlTemplateOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - * @param version the version - */ - public Builder(String actionControlTemplateId, String version) { - this.actionControlTemplateId = actionControlTemplateId; - this.version = version; - } - - /** - * Builds a CommitActionControlTemplateOptions. - * - * @return the new CommitActionControlTemplateOptions instance - */ - public CommitActionControlTemplateOptions build() { - return new CommitActionControlTemplateOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the CommitActionControlTemplateOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the CommitActionControlTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected CommitActionControlTemplateOptions() { } - - protected CommitActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a CommitActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the version. - * - * The action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java deleted file mode 100644 index 61283194c44..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The commitPolicyTemplate options. - */ -public class CommitPolicyTemplateOptions extends GenericModel { - - protected String policyTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing CommitPolicyTemplateOptions instance. - * - * @param commitPolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(CommitPolicyTemplateOptions commitPolicyTemplateOptions) { - this.policyTemplateId = commitPolicyTemplateOptions.policyTemplateId; - this.version = commitPolicyTemplateOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param version the version - */ - public Builder(String policyTemplateId, String version) { - this.policyTemplateId = policyTemplateId; - this.version = version; - } - - /** - * Builds a CommitPolicyTemplateOptions. - * - * @return the new CommitPolicyTemplateOptions instance - */ - public CommitPolicyTemplateOptions build() { - return new CommitPolicyTemplateOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the CommitPolicyTemplateOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the CommitPolicyTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected CommitPolicyTemplateOptions() { } - - protected CommitPolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - policyTemplateId = builder.policyTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a CommitPolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the version. - * - * The policy template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java deleted file mode 100644 index 7e93c92fb0b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The commitRoleTemplate options. - */ -public class CommitRoleTemplateOptions extends GenericModel { - - protected String roleTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing CommitRoleTemplateOptions instance. - * - * @param commitRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(CommitRoleTemplateOptions commitRoleTemplateOptions) { - this.roleTemplateId = commitRoleTemplateOptions.roleTemplateId; - this.version = commitRoleTemplateOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - * @param version the version - */ - public Builder(String roleTemplateId, String version) { - this.roleTemplateId = roleTemplateId; - this.version = version; - } - - /** - * Builds a CommitRoleTemplateOptions. - * - * @return the new CommitRoleTemplateOptions instance - */ - public CommitRoleTemplateOptions build() { - return new CommitRoleTemplateOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the CommitRoleTemplateOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the CommitRoleTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected CommitRoleTemplateOptions() { } - - protected CommitRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - roleTemplateId = builder.roleTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a CommitRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the version. - * - * The role template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java deleted file mode 100644 index be0c3d0aa98..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Details of conflicting resource. - */ -public class ConflictsWith extends GenericModel { - - protected String etag; - protected String role; - protected String policy; - - protected ConflictsWith() { } - - /** - * Gets the etag. - * - * The revision number of the resource. - * - * @return the etag - */ - public String getEtag() { - return etag; - } - - /** - * Gets the role. - * - * The conflicting role of ID. - * - * @return the role - */ - public String getRole() { - return role; - } - - /** - * Gets the policy. - * - * The conflicting policy ID. - * - * @return the policy - */ - public String getPolicy() { - return policy; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java deleted file mode 100644 index 15e502ac214..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Specifies the type of access that is granted by the policy. - */ -public class Control extends GenericModel { - - protected Grant grant; - - /** - * Builder. - */ - public static class Builder { - private Grant grant; - - /** - * Instantiates a new Builder from an existing Control instance. - * - * @param control the instance to initialize the Builder with - */ - private Builder(Control control) { - this.grant = control.grant; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param grant the grant - */ - public Builder(Grant grant) { - this.grant = grant; - } - - /** - * Builds a Control. - * - * @return the new Control instance - */ - public Control build() { - return new Control(this); - } - - /** - * Set the grant. - * - * @param grant the grant - * @return the Control builder - */ - public Builder grant(Grant grant) { - this.grant = grant; - return this; - } - } - - protected Control() { } - - protected Control(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.grant, - "grant cannot be null"); - grant = builder.grant; - } - - /** - * New builder. - * - * @return a Control builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the grant. - * - * Permission is granted by the policy. - * - * @return the grant - */ - public Grant grant() { - return grant; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java deleted file mode 100644 index 5055d290c80..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * ControlResponse. - * - * Classes which extend this class: - * - ControlResponseControl - * - ControlResponseControlWithEnrichedRoles - */ -public class ControlResponse extends GenericModel { - - protected Grant grant; - - protected ControlResponse() { } - - /** - * Gets the grant. - * - * Permission is granted by the policy. - * - * @return the grant - */ - public Grant getGrant() { - return grant; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java deleted file mode 100644 index 5934ebf7c76..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * Specifies the type of access that is granted by the policy. - */ -public class ControlResponseControl extends ControlResponse { - - - protected ControlResponseControl() { } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java deleted file mode 100644 index 8b3c73d73c0..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * Specifies the type of access that is granted by the policy with additional role information. - */ -public class ControlResponseControlWithEnrichedRoles extends ControlResponse { - - - protected ControlResponseControlWithEnrichedRoles() { } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java deleted file mode 100644 index 1ccd3f8b4dd..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createActionControlTemplateAssignment options. - */ -public class CreateActionControlTemplateAssignmentOptions extends GenericModel { - - protected AssignmentTargetDetails target; - protected List templates; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private AssignmentTargetDetails target; - private List templates; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateActionControlTemplateAssignmentOptions instance. - * - * @param createActionControlTemplateAssignmentOptions the instance to initialize the Builder with - */ - private Builder(CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptions) { - this.target = createActionControlTemplateAssignmentOptions.target; - this.templates = createActionControlTemplateAssignmentOptions.templates; - this.acceptLanguage = createActionControlTemplateAssignmentOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param target the target - * @param templates the templates - */ - public Builder(AssignmentTargetDetails target, List templates) { - this.target = target; - this.templates = templates; - } - - /** - * Builds a CreateActionControlTemplateAssignmentOptions. - * - * @return the new CreateActionControlTemplateAssignmentOptions instance - */ - public CreateActionControlTemplateAssignmentOptions build() { - return new CreateActionControlTemplateAssignmentOptions(this); - } - - /** - * Adds a new element to templates. - * - * @param templates the new element to be added - * @return the CreateActionControlTemplateAssignmentOptions builder - */ - public Builder addTemplates(ActionControlAssignmentTemplate templates) { - com.ibm.cloud.sdk.core.util.Validator.notNull(templates, - "templates cannot be null"); - if (this.templates == null) { - this.templates = new ArrayList(); - } - this.templates.add(templates); - return this; - } - - /** - * Set the target. - * - * @param target the target - * @return the CreateActionControlTemplateAssignmentOptions builder - */ - public Builder target(AssignmentTargetDetails target) { - this.target = target; - return this; - } - - /** - * Set the templates. - * Existing templates will be replaced. - * - * @param templates the templates - * @return the CreateActionControlTemplateAssignmentOptions builder - */ - public Builder templates(List templates) { - this.templates = templates; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateActionControlTemplateAssignmentOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateActionControlTemplateAssignmentOptions() { } - - protected CreateActionControlTemplateAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, - "target cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, - "templates cannot be null"); - target = builder.target; - templates = builder.templates; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateActionControlTemplateAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails target() { - return target; - } - - /** - * Gets the templates. - * - * List of action control template details for action control assignment. - * - * @return the templates - */ - public List templates() { - return templates; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java deleted file mode 100644 index 37594a7a440..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createActionControlTemplate options. - */ -public class CreateActionControlTemplateOptions extends GenericModel { - - protected String name; - protected String accountId; - protected String description; - protected Boolean committed; - protected TemplateActionControl actionControl; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String accountId; - private String description; - private Boolean committed; - private TemplateActionControl actionControl; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateActionControlTemplateOptions instance. - * - * @param createActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(CreateActionControlTemplateOptions createActionControlTemplateOptions) { - this.name = createActionControlTemplateOptions.name; - this.accountId = createActionControlTemplateOptions.accountId; - this.description = createActionControlTemplateOptions.description; - this.committed = createActionControlTemplateOptions.committed; - this.actionControl = createActionControlTemplateOptions.actionControl; - this.acceptLanguage = createActionControlTemplateOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param accountId the accountId - */ - public Builder(String name, String accountId) { - this.name = name; - this.accountId = accountId; - } - - /** - * Builds a CreateActionControlTemplateOptions. - * - * @return the new CreateActionControlTemplateOptions instance - */ - public CreateActionControlTemplateOptions build() { - return new CreateActionControlTemplateOptions(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateActionControlTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the CreateActionControlTemplateOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateActionControlTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreateActionControlTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - - /** - * Set the actionControl. - * - * @param actionControl the actionControl - * @return the CreateActionControlTemplateOptions builder - */ - public Builder actionControl(TemplateActionControl actionControl) { - this.actionControl = actionControl; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateActionControlTemplateOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateActionControlTemplateOptions() { } - - protected CreateActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - name = builder.name; - accountId = builder.accountId; - description = builder.description; - committed = builder.committed; - actionControl = builder.actionControl; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the description. - * - * Description of the action control template. This is shown to users in the enterprise account. Use this to describe - * the purpose or context of the action control for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template. If committed is set to true, then the template version can no longer be updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } - - /** - * Gets the actionControl. - * - * The action control properties that are created in an action resource when the template is assigned. - * - * @return the actionControl - */ - public TemplateActionControl actionControl() { - return actionControl; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java deleted file mode 100644 index 13ce1a8e60f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createActionControlTemplateVersion options. - */ -public class CreateActionControlTemplateVersionOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String name; - protected String description; - protected TemplateActionControl actionControl; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String name; - private String description; - private TemplateActionControl actionControl; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing CreateActionControlTemplateVersionOptions instance. - * - * @param createActionControlTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptions) { - this.actionControlTemplateId = createActionControlTemplateVersionOptions.actionControlTemplateId; - this.name = createActionControlTemplateVersionOptions.name; - this.description = createActionControlTemplateVersionOptions.description; - this.actionControl = createActionControlTemplateVersionOptions.actionControl; - this.committed = createActionControlTemplateVersionOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - */ - public Builder(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - } - - /** - * Builds a CreateActionControlTemplateVersionOptions. - * - * @return the new CreateActionControlTemplateVersionOptions instance - */ - public CreateActionControlTemplateVersionOptions build() { - return new CreateActionControlTemplateVersionOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actionControl. - * - * @param actionControl the actionControl - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder actionControl(TemplateActionControl actionControl) { - this.actionControl = actionControl; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected CreateActionControlTemplateVersionOptions() { } - - protected CreateActionControlTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - name = builder.name; - description = builder.description; - actionControl = builder.actionControl; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a CreateActionControlTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * The action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will - * change the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the action control template. This is shown to users in the enterprise account. Use this to describe - * the purpose or context of the action control for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actionControl. - * - * The action control properties that are created in an action resource when the template is assigned. - * - * @return the actionControl - */ - public TemplateActionControl actionControl() { - return actionControl; - } - - /** - * Gets the committed. - * - * Committed status of the template version. If committed is set to true, then the template version can no longer be - * updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java deleted file mode 100644 index b6ec9f78c02..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java +++ /dev/null @@ -1,311 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createPolicy options. - */ -public class CreatePolicyOptions extends GenericModel { - - protected String type; - protected List subjects; - protected List roles; - protected List resources; - protected String description; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String type; - private List subjects; - private List roles; - private List resources; - private String description; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreatePolicyOptions instance. - * - * @param createPolicyOptions the instance to initialize the Builder with - */ - private Builder(CreatePolicyOptions createPolicyOptions) { - this.type = createPolicyOptions.type; - this.subjects = createPolicyOptions.subjects; - this.roles = createPolicyOptions.roles; - this.resources = createPolicyOptions.resources; - this.description = createPolicyOptions.description; - this.acceptLanguage = createPolicyOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param type the type - * @param subjects the subjects - * @param roles the roles - * @param resources the resources - */ - public Builder(String type, List subjects, List roles, List resources) { - this.type = type; - this.subjects = subjects; - this.roles = roles; - this.resources = resources; - } - - /** - * Builds a CreatePolicyOptions. - * - * @return the new CreatePolicyOptions instance - */ - public CreatePolicyOptions build() { - return new CreatePolicyOptions(this); - } - - /** - * Adds a new element to subjects. - * - * @param subjects the new element to be added - * @return the CreatePolicyOptions builder - */ - public Builder addSubjects(PolicySubject subjects) { - com.ibm.cloud.sdk.core.util.Validator.notNull(subjects, - "subjects cannot be null"); - if (this.subjects == null) { - this.subjects = new ArrayList(); - } - this.subjects.add(subjects); - return this; - } - - /** - * Adds a new element to roles. - * - * @param roles the new element to be added - * @return the CreatePolicyOptions builder - */ - public Builder addRoles(PolicyRole roles) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roles, - "roles cannot be null"); - if (this.roles == null) { - this.roles = new ArrayList(); - } - this.roles.add(roles); - return this; - } - - /** - * Adds a new element to resources. - * - * @param resources the new element to be added - * @return the CreatePolicyOptions builder - */ - public Builder addResources(PolicyResource resources) { - com.ibm.cloud.sdk.core.util.Validator.notNull(resources, - "resources cannot be null"); - if (this.resources == null) { - this.resources = new ArrayList(); - } - this.resources.add(resources); - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the CreatePolicyOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the subjects. - * Existing subjects will be replaced. - * - * @param subjects the subjects - * @return the CreatePolicyOptions builder - */ - public Builder subjects(List subjects) { - this.subjects = subjects; - return this; - } - - /** - * Set the roles. - * Existing roles will be replaced. - * - * @param roles the roles - * @return the CreatePolicyOptions builder - */ - public Builder roles(List roles) { - this.roles = roles; - return this; - } - - /** - * Set the resources. - * Existing resources will be replaced. - * - * @param resources the resources - * @return the CreatePolicyOptions builder - */ - public Builder resources(List resources) { - this.resources = resources; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreatePolicyOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreatePolicyOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreatePolicyOptions() { } - - protected CreatePolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subjects, - "subjects cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, - "roles cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resources, - "resources cannot be null"); - type = builder.type; - subjects = builder.subjects; - roles = builder.roles; - resources = builder.resources; - description = builder.description; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreatePolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the subjects. - * - * The subjects associated with a policy. - * - * @return the subjects - */ - public List subjects() { - return subjects; - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List roles() { - return roles; - } - - /** - * Gets the resources. - * - * The resources associated with a policy. - * - * @return the resources - */ - public List resources() { - return resources; - } - - /** - * Gets the description. - * - * Customer-defined description. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java deleted file mode 100644 index b71ca393f11..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createPolicyTemplateAssignment options. - */ -public class CreatePolicyTemplateAssignmentOptions extends GenericModel { - - protected String version; - protected AssignmentTargetDetails target; - protected List templates; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String version; - private AssignmentTargetDetails target; - private List templates; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreatePolicyTemplateAssignmentOptions instance. - * - * @param createPolicyTemplateAssignmentOptions the instance to initialize the Builder with - */ - private Builder(CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptions) { - this.version = createPolicyTemplateAssignmentOptions.version; - this.target = createPolicyTemplateAssignmentOptions.target; - this.templates = createPolicyTemplateAssignmentOptions.templates; - this.acceptLanguage = createPolicyTemplateAssignmentOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param version the version - * @param target the target - * @param templates the templates - */ - public Builder(String version, AssignmentTargetDetails target, List templates) { - this.version = version; - this.target = target; - this.templates = templates; - } - - /** - * Builds a CreatePolicyTemplateAssignmentOptions. - * - * @return the new CreatePolicyTemplateAssignmentOptions instance - */ - public CreatePolicyTemplateAssignmentOptions build() { - return new CreatePolicyTemplateAssignmentOptions(this); - } - - /** - * Adds a new element to templates. - * - * @param templates the new element to be added - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder addTemplates(AssignmentTemplateDetails templates) { - com.ibm.cloud.sdk.core.util.Validator.notNull(templates, - "templates cannot be null"); - if (this.templates == null) { - this.templates = new ArrayList(); - } - this.templates.add(templates); - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the target. - * - * @param target the target - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder target(AssignmentTargetDetails target) { - this.target = target; - return this; - } - - /** - * Set the templates. - * Existing templates will be replaced. - * - * @param templates the templates - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder templates(List templates) { - this.templates = templates; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreatePolicyTemplateAssignmentOptions() { } - - protected CreatePolicyTemplateAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, - "target cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, - "templates cannot be null"); - version = builder.version; - target = builder.target; - templates = builder.templates; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreatePolicyTemplateAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the version. - * - * specify version of response body format. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails target() { - return target; - } - - /** - * Gets the templates. - * - * List of template details for policy assignment. - * - * @return the templates - */ - public List templates() { - return templates; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java deleted file mode 100644 index 72944308428..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java +++ /dev/null @@ -1,255 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createPolicyTemplate options. - */ -public class CreatePolicyTemplateOptions extends GenericModel { - - protected String name; - protected String accountId; - protected TemplatePolicy policy; - protected String description; - protected Boolean committed; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String accountId; - private TemplatePolicy policy; - private String description; - private Boolean committed; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreatePolicyTemplateOptions instance. - * - * @param createPolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(CreatePolicyTemplateOptions createPolicyTemplateOptions) { - this.name = createPolicyTemplateOptions.name; - this.accountId = createPolicyTemplateOptions.accountId; - this.policy = createPolicyTemplateOptions.policy; - this.description = createPolicyTemplateOptions.description; - this.committed = createPolicyTemplateOptions.committed; - this.acceptLanguage = createPolicyTemplateOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param accountId the accountId - * @param policy the policy - */ - public Builder(String name, String accountId, TemplatePolicy policy) { - this.name = name; - this.accountId = accountId; - this.policy = policy; - } - - /** - * Builds a CreatePolicyTemplateOptions. - * - * @return the new CreatePolicyTemplateOptions instance - */ - public CreatePolicyTemplateOptions build() { - return new CreatePolicyTemplateOptions(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the CreatePolicyTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the CreatePolicyTemplateOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the policy. - * - * @param policy the policy - * @return the CreatePolicyTemplateOptions builder - */ - public Builder policy(TemplatePolicy policy) { - this.policy = policy; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreatePolicyTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreatePolicyTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreatePolicyTemplateOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreatePolicyTemplateOptions() { } - - protected CreatePolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.policy, - "policy cannot be null"); - name = builder.name; - accountId = builder.accountId; - policy = builder.policy; - description = builder.description; - committed = builder.committed; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreatePolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy policy() { - return policy; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java deleted file mode 100644 index 6903774c335..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createPolicyTemplateVersion options. - */ -public class CreatePolicyTemplateVersionOptions extends GenericModel { - - protected String policyTemplateId; - protected TemplatePolicy policy; - protected String name; - protected String description; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private TemplatePolicy policy; - private String name; - private String description; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing CreatePolicyTemplateVersionOptions instance. - * - * @param createPolicyTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptions) { - this.policyTemplateId = createPolicyTemplateVersionOptions.policyTemplateId; - this.policy = createPolicyTemplateVersionOptions.policy; - this.name = createPolicyTemplateVersionOptions.name; - this.description = createPolicyTemplateVersionOptions.description; - this.committed = createPolicyTemplateVersionOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param policy the policy - */ - public Builder(String policyTemplateId, TemplatePolicy policy) { - this.policyTemplateId = policyTemplateId; - this.policy = policy; - } - - /** - * Builds a CreatePolicyTemplateVersionOptions. - * - * @return the new CreatePolicyTemplateVersionOptions instance - */ - public CreatePolicyTemplateVersionOptions build() { - return new CreatePolicyTemplateVersionOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the policy. - * - * @param policy the policy - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder policy(TemplatePolicy policy) { - this.policy = policy; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected CreatePolicyTemplateVersionOptions() { } - - protected CreatePolicyTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.policy, - "policy cannot be null"); - policyTemplateId = builder.policyTemplateId; - policy = builder.policy; - name = builder.name; - description = builder.description; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a CreatePolicyTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy policy() { - return policy; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template version. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java deleted file mode 100644 index 725ec5d8a53..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java +++ /dev/null @@ -1,308 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createRole options. - */ -public class CreateRoleOptions extends GenericModel { - - protected String displayName; - protected List actions; - protected String name; - protected String accountId; - protected String serviceName; - protected String description; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String displayName; - private List actions; - private String name; - private String accountId; - private String serviceName; - private String description; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateRoleOptions instance. - * - * @param createRoleOptions the instance to initialize the Builder with - */ - private Builder(CreateRoleOptions createRoleOptions) { - this.displayName = createRoleOptions.displayName; - this.actions = createRoleOptions.actions; - this.name = createRoleOptions.name; - this.accountId = createRoleOptions.accountId; - this.serviceName = createRoleOptions.serviceName; - this.description = createRoleOptions.description; - this.acceptLanguage = createRoleOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param displayName the displayName - * @param actions the actions - * @param name the name - * @param accountId the accountId - * @param serviceName the serviceName - */ - public Builder(String displayName, List actions, String name, String accountId, String serviceName) { - this.displayName = displayName; - this.actions = actions; - this.name = name; - this.accountId = accountId; - this.serviceName = serviceName; - } - - /** - * Builds a CreateRoleOptions. - * - * @return the new CreateRoleOptions instance - */ - public CreateRoleOptions build() { - return new CreateRoleOptions(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the CreateRoleOptions builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the CreateRoleOptions builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the CreateRoleOptions builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateRoleOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the CreateRoleOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the CreateRoleOptions builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateRoleOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateRoleOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateRoleOptions() { } - - protected CreateRoleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, - "serviceName cannot be null"); - displayName = builder.displayName; - actions = builder.actions; - name = builder.name; - accountId = builder.accountId; - serviceName = builder.serviceName; - description = builder.description; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateRoleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List actions() { - return actions; - } - - /** - * Gets the name. - * - * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the accountId. - * - * The account GUID. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the serviceName. - * - * The service name. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java deleted file mode 100644 index c9bef88e703..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createRoleTemplateAssignment options. - */ -public class CreateRoleTemplateAssignmentOptions extends GenericModel { - - protected AssignmentTargetDetails target; - protected List templates; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private AssignmentTargetDetails target; - private List templates; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateRoleTemplateAssignmentOptions instance. - * - * @param createRoleTemplateAssignmentOptions the instance to initialize the Builder with - */ - private Builder(CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptions) { - this.target = createRoleTemplateAssignmentOptions.target; - this.templates = createRoleTemplateAssignmentOptions.templates; - this.acceptLanguage = createRoleTemplateAssignmentOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param target the target - * @param templates the templates - */ - public Builder(AssignmentTargetDetails target, List templates) { - this.target = target; - this.templates = templates; - } - - /** - * Builds a CreateRoleTemplateAssignmentOptions. - * - * @return the new CreateRoleTemplateAssignmentOptions instance - */ - public CreateRoleTemplateAssignmentOptions build() { - return new CreateRoleTemplateAssignmentOptions(this); - } - - /** - * Adds a new element to templates. - * - * @param templates the new element to be added - * @return the CreateRoleTemplateAssignmentOptions builder - */ - public Builder addTemplates(RoleAssignmentTemplate templates) { - com.ibm.cloud.sdk.core.util.Validator.notNull(templates, - "templates cannot be null"); - if (this.templates == null) { - this.templates = new ArrayList(); - } - this.templates.add(templates); - return this; - } - - /** - * Set the target. - * - * @param target the target - * @return the CreateRoleTemplateAssignmentOptions builder - */ - public Builder target(AssignmentTargetDetails target) { - this.target = target; - return this; - } - - /** - * Set the templates. - * Existing templates will be replaced. - * - * @param templates the templates - * @return the CreateRoleTemplateAssignmentOptions builder - */ - public Builder templates(List templates) { - this.templates = templates; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateRoleTemplateAssignmentOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateRoleTemplateAssignmentOptions() { } - - protected CreateRoleTemplateAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, - "target cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, - "templates cannot be null"); - target = builder.target; - templates = builder.templates; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateRoleTemplateAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails target() { - return target; - } - - /** - * Gets the templates. - * - * List of role template details for role assignment. - * - * @return the templates - */ - public List templates() { - return templates; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java deleted file mode 100644 index baf82e17961..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createRoleTemplate options. - */ -public class CreateRoleTemplateOptions extends GenericModel { - - protected String name; - protected String accountId; - protected String description; - protected Boolean committed; - protected RoleTemplatePrototypeRole role; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String accountId; - private String description; - private Boolean committed; - private RoleTemplatePrototypeRole role; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateRoleTemplateOptions instance. - * - * @param createRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(CreateRoleTemplateOptions createRoleTemplateOptions) { - this.name = createRoleTemplateOptions.name; - this.accountId = createRoleTemplateOptions.accountId; - this.description = createRoleTemplateOptions.description; - this.committed = createRoleTemplateOptions.committed; - this.role = createRoleTemplateOptions.role; - this.acceptLanguage = createRoleTemplateOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param accountId the accountId - */ - public Builder(String name, String accountId) { - this.name = name; - this.accountId = accountId; - } - - /** - * Builds a CreateRoleTemplateOptions. - * - * @return the new CreateRoleTemplateOptions instance - */ - public CreateRoleTemplateOptions build() { - return new CreateRoleTemplateOptions(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateRoleTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the CreateRoleTemplateOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateRoleTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreateRoleTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - - /** - * Set the role. - * - * @param role the role - * @return the CreateRoleTemplateOptions builder - */ - public Builder role(RoleTemplatePrototypeRole role) { - this.role = role; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateRoleTemplateOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateRoleTemplateOptions() { } - - protected CreateRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - name = builder.name; - accountId = builder.accountId; - description = builder.description; - committed = builder.committed; - role = builder.role; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the description. - * - * Description of the role template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the role for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template. If committed is set to true, then the template version can no longer be updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } - - /** - * Gets the role. - * - * The role properties that are created in an action resource when the template is assigned. - * - * @return the role - */ - public RoleTemplatePrototypeRole role() { - return role; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java deleted file mode 100644 index c322c5a332d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createRoleTemplateVersion options. - */ -public class CreateRoleTemplateVersionOptions extends GenericModel { - - protected String roleTemplateId; - protected String name; - protected String description; - protected TemplateRole role; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String name; - private String description; - private TemplateRole role; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing CreateRoleTemplateVersionOptions instance. - * - * @param createRoleTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(CreateRoleTemplateVersionOptions createRoleTemplateVersionOptions) { - this.roleTemplateId = createRoleTemplateVersionOptions.roleTemplateId; - this.name = createRoleTemplateVersionOptions.name; - this.description = createRoleTemplateVersionOptions.description; - this.role = createRoleTemplateVersionOptions.role; - this.committed = createRoleTemplateVersionOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - */ - public Builder(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - } - - /** - * Builds a CreateRoleTemplateVersionOptions. - * - * @return the new CreateRoleTemplateVersionOptions instance - */ - public CreateRoleTemplateVersionOptions build() { - return new CreateRoleTemplateVersionOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the role. - * - * @param role the role - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder role(TemplateRole role) { - this.role = role; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected CreateRoleTemplateVersionOptions() { } - - protected CreateRoleTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - roleTemplateId = builder.roleTemplateId; - name = builder.name; - description = builder.description; - role = builder.role; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a CreateRoleTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * The role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will - * change the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the role template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the role for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the role. - * - * The role properties that are created in an action resource when the template is assigned. - * - * @return the role - */ - public TemplateRole role() { - return role; - } - - /** - * Gets the committed. - * - * Committed status of the template version. If committed is set to true, then the template version can no longer be - * updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java deleted file mode 100644 index 59ccb4b908a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java +++ /dev/null @@ -1,312 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createV2Policy options. - */ -public class CreateV2PolicyOptions extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - protected Control control; - protected String type; - protected String description; - protected V2PolicySubject subject; - protected V2PolicyResource resource; - protected String pattern; - protected V2PolicyRule rule; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private Control control; - private String type; - private String description; - private V2PolicySubject subject; - private V2PolicyResource resource; - private String pattern; - private V2PolicyRule rule; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateV2PolicyOptions instance. - * - * @param createV2PolicyOptions the instance to initialize the Builder with - */ - private Builder(CreateV2PolicyOptions createV2PolicyOptions) { - this.control = createV2PolicyOptions.control; - this.type = createV2PolicyOptions.type; - this.description = createV2PolicyOptions.description; - this.subject = createV2PolicyOptions.subject; - this.resource = createV2PolicyOptions.resource; - this.pattern = createV2PolicyOptions.pattern; - this.rule = createV2PolicyOptions.rule; - this.acceptLanguage = createV2PolicyOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param control the control - * @param type the type - */ - public Builder(Control control, String type) { - this.control = control; - this.type = type; - } - - /** - * Builds a CreateV2PolicyOptions. - * - * @return the new CreateV2PolicyOptions instance - */ - public CreateV2PolicyOptions build() { - return new CreateV2PolicyOptions(this); - } - - /** - * Set the control. - * - * @param control the control - * @return the CreateV2PolicyOptions builder - */ - public Builder control(Control control) { - this.control = control; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the CreateV2PolicyOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateV2PolicyOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the subject. - * - * @param subject the subject - * @return the CreateV2PolicyOptions builder - */ - public Builder subject(V2PolicySubject subject) { - this.subject = subject; - return this; - } - - /** - * Set the resource. - * - * @param resource the resource - * @return the CreateV2PolicyOptions builder - */ - public Builder resource(V2PolicyResource resource) { - this.resource = resource; - return this; - } - - /** - * Set the pattern. - * - * @param pattern the pattern - * @return the CreateV2PolicyOptions builder - */ - public Builder pattern(String pattern) { - this.pattern = pattern; - return this; - } - - /** - * Set the rule. - * - * @param rule the rule - * @return the CreateV2PolicyOptions builder - */ - public Builder rule(V2PolicyRule rule) { - this.rule = rule; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateV2PolicyOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateV2PolicyOptions() { } - - protected CreateV2PolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.control, - "control cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - control = builder.control; - type = builder.type; - description = builder.description; - subject = builder.subject; - resource = builder.resource; - pattern = builder.pattern; - rule = builder.rule; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateV2PolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the control. - * - * Specifies the type of access that is granted by the policy. - * - * @return the control - */ - public Control control() { - return control; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject subject() { - return subject; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource resource() { - return resource; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String pattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule rule() { - return rule; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java deleted file mode 100644 index f5e35c13d9f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * An additional set of properties associated with a role. - */ -public class CustomRole extends GenericModel { - - protected String id; - @SerializedName("display_name") - protected String displayName; - protected String description; - protected List actions; - protected String crn; - protected String name; - @SerializedName("account_id") - protected String accountId; - @SerializedName("service_name") - protected String serviceName; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String href; - - protected CustomRole() { } - - /** - * Gets the id. - * - * The role ID. Composed of hexadecimal characters. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String getDisplayName() { - return displayName; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List getActions() { - return actions; - } - - /** - * Gets the crn. - * - * The role Cloud Resource Name (CRN). Example CRN: - * 'crn:v1:ibmcloud:public:iam-access-management::a/exampleAccountId::customRole:ExampleRoleName'. - * - * @return the crn - */ - public String getCrn() { - return crn; - } - - /** - * Gets the name. - * - * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the accountId. - * - * The account GUID. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the serviceName. - * - * The service name. - * - * @return the serviceName - */ - public String getServiceName() { - return serviceName; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the role was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the role. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the role was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the href. - * - * The href links back to the role. - * - * @return the href - */ - public String getHref() { - return href; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java deleted file mode 100644 index f71d2c2ab9d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteActionControlAssignment options. - */ -public class DeleteActionControlAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing DeleteActionControlAssignmentOptions instance. - * - * @param deleteActionControlAssignmentOptions the instance to initialize the Builder with - */ - private Builder(DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptions) { - this.assignmentId = deleteActionControlAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a DeleteActionControlAssignmentOptions. - * - * @return the new DeleteActionControlAssignmentOptions instance - */ - public DeleteActionControlAssignmentOptions build() { - return new DeleteActionControlAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the DeleteActionControlAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected DeleteActionControlAssignmentOptions() { } - - protected DeleteActionControlAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a DeleteActionControlAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Action control template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java deleted file mode 100644 index 6ff35d83603..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteActionControlTemplate options. - */ -public class DeleteActionControlTemplateOptions extends GenericModel { - - protected String actionControlTemplateId; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - - /** - * Instantiates a new Builder from an existing DeleteActionControlTemplateOptions instance. - * - * @param deleteActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(DeleteActionControlTemplateOptions deleteActionControlTemplateOptions) { - this.actionControlTemplateId = deleteActionControlTemplateOptions.actionControlTemplateId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - */ - public Builder(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - } - - /** - * Builds a DeleteActionControlTemplateOptions. - * - * @return the new DeleteActionControlTemplateOptions instance - */ - public DeleteActionControlTemplateOptions build() { - return new DeleteActionControlTemplateOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the DeleteActionControlTemplateOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - } - - protected DeleteActionControlTemplateOptions() { } - - protected DeleteActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - } - - /** - * New builder. - * - * @return a DeleteActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java deleted file mode 100644 index 69aca0555a1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteActionControlTemplateVersion options. - */ -public class DeleteActionControlTemplateVersionOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing DeleteActionControlTemplateVersionOptions instance. - * - * @param deleteActionControlTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptions) { - this.actionControlTemplateId = deleteActionControlTemplateVersionOptions.actionControlTemplateId; - this.version = deleteActionControlTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - * @param version the version - */ - public Builder(String actionControlTemplateId, String version) { - this.actionControlTemplateId = actionControlTemplateId; - this.version = version; - } - - /** - * Builds a DeleteActionControlTemplateVersionOptions. - * - * @return the new DeleteActionControlTemplateVersionOptions instance - */ - public DeleteActionControlTemplateVersionOptions build() { - return new DeleteActionControlTemplateVersionOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the DeleteActionControlTemplateVersionOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the DeleteActionControlTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected DeleteActionControlTemplateVersionOptions() { } - - protected DeleteActionControlTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a DeleteActionControlTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java deleted file mode 100644 index 3ab2cf17469..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deletePolicyAssignment options. - */ -public class DeletePolicyAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing DeletePolicyAssignmentOptions instance. - * - * @param deletePolicyAssignmentOptions the instance to initialize the Builder with - */ - private Builder(DeletePolicyAssignmentOptions deletePolicyAssignmentOptions) { - this.assignmentId = deletePolicyAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a DeletePolicyAssignmentOptions. - * - * @return the new DeletePolicyAssignmentOptions instance - */ - public DeletePolicyAssignmentOptions build() { - return new DeletePolicyAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the DeletePolicyAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected DeletePolicyAssignmentOptions() { } - - protected DeletePolicyAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a DeletePolicyAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * The policy template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java deleted file mode 100644 index fe070b2064a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deletePolicy options. - */ -public class DeletePolicyOptions extends GenericModel { - - protected String policyId; - - /** - * Builder. - */ - public static class Builder { - private String policyId; - - /** - * Instantiates a new Builder from an existing DeletePolicyOptions instance. - * - * @param deletePolicyOptions the instance to initialize the Builder with - */ - private Builder(DeletePolicyOptions deletePolicyOptions) { - this.policyId = deletePolicyOptions.policyId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyId the policyId - */ - public Builder(String policyId) { - this.policyId = policyId; - } - - /** - * Builds a DeletePolicyOptions. - * - * @return the new DeletePolicyOptions instance - */ - public DeletePolicyOptions build() { - return new DeletePolicyOptions(this); - } - - /** - * Set the policyId. - * - * @param policyId the policyId - * @return the DeletePolicyOptions builder - */ - public Builder policyId(String policyId) { - this.policyId = policyId; - return this; - } - } - - protected DeletePolicyOptions() { } - - protected DeletePolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, - "policyId cannot be empty"); - policyId = builder.policyId; - } - - /** - * New builder. - * - * @return a DeletePolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyId. - * - * The policy ID. - * - * @return the policyId - */ - public String policyId() { - return policyId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java deleted file mode 100644 index bb70b0d6727..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deletePolicyTemplate options. - */ -public class DeletePolicyTemplateOptions extends GenericModel { - - protected String policyTemplateId; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - - /** - * Instantiates a new Builder from an existing DeletePolicyTemplateOptions instance. - * - * @param deletePolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(DeletePolicyTemplateOptions deletePolicyTemplateOptions) { - this.policyTemplateId = deletePolicyTemplateOptions.policyTemplateId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - */ - public Builder(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - } - - /** - * Builds a DeletePolicyTemplateOptions. - * - * @return the new DeletePolicyTemplateOptions instance - */ - public DeletePolicyTemplateOptions build() { - return new DeletePolicyTemplateOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the DeletePolicyTemplateOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - } - - protected DeletePolicyTemplateOptions() { } - - protected DeletePolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - policyTemplateId = builder.policyTemplateId; - } - - /** - * New builder. - * - * @return a DeletePolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java deleted file mode 100644 index 9a04a5157b6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deletePolicyTemplateVersion options. - */ -public class DeletePolicyTemplateVersionOptions extends GenericModel { - - protected String policyTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing DeletePolicyTemplateVersionOptions instance. - * - * @param deletePolicyTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptions) { - this.policyTemplateId = deletePolicyTemplateVersionOptions.policyTemplateId; - this.version = deletePolicyTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param version the version - */ - public Builder(String policyTemplateId, String version) { - this.policyTemplateId = policyTemplateId; - this.version = version; - } - - /** - * Builds a DeletePolicyTemplateVersionOptions. - * - * @return the new DeletePolicyTemplateVersionOptions instance - */ - public DeletePolicyTemplateVersionOptions build() { - return new DeletePolicyTemplateVersionOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the DeletePolicyTemplateVersionOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the DeletePolicyTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected DeletePolicyTemplateVersionOptions() { } - - protected DeletePolicyTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - policyTemplateId = builder.policyTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a DeletePolicyTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the version. - * - * The policy template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java deleted file mode 100644 index b9341a9f414..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteRoleAssignment options. - */ -public class DeleteRoleAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing DeleteRoleAssignmentOptions instance. - * - * @param deleteRoleAssignmentOptions the instance to initialize the Builder with - */ - private Builder(DeleteRoleAssignmentOptions deleteRoleAssignmentOptions) { - this.assignmentId = deleteRoleAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a DeleteRoleAssignmentOptions. - * - * @return the new DeleteRoleAssignmentOptions instance - */ - public DeleteRoleAssignmentOptions build() { - return new DeleteRoleAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the DeleteRoleAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected DeleteRoleAssignmentOptions() { } - - protected DeleteRoleAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a DeleteRoleAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Role template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java deleted file mode 100644 index 8675777719e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteRole options. - */ -public class DeleteRoleOptions extends GenericModel { - - protected String roleId; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - - /** - * Instantiates a new Builder from an existing DeleteRoleOptions instance. - * - * @param deleteRoleOptions the instance to initialize the Builder with - */ - private Builder(DeleteRoleOptions deleteRoleOptions) { - this.roleId = deleteRoleOptions.roleId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - */ - public Builder(String roleId) { - this.roleId = roleId; - } - - /** - * Builds a DeleteRoleOptions. - * - * @return the new DeleteRoleOptions instance - */ - public DeleteRoleOptions build() { - return new DeleteRoleOptions(this); - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the DeleteRoleOptions builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - } - - protected DeleteRoleOptions() { } - - protected DeleteRoleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, - "roleId cannot be empty"); - roleId = builder.roleId; - } - - /** - * New builder. - * - * @return a DeleteRoleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role ID. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java deleted file mode 100644 index c76bf3bfda4..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteRoleTemplate options. - */ -public class DeleteRoleTemplateOptions extends GenericModel { - - protected String roleTemplateId; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - - /** - * Instantiates a new Builder from an existing DeleteRoleTemplateOptions instance. - * - * @param deleteRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(DeleteRoleTemplateOptions deleteRoleTemplateOptions) { - this.roleTemplateId = deleteRoleTemplateOptions.roleTemplateId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - */ - public Builder(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - } - - /** - * Builds a DeleteRoleTemplateOptions. - * - * @return the new DeleteRoleTemplateOptions instance - */ - public DeleteRoleTemplateOptions build() { - return new DeleteRoleTemplateOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the DeleteRoleTemplateOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - } - - protected DeleteRoleTemplateOptions() { } - - protected DeleteRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - roleTemplateId = builder.roleTemplateId; - } - - /** - * New builder. - * - * @return a DeleteRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java deleted file mode 100644 index 9f974213165..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteRoleTemplateVersion options. - */ -public class DeleteRoleTemplateVersionOptions extends GenericModel { - - protected String roleTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing DeleteRoleTemplateVersionOptions instance. - * - * @param deleteRoleTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptions) { - this.roleTemplateId = deleteRoleTemplateVersionOptions.roleTemplateId; - this.version = deleteRoleTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - * @param version the version - */ - public Builder(String roleTemplateId, String version) { - this.roleTemplateId = roleTemplateId; - this.version = version; - } - - /** - * Builds a DeleteRoleTemplateVersionOptions. - * - * @return the new DeleteRoleTemplateVersionOptions instance - */ - public DeleteRoleTemplateVersionOptions build() { - return new DeleteRoleTemplateVersionOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the DeleteRoleTemplateVersionOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the DeleteRoleTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected DeleteRoleTemplateVersionOptions() { } - - protected DeleteRoleTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - roleTemplateId = builder.roleTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a DeleteRoleTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the version. - * - * Role template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java deleted file mode 100644 index 92c1caaa34c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteV2Policy options. - */ -public class DeleteV2PolicyOptions extends GenericModel { - - protected String id; - - /** - * Builder. - */ - public static class Builder { - private String id; - - /** - * Instantiates a new Builder from an existing DeleteV2PolicyOptions instance. - * - * @param deleteV2PolicyOptions the instance to initialize the Builder with - */ - private Builder(DeleteV2PolicyOptions deleteV2PolicyOptions) { - this.id = deleteV2PolicyOptions.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 DeleteV2PolicyOptions. - * - * @return the new DeleteV2PolicyOptions instance - */ - public DeleteV2PolicyOptions build() { - return new DeleteV2PolicyOptions(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the DeleteV2PolicyOptions builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - } - - protected DeleteV2PolicyOptions() { } - - protected DeleteV2PolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, - "id cannot be empty"); - id = builder.id; - } - - /** - * New builder. - * - * @return a DeleteV2PolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String id() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java deleted file mode 100644 index 0978eb1040b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role associated with a policy with additional information (display_name, description, actions) when - * `format=display`. - */ -public class EnrichedRoles extends GenericModel { - - @SerializedName("role_id") - protected String roleId; - @SerializedName("display_name") - protected String displayName; - protected String description; - protected List actions; - - protected EnrichedRoles() { } - - /** - * Gets the roleId. - * - * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. - * - * @return the roleId - */ - public String getRoleId() { - return roleId; - } - - /** - * Gets the displayName. - * - * The display name of the role, either service-defined or user-defined for custom roles. - * - * @return the displayName - */ - public String getDisplayName() { - return displayName; - } - - /** - * Gets the description. - * - * The role description, either service-defined or user-defined for custom roles. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List getActions() { - return actions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java deleted file mode 100644 index e99ea48f5f6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Additional error details. - */ -public class ErrorDetails extends GenericModel { - - @SerializedName("conflicts_with") - protected ConflictsWith conflictsWith; - - protected ErrorDetails() { } - - /** - * Gets the conflictsWith. - * - * Details of conflicting resource. - * - * @return the conflictsWith - */ - public ConflictsWith getConflictsWith() { - return conflictsWith; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java deleted file mode 100644 index b5411a7bb36..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * ErrorObject. - */ -public class ErrorObject extends GenericModel { - - /** - * The API error code for the error. - */ - public interface Code { - /** insufficent_permissions. */ - String INSUFFICENT_PERMISSIONS = "insufficent_permissions"; - /** invalid_body. */ - String INVALID_BODY = "invalid_body"; - /** invalid_token. */ - String INVALID_TOKEN = "invalid_token"; - /** missing_required_query_parameter. */ - String MISSING_REQUIRED_QUERY_PARAMETER = "missing_required_query_parameter"; - /** not_found. */ - String NOT_FOUND = "not_found"; - /** policy_conflict_error. */ - String POLICY_CONFLICT_ERROR = "policy_conflict_error"; - /** policy_not_found. */ - String POLICY_NOT_FOUND = "policy_not_found"; - /** request_not_processed. */ - String REQUEST_NOT_PROCESSED = "request_not_processed"; - /** role_conflict_error. */ - String ROLE_CONFLICT_ERROR = "role_conflict_error"; - /** role_not_found. */ - String ROLE_NOT_FOUND = "role_not_found"; - /** too_many_requests. */ - String TOO_MANY_REQUESTS = "too_many_requests"; - /** unable_to_process. */ - String UNABLE_TO_PROCESS = "unable_to_process"; - /** unsupported_content_type. */ - String UNSUPPORTED_CONTENT_TYPE = "unsupported_content_type"; - /** policy_template_conflict_error. */ - String POLICY_TEMPLATE_CONFLICT_ERROR = "policy_template_conflict_error"; - /** policy_template_not_found. */ - String POLICY_TEMPLATE_NOT_FOUND = "policy_template_not_found"; - /** policy_assignment_not_found. */ - String POLICY_ASSIGNMENT_NOT_FOUND = "policy_assignment_not_found"; - /** policy_assignment_conflict_error. */ - String POLICY_ASSIGNMENT_CONFLICT_ERROR = "policy_assignment_conflict_error"; - /** resource_not_found. */ - String RESOURCE_NOT_FOUND = "resource_not_found"; - /** action_control_template_not_found. */ - String ACTION_CONTROL_TEMPLATE_NOT_FOUND = "action_control_template_not_found"; - /** action_control_assignment_not_found. */ - String ACTION_CONTROL_ASSIGNMENT_NOT_FOUND = "action_control_assignment_not_found"; - /** role_template_conflict_error. */ - String ROLE_TEMPLATE_CONFLICT_ERROR = "role_template_conflict_error"; - /** role_template_not_found. */ - String ROLE_TEMPLATE_NOT_FOUND = "role_template_not_found"; - /** role_assignment_not_found. */ - String ROLE_ASSIGNMENT_NOT_FOUND = "role_assignment_not_found"; - } - - protected String code; - protected String message; - protected ErrorDetails details; - @SerializedName("more_info") - protected String moreInfo; - - protected ErrorObject() { } - - /** - * Gets the code. - * - * The API error code for the error. - * - * @return the code - */ - public String getCode() { - return code; - } - - /** - * Gets the message. - * - * The error message returned by the API. - * - * @return the message - */ - public String getMessage() { - return message; - } - - /** - * Gets the details. - * - * Additional error details. - * - * @return the details - */ - public ErrorDetails getDetails() { - return details; - } - - /** - * Gets the moreInfo. - * - * Additional info for error. - * - * @return the moreInfo - */ - public String getMoreInfo() { - return moreInfo; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java deleted file mode 100644 index 5c1c9a9fad6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * How external accounts can interact in relation to the requested account. - */ -public class ExternalAccountIdentityInteraction extends GenericModel { - - @SerializedName("identity_types") - protected IdentityTypes identityTypes; - - protected ExternalAccountIdentityInteraction() { } - - /** - * Gets the identityTypes. - * - * The settings for each identity type. - * - * @return the identityTypes - */ - public IdentityTypes getIdentityTypes() { - return identityTypes; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java deleted file mode 100644 index 1efd0673e9d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Update to how external accounts can interact in relation to the requested account. - */ -public class ExternalAccountIdentityInteractionPatch extends GenericModel { - - @SerializedName("identity_types") - protected IdentityTypesPatch identityTypes; - - /** - * Builder. - */ - public static class Builder { - private IdentityTypesPatch identityTypes; - - /** - * Instantiates a new Builder from an existing ExternalAccountIdentityInteractionPatch instance. - * - * @param externalAccountIdentityInteractionPatch the instance to initialize the Builder with - */ - private Builder(ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatch) { - this.identityTypes = externalAccountIdentityInteractionPatch.identityTypes; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a ExternalAccountIdentityInteractionPatch. - * - * @return the new ExternalAccountIdentityInteractionPatch instance - */ - public ExternalAccountIdentityInteractionPatch build() { - return new ExternalAccountIdentityInteractionPatch(this); - } - - /** - * Set the identityTypes. - * - * @param identityTypes the identityTypes - * @return the ExternalAccountIdentityInteractionPatch builder - */ - public Builder identityTypes(IdentityTypesPatch identityTypes) { - this.identityTypes = identityTypes; - return this; - } - } - - protected ExternalAccountIdentityInteractionPatch() { } - - protected ExternalAccountIdentityInteractionPatch(Builder builder) { - identityTypes = builder.identityTypes; - } - - /** - * New builder. - * - * @return a ExternalAccountIdentityInteractionPatch builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the identityTypes. - * - * The settings to apply for each identity type for a request. - * - * @return the identityTypes - */ - public IdentityTypesPatch identityTypes() { - return identityTypes; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java deleted file mode 100644 index 83cd67d33c9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Details with linking href to first page of requested collection. - */ -public class First extends GenericModel { - - protected String href; - - protected First() { } - - /** - * Gets the href. - * - * The href linking to the page of requested collection. - * - * @return the href - */ - public String getHref() { - return href; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java deleted file mode 100644 index f87e7d741a4..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getActionControlAssignment options. - */ -public class GetActionControlAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing GetActionControlAssignmentOptions instance. - * - * @param getActionControlAssignmentOptions the instance to initialize the Builder with - */ - private Builder(GetActionControlAssignmentOptions getActionControlAssignmentOptions) { - this.assignmentId = getActionControlAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a GetActionControlAssignmentOptions. - * - * @return the new GetActionControlAssignmentOptions instance - */ - public GetActionControlAssignmentOptions build() { - return new GetActionControlAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the GetActionControlAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected GetActionControlAssignmentOptions() { } - - protected GetActionControlAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a GetActionControlAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Action control template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java deleted file mode 100644 index 963c68e8876..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getActionControlTemplate options. - */ -public class GetActionControlTemplateOptions extends GenericModel { - - /** - * The action control template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String actionControlTemplateId; - protected String state; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String state; - - /** - * Instantiates a new Builder from an existing GetActionControlTemplateOptions instance. - * - * @param getActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(GetActionControlTemplateOptions getActionControlTemplateOptions) { - this.actionControlTemplateId = getActionControlTemplateOptions.actionControlTemplateId; - this.state = getActionControlTemplateOptions.state; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - */ - public Builder(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - } - - /** - * Builds a GetActionControlTemplateOptions. - * - * @return the new GetActionControlTemplateOptions instance - */ - public GetActionControlTemplateOptions build() { - return new GetActionControlTemplateOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the GetActionControlTemplateOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the GetActionControlTemplateOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - } - - protected GetActionControlTemplateOptions() { } - - protected GetActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - state = builder.state; - } - - /** - * New builder. - * - * @return a GetActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the state. - * - * The action control template state. - * - * @return the state - */ - public String state() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java deleted file mode 100644 index 95bc94950bb..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getActionControlTemplateVersion options. - */ -public class GetActionControlTemplateVersionOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing GetActionControlTemplateVersionOptions instance. - * - * @param getActionControlTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptions) { - this.actionControlTemplateId = getActionControlTemplateVersionOptions.actionControlTemplateId; - this.version = getActionControlTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - * @param version the version - */ - public Builder(String actionControlTemplateId, String version) { - this.actionControlTemplateId = actionControlTemplateId; - this.version = version; - } - - /** - * Builds a GetActionControlTemplateVersionOptions. - * - * @return the new GetActionControlTemplateVersionOptions instance - */ - public GetActionControlTemplateVersionOptions build() { - return new GetActionControlTemplateVersionOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the GetActionControlTemplateVersionOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the GetActionControlTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected GetActionControlTemplateVersionOptions() { } - - protected GetActionControlTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a GetActionControlTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java deleted file mode 100644 index d1c7c359003..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getPolicyAssignment options. - */ -public class GetPolicyAssignmentOptions extends GenericModel { - - protected String assignmentId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - private String version; - - /** - * Instantiates a new Builder from an existing GetPolicyAssignmentOptions instance. - * - * @param getPolicyAssignmentOptions the instance to initialize the Builder with - */ - private Builder(GetPolicyAssignmentOptions getPolicyAssignmentOptions) { - this.assignmentId = getPolicyAssignmentOptions.assignmentId; - this.version = getPolicyAssignmentOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - * @param version the version - */ - public Builder(String assignmentId, String version) { - this.assignmentId = assignmentId; - this.version = version; - } - - /** - * Builds a GetPolicyAssignmentOptions. - * - * @return the new GetPolicyAssignmentOptions instance - */ - public GetPolicyAssignmentOptions build() { - return new GetPolicyAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the GetPolicyAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the GetPolicyAssignmentOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected GetPolicyAssignmentOptions() { } - - protected GetPolicyAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - assignmentId = builder.assignmentId; - version = builder.version; - } - - /** - * New builder. - * - * @return a GetPolicyAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * The policy template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } - - /** - * Gets the version. - * - * specify version of response body format. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java deleted file mode 100644 index e780ac06896..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getPolicy options. - */ -public class GetPolicyOptions extends GenericModel { - - protected String policyId; - - /** - * Builder. - */ - public static class Builder { - private String policyId; - - /** - * Instantiates a new Builder from an existing GetPolicyOptions instance. - * - * @param getPolicyOptions the instance to initialize the Builder with - */ - private Builder(GetPolicyOptions getPolicyOptions) { - this.policyId = getPolicyOptions.policyId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyId the policyId - */ - public Builder(String policyId) { - this.policyId = policyId; - } - - /** - * Builds a GetPolicyOptions. - * - * @return the new GetPolicyOptions instance - */ - public GetPolicyOptions build() { - return new GetPolicyOptions(this); - } - - /** - * Set the policyId. - * - * @param policyId the policyId - * @return the GetPolicyOptions builder - */ - public Builder policyId(String policyId) { - this.policyId = policyId; - return this; - } - } - - protected GetPolicyOptions() { } - - protected GetPolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, - "policyId cannot be empty"); - policyId = builder.policyId; - } - - /** - * New builder. - * - * @return a GetPolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyId. - * - * The policy ID. - * - * @return the policyId - */ - public String policyId() { - return policyId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java deleted file mode 100644 index ee604554a85..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getPolicyTemplate options. - */ -public class GetPolicyTemplateOptions extends GenericModel { - - /** - * The policy template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String policyTemplateId; - protected String state; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String state; - - /** - * Instantiates a new Builder from an existing GetPolicyTemplateOptions instance. - * - * @param getPolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(GetPolicyTemplateOptions getPolicyTemplateOptions) { - this.policyTemplateId = getPolicyTemplateOptions.policyTemplateId; - this.state = getPolicyTemplateOptions.state; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - */ - public Builder(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - } - - /** - * Builds a GetPolicyTemplateOptions. - * - * @return the new GetPolicyTemplateOptions instance - */ - public GetPolicyTemplateOptions build() { - return new GetPolicyTemplateOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the GetPolicyTemplateOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the GetPolicyTemplateOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - } - - protected GetPolicyTemplateOptions() { } - - protected GetPolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - policyTemplateId = builder.policyTemplateId; - state = builder.state; - } - - /** - * New builder. - * - * @return a GetPolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the state. - * - * The policy template state. - * - * @return the state - */ - public String state() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java deleted file mode 100644 index 8741f83357d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getPolicyTemplateVersion options. - */ -public class GetPolicyTemplateVersionOptions extends GenericModel { - - protected String policyTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing GetPolicyTemplateVersionOptions instance. - * - * @param getPolicyTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptions) { - this.policyTemplateId = getPolicyTemplateVersionOptions.policyTemplateId; - this.version = getPolicyTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param version the version - */ - public Builder(String policyTemplateId, String version) { - this.policyTemplateId = policyTemplateId; - this.version = version; - } - - /** - * Builds a GetPolicyTemplateVersionOptions. - * - * @return the new GetPolicyTemplateVersionOptions instance - */ - public GetPolicyTemplateVersionOptions build() { - return new GetPolicyTemplateVersionOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the GetPolicyTemplateVersionOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the GetPolicyTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected GetPolicyTemplateVersionOptions() { } - - protected GetPolicyTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - policyTemplateId = builder.policyTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a GetPolicyTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the version. - * - * The policy template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java deleted file mode 100644 index 35313b9b746..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getRoleAssignment options. - */ -public class GetRoleAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing GetRoleAssignmentOptions instance. - * - * @param getRoleAssignmentOptions the instance to initialize the Builder with - */ - private Builder(GetRoleAssignmentOptions getRoleAssignmentOptions) { - this.assignmentId = getRoleAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a GetRoleAssignmentOptions. - * - * @return the new GetRoleAssignmentOptions instance - */ - public GetRoleAssignmentOptions build() { - return new GetRoleAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the GetRoleAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected GetRoleAssignmentOptions() { } - - protected GetRoleAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a GetRoleAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Role template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java deleted file mode 100644 index 8c56ac7f58a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getRole options. - */ -public class GetRoleOptions extends GenericModel { - - protected String roleId; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - - /** - * Instantiates a new Builder from an existing GetRoleOptions instance. - * - * @param getRoleOptions the instance to initialize the Builder with - */ - private Builder(GetRoleOptions getRoleOptions) { - this.roleId = getRoleOptions.roleId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - */ - public Builder(String roleId) { - this.roleId = roleId; - } - - /** - * Builds a GetRoleOptions. - * - * @return the new GetRoleOptions instance - */ - public GetRoleOptions build() { - return new GetRoleOptions(this); - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the GetRoleOptions builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - } - - protected GetRoleOptions() { } - - protected GetRoleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, - "roleId cannot be empty"); - roleId = builder.roleId; - } - - /** - * New builder. - * - * @return a GetRoleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role ID. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java deleted file mode 100644 index e33fcf29b32..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getRoleTemplate options. - */ -public class GetRoleTemplateOptions extends GenericModel { - - /** - * The role template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String roleTemplateId; - protected String state; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String state; - - /** - * Instantiates a new Builder from an existing GetRoleTemplateOptions instance. - * - * @param getRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(GetRoleTemplateOptions getRoleTemplateOptions) { - this.roleTemplateId = getRoleTemplateOptions.roleTemplateId; - this.state = getRoleTemplateOptions.state; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - */ - public Builder(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - } - - /** - * Builds a GetRoleTemplateOptions. - * - * @return the new GetRoleTemplateOptions instance - */ - public GetRoleTemplateOptions build() { - return new GetRoleTemplateOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the GetRoleTemplateOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the GetRoleTemplateOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - } - - protected GetRoleTemplateOptions() { } - - protected GetRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - roleTemplateId = builder.roleTemplateId; - state = builder.state; - } - - /** - * New builder. - * - * @return a GetRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the state. - * - * The role template state. - * - * @return the state - */ - public String state() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java deleted file mode 100644 index 4757484f969..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getRoleTemplateVersion options. - */ -public class GetRoleTemplateVersionOptions extends GenericModel { - - protected String roleTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing GetRoleTemplateVersionOptions instance. - * - * @param getRoleTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(GetRoleTemplateVersionOptions getRoleTemplateVersionOptions) { - this.roleTemplateId = getRoleTemplateVersionOptions.roleTemplateId; - this.version = getRoleTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - * @param version the version - */ - public Builder(String roleTemplateId, String version) { - this.roleTemplateId = roleTemplateId; - this.version = version; - } - - /** - * Builds a GetRoleTemplateVersionOptions. - * - * @return the new GetRoleTemplateVersionOptions instance - */ - public GetRoleTemplateVersionOptions build() { - return new GetRoleTemplateVersionOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the GetRoleTemplateVersionOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the GetRoleTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected GetRoleTemplateVersionOptions() { } - - protected GetRoleTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - roleTemplateId = builder.roleTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a GetRoleTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the version. - * - * Role template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java deleted file mode 100644 index ebc88bbf45c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getSettings options. - */ -public class GetSettingsOptions extends GenericModel { - - protected String accountId; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing GetSettingsOptions instance. - * - * @param getSettingsOptions the instance to initialize the Builder with - */ - private Builder(GetSettingsOptions getSettingsOptions) { - this.accountId = getSettingsOptions.accountId; - this.acceptLanguage = getSettingsOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a GetSettingsOptions. - * - * @return the new GetSettingsOptions instance - */ - public GetSettingsOptions build() { - return new GetSettingsOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the GetSettingsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the GetSettingsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected GetSettingsOptions() { } - - protected GetSettingsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.accountId, - "accountId cannot be empty"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a GetSettingsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the settings belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java deleted file mode 100644 index 23a950cc815..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getV2Policy options. - */ -public class GetV2PolicyOptions extends GenericModel { - - /** - * Include additional data for policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles and translations for all - * relevant fields. - */ - public interface Format { - /** include_last_permit. */ - String INCLUDE_LAST_PERMIT = "include_last_permit"; - /** display. */ - String DISPLAY = "display"; - } - - protected String id; - protected String format; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String format; - - /** - * Instantiates a new Builder from an existing GetV2PolicyOptions instance. - * - * @param getV2PolicyOptions the instance to initialize the Builder with - */ - private Builder(GetV2PolicyOptions getV2PolicyOptions) { - this.id = getV2PolicyOptions.id; - this.format = getV2PolicyOptions.format; - } - - /** - * 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 GetV2PolicyOptions. - * - * @return the new GetV2PolicyOptions instance - */ - public GetV2PolicyOptions build() { - return new GetV2PolicyOptions(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the GetV2PolicyOptions builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the format. - * - * @param format the format - * @return the GetV2PolicyOptions builder - */ - public Builder format(String format) { - this.format = format; - return this; - } - } - - protected GetV2PolicyOptions() { } - - protected GetV2PolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, - "id cannot be empty"); - id = builder.id; - format = builder.format; - } - - /** - * New builder. - * - * @return a GetV2PolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the format. - * - * Include additional data for policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles and translations for all - * relevant fields. - * - * @return the format - */ - public String format() { - return format; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java deleted file mode 100644 index d8439c9d6f7..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Permission is granted by the policy. - */ -public class Grant extends GenericModel { - - protected List roles; - - /** - * Builder. - */ - public static class Builder { - private List roles; - - /** - * Instantiates a new Builder from an existing Grant instance. - * - * @param grant the instance to initialize the Builder with - */ - private Builder(Grant grant) { - this.roles = grant.roles; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roles the roles - */ - public Builder(List roles) { - this.roles = roles; - } - - /** - * Builds a Grant. - * - * @return the new Grant instance - */ - public Grant build() { - return new Grant(this); - } - - /** - * Adds a new element to roles. - * - * @param roles the new element to be added - * @return the Grant builder - */ - public Builder addRoles(Roles roles) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roles, - "roles cannot be null"); - if (this.roles == null) { - this.roles = new ArrayList(); - } - this.roles.add(roles); - return this; - } - - /** - * Set the roles. - * Existing roles will be replaced. - * - * @param roles the roles - * @return the Grant builder - */ - public Builder roles(List roles) { - this.roles = roles; - return this; - } - } - - protected Grant() { } - - protected Grant(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, - "roles cannot be null"); - roles = builder.roles; - } - - /** - * New builder. - * - * @return a Grant builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List roles() { - return roles; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java deleted file mode 100644 index 1dbc53fefb6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Permission granted by the policy with translated roles and additional role information. - */ -public class GrantWithEnrichedRoles extends GenericModel { - - protected List roles; - - protected GrantWithEnrichedRoles() { } - - /** - * Gets the roles. - * - * A set of roles granted by the policy. - * - * @return the roles - */ - public List getRoles() { - return roles; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java deleted file mode 100644 index 0ac71d8192b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The settings for each identity type. - */ -public class IdentityTypes extends GenericModel { - - protected IdentityTypesBase user; - @SerializedName("service_id") - protected IdentityTypesBase serviceId; - protected IdentityTypesBase service; - - protected IdentityTypes() { } - - /** - * Gets the user. - * - * The core set of properties associated with an identity type. - * - * @return the user - */ - public IdentityTypesBase getUser() { - return user; - } - - /** - * Gets the serviceId. - * - * The core set of properties associated with an identity type. - * - * @return the serviceId - */ - public IdentityTypesBase getServiceId() { - return serviceId; - } - - /** - * Gets the service. - * - * The core set of properties associated with an identity type. - * - * @return the service - */ - public IdentityTypesBase getService() { - return service; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java deleted file mode 100644 index e8df91a1e5d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with an identity type. - */ -public class IdentityTypesBase extends GenericModel { - - /** - * The state of the identity type. - */ - public interface State { - /** enabled. */ - String ENABLED = "enabled"; - /** monitor. */ - String MONITOR = "monitor"; - /** limited. */ - String LIMITED = "limited"; - } - - protected String state; - @SerializedName("external_allowed_accounts") - protected List externalAllowedAccounts; - - /** - * Builder. - */ - public static class Builder { - private String state; - private List externalAllowedAccounts; - - /** - * Instantiates a new Builder from an existing IdentityTypesBase instance. - * - * @param identityTypesBase the instance to initialize the Builder with - */ - private Builder(IdentityTypesBase identityTypesBase) { - this.state = identityTypesBase.state; - this.externalAllowedAccounts = identityTypesBase.externalAllowedAccounts; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param state the state - * @param externalAllowedAccounts the externalAllowedAccounts - */ - public Builder(String state, List externalAllowedAccounts) { - this.state = state; - this.externalAllowedAccounts = externalAllowedAccounts; - } - - /** - * Builds a IdentityTypesBase. - * - * @return the new IdentityTypesBase instance - */ - public IdentityTypesBase build() { - return new IdentityTypesBase(this); - } - - /** - * Adds a new element to externalAllowedAccounts. - * - * @param externalAllowedAccounts the new element to be added - * @return the IdentityTypesBase builder - */ - public Builder addExternalAllowedAccounts(String externalAllowedAccounts) { - com.ibm.cloud.sdk.core.util.Validator.notNull(externalAllowedAccounts, - "externalAllowedAccounts cannot be null"); - if (this.externalAllowedAccounts == null) { - this.externalAllowedAccounts = new ArrayList(); - } - this.externalAllowedAccounts.add(externalAllowedAccounts); - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the IdentityTypesBase builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the externalAllowedAccounts. - * Existing externalAllowedAccounts will be replaced. - * - * @param externalAllowedAccounts the externalAllowedAccounts - * @return the IdentityTypesBase builder - */ - public Builder externalAllowedAccounts(List externalAllowedAccounts) { - this.externalAllowedAccounts = externalAllowedAccounts; - return this; - } - } - - protected IdentityTypesBase() { } - - protected IdentityTypesBase(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.state, - "state cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.externalAllowedAccounts, - "externalAllowedAccounts cannot be null"); - state = builder.state; - externalAllowedAccounts = builder.externalAllowedAccounts; - } - - /** - * New builder. - * - * @return a IdentityTypesBase builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the state. - * - * The state of the identity type. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the externalAllowedAccounts. - * - * List of accounts that the state applies to for a given identity. - * - * @return the externalAllowedAccounts - */ - public List externalAllowedAccounts() { - return externalAllowedAccounts; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java deleted file mode 100644 index 77aa5a26366..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The settings to apply for each identity type for a request. - */ -public class IdentityTypesPatch extends GenericModel { - - protected IdentityTypesBase user; - @SerializedName("service_id") - protected IdentityTypesBase serviceId; - protected IdentityTypesBase service; - - /** - * Builder. - */ - public static class Builder { - private IdentityTypesBase user; - private IdentityTypesBase serviceId; - private IdentityTypesBase service; - - /** - * Instantiates a new Builder from an existing IdentityTypesPatch instance. - * - * @param identityTypesPatch the instance to initialize the Builder with - */ - private Builder(IdentityTypesPatch identityTypesPatch) { - this.user = identityTypesPatch.user; - this.serviceId = identityTypesPatch.serviceId; - this.service = identityTypesPatch.service; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a IdentityTypesPatch. - * - * @return the new IdentityTypesPatch instance - */ - public IdentityTypesPatch build() { - return new IdentityTypesPatch(this); - } - - /** - * Set the user. - * - * @param user the user - * @return the IdentityTypesPatch builder - */ - public Builder user(IdentityTypesBase user) { - this.user = user; - return this; - } - - /** - * Set the serviceId. - * - * @param serviceId the serviceId - * @return the IdentityTypesPatch builder - */ - public Builder serviceId(IdentityTypesBase serviceId) { - this.serviceId = serviceId; - return this; - } - - /** - * Set the service. - * - * @param service the service - * @return the IdentityTypesPatch builder - */ - public Builder service(IdentityTypesBase service) { - this.service = service; - return this; - } - } - - protected IdentityTypesPatch() { } - - protected IdentityTypesPatch(Builder builder) { - user = builder.user; - serviceId = builder.serviceId; - service = builder.service; - } - - /** - * New builder. - * - * @return a IdentityTypesPatch builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the user. - * - * The core set of properties associated with an identity type. - * - * @return the user - */ - public IdentityTypesBase user() { - return user; - } - - /** - * Gets the serviceId. - * - * The core set of properties associated with an identity type. - * - * @return the serviceId - */ - public IdentityTypesBase serviceId() { - return serviceId; - } - - /** - * Gets the service. - * - * The core set of properties associated with an identity type. - * - * @return the service - */ - public IdentityTypesBase service() { - return service; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java deleted file mode 100644 index 5aa0b39573b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * policy template current and limit details with in an account. - */ -public class LimitData extends GenericModel { - - protected Long current; - protected Long limit; - - protected LimitData() { } - - /** - * Gets the current. - * - * policy template current count. - * - * @return the current - */ - public Long getCurrent() { - return current; - } - - /** - * Gets the limit. - * - * policy template limit count. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java deleted file mode 100644 index 6835f5afccc..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listActionControlAssignments options. - */ -public class ListActionControlAssignmentsOptions extends GenericModel { - - protected String accountId; - protected String acceptLanguage; - protected String templateId; - protected String templateVersion; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String templateId; - private String templateVersion; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListActionControlAssignmentsOptions instance. - * - * @param listActionControlAssignmentsOptions the instance to initialize the Builder with - */ - private Builder(ListActionControlAssignmentsOptions listActionControlAssignmentsOptions) { - this.accountId = listActionControlAssignmentsOptions.accountId; - this.acceptLanguage = listActionControlAssignmentsOptions.acceptLanguage; - this.templateId = listActionControlAssignmentsOptions.templateId; - this.templateVersion = listActionControlAssignmentsOptions.templateVersion; - this.limit = listActionControlAssignmentsOptions.limit; - this.start = listActionControlAssignmentsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListActionControlAssignmentsOptions. - * - * @return the new ListActionControlAssignmentsOptions instance - */ - public ListActionControlAssignmentsOptions build() { - return new ListActionControlAssignmentsOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the templateId. - * - * @param templateId the templateId - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder templateId(String templateId) { - this.templateId = templateId; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListActionControlAssignmentsOptions() { } - - protected ListActionControlAssignmentsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - templateId = builder.templateId; - templateVersion = builder.templateVersion; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListActionControlAssignmentsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID in which the action control assignment belongs to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the templateId. - * - * Optional template ID. - * - * @return the templateId - */ - public String templateId() { - return templateId; - } - - /** - * Gets the templateVersion. - * - * Optional action control template version. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java deleted file mode 100644 index 984d1060c83..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listActionControlTemplateVersions options. - */ -public class ListActionControlTemplateVersionsOptions extends GenericModel { - - /** - * Action control template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String actionControlTemplateId; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListActionControlTemplateVersionsOptions instance. - * - * @param listActionControlTemplateVersionsOptions the instance to initialize the Builder with - */ - private Builder(ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions) { - this.actionControlTemplateId = listActionControlTemplateVersionsOptions.actionControlTemplateId; - this.state = listActionControlTemplateVersionsOptions.state; - this.limit = listActionControlTemplateVersionsOptions.limit; - this.start = listActionControlTemplateVersionsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - */ - public Builder(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - } - - /** - * Builds a ListActionControlTemplateVersionsOptions. - * - * @return the new ListActionControlTemplateVersionsOptions instance - */ - public ListActionControlTemplateVersionsOptions build() { - return new ListActionControlTemplateVersionsOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the ListActionControlTemplateVersionsOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListActionControlTemplateVersionsOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListActionControlTemplateVersionsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListActionControlTemplateVersionsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListActionControlTemplateVersionsOptions() { } - - protected ListActionControlTemplateVersionsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListActionControlTemplateVersionsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * The action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the state. - * - * Action control template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java deleted file mode 100644 index d019db6119f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listActionControlTemplates options. - */ -public class ListActionControlTemplatesOptions extends GenericModel { - - protected String accountId; - protected String acceptLanguage; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListActionControlTemplatesOptions instance. - * - * @param listActionControlTemplatesOptions the instance to initialize the Builder with - */ - private Builder(ListActionControlTemplatesOptions listActionControlTemplatesOptions) { - this.accountId = listActionControlTemplatesOptions.accountId; - this.acceptLanguage = listActionControlTemplatesOptions.acceptLanguage; - this.limit = listActionControlTemplatesOptions.limit; - this.start = listActionControlTemplatesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListActionControlTemplatesOptions. - * - * @return the new ListActionControlTemplatesOptions instance - */ - public ListActionControlTemplatesOptions build() { - return new ListActionControlTemplatesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListActionControlTemplatesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListActionControlTemplatesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListActionControlTemplatesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListActionControlTemplatesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListActionControlTemplatesOptions() { } - - protected ListActionControlTemplatesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListActionControlTemplatesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the action control templates belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java deleted file mode 100644 index 90ecb352c37..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java +++ /dev/null @@ -1,501 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listPolicies options. - */ -public class ListPoliciesOptions extends GenericModel { - - /** - * Optional type of policy. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - /** - * Optional type of service. - */ - public interface ServiceType { - /** service. */ - String SERVICE = "service"; - /** platform_service. */ - String PLATFORM_SERVICE = "platform_service"; - } - - /** - * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending - * '-' to field. Example '-last_modified_at'. - */ - public interface Sort { - /** id. */ - String ID = "id"; - /** type. */ - String TYPE = "type"; - /** href. */ - String HREF = "href"; - /** created_at. */ - String CREATED_AT = "created_at"; - /** created_by_id. */ - String CREATED_BY_ID = "created_by_id"; - /** last_modified_at. */ - String LAST_MODIFIED_AT = "last_modified_at"; - /** last_modified_by_id. */ - String LAST_MODIFIED_BY_ID = "last_modified_by_id"; - /** state. */ - String STATE = "state"; - } - - /** - * Include additional data per policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles. - */ - public interface Format { - /** include_last_permit. */ - String INCLUDE_LAST_PERMIT = "include_last_permit"; - /** display. */ - String DISPLAY = "display"; - } - - /** - * The state of the policy. - * * `active` - returns active policies - * * `deleted` - returns non-active policies. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String accountId; - protected String acceptLanguage; - protected String iamId; - protected String accessGroupId; - protected String type; - protected String serviceType; - protected String tagName; - protected String tagValue; - protected String sort; - protected String format; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String iamId; - private String accessGroupId; - private String type; - private String serviceType; - private String tagName; - private String tagValue; - private String sort; - private String format; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListPoliciesOptions instance. - * - * @param listPoliciesOptions the instance to initialize the Builder with - */ - private Builder(ListPoliciesOptions listPoliciesOptions) { - this.accountId = listPoliciesOptions.accountId; - this.acceptLanguage = listPoliciesOptions.acceptLanguage; - this.iamId = listPoliciesOptions.iamId; - this.accessGroupId = listPoliciesOptions.accessGroupId; - this.type = listPoliciesOptions.type; - this.serviceType = listPoliciesOptions.serviceType; - this.tagName = listPoliciesOptions.tagName; - this.tagValue = listPoliciesOptions.tagValue; - this.sort = listPoliciesOptions.sort; - this.format = listPoliciesOptions.format; - this.state = listPoliciesOptions.state; - this.limit = listPoliciesOptions.limit; - this.start = listPoliciesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListPoliciesOptions. - * - * @return the new ListPoliciesOptions instance - */ - public ListPoliciesOptions build() { - return new ListPoliciesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListPoliciesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListPoliciesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the iamId. - * - * @param iamId the iamId - * @return the ListPoliciesOptions builder - */ - public Builder iamId(String iamId) { - this.iamId = iamId; - return this; - } - - /** - * Set the accessGroupId. - * - * @param accessGroupId the accessGroupId - * @return the ListPoliciesOptions builder - */ - public Builder accessGroupId(String accessGroupId) { - this.accessGroupId = accessGroupId; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the ListPoliciesOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the serviceType. - * - * @param serviceType the serviceType - * @return the ListPoliciesOptions builder - */ - public Builder serviceType(String serviceType) { - this.serviceType = serviceType; - return this; - } - - /** - * Set the tagName. - * - * @param tagName the tagName - * @return the ListPoliciesOptions builder - */ - public Builder tagName(String tagName) { - this.tagName = tagName; - return this; - } - - /** - * Set the tagValue. - * - * @param tagValue the tagValue - * @return the ListPoliciesOptions builder - */ - public Builder tagValue(String tagValue) { - this.tagValue = tagValue; - return this; - } - - /** - * Set the sort. - * - * @param sort the sort - * @return the ListPoliciesOptions builder - */ - public Builder sort(String sort) { - this.sort = sort; - return this; - } - - /** - * Set the format. - * - * @param format the format - * @return the ListPoliciesOptions builder - */ - public Builder format(String format) { - this.format = format; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListPoliciesOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListPoliciesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListPoliciesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListPoliciesOptions() { } - - protected ListPoliciesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - iamId = builder.iamId; - accessGroupId = builder.accessGroupId; - type = builder.type; - serviceType = builder.serviceType; - tagName = builder.tagName; - tagValue = builder.tagValue; - sort = builder.sort; - format = builder.format; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListPoliciesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the policies belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the iamId. - * - * Optional IAM ID used to identify the subject. - * - * @return the iamId - */ - public String iamId() { - return iamId; - } - - /** - * Gets the accessGroupId. - * - * Optional access group id. - * - * @return the accessGroupId - */ - public String accessGroupId() { - return accessGroupId; - } - - /** - * Gets the type. - * - * Optional type of policy. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the serviceType. - * - * Optional type of service. - * - * @return the serviceType - */ - public String serviceType() { - return serviceType; - } - - /** - * Gets the tagName. - * - * Optional name of the access tag in the policy. - * - * @return the tagName - */ - public String tagName() { - return tagName; - } - - /** - * Gets the tagValue. - * - * Optional value of the access tag in the policy. - * - * @return the tagValue - */ - public String tagValue() { - return tagValue; - } - - /** - * Gets the sort. - * - * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending - * '-' to field. Example '-last_modified_at'. - * - * @return the sort - */ - public String sort() { - return sort; - } - - /** - * Gets the format. - * - * Include additional data per policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles. - * - * @return the format - */ - public String format() { - return format; - } - - /** - * Gets the state. - * - * The state of the policy. - * * `active` - returns active policies - * * `deleted` - returns non-active policies. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java deleted file mode 100644 index 9362749c670..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java +++ /dev/null @@ -1,275 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listPolicyAssignments options. - */ -public class ListPolicyAssignmentsOptions extends GenericModel { - - protected String version; - protected String accountId; - protected String acceptLanguage; - protected String templateId; - protected String templateVersion; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String version; - private String accountId; - private String acceptLanguage; - private String templateId; - private String templateVersion; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListPolicyAssignmentsOptions instance. - * - * @param listPolicyAssignmentsOptions the instance to initialize the Builder with - */ - private Builder(ListPolicyAssignmentsOptions listPolicyAssignmentsOptions) { - this.version = listPolicyAssignmentsOptions.version; - this.accountId = listPolicyAssignmentsOptions.accountId; - this.acceptLanguage = listPolicyAssignmentsOptions.acceptLanguage; - this.templateId = listPolicyAssignmentsOptions.templateId; - this.templateVersion = listPolicyAssignmentsOptions.templateVersion; - this.limit = listPolicyAssignmentsOptions.limit; - this.start = listPolicyAssignmentsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param version the version - * @param accountId the accountId - */ - public Builder(String version, String accountId) { - this.version = version; - this.accountId = accountId; - } - - /** - * Builds a ListPolicyAssignmentsOptions. - * - * @return the new ListPolicyAssignmentsOptions instance - */ - public ListPolicyAssignmentsOptions build() { - return new ListPolicyAssignmentsOptions(this); - } - - /** - * Set the version. - * - * @param version the version - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the templateId. - * - * @param templateId the templateId - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder templateId(String templateId) { - this.templateId = templateId; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListPolicyAssignmentsOptions() { } - - protected ListPolicyAssignmentsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - version = builder.version; - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - templateId = builder.templateId; - templateVersion = builder.templateVersion; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListPolicyAssignmentsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the version. - * - * specify version of response body format. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the accountId. - * - * The account GUID in which the policies belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the templateId. - * - * Optional template id. - * - * @return the templateId - */ - public String templateId() { - return templateId; - } - - /** - * Gets the templateVersion. - * - * Optional policy template version. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java deleted file mode 100644 index c7965ba6c31..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listPolicyTemplateVersions options. - */ -public class ListPolicyTemplateVersionsOptions extends GenericModel { - - /** - * The policy template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String policyTemplateId; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListPolicyTemplateVersionsOptions instance. - * - * @param listPolicyTemplateVersionsOptions the instance to initialize the Builder with - */ - private Builder(ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions) { - this.policyTemplateId = listPolicyTemplateVersionsOptions.policyTemplateId; - this.state = listPolicyTemplateVersionsOptions.state; - this.limit = listPolicyTemplateVersionsOptions.limit; - this.start = listPolicyTemplateVersionsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - */ - public Builder(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - } - - /** - * Builds a ListPolicyTemplateVersionsOptions. - * - * @return the new ListPolicyTemplateVersionsOptions instance - */ - public ListPolicyTemplateVersionsOptions build() { - return new ListPolicyTemplateVersionsOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the ListPolicyTemplateVersionsOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListPolicyTemplateVersionsOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListPolicyTemplateVersionsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListPolicyTemplateVersionsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListPolicyTemplateVersionsOptions() { } - - protected ListPolicyTemplateVersionsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - policyTemplateId = builder.policyTemplateId; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListPolicyTemplateVersionsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the state. - * - * The policy template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java deleted file mode 100644 index f230c9bd549..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java +++ /dev/null @@ -1,379 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listPolicyTemplates options. - */ -public class ListPolicyTemplatesOptions extends GenericModel { - - /** - * The policy template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - /** - * Service type, Optional. - */ - public interface PolicyServiceType { - /** service. */ - String SERVICE = "service"; - /** platform_service. */ - String PLATFORM_SERVICE = "platform_service"; - } - - /** - * Policy type, Optional. - */ - public interface PolicyType { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - protected String accountId; - protected String acceptLanguage; - protected String state; - protected String name; - protected String policyServiceType; - protected String policyServiceName; - protected String policyServiceGroupId; - protected String policyType; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String state; - private String name; - private String policyServiceType; - private String policyServiceName; - private String policyServiceGroupId; - private String policyType; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListPolicyTemplatesOptions instance. - * - * @param listPolicyTemplatesOptions the instance to initialize the Builder with - */ - private Builder(ListPolicyTemplatesOptions listPolicyTemplatesOptions) { - this.accountId = listPolicyTemplatesOptions.accountId; - this.acceptLanguage = listPolicyTemplatesOptions.acceptLanguage; - this.state = listPolicyTemplatesOptions.state; - this.name = listPolicyTemplatesOptions.name; - this.policyServiceType = listPolicyTemplatesOptions.policyServiceType; - this.policyServiceName = listPolicyTemplatesOptions.policyServiceName; - this.policyServiceGroupId = listPolicyTemplatesOptions.policyServiceGroupId; - this.policyType = listPolicyTemplatesOptions.policyType; - this.limit = listPolicyTemplatesOptions.limit; - this.start = listPolicyTemplatesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListPolicyTemplatesOptions. - * - * @return the new ListPolicyTemplatesOptions instance - */ - public ListPolicyTemplatesOptions build() { - return new ListPolicyTemplatesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListPolicyTemplatesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListPolicyTemplatesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListPolicyTemplatesOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ListPolicyTemplatesOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the policyServiceType. - * - * @param policyServiceType the policyServiceType - * @return the ListPolicyTemplatesOptions builder - */ - public Builder policyServiceType(String policyServiceType) { - this.policyServiceType = policyServiceType; - return this; - } - - /** - * Set the policyServiceName. - * - * @param policyServiceName the policyServiceName - * @return the ListPolicyTemplatesOptions builder - */ - public Builder policyServiceName(String policyServiceName) { - this.policyServiceName = policyServiceName; - return this; - } - - /** - * Set the policyServiceGroupId. - * - * @param policyServiceGroupId the policyServiceGroupId - * @return the ListPolicyTemplatesOptions builder - */ - public Builder policyServiceGroupId(String policyServiceGroupId) { - this.policyServiceGroupId = policyServiceGroupId; - return this; - } - - /** - * Set the policyType. - * - * @param policyType the policyType - * @return the ListPolicyTemplatesOptions builder - */ - public Builder policyType(String policyType) { - this.policyType = policyType; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListPolicyTemplatesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListPolicyTemplatesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListPolicyTemplatesOptions() { } - - protected ListPolicyTemplatesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - state = builder.state; - name = builder.name; - policyServiceType = builder.policyServiceType; - policyServiceName = builder.policyServiceName; - policyServiceGroupId = builder.policyServiceGroupId; - policyType = builder.policyType; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListPolicyTemplatesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the policy templates belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the state. - * - * The policy template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the name. - * - * The policy template name. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the policyServiceType. - * - * Service type, Optional. - * - * @return the policyServiceType - */ - public String policyServiceType() { - return policyServiceType; - } - - /** - * Gets the policyServiceName. - * - * Service name, Optional. - * - * @return the policyServiceName - */ - public String policyServiceName() { - return policyServiceName; - } - - /** - * Gets the policyServiceGroupId. - * - * Service group id, Optional. - * - * @return the policyServiceGroupId - */ - public String policyServiceGroupId() { - return policyServiceGroupId; - } - - /** - * Gets the policyType. - * - * Policy type, Optional. - * - * @return the policyType - */ - public String policyType() { - return policyType; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java deleted file mode 100644 index adcb3f0cc90..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listRoleAssignments options. - */ -public class ListRoleAssignmentsOptions extends GenericModel { - - protected String accountId; - protected String acceptLanguage; - protected String templateId; - protected String templateVersion; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String templateId; - private String templateVersion; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListRoleAssignmentsOptions instance. - * - * @param listRoleAssignmentsOptions the instance to initialize the Builder with - */ - private Builder(ListRoleAssignmentsOptions listRoleAssignmentsOptions) { - this.accountId = listRoleAssignmentsOptions.accountId; - this.acceptLanguage = listRoleAssignmentsOptions.acceptLanguage; - this.templateId = listRoleAssignmentsOptions.templateId; - this.templateVersion = listRoleAssignmentsOptions.templateVersion; - this.limit = listRoleAssignmentsOptions.limit; - this.start = listRoleAssignmentsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListRoleAssignmentsOptions. - * - * @return the new ListRoleAssignmentsOptions instance - */ - public ListRoleAssignmentsOptions build() { - return new ListRoleAssignmentsOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListRoleAssignmentsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListRoleAssignmentsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the templateId. - * - * @param templateId the templateId - * @return the ListRoleAssignmentsOptions builder - */ - public Builder templateId(String templateId) { - this.templateId = templateId; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the ListRoleAssignmentsOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListRoleAssignmentsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListRoleAssignmentsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListRoleAssignmentsOptions() { } - - protected ListRoleAssignmentsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - templateId = builder.templateId; - templateVersion = builder.templateVersion; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListRoleAssignmentsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID in which the role assignment belongs to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the templateId. - * - * Optional template ID. - * - * @return the templateId - */ - public String templateId() { - return templateId; - } - - /** - * Gets the templateVersion. - * - * Optional role template version. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java deleted file mode 100644 index e22751433e5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listRoleTemplateVersions options. - */ -public class ListRoleTemplateVersionsOptions extends GenericModel { - - /** - * Role template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String roleTemplateId; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListRoleTemplateVersionsOptions instance. - * - * @param listRoleTemplateVersionsOptions the instance to initialize the Builder with - */ - private Builder(ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions) { - this.roleTemplateId = listRoleTemplateVersionsOptions.roleTemplateId; - this.state = listRoleTemplateVersionsOptions.state; - this.limit = listRoleTemplateVersionsOptions.limit; - this.start = listRoleTemplateVersionsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - */ - public Builder(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - } - - /** - * Builds a ListRoleTemplateVersionsOptions. - * - * @return the new ListRoleTemplateVersionsOptions instance - */ - public ListRoleTemplateVersionsOptions build() { - return new ListRoleTemplateVersionsOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the ListRoleTemplateVersionsOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListRoleTemplateVersionsOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListRoleTemplateVersionsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListRoleTemplateVersionsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListRoleTemplateVersionsOptions() { } - - protected ListRoleTemplateVersionsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - roleTemplateId = builder.roleTemplateId; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListRoleTemplateVersionsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * The role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the state. - * - * Role template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java deleted file mode 100644 index 8f889bdce96..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java +++ /dev/null @@ -1,307 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listRoleTemplates options. - */ -public class ListRoleTemplatesOptions extends GenericModel { - - /** - * The role template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String accountId; - protected String acceptLanguage; - protected String name; - protected String roleName; - protected String roleServiceName; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String name; - private String roleName; - private String roleServiceName; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListRoleTemplatesOptions instance. - * - * @param listRoleTemplatesOptions the instance to initialize the Builder with - */ - private Builder(ListRoleTemplatesOptions listRoleTemplatesOptions) { - this.accountId = listRoleTemplatesOptions.accountId; - this.acceptLanguage = listRoleTemplatesOptions.acceptLanguage; - this.name = listRoleTemplatesOptions.name; - this.roleName = listRoleTemplatesOptions.roleName; - this.roleServiceName = listRoleTemplatesOptions.roleServiceName; - this.state = listRoleTemplatesOptions.state; - this.limit = listRoleTemplatesOptions.limit; - this.start = listRoleTemplatesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListRoleTemplatesOptions. - * - * @return the new ListRoleTemplatesOptions instance - */ - public ListRoleTemplatesOptions build() { - return new ListRoleTemplatesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListRoleTemplatesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListRoleTemplatesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ListRoleTemplatesOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the roleName. - * - * @param roleName the roleName - * @return the ListRoleTemplatesOptions builder - */ - public Builder roleName(String roleName) { - this.roleName = roleName; - return this; - } - - /** - * Set the roleServiceName. - * - * @param roleServiceName the roleServiceName - * @return the ListRoleTemplatesOptions builder - */ - public Builder roleServiceName(String roleServiceName) { - this.roleServiceName = roleServiceName; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListRoleTemplatesOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListRoleTemplatesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListRoleTemplatesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListRoleTemplatesOptions() { } - - protected ListRoleTemplatesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - name = builder.name; - roleName = builder.roleName; - roleServiceName = builder.roleServiceName; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListRoleTemplatesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the role templates belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the name. - * - * The role template name. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the roleName. - * - * The template role name. - * - * @return the roleName - */ - public String roleName() { - return roleName; - } - - /** - * Gets the roleServiceName. - * - * The template role service name. - * - * @return the roleServiceName - */ - public String roleServiceName() { - return roleServiceName; - } - - /** - * Gets the state. - * - * The role template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java deleted file mode 100644 index 2ca364c53a3..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listRoles options. - */ -public class ListRolesOptions extends GenericModel { - - protected String acceptLanguage; - protected String accountId; - protected String serviceName; - protected String sourceServiceName; - protected String policyType; - protected String serviceGroupId; - - /** - * Builder. - */ - public static class Builder { - private String acceptLanguage; - private String accountId; - private String serviceName; - private String sourceServiceName; - private String policyType; - private String serviceGroupId; - - /** - * Instantiates a new Builder from an existing ListRolesOptions instance. - * - * @param listRolesOptions the instance to initialize the Builder with - */ - private Builder(ListRolesOptions listRolesOptions) { - this.acceptLanguage = listRolesOptions.acceptLanguage; - this.accountId = listRolesOptions.accountId; - this.serviceName = listRolesOptions.serviceName; - this.sourceServiceName = listRolesOptions.sourceServiceName; - this.policyType = listRolesOptions.policyType; - this.serviceGroupId = listRolesOptions.serviceGroupId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a ListRolesOptions. - * - * @return the new ListRolesOptions instance - */ - public ListRolesOptions build() { - return new ListRolesOptions(this); - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListRolesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListRolesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the ListRolesOptions builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the sourceServiceName. - * - * @param sourceServiceName the sourceServiceName - * @return the ListRolesOptions builder - */ - public Builder sourceServiceName(String sourceServiceName) { - this.sourceServiceName = sourceServiceName; - return this; - } - - /** - * Set the policyType. - * - * @param policyType the policyType - * @return the ListRolesOptions builder - */ - public Builder policyType(String policyType) { - this.policyType = policyType; - return this; - } - - /** - * Set the serviceGroupId. - * - * @param serviceGroupId the serviceGroupId - * @return the ListRolesOptions builder - */ - public Builder serviceGroupId(String serviceGroupId) { - this.serviceGroupId = serviceGroupId; - return this; - } - } - - protected ListRolesOptions() { } - - protected ListRolesOptions(Builder builder) { - acceptLanguage = builder.acceptLanguage; - accountId = builder.accountId; - serviceName = builder.serviceName; - sourceServiceName = builder.sourceServiceName; - policyType = builder.policyType; - serviceGroupId = builder.serviceGroupId; - } - - /** - * New builder. - * - * @return a ListRolesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the accountId. - * - * Optional account GUID in which the roles belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the serviceName. - * - * Optional name of IAM enabled service. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the sourceServiceName. - * - * Optional name of source IAM enabled service. - * - * @return the sourceServiceName - */ - public String sourceServiceName() { - return sourceServiceName; - } - - /** - * Gets the policyType. - * - * Optional Policy Type. - * - * @return the policyType - */ - public String policyType() { - return policyType; - } - - /** - * Gets the serviceGroupId. - * - * Optional id of service group. - * - * @return the serviceGroupId - */ - public String serviceGroupId() { - return serviceGroupId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java deleted file mode 100644 index 65849c3d9a6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java +++ /dev/null @@ -1,492 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listV2Policies options. - */ -public class ListV2PoliciesOptions extends GenericModel { - - /** - * Optional type of policy. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - /** - * Optional type of service. - */ - public interface ServiceType { - /** service. */ - String SERVICE = "service"; - /** platform_service. */ - String PLATFORM_SERVICE = "platform_service"; - } - - /** - * Include additional data per policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles and translations for all - * relevant fields. - */ - public interface Format { - /** include_last_permit. */ - String INCLUDE_LAST_PERMIT = "include_last_permit"; - /** display. */ - String DISPLAY = "display"; - } - - /** - * The state of the policy. - * * `active` - returns active policies - * * `deleted` - returns non-active policies. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String accountId; - protected String acceptLanguage; - protected String iamId; - protected String accessGroupId; - protected String type; - protected String serviceType; - protected String serviceName; - protected String serviceGroupId; - protected String sort; - protected String format; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String iamId; - private String accessGroupId; - private String type; - private String serviceType; - private String serviceName; - private String serviceGroupId; - private String sort; - private String format; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListV2PoliciesOptions instance. - * - * @param listV2PoliciesOptions the instance to initialize the Builder with - */ - private Builder(ListV2PoliciesOptions listV2PoliciesOptions) { - this.accountId = listV2PoliciesOptions.accountId; - this.acceptLanguage = listV2PoliciesOptions.acceptLanguage; - this.iamId = listV2PoliciesOptions.iamId; - this.accessGroupId = listV2PoliciesOptions.accessGroupId; - this.type = listV2PoliciesOptions.type; - this.serviceType = listV2PoliciesOptions.serviceType; - this.serviceName = listV2PoliciesOptions.serviceName; - this.serviceGroupId = listV2PoliciesOptions.serviceGroupId; - this.sort = listV2PoliciesOptions.sort; - this.format = listV2PoliciesOptions.format; - this.state = listV2PoliciesOptions.state; - this.limit = listV2PoliciesOptions.limit; - this.start = listV2PoliciesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListV2PoliciesOptions. - * - * @return the new ListV2PoliciesOptions instance - */ - public ListV2PoliciesOptions build() { - return new ListV2PoliciesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListV2PoliciesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListV2PoliciesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the iamId. - * - * @param iamId the iamId - * @return the ListV2PoliciesOptions builder - */ - public Builder iamId(String iamId) { - this.iamId = iamId; - return this; - } - - /** - * Set the accessGroupId. - * - * @param accessGroupId the accessGroupId - * @return the ListV2PoliciesOptions builder - */ - public Builder accessGroupId(String accessGroupId) { - this.accessGroupId = accessGroupId; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the ListV2PoliciesOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the serviceType. - * - * @param serviceType the serviceType - * @return the ListV2PoliciesOptions builder - */ - public Builder serviceType(String serviceType) { - this.serviceType = serviceType; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the ListV2PoliciesOptions builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the serviceGroupId. - * - * @param serviceGroupId the serviceGroupId - * @return the ListV2PoliciesOptions builder - */ - public Builder serviceGroupId(String serviceGroupId) { - this.serviceGroupId = serviceGroupId; - return this; - } - - /** - * Set the sort. - * - * @param sort the sort - * @return the ListV2PoliciesOptions builder - */ - public Builder sort(String sort) { - this.sort = sort; - return this; - } - - /** - * Set the format. - * - * @param format the format - * @return the ListV2PoliciesOptions builder - */ - public Builder format(String format) { - this.format = format; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListV2PoliciesOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListV2PoliciesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListV2PoliciesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListV2PoliciesOptions() { } - - protected ListV2PoliciesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - iamId = builder.iamId; - accessGroupId = builder.accessGroupId; - type = builder.type; - serviceType = builder.serviceType; - serviceName = builder.serviceName; - serviceGroupId = builder.serviceGroupId; - sort = builder.sort; - format = builder.format; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListV2PoliciesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID in which the policies belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the iamId. - * - * Optional IAM ID used to identify the subject. - * - * @return the iamId - */ - public String iamId() { - return iamId; - } - - /** - * Gets the accessGroupId. - * - * Optional access group id. - * - * @return the accessGroupId - */ - public String accessGroupId() { - return accessGroupId; - } - - /** - * Gets the type. - * - * Optional type of policy. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the serviceType. - * - * Optional type of service. - * - * @return the serviceType - */ - public String serviceType() { - return serviceType; - } - - /** - * Gets the serviceName. - * - * Optional name of service. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the serviceGroupId. - * - * Optional ID of service group. - * - * @return the serviceGroupId - */ - public String serviceGroupId() { - return serviceGroupId; - } - - /** - * Gets the sort. - * - * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending - * '-' to field, for example, '-last_modified_at'. Note that last permit information is only included when - * 'format=include_last_permit', for example, "format=include_last_permit&sort=last_permit_at" Example fields that - * can be sorted on: - * - 'id' - * - 'type' - * - 'href' - * - 'created_at' - * - 'created_by_id' - * - 'last_modified_at' - * - 'last_modified_by_id' - * - 'state' - * - 'last_permit_at' - * - 'last_permit_frequency'. - * - * @return the sort - */ - public String sort() { - return sort; - } - - /** - * Gets the format. - * - * Include additional data per policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles and translations for all - * relevant fields. - * - * @return the format - */ - public String format() { - return format; - } - - /** - * Gets the state. - * - * The state of the policy. - * * `active` - returns active policies - * * `deleted` - returns non-active policies. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java deleted file mode 100644 index 4d43d84dbba..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Condition that specifies additional conditions or RuleAttribute to grant access. - * - * Classes which extend this class: - * - NestedConditionRuleAttribute - * - NestedConditionRuleWithConditions - */ -public class NestedCondition extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - protected String key; - protected String operator; - protected Object value; - protected List conditions; - - protected NestedCondition() { } - - /** - * Gets the key. - * - * The name of an attribute. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } - - /** - * Gets the conditions. - * - * List of conditions associated with a policy. For example, time-based conditions that grant access over a certain - * time period. - * - * @return the conditions - */ - public List conditions() { - return conditions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java deleted file mode 100644 index b1d44da3f6b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * Rule that specifies additional access that is granted (For example, time-based condition). - */ -public class NestedConditionRuleAttribute extends NestedCondition { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing NestedConditionRuleAttribute instance. - * - * @param nestedConditionRuleAttribute the instance to initialize the Builder with - */ - public Builder(NestedCondition nestedConditionRuleAttribute) { - this.key = nestedConditionRuleAttribute.key; - this.operator = nestedConditionRuleAttribute.operator; - this.value = nestedConditionRuleAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a NestedConditionRuleAttribute. - * - * @return the new NestedConditionRuleAttribute instance - */ - public NestedConditionRuleAttribute build() { - return new NestedConditionRuleAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the NestedConditionRuleAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the NestedConditionRuleAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the NestedConditionRuleAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected NestedConditionRuleAttribute() { } - - protected NestedConditionRuleAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a NestedConditionRuleAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java deleted file mode 100644 index 20d0faac795..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * Rule that specifies additional access that is granted (for example, time-based condition) accross multiple - * conditions. - */ -public class NestedConditionRuleWithConditions extends NestedCondition { - - /** - * Operator to evaluate conditions. - */ - public interface Operator { - /** and. */ - String AND = "and"; - /** or. */ - String OR = "or"; - } - - - /** - * Builder. - */ - public static class Builder { - private String operator; - private List conditions; - - /** - * Instantiates a new Builder from an existing NestedConditionRuleWithConditions instance. - * - * @param nestedConditionRuleWithConditions the instance to initialize the Builder with - */ - public Builder(NestedCondition nestedConditionRuleWithConditions) { - this.operator = nestedConditionRuleWithConditions.operator; - this.conditions = nestedConditionRuleWithConditions.conditions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param operator the operator - * @param conditions the conditions - */ - public Builder(String operator, List conditions) { - this.operator = operator; - this.conditions = conditions; - } - - /** - * Builds a NestedConditionRuleWithConditions. - * - * @return the new NestedConditionRuleWithConditions instance - */ - public NestedConditionRuleWithConditions build() { - return new NestedConditionRuleWithConditions(this); - } - - /** - * Adds a new element to conditions. - * - * @param conditions the new element to be added - * @return the NestedConditionRuleWithConditions builder - */ - public Builder addConditions(RuleAttribute conditions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(conditions, - "conditions cannot be null"); - if (this.conditions == null) { - this.conditions = new ArrayList(); - } - this.conditions.add(conditions); - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the NestedConditionRuleWithConditions builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the conditions. - * Existing conditions will be replaced. - * - * @param conditions the conditions - * @return the NestedConditionRuleWithConditions builder - */ - public Builder conditions(List conditions) { - this.conditions = conditions; - return this; - } - } - - protected NestedConditionRuleWithConditions() { } - - protected NestedConditionRuleWithConditions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.conditions, - "conditions cannot be null"); - operator = builder.operator; - conditions = builder.conditions; - } - - /** - * New builder. - * - * @return a NestedConditionRuleWithConditions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java deleted file mode 100644 index b0442f902bc..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Details with href linking to the following page of requested collection. - */ -public class Next extends GenericModel { - - protected String href; - protected String start; - - protected Next() { } - - /** - * Gets the href. - * - * The href linking to the page of requested collection. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection. - * - * @return the start - */ - public String getStart() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java deleted file mode 100644 index 8f12053c72e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * PoliciesPager can be used to simplify the use of the "listPolicies" method. - */ -public class PoliciesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListPoliciesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected PoliciesPager() { } - - /** - * Constructs a new PoliciesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listPolicies" method - * @param options the ListPoliciesOptions instance to be used to invoke the "listPolicies" method - */ - public PoliciesPager(IamPolicyManagement client, ListPoliciesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<PolicyTemplateMetaData> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListPoliciesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - PolicyCollection result = client.listPolicies(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getPolicies(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<PolicyTemplateMetaData> containing all results returned by the "listPolicies" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java deleted file mode 100644 index af852b7cd74..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with a policy. - */ -public class Policy extends GenericModel { - - /** - * The policy state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String id; - protected String type; - protected String description; - protected List subjects; - protected List roles; - protected List resources; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String state; - - protected Policy() { } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Gets the description. - * - * Customer-defined description. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the subjects. - * - * The subjects associated with a policy. - * - * @return the subjects - */ - public List getSubjects() { - return subjects; - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List getRoles() { - return roles; - } - - /** - * Gets the resources. - * - * The resources associated with a policy. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the href. - * - * The href links back to the policy. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the state. - * - * The policy state. - * - * @return the state - */ - public String getState() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java deleted file mode 100644 index 3e566ce7bdf..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Set of properties for the assigned resource. - */ -public class PolicyAssignmentResourcePolicy extends GenericModel { - - @SerializedName("resource_created") - protected AssignmentResourceCreated resourceCreated; - protected String status; - @SerializedName("error_message") - protected AssignmentResourceError errorMessage; - - protected PolicyAssignmentResourcePolicy() { } - - /** - * Gets the resourceCreated. - * - * On success, includes the policy that is assigned. - * - * @return the resourceCreated - */ - public AssignmentResourceCreated getResourceCreated() { - return resourceCreated; - } - - /** - * Gets the status. - * - * policy status. - * - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * Gets the errorMessage. - * - * Body parameters for assignment error. - * - * @return the errorMessage - */ - public AssignmentResourceError getErrorMessage() { - return errorMessage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java deleted file mode 100644 index ad944536b0d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The policy assignment resources. - */ -public class PolicyAssignmentResources extends GenericModel { - - protected String target; - protected PolicyAssignmentResourcePolicy policy; - - protected PolicyAssignmentResources() { } - - /** - * Gets the target. - * - * Account ID where resources are assigned. - * - * @return the target - */ - public String getTarget() { - return target; - } - - /** - * Gets the policy. - * - * Set of properties for the assigned resource. - * - * @return the policy - */ - public PolicyAssignmentResourcePolicy getPolicy() { - return policy; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java deleted file mode 100644 index f1ea295713c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the policy template assignment. - */ -public class PolicyAssignmentV1 extends GenericModel { - - /** - * The policy assignment status. - */ - public interface Status { - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** succeeded. */ - String SUCCEEDED = "succeeded"; - /** succeed_with_errors. */ - String SUCCEED_WITH_ERRORS = "succeed_with_errors"; - /** failed. */ - String FAILED = "failed"; - } - - protected AssignmentTargetDetails target; - protected String id; - @SerializedName("account_id") - protected String accountId; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected List resources; - protected PolicyAssignmentV1Subject subject; - protected AssignmentTemplateDetails template; - protected String status; - - protected PolicyAssignmentV1() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the id. - * - * Policy assignment ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the accountId. - * - * The account GUID that the policies assignments belong to. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the href. - * - * The href URL that links to the policies assignments API by policy assignment ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy assignment was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy assignment. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy assignment was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy assignment. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the resources. - * - * Object for each account assigned. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the subject. - * - * Subject details of access type assignment. - * - * @return the subject - */ - public PolicyAssignmentV1Subject getSubject() { - return subject; - } - - /** - * Gets the template. - * - * policy template details. - * - * @return the template - */ - public AssignmentTemplateDetails getTemplate() { - return template; - } - - /** - * Gets the status. - * - * The policy assignment status. - * - * @return the status - */ - public String getStatus() { - return status; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java deleted file mode 100644 index 7331ee5a854..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Policy assignment response. - */ -public class PolicyAssignmentV1Collection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List assignments; - - protected PolicyAssignmentV1Collection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the assignments. - * - * Response of policy assignments. - * - * @return the assignments - */ - public List getAssignments() { - return assignments; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java deleted file mode 100644 index c05eb90816b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The policy assignment resources. - */ -public class PolicyAssignmentV1Resources extends GenericModel { - - protected AssignmentTargetDetails target; - protected PolicyAssignmentResourcePolicy policy; - - protected PolicyAssignmentV1Resources() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the policy. - * - * Set of properties for the assigned resource. - * - * @return the policy - */ - public PolicyAssignmentResourcePolicy getPolicy() { - return policy; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java deleted file mode 100644 index 58b2cd240ba..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Subject details of access type assignment. - */ -public class PolicyAssignmentV1Subject extends GenericModel { - - /** - * The identity type of the subject of the assignment. - */ - public interface Type { - /** iam_id. */ - String IAM_ID = "iam_id"; - /** access_group_id. */ - String ACCESS_GROUP_ID = "access_group_id"; - } - - protected String id; - protected String type; - - protected PolicyAssignmentV1Subject() { } - - /** - * Gets the id. - * - * The unique identifier of the subject of the assignment. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the type. - * - * The identity type of the subject of the assignment. - * - * @return the type - */ - public String getType() { - return type; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java deleted file mode 100644 index 931769daed5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * PolicyAssignmentsPager can be used to simplify the use of the "listPolicyAssignments" method. - */ -public class PolicyAssignmentsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListPolicyAssignmentsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected PolicyAssignmentsPager() { } - - /** - * Constructs a new PolicyAssignmentsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyAssignments" method - * @param options the ListPolicyAssignmentsOptions instance to be used to invoke the "listPolicyAssignments" method - */ - public PolicyAssignmentsPager(IamPolicyManagement client, ListPolicyAssignmentsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<PolicyTemplateAssignmentItems> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListPolicyAssignmentsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - PolicyTemplateAssignmentCollection result = client.listPolicyAssignments(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getAssignments(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<PolicyTemplateAssignmentItems> containing all results returned by the "listPolicyAssignments" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java deleted file mode 100644 index 25062dd0a52..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of policies. - */ -public class PolicyCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List policies; - - protected PolicyCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the policies. - * - * List of policies. - * - * @return the policies - */ - public List getPolicies() { - return policies; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java deleted file mode 100644 index 4033f2dbc9d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The attributes of the resource. Note that only one resource is allowed in a policy. - */ -public class PolicyResource extends GenericModel { - - protected List attributes; - protected List tags; - - /** - * Builder. - */ - public static class Builder { - private List attributes; - private List tags; - - /** - * Instantiates a new Builder from an existing PolicyResource instance. - * - * @param policyResource the instance to initialize the Builder with - */ - private Builder(PolicyResource policyResource) { - this.attributes = policyResource.attributes; - this.tags = policyResource.tags; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param attributes the attributes - */ - public Builder(List attributes) { - this.attributes = attributes; - } - - /** - * Builds a PolicyResource. - * - * @return the new PolicyResource instance - */ - public PolicyResource build() { - return new PolicyResource(this); - } - - /** - * Adds a new element to attributes. - * - * @param attributes the new element to be added - * @return the PolicyResource builder - */ - public Builder addAttributes(ResourceAttribute attributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, - "attributes cannot be null"); - if (this.attributes == null) { - this.attributes = new ArrayList(); - } - this.attributes.add(attributes); - return this; - } - - /** - * Adds a new element to tags. - * - * @param tags the new element to be added - * @return the PolicyResource builder - */ - public Builder addTags(ResourceTag tags) { - com.ibm.cloud.sdk.core.util.Validator.notNull(tags, - "tags cannot be null"); - if (this.tags == null) { - this.tags = new ArrayList(); - } - this.tags.add(tags); - return this; - } - - /** - * Set the attributes. - * Existing attributes will be replaced. - * - * @param attributes the attributes - * @return the PolicyResource builder - */ - public Builder attributes(List attributes) { - this.attributes = attributes; - return this; - } - - /** - * Set the tags. - * Existing tags will be replaced. - * - * @param tags the tags - * @return the PolicyResource builder - */ - public Builder tags(List tags) { - this.tags = tags; - return this; - } - } - - protected PolicyResource() { } - - protected PolicyResource(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, - "attributes cannot be null"); - attributes = builder.attributes; - tags = builder.tags; - } - - /** - * New builder. - * - * @return a PolicyResource builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the attributes. - * - * List of resource attributes. - * - * @return the attributes - */ - public List attributes() { - return attributes; - } - - /** - * Gets the tags. - * - * List of access management tags. - * - * @return the tags - */ - public List tags() { - return tags; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java deleted file mode 100644 index 7319eabce7b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role associated with a policy. - */ -public class PolicyRole extends GenericModel { - - @SerializedName("role_id") - protected String roleId; - @SerializedName("display_name") - protected String displayName; - protected String description; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - - /** - * Instantiates a new Builder from an existing PolicyRole instance. - * - * @param policyRole the instance to initialize the Builder with - */ - private Builder(PolicyRole policyRole) { - this.roleId = policyRole.roleId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - */ - public Builder(String roleId) { - this.roleId = roleId; - } - - /** - * Builds a PolicyRole. - * - * @return the new PolicyRole instance - */ - public PolicyRole build() { - return new PolicyRole(this); - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the PolicyRole builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - } - - protected PolicyRole() { } - - protected PolicyRole(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleId, - "roleId cannot be null"); - roleId = builder.roleId; - } - - /** - * New builder. - * - * @return a PolicyRole builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } - - /** - * Gets the displayName. - * - * The display name of the role. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String description() { - return description; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java deleted file mode 100644 index bf1b035a6b7..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The subject attribute values that must match in order for this policy to apply in a permission decision. - */ -public class PolicySubject extends GenericModel { - - protected List attributes; - - /** - * Builder. - */ - public static class Builder { - private List attributes; - - /** - * Instantiates a new Builder from an existing PolicySubject instance. - * - * @param policySubject the instance to initialize the Builder with - */ - private Builder(PolicySubject policySubject) { - this.attributes = policySubject.attributes; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param attributes the attributes - */ - public Builder(List attributes) { - this.attributes = attributes; - } - - /** - * Builds a PolicySubject. - * - * @return the new PolicySubject instance - */ - public PolicySubject build() { - return new PolicySubject(this); - } - - /** - * Adds a new element to attributes. - * - * @param attributes the new element to be added - * @return the PolicySubject builder - */ - public Builder addAttributes(SubjectAttribute attributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, - "attributes cannot be null"); - if (this.attributes == null) { - this.attributes = new ArrayList(); - } - this.attributes.add(attributes); - return this; - } - - /** - * Set the attributes. - * Existing attributes will be replaced. - * - * @param attributes the attributes - * @return the PolicySubject builder - */ - public Builder attributes(List attributes) { - this.attributes = attributes; - return this; - } - } - - protected PolicySubject() { } - - protected PolicySubject(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, - "attributes cannot be null"); - attributes = builder.attributes; - } - - /** - * New builder. - * - * @return a PolicySubject builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the attributes. - * - * List of subject attributes. - * - * @return the attributes - */ - public List attributes() { - return attributes; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java deleted file mode 100644 index bdffbe98c10..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the policy template. - */ -public class PolicyTemplate extends GenericModel { - - /** - * State of policy template. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String name; - protected String description; - @SerializedName("account_id") - protected String accountId; - protected String version; - protected Boolean committed; - protected TemplatePolicy policy; - protected String state; - protected String id; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - - protected PolicyTemplate() { } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the version. - * - * Template version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the committed. - * - * Committed status of the template version. - * - * @return the committed - */ - public Boolean isCommitted() { - return committed; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy getPolicy() { - return policy; - } - - /** - * Gets the state. - * - * State of policy template. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the id. - * - * The policy template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the policy templates API by policy template ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy template was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy template. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy template was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy template. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java deleted file mode 100644 index 54727eadf4d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of policies assignments. - */ -public class PolicyTemplateAssignmentCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List assignments; - - protected PolicyTemplateAssignmentCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the assignments. - * - * List of policy assignments. - * - * @return the assignments - */ - public List getAssignments() { - return assignments; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java deleted file mode 100644 index 2c8e82df441..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * PolicyTemplateAssignmentItems. - * - * Classes which extend this class: - * - PolicyTemplateAssignmentItemsPolicyAssignmentV1 - * - PolicyTemplateAssignmentItemsPolicyAssignment - */ -public class PolicyTemplateAssignmentItems extends GenericModel { - - /** - * The policy assignment status. - */ - public interface Status { - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** succeeded. */ - String SUCCEEDED = "succeeded"; - /** succeed_with_errors. */ - String SUCCEED_WITH_ERRORS = "succeed_with_errors"; - /** failed. */ - String FAILED = "failed"; - } - - /** - * Assignment target type. - */ - public interface TargetType { - /** Account. */ - String ACCOUNT = "Account"; - /** AccountGroup. */ - String ACCOUNTGROUP = "AccountGroup"; - /** Enterprise. */ - String ENTERPRISE = "Enterprise"; - } - - protected AssignmentTargetDetails target; - protected String id; - @SerializedName("account_id") - protected String accountId; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected List resources; - protected PolicyAssignmentV1Subject subject; - protected AssignmentTemplateDetails template; - protected String status; - @SerializedName("template_id") - protected String templateId; - @SerializedName("template_version") - protected String templateVersion; - @SerializedName("assignment_id") - protected String assignmentId; - @SerializedName("target_type") - protected String targetType; - - protected PolicyTemplateAssignmentItems() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the id. - * - * Policy assignment ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the accountId. - * - * The account GUID that the policies assignments belong to. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the href. - * - * The href URL that links to the policies assignments API by policy assignment ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy assignment was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy assignment. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy assignment was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy assignment. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the resources. - * - * Object for each account assigned. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the subject. - * - * Subject details of access type assignment. - * - * @return the subject - */ - public PolicyAssignmentV1Subject getSubject() { - return subject; - } - - /** - * Gets the template. - * - * policy template details. - * - * @return the template - */ - public AssignmentTemplateDetails getTemplate() { - return template; - } - - /** - * Gets the status. - * - * The policy assignment status. - * - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * Gets the templateId. - * - * policy template ID. - * - * @return the templateId - */ - public String getTemplateId() { - return templateId; - } - - /** - * Gets the templateVersion. - * - * policy template version. - * - * @return the templateVersion - */ - public String getTemplateVersion() { - return templateVersion; - } - - /** - * Gets the assignmentId. - * - * Passed in value to correlate with other assignments. - * - * @return the assignmentId - */ - public String getAssignmentId() { - return assignmentId; - } - - /** - * Gets the targetType. - * - * Assignment target type. - * - * @return the targetType - */ - public String getTargetType() { - return targetType; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java deleted file mode 100644 index ec9c32e5bdd..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * The set of properties associated with the policy template assignment. - */ -public class PolicyTemplateAssignmentItemsPolicyAssignment extends PolicyTemplateAssignmentItems { - - /** - * Assignment target type. - */ - public interface TargetType { - /** Account. */ - String ACCOUNT = "Account"; - /** AccountGroup. */ - String ACCOUNTGROUP = "AccountGroup"; - /** Enterprise. */ - String ENTERPRISE = "Enterprise"; - } - - /** - * The policy assignment status. - */ - public interface Status { - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** succeeded. */ - String SUCCEEDED = "succeeded"; - /** succeed_with_errors. */ - String SUCCEED_WITH_ERRORS = "succeed_with_errors"; - /** failed. */ - String FAILED = "failed"; - } - - - protected PolicyTemplateAssignmentItemsPolicyAssignment() { } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java deleted file mode 100644 index 4cebdbb17b1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * The set of properties associated with the policy template assignment. - */ -public class PolicyTemplateAssignmentItemsPolicyAssignmentV1 extends PolicyTemplateAssignmentItems { - - /** - * The policy assignment status. - */ - public interface Status { - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** succeeded. */ - String SUCCEEDED = "succeeded"; - /** succeed_with_errors. */ - String SUCCEED_WITH_ERRORS = "succeed_with_errors"; - /** failed. */ - String FAILED = "failed"; - } - - - protected PolicyTemplateAssignmentItemsPolicyAssignmentV1() { } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java deleted file mode 100644 index 2a262c584b5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of policy Templates. - */ -public class PolicyTemplateCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - @SerializedName("policy_templates") - protected List policyTemplates; - - protected PolicyTemplateCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the policyTemplates. - * - * List of policy templates. - * - * @return the policyTemplates - */ - public List getPolicyTemplates() { - return policyTemplates; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java deleted file mode 100644 index 5a2876dfe28..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the policy template. - */ -public class PolicyTemplateLimitData extends GenericModel { - - /** - * State of policy template. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String name; - protected String description; - @SerializedName("account_id") - protected String accountId; - protected String version; - protected Boolean committed; - protected TemplatePolicy policy; - protected String state; - protected String id; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected TemplateCountData counts; - - protected PolicyTemplateLimitData() { } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the version. - * - * Template version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the committed. - * - * Committed status of the template version. - * - * @return the committed - */ - public Boolean isCommitted() { - return committed; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy getPolicy() { - return policy; - } - - /** - * Gets the state. - * - * State of policy template. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the id. - * - * The policy template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the policy templates API by policy template ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy template was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy template. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy template was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy template. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the counts. - * - * policy template count details. - * - * @return the counts - */ - public TemplateCountData getCounts() { - return counts; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java deleted file mode 100644 index 07effc5b3ad..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with a policy. - */ -public class PolicyTemplateMetaData extends GenericModel { - - /** - * The policy state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String id; - protected String type; - protected String description; - protected List subjects; - protected List roles; - protected List resources; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String state; - protected TemplateMetadata template; - - protected PolicyTemplateMetaData() { } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Gets the description. - * - * Customer-defined description. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the subjects. - * - * The subjects associated with a policy. - * - * @return the subjects - */ - public List getSubjects() { - return subjects; - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List getRoles() { - return roles; - } - - /** - * Gets the resources. - * - * The resources associated with a policy. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the href. - * - * The href links back to the policy. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the state. - * - * The policy state. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the template. - * - * The details of the IAM template that was used to create an enterprise-managed policy in your account. When - * returned, this indicates that the policy is created from and managed by a template in the root enterprise account. - * - * @return the template - */ - public TemplateMetadata getTemplate() { - return template; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java deleted file mode 100644 index a4f95bc6562..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of versions for a specific policy template. - */ -public class PolicyTemplateVersionsCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List versions; - - protected PolicyTemplateVersionsCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the versions. - * - * List of policy templates versions. - * - * @return the versions - */ - public List getVersions() { - return versions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java deleted file mode 100644 index f6a2496cf91..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * PolicyTemplateVersionsPager can be used to simplify the use of the "listPolicyTemplateVersions" method. - */ -public class PolicyTemplateVersionsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListPolicyTemplateVersionsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected PolicyTemplateVersionsPager() { } - - /** - * Constructs a new PolicyTemplateVersionsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyTemplateVersions" method - * @param options the ListPolicyTemplateVersionsOptions instance to be used to invoke the "listPolicyTemplateVersions" method - */ - public PolicyTemplateVersionsPager(IamPolicyManagement client, ListPolicyTemplateVersionsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<PolicyTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListPolicyTemplateVersionsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - PolicyTemplateVersionsCollection result = client.listPolicyTemplateVersions(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getVersions(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<PolicyTemplate> containing all results returned by the "listPolicyTemplateVersions" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java deleted file mode 100644 index eba6e6c8fad..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * PolicyTemplatesPager can be used to simplify the use of the "listPolicyTemplates" method. - */ -public class PolicyTemplatesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListPolicyTemplatesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected PolicyTemplatesPager() { } - - /** - * Constructs a new PolicyTemplatesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyTemplates" method - * @param options the ListPolicyTemplatesOptions instance to be used to invoke the "listPolicyTemplates" method - */ - public PolicyTemplatesPager(IamPolicyManagement client, ListPolicyTemplatesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<PolicyTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListPolicyTemplatesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - PolicyTemplateCollection result = client.listPolicyTemplates(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getPolicyTemplates(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<PolicyTemplate> containing all results returned by the "listPolicyTemplates" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java deleted file mode 100644 index 2656f3fb790..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Details with linking href to previous page of requested collection. - */ -public class Previous extends GenericModel { - - protected String href; - protected String start; - - protected Previous() { } - - /** - * Gets the href. - * - * The href linking to the page of requested collection. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection. - * - * @return the start - */ - public String getStart() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java deleted file mode 100644 index 151a77e8cb9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java +++ /dev/null @@ -1,273 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replaceActionControlTemplate options. - */ -public class ReplaceActionControlTemplateOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String version; - protected String ifMatch; - protected String name; - protected String description; - protected TemplateActionControl actionControl; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String version; - private String ifMatch; - private String name; - private String description; - private TemplateActionControl actionControl; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing ReplaceActionControlTemplateOptions instance. - * - * @param replaceActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(ReplaceActionControlTemplateOptions replaceActionControlTemplateOptions) { - this.actionControlTemplateId = replaceActionControlTemplateOptions.actionControlTemplateId; - this.version = replaceActionControlTemplateOptions.version; - this.ifMatch = replaceActionControlTemplateOptions.ifMatch; - this.name = replaceActionControlTemplateOptions.name; - this.description = replaceActionControlTemplateOptions.description; - this.actionControl = replaceActionControlTemplateOptions.actionControl; - this.committed = replaceActionControlTemplateOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - * @param version the version - * @param ifMatch the ifMatch - */ - public Builder(String actionControlTemplateId, String version, String ifMatch) { - this.actionControlTemplateId = actionControlTemplateId; - this.version = version; - this.ifMatch = ifMatch; - } - - /** - * Builds a ReplaceActionControlTemplateOptions. - * - * @return the new ReplaceActionControlTemplateOptions instance - */ - public ReplaceActionControlTemplateOptions build() { - return new ReplaceActionControlTemplateOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actionControl. - * - * @param actionControl the actionControl - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder actionControl(TemplateActionControl actionControl) { - this.actionControl = actionControl; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected ReplaceActionControlTemplateOptions() { } - - protected ReplaceActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - actionControlTemplateId = builder.actionControlTemplateId; - version = builder.version; - ifMatch = builder.ifMatch; - name = builder.name; - description = builder.description; - actionControl = builder.actionControl; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a ReplaceActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating an action control template version must match the Etag value of the existing - * action control template version. The Etag can be retrieved using the GET - * /v1/action_control_templates/{template_id}/versions/{version} API and looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will - * change the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the action control template. This is shown to users in the enterprise account. Use this to describe - * the purpose or context of the action control for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actionControl. - * - * The action control properties that are created in an action resource when the template is assigned. - * - * @return the actionControl - */ - public TemplateActionControl actionControl() { - return actionControl; - } - - /** - * Gets the committed. - * - * Committed status of the template version. If committed is set to true, then the template version can no longer be - * updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java deleted file mode 100644 index 80cbe9e4c79..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java +++ /dev/null @@ -1,335 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replacePolicy options. - */ -public class ReplacePolicyOptions extends GenericModel { - - protected String policyId; - protected String ifMatch; - protected String type; - protected List subjects; - protected List roles; - protected List resources; - protected String description; - - /** - * Builder. - */ - public static class Builder { - private String policyId; - private String ifMatch; - private String type; - private List subjects; - private List roles; - private List resources; - private String description; - - /** - * Instantiates a new Builder from an existing ReplacePolicyOptions instance. - * - * @param replacePolicyOptions the instance to initialize the Builder with - */ - private Builder(ReplacePolicyOptions replacePolicyOptions) { - this.policyId = replacePolicyOptions.policyId; - this.ifMatch = replacePolicyOptions.ifMatch; - this.type = replacePolicyOptions.type; - this.subjects = replacePolicyOptions.subjects; - this.roles = replacePolicyOptions.roles; - this.resources = replacePolicyOptions.resources; - this.description = replacePolicyOptions.description; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyId the policyId - * @param ifMatch the ifMatch - * @param type the type - * @param subjects the subjects - * @param roles the roles - * @param resources the resources - */ - public Builder(String policyId, String ifMatch, String type, List subjects, List roles, List resources) { - this.policyId = policyId; - this.ifMatch = ifMatch; - this.type = type; - this.subjects = subjects; - this.roles = roles; - this.resources = resources; - } - - /** - * Builds a ReplacePolicyOptions. - * - * @return the new ReplacePolicyOptions instance - */ - public ReplacePolicyOptions build() { - return new ReplacePolicyOptions(this); - } - - /** - * Adds a new element to subjects. - * - * @param subjects the new element to be added - * @return the ReplacePolicyOptions builder - */ - public Builder addSubjects(PolicySubject subjects) { - com.ibm.cloud.sdk.core.util.Validator.notNull(subjects, - "subjects cannot be null"); - if (this.subjects == null) { - this.subjects = new ArrayList(); - } - this.subjects.add(subjects); - return this; - } - - /** - * Adds a new element to roles. - * - * @param roles the new element to be added - * @return the ReplacePolicyOptions builder - */ - public Builder addRoles(PolicyRole roles) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roles, - "roles cannot be null"); - if (this.roles == null) { - this.roles = new ArrayList(); - } - this.roles.add(roles); - return this; - } - - /** - * Adds a new element to resources. - * - * @param resources the new element to be added - * @return the ReplacePolicyOptions builder - */ - public Builder addResources(PolicyResource resources) { - com.ibm.cloud.sdk.core.util.Validator.notNull(resources, - "resources cannot be null"); - if (this.resources == null) { - this.resources = new ArrayList(); - } - this.resources.add(resources); - return this; - } - - /** - * Set the policyId. - * - * @param policyId the policyId - * @return the ReplacePolicyOptions builder - */ - public Builder policyId(String policyId) { - this.policyId = policyId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplacePolicyOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the ReplacePolicyOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the subjects. - * Existing subjects will be replaced. - * - * @param subjects the subjects - * @return the ReplacePolicyOptions builder - */ - public Builder subjects(List subjects) { - this.subjects = subjects; - return this; - } - - /** - * Set the roles. - * Existing roles will be replaced. - * - * @param roles the roles - * @return the ReplacePolicyOptions builder - */ - public Builder roles(List roles) { - this.roles = roles; - return this; - } - - /** - * Set the resources. - * Existing resources will be replaced. - * - * @param resources the resources - * @return the ReplacePolicyOptions builder - */ - public Builder resources(List resources) { - this.resources = resources; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplacePolicyOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - } - - protected ReplacePolicyOptions() { } - - protected ReplacePolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, - "policyId 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.type, - "type cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subjects, - "subjects cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, - "roles cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resources, - "resources cannot be null"); - policyId = builder.policyId; - ifMatch = builder.ifMatch; - type = builder.type; - subjects = builder.subjects; - roles = builder.roles; - resources = builder.resources; - description = builder.description; - } - - /** - * New builder. - * - * @return a ReplacePolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyId. - * - * The policy ID. - * - * @return the policyId - */ - public String policyId() { - return policyId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be - * retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the subjects. - * - * The subjects associated with a policy. - * - * @return the subjects - */ - public List subjects() { - return subjects; - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List roles() { - return roles; - } - - /** - * Gets the resources. - * - * The resources associated with a policy. - * - * @return the resources - */ - public List resources() { - return resources; - } - - /** - * Gets the description. - * - * Customer-defined description. - * - * @return the description - */ - public String description() { - return description; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java deleted file mode 100644 index 5a55c4898e5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replacePolicyTemplate options. - */ -public class ReplacePolicyTemplateOptions extends GenericModel { - - protected String policyTemplateId; - protected String version; - protected String ifMatch; - protected TemplatePolicy policy; - protected String name; - protected String description; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String version; - private String ifMatch; - private TemplatePolicy policy; - private String name; - private String description; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing ReplacePolicyTemplateOptions instance. - * - * @param replacePolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(ReplacePolicyTemplateOptions replacePolicyTemplateOptions) { - this.policyTemplateId = replacePolicyTemplateOptions.policyTemplateId; - this.version = replacePolicyTemplateOptions.version; - this.ifMatch = replacePolicyTemplateOptions.ifMatch; - this.policy = replacePolicyTemplateOptions.policy; - this.name = replacePolicyTemplateOptions.name; - this.description = replacePolicyTemplateOptions.description; - this.committed = replacePolicyTemplateOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param version the version - * @param ifMatch the ifMatch - * @param policy the policy - */ - public Builder(String policyTemplateId, String version, String ifMatch, TemplatePolicy policy) { - this.policyTemplateId = policyTemplateId; - this.version = version; - this.ifMatch = ifMatch; - this.policy = policy; - } - - /** - * Builds a ReplacePolicyTemplateOptions. - * - * @return the new ReplacePolicyTemplateOptions instance - */ - public ReplacePolicyTemplateOptions build() { - return new ReplacePolicyTemplateOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the policy. - * - * @param policy the policy - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder policy(TemplatePolicy policy) { - this.policy = policy; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected ReplacePolicyTemplateOptions() { } - - protected ReplacePolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version 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.policy, - "policy cannot be null"); - policyTemplateId = builder.policyTemplateId; - version = builder.version; - ifMatch = builder.ifMatch; - policy = builder.policy; - name = builder.name; - description = builder.description; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a ReplacePolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the version. - * - * The policy template version. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy template version and must match the Etag value of the existing policy - * template version. The Etag can be retrieved using the GET - * /v1/policy_templates/{policy_template_id}/versions/{version} API and looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy policy() { - return policy; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template version. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java deleted file mode 100644 index fc4b536103d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java +++ /dev/null @@ -1,255 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replaceRole options. - */ -public class ReplaceRoleOptions extends GenericModel { - - protected String roleId; - protected String ifMatch; - protected String displayName; - protected List actions; - protected String description; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - private String ifMatch; - private String displayName; - private List actions; - private String description; - - /** - * Instantiates a new Builder from an existing ReplaceRoleOptions instance. - * - * @param replaceRoleOptions the instance to initialize the Builder with - */ - private Builder(ReplaceRoleOptions replaceRoleOptions) { - this.roleId = replaceRoleOptions.roleId; - this.ifMatch = replaceRoleOptions.ifMatch; - this.displayName = replaceRoleOptions.displayName; - this.actions = replaceRoleOptions.actions; - this.description = replaceRoleOptions.description; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - * @param ifMatch the ifMatch - * @param displayName the displayName - * @param actions the actions - */ - public Builder(String roleId, String ifMatch, String displayName, List actions) { - this.roleId = roleId; - this.ifMatch = ifMatch; - this.displayName = displayName; - this.actions = actions; - } - - /** - * Builds a ReplaceRoleOptions. - * - * @return the new ReplaceRoleOptions instance - */ - public ReplaceRoleOptions build() { - return new ReplaceRoleOptions(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the ReplaceRoleOptions builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the ReplaceRoleOptions builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplaceRoleOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the ReplaceRoleOptions builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the ReplaceRoleOptions builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplaceRoleOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the role. - * - * @param role the role - * @return the ReplaceRoleOptions builder - */ - public Builder role(Role role) { - this.displayName = role.displayName(); - this.actions = role.actions(); - this.description = role.description(); - return this; - } - } - - protected ReplaceRoleOptions() { } - - protected ReplaceRoleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, - "roleId 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.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - roleId = builder.roleId; - ifMatch = builder.ifMatch; - displayName = builder.displayName; - actions = builder.actions; - description = builder.description; - } - - /** - * New builder. - * - * @return a ReplaceRoleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role ID. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a role and must match the ETag value of the existing role. The Etag can be - * retrieved using the GET /v2/roles/{role_id} API and looking at the ETag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List actions() { - return actions; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String description() { - return description; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java deleted file mode 100644 index 9a69b13326c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java +++ /dev/null @@ -1,273 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replaceRoleTemplate options. - */ -public class ReplaceRoleTemplateOptions extends GenericModel { - - protected String roleTemplateId; - protected String version; - protected String ifMatch; - protected String name; - protected String description; - protected TemplateRole role; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String version; - private String ifMatch; - private String name; - private String description; - private TemplateRole role; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing ReplaceRoleTemplateOptions instance. - * - * @param replaceRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(ReplaceRoleTemplateOptions replaceRoleTemplateOptions) { - this.roleTemplateId = replaceRoleTemplateOptions.roleTemplateId; - this.version = replaceRoleTemplateOptions.version; - this.ifMatch = replaceRoleTemplateOptions.ifMatch; - this.name = replaceRoleTemplateOptions.name; - this.description = replaceRoleTemplateOptions.description; - this.role = replaceRoleTemplateOptions.role; - this.committed = replaceRoleTemplateOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - * @param version the version - * @param ifMatch the ifMatch - */ - public Builder(String roleTemplateId, String version, String ifMatch) { - this.roleTemplateId = roleTemplateId; - this.version = version; - this.ifMatch = ifMatch; - } - - /** - * Builds a ReplaceRoleTemplateOptions. - * - * @return the new ReplaceRoleTemplateOptions instance - */ - public ReplaceRoleTemplateOptions build() { - return new ReplaceRoleTemplateOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the role. - * - * @param role the role - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder role(TemplateRole role) { - this.role = role; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected ReplaceRoleTemplateOptions() { } - - protected ReplaceRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - roleTemplateId = builder.roleTemplateId; - version = builder.version; - ifMatch = builder.ifMatch; - name = builder.name; - description = builder.description; - role = builder.role; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a ReplaceRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the version. - * - * Role template version. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a role template version must match the Etag value of the existing role template - * version. The Etag can be retrieved using the GET /v1/role_templates/{template_id}/versions/{version} API and - * looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will - * change the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the role template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the role for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the role. - * - * The role properties that are created in an action resource when the template is assigned. - * - * @return the role - */ - public TemplateRole role() { - return role; - } - - /** - * Gets the committed. - * - * Committed status of the template version. If committed is set to true, then the template version can no longer be - * updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java deleted file mode 100644 index 960f4782635..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java +++ /dev/null @@ -1,336 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replaceV2Policy options. - */ -public class ReplaceV2PolicyOptions extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - protected String id; - protected String ifMatch; - protected Control control; - protected String type; - protected String description; - protected V2PolicySubject subject; - protected V2PolicyResource resource; - protected String pattern; - protected V2PolicyRule rule; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String ifMatch; - private Control control; - private String type; - private String description; - private V2PolicySubject subject; - private V2PolicyResource resource; - private String pattern; - private V2PolicyRule rule; - - /** - * Instantiates a new Builder from an existing ReplaceV2PolicyOptions instance. - * - * @param replaceV2PolicyOptions the instance to initialize the Builder with - */ - private Builder(ReplaceV2PolicyOptions replaceV2PolicyOptions) { - this.id = replaceV2PolicyOptions.id; - this.ifMatch = replaceV2PolicyOptions.ifMatch; - this.control = replaceV2PolicyOptions.control; - this.type = replaceV2PolicyOptions.type; - this.description = replaceV2PolicyOptions.description; - this.subject = replaceV2PolicyOptions.subject; - this.resource = replaceV2PolicyOptions.resource; - this.pattern = replaceV2PolicyOptions.pattern; - this.rule = replaceV2PolicyOptions.rule; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param id the id - * @param ifMatch the ifMatch - * @param control the control - * @param type the type - */ - public Builder(String id, String ifMatch, Control control, String type) { - this.id = id; - this.ifMatch = ifMatch; - this.control = control; - this.type = type; - } - - /** - * Builds a ReplaceV2PolicyOptions. - * - * @return the new ReplaceV2PolicyOptions instance - */ - public ReplaceV2PolicyOptions build() { - return new ReplaceV2PolicyOptions(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the ReplaceV2PolicyOptions builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplaceV2PolicyOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the control. - * - * @param control the control - * @return the ReplaceV2PolicyOptions builder - */ - public Builder control(Control control) { - this.control = control; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the ReplaceV2PolicyOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplaceV2PolicyOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the subject. - * - * @param subject the subject - * @return the ReplaceV2PolicyOptions builder - */ - public Builder subject(V2PolicySubject subject) { - this.subject = subject; - return this; - } - - /** - * Set the resource. - * - * @param resource the resource - * @return the ReplaceV2PolicyOptions builder - */ - public Builder resource(V2PolicyResource resource) { - this.resource = resource; - return this; - } - - /** - * Set the pattern. - * - * @param pattern the pattern - * @return the ReplaceV2PolicyOptions builder - */ - public Builder pattern(String pattern) { - this.pattern = pattern; - return this; - } - - /** - * Set the rule. - * - * @param rule the rule - * @return the ReplaceV2PolicyOptions builder - */ - public Builder rule(V2PolicyRule rule) { - this.rule = rule; - return this; - } - } - - protected ReplaceV2PolicyOptions() { } - - protected ReplaceV2PolicyOptions(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.control, - "control cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - id = builder.id; - ifMatch = builder.ifMatch; - control = builder.control; - type = builder.type; - description = builder.description; - subject = builder.subject; - resource = builder.resource; - pattern = builder.pattern; - rule = builder.rule; - } - - /** - * New builder. - * - * @return a ReplaceV2PolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be - * retrieved using the GET /v2/policies/{id} API and looking at the ETag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the control. - * - * Specifies the type of access that is granted by the policy. - * - * @return the control - */ - public Control control() { - return control; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject subject() { - return subject; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource resource() { - return resource; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String pattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule rule() { - return rule; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java deleted file mode 100644 index 3a8b7e87b9e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * An attribute associated with a resource. - */ -public class ResourceAttribute extends GenericModel { - - protected String name; - protected String value; - protected String operator; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String value; - private String operator; - - /** - * Instantiates a new Builder from an existing ResourceAttribute instance. - * - * @param resourceAttribute the instance to initialize the Builder with - */ - private Builder(ResourceAttribute resourceAttribute) { - this.name = resourceAttribute.name; - this.value = resourceAttribute.value; - this.operator = resourceAttribute.operator; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param value the value - */ - public Builder(String name, String value) { - this.name = name; - this.value = value; - } - - /** - * Builds a ResourceAttribute. - * - * @return the new ResourceAttribute instance - */ - public ResourceAttribute build() { - return new ResourceAttribute(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the ResourceAttribute builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the ResourceAttribute builder - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the ResourceAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - } - - protected ResourceAttribute() { } - - protected ResourceAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - name = builder.name; - value = builder.value; - operator = builder.operator; - } - - /** - * New builder. - * - * @return a ResourceAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * The name of an attribute. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the value. - * - * The value of an attribute. - * - * @return the value - */ - public String value() { - return value; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java deleted file mode 100644 index 7da4cffee56..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A tag associated with a resource. - */ -public class ResourceTag extends GenericModel { - - protected String name; - protected String value; - protected String operator; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String value; - private String operator; - - /** - * Instantiates a new Builder from an existing ResourceTag instance. - * - * @param resourceTag the instance to initialize the Builder with - */ - private Builder(ResourceTag resourceTag) { - this.name = resourceTag.name; - this.value = resourceTag.value; - this.operator = resourceTag.operator; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param value the value - */ - public Builder(String name, String value) { - this.name = name; - this.value = value; - } - - /** - * Builds a ResourceTag. - * - * @return the new ResourceTag instance - */ - public ResourceTag build() { - return new ResourceTag(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the ResourceTag builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the ResourceTag builder - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the ResourceTag builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - } - - protected ResourceTag() { } - - protected ResourceTag(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - name = builder.name; - value = builder.value; - operator = builder.operator; - } - - /** - * New builder. - * - * @return a ResourceTag builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * The name of an access management tag. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the value. - * - * The value of an access management tag. - * - * @return the value - */ - public String value() { - return value; - } - - /** - * Gets the operator. - * - * The operator of an access management tag. - * - * @return the operator - */ - public String operator() { - return operator; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java deleted file mode 100644 index 24b99c9bd08..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role resource. - */ -public class Role extends GenericModel { - - @SerializedName("display_name") - protected String displayName; - protected String description; - protected List actions; - protected String crn; - - /** - * Builder. - */ - public static class Builder { - private String displayName; - private String description; - private List actions; - - /** - * Instantiates a new Builder from an existing Role instance. - * - * @param role the instance to initialize the Builder with - */ - private Builder(Role role) { - this.displayName = role.displayName; - this.description = role.description; - this.actions = role.actions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param displayName the displayName - * @param actions the actions - */ - public Builder(String displayName, List actions) { - this.displayName = displayName; - this.actions = actions; - } - - /** - * Builds a Role. - * - * @return the new Role instance - */ - public Role build() { - return new Role(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the Role builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the Role builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the Role builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the Role builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - } - - protected Role() { } - - protected Role(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - displayName = builder.displayName; - description = builder.description; - actions = builder.actions; - } - - /** - * New builder. - * - * @return a Role builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List actions() { - return actions; - } - - /** - * Gets the crn. - * - * The role Cloud Resource Name (CRN). Example CRN: - * 'crn:v1:ibmcloud:public:iam-access-management::a/exampleAccountId::customRole:ExampleRoleName'. - * - * @return the crn - */ - public String crn() { - return crn; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java deleted file mode 100644 index 9169fc88572..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * An action that can be performed by the policy subject when assigned a role. - */ -public class RoleAction extends GenericModel { - - protected String id; - @SerializedName("display_name") - protected String displayName; - protected String description; - - protected RoleAction() { } - - /** - * Gets the id. - * - * Unique identifier for action with structure service.resource.action. For example, cbr.rule.read. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the displayName. - * - * Services defined display name for action. - * - * @return the displayName - */ - public String getDisplayName() { - return displayName; - } - - /** - * Gets the description. - * - * Service defined description for action. - * - * @return the description - */ - public String getDescription() { - return description; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java deleted file mode 100644 index 23bb4b65c6f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the assigned role template. - */ -public class RoleAssignment extends GenericModel { - - /** - * The current operation of the role assignment. - */ - public interface Operation { - /** create. */ - String CREATE = "create"; - /** apply. */ - String APPLY = "apply"; - /** update. */ - String UPDATE = "update"; - /** remove. */ - String REMOVE = "remove"; - } - - /** - * The role assignment status. - */ - public interface Status { - /** accepted. */ - String ACCEPTED = "accepted"; - /** failure. */ - String FAILURE = "failure"; - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** superseded. */ - String SUPERSEDED = "superseded"; - } - - protected String id; - @SerializedName("account_id") - protected String accountId; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String operation; - protected List resources; - protected RoleAssignmentTemplate template; - protected AssignmentTargetDetails target; - protected String status; - - protected RoleAssignment() { } - - /** - * Gets the id. - * - * Action control assignment ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the accountId. - * - * The account GUID that the role assignments belong to. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the href. - * - * The href URL that links to the role assignments API by role assignment ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the role assignment was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the role assignment. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the role assignment was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the role assignment. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the operation. - * - * The current operation of the role assignment. - * - * @return the operation - */ - public String getOperation() { - return operation; - } - - /** - * Gets the resources. - * - * Resources created when role template is assigned. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the template. - * - * The role template id and version that will be assigned. - * - * @return the template - */ - public RoleAssignmentTemplate getTemplate() { - return template; - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the status. - * - * The role assignment status. - * - * @return the status - */ - public String getStatus() { - return status; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java deleted file mode 100644 index 658ac5b8c99..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of role assignments. - */ -public class RoleAssignmentCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List assignments; - - protected RoleAssignmentCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the assignments. - * - * List of role assignments. - * - * @return the assignments - */ - public List getAssignments() { - return assignments; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java deleted file mode 100644 index 60d7a02d604..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The role assignment resources and target where the template is assigned. - */ -public class RoleAssignmentResource extends GenericModel { - - protected AssignmentTargetDetails target; - protected RoleAssignmentResourceRole role; - - protected RoleAssignmentResource() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the role. - * - * Set of properties of the assigned resource or error message if assignment failed. - * - * @return the role - */ - public RoleAssignmentResourceRole getRole() { - return role; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java deleted file mode 100644 index 9ea359d63fb..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * On success, it includes the role assigned. - */ -public class RoleAssignmentResourceCreated extends GenericModel { - - protected String id; - - protected RoleAssignmentResourceCreated() { } - - /** - * Gets the id. - * - * role id. - * - * @return the id - */ - public String getId() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java deleted file mode 100644 index 22d40bdaef4..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Set of properties of the assigned resource or error message if assignment failed. - */ -public class RoleAssignmentResourceRole extends GenericModel { - - @SerializedName("resource_created") - protected RoleAssignmentResourceCreated resourceCreated; - @SerializedName("error_message") - protected AssignmentResourceError errorMessage; - - protected RoleAssignmentResourceRole() { } - - /** - * Gets the resourceCreated. - * - * On success, it includes the role assigned. - * - * @return the resourceCreated - */ - public RoleAssignmentResourceCreated getResourceCreated() { - return resourceCreated; - } - - /** - * Gets the errorMessage. - * - * Body parameters for assignment error. - * - * @return the errorMessage - */ - public AssignmentResourceError getErrorMessage() { - return errorMessage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java deleted file mode 100644 index 3524b91f4d5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The role template id and version that will be assigned. - */ -public class RoleAssignmentTemplate extends GenericModel { - - protected String id; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String version; - - /** - * Instantiates a new Builder from an existing RoleAssignmentTemplate instance. - * - * @param roleAssignmentTemplate the instance to initialize the Builder with - */ - private Builder(RoleAssignmentTemplate roleAssignmentTemplate) { - this.id = roleAssignmentTemplate.id; - this.version = roleAssignmentTemplate.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param id the id - * @param version the version - */ - public Builder(String id, String version) { - this.id = id; - this.version = version; - } - - /** - * Builds a RoleAssignmentTemplate. - * - * @return the new RoleAssignmentTemplate instance - */ - public RoleAssignmentTemplate build() { - return new RoleAssignmentTemplate(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the RoleAssignmentTemplate builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the RoleAssignmentTemplate builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected RoleAssignmentTemplate() { } - - protected RoleAssignmentTemplate(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - id = builder.id; - version = builder.version; - } - - /** - * New builder. - * - * @return a RoleAssignmentTemplate builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * Action control template ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java deleted file mode 100644 index 16296a82e40..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * RoleAssignmentsPager can be used to simplify the use of the "listRoleAssignments" method. - */ -public class RoleAssignmentsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListRoleAssignmentsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected RoleAssignmentsPager() { } - - /** - * Constructs a new RoleAssignmentsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listRoleAssignments" method - * @param options the ListRoleAssignmentsOptions instance to be used to invoke the "listRoleAssignments" method - */ - public RoleAssignmentsPager(IamPolicyManagement client, ListRoleAssignmentsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<RoleAssignment> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListRoleAssignmentsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - RoleAssignmentCollection result = client.listRoleAssignments(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getAssignments(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<RoleAssignment> containing all results returned by the "listRoleAssignments" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java deleted file mode 100644 index 282730a2dfc..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of roles returned by the 'list roles' operation. - */ -public class RoleCollection extends GenericModel { - - @SerializedName("custom_roles") - protected List customRoles; - @SerializedName("service_roles") - protected List serviceRoles; - @SerializedName("system_roles") - protected List systemRoles; - - protected RoleCollection() { } - - /** - * Gets the customRoles. - * - * List of custom roles. - * - * @return the customRoles - */ - public List getCustomRoles() { - return customRoles; - } - - /** - * Gets the serviceRoles. - * - * List of service roles. - * - * @return the serviceRoles - */ - public List getServiceRoles() { - return serviceRoles; - } - - /** - * Gets the systemRoles. - * - * List of system roles. - * - * @return the systemRoles - */ - public List getSystemRoles() { - return systemRoles; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java deleted file mode 100644 index 663d0f7f1d0..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the role template. - */ -public class RoleTemplate extends GenericModel { - - /** - * State of role template. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String name; - protected String description; - @SerializedName("account_id") - protected String accountId; - protected Boolean committed; - protected RoleTemplatePrototypeRole role; - protected String id; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String version; - protected String state; - - protected RoleTemplate() { } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the description. - * - * Description of the role template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the role for enterprise users managing IAM templates. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the committed. - * - * Committed status of the template. If committed is set to true, then the template version can no longer be updated. - * - * @return the committed - */ - public Boolean isCommitted() { - return committed; - } - - /** - * Gets the role. - * - * The role properties that are created in an action resource when the template is assigned. - * - * @return the role - */ - public RoleTemplatePrototypeRole getRole() { - return role; - } - - /** - * Gets the id. - * - * The role template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the role templates API by role template ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the role template was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the role template. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the role template was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the role template. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the version. - * - * The version number of the template used to identify different versions of same template. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the state. - * - * State of role template. - * - * @return the state - */ - public String getState() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java deleted file mode 100644 index 22a739b4a58..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of role templates. - */ -public class RoleTemplateCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - @SerializedName("role_templates") - protected List roleTemplates; - - protected RoleTemplateCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the roleTemplates. - * - * List of role templates. - * - * @return the roleTemplates - */ - public List getRoleTemplates() { - return roleTemplates; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java deleted file mode 100644 index 43197620689..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java +++ /dev/null @@ -1,239 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The role properties that are created in an action resource when the template is assigned. - */ -public class RoleTemplatePrototypeRole extends GenericModel { - - protected String name; - @SerializedName("display_name") - protected String displayName; - @SerializedName("service_name") - protected String serviceName; - protected String description; - protected List actions; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String displayName; - private String serviceName; - private String description; - private List actions; - - /** - * Instantiates a new Builder from an existing RoleTemplatePrototypeRole instance. - * - * @param roleTemplatePrototypeRole the instance to initialize the Builder with - */ - private Builder(RoleTemplatePrototypeRole roleTemplatePrototypeRole) { - this.name = roleTemplatePrototypeRole.name; - this.displayName = roleTemplatePrototypeRole.displayName; - this.serviceName = roleTemplatePrototypeRole.serviceName; - this.description = roleTemplatePrototypeRole.description; - this.actions = roleTemplatePrototypeRole.actions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param displayName the displayName - * @param actions the actions - */ - public Builder(String name, String displayName, List actions) { - this.name = name; - this.displayName = displayName; - this.actions = actions; - } - - /** - * Builds a RoleTemplatePrototypeRole. - * - * @return the new RoleTemplatePrototypeRole instance - */ - public RoleTemplatePrototypeRole build() { - return new RoleTemplatePrototypeRole(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the RoleTemplatePrototypeRole builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the RoleTemplatePrototypeRole builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the RoleTemplatePrototypeRole builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the RoleTemplatePrototypeRole builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the RoleTemplatePrototypeRole builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the RoleTemplatePrototypeRole builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - } - - protected RoleTemplatePrototypeRole() { } - - protected RoleTemplatePrototypeRole(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - name = builder.name; - displayName = builder.displayName; - serviceName = builder.serviceName; - description = builder.description; - actions = builder.actions; - } - - /** - * New builder. - * - * @return a RoleTemplatePrototypeRole builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the serviceName. - * - * The service name that the role refers. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the description. - * - * Description of the role. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. - * - * @return the actions - */ - public List actions() { - return actions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java deleted file mode 100644 index 673ff7f9750..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role template reference associated with a policy template. - */ -public class RoleTemplateReferencesItem extends GenericModel { - - protected String id; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String version; - - /** - * Instantiates a new Builder from an existing RoleTemplateReferencesItem instance. - * - * @param roleTemplateReferencesItem the instance to initialize the Builder with - */ - private Builder(RoleTemplateReferencesItem roleTemplateReferencesItem) { - this.id = roleTemplateReferencesItem.id; - this.version = roleTemplateReferencesItem.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param id the id - * @param version the version - */ - public Builder(String id, String version) { - this.id = id; - this.version = version; - } - - /** - * Builds a RoleTemplateReferencesItem. - * - * @return the new RoleTemplateReferencesItem instance - */ - public RoleTemplateReferencesItem build() { - return new RoleTemplateReferencesItem(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the RoleTemplateReferencesItem builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the RoleTemplateReferencesItem builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected RoleTemplateReferencesItem() { } - - protected RoleTemplateReferencesItem(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - id = builder.id; - version = builder.version; - } - - /** - * New builder. - * - * @return a RoleTemplateReferencesItem builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * The role template ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the version. - * - * Role template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java deleted file mode 100644 index a983208afe3..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of versions for a specific role template. - */ -public class RoleTemplateVersionsCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List versions; - - protected RoleTemplateVersionsCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the versions. - * - * List of role templates versions. - * - * @return the versions - */ - public List getVersions() { - return versions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java deleted file mode 100644 index 7af200cd72f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * RoleTemplateVersionsPager can be used to simplify the use of the "listRoleTemplateVersions" method. - */ -public class RoleTemplateVersionsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListRoleTemplateVersionsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected RoleTemplateVersionsPager() { } - - /** - * Constructs a new RoleTemplateVersionsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listRoleTemplateVersions" method - * @param options the ListRoleTemplateVersionsOptions instance to be used to invoke the "listRoleTemplateVersions" method - */ - public RoleTemplateVersionsPager(IamPolicyManagement client, ListRoleTemplateVersionsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<RoleTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListRoleTemplateVersionsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - RoleTemplateVersionsCollection result = client.listRoleTemplateVersions(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getVersions(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<RoleTemplate> containing all results returned by the "listRoleTemplateVersions" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java deleted file mode 100644 index 3654e0757ba..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * RoleTemplatesPager can be used to simplify the use of the "listRoleTemplates" method. - */ -public class RoleTemplatesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListRoleTemplatesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected RoleTemplatesPager() { } - - /** - * Constructs a new RoleTemplatesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listRoleTemplates" method - * @param options the ListRoleTemplatesOptions instance to be used to invoke the "listRoleTemplates" method - */ - public RoleTemplatesPager(IamPolicyManagement client, ListRoleTemplatesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<RoleTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListRoleTemplatesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - RoleTemplateCollection result = client.listRoleTemplates(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getRoleTemplates(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<RoleTemplate> containing all results returned by the "listRoleTemplates" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java deleted file mode 100644 index 03b6ff75eb1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role associated with a policy. - */ -public class Roles extends GenericModel { - - @SerializedName("role_id") - protected String roleId; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - - /** - * Instantiates a new Builder from an existing Roles instance. - * - * @param roles the instance to initialize the Builder with - */ - private Builder(Roles roles) { - this.roleId = roles.roleId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - */ - public Builder(String roleId) { - this.roleId = roleId; - } - - /** - * Builds a Roles. - * - * @return the new Roles instance - */ - public Roles build() { - return new Roles(this); - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the Roles builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - } - - protected Roles() { } - - protected Roles(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleId, - "roleId cannot be null"); - roleId = builder.roleId; - } - - /** - * New builder. - * - * @return a Roles builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java deleted file mode 100644 index fbf66d53ae1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Rule that specifies additional access that is granted (For example, time-based condition). - */ -public class RuleAttribute extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - protected String key; - protected String operator; - protected Object value; - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing RuleAttribute instance. - * - * @param ruleAttribute the instance to initialize the Builder with - */ - private Builder(RuleAttribute ruleAttribute) { - this.key = ruleAttribute.key; - this.operator = ruleAttribute.operator; - this.value = ruleAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a RuleAttribute. - * - * @return the new RuleAttribute instance - */ - public RuleAttribute build() { - return new RuleAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the RuleAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the RuleAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the RuleAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected RuleAttribute() { } - - protected RuleAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a RuleAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the key. - * - * The name of an attribute. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java deleted file mode 100644 index d7e54e112c5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * An attribute associated with a subject. - */ -public class SubjectAttribute extends GenericModel { - - protected String name; - protected String value; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String value; - - /** - * Instantiates a new Builder from an existing SubjectAttribute instance. - * - * @param subjectAttribute the instance to initialize the Builder with - */ - private Builder(SubjectAttribute subjectAttribute) { - this.name = subjectAttribute.name; - this.value = subjectAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param value the value - */ - public Builder(String name, String value) { - this.name = name; - this.value = value; - } - - /** - * Builds a SubjectAttribute. - * - * @return the new SubjectAttribute instance - */ - public SubjectAttribute build() { - return new SubjectAttribute(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the SubjectAttribute builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the SubjectAttribute builder - */ - public Builder value(String value) { - this.value = value; - return this; - } - } - - protected SubjectAttribute() { } - - protected SubjectAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - name = builder.name; - value = builder.value; - } - - /** - * New builder. - * - * @return a SubjectAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * The name of an attribute. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the value. - * - * The value of an attribute. - * - * @return the value - */ - public String value() { - return value; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java deleted file mode 100644 index 62f4bd77f87..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The action control properties that are created in an action resource when the template is assigned. - */ -public class TemplateActionControl extends GenericModel { - - @SerializedName("service_name") - protected String serviceName; - protected String description; - protected List actions; - - /** - * Builder. - */ - public static class Builder { - private String serviceName; - private String description; - private List actions; - - /** - * Instantiates a new Builder from an existing TemplateActionControl instance. - * - * @param templateActionControl the instance to initialize the Builder with - */ - private Builder(TemplateActionControl templateActionControl) { - this.serviceName = templateActionControl.serviceName; - this.description = templateActionControl.description; - this.actions = templateActionControl.actions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param serviceName the serviceName - * @param actions the actions - */ - public Builder(String serviceName, List actions) { - this.serviceName = serviceName; - this.actions = actions; - } - - /** - * Builds a TemplateActionControl. - * - * @return the new TemplateActionControl instance - */ - public TemplateActionControl build() { - return new TemplateActionControl(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the TemplateActionControl builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the TemplateActionControl builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the TemplateActionControl builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the TemplateActionControl builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - } - - protected TemplateActionControl() { } - - protected TemplateActionControl(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, - "serviceName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - serviceName = builder.serviceName; - description = builder.description; - actions = builder.actions; - } - - /** - * New builder. - * - * @return a TemplateActionControl builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the serviceName. - * - * The service name that the action control refers. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the description. - * - * Description of the action control. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actions. - * - * List of actions to control access. - * - * @return the actions - */ - public List actions() { - return actions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java deleted file mode 100644 index c74a77d9b6d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Specifies the type of access that is granted by the policy. - */ -public class TemplateControl extends GenericModel { - - protected TemplateGrant grant; - - /** - * Builder. - */ - public static class Builder { - private TemplateGrant grant; - - /** - * Instantiates a new Builder from an existing TemplateControl instance. - * - * @param templateControl the instance to initialize the Builder with - */ - private Builder(TemplateControl templateControl) { - this.grant = templateControl.grant; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param grant the grant - */ - public Builder(TemplateGrant grant) { - this.grant = grant; - } - - /** - * Builds a TemplateControl. - * - * @return the new TemplateControl instance - */ - public TemplateControl build() { - return new TemplateControl(this); - } - - /** - * Set the grant. - * - * @param grant the grant - * @return the TemplateControl builder - */ - public Builder grant(TemplateGrant grant) { - this.grant = grant; - return this; - } - } - - protected TemplateControl() { } - - protected TemplateControl(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.grant, - "grant cannot be null"); - grant = builder.grant; - } - - /** - * New builder. - * - * @return a TemplateControl builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the grant. - * - * Permission is granted by the policy. - * - * @return the grant - */ - public TemplateGrant grant() { - return grant; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java deleted file mode 100644 index edb134e1270..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * policy template count details. - */ -public class TemplateCountData extends GenericModel { - - protected LimitData template; - protected LimitData version; - - protected TemplateCountData() { } - - /** - * Gets the template. - * - * policy template current and limit details with in an account. - * - * @return the template - */ - public LimitData getTemplate() { - return template; - } - - /** - * Gets the version. - * - * policy template current and limit details with in an account. - * - * @return the version - */ - public LimitData getVersion() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java deleted file mode 100644 index fd0daff9665..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Permission is granted by the policy. - * - * Classes which extend this class: - * - TemplateGrantRoles - * - TemplateGrantRoleReferences - */ -public class TemplateGrant extends GenericModel { - - protected List roles; - @SerializedName("role_template_references") - protected List roleTemplateReferences; - - protected TemplateGrant() { } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List roles() { - return roles; - } - - /** - * Gets the roleTemplateReferences. - * - * A set of role template reference IDs granted by the policy. - * - * @return the roleTemplateReferences - */ - public List roleTemplateReferences() { - return roleTemplateReferences; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java deleted file mode 100644 index 248eb121b72..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * TemplateGrantRoleReferences. - */ -public class TemplateGrantRoleReferences extends TemplateGrant { - - - /** - * Builder. - */ - public static class Builder { - private List roleTemplateReferences; - - /** - * Instantiates a new Builder from an existing TemplateGrantRoleReferences instance. - * - * @param templateGrantRoleReferences the instance to initialize the Builder with - */ - public Builder(TemplateGrant templateGrantRoleReferences) { - this.roleTemplateReferences = templateGrantRoleReferences.roleTemplateReferences; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateReferences the roleTemplateReferences - */ - public Builder(List roleTemplateReferences) { - this.roleTemplateReferences = roleTemplateReferences; - } - - /** - * Builds a TemplateGrantRoleReferences. - * - * @return the new TemplateGrantRoleReferences instance - */ - public TemplateGrantRoleReferences build() { - return new TemplateGrantRoleReferences(this); - } - - /** - * Adds a new element to roleTemplateReferences. - * - * @param roleTemplateReferences the new element to be added - * @return the TemplateGrantRoleReferences builder - */ - public Builder addRoleTemplateReferences(RoleTemplateReferencesItem roleTemplateReferences) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roleTemplateReferences, - "roleTemplateReferences cannot be null"); - if (this.roleTemplateReferences == null) { - this.roleTemplateReferences = new ArrayList(); - } - this.roleTemplateReferences.add(roleTemplateReferences); - return this; - } - - /** - * Set the roleTemplateReferences. - * Existing roleTemplateReferences will be replaced. - * - * @param roleTemplateReferences the roleTemplateReferences - * @return the TemplateGrantRoleReferences builder - */ - public Builder roleTemplateReferences(List roleTemplateReferences) { - this.roleTemplateReferences = roleTemplateReferences; - return this; - } - } - - protected TemplateGrantRoleReferences() { } - - protected TemplateGrantRoleReferences(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleTemplateReferences, - "roleTemplateReferences cannot be null"); - roleTemplateReferences = builder.roleTemplateReferences; - } - - /** - * New builder. - * - * @return a TemplateGrantRoleReferences builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java deleted file mode 100644 index 6524b3645eb..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * TemplateGrantRoles. - */ -public class TemplateGrantRoles extends TemplateGrant { - - - /** - * Builder. - */ - public static class Builder { - private List roles; - - /** - * Instantiates a new Builder from an existing TemplateGrantRoles instance. - * - * @param templateGrantRoles the instance to initialize the Builder with - */ - public Builder(TemplateGrant templateGrantRoles) { - this.roles = templateGrantRoles.roles; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roles the roles - */ - public Builder(List roles) { - this.roles = roles; - } - - /** - * Builds a TemplateGrantRoles. - * - * @return the new TemplateGrantRoles instance - */ - public TemplateGrantRoles build() { - return new TemplateGrantRoles(this); - } - - /** - * Adds a new element to roles. - * - * @param roles the new element to be added - * @return the TemplateGrantRoles builder - */ - public Builder addRoles(Roles roles) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roles, - "roles cannot be null"); - if (this.roles == null) { - this.roles = new ArrayList(); - } - this.roles.add(roles); - return this; - } - - /** - * Set the roles. - * Existing roles will be replaced. - * - * @param roles the roles - * @return the TemplateGrantRoles builder - */ - public Builder roles(List roles) { - this.roles = roles; - return this; - } - } - - protected TemplateGrantRoles() { } - - protected TemplateGrantRoles(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, - "roles cannot be null"); - roles = builder.roles; - } - - /** - * New builder. - * - * @return a TemplateGrantRoles builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java deleted file mode 100644 index 41f112312cd..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The details of the IAM template that was used to create an enterprise-managed policy in your account. When returned, - * this indicates that the policy is created from and managed by a template in the root enterprise account. - */ -public class TemplateMetadata extends GenericModel { - - protected String id; - protected String version; - @SerializedName("assignment_id") - protected String assignmentId; - @SerializedName("root_id") - protected String rootId; - @SerializedName("root_version") - protected String rootVersion; - - protected TemplateMetadata() { } - - /** - * Gets the id. - * - * The policy template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the version. - * - * Template version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the assignmentId. - * - * Policy assignment ID. - * - * @return the assignmentId - */ - public String getAssignmentId() { - return assignmentId; - } - - /** - * Gets the rootId. - * - * Orchestrator template ID. - * - * @return the rootId - */ - public String getRootId() { - return rootId; - } - - /** - * Gets the rootVersion. - * - * Orchestrator template version. - * - * @return the rootVersion - */ - public String getRootVersion() { - return rootVersion; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java deleted file mode 100644 index 496b2e70e40..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java +++ /dev/null @@ -1,272 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the template's policy object. - */ -public class TemplatePolicy extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - protected String type; - protected String description; - protected V2PolicyResource resource; - protected V2PolicySubject subject; - protected String pattern; - protected V2PolicyRule rule; - protected TemplateControl control; - - /** - * Builder. - */ - public static class Builder { - private String type; - private String description; - private V2PolicyResource resource; - private V2PolicySubject subject; - private String pattern; - private V2PolicyRule rule; - private TemplateControl control; - - /** - * Instantiates a new Builder from an existing TemplatePolicy instance. - * - * @param templatePolicy the instance to initialize the Builder with - */ - private Builder(TemplatePolicy templatePolicy) { - this.type = templatePolicy.type; - this.description = templatePolicy.description; - this.resource = templatePolicy.resource; - this.subject = templatePolicy.subject; - this.pattern = templatePolicy.pattern; - this.rule = templatePolicy.rule; - this.control = templatePolicy.control; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param type the type - */ - public Builder(String type) { - this.type = type; - } - - /** - * Builds a TemplatePolicy. - * - * @return the new TemplatePolicy instance - */ - public TemplatePolicy build() { - return new TemplatePolicy(this); - } - - /** - * Set the type. - * - * @param type the type - * @return the TemplatePolicy builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the TemplatePolicy builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the resource. - * - * @param resource the resource - * @return the TemplatePolicy builder - */ - public Builder resource(V2PolicyResource resource) { - this.resource = resource; - return this; - } - - /** - * Set the subject. - * - * @param subject the subject - * @return the TemplatePolicy builder - */ - public Builder subject(V2PolicySubject subject) { - this.subject = subject; - return this; - } - - /** - * Set the pattern. - * - * @param pattern the pattern - * @return the TemplatePolicy builder - */ - public Builder pattern(String pattern) { - this.pattern = pattern; - return this; - } - - /** - * Set the rule. - * - * @param rule the rule - * @return the TemplatePolicy builder - */ - public Builder rule(V2PolicyRule rule) { - this.rule = rule; - return this; - } - - /** - * Set the control. - * - * @param control the control - * @return the TemplatePolicy builder - */ - public Builder control(TemplateControl control) { - this.control = control; - return this; - } - } - - protected TemplatePolicy() { } - - protected TemplatePolicy(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - type = builder.type; - description = builder.description; - resource = builder.resource; - subject = builder.subject; - pattern = builder.pattern; - rule = builder.rule; - control = builder.control; - } - - /** - * New builder. - * - * @return a TemplatePolicy builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. This is shown in child accounts when an access group or trusted profile template uses - * the policy template to assign access. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource resource() { - return resource; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject subject() { - return subject; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String pattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule rule() { - return rule; - } - - /** - * Gets the control. - * - * Specifies the type of access that is granted by the policy. - * - * @return the control - */ - public TemplateControl control() { - return control; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java deleted file mode 100644 index b76beb3bddb..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The role properties that are created in an action resource when the template is assigned. - */ -public class TemplateRole extends GenericModel { - - @SerializedName("display_name") - protected String displayName; - @SerializedName("service_name") - protected String serviceName; - protected String description; - protected List actions; - - /** - * Builder. - */ - public static class Builder { - private String displayName; - private String serviceName; - private String description; - private List actions; - - /** - * Instantiates a new Builder from an existing TemplateRole instance. - * - * @param templateRole the instance to initialize the Builder with - */ - private Builder(TemplateRole templateRole) { - this.displayName = templateRole.displayName; - this.serviceName = templateRole.serviceName; - this.description = templateRole.description; - this.actions = templateRole.actions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param displayName the displayName - * @param actions the actions - */ - public Builder(String displayName, List actions) { - this.displayName = displayName; - this.actions = actions; - } - - /** - * Builds a TemplateRole. - * - * @return the new TemplateRole instance - */ - public TemplateRole build() { - return new TemplateRole(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the TemplateRole builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the TemplateRole builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the TemplateRole builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the TemplateRole builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the TemplateRole builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - } - - protected TemplateRole() { } - - protected TemplateRole(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - displayName = builder.displayName; - serviceName = builder.serviceName; - description = builder.description; - actions = builder.actions; - } - - /** - * New builder. - * - * @return a TemplateRole builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the serviceName. - * - * The service name that the role refers. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the description. - * - * Description of the role. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. - * - * @return the actions - */ - public List actions() { - return actions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java deleted file mode 100644 index caf2f737b55..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updateActionControlAssignment options. - */ -public class UpdateActionControlAssignmentOptions extends GenericModel { - - protected String assignmentId; - protected String ifMatch; - protected String templateVersion; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - private String ifMatch; - private String templateVersion; - - /** - * Instantiates a new Builder from an existing UpdateActionControlAssignmentOptions instance. - * - * @param updateActionControlAssignmentOptions the instance to initialize the Builder with - */ - private Builder(UpdateActionControlAssignmentOptions updateActionControlAssignmentOptions) { - this.assignmentId = updateActionControlAssignmentOptions.assignmentId; - this.ifMatch = updateActionControlAssignmentOptions.ifMatch; - this.templateVersion = updateActionControlAssignmentOptions.templateVersion; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - * @param ifMatch the ifMatch - * @param templateVersion the templateVersion - */ - public Builder(String assignmentId, String ifMatch, String templateVersion) { - this.assignmentId = assignmentId; - this.ifMatch = ifMatch; - this.templateVersion = templateVersion; - } - - /** - * Builds a UpdateActionControlAssignmentOptions. - * - * @return the new UpdateActionControlAssignmentOptions instance - */ - public UpdateActionControlAssignmentOptions build() { - return new UpdateActionControlAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the UpdateActionControlAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdateActionControlAssignmentOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the UpdateActionControlAssignmentOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - } - - protected UpdateActionControlAssignmentOptions() { } - - protected UpdateActionControlAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId 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.templateVersion, - "templateVersion cannot be null"); - assignmentId = builder.assignmentId; - ifMatch = builder.ifMatch; - templateVersion = builder.templateVersion; - } - - /** - * New builder. - * - * @return a UpdateActionControlAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Action control template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating an action control assignment and must match the Etag value of the existing action - * control assignment. The Etag can be retrieved using the GET /v1/action_control_assignments/{assignment_id} API and - * looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the templateVersion. - * - * The version number of the template used to identify different versions of same template. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java deleted file mode 100644 index 869eb357802..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updatePolicyAssignment options. - */ -public class UpdatePolicyAssignmentOptions extends GenericModel { - - protected String assignmentId; - protected String version; - protected String ifMatch; - protected String templateVersion; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - private String version; - private String ifMatch; - private String templateVersion; - - /** - * Instantiates a new Builder from an existing UpdatePolicyAssignmentOptions instance. - * - * @param updatePolicyAssignmentOptions the instance to initialize the Builder with - */ - private Builder(UpdatePolicyAssignmentOptions updatePolicyAssignmentOptions) { - this.assignmentId = updatePolicyAssignmentOptions.assignmentId; - this.version = updatePolicyAssignmentOptions.version; - this.ifMatch = updatePolicyAssignmentOptions.ifMatch; - this.templateVersion = updatePolicyAssignmentOptions.templateVersion; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - * @param version the version - * @param ifMatch the ifMatch - * @param templateVersion the templateVersion - */ - public Builder(String assignmentId, String version, String ifMatch, String templateVersion) { - this.assignmentId = assignmentId; - this.version = version; - this.ifMatch = ifMatch; - this.templateVersion = templateVersion; - } - - /** - * Builds a UpdatePolicyAssignmentOptions. - * - * @return the new UpdatePolicyAssignmentOptions instance - */ - public UpdatePolicyAssignmentOptions build() { - return new UpdatePolicyAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the UpdatePolicyAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the UpdatePolicyAssignmentOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdatePolicyAssignmentOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the UpdatePolicyAssignmentOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - } - - protected UpdatePolicyAssignmentOptions() { } - - protected UpdatePolicyAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templateVersion, - "templateVersion cannot be null"); - assignmentId = builder.assignmentId; - version = builder.version; - ifMatch = builder.ifMatch; - templateVersion = builder.templateVersion; - } - - /** - * New builder. - * - * @return a UpdatePolicyAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * The policy template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } - - /** - * Gets the version. - * - * specify version of response body format. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy assignment and must match the Etag value of the existing policy - * assignment. The Etag can be retrieved using the GET /v1/policy_assignments/{assignment_id} API and looking at the - * Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the templateVersion. - * - * The policy template version to update to. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java deleted file mode 100644 index a28b357641f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updatePolicyState options. - */ -public class UpdatePolicyStateOptions extends GenericModel { - - /** - * The policy state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String policyId; - protected String ifMatch; - protected String state; - - /** - * Builder. - */ - public static class Builder { - private String policyId; - private String ifMatch; - private String state; - - /** - * Instantiates a new Builder from an existing UpdatePolicyStateOptions instance. - * - * @param updatePolicyStateOptions the instance to initialize the Builder with - */ - private Builder(UpdatePolicyStateOptions updatePolicyStateOptions) { - this.policyId = updatePolicyStateOptions.policyId; - this.ifMatch = updatePolicyStateOptions.ifMatch; - this.state = updatePolicyStateOptions.state; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyId the policyId - * @param ifMatch the ifMatch - */ - public Builder(String policyId, String ifMatch) { - this.policyId = policyId; - this.ifMatch = ifMatch; - } - - /** - * Builds a UpdatePolicyStateOptions. - * - * @return the new UpdatePolicyStateOptions instance - */ - public UpdatePolicyStateOptions build() { - return new UpdatePolicyStateOptions(this); - } - - /** - * Set the policyId. - * - * @param policyId the policyId - * @return the UpdatePolicyStateOptions builder - */ - public Builder policyId(String policyId) { - this.policyId = policyId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdatePolicyStateOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the UpdatePolicyStateOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - } - - protected UpdatePolicyStateOptions() { } - - protected UpdatePolicyStateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, - "policyId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - policyId = builder.policyId; - ifMatch = builder.ifMatch; - state = builder.state; - } - - /** - * New builder. - * - * @return a UpdatePolicyStateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyId. - * - * The policy ID. - * - * @return the policyId - */ - public String policyId() { - return policyId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be - * retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the state. - * - * The policy state. - * - * @return the state - */ - public String state() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java deleted file mode 100644 index f10cba5fe93..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updateRoleAssignment options. - */ -public class UpdateRoleAssignmentOptions extends GenericModel { - - protected String assignmentId; - protected String ifMatch; - protected String templateVersion; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - private String ifMatch; - private String templateVersion; - - /** - * Instantiates a new Builder from an existing UpdateRoleAssignmentOptions instance. - * - * @param updateRoleAssignmentOptions the instance to initialize the Builder with - */ - private Builder(UpdateRoleAssignmentOptions updateRoleAssignmentOptions) { - this.assignmentId = updateRoleAssignmentOptions.assignmentId; - this.ifMatch = updateRoleAssignmentOptions.ifMatch; - this.templateVersion = updateRoleAssignmentOptions.templateVersion; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - * @param ifMatch the ifMatch - * @param templateVersion the templateVersion - */ - public Builder(String assignmentId, String ifMatch, String templateVersion) { - this.assignmentId = assignmentId; - this.ifMatch = ifMatch; - this.templateVersion = templateVersion; - } - - /** - * Builds a UpdateRoleAssignmentOptions. - * - * @return the new UpdateRoleAssignmentOptions instance - */ - public UpdateRoleAssignmentOptions build() { - return new UpdateRoleAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the UpdateRoleAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdateRoleAssignmentOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the UpdateRoleAssignmentOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - } - - protected UpdateRoleAssignmentOptions() { } - - protected UpdateRoleAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId 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.templateVersion, - "templateVersion cannot be null"); - assignmentId = builder.assignmentId; - ifMatch = builder.ifMatch; - templateVersion = builder.templateVersion; - } - - /** - * New builder. - * - * @return a UpdateRoleAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Role template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a role assignment and must match the Etag value of the existing role assignment. - * The Etag can be retrieved using the GET /v1/role_assignments/{assignment_id} API and looking at the Etag response - * header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the templateVersion. - * - * The version number of the template used to identify different versions of same template. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java deleted file mode 100644 index 3d9dbb43fb3..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updateSettings options. - */ -public class UpdateSettingsOptions extends GenericModel { - - protected String accountId; - protected String ifMatch; - protected ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String ifMatch; - private ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing UpdateSettingsOptions instance. - * - * @param updateSettingsOptions the instance to initialize the Builder with - */ - private Builder(UpdateSettingsOptions updateSettingsOptions) { - this.accountId = updateSettingsOptions.accountId; - this.ifMatch = updateSettingsOptions.ifMatch; - this.externalAccountIdentityInteraction = updateSettingsOptions.externalAccountIdentityInteraction; - this.acceptLanguage = updateSettingsOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - * @param ifMatch the ifMatch - */ - public Builder(String accountId, String ifMatch) { - this.accountId = accountId; - this.ifMatch = ifMatch; - } - - /** - * Builds a UpdateSettingsOptions. - * - * @return the new UpdateSettingsOptions instance - */ - public UpdateSettingsOptions build() { - return new UpdateSettingsOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the UpdateSettingsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdateSettingsOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the externalAccountIdentityInteraction. - * - * @param externalAccountIdentityInteraction the externalAccountIdentityInteraction - * @return the UpdateSettingsOptions builder - */ - public Builder externalAccountIdentityInteraction(ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction) { - this.externalAccountIdentityInteraction = externalAccountIdentityInteraction; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the UpdateSettingsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected UpdateSettingsOptions() { } - - protected UpdateSettingsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.accountId, - "accountId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - accountId = builder.accountId; - ifMatch = builder.ifMatch; - externalAccountIdentityInteraction = builder.externalAccountIdentityInteraction; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a UpdateSettingsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the settings belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating Access Management Account Settings and must match the Etag value of the existing - * Access Management Account Settings. The Etag can be retrieved using the GET - * /v1/accounts/{account_id}/settings/access_management API and looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the externalAccountIdentityInteraction. - * - * Update to how external accounts can interact in relation to the requested account. - * - * @return the externalAccountIdentityInteraction - */ - public ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction() { - return externalAccountIdentityInteraction; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java deleted file mode 100644 index fdae9e28c12..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * V2PoliciesPager can be used to simplify the use of the "listV2Policies" method. - */ -public class V2PoliciesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListV2PoliciesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected V2PoliciesPager() { } - - /** - * Constructs a new V2PoliciesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listV2Policies" method - * @param options the ListV2PoliciesOptions instance to be used to invoke the "listV2Policies" method - */ - public V2PoliciesPager(IamPolicyManagement client, ListV2PoliciesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<V2PolicyTemplateMetaData> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListV2PoliciesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - V2PolicyCollection result = client.listV2Policies(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getPolicies(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<V2PolicyTemplateMetaData> containing all results returned by the "listV2Policies" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java deleted file mode 100644 index 842a354b7b1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java +++ /dev/null @@ -1,247 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the policy. - */ -public class V2Policy extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - /** - * The policy state, either 'deleted' or 'active'. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String type; - protected String description; - protected V2PolicySubject subject; - protected V2PolicyResource resource; - protected String pattern; - protected V2PolicyRule rule; - protected String id; - protected String href; - protected ControlResponse control; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String state; - @SerializedName("last_permit_at") - protected String lastPermitAt; - @SerializedName("last_permit_frequency") - protected Long lastPermitFrequency; - - protected V2Policy() { } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject getSubject() { - return subject; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource getResource() { - return resource; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String getPattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule getRule() { - return rule; - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the policies API by policy ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the control. - * - * @return the control - */ - public ControlResponse getControl() { - return control; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the state. - * - * The policy state, either 'deleted' or 'active'. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the lastPermitAt. - * - * The optional last permit time of policy, when passing query parameter format=include_last_permit. - * - * @return the lastPermitAt - */ - public String getLastPermitAt() { - return lastPermitAt; - } - - /** - * Gets the lastPermitFrequency. - * - * The optional count of times that policy has provided a permit, when passing query parameter - * format=include_last_permit. - * - * @return the lastPermitFrequency - */ - public Long getLastPermitFrequency() { - return lastPermitFrequency; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java deleted file mode 100644 index d392025f8d8..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of policies. - */ -public class V2PolicyCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List policies; - - protected V2PolicyCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the policies. - * - * List of policies. - * - * @return the policies - */ - public List getPolicies() { - return policies; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java deleted file mode 100644 index caf8dd522a9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The resource attributes to which the policy grants access. - */ -public class V2PolicyResource extends GenericModel { - - protected List attributes; - protected List tags; - - /** - * Builder. - */ - public static class Builder { - private List attributes; - private List tags; - - /** - * Instantiates a new Builder from an existing V2PolicyResource instance. - * - * @param v2PolicyResource the instance to initialize the Builder with - */ - private Builder(V2PolicyResource v2PolicyResource) { - this.attributes = v2PolicyResource.attributes; - this.tags = v2PolicyResource.tags; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param attributes the attributes - */ - public Builder(List attributes) { - this.attributes = attributes; - } - - /** - * Builds a V2PolicyResource. - * - * @return the new V2PolicyResource instance - */ - public V2PolicyResource build() { - return new V2PolicyResource(this); - } - - /** - * Adds a new element to attributes. - * - * @param attributes the new element to be added - * @return the V2PolicyResource builder - */ - public Builder addAttributes(V2PolicyResourceAttribute attributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, - "attributes cannot be null"); - if (this.attributes == null) { - this.attributes = new ArrayList(); - } - this.attributes.add(attributes); - return this; - } - - /** - * Adds a new element to tags. - * - * @param tags the new element to be added - * @return the V2PolicyResource builder - */ - public Builder addTags(V2PolicyResourceTag tags) { - com.ibm.cloud.sdk.core.util.Validator.notNull(tags, - "tags cannot be null"); - if (this.tags == null) { - this.tags = new ArrayList(); - } - this.tags.add(tags); - return this; - } - - /** - * Set the attributes. - * Existing attributes will be replaced. - * - * @param attributes the attributes - * @return the V2PolicyResource builder - */ - public Builder attributes(List attributes) { - this.attributes = attributes; - return this; - } - - /** - * Set the tags. - * Existing tags will be replaced. - * - * @param tags the tags - * @return the V2PolicyResource builder - */ - public Builder tags(List tags) { - this.tags = tags; - return this; - } - } - - protected V2PolicyResource() { } - - protected V2PolicyResource(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, - "attributes cannot be null"); - attributes = builder.attributes; - tags = builder.tags; - } - - /** - * New builder. - * - * @return a V2PolicyResource builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the attributes. - * - * List of resource attributes to which the policy grants access. - * - * @return the attributes - */ - public List attributes() { - return attributes; - } - - /** - * Gets the tags. - * - * Optional list of resource tags to which the policy grants access. - * - * @return the tags - */ - public List tags() { - return tags; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java deleted file mode 100644 index 73e7cedd55e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Resource attribute to which the policy grants access. - */ -public class V2PolicyResourceAttribute extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - } - - protected String key; - protected String operator; - protected Object value; - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing V2PolicyResourceAttribute instance. - * - * @param v2PolicyResourceAttribute the instance to initialize the Builder with - */ - private Builder(V2PolicyResourceAttribute v2PolicyResourceAttribute) { - this.key = v2PolicyResourceAttribute.key; - this.operator = v2PolicyResourceAttribute.operator; - this.value = v2PolicyResourceAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a V2PolicyResourceAttribute. - * - * @return the new V2PolicyResourceAttribute instance - */ - public V2PolicyResourceAttribute build() { - return new V2PolicyResourceAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the V2PolicyResourceAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicyResourceAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the V2PolicyResourceAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected V2PolicyResourceAttribute() { } - - protected V2PolicyResourceAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a V2PolicyResourceAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the key. - * - * The name of a resource attribute. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java deleted file mode 100644 index bb32772b8dc..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A tag associated with a resource. - */ -public class V2PolicyResourceTag extends GenericModel { - - /** - * The operator of an access management tag. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - } - - protected String key; - protected String value; - protected String operator; - - /** - * Builder. - */ - public static class Builder { - private String key; - private String value; - private String operator; - - /** - * Instantiates a new Builder from an existing V2PolicyResourceTag instance. - * - * @param v2PolicyResourceTag the instance to initialize the Builder with - */ - private Builder(V2PolicyResourceTag v2PolicyResourceTag) { - this.key = v2PolicyResourceTag.key; - this.value = v2PolicyResourceTag.value; - this.operator = v2PolicyResourceTag.operator; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param value the value - * @param operator the operator - */ - public Builder(String key, String value, String operator) { - this.key = key; - this.value = value; - this.operator = operator; - } - - /** - * Builds a V2PolicyResourceTag. - * - * @return the new V2PolicyResourceTag instance - */ - public V2PolicyResourceTag build() { - return new V2PolicyResourceTag(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the V2PolicyResourceTag builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the V2PolicyResourceTag builder - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicyResourceTag builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - } - - protected V2PolicyResourceTag() { } - - protected V2PolicyResourceTag(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - key = builder.key; - value = builder.value; - operator = builder.operator; - } - - /** - * New builder. - * - * @return a V2PolicyResourceTag builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the key. - * - * The name of an access management tag. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the value. - * - * The value of an access management tag. - * - * @return the value - */ - public String value() { - return value; - } - - /** - * Gets the operator. - * - * The operator of an access management tag. - * - * @return the operator - */ - public String operator() { - return operator; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java deleted file mode 100644 index 13a9f5fbd94..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Additional access conditions associated with the policy. - * - * Classes which extend this class: - * - V2PolicyRuleRuleAttribute - * - V2PolicyRuleRuleWithNestedConditions - */ -public class V2PolicyRule extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - protected String key; - protected String operator; - protected Object value; - protected List conditions; - - protected V2PolicyRule() { } - - /** - * Gets the key. - * - * The name of an attribute. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } - - /** - * Gets the conditions. - * - * List of conditions associated with a policy. For example, time-based conditions that grant access over a certain - * time period. - * - * @return the conditions - */ - public List conditions() { - return conditions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java deleted file mode 100644 index c20b3a8cb0c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * Rule that specifies additional access that is granted (For example, time-based condition). - */ -public class V2PolicyRuleRuleAttribute extends V2PolicyRule { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing V2PolicyRuleRuleAttribute instance. - * - * @param v2PolicyRuleRuleAttribute the instance to initialize the Builder with - */ - public Builder(V2PolicyRule v2PolicyRuleRuleAttribute) { - this.key = v2PolicyRuleRuleAttribute.key; - this.operator = v2PolicyRuleRuleAttribute.operator; - this.value = v2PolicyRuleRuleAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a V2PolicyRuleRuleAttribute. - * - * @return the new V2PolicyRuleRuleAttribute instance - */ - public V2PolicyRuleRuleAttribute build() { - return new V2PolicyRuleRuleAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the V2PolicyRuleRuleAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicyRuleRuleAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the V2PolicyRuleRuleAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected V2PolicyRuleRuleAttribute() { } - - protected V2PolicyRuleRuleAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a V2PolicyRuleRuleAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java deleted file mode 100644 index 8d6e57920f9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * Rule that specifies additional access that is granted (for example, time-based condition) accross multiple - * conditions. - */ -public class V2PolicyRuleRuleWithNestedConditions extends V2PolicyRule { - - /** - * Operator to evaluate conditions. - */ - public interface Operator { - /** and. */ - String AND = "and"; - /** or. */ - String OR = "or"; - } - - - /** - * Builder. - */ - public static class Builder { - private String operator; - private List conditions; - - /** - * Instantiates a new Builder from an existing V2PolicyRuleRuleWithNestedConditions instance. - * - * @param v2PolicyRuleRuleWithNestedConditions the instance to initialize the Builder with - */ - public Builder(V2PolicyRule v2PolicyRuleRuleWithNestedConditions) { - this.operator = v2PolicyRuleRuleWithNestedConditions.operator; - this.conditions = v2PolicyRuleRuleWithNestedConditions.conditions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param operator the operator - * @param conditions the conditions - */ - public Builder(String operator, List conditions) { - this.operator = operator; - this.conditions = conditions; - } - - /** - * Builds a V2PolicyRuleRuleWithNestedConditions. - * - * @return the new V2PolicyRuleRuleWithNestedConditions instance - */ - public V2PolicyRuleRuleWithNestedConditions build() { - return new V2PolicyRuleRuleWithNestedConditions(this); - } - - /** - * Adds a new element to conditions. - * - * @param conditions the new element to be added - * @return the V2PolicyRuleRuleWithNestedConditions builder - */ - public Builder addConditions(NestedCondition conditions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(conditions, - "conditions cannot be null"); - if (this.conditions == null) { - this.conditions = new ArrayList(); - } - this.conditions.add(conditions); - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicyRuleRuleWithNestedConditions builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the conditions. - * Existing conditions will be replaced. - * - * @param conditions the conditions - * @return the V2PolicyRuleRuleWithNestedConditions builder - */ - public Builder conditions(List conditions) { - this.conditions = conditions; - return this; - } - } - - protected V2PolicyRuleRuleWithNestedConditions() { } - - protected V2PolicyRuleRuleWithNestedConditions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.conditions, - "conditions cannot be null"); - operator = builder.operator; - conditions = builder.conditions; - } - - /** - * New builder. - * - * @return a V2PolicyRuleRuleWithNestedConditions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java deleted file mode 100644 index 891513fd45a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The subject attributes for whom the policy grants access. - */ -public class V2PolicySubject extends GenericModel { - - protected List attributes; - - /** - * Builder. - */ - public static class Builder { - private List attributes; - - /** - * Instantiates a new Builder from an existing V2PolicySubject instance. - * - * @param v2PolicySubject the instance to initialize the Builder with - */ - private Builder(V2PolicySubject v2PolicySubject) { - this.attributes = v2PolicySubject.attributes; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param attributes the attributes - */ - public Builder(List attributes) { - this.attributes = attributes; - } - - /** - * Builds a V2PolicySubject. - * - * @return the new V2PolicySubject instance - */ - public V2PolicySubject build() { - return new V2PolicySubject(this); - } - - /** - * Adds a new element to attributes. - * - * @param attributes the new element to be added - * @return the V2PolicySubject builder - */ - public Builder addAttributes(V2PolicySubjectAttribute attributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, - "attributes cannot be null"); - if (this.attributes == null) { - this.attributes = new ArrayList(); - } - this.attributes.add(attributes); - return this; - } - - /** - * Set the attributes. - * Existing attributes will be replaced. - * - * @param attributes the attributes - * @return the V2PolicySubject builder - */ - public Builder attributes(List attributes) { - this.attributes = attributes; - return this; - } - } - - protected V2PolicySubject() { } - - protected V2PolicySubject(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, - "attributes cannot be null"); - attributes = builder.attributes; - } - - /** - * New builder. - * - * @return a V2PolicySubject builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the attributes. - * - * List of subject attributes associated with policy. - * - * @return the attributes - */ - public List attributes() { - return attributes; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java deleted file mode 100644 index c90606429df..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Subject attribute for whom the policy grants access. - */ -public class V2PolicySubjectAttribute extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - } - - protected String key; - protected String operator; - protected Object value; - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing V2PolicySubjectAttribute instance. - * - * @param v2PolicySubjectAttribute the instance to initialize the Builder with - */ - private Builder(V2PolicySubjectAttribute v2PolicySubjectAttribute) { - this.key = v2PolicySubjectAttribute.key; - this.operator = v2PolicySubjectAttribute.operator; - this.value = v2PolicySubjectAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a V2PolicySubjectAttribute. - * - * @return the new V2PolicySubjectAttribute instance - */ - public V2PolicySubjectAttribute build() { - return new V2PolicySubjectAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the V2PolicySubjectAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicySubjectAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the V2PolicySubjectAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected V2PolicySubjectAttribute() { } - - protected V2PolicySubjectAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a V2PolicySubjectAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the key. - * - * The name of a subject attribute. For example, iam_id, access_group_id. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java deleted file mode 100644 index 720f7b57d4e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the policy. - */ -public class V2PolicyTemplateMetaData extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - /** - * The policy state, either 'deleted' or 'active'. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String type; - protected String description; - protected V2PolicySubject subject; - protected V2PolicyResource resource; - protected String pattern; - protected V2PolicyRule rule; - protected String id; - protected String href; - protected ControlResponse control; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String state; - @SerializedName("last_permit_at") - protected String lastPermitAt; - @SerializedName("last_permit_frequency") - protected Long lastPermitFrequency; - protected TemplateMetadata template; - - protected V2PolicyTemplateMetaData() { } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject getSubject() { - return subject; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource getResource() { - return resource; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String getPattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule getRule() { - return rule; - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the policies API by policy ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the control. - * - * @return the control - */ - public ControlResponse getControl() { - return control; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the state. - * - * The policy state, either 'deleted' or 'active'. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the lastPermitAt. - * - * The optional last permit time of policy, when passing query parameter format=include_last_permit. - * - * @return the lastPermitAt - */ - public String getLastPermitAt() { - return lastPermitAt; - } - - /** - * Gets the lastPermitFrequency. - * - * The optional count of times that policy has provided a permit, when passing query parameter - * format=include_last_permit. - * - * @return the lastPermitFrequency - */ - public Long getLastPermitFrequency() { - return lastPermitFrequency; - } - - /** - * Gets the template. - * - * The details of the IAM template that was used to create an enterprise-managed policy in your account. When - * returned, this indicates that the policy is created from and managed by a template in the root enterprise account. - * - * @return the template - */ - public TemplateMetadata getTemplate() { - return template; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java deleted file mode 100644 index 63a87389391..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * (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. - */ - -/** - * IAM Policy Management v1. - */ -package com.ibm.cloud.platform_services.iam_policy_management.v1; diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java deleted file mode 100644 index b38933306a6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java +++ /dev/null @@ -1,5007 +0,0 @@ -/* - * (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_policy_management.v1; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplatesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponse; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControlWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedCondition; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleWithConditions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PoliciesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplatesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoleReferences; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PoliciesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRule; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleWithNestedConditions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.utils.TestUtilities; -import com.ibm.cloud.sdk.core.http.Response; -import com.ibm.cloud.sdk.core.security.Authenticator; -import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import okhttp3.mockwebserver.MockResponse; -import okhttp3.mockwebserver.MockWebServer; -import okhttp3.mockwebserver.RecordedRequest; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; -import static org.testng.Assert.*; - -/** - * Unit test class for the IamPolicyManagement service. - */ -public class IamPolicyManagementTest { - - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - protected MockWebServer server; - protected IamPolicyManagement iamPolicyManagementService; - - // Construct the service with a null authenticator (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testConstructorWithNullAuthenticator() throws Throwable { - final String serviceName = "testService"; - new IamPolicyManagement(serviceName, null); - } - - // Test the listPolicies operation with a valid options model parameter - @Test - public void testListPoliciesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policies\": [{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}]}"; - String listPoliciesPath = "/v1/policies"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListPoliciesOptions model - ListPoliciesOptions listPoliciesOptionsModel = new ListPoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .tagName("testString") - .tagValue("testString") - .sort("id") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listPolicies() with a valid options model and verify the result - Response response = iamPolicyManagementService.listPolicies(listPoliciesOptionsModel).execute(); - assertNotNull(response); - PolicyCollection 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, listPoliciesPath); - // 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("access_group_id"), "testString"); - assertEquals(query.get("type"), "access"); - assertEquals(query.get("service_type"), "service"); - assertEquals(query.get("tag_name"), "testString"); - assertEquals(query.get("tag_value"), "testString"); - assertEquals(query.get("sort"), "id"); - assertEquals(query.get("format"), "include_last_permit"); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listPolicies operation with and without retries enabled - @Test - public void testListPoliciesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListPoliciesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListPoliciesWOptions(); - } - - // Test the listPolicies operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPoliciesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listPolicies(null).execute(); - } - - // Test the listPolicies operation using the PoliciesPager.getNext() method - @Test - public void testListPoliciesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPoliciesOptions listPoliciesOptions = new ListPoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .tagName("testString") - .tagValue("testString") - .sort("id") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - PoliciesPager pager = new PoliciesPager(iamPolicyManagementService, listPoliciesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listPolicies operation using the PoliciesPager.getAll() method - @Test - public void testListPoliciesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPoliciesOptions listPoliciesOptions = new ListPoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .tagName("testString") - .tagValue("testString") - .sort("id") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - PoliciesPager pager = new PoliciesPager(iamPolicyManagementService, listPoliciesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createPolicy operation with a valid options model parameter - @Test - public void testCreatePolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; - String createPolicyPath = "/v1/policies"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the SubjectAttribute model - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - - // Construct an instance of the PolicySubject model - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - - // Construct an instance of the PolicyRole model - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the ResourceAttribute model - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - - // Construct an instance of the ResourceTag model - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - - // Construct an instance of the PolicyResource model - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - - // Construct an instance of the CreatePolicyOptions model - CreatePolicyOptions createPolicyOptionsModel = new CreatePolicyOptions.Builder() - .type("testString") - .subjects(java.util.Arrays.asList(policySubjectModel)) - .roles(java.util.Arrays.asList(policyRoleModel)) - .resources(java.util.Arrays.asList(policyResourceModel)) - .description("testString") - .acceptLanguage("default") - .build(); - - // Invoke createPolicy() with a valid options model and verify the result - Response response = iamPolicyManagementService.createPolicy(createPolicyOptionsModel).execute(); - assertNotNull(response); - Policy 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createPolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createPolicy operation with and without retries enabled - @Test - public void testCreatePolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreatePolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreatePolicyWOptions(); - } - - // Test the createPolicy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createPolicy(null).execute(); - } - - // Test the replacePolicy operation with a valid options model parameter - @Test - public void testReplacePolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; - String replacePolicyPath = "/v1/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the SubjectAttribute model - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - - // Construct an instance of the PolicySubject model - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - - // Construct an instance of the PolicyRole model - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the ResourceAttribute model - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - - // Construct an instance of the ResourceTag model - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - - // Construct an instance of the PolicyResource model - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - - // Construct an instance of the ReplacePolicyOptions model - ReplacePolicyOptions replacePolicyOptionsModel = new ReplacePolicyOptions.Builder() - .policyId("testString") - .ifMatch("testString") - .type("testString") - .subjects(java.util.Arrays.asList(policySubjectModel)) - .roles(java.util.Arrays.asList(policyRoleModel)) - .resources(java.util.Arrays.asList(policyResourceModel)) - .description("testString") - .build(); - - // Invoke replacePolicy() with a valid options model and verify the result - Response response = iamPolicyManagementService.replacePolicy(replacePolicyOptionsModel).execute(); - assertNotNull(response); - Policy 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, replacePolicyPath); - // 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 replacePolicy operation with and without retries enabled - @Test - public void testReplacePolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplacePolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplacePolicyWOptions(); - } - - // Test the replacePolicy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplacePolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replacePolicy(null).execute(); - } - - // Test the getPolicy operation with a valid options model parameter - @Test - public void testGetPolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}"; - String getPolicyPath = "/v1/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetPolicyOptions model - GetPolicyOptions getPolicyOptionsModel = new GetPolicyOptions.Builder() - .policyId("testString") - .build(); - - // Invoke getPolicy() with a valid options model and verify the result - Response response = iamPolicyManagementService.getPolicy(getPolicyOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateMetaData 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, getPolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getPolicy operation with and without retries enabled - @Test - public void testGetPolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetPolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetPolicyWOptions(); - } - - // Test the getPolicy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getPolicy(null).execute(); - } - - // Test the deletePolicy operation with a valid options model parameter - @Test - public void testDeletePolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deletePolicyPath = "/v1/policies/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeletePolicyOptions model - DeletePolicyOptions deletePolicyOptionsModel = new DeletePolicyOptions.Builder() - .policyId("testString") - .build(); - - // Invoke deletePolicy() with a valid options model and verify the result - Response response = iamPolicyManagementService.deletePolicy(deletePolicyOptionsModel).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, deletePolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deletePolicy operation with and without retries enabled - @Test - public void testDeletePolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeletePolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeletePolicyWOptions(); - } - - // Test the deletePolicy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deletePolicy(null).execute(); - } - - // Test the updatePolicyState operation with a valid options model parameter - @Test - public void testUpdatePolicyStateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; - String updatePolicyStatePath = "/v1/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdatePolicyStateOptions model - UpdatePolicyStateOptions updatePolicyStateOptionsModel = new UpdatePolicyStateOptions.Builder() - .policyId("testString") - .ifMatch("testString") - .state("active") - .build(); - - // Invoke updatePolicyState() with a valid options model and verify the result - Response response = iamPolicyManagementService.updatePolicyState(updatePolicyStateOptionsModel).execute(); - assertNotNull(response); - Policy 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updatePolicyStatePath); - // 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 updatePolicyState operation with and without retries enabled - @Test - public void testUpdatePolicyStateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdatePolicyStateWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdatePolicyStateWOptions(); - } - - // Test the updatePolicyState operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdatePolicyStateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updatePolicyState(null).execute(); - } - - // Test the listRoles operation with a valid options model parameter - @Test - public void testListRolesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"custom_roles\": [{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}], \"service_roles\": [{\"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\"}], \"system_roles\": [{\"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\"}]}"; - String listRolesPath = "/v2/roles"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListRolesOptions model - ListRolesOptions listRolesOptionsModel = new ListRolesOptions.Builder() - .acceptLanguage("default") - .accountId("testString") - .serviceName("iam-groups") - .sourceServiceName("iam-groups") - .policyType("authorization") - .serviceGroupId("IAM") - .build(); - - // Invoke listRoles() with a valid options model and verify the result - Response response = iamPolicyManagementService.listRoles(listRolesOptionsModel).execute(); - assertNotNull(response); - RoleCollection 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, listRolesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("service_name"), "iam-groups"); - assertEquals(query.get("source_service_name"), "iam-groups"); - assertEquals(query.get("policy_type"), "authorization"); - assertEquals(query.get("service_group_id"), "IAM"); - } - - // Test the listRoles operation with and without retries enabled - @Test - public void testListRolesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListRolesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListRolesWOptions(); - } - - // Test the createRole operation with a valid options model parameter - @Test - public void testCreateRoleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; - String createRolePath = "/v2/roles"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the CreateRoleOptions model - CreateRoleOptions createRoleOptionsModel = new CreateRoleOptions.Builder() - .displayName("testString") - .actions(java.util.Arrays.asList("testString")) - .name("Developer") - .accountId("testString") - .serviceName("iam-groups") - .description("testString") - .acceptLanguage("default") - .build(); - - // Invoke createRole() with a valid options model and verify the result - Response response = iamPolicyManagementService.createRole(createRoleOptionsModel).execute(); - assertNotNull(response); - CustomRole 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createRolePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createRole operation with and without retries enabled - @Test - public void testCreateRoleWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateRoleWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateRoleWOptions(); - } - - // Test the createRole operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createRole(null).execute(); - } - - // Test the replaceRole operation with a valid options model parameter - @Test - public void testReplaceRoleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; - String replaceRolePath = "/v2/roles/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ReplaceRoleOptions model - ReplaceRoleOptions replaceRoleOptionsModel = new ReplaceRoleOptions.Builder() - .roleId("testString") - .ifMatch("testString") - .displayName("testString") - .actions(java.util.Arrays.asList("testString")) - .description("testString") - .build(); - - // Invoke replaceRole() with a valid options model and verify the result - Response response = iamPolicyManagementService.replaceRole(replaceRoleOptionsModel).execute(); - assertNotNull(response); - CustomRole 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, replaceRolePath); - // 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 replaceRole operation with and without retries enabled - @Test - public void testReplaceRoleWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplaceRoleWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplaceRoleWOptions(); - } - - // Test the replaceRole operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceRoleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replaceRole(null).execute(); - } - - // Test the getRole operation with a valid options model parameter - @Test - public void testGetRoleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; - String getRolePath = "/v2/roles/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetRoleOptions model - GetRoleOptions getRoleOptionsModel = new GetRoleOptions.Builder() - .roleId("testString") - .build(); - - // Invoke getRole() with a valid options model and verify the result - Response response = iamPolicyManagementService.getRole(getRoleOptionsModel).execute(); - assertNotNull(response); - CustomRole 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, getRolePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getRole operation with and without retries enabled - @Test - public void testGetRoleWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetRoleWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetRoleWOptions(); - } - - // Test the getRole operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getRole(null).execute(); - } - - // Test the deleteRole operation with a valid options model parameter - @Test - public void testDeleteRoleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteRolePath = "/v2/roles/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteRoleOptions model - DeleteRoleOptions deleteRoleOptionsModel = new DeleteRoleOptions.Builder() - .roleId("testString") - .build(); - - // Invoke deleteRole() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteRole(deleteRoleOptionsModel).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, deleteRolePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteRole operation with and without retries enabled - @Test - public void testDeleteRoleWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteRoleWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteRoleWOptions(); - } - - // Test the deleteRole operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteRole(null).execute(); - } - - // Test the listV2Policies operation with a valid options model parameter - @Test - public void testListV2PoliciesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policies\": [{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19, \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}]}"; - String listV2PoliciesPath = "/v2/policies"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListV2PoliciesOptions model - ListV2PoliciesOptions listV2PoliciesOptionsModel = new ListV2PoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .serviceName("testString") - .serviceGroupId("testString") - .sort("testString") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listV2Policies() with a valid options model and verify the result - Response response = iamPolicyManagementService.listV2Policies(listV2PoliciesOptionsModel).execute(); - assertNotNull(response); - V2PolicyCollection 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, listV2PoliciesPath); - // 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("access_group_id"), "testString"); - assertEquals(query.get("type"), "access"); - assertEquals(query.get("service_type"), "service"); - assertEquals(query.get("service_name"), "testString"); - assertEquals(query.get("service_group_id"), "testString"); - assertEquals(query.get("sort"), "testString"); - assertEquals(query.get("format"), "include_last_permit"); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listV2Policies operation with and without retries enabled - @Test - public void testListV2PoliciesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListV2PoliciesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListV2PoliciesWOptions(); - } - - // Test the listV2Policies operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListV2PoliciesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listV2Policies(null).execute(); - } - - // Test the listV2Policies operation using the V2PoliciesPager.getNext() method - @Test - public void testListV2PoliciesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListV2PoliciesOptions listV2PoliciesOptions = new ListV2PoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .serviceName("testString") - .serviceGroupId("testString") - .sort("testString") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - V2PoliciesPager pager = new V2PoliciesPager(iamPolicyManagementService, listV2PoliciesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listV2Policies operation using the V2PoliciesPager.getAll() method - @Test - public void testListV2PoliciesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListV2PoliciesOptions listV2PoliciesOptions = new ListV2PoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .serviceName("testString") - .serviceGroupId("testString") - .sort("testString") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - V2PoliciesPager pager = new V2PoliciesPager(iamPolicyManagementService, listV2PoliciesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createV2Policy operation with a valid options model parameter - @Test - public void testCreateV2PolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19}"; - String createV2PolicyPath = "/v2/policies"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the Grant model - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the Control model - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the CreateV2PolicyOptions model - CreateV2PolicyOptions createV2PolicyOptionsModel = new CreateV2PolicyOptions.Builder() - .control(controlModel) - .type("access") - .description("testString") - .subject(v2PolicySubjectModel) - .resource(v2PolicyResourceModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .acceptLanguage("default") - .build(); - - // Invoke createV2Policy() with a valid options model and verify the result - Response response = iamPolicyManagementService.createV2Policy(createV2PolicyOptionsModel).execute(); - assertNotNull(response); - V2Policy 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createV2PolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createV2Policy operation with and without retries enabled - @Test - public void testCreateV2PolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateV2PolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateV2PolicyWOptions(); - } - - // Test the createV2Policy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateV2PolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createV2Policy(null).execute(); - } - - // Test the replaceV2Policy operation with a valid options model parameter - @Test - public void testReplaceV2PolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19}"; - String replaceV2PolicyPath = "/v2/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the Grant model - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the Control model - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the ReplaceV2PolicyOptions model - ReplaceV2PolicyOptions replaceV2PolicyOptionsModel = new ReplaceV2PolicyOptions.Builder() - .id("testString") - .ifMatch("testString") - .control(controlModel) - .type("access") - .description("testString") - .subject(v2PolicySubjectModel) - .resource(v2PolicyResourceModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .build(); - - // Invoke replaceV2Policy() with a valid options model and verify the result - Response response = iamPolicyManagementService.replaceV2Policy(replaceV2PolicyOptionsModel).execute(); - assertNotNull(response); - V2Policy 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, replaceV2PolicyPath); - // 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 replaceV2Policy operation with and without retries enabled - @Test - public void testReplaceV2PolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplaceV2PolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplaceV2PolicyWOptions(); - } - - // Test the replaceV2Policy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceV2PolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replaceV2Policy(null).execute(); - } - - // Test the getV2Policy operation with a valid options model parameter - @Test - public void testGetV2PolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19, \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}"; - String getV2PolicyPath = "/v2/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetV2PolicyOptions model - GetV2PolicyOptions getV2PolicyOptionsModel = new GetV2PolicyOptions.Builder() - .id("testString") - .format("include_last_permit") - .build(); - - // Invoke getV2Policy() with a valid options model and verify the result - Response response = iamPolicyManagementService.getV2Policy(getV2PolicyOptionsModel).execute(); - assertNotNull(response); - V2PolicyTemplateMetaData 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, getV2PolicyPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("format"), "include_last_permit"); - } - - // Test the getV2Policy operation with and without retries enabled - @Test - public void testGetV2PolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetV2PolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetV2PolicyWOptions(); - } - - // Test the getV2Policy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetV2PolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getV2Policy(null).execute(); - } - - // Test the deleteV2Policy operation with a valid options model parameter - @Test - public void testDeleteV2PolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteV2PolicyPath = "/v2/policies/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteV2PolicyOptions model - DeleteV2PolicyOptions deleteV2PolicyOptionsModel = new DeleteV2PolicyOptions.Builder() - .id("testString") - .build(); - - // Invoke deleteV2Policy() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteV2Policy(deleteV2PolicyOptionsModel).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, deleteV2PolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteV2Policy operation with and without retries enabled - @Test - public void testDeleteV2PolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteV2PolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteV2PolicyWOptions(); - } - - // Test the deleteV2Policy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteV2PolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteV2Policy(null).execute(); - } - - // Test the listPolicyTemplates operation with a valid options model parameter - @Test - public void testListPolicyTemplatesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policy_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; - String listPolicyTemplatesPath = "/v1/policy_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListPolicyTemplatesOptions model - ListPolicyTemplatesOptions listPolicyTemplatesOptionsModel = new ListPolicyTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .state("active") - .name("testString") - .policyServiceType("service") - .policyServiceName("testString") - .policyServiceGroupId("testString") - .policyType("access") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listPolicyTemplates() with a valid options model and verify the result - Response response = iamPolicyManagementService.listPolicyTemplates(listPolicyTemplatesOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateCollection 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, listPolicyTemplatesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("state"), "active"); - assertEquals(query.get("name"), "testString"); - assertEquals(query.get("policy_service_type"), "service"); - assertEquals(query.get("policy_service_name"), "testString"); - assertEquals(query.get("policy_service_group_id"), "testString"); - assertEquals(query.get("policy_type"), "access"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listPolicyTemplates operation with and without retries enabled - @Test - public void testListPolicyTemplatesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListPolicyTemplatesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListPolicyTemplatesWOptions(); - } - - // Test the listPolicyTemplates operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyTemplatesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listPolicyTemplates(null).execute(); - } - - // Test the listPolicyTemplates operation using the PolicyTemplatesPager.getNext() method - @Test - public void testListPolicyTemplatesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyTemplatesOptions listPolicyTemplatesOptions = new ListPolicyTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .state("active") - .name("testString") - .policyServiceType("service") - .policyServiceName("testString") - .policyServiceGroupId("testString") - .policyType("access") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - PolicyTemplatesPager pager = new PolicyTemplatesPager(iamPolicyManagementService, listPolicyTemplatesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listPolicyTemplates operation using the PolicyTemplatesPager.getAll() method - @Test - public void testListPolicyTemplatesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyTemplatesOptions listPolicyTemplatesOptions = new ListPolicyTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .state("active") - .name("testString") - .policyServiceType("service") - .policyServiceName("testString") - .policyServiceGroupId("testString") - .policyType("access") - .limit(Long.valueOf("10")) - .build(); - - PolicyTemplatesPager pager = new PolicyTemplatesPager(iamPolicyManagementService, listPolicyTemplatesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createPolicyTemplate operation with a valid options model parameter - @Test - public void testCreatePolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; - String createPolicyTemplatePath = "/v1/policy_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the TemplateGrantRoles model - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the TemplateControl model - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - - // Construct an instance of the TemplatePolicy model - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - - // Construct an instance of the CreatePolicyTemplateOptions model - CreatePolicyTemplateOptions createPolicyTemplateOptionsModel = new CreatePolicyTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .policy(templatePolicyModel) - .description("testString") - .committed(true) - .acceptLanguage("default") - .build(); - - // Invoke createPolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.createPolicyTemplate(createPolicyTemplateOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateLimitData 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createPolicyTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createPolicyTemplate operation with and without retries enabled - @Test - public void testCreatePolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreatePolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreatePolicyTemplateWOptions(); - } - - // Test the createPolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createPolicyTemplate(null).execute(); - } - - // Test the getPolicyTemplate operation with a valid options model parameter - @Test - public void testGetPolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String getPolicyTemplatePath = "/v1/policy_templates/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetPolicyTemplateOptions model - GetPolicyTemplateOptions getPolicyTemplateOptionsModel = new GetPolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .state("active") - .build(); - - // Invoke getPolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.getPolicyTemplate(getPolicyTemplateOptionsModel).execute(); - assertNotNull(response); - PolicyTemplate 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, getPolicyTemplatePath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - } - - // Test the getPolicyTemplate operation with and without retries enabled - @Test - public void testGetPolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetPolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetPolicyTemplateWOptions(); - } - - // Test the getPolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getPolicyTemplate(null).execute(); - } - - // Test the deletePolicyTemplate operation with a valid options model parameter - @Test - public void testDeletePolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deletePolicyTemplatePath = "/v1/policy_templates/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeletePolicyTemplateOptions model - DeletePolicyTemplateOptions deletePolicyTemplateOptionsModel = new DeletePolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .build(); - - // Invoke deletePolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.deletePolicyTemplate(deletePolicyTemplateOptionsModel).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, deletePolicyTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deletePolicyTemplate operation with and without retries enabled - @Test - public void testDeletePolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeletePolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeletePolicyTemplateWOptions(); - } - - // Test the deletePolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deletePolicyTemplate(null).execute(); - } - - // Test the createPolicyTemplateVersion operation with a valid options model parameter - @Test - public void testCreatePolicyTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; - String createPolicyTemplateVersionPath = "/v1/policy_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the TemplateGrantRoles model - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the TemplateControl model - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - - // Construct an instance of the TemplatePolicy model - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - - // Construct an instance of the CreatePolicyTemplateVersionOptions model - CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptionsModel = new CreatePolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .policy(templatePolicyModel) - .name("testString") - .description("testString") - .committed(true) - .build(); - - // Invoke createPolicyTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.createPolicyTemplateVersion(createPolicyTemplateVersionOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateLimitData 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createPolicyTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createPolicyTemplateVersion operation with and without retries enabled - @Test - public void testCreatePolicyTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreatePolicyTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreatePolicyTemplateVersionWOptions(); - } - - // Test the createPolicyTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createPolicyTemplateVersion(null).execute(); - } - - // Test the listPolicyTemplateVersions operation with a valid options model parameter - @Test - public void testListPolicyTemplateVersionsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; - String listPolicyTemplateVersionsPath = "/v1/policy_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListPolicyTemplateVersionsOptions model - ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptionsModel = new ListPolicyTemplateVersionsOptions.Builder() - .policyTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listPolicyTemplateVersions() with a valid options model and verify the result - Response response = iamPolicyManagementService.listPolicyTemplateVersions(listPolicyTemplateVersionsOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateVersionsCollection 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, listPolicyTemplateVersionsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listPolicyTemplateVersions operation with and without retries enabled - @Test - public void testListPolicyTemplateVersionsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListPolicyTemplateVersionsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListPolicyTemplateVersionsWOptions(); - } - - // Test the listPolicyTemplateVersions operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyTemplateVersionsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listPolicyTemplateVersions(null).execute(); - } - - // Test the listPolicyTemplateVersions operation using the PolicyTemplateVersionsPager.getNext() method - @Test - public void testListPolicyTemplateVersionsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions = new ListPolicyTemplateVersionsOptions.Builder() - .policyTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - PolicyTemplateVersionsPager pager = new PolicyTemplateVersionsPager(iamPolicyManagementService, listPolicyTemplateVersionsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listPolicyTemplateVersions operation using the PolicyTemplateVersionsPager.getAll() method - @Test - public void testListPolicyTemplateVersionsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions = new ListPolicyTemplateVersionsOptions.Builder() - .policyTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - PolicyTemplateVersionsPager pager = new PolicyTemplateVersionsPager(iamPolicyManagementService, listPolicyTemplateVersionsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the replacePolicyTemplate operation with a valid options model parameter - @Test - public void testReplacePolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String replacePolicyTemplatePath = "/v1/policy_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the TemplateGrantRoles model - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the TemplateControl model - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - - // Construct an instance of the TemplatePolicy model - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - - // Construct an instance of the ReplacePolicyTemplateOptions model - ReplacePolicyTemplateOptions replacePolicyTemplateOptionsModel = new ReplacePolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .ifMatch("testString") - .policy(templatePolicyModel) - .name("testString") - .description("testString") - .committed(true) - .build(); - - // Invoke replacePolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.replacePolicyTemplate(replacePolicyTemplateOptionsModel).execute(); - assertNotNull(response); - PolicyTemplate 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, replacePolicyTemplatePath); - // 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 replacePolicyTemplate operation with and without retries enabled - @Test - public void testReplacePolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplacePolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplacePolicyTemplateWOptions(); - } - - // Test the replacePolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplacePolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replacePolicyTemplate(null).execute(); - } - - // Test the deletePolicyTemplateVersion operation with a valid options model parameter - @Test - public void testDeletePolicyTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deletePolicyTemplateVersionPath = "/v1/policy_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeletePolicyTemplateVersionOptions model - DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptionsModel = new DeletePolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - - // Invoke deletePolicyTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.deletePolicyTemplateVersion(deletePolicyTemplateVersionOptionsModel).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, deletePolicyTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deletePolicyTemplateVersion operation with and without retries enabled - @Test - public void testDeletePolicyTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeletePolicyTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeletePolicyTemplateVersionWOptions(); - } - - // Test the deletePolicyTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deletePolicyTemplateVersion(null).execute(); - } - - // Test the getPolicyTemplateVersion operation with a valid options model parameter - @Test - public void testGetPolicyTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String getPolicyTemplateVersionPath = "/v1/policy_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetPolicyTemplateVersionOptions model - GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptionsModel = new GetPolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - - // Invoke getPolicyTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.getPolicyTemplateVersion(getPolicyTemplateVersionOptionsModel).execute(); - assertNotNull(response); - PolicyTemplate 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, getPolicyTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getPolicyTemplateVersion operation with and without retries enabled - @Test - public void testGetPolicyTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetPolicyTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetPolicyTemplateVersionWOptions(); - } - - // Test the getPolicyTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getPolicyTemplateVersion(null).execute(); - } - - // Test the commitPolicyTemplate operation with a valid options model parameter - @Test - public void testCommitPolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String commitPolicyTemplatePath = "/v1/policy_templates/testString/versions/testString/commit"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the CommitPolicyTemplateOptions model - CommitPolicyTemplateOptions commitPolicyTemplateOptionsModel = new CommitPolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - - // Invoke commitPolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.commitPolicyTemplate(commitPolicyTemplateOptionsModel).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, commitPolicyTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the commitPolicyTemplate operation with and without retries enabled - @Test - public void testCommitPolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCommitPolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCommitPolicyTemplateWOptions(); - } - - // Test the commitPolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitPolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.commitPolicyTemplate(null).execute(); - } - - // Test the listPolicyAssignments operation with a valid options model parameter - @Test - public void testListPolicyAssignmentsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}]}"; - String listPolicyAssignmentsPath = "/v1/policy_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListPolicyAssignmentsOptions model - ListPolicyAssignmentsOptions listPolicyAssignmentsOptionsModel = new ListPolicyAssignmentsOptions.Builder() - .version("1.0") - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listPolicyAssignments() with a valid options model and verify the result - Response response = iamPolicyManagementService.listPolicyAssignments(listPolicyAssignmentsOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateAssignmentCollection 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, listPolicyAssignmentsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "1.0"); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("template_id"), "testString"); - assertEquals(query.get("template_version"), "testString"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listPolicyAssignments operation with and without retries enabled - @Test - public void testListPolicyAssignmentsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListPolicyAssignmentsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListPolicyAssignmentsWOptions(); - } - - // Test the listPolicyAssignments operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyAssignmentsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listPolicyAssignments(null).execute(); - } - - // Test the listPolicyAssignments operation using the PolicyAssignmentsPager.getNext() method - @Test - public void testListPolicyAssignmentsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyAssignmentsOptions listPolicyAssignmentsOptions = new ListPolicyAssignmentsOptions.Builder() - .version("1.0") - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - PolicyAssignmentsPager pager = new PolicyAssignmentsPager(iamPolicyManagementService, listPolicyAssignmentsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listPolicyAssignments operation using the PolicyAssignmentsPager.getAll() method - @Test - public void testListPolicyAssignmentsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyAssignmentsOptions listPolicyAssignmentsOptions = new ListPolicyAssignmentsOptions.Builder() - .version("1.0") - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - PolicyAssignmentsPager pager = new PolicyAssignmentsPager(iamPolicyManagementService, listPolicyAssignmentsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createPolicyTemplateAssignment operation with a valid options model parameter - @Test - public void testCreatePolicyTemplateAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}]}"; - String createPolicyTemplateAssignmentPath = "/v1/policy_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the AssignmentTargetDetails model - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - - // Construct an instance of the AssignmentTemplateDetails model - AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() - .id("testString") - .version("testString") - .build(); - - // Construct an instance of the CreatePolicyTemplateAssignmentOptions model - CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptionsModel = new CreatePolicyTemplateAssignmentOptions.Builder() - .version("1.0") - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(assignmentTemplateDetailsModel)) - .acceptLanguage("default") - .build(); - - // Invoke createPolicyTemplateAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.createPolicyTemplateAssignment(createPolicyTemplateAssignmentOptionsModel).execute(); - assertNotNull(response); - PolicyAssignmentV1Collection 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createPolicyTemplateAssignmentPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "1.0"); - } - - // Test the createPolicyTemplateAssignment operation with and without retries enabled - @Test - public void testCreatePolicyTemplateAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreatePolicyTemplateAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreatePolicyTemplateAssignmentWOptions(); - } - - // Test the createPolicyTemplateAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createPolicyTemplateAssignment(null).execute(); - } - - // Test the getPolicyAssignment operation with a valid options model parameter - @Test - public void testGetPolicyAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}"; - String getPolicyAssignmentPath = "/v1/policy_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetPolicyAssignmentOptions model - GetPolicyAssignmentOptions getPolicyAssignmentOptionsModel = new GetPolicyAssignmentOptions.Builder() - .assignmentId("testString") - .version("1.0") - .build(); - - // Invoke getPolicyAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.getPolicyAssignment(getPolicyAssignmentOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateAssignmentItems 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, getPolicyAssignmentPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "1.0"); - } - - // Test the getPolicyAssignment operation with and without retries enabled - @Test - public void testGetPolicyAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetPolicyAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetPolicyAssignmentWOptions(); - } - - // Test the getPolicyAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getPolicyAssignment(null).execute(); - } - - // Test the updatePolicyAssignment operation with a valid options model parameter - @Test - public void testUpdatePolicyAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}"; - String updatePolicyAssignmentPath = "/v1/policy_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdatePolicyAssignmentOptions model - UpdatePolicyAssignmentOptions updatePolicyAssignmentOptionsModel = new UpdatePolicyAssignmentOptions.Builder() - .assignmentId("testString") - .version("1.0") - .ifMatch("testString") - .templateVersion("testString") - .build(); - - // Invoke updatePolicyAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.updatePolicyAssignment(updatePolicyAssignmentOptionsModel).execute(); - assertNotNull(response); - PolicyAssignmentV1 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updatePolicyAssignmentPath); - // Verify header parameters - assertEquals(request.getHeader("If-Match"), "testString"); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "1.0"); - } - - // Test the updatePolicyAssignment operation with and without retries enabled - @Test - public void testUpdatePolicyAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdatePolicyAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdatePolicyAssignmentWOptions(); - } - - // Test the updatePolicyAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdatePolicyAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updatePolicyAssignment(null).execute(); - } - - // Test the deletePolicyAssignment operation with a valid options model parameter - @Test - public void testDeletePolicyAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deletePolicyAssignmentPath = "/v1/policy_assignments/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeletePolicyAssignmentOptions model - DeletePolicyAssignmentOptions deletePolicyAssignmentOptionsModel = new DeletePolicyAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke deletePolicyAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.deletePolicyAssignment(deletePolicyAssignmentOptionsModel).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, deletePolicyAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deletePolicyAssignment operation with and without retries enabled - @Test - public void testDeletePolicyAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeletePolicyAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeletePolicyAssignmentWOptions(); - } - - // Test the deletePolicyAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deletePolicyAssignment(null).execute(); - } - - // Test the getSettings operation with a valid options model parameter - @Test - public void testGetSettingsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"external_account_identity_interaction\": {\"identity_types\": {\"user\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service_id\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}}}}"; - String getSettingsPath = "/v1/accounts/testString/settings/access_management"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetSettingsOptions model - GetSettingsOptions getSettingsOptionsModel = new GetSettingsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .build(); - - // Invoke getSettings() with a valid options model and verify the result - Response response = iamPolicyManagementService.getSettings(getSettingsOptionsModel).execute(); - assertNotNull(response); - AccountSettingsAccessManagement 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, getSettingsPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getSettings operation with and without retries enabled - @Test - public void testGetSettingsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetSettingsWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetSettingsWOptions(); - } - - // Test the getSettings operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetSettingsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getSettings(null).execute(); - } - - // Test the updateSettings operation with a valid options model parameter - @Test - public void testUpdateSettingsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"external_account_identity_interaction\": {\"identity_types\": {\"user\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service_id\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}}}}"; - String updateSettingsPath = "/v1/accounts/testString/settings/access_management"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the IdentityTypesBase model - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the IdentityTypesPatch model - IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() - .user(identityTypesBaseModel) - .serviceId(identityTypesBaseModel) - .service(identityTypesBaseModel) - .build(); - - // Construct an instance of the ExternalAccountIdentityInteractionPatch model - ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() - .identityTypes(identityTypesPatchModel) - .build(); - - // Construct an instance of the UpdateSettingsOptions model - UpdateSettingsOptions updateSettingsOptionsModel = new UpdateSettingsOptions.Builder() - .accountId("testString") - .ifMatch("testString") - .externalAccountIdentityInteraction(externalAccountIdentityInteractionPatchModel) - .acceptLanguage("default") - .build(); - - // Invoke updateSettings() with a valid options model and verify the result - Response response = iamPolicyManagementService.updateSettings(updateSettingsOptionsModel).execute(); - assertNotNull(response); - AccountSettingsAccessManagement 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateSettingsPath); - // 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 updateSettings operation with and without retries enabled - @Test - public void testUpdateSettingsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdateSettingsWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdateSettingsWOptions(); - } - - // Test the updateSettings operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateSettingsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updateSettings(null).execute(); - } - - // Test the listActionControlTemplates operation with a valid options model parameter - @Test - public void testListActionControlTemplatesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"action_control_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; - String listActionControlTemplatesPath = "/v1/action_control_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListActionControlTemplatesOptions model - ListActionControlTemplatesOptions listActionControlTemplatesOptionsModel = new ListActionControlTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listActionControlTemplates() with a valid options model and verify the result - Response response = iamPolicyManagementService.listActionControlTemplates(listActionControlTemplatesOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplateCollection 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, listActionControlTemplatesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listActionControlTemplates operation with and without retries enabled - @Test - public void testListActionControlTemplatesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListActionControlTemplatesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListActionControlTemplatesWOptions(); - } - - // Test the listActionControlTemplates operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlTemplatesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listActionControlTemplates(null).execute(); - } - - // Test the listActionControlTemplates operation using the ActionControlTemplatesPager.getNext() method - @Test - public void testListActionControlTemplatesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlTemplatesOptions listActionControlTemplatesOptions = new ListActionControlTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - ActionControlTemplatesPager pager = new ActionControlTemplatesPager(iamPolicyManagementService, listActionControlTemplatesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listActionControlTemplates operation using the ActionControlTemplatesPager.getAll() method - @Test - public void testListActionControlTemplatesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlTemplatesOptions listActionControlTemplatesOptions = new ListActionControlTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .limit(Long.valueOf("10")) - .build(); - - ActionControlTemplatesPager pager = new ActionControlTemplatesPager(iamPolicyManagementService, listActionControlTemplatesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createActionControlTemplate operation with a valid options model parameter - @Test - public void testCreateActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String createActionControlTemplatePath = "/v1/action_control_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateActionControl model - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the CreateActionControlTemplateOptions model - CreateActionControlTemplateOptions createActionControlTemplateOptionsModel = new CreateActionControlTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .description("testString") - .committed(true) - .actionControl(templateActionControlModel) - .acceptLanguage("default") - .build(); - - // Invoke createActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.createActionControlTemplate(createActionControlTemplateOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createActionControlTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createActionControlTemplate operation with and without retries enabled - @Test - public void testCreateActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateActionControlTemplateWOptions(); - } - - // Test the createActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createActionControlTemplate(null).execute(); - } - - // Test the getActionControlTemplate operation with a valid options model parameter - @Test - public void testGetActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String getActionControlTemplatePath = "/v1/action_control_templates/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetActionControlTemplateOptions model - GetActionControlTemplateOptions getActionControlTemplateOptionsModel = new GetActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .build(); - - // Invoke getActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.getActionControlTemplate(getActionControlTemplateOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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, getActionControlTemplatePath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - } - - // Test the getActionControlTemplate operation with and without retries enabled - @Test - public void testGetActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetActionControlTemplateWOptions(); - } - - // Test the getActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getActionControlTemplate(null).execute(); - } - - // Test the deleteActionControlTemplate operation with a valid options model parameter - @Test - public void testDeleteActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteActionControlTemplatePath = "/v1/action_control_templates/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteActionControlTemplateOptions model - DeleteActionControlTemplateOptions deleteActionControlTemplateOptionsModel = new DeleteActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .build(); - - // Invoke deleteActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteActionControlTemplate(deleteActionControlTemplateOptionsModel).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, deleteActionControlTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteActionControlTemplate operation with and without retries enabled - @Test - public void testDeleteActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteActionControlTemplateWOptions(); - } - - // Test the deleteActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteActionControlTemplate(null).execute(); - } - - // Test the createActionControlTemplateVersion operation with a valid options model parameter - @Test - public void testCreateActionControlTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String createActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateActionControl model - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the CreateActionControlTemplateVersionOptions model - CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptionsModel = new CreateActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .name("testString") - .description("testString") - .actionControl(templateActionControlModel) - .committed(true) - .build(); - - // Invoke createActionControlTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.createActionControlTemplateVersion(createActionControlTemplateVersionOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createActionControlTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createActionControlTemplateVersion operation with and without retries enabled - @Test - public void testCreateActionControlTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateActionControlTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateActionControlTemplateVersionWOptions(); - } - - // Test the createActionControlTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createActionControlTemplateVersion(null).execute(); - } - - // Test the listActionControlTemplateVersions operation with a valid options model parameter - @Test - public void testListActionControlTemplateVersionsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; - String listActionControlTemplateVersionsPath = "/v1/action_control_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListActionControlTemplateVersionsOptions model - ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptionsModel = new ListActionControlTemplateVersionsOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listActionControlTemplateVersions() with a valid options model and verify the result - Response response = iamPolicyManagementService.listActionControlTemplateVersions(listActionControlTemplateVersionsOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplateVersionsCollection 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, listActionControlTemplateVersionsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listActionControlTemplateVersions operation with and without retries enabled - @Test - public void testListActionControlTemplateVersionsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListActionControlTemplateVersionsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListActionControlTemplateVersionsWOptions(); - } - - // Test the listActionControlTemplateVersions operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlTemplateVersionsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listActionControlTemplateVersions(null).execute(); - } - - // Test the listActionControlTemplateVersions operation using the ActionControlTemplateVersionsPager.getNext() method - @Test - public void testListActionControlTemplateVersionsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions = new ListActionControlTemplateVersionsOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - ActionControlTemplateVersionsPager pager = new ActionControlTemplateVersionsPager(iamPolicyManagementService, listActionControlTemplateVersionsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listActionControlTemplateVersions operation using the ActionControlTemplateVersionsPager.getAll() method - @Test - public void testListActionControlTemplateVersionsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions = new ListActionControlTemplateVersionsOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - ActionControlTemplateVersionsPager pager = new ActionControlTemplateVersionsPager(iamPolicyManagementService, listActionControlTemplateVersionsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the replaceActionControlTemplate operation with a valid options model parameter - @Test - public void testReplaceActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String replaceActionControlTemplatePath = "/v1/action_control_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateActionControl model - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the ReplaceActionControlTemplateOptions model - ReplaceActionControlTemplateOptions replaceActionControlTemplateOptionsModel = new ReplaceActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .ifMatch("testString") - .name("testString") - .description("testString") - .actionControl(templateActionControlModel) - .committed(true) - .build(); - - // Invoke replaceActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.replaceActionControlTemplate(replaceActionControlTemplateOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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, replaceActionControlTemplatePath); - // 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 replaceActionControlTemplate operation with and without retries enabled - @Test - public void testReplaceActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplaceActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplaceActionControlTemplateWOptions(); - } - - // Test the replaceActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replaceActionControlTemplate(null).execute(); - } - - // Test the deleteActionControlTemplateVersion operation with a valid options model parameter - @Test - public void testDeleteActionControlTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteActionControlTemplateVersionOptions model - DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptionsModel = new DeleteActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - - // Invoke deleteActionControlTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteActionControlTemplateVersion(deleteActionControlTemplateVersionOptionsModel).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, deleteActionControlTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteActionControlTemplateVersion operation with and without retries enabled - @Test - public void testDeleteActionControlTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteActionControlTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteActionControlTemplateVersionWOptions(); - } - - // Test the deleteActionControlTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteActionControlTemplateVersion(null).execute(); - } - - // Test the getActionControlTemplateVersion operation with a valid options model parameter - @Test - public void testGetActionControlTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String getActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetActionControlTemplateVersionOptions model - GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptionsModel = new GetActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - - // Invoke getActionControlTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.getActionControlTemplateVersion(getActionControlTemplateVersionOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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, getActionControlTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getActionControlTemplateVersion operation with and without retries enabled - @Test - public void testGetActionControlTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetActionControlTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetActionControlTemplateVersionWOptions(); - } - - // Test the getActionControlTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getActionControlTemplateVersion(null).execute(); - } - - // Test the commitActionControlTemplate operation with a valid options model parameter - @Test - public void testCommitActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String commitActionControlTemplatePath = "/v1/action_control_templates/testString/versions/testString/commit"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the CommitActionControlTemplateOptions model - CommitActionControlTemplateOptions commitActionControlTemplateOptionsModel = new CommitActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - - // Invoke commitActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.commitActionControlTemplate(commitActionControlTemplateOptionsModel).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, commitActionControlTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the commitActionControlTemplate operation with and without retries enabled - @Test - public void testCommitActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCommitActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCommitActionControlTemplateWOptions(); - } - - // Test the commitActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.commitActionControlTemplate(null).execute(); - } - - // Test the listActionControlAssignments operation with a valid options model parameter - @Test - public void testListActionControlAssignmentsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; - String listActionControlAssignmentsPath = "/v1/action_control_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListActionControlAssignmentsOptions model - ListActionControlAssignmentsOptions listActionControlAssignmentsOptionsModel = new ListActionControlAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listActionControlAssignments() with a valid options model and verify the result - Response response = iamPolicyManagementService.listActionControlAssignments(listActionControlAssignmentsOptionsModel).execute(); - assertNotNull(response); - ActionControlAssignmentCollection 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, listActionControlAssignmentsPath); - // 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(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listActionControlAssignments operation with and without retries enabled - @Test - public void testListActionControlAssignmentsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListActionControlAssignmentsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListActionControlAssignmentsWOptions(); - } - - // Test the listActionControlAssignments operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlAssignmentsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listActionControlAssignments(null).execute(); - } - - // Test the listActionControlAssignments operation using the ActionControlAssignmentsPager.getNext() method - @Test - public void testListActionControlAssignmentsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlAssignmentsOptions listActionControlAssignmentsOptions = new ListActionControlAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - ActionControlAssignmentsPager pager = new ActionControlAssignmentsPager(iamPolicyManagementService, listActionControlAssignmentsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listActionControlAssignments operation using the ActionControlAssignmentsPager.getAll() method - @Test - public void testListActionControlAssignmentsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlAssignmentsOptions listActionControlAssignmentsOptions = new ListActionControlAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - ActionControlAssignmentsPager pager = new ActionControlAssignmentsPager(iamPolicyManagementService, listActionControlAssignmentsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createActionControlTemplateAssignment operation with a valid options model parameter - @Test - public void testCreateActionControlTemplateAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; - String createActionControlTemplateAssignmentPath = "/v1/action_control_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the AssignmentTargetDetails model - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - - // Construct an instance of the ActionControlAssignmentTemplate model - ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - - // Construct an instance of the CreateActionControlTemplateAssignmentOptions model - CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptionsModel = new CreateActionControlTemplateAssignmentOptions.Builder() - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(actionControlAssignmentTemplateModel)) - .acceptLanguage("default") - .build(); - - // Invoke createActionControlTemplateAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.createActionControlTemplateAssignment(createActionControlTemplateAssignmentOptionsModel).execute(); - assertNotNull(response); - ActionControlAssignmentCollection 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createActionControlTemplateAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createActionControlTemplateAssignment operation with and without retries enabled - @Test - public void testCreateActionControlTemplateAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateActionControlTemplateAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateActionControlTemplateAssignmentWOptions(); - } - - // Test the createActionControlTemplateAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createActionControlTemplateAssignment(null).execute(); - } - - // Test the getActionControlAssignment operation with a valid options model parameter - @Test - public void testGetActionControlAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; - String getActionControlAssignmentPath = "/v1/action_control_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetActionControlAssignmentOptions model - GetActionControlAssignmentOptions getActionControlAssignmentOptionsModel = new GetActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke getActionControlAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.getActionControlAssignment(getActionControlAssignmentOptionsModel).execute(); - assertNotNull(response); - ActionControlAssignment 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, getActionControlAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getActionControlAssignment operation with and without retries enabled - @Test - public void testGetActionControlAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetActionControlAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetActionControlAssignmentWOptions(); - } - - // Test the getActionControlAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getActionControlAssignment(null).execute(); - } - - // Test the updateActionControlAssignment operation with a valid options model parameter - @Test - public void testUpdateActionControlAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; - String updateActionControlAssignmentPath = "/v1/action_control_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdateActionControlAssignmentOptions model - UpdateActionControlAssignmentOptions updateActionControlAssignmentOptionsModel = new UpdateActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .ifMatch("testString") - .templateVersion("testString") - .build(); - - // Invoke updateActionControlAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.updateActionControlAssignment(updateActionControlAssignmentOptionsModel).execute(); - assertNotNull(response); - ActionControlAssignment 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateActionControlAssignmentPath); - // 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 updateActionControlAssignment operation with and without retries enabled - @Test - public void testUpdateActionControlAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdateActionControlAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdateActionControlAssignmentWOptions(); - } - - // Test the updateActionControlAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateActionControlAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updateActionControlAssignment(null).execute(); - } - - // Test the deleteActionControlAssignment operation with a valid options model parameter - @Test - public void testDeleteActionControlAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteActionControlAssignmentPath = "/v1/action_control_assignments/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteActionControlAssignmentOptions model - DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptionsModel = new DeleteActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke deleteActionControlAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteActionControlAssignment(deleteActionControlAssignmentOptionsModel).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, deleteActionControlAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteActionControlAssignment operation with and without retries enabled - @Test - public void testDeleteActionControlAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteActionControlAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteActionControlAssignmentWOptions(); - } - - // Test the deleteActionControlAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteActionControlAssignment(null).execute(); - } - - // Test the listRoleTemplates operation with a valid options model parameter - @Test - public void testListRoleTemplatesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"role_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; - String listRoleTemplatesPath = "/v1/role_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListRoleTemplatesOptions model - ListRoleTemplatesOptions listRoleTemplatesOptionsModel = new ListRoleTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .name("testString") - .roleName("testString") - .roleServiceName("testString") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listRoleTemplates() with a valid options model and verify the result - Response response = iamPolicyManagementService.listRoleTemplates(listRoleTemplatesOptionsModel).execute(); - assertNotNull(response); - RoleTemplateCollection 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, listRoleTemplatesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("name"), "testString"); - assertEquals(query.get("role_name"), "testString"); - assertEquals(query.get("role_service_name"), "testString"); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listRoleTemplates operation with and without retries enabled - @Test - public void testListRoleTemplatesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListRoleTemplatesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListRoleTemplatesWOptions(); - } - - // Test the listRoleTemplates operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleTemplatesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listRoleTemplates(null).execute(); - } - - // Test the listRoleTemplates operation using the RoleTemplatesPager.getNext() method - @Test - public void testListRoleTemplatesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleTemplatesOptions listRoleTemplatesOptions = new ListRoleTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .name("testString") - .roleName("testString") - .roleServiceName("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - RoleTemplatesPager pager = new RoleTemplatesPager(iamPolicyManagementService, listRoleTemplatesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listRoleTemplates operation using the RoleTemplatesPager.getAll() method - @Test - public void testListRoleTemplatesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleTemplatesOptions listRoleTemplatesOptions = new ListRoleTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .name("testString") - .roleName("testString") - .roleServiceName("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - RoleTemplatesPager pager = new RoleTemplatesPager(iamPolicyManagementService, listRoleTemplatesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createRoleTemplate operation with a valid options model parameter - @Test - public void testCreateRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String createRoleTemplatePath = "/v1/role_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the RoleTemplatePrototypeRole model - RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() - .name("testString") - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the CreateRoleTemplateOptions model - CreateRoleTemplateOptions createRoleTemplateOptionsModel = new CreateRoleTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .description("testString") - .committed(true) - .role(roleTemplatePrototypeRoleModel) - .acceptLanguage("default") - .build(); - - // Invoke createRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.createRoleTemplate(createRoleTemplateOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createRoleTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createRoleTemplate operation with and without retries enabled - @Test - public void testCreateRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateRoleTemplateWOptions(); - } - - // Test the createRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createRoleTemplate(null).execute(); - } - - // Test the getRoleTemplate operation with a valid options model parameter - @Test - public void testGetRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String getRoleTemplatePath = "/v1/role_templates/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetRoleTemplateOptions model - GetRoleTemplateOptions getRoleTemplateOptionsModel = new GetRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .state("active") - .build(); - - // Invoke getRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.getRoleTemplate(getRoleTemplateOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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, getRoleTemplatePath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - } - - // Test the getRoleTemplate operation with and without retries enabled - @Test - public void testGetRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetRoleTemplateWOptions(); - } - - // Test the getRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getRoleTemplate(null).execute(); - } - - // Test the deleteRoleTemplate operation with a valid options model parameter - @Test - public void testDeleteRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteRoleTemplatePath = "/v1/role_templates/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteRoleTemplateOptions model - DeleteRoleTemplateOptions deleteRoleTemplateOptionsModel = new DeleteRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .build(); - - // Invoke deleteRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteRoleTemplate(deleteRoleTemplateOptionsModel).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, deleteRoleTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteRoleTemplate operation with and without retries enabled - @Test - public void testDeleteRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteRoleTemplateWOptions(); - } - - // Test the deleteRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteRoleTemplate(null).execute(); - } - - // Test the createRoleTemplateVersion operation with a valid options model parameter - @Test - public void testCreateRoleTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String createRoleTemplateVersionPath = "/v1/role_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateRole model - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the CreateRoleTemplateVersionOptions model - CreateRoleTemplateVersionOptions createRoleTemplateVersionOptionsModel = new CreateRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .name("testString") - .description("testString") - .role(templateRoleModel) - .committed(true) - .build(); - - // Invoke createRoleTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.createRoleTemplateVersion(createRoleTemplateVersionOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createRoleTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createRoleTemplateVersion operation with and without retries enabled - @Test - public void testCreateRoleTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateRoleTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateRoleTemplateVersionWOptions(); - } - - // Test the createRoleTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createRoleTemplateVersion(null).execute(); - } - - // Test the listRoleTemplateVersions operation with a valid options model parameter - @Test - public void testListRoleTemplateVersionsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; - String listRoleTemplateVersionsPath = "/v1/role_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListRoleTemplateVersionsOptions model - ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptionsModel = new ListRoleTemplateVersionsOptions.Builder() - .roleTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listRoleTemplateVersions() with a valid options model and verify the result - Response response = iamPolicyManagementService.listRoleTemplateVersions(listRoleTemplateVersionsOptionsModel).execute(); - assertNotNull(response); - RoleTemplateVersionsCollection 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, listRoleTemplateVersionsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listRoleTemplateVersions operation with and without retries enabled - @Test - public void testListRoleTemplateVersionsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListRoleTemplateVersionsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListRoleTemplateVersionsWOptions(); - } - - // Test the listRoleTemplateVersions operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleTemplateVersionsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listRoleTemplateVersions(null).execute(); - } - - // Test the listRoleTemplateVersions operation using the RoleTemplateVersionsPager.getNext() method - @Test - public void testListRoleTemplateVersionsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions = new ListRoleTemplateVersionsOptions.Builder() - .roleTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - RoleTemplateVersionsPager pager = new RoleTemplateVersionsPager(iamPolicyManagementService, listRoleTemplateVersionsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listRoleTemplateVersions operation using the RoleTemplateVersionsPager.getAll() method - @Test - public void testListRoleTemplateVersionsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions = new ListRoleTemplateVersionsOptions.Builder() - .roleTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - RoleTemplateVersionsPager pager = new RoleTemplateVersionsPager(iamPolicyManagementService, listRoleTemplateVersionsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the replaceRoleTemplate operation with a valid options model parameter - @Test - public void testReplaceRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String replaceRoleTemplatePath = "/v1/role_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateRole model - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the ReplaceRoleTemplateOptions model - ReplaceRoleTemplateOptions replaceRoleTemplateOptionsModel = new ReplaceRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .ifMatch("testString") - .name("testString") - .description("testString") - .role(templateRoleModel) - .committed(true) - .build(); - - // Invoke replaceRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.replaceRoleTemplate(replaceRoleTemplateOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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, replaceRoleTemplatePath); - // 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 replaceRoleTemplate operation with and without retries enabled - @Test - public void testReplaceRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplaceRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplaceRoleTemplateWOptions(); - } - - // Test the replaceRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replaceRoleTemplate(null).execute(); - } - - // Test the deleteRoleTemplateVersion operation with a valid options model parameter - @Test - public void testDeleteRoleTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteRoleTemplateVersionPath = "/v1/role_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteRoleTemplateVersionOptions model - DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptionsModel = new DeleteRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - - // Invoke deleteRoleTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteRoleTemplateVersion(deleteRoleTemplateVersionOptionsModel).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, deleteRoleTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteRoleTemplateVersion operation with and without retries enabled - @Test - public void testDeleteRoleTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteRoleTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteRoleTemplateVersionWOptions(); - } - - // Test the deleteRoleTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteRoleTemplateVersion(null).execute(); - } - - // Test the getRoleTemplateVersion operation with a valid options model parameter - @Test - public void testGetRoleTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String getRoleTemplateVersionPath = "/v1/role_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetRoleTemplateVersionOptions model - GetRoleTemplateVersionOptions getRoleTemplateVersionOptionsModel = new GetRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - - // Invoke getRoleTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.getRoleTemplateVersion(getRoleTemplateVersionOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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, getRoleTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getRoleTemplateVersion operation with and without retries enabled - @Test - public void testGetRoleTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetRoleTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetRoleTemplateVersionWOptions(); - } - - // Test the getRoleTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getRoleTemplateVersion(null).execute(); - } - - // Test the commitRoleTemplate operation with a valid options model parameter - @Test - public void testCommitRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String commitRoleTemplatePath = "/v1/role_templates/testString/versions/testString/commit"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the CommitRoleTemplateOptions model - CommitRoleTemplateOptions commitRoleTemplateOptionsModel = new CommitRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - - // Invoke commitRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.commitRoleTemplate(commitRoleTemplateOptionsModel).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, commitRoleTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the commitRoleTemplate operation with and without retries enabled - @Test - public void testCommitRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCommitRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCommitRoleTemplateWOptions(); - } - - // Test the commitRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.commitRoleTemplate(null).execute(); - } - - // Test the listRoleAssignments operation with a valid options model parameter - @Test - public void testListRoleAssignmentsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; - String listRoleAssignmentsPath = "/v1/role_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListRoleAssignmentsOptions model - ListRoleAssignmentsOptions listRoleAssignmentsOptionsModel = new ListRoleAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listRoleAssignments() with a valid options model and verify the result - Response response = iamPolicyManagementService.listRoleAssignments(listRoleAssignmentsOptionsModel).execute(); - assertNotNull(response); - RoleAssignmentCollection 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, listRoleAssignmentsPath); - // 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(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listRoleAssignments operation with and without retries enabled - @Test - public void testListRoleAssignmentsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListRoleAssignmentsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListRoleAssignmentsWOptions(); - } - - // Test the listRoleAssignments operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleAssignmentsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listRoleAssignments(null).execute(); - } - - // Test the listRoleAssignments operation using the RoleAssignmentsPager.getNext() method - @Test - public void testListRoleAssignmentsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleAssignmentsOptions listRoleAssignmentsOptions = new ListRoleAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - RoleAssignmentsPager pager = new RoleAssignmentsPager(iamPolicyManagementService, listRoleAssignmentsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listRoleAssignments operation using the RoleAssignmentsPager.getAll() method - @Test - public void testListRoleAssignmentsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleAssignmentsOptions listRoleAssignmentsOptions = new ListRoleAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - RoleAssignmentsPager pager = new RoleAssignmentsPager(iamPolicyManagementService, listRoleAssignmentsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createRoleTemplateAssignment operation with a valid options model parameter - @Test - public void testCreateRoleTemplateAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; - String createRoleTemplateAssignmentPath = "/v1/role_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the AssignmentTargetDetails model - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - - // Construct an instance of the RoleAssignmentTemplate model - RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - - // Construct an instance of the CreateRoleTemplateAssignmentOptions model - CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptionsModel = new CreateRoleTemplateAssignmentOptions.Builder() - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(roleAssignmentTemplateModel)) - .acceptLanguage("default") - .build(); - - // Invoke createRoleTemplateAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.createRoleTemplateAssignment(createRoleTemplateAssignmentOptionsModel).execute(); - assertNotNull(response); - RoleAssignmentCollection 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createRoleTemplateAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createRoleTemplateAssignment operation with and without retries enabled - @Test - public void testCreateRoleTemplateAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateRoleTemplateAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateRoleTemplateAssignmentWOptions(); - } - - // Test the createRoleTemplateAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createRoleTemplateAssignment(null).execute(); - } - - // Test the getRoleAssignment operation with a valid options model parameter - @Test - public void testGetRoleAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; - String getRoleAssignmentPath = "/v1/role_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetRoleAssignmentOptions model - GetRoleAssignmentOptions getRoleAssignmentOptionsModel = new GetRoleAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke getRoleAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.getRoleAssignment(getRoleAssignmentOptionsModel).execute(); - assertNotNull(response); - RoleAssignment 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, getRoleAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getRoleAssignment operation with and without retries enabled - @Test - public void testGetRoleAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetRoleAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetRoleAssignmentWOptions(); - } - - // Test the getRoleAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getRoleAssignment(null).execute(); - } - - // Test the updateRoleAssignment operation with a valid options model parameter - @Test - public void testUpdateRoleAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; - String updateRoleAssignmentPath = "/v1/role_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdateRoleAssignmentOptions model - UpdateRoleAssignmentOptions updateRoleAssignmentOptionsModel = new UpdateRoleAssignmentOptions.Builder() - .assignmentId("testString") - .ifMatch("testString") - .templateVersion("testString") - .build(); - - // Invoke updateRoleAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.updateRoleAssignment(updateRoleAssignmentOptionsModel).execute(); - assertNotNull(response); - RoleAssignment 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateRoleAssignmentPath); - // 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 updateRoleAssignment operation with and without retries enabled - @Test - public void testUpdateRoleAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdateRoleAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdateRoleAssignmentWOptions(); - } - - // Test the updateRoleAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateRoleAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updateRoleAssignment(null).execute(); - } - - // Test the deleteRoleAssignment operation with a valid options model parameter - @Test - public void testDeleteRoleAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteRoleAssignmentPath = "/v1/role_assignments/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteRoleAssignmentOptions model - DeleteRoleAssignmentOptions deleteRoleAssignmentOptionsModel = new DeleteRoleAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke deleteRoleAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteRoleAssignment(deleteRoleAssignmentOptionsModel).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, deleteRoleAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteRoleAssignment operation with and without retries enabled - @Test - public void testDeleteRoleAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteRoleAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteRoleAssignmentWOptions(); - } - - // Test the deleteRoleAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteRoleAssignment(null).execute(); - } - - // Perform setup needed before each test method - @BeforeMethod - public void beforeEachTest() { - // Start the mock server. - try { - server = new MockWebServer(); - server.start(); - } catch (IOException err) { - fail("Failed to instantiate mock web server"); - } - - // Construct an instance of the service - constructClientService(); - } - - // Perform tear down after each test method - @AfterMethod - public void afterEachTest() throws IOException { - server.shutdown(); - iamPolicyManagementService = null; - } - - // Constructs an instance of the service to be used by the tests - public void constructClientService() { - System.setProperty("TESTSERVICE_AUTH_TYPE", "noAuth"); - final String serviceName = "testService"; - - iamPolicyManagementService = IamPolicyManagement.newInstance(serviceName); - String url = server.url("/").toString(); - iamPolicyManagementService.setServiceUrl(url); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java deleted file mode 100644 index 5630ccb0c03..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.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 AccountSettingsAccessManagement model. - */ -public class AccountSettingsAccessManagementTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAccountSettingsAccessManagement() throws Throwable { - AccountSettingsAccessManagement accountSettingsAccessManagementModel = new AccountSettingsAccessManagement(); - assertNull(accountSettingsAccessManagementModel.getExternalAccountIdentityInteraction()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java deleted file mode 100644 index d4dfc8863c6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentCollection model. - */ -public class ActionControlAssignmentCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentCollection() throws Throwable { - ActionControlAssignmentCollection actionControlAssignmentCollectionModel = new ActionControlAssignmentCollection(); - assertNull(actionControlAssignmentCollectionModel.getLimit()); - assertNull(actionControlAssignmentCollectionModel.getFirst()); - assertNull(actionControlAssignmentCollectionModel.getNext()); - assertNull(actionControlAssignmentCollectionModel.getPrevious()); - assertNull(actionControlAssignmentCollectionModel.getAssignments()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java deleted file mode 100644 index cb53bc44d1c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResourceActionControl model. - */ -public class ActionControlAssignmentResourceActionControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentResourceActionControl() throws Throwable { - ActionControlAssignmentResourceActionControl actionControlAssignmentResourceActionControlModel = new ActionControlAssignmentResourceActionControl(); - assertNull(actionControlAssignmentResourceActionControlModel.getResourceCreated()); - assertNull(actionControlAssignmentResourceActionControlModel.getErrorMessage()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java deleted file mode 100644 index 284ec17a0f0..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResourceCreated model. - */ -public class ActionControlAssignmentResourceCreatedTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentResourceCreated() throws Throwable { - ActionControlAssignmentResourceCreated actionControlAssignmentResourceCreatedModel = new ActionControlAssignmentResourceCreated(); - assertNull(actionControlAssignmentResourceCreatedModel.getId()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java deleted file mode 100644 index eaa560dce78..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResource model. - */ -public class ActionControlAssignmentResourceTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentResource() throws Throwable { - ActionControlAssignmentResource actionControlAssignmentResourceModel = new ActionControlAssignmentResource(); - assertNull(actionControlAssignmentResourceModel.getTarget()); - assertNull(actionControlAssignmentResourceModel.getActionControl()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java deleted file mode 100644 index 262a74bea45..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentTemplate model. - */ -public class ActionControlAssignmentTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentTemplate() throws Throwable { - ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(actionControlAssignmentTemplateModel.id(), "testString"); - assertEquals(actionControlAssignmentTemplateModel.version(), "testString"); - - String json = TestUtilities.serialize(actionControlAssignmentTemplateModel); - - ActionControlAssignmentTemplate actionControlAssignmentTemplateModelNew = TestUtilities.deserialize(json, ActionControlAssignmentTemplate.class); - assertTrue(actionControlAssignmentTemplateModelNew instanceof ActionControlAssignmentTemplate); - assertEquals(actionControlAssignmentTemplateModelNew.id(), "testString"); - assertEquals(actionControlAssignmentTemplateModelNew.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testActionControlAssignmentTemplateError() throws Throwable { - new ActionControlAssignmentTemplate.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java deleted file mode 100644 index c5173f940c4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignment model. - */ -public class ActionControlAssignmentTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignment() throws Throwable { - ActionControlAssignment actionControlAssignmentModel = new ActionControlAssignment(); - assertNull(actionControlAssignmentModel.getTemplate()); - assertNull(actionControlAssignmentModel.getTarget()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java deleted file mode 100644 index 58155ee1e7e..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplateCollection model. - */ -public class ActionControlTemplateCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlTemplateCollection() throws Throwable { - ActionControlTemplateCollection actionControlTemplateCollectionModel = new ActionControlTemplateCollection(); - assertNull(actionControlTemplateCollectionModel.getLimit()); - assertNull(actionControlTemplateCollectionModel.getFirst()); - assertNull(actionControlTemplateCollectionModel.getNext()); - assertNull(actionControlTemplateCollectionModel.getPrevious()); - assertNull(actionControlTemplateCollectionModel.getActionControlTemplates()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java deleted file mode 100644 index a086106a57e..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplate model. - */ -public class ActionControlTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlTemplate() throws Throwable { - ActionControlTemplate actionControlTemplateModel = new ActionControlTemplate(); - assertNull(actionControlTemplateModel.getName()); - assertNull(actionControlTemplateModel.getDescription()); - assertNull(actionControlTemplateModel.getAccountId()); - assertNull(actionControlTemplateModel.isCommitted()); - assertNull(actionControlTemplateModel.getActionControl()); - assertNull(actionControlTemplateModel.getVersion()); - assertNull(actionControlTemplateModel.getState()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java deleted file mode 100644 index 7b6bf014357..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplateVersionsCollection model. - */ -public class ActionControlTemplateVersionsCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlTemplateVersionsCollection() throws Throwable { - ActionControlTemplateVersionsCollection actionControlTemplateVersionsCollectionModel = new ActionControlTemplateVersionsCollection(); - assertNull(actionControlTemplateVersionsCollectionModel.getLimit()); - assertNull(actionControlTemplateVersionsCollectionModel.getFirst()); - assertNull(actionControlTemplateVersionsCollectionModel.getNext()); - assertNull(actionControlTemplateVersionsCollectionModel.getPrevious()); - assertNull(actionControlTemplateVersionsCollectionModel.getVersions()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java deleted file mode 100644 index 4038d52606c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentResourceCreated model. - */ -public class AssignmentResourceCreatedTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAssignmentResourceCreated() throws Throwable { - AssignmentResourceCreated assignmentResourceCreatedModel = new AssignmentResourceCreated(); - assertNull(assignmentResourceCreatedModel.getId()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java deleted file mode 100644 index 81e3799a42c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentResourceError model. - */ -public class AssignmentResourceErrorTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAssignmentResourceError() throws Throwable { - AssignmentResourceError assignmentResourceErrorModel = new AssignmentResourceError(); - assertNull(assignmentResourceErrorModel.getName()); - assertNull(assignmentResourceErrorModel.getErrorCode()); - assertNull(assignmentResourceErrorModel.getMessage()); - assertNull(assignmentResourceErrorModel.getCode()); - assertNull(assignmentResourceErrorModel.getErrors()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java deleted file mode 100644 index 48e4a605cbb..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentTargetDetails model. - */ -public class AssignmentTargetDetailsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAssignmentTargetDetails() throws Throwable { - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - assertEquals(assignmentTargetDetailsModel.type(), "Account"); - assertEquals(assignmentTargetDetailsModel.id(), "testString"); - - String json = TestUtilities.serialize(assignmentTargetDetailsModel); - - AssignmentTargetDetails assignmentTargetDetailsModelNew = TestUtilities.deserialize(json, AssignmentTargetDetails.class); - assertTrue(assignmentTargetDetailsModelNew instanceof AssignmentTargetDetails); - assertEquals(assignmentTargetDetailsModelNew.type(), "Account"); - assertEquals(assignmentTargetDetailsModelNew.id(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testAssignmentTargetDetailsError() throws Throwable { - new AssignmentTargetDetails.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java deleted file mode 100644 index bcecf27ed27..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentTemplateDetails model. - */ -public class AssignmentTemplateDetailsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAssignmentTemplateDetails() throws Throwable { - AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(assignmentTemplateDetailsModel.id(), "testString"); - assertEquals(assignmentTemplateDetailsModel.version(), "testString"); - - String json = TestUtilities.serialize(assignmentTemplateDetailsModel); - - AssignmentTemplateDetails assignmentTemplateDetailsModelNew = TestUtilities.deserialize(json, AssignmentTemplateDetails.class); - assertTrue(assignmentTemplateDetailsModelNew instanceof AssignmentTemplateDetails); - assertEquals(assignmentTemplateDetailsModelNew.id(), "testString"); - assertEquals(assignmentTemplateDetailsModelNew.version(), "testString"); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java deleted file mode 100644 index 2b5ed42c76a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CommitActionControlTemplateOptions model. - */ -public class CommitActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCommitActionControlTemplateOptions() throws Throwable { - CommitActionControlTemplateOptions commitActionControlTemplateOptionsModel = new CommitActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - assertEquals(commitActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(commitActionControlTemplateOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitActionControlTemplateOptionsError() throws Throwable { - new CommitActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java deleted file mode 100644 index 66cdca59588..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CommitPolicyTemplateOptions model. - */ -public class CommitPolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCommitPolicyTemplateOptions() throws Throwable { - CommitPolicyTemplateOptions commitPolicyTemplateOptionsModel = new CommitPolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - assertEquals(commitPolicyTemplateOptionsModel.policyTemplateId(), "testString"); - assertEquals(commitPolicyTemplateOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitPolicyTemplateOptionsError() throws Throwable { - new CommitPolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java deleted file mode 100644 index 09c48b8e80e..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CommitRoleTemplateOptions model. - */ -public class CommitRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCommitRoleTemplateOptions() throws Throwable { - CommitRoleTemplateOptions commitRoleTemplateOptionsModel = new CommitRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - assertEquals(commitRoleTemplateOptionsModel.roleTemplateId(), "testString"); - assertEquals(commitRoleTemplateOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitRoleTemplateOptionsError() throws Throwable { - new CommitRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java deleted file mode 100644 index 94ef6ce21e8..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.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 ConflictsWith model. - */ -public class ConflictsWithTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testConflictsWith() throws Throwable { - ConflictsWith conflictsWithModel = new ConflictsWith(); - assertNull(conflictsWithModel.getEtag()); - assertNull(conflictsWithModel.getRole()); - assertNull(conflictsWithModel.getPolicy()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java deleted file mode 100644 index bbe19a7b9b1..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponseControl model. - */ -public class ControlResponseControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testControlResponseControl() throws Throwable { - ControlResponseControl controlResponseControlModel = new ControlResponseControl(); - assertNull(controlResponseControlModel.getGrant()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java deleted file mode 100644 index 7b2fbfae90d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControlWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponseControlWithEnrichedRoles model. - */ -public class ControlResponseControlWithEnrichedRolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testControlResponseControlWithEnrichedRoles() throws Throwable { - ControlResponseControlWithEnrichedRoles controlResponseControlWithEnrichedRolesModel = new ControlResponseControlWithEnrichedRoles(); - assertNull(controlResponseControlWithEnrichedRolesModel.getGrant()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java deleted file mode 100644 index f42cbc0a2d8..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponse; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponse model. - */ -public class ControlResponseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testControlResponse() throws Throwable { - ControlResponse controlResponseModel = new ControlResponse(); - assertNotNull(controlResponseModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java deleted file mode 100644 index c8b1e3000f9..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 Control model. - */ -public class ControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testControl() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); - - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - assertEquals(controlModel.grant(), grantModel); - - String json = TestUtilities.serialize(controlModel); - - Control controlModelNew = TestUtilities.deserialize(json, Control.class); - assertTrue(controlModelNew instanceof Control); - assertEquals(controlModelNew.grant().toString(), grantModel.toString()); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testControlError() throws Throwable { - new Control.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java deleted file mode 100644 index f2557c8f64f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateAssignmentOptions model. - */ -public class CreateActionControlTemplateAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateActionControlTemplateAssignmentOptions() throws Throwable { - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - assertEquals(assignmentTargetDetailsModel.type(), "Account"); - assertEquals(assignmentTargetDetailsModel.id(), "testString"); - - ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(actionControlAssignmentTemplateModel.id(), "testString"); - assertEquals(actionControlAssignmentTemplateModel.version(), "testString"); - - CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptionsModel = new CreateActionControlTemplateAssignmentOptions.Builder() - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(actionControlAssignmentTemplateModel)) - .acceptLanguage("default") - .build(); - assertEquals(createActionControlTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); - assertEquals(createActionControlTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(actionControlAssignmentTemplateModel)); - assertEquals(createActionControlTemplateAssignmentOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateAssignmentOptionsError() throws Throwable { - new CreateActionControlTemplateAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java deleted file mode 100644 index 2508072a03c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateOptions model. - */ -public class CreateActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateActionControlTemplateOptions() throws Throwable { - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateActionControlModel.serviceName(), "testString"); - assertEquals(templateActionControlModel.description(), "testString"); - assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); - - CreateActionControlTemplateOptions createActionControlTemplateOptionsModel = new CreateActionControlTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .description("testString") - .committed(true) - .actionControl(templateActionControlModel) - .acceptLanguage("default") - .build(); - assertEquals(createActionControlTemplateOptionsModel.name(), "testString"); - assertEquals(createActionControlTemplateOptionsModel.accountId(), "testString"); - assertEquals(createActionControlTemplateOptionsModel.description(), "testString"); - assertEquals(createActionControlTemplateOptionsModel.committed(), Boolean.valueOf(true)); - assertEquals(createActionControlTemplateOptionsModel.actionControl(), templateActionControlModel); - assertEquals(createActionControlTemplateOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateOptionsError() throws Throwable { - new CreateActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java deleted file mode 100644 index d5070249115..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateVersionOptions model. - */ -public class CreateActionControlTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateActionControlTemplateVersionOptions() throws Throwable { - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateActionControlModel.serviceName(), "testString"); - assertEquals(templateActionControlModel.description(), "testString"); - assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); - - CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptionsModel = new CreateActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .name("testString") - .description("testString") - .actionControl(templateActionControlModel) - .committed(true) - .build(); - assertEquals(createActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(createActionControlTemplateVersionOptionsModel.name(), "testString"); - assertEquals(createActionControlTemplateVersionOptionsModel.description(), "testString"); - assertEquals(createActionControlTemplateVersionOptionsModel.actionControl(), templateActionControlModel); - assertEquals(createActionControlTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateVersionOptionsError() throws Throwable { - new CreateActionControlTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java deleted file mode 100644 index c2dd24fd213..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyOptions model. - */ -public class CreatePolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreatePolicyOptions() throws Throwable { - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - assertEquals(subjectAttributeModel.name(), "testString"); - assertEquals(subjectAttributeModel.value(), "testString"); - - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); - - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - assertEquals(policyRoleModel.roleId(), "testString"); - - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceAttributeModel.name(), "testString"); - assertEquals(resourceAttributeModel.value(), "testString"); - assertEquals(resourceAttributeModel.operator(), "testString"); - - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceTagModel.name(), "testString"); - assertEquals(resourceTagModel.value(), "testString"); - assertEquals(resourceTagModel.operator(), "testString"); - - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); - assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); - - CreatePolicyOptions createPolicyOptionsModel = new CreatePolicyOptions.Builder() - .type("testString") - .subjects(java.util.Arrays.asList(policySubjectModel)) - .roles(java.util.Arrays.asList(policyRoleModel)) - .resources(java.util.Arrays.asList(policyResourceModel)) - .description("testString") - .acceptLanguage("default") - .build(); - assertEquals(createPolicyOptionsModel.type(), "testString"); - assertEquals(createPolicyOptionsModel.subjects(), java.util.Arrays.asList(policySubjectModel)); - assertEquals(createPolicyOptionsModel.roles(), java.util.Arrays.asList(policyRoleModel)); - assertEquals(createPolicyOptionsModel.resources(), java.util.Arrays.asList(policyResourceModel)); - assertEquals(createPolicyOptionsModel.description(), "testString"); - assertEquals(createPolicyOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyOptionsError() throws Throwable { - new CreatePolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java deleted file mode 100644 index 5b08b4b398a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateAssignmentOptions model. - */ -public class CreatePolicyTemplateAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreatePolicyTemplateAssignmentOptions() throws Throwable { - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - assertEquals(assignmentTargetDetailsModel.type(), "Account"); - assertEquals(assignmentTargetDetailsModel.id(), "testString"); - - AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(assignmentTemplateDetailsModel.id(), "testString"); - assertEquals(assignmentTemplateDetailsModel.version(), "testString"); - - CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptionsModel = new CreatePolicyTemplateAssignmentOptions.Builder() - .version("1.0") - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(assignmentTemplateDetailsModel)) - .acceptLanguage("default") - .build(); - assertEquals(createPolicyTemplateAssignmentOptionsModel.version(), "1.0"); - assertEquals(createPolicyTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); - assertEquals(createPolicyTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(assignmentTemplateDetailsModel)); - assertEquals(createPolicyTemplateAssignmentOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateAssignmentOptionsError() throws Throwable { - new CreatePolicyTemplateAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java deleted file mode 100644 index 68617451831..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateOptions model. - */ -public class CreatePolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreatePolicyTemplateOptions() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - assertEquals(templatePolicyModel.type(), "access"); - assertEquals(templatePolicyModel.description(), "testString"); - assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); - assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); - assertEquals(templatePolicyModel.pattern(), "testString"); - assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), templateControlModel); - - CreatePolicyTemplateOptions createPolicyTemplateOptionsModel = new CreatePolicyTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .policy(templatePolicyModel) - .description("testString") - .committed(true) - .acceptLanguage("default") - .build(); - assertEquals(createPolicyTemplateOptionsModel.name(), "testString"); - assertEquals(createPolicyTemplateOptionsModel.accountId(), "testString"); - assertEquals(createPolicyTemplateOptionsModel.policy(), templatePolicyModel); - assertEquals(createPolicyTemplateOptionsModel.description(), "testString"); - assertEquals(createPolicyTemplateOptionsModel.committed(), Boolean.valueOf(true)); - assertEquals(createPolicyTemplateOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateOptionsError() throws Throwable { - new CreatePolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java deleted file mode 100644 index d6919e6e1b9..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateVersionOptions model. - */ -public class CreatePolicyTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreatePolicyTemplateVersionOptions() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - assertEquals(templatePolicyModel.type(), "access"); - assertEquals(templatePolicyModel.description(), "testString"); - assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); - assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); - assertEquals(templatePolicyModel.pattern(), "testString"); - assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), templateControlModel); - - CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptionsModel = new CreatePolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .policy(templatePolicyModel) - .name("testString") - .description("testString") - .committed(true) - .build(); - assertEquals(createPolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); - assertEquals(createPolicyTemplateVersionOptionsModel.policy(), templatePolicyModel); - assertEquals(createPolicyTemplateVersionOptionsModel.name(), "testString"); - assertEquals(createPolicyTemplateVersionOptionsModel.description(), "testString"); - assertEquals(createPolicyTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateVersionOptionsError() throws Throwable { - new CreatePolicyTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java deleted file mode 100644 index 849512f2bda..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleOptions model. - */ -public class CreateRoleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateRoleOptions() throws Throwable { - CreateRoleOptions createRoleOptionsModel = new CreateRoleOptions.Builder() - .displayName("testString") - .actions(java.util.Arrays.asList("testString")) - .name("Developer") - .accountId("testString") - .serviceName("iam-groups") - .description("testString") - .acceptLanguage("default") - .build(); - assertEquals(createRoleOptionsModel.displayName(), "testString"); - assertEquals(createRoleOptionsModel.actions(), java.util.Arrays.asList("testString")); - assertEquals(createRoleOptionsModel.name(), "Developer"); - assertEquals(createRoleOptionsModel.accountId(), "testString"); - assertEquals(createRoleOptionsModel.serviceName(), "iam-groups"); - assertEquals(createRoleOptionsModel.description(), "testString"); - assertEquals(createRoleOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleOptionsError() throws Throwable { - new CreateRoleOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java deleted file mode 100644 index bff414389a5..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateAssignmentOptions model. - */ -public class CreateRoleTemplateAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateRoleTemplateAssignmentOptions() throws Throwable { - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - assertEquals(assignmentTargetDetailsModel.type(), "Account"); - assertEquals(assignmentTargetDetailsModel.id(), "testString"); - - RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(roleAssignmentTemplateModel.id(), "testString"); - assertEquals(roleAssignmentTemplateModel.version(), "testString"); - - CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptionsModel = new CreateRoleTemplateAssignmentOptions.Builder() - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(roleAssignmentTemplateModel)) - .acceptLanguage("default") - .build(); - assertEquals(createRoleTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); - assertEquals(createRoleTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(roleAssignmentTemplateModel)); - assertEquals(createRoleTemplateAssignmentOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateAssignmentOptionsError() throws Throwable { - new CreateRoleTemplateAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java deleted file mode 100644 index 799743ddbf4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateOptions model. - */ -public class CreateRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateRoleTemplateOptions() throws Throwable { - RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() - .name("testString") - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(roleTemplatePrototypeRoleModel.name(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.displayName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.serviceName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.description(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.actions(), java.util.Arrays.asList("testString")); - - CreateRoleTemplateOptions createRoleTemplateOptionsModel = new CreateRoleTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .description("testString") - .committed(true) - .role(roleTemplatePrototypeRoleModel) - .acceptLanguage("default") - .build(); - assertEquals(createRoleTemplateOptionsModel.name(), "testString"); - assertEquals(createRoleTemplateOptionsModel.accountId(), "testString"); - assertEquals(createRoleTemplateOptionsModel.description(), "testString"); - assertEquals(createRoleTemplateOptionsModel.committed(), Boolean.valueOf(true)); - assertEquals(createRoleTemplateOptionsModel.role(), roleTemplatePrototypeRoleModel); - assertEquals(createRoleTemplateOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateOptionsError() throws Throwable { - new CreateRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java deleted file mode 100644 index a7d2d312afa..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateVersionOptions model. - */ -public class CreateRoleTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateRoleTemplateVersionOptions() throws Throwable { - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateRoleModel.displayName(), "testString"); - assertEquals(templateRoleModel.serviceName(), "testString"); - assertEquals(templateRoleModel.description(), "testString"); - assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); - - CreateRoleTemplateVersionOptions createRoleTemplateVersionOptionsModel = new CreateRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .name("testString") - .description("testString") - .role(templateRoleModel) - .committed(true) - .build(); - assertEquals(createRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); - assertEquals(createRoleTemplateVersionOptionsModel.name(), "testString"); - assertEquals(createRoleTemplateVersionOptionsModel.description(), "testString"); - assertEquals(createRoleTemplateVersionOptionsModel.role(), templateRoleModel); - assertEquals(createRoleTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateVersionOptionsError() throws Throwable { - new CreateRoleTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java deleted file mode 100644 index acce8b7b537..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateV2PolicyOptions model. - */ -public class CreateV2PolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateV2PolicyOptions() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); - - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - assertEquals(controlModel.grant(), grantModel); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - CreateV2PolicyOptions createV2PolicyOptionsModel = new CreateV2PolicyOptions.Builder() - .control(controlModel) - .type("access") - .description("testString") - .subject(v2PolicySubjectModel) - .resource(v2PolicyResourceModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .acceptLanguage("default") - .build(); - assertEquals(createV2PolicyOptionsModel.control(), controlModel); - assertEquals(createV2PolicyOptionsModel.type(), "access"); - assertEquals(createV2PolicyOptionsModel.description(), "testString"); - assertEquals(createV2PolicyOptionsModel.subject(), v2PolicySubjectModel); - assertEquals(createV2PolicyOptionsModel.resource(), v2PolicyResourceModel); - assertEquals(createV2PolicyOptionsModel.pattern(), "testString"); - assertEquals(createV2PolicyOptionsModel.rule(), v2PolicyRuleModel); - assertEquals(createV2PolicyOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateV2PolicyOptionsError() throws Throwable { - new CreateV2PolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java deleted file mode 100644 index acc0dc0a3c1..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 CustomRole model. - */ -public class CustomRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCustomRole() throws Throwable { - CustomRole customRoleModel = new CustomRole(); - assertNull(customRoleModel.getDisplayName()); - assertNull(customRoleModel.getDescription()); - assertNull(customRoleModel.getActions()); - assertNull(customRoleModel.getName()); - assertNull(customRoleModel.getAccountId()); - assertNull(customRoleModel.getServiceName()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java deleted file mode 100644 index 1a38606ede5..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlAssignmentOptions model. - */ -public class DeleteActionControlAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteActionControlAssignmentOptions() throws Throwable { - DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptionsModel = new DeleteActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(deleteActionControlAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlAssignmentOptionsError() throws Throwable { - new DeleteActionControlAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java deleted file mode 100644 index 75b111e9214..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlTemplateOptions model. - */ -public class DeleteActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteActionControlTemplateOptions() throws Throwable { - DeleteActionControlTemplateOptions deleteActionControlTemplateOptionsModel = new DeleteActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .build(); - assertEquals(deleteActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlTemplateOptionsError() throws Throwable { - new DeleteActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java deleted file mode 100644 index 64fb5790244..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlTemplateVersionOptions model. - */ -public class DeleteActionControlTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteActionControlTemplateVersionOptions() throws Throwable { - DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptionsModel = new DeleteActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - assertEquals(deleteActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(deleteActionControlTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlTemplateVersionOptionsError() throws Throwable { - new DeleteActionControlTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java deleted file mode 100644 index 75aed905222..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyAssignmentOptions model. - */ -public class DeletePolicyAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeletePolicyAssignmentOptions() throws Throwable { - DeletePolicyAssignmentOptions deletePolicyAssignmentOptionsModel = new DeletePolicyAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(deletePolicyAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyAssignmentOptionsError() throws Throwable { - new DeletePolicyAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java deleted file mode 100644 index 1b130eb0f79..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyOptions model. - */ -public class DeletePolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeletePolicyOptions() throws Throwable { - DeletePolicyOptions deletePolicyOptionsModel = new DeletePolicyOptions.Builder() - .policyId("testString") - .build(); - assertEquals(deletePolicyOptionsModel.policyId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyOptionsError() throws Throwable { - new DeletePolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java deleted file mode 100644 index 288517222aa..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyTemplateOptions model. - */ -public class DeletePolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeletePolicyTemplateOptions() throws Throwable { - DeletePolicyTemplateOptions deletePolicyTemplateOptionsModel = new DeletePolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .build(); - assertEquals(deletePolicyTemplateOptionsModel.policyTemplateId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyTemplateOptionsError() throws Throwable { - new DeletePolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java deleted file mode 100644 index 7b1c6cffa1d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyTemplateVersionOptions model. - */ -public class DeletePolicyTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeletePolicyTemplateVersionOptions() throws Throwable { - DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptionsModel = new DeletePolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - assertEquals(deletePolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); - assertEquals(deletePolicyTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyTemplateVersionOptionsError() throws Throwable { - new DeletePolicyTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java deleted file mode 100644 index 7f9b614304f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleAssignmentOptions model. - */ -public class DeleteRoleAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteRoleAssignmentOptions() throws Throwable { - DeleteRoleAssignmentOptions deleteRoleAssignmentOptionsModel = new DeleteRoleAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(deleteRoleAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleAssignmentOptionsError() throws Throwable { - new DeleteRoleAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java deleted file mode 100644 index 9c6690cda7b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleOptions model. - */ -public class DeleteRoleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteRoleOptions() throws Throwable { - DeleteRoleOptions deleteRoleOptionsModel = new DeleteRoleOptions.Builder() - .roleId("testString") - .build(); - assertEquals(deleteRoleOptionsModel.roleId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleOptionsError() throws Throwable { - new DeleteRoleOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java deleted file mode 100644 index 3fc04286ed3..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleTemplateOptions model. - */ -public class DeleteRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteRoleTemplateOptions() throws Throwable { - DeleteRoleTemplateOptions deleteRoleTemplateOptionsModel = new DeleteRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .build(); - assertEquals(deleteRoleTemplateOptionsModel.roleTemplateId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleTemplateOptionsError() throws Throwable { - new DeleteRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java deleted file mode 100644 index ff652fa335c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleTemplateVersionOptions model. - */ -public class DeleteRoleTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteRoleTemplateVersionOptions() throws Throwable { - DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptionsModel = new DeleteRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - assertEquals(deleteRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); - assertEquals(deleteRoleTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleTemplateVersionOptionsError() throws Throwable { - new DeleteRoleTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java deleted file mode 100644 index 6a33aa8f116..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteV2PolicyOptions model. - */ -public class DeleteV2PolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteV2PolicyOptions() throws Throwable { - DeleteV2PolicyOptions deleteV2PolicyOptionsModel = new DeleteV2PolicyOptions.Builder() - .id("testString") - .build(); - assertEquals(deleteV2PolicyOptionsModel.id(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteV2PolicyOptionsError() throws Throwable { - new DeleteV2PolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java deleted file mode 100644 index 104a5210ed9..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.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 EnrichedRoles model. - */ -public class EnrichedRolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testEnrichedRoles() throws Throwable { - EnrichedRoles enrichedRolesModel = new EnrichedRoles(); - assertNull(enrichedRolesModel.getRoleId()); - assertNull(enrichedRolesModel.getActions()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java deleted file mode 100644 index 460b37f8105..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.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 ErrorDetails model. - */ -public class ErrorDetailsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testErrorDetails() throws Throwable { - ErrorDetails errorDetailsModel = new ErrorDetails(); - assertNull(errorDetailsModel.getConflictsWith()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java deleted file mode 100644 index e7f7f9afbfc..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.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 ErrorObject model. - */ -public class ErrorObjectTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testErrorObject() throws Throwable { - ErrorObject errorObjectModel = new ErrorObject(); - assertNull(errorObjectModel.getCode()); - assertNull(errorObjectModel.getMessage()); - assertNull(errorObjectModel.getDetails()); - assertNull(errorObjectModel.getMoreInfo()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java deleted file mode 100644 index 90c91c8fcaf..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; -import com.ibm.cloud.platform_services.iam_policy_management.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 ExternalAccountIdentityInteractionPatch model. - */ -public class ExternalAccountIdentityInteractionPatchTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testExternalAccountIdentityInteractionPatch() throws Throwable { - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - assertEquals(identityTypesBaseModel.state(), "enabled"); - assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); - - IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() - .user(identityTypesBaseModel) - .serviceId(identityTypesBaseModel) - .service(identityTypesBaseModel) - .build(); - assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); - - ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() - .identityTypes(identityTypesPatchModel) - .build(); - assertEquals(externalAccountIdentityInteractionPatchModel.identityTypes(), identityTypesPatchModel); - - String json = TestUtilities.serialize(externalAccountIdentityInteractionPatchModel); - - ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModelNew = TestUtilities.deserialize(json, ExternalAccountIdentityInteractionPatch.class); - assertTrue(externalAccountIdentityInteractionPatchModelNew instanceof ExternalAccountIdentityInteractionPatch); - assertEquals(externalAccountIdentityInteractionPatchModelNew.identityTypes().toString(), identityTypesPatchModel.toString()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java deleted file mode 100644 index 2e4aaef7e07..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.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 ExternalAccountIdentityInteraction model. - */ -public class ExternalAccountIdentityInteractionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testExternalAccountIdentityInteraction() throws Throwable { - ExternalAccountIdentityInteraction externalAccountIdentityInteractionModel = new ExternalAccountIdentityInteraction(); - assertNull(externalAccountIdentityInteractionModel.getIdentityTypes()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java deleted file mode 100644 index b4d68673091..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.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 First model. - */ -public class FirstTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testFirst() throws Throwable { - First firstModel = new First(); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java deleted file mode 100644 index 73e66a5a756..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlAssignmentOptions model. - */ -public class GetActionControlAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetActionControlAssignmentOptions() throws Throwable { - GetActionControlAssignmentOptions getActionControlAssignmentOptionsModel = new GetActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(getActionControlAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlAssignmentOptionsError() throws Throwable { - new GetActionControlAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java deleted file mode 100644 index d6e66ce6939..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlTemplateOptions model. - */ -public class GetActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetActionControlTemplateOptions() throws Throwable { - GetActionControlTemplateOptions getActionControlTemplateOptionsModel = new GetActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .build(); - assertEquals(getActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(getActionControlTemplateOptionsModel.state(), "active"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlTemplateOptionsError() throws Throwable { - new GetActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java deleted file mode 100644 index ac8e17fe083..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlTemplateVersionOptions model. - */ -public class GetActionControlTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetActionControlTemplateVersionOptions() throws Throwable { - GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptionsModel = new GetActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - assertEquals(getActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(getActionControlTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlTemplateVersionOptionsError() throws Throwable { - new GetActionControlTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java deleted file mode 100644 index 6b2a479c37d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyAssignmentOptions model. - */ -public class GetPolicyAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetPolicyAssignmentOptions() throws Throwable { - GetPolicyAssignmentOptions getPolicyAssignmentOptionsModel = new GetPolicyAssignmentOptions.Builder() - .assignmentId("testString") - .version("1.0") - .build(); - assertEquals(getPolicyAssignmentOptionsModel.assignmentId(), "testString"); - assertEquals(getPolicyAssignmentOptionsModel.version(), "1.0"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyAssignmentOptionsError() throws Throwable { - new GetPolicyAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java deleted file mode 100644 index 2a7348c2c2d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyOptions model. - */ -public class GetPolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetPolicyOptions() throws Throwable { - GetPolicyOptions getPolicyOptionsModel = new GetPolicyOptions.Builder() - .policyId("testString") - .build(); - assertEquals(getPolicyOptionsModel.policyId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyOptionsError() throws Throwable { - new GetPolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java deleted file mode 100644 index 06535ed77ed..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyTemplateOptions model. - */ -public class GetPolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetPolicyTemplateOptions() throws Throwable { - GetPolicyTemplateOptions getPolicyTemplateOptionsModel = new GetPolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .state("active") - .build(); - assertEquals(getPolicyTemplateOptionsModel.policyTemplateId(), "testString"); - assertEquals(getPolicyTemplateOptionsModel.state(), "active"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyTemplateOptionsError() throws Throwable { - new GetPolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java deleted file mode 100644 index 264b5db4912..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyTemplateVersionOptions model. - */ -public class GetPolicyTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetPolicyTemplateVersionOptions() throws Throwable { - GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptionsModel = new GetPolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - assertEquals(getPolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); - assertEquals(getPolicyTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyTemplateVersionOptionsError() throws Throwable { - new GetPolicyTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java deleted file mode 100644 index 0c1f6b2bb5a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleAssignmentOptions model. - */ -public class GetRoleAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetRoleAssignmentOptions() throws Throwable { - GetRoleAssignmentOptions getRoleAssignmentOptionsModel = new GetRoleAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(getRoleAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleAssignmentOptionsError() throws Throwable { - new GetRoleAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java deleted file mode 100644 index e589b8d1285..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleOptions model. - */ -public class GetRoleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetRoleOptions() throws Throwable { - GetRoleOptions getRoleOptionsModel = new GetRoleOptions.Builder() - .roleId("testString") - .build(); - assertEquals(getRoleOptionsModel.roleId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleOptionsError() throws Throwable { - new GetRoleOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java deleted file mode 100644 index 3c10b5207dc..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleTemplateOptions model. - */ -public class GetRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetRoleTemplateOptions() throws Throwable { - GetRoleTemplateOptions getRoleTemplateOptionsModel = new GetRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .state("active") - .build(); - assertEquals(getRoleTemplateOptionsModel.roleTemplateId(), "testString"); - assertEquals(getRoleTemplateOptionsModel.state(), "active"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleTemplateOptionsError() throws Throwable { - new GetRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java deleted file mode 100644 index 3bd5d278630..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleTemplateVersionOptions model. - */ -public class GetRoleTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetRoleTemplateVersionOptions() throws Throwable { - GetRoleTemplateVersionOptions getRoleTemplateVersionOptionsModel = new GetRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - assertEquals(getRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); - assertEquals(getRoleTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleTemplateVersionOptionsError() throws Throwable { - new GetRoleTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java deleted file mode 100644 index 00f780c4153..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetSettingsOptions model. - */ -public class GetSettingsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetSettingsOptions() throws Throwable { - GetSettingsOptions getSettingsOptionsModel = new GetSettingsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .build(); - assertEquals(getSettingsOptionsModel.accountId(), "testString"); - assertEquals(getSettingsOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetSettingsOptionsError() throws Throwable { - new GetSettingsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java deleted file mode 100644 index ebad7af7371..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetV2PolicyOptions model. - */ -public class GetV2PolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetV2PolicyOptions() throws Throwable { - GetV2PolicyOptions getV2PolicyOptionsModel = new GetV2PolicyOptions.Builder() - .id("testString") - .format("include_last_permit") - .build(); - assertEquals(getV2PolicyOptionsModel.id(), "testString"); - assertEquals(getV2PolicyOptionsModel.format(), "include_last_permit"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetV2PolicyOptionsError() throws Throwable { - new GetV2PolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java deleted file mode 100644 index f627a54ecc2..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 Grant model. - */ -public class GrantTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGrant() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); - - String json = TestUtilities.serialize(grantModel); - - Grant grantModelNew = TestUtilities.deserialize(json, Grant.class); - assertTrue(grantModelNew instanceof Grant); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGrantError() throws Throwable { - new Grant.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java deleted file mode 100644 index f86af34fab8..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.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 GrantWithEnrichedRoles model. - */ -public class GrantWithEnrichedRolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGrantWithEnrichedRoles() throws Throwable { - GrantWithEnrichedRoles grantWithEnrichedRolesModel = new GrantWithEnrichedRoles(); - assertNull(grantWithEnrichedRolesModel.getRoles()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java deleted file mode 100644 index 2a4d38de51a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypesBase model. - */ -public class IdentityTypesBaseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testIdentityTypesBase() throws Throwable { - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - assertEquals(identityTypesBaseModel.state(), "enabled"); - assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(identityTypesBaseModel); - - IdentityTypesBase identityTypesBaseModelNew = TestUtilities.deserialize(json, IdentityTypesBase.class); - assertTrue(identityTypesBaseModelNew instanceof IdentityTypesBase); - assertEquals(identityTypesBaseModelNew.state(), "enabled"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testIdentityTypesBaseError() throws Throwable { - new IdentityTypesBase.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java deleted file mode 100644 index 3e762536695..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; -import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypesPatch model. - */ -public class IdentityTypesPatchTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testIdentityTypesPatch() throws Throwable { - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - assertEquals(identityTypesBaseModel.state(), "enabled"); - assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); - - IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() - .user(identityTypesBaseModel) - .serviceId(identityTypesBaseModel) - .service(identityTypesBaseModel) - .build(); - assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); - - String json = TestUtilities.serialize(identityTypesPatchModel); - - IdentityTypesPatch identityTypesPatchModelNew = TestUtilities.deserialize(json, IdentityTypesPatch.class); - assertTrue(identityTypesPatchModelNew instanceof IdentityTypesPatch); - assertEquals(identityTypesPatchModelNew.user().toString(), identityTypesBaseModel.toString()); - assertEquals(identityTypesPatchModelNew.serviceId().toString(), identityTypesBaseModel.toString()); - assertEquals(identityTypesPatchModelNew.service().toString(), identityTypesBaseModel.toString()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java deleted file mode 100644 index e2b6c77338f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypes model. - */ -public class IdentityTypesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testIdentityTypes() throws Throwable { - IdentityTypes identityTypesModel = new IdentityTypes(); - assertNull(identityTypesModel.getUser()); - assertNull(identityTypesModel.getServiceId()); - assertNull(identityTypesModel.getService()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java deleted file mode 100644 index c3f51516e25..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; -import com.ibm.cloud.platform_services.iam_policy_management.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 LimitData model. - */ -public class LimitDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testLimitData() throws Throwable { - LimitData limitDataModel = new LimitData(); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java deleted file mode 100644 index 0d64653d829..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlAssignmentsOptions model. - */ -public class ListActionControlAssignmentsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListActionControlAssignmentsOptions() throws Throwable { - ListActionControlAssignmentsOptions listActionControlAssignmentsOptionsModel = new ListActionControlAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listActionControlAssignmentsOptionsModel.accountId(), "testString"); - assertEquals(listActionControlAssignmentsOptionsModel.acceptLanguage(), "default"); - assertEquals(listActionControlAssignmentsOptionsModel.templateId(), "testString"); - assertEquals(listActionControlAssignmentsOptionsModel.templateVersion(), "testString"); - assertEquals(listActionControlAssignmentsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listActionControlAssignmentsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlAssignmentsOptionsError() throws Throwable { - new ListActionControlAssignmentsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java deleted file mode 100644 index dfe91662d83..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlTemplateVersionsOptions model. - */ -public class ListActionControlTemplateVersionsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListActionControlTemplateVersionsOptions() throws Throwable { - ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptionsModel = new ListActionControlTemplateVersionsOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listActionControlTemplateVersionsOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(listActionControlTemplateVersionsOptionsModel.state(), "active"); - assertEquals(listActionControlTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listActionControlTemplateVersionsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlTemplateVersionsOptionsError() throws Throwable { - new ListActionControlTemplateVersionsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java deleted file mode 100644 index 9e2e6a18158..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlTemplatesOptions model. - */ -public class ListActionControlTemplatesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListActionControlTemplatesOptions() throws Throwable { - ListActionControlTemplatesOptions listActionControlTemplatesOptionsModel = new ListActionControlTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listActionControlTemplatesOptionsModel.accountId(), "testString"); - assertEquals(listActionControlTemplatesOptionsModel.acceptLanguage(), "default"); - assertEquals(listActionControlTemplatesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listActionControlTemplatesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlTemplatesOptionsError() throws Throwable { - new ListActionControlTemplatesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java deleted file mode 100644 index 8bfe5000355..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListPoliciesOptions model. - */ -public class ListPoliciesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListPoliciesOptions() throws Throwable { - ListPoliciesOptions listPoliciesOptionsModel = new ListPoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .tagName("testString") - .tagValue("testString") - .sort("id") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listPoliciesOptionsModel.accountId(), "testString"); - assertEquals(listPoliciesOptionsModel.acceptLanguage(), "default"); - assertEquals(listPoliciesOptionsModel.iamId(), "testString"); - assertEquals(listPoliciesOptionsModel.accessGroupId(), "testString"); - assertEquals(listPoliciesOptionsModel.type(), "access"); - assertEquals(listPoliciesOptionsModel.serviceType(), "service"); - assertEquals(listPoliciesOptionsModel.tagName(), "testString"); - assertEquals(listPoliciesOptionsModel.tagValue(), "testString"); - assertEquals(listPoliciesOptionsModel.sort(), "id"); - assertEquals(listPoliciesOptionsModel.format(), "include_last_permit"); - assertEquals(listPoliciesOptionsModel.state(), "active"); - assertEquals(listPoliciesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listPoliciesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPoliciesOptionsError() throws Throwable { - new ListPoliciesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java deleted file mode 100644 index 32729befeda..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyAssignmentsOptions model. - */ -public class ListPolicyAssignmentsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListPolicyAssignmentsOptions() throws Throwable { - ListPolicyAssignmentsOptions listPolicyAssignmentsOptionsModel = new ListPolicyAssignmentsOptions.Builder() - .version("1.0") - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listPolicyAssignmentsOptionsModel.version(), "1.0"); - assertEquals(listPolicyAssignmentsOptionsModel.accountId(), "testString"); - assertEquals(listPolicyAssignmentsOptionsModel.acceptLanguage(), "default"); - assertEquals(listPolicyAssignmentsOptionsModel.templateId(), "testString"); - assertEquals(listPolicyAssignmentsOptionsModel.templateVersion(), "testString"); - assertEquals(listPolicyAssignmentsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listPolicyAssignmentsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyAssignmentsOptionsError() throws Throwable { - new ListPolicyAssignmentsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java deleted file mode 100644 index 1053d41b84b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyTemplateVersionsOptions model. - */ -public class ListPolicyTemplateVersionsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListPolicyTemplateVersionsOptions() throws Throwable { - ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptionsModel = new ListPolicyTemplateVersionsOptions.Builder() - .policyTemplateId("testString") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listPolicyTemplateVersionsOptionsModel.policyTemplateId(), "testString"); - assertEquals(listPolicyTemplateVersionsOptionsModel.state(), "active"); - assertEquals(listPolicyTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listPolicyTemplateVersionsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyTemplateVersionsOptionsError() throws Throwable { - new ListPolicyTemplateVersionsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java deleted file mode 100644 index 5065a9d9495..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyTemplatesOptions model. - */ -public class ListPolicyTemplatesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListPolicyTemplatesOptions() throws Throwable { - ListPolicyTemplatesOptions listPolicyTemplatesOptionsModel = new ListPolicyTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .state("active") - .name("testString") - .policyServiceType("service") - .policyServiceName("testString") - .policyServiceGroupId("testString") - .policyType("access") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listPolicyTemplatesOptionsModel.accountId(), "testString"); - assertEquals(listPolicyTemplatesOptionsModel.acceptLanguage(), "default"); - assertEquals(listPolicyTemplatesOptionsModel.state(), "active"); - assertEquals(listPolicyTemplatesOptionsModel.name(), "testString"); - assertEquals(listPolicyTemplatesOptionsModel.policyServiceType(), "service"); - assertEquals(listPolicyTemplatesOptionsModel.policyServiceName(), "testString"); - assertEquals(listPolicyTemplatesOptionsModel.policyServiceGroupId(), "testString"); - assertEquals(listPolicyTemplatesOptionsModel.policyType(), "access"); - assertEquals(listPolicyTemplatesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listPolicyTemplatesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyTemplatesOptionsError() throws Throwable { - new ListPolicyTemplatesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java deleted file mode 100644 index bd82df9bfd5..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleAssignmentsOptions model. - */ -public class ListRoleAssignmentsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListRoleAssignmentsOptions() throws Throwable { - ListRoleAssignmentsOptions listRoleAssignmentsOptionsModel = new ListRoleAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listRoleAssignmentsOptionsModel.accountId(), "testString"); - assertEquals(listRoleAssignmentsOptionsModel.acceptLanguage(), "default"); - assertEquals(listRoleAssignmentsOptionsModel.templateId(), "testString"); - assertEquals(listRoleAssignmentsOptionsModel.templateVersion(), "testString"); - assertEquals(listRoleAssignmentsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listRoleAssignmentsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleAssignmentsOptionsError() throws Throwable { - new ListRoleAssignmentsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java deleted file mode 100644 index 2e89527b653..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleTemplateVersionsOptions model. - */ -public class ListRoleTemplateVersionsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListRoleTemplateVersionsOptions() throws Throwable { - ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptionsModel = new ListRoleTemplateVersionsOptions.Builder() - .roleTemplateId("testString") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listRoleTemplateVersionsOptionsModel.roleTemplateId(), "testString"); - assertEquals(listRoleTemplateVersionsOptionsModel.state(), "active"); - assertEquals(listRoleTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listRoleTemplateVersionsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleTemplateVersionsOptionsError() throws Throwable { - new ListRoleTemplateVersionsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java deleted file mode 100644 index 21d23a7be0f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleTemplatesOptions model. - */ -public class ListRoleTemplatesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListRoleTemplatesOptions() throws Throwable { - ListRoleTemplatesOptions listRoleTemplatesOptionsModel = new ListRoleTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .name("testString") - .roleName("testString") - .roleServiceName("testString") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listRoleTemplatesOptionsModel.accountId(), "testString"); - assertEquals(listRoleTemplatesOptionsModel.acceptLanguage(), "default"); - assertEquals(listRoleTemplatesOptionsModel.name(), "testString"); - assertEquals(listRoleTemplatesOptionsModel.roleName(), "testString"); - assertEquals(listRoleTemplatesOptionsModel.roleServiceName(), "testString"); - assertEquals(listRoleTemplatesOptionsModel.state(), "active"); - assertEquals(listRoleTemplatesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listRoleTemplatesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleTemplatesOptionsError() throws Throwable { - new ListRoleTemplatesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java deleted file mode 100644 index 4fb97c7fc9a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListRolesOptions model. - */ -public class ListRolesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListRolesOptions() throws Throwable { - ListRolesOptions listRolesOptionsModel = new ListRolesOptions.Builder() - .acceptLanguage("default") - .accountId("testString") - .serviceName("iam-groups") - .sourceServiceName("iam-groups") - .policyType("authorization") - .serviceGroupId("IAM") - .build(); - assertEquals(listRolesOptionsModel.acceptLanguage(), "default"); - assertEquals(listRolesOptionsModel.accountId(), "testString"); - assertEquals(listRolesOptionsModel.serviceName(), "iam-groups"); - assertEquals(listRolesOptionsModel.sourceServiceName(), "iam-groups"); - assertEquals(listRolesOptionsModel.policyType(), "authorization"); - assertEquals(listRolesOptionsModel.serviceGroupId(), "IAM"); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java deleted file mode 100644 index 8c72945373b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListV2PoliciesOptions model. - */ -public class ListV2PoliciesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListV2PoliciesOptions() throws Throwable { - ListV2PoliciesOptions listV2PoliciesOptionsModel = new ListV2PoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .serviceName("testString") - .serviceGroupId("testString") - .sort("testString") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listV2PoliciesOptionsModel.accountId(), "testString"); - assertEquals(listV2PoliciesOptionsModel.acceptLanguage(), "default"); - assertEquals(listV2PoliciesOptionsModel.iamId(), "testString"); - assertEquals(listV2PoliciesOptionsModel.accessGroupId(), "testString"); - assertEquals(listV2PoliciesOptionsModel.type(), "access"); - assertEquals(listV2PoliciesOptionsModel.serviceType(), "service"); - assertEquals(listV2PoliciesOptionsModel.serviceName(), "testString"); - assertEquals(listV2PoliciesOptionsModel.serviceGroupId(), "testString"); - assertEquals(listV2PoliciesOptionsModel.sort(), "testString"); - assertEquals(listV2PoliciesOptionsModel.format(), "include_last_permit"); - assertEquals(listV2PoliciesOptionsModel.state(), "active"); - assertEquals(listV2PoliciesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listV2PoliciesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListV2PoliciesOptionsError() throws Throwable { - new ListV2PoliciesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java deleted file mode 100644 index 0661d4245a2..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 NestedConditionRuleAttribute model. - */ -public class NestedConditionRuleAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNestedConditionRuleAttribute() throws Throwable { - NestedConditionRuleAttribute nestedConditionRuleAttributeModel = new NestedConditionRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(nestedConditionRuleAttributeModel.key(), "testString"); - assertEquals(nestedConditionRuleAttributeModel.operator(), "stringEquals"); - assertEquals(nestedConditionRuleAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(nestedConditionRuleAttributeModel); - - NestedConditionRuleAttribute nestedConditionRuleAttributeModelNew = TestUtilities.deserialize(json, NestedConditionRuleAttribute.class); - assertTrue(nestedConditionRuleAttributeModelNew instanceof NestedConditionRuleAttribute); - assertEquals(nestedConditionRuleAttributeModelNew.key(), "testString"); - assertEquals(nestedConditionRuleAttributeModelNew.operator(), "stringEquals"); - assertEquals(nestedConditionRuleAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testNestedConditionRuleAttributeError() throws Throwable { - new NestedConditionRuleAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java deleted file mode 100644 index 1ba394dbb7d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleWithConditions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 NestedConditionRuleWithConditions model. - */ -public class NestedConditionRuleWithConditionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNestedConditionRuleWithConditions() throws Throwable { - RuleAttribute ruleAttributeModel = new RuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(ruleAttributeModel.key(), "testString"); - assertEquals(ruleAttributeModel.operator(), "stringEquals"); - assertEquals(ruleAttributeModel.value(), "testString"); - - NestedConditionRuleWithConditions nestedConditionRuleWithConditionsModel = new NestedConditionRuleWithConditions.Builder() - .operator("and") - .conditions(java.util.Arrays.asList(ruleAttributeModel)) - .build(); - assertEquals(nestedConditionRuleWithConditionsModel.operator(), "and"); - assertEquals(nestedConditionRuleWithConditionsModel.conditions(), java.util.Arrays.asList(ruleAttributeModel)); - - String json = TestUtilities.serialize(nestedConditionRuleWithConditionsModel); - - NestedConditionRuleWithConditions nestedConditionRuleWithConditionsModelNew = TestUtilities.deserialize(json, NestedConditionRuleWithConditions.class); - assertTrue(nestedConditionRuleWithConditionsModelNew instanceof NestedConditionRuleWithConditions); - assertEquals(nestedConditionRuleWithConditionsModelNew.operator(), "and"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testNestedConditionRuleWithConditionsError() throws Throwable { - new NestedConditionRuleWithConditions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java deleted file mode 100644 index 4956eea2675..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedCondition; -import com.ibm.cloud.platform_services.iam_policy_management.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 NestedCondition model. - */ -public class NestedConditionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testNestedCondition() throws Throwable { - NestedCondition nestedConditionModel = new NestedCondition(); - assertNotNull(nestedConditionModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java deleted file mode 100644 index c5e084a44d5..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.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 Next model. - */ -public class NextTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNext() throws Throwable { - Next nextModel = new Next(); - assertNull(nextModel.getStart()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java deleted file mode 100644 index d5b05ede760..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentResourcePolicy model. - */ -public class PolicyAssignmentResourcePolicyTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentResourcePolicy() throws Throwable { - PolicyAssignmentResourcePolicy policyAssignmentResourcePolicyModel = new PolicyAssignmentResourcePolicy(); - assertNull(policyAssignmentResourcePolicyModel.getResourceCreated()); - assertNull(policyAssignmentResourcePolicyModel.getStatus()); - assertNull(policyAssignmentResourcePolicyModel.getErrorMessage()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java deleted file mode 100644 index 8b146425617..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentResources model. - */ -public class PolicyAssignmentResourcesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentResources() throws Throwable { - PolicyAssignmentResources policyAssignmentResourcesModel = new PolicyAssignmentResources(); - assertNull(policyAssignmentResourcesModel.getTarget()); - assertNull(policyAssignmentResourcesModel.getPolicy()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java deleted file mode 100644 index 8a3a6b67703..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Collection model. - */ -public class PolicyAssignmentV1CollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentV1Collection() throws Throwable { - PolicyAssignmentV1Collection policyAssignmentV1CollectionModel = new PolicyAssignmentV1Collection(); - assertNull(policyAssignmentV1CollectionModel.getLimit()); - assertNull(policyAssignmentV1CollectionModel.getFirst()); - assertNull(policyAssignmentV1CollectionModel.getNext()); - assertNull(policyAssignmentV1CollectionModel.getPrevious()); - assertNull(policyAssignmentV1CollectionModel.getAssignments()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java deleted file mode 100644 index 56c843a232e..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Resources model. - */ -public class PolicyAssignmentV1ResourcesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentV1Resources() throws Throwable { - PolicyAssignmentV1Resources policyAssignmentV1ResourcesModel = new PolicyAssignmentV1Resources(); - assertNull(policyAssignmentV1ResourcesModel.getTarget()); - assertNull(policyAssignmentV1ResourcesModel.getPolicy()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java deleted file mode 100644 index f5d14b29447..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Subject model. - */ -public class PolicyAssignmentV1SubjectTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentV1Subject() throws Throwable { - PolicyAssignmentV1Subject policyAssignmentV1SubjectModel = new PolicyAssignmentV1Subject(); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java deleted file mode 100644 index d9889483421..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1 model. - */ -public class PolicyAssignmentV1Test { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentV1() throws Throwable { - PolicyAssignmentV1 policyAssignmentV1Model = new PolicyAssignmentV1(); - assertNull(policyAssignmentV1Model.getTarget()); - assertNull(policyAssignmentV1Model.getResources()); - assertNull(policyAssignmentV1Model.getSubject()); - assertNull(policyAssignmentV1Model.getTemplate()); - assertNull(policyAssignmentV1Model.getStatus()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java deleted file mode 100644 index 3d372dfaf20..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyCollection model. - */ -public class PolicyCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyCollection() throws Throwable { - PolicyCollection policyCollectionModel = new PolicyCollection(); - assertNull(policyCollectionModel.getLimit()); - assertNull(policyCollectionModel.getFirst()); - assertNull(policyCollectionModel.getNext()); - assertNull(policyCollectionModel.getPrevious()); - assertNull(policyCollectionModel.getPolicies()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java deleted file mode 100644 index cb2f203a5c3..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyResource model. - */ -public class PolicyResourceTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyResource() throws Throwable { - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceAttributeModel.name(), "testString"); - assertEquals(resourceAttributeModel.value(), "testString"); - assertEquals(resourceAttributeModel.operator(), "testString"); - - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceTagModel.name(), "testString"); - assertEquals(resourceTagModel.value(), "testString"); - assertEquals(resourceTagModel.operator(), "testString"); - - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); - assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); - - String json = TestUtilities.serialize(policyResourceModel); - - PolicyResource policyResourceModelNew = TestUtilities.deserialize(json, PolicyResource.class); - assertTrue(policyResourceModelNew instanceof PolicyResource); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testPolicyResourceError() throws Throwable { - new PolicyResource.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java deleted file mode 100644 index 299e15b1fd4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyRole model. - */ -public class PolicyRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyRole() throws Throwable { - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - assertEquals(policyRoleModel.roleId(), "testString"); - - String json = TestUtilities.serialize(policyRoleModel); - - PolicyRole policyRoleModelNew = TestUtilities.deserialize(json, PolicyRole.class); - assertTrue(policyRoleModelNew instanceof PolicyRole); - assertEquals(policyRoleModelNew.roleId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testPolicyRoleError() throws Throwable { - new PolicyRole.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java deleted file mode 100644 index 6d0a937bd53..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicySubject model. - */ -public class PolicySubjectTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicySubject() throws Throwable { - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - assertEquals(subjectAttributeModel.name(), "testString"); - assertEquals(subjectAttributeModel.value(), "testString"); - - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); - - String json = TestUtilities.serialize(policySubjectModel); - - PolicySubject policySubjectModelNew = TestUtilities.deserialize(json, PolicySubject.class); - assertTrue(policySubjectModelNew instanceof PolicySubject); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testPolicySubjectError() throws Throwable { - new PolicySubject.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java deleted file mode 100644 index 8cb98be3d32..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentCollection model. - */ -public class PolicyTemplateAssignmentCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateAssignmentCollection() throws Throwable { - PolicyTemplateAssignmentCollection policyTemplateAssignmentCollectionModel = new PolicyTemplateAssignmentCollection(); - assertNull(policyTemplateAssignmentCollectionModel.getLimit()); - assertNull(policyTemplateAssignmentCollectionModel.getFirst()); - assertNull(policyTemplateAssignmentCollectionModel.getNext()); - assertNull(policyTemplateAssignmentCollectionModel.getPrevious()); - assertNull(policyTemplateAssignmentCollectionModel.getAssignments()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java deleted file mode 100644 index fded12633d2..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItemsPolicyAssignment model. - */ -public class PolicyTemplateAssignmentItemsPolicyAssignmentTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateAssignmentItemsPolicyAssignment() throws Throwable { - PolicyTemplateAssignmentItemsPolicyAssignment policyTemplateAssignmentItemsPolicyAssignmentModel = new PolicyTemplateAssignmentItemsPolicyAssignment(); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTemplateId()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTemplateVersion()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getAssignmentId()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTargetType()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTarget()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getResources()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getStatus()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java deleted file mode 100644 index 6b74125d238..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItemsPolicyAssignmentV1 model. - */ -public class PolicyTemplateAssignmentItemsPolicyAssignmentV1Test { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateAssignmentItemsPolicyAssignmentV1() throws Throwable { - PolicyTemplateAssignmentItemsPolicyAssignmentV1 policyTemplateAssignmentItemsPolicyAssignmentV1Model = new PolicyTemplateAssignmentItemsPolicyAssignmentV1(); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getTarget()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getResources()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getSubject()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getTemplate()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getStatus()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java deleted file mode 100644 index 05b400e91c1..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItems model. - */ -public class PolicyTemplateAssignmentItemsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testPolicyTemplateAssignmentItems() throws Throwable { - PolicyTemplateAssignmentItems policyTemplateAssignmentItemsModel = new PolicyTemplateAssignmentItems(); - assertNotNull(policyTemplateAssignmentItemsModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java deleted file mode 100644 index 52041b1a6a3..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateCollection model. - */ -public class PolicyTemplateCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateCollection() throws Throwable { - PolicyTemplateCollection policyTemplateCollectionModel = new PolicyTemplateCollection(); - assertNull(policyTemplateCollectionModel.getLimit()); - assertNull(policyTemplateCollectionModel.getFirst()); - assertNull(policyTemplateCollectionModel.getNext()); - assertNull(policyTemplateCollectionModel.getPrevious()); - assertNull(policyTemplateCollectionModel.getPolicyTemplates()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java deleted file mode 100644 index b6ee06990a2..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateLimitData model. - */ -public class PolicyTemplateLimitDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateLimitData() throws Throwable { - PolicyTemplateLimitData policyTemplateLimitDataModel = new PolicyTemplateLimitData(); - assertNull(policyTemplateLimitDataModel.getName()); - assertNull(policyTemplateLimitDataModel.getDescription()); - assertNull(policyTemplateLimitDataModel.getAccountId()); - assertNull(policyTemplateLimitDataModel.getVersion()); - assertNull(policyTemplateLimitDataModel.isCommitted()); - assertNull(policyTemplateLimitDataModel.getPolicy()); - assertNull(policyTemplateLimitDataModel.getState()); - assertNull(policyTemplateLimitDataModel.getCounts()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java deleted file mode 100644 index edeb45c4d96..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateMetaData model. - */ -public class PolicyTemplateMetaDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateMetaData() throws Throwable { - PolicyTemplateMetaData policyTemplateMetaDataModel = new PolicyTemplateMetaData(); - assertNull(policyTemplateMetaDataModel.getType()); - assertNull(policyTemplateMetaDataModel.getDescription()); - assertNull(policyTemplateMetaDataModel.getSubjects()); - assertNull(policyTemplateMetaDataModel.getRoles()); - assertNull(policyTemplateMetaDataModel.getResources()); - assertNull(policyTemplateMetaDataModel.getState()); - assertNull(policyTemplateMetaDataModel.getTemplate()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java deleted file mode 100644 index c349e4a3415..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplate model. - */ -public class PolicyTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplate() throws Throwable { - PolicyTemplate policyTemplateModel = new PolicyTemplate(); - assertNull(policyTemplateModel.getName()); - assertNull(policyTemplateModel.getDescription()); - assertNull(policyTemplateModel.getAccountId()); - assertNull(policyTemplateModel.getVersion()); - assertNull(policyTemplateModel.isCommitted()); - assertNull(policyTemplateModel.getPolicy()); - assertNull(policyTemplateModel.getState()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java deleted file mode 100644 index da651956461..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateVersionsCollection model. - */ -public class PolicyTemplateVersionsCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateVersionsCollection() throws Throwable { - PolicyTemplateVersionsCollection policyTemplateVersionsCollectionModel = new PolicyTemplateVersionsCollection(); - assertNull(policyTemplateVersionsCollectionModel.getLimit()); - assertNull(policyTemplateVersionsCollectionModel.getFirst()); - assertNull(policyTemplateVersionsCollectionModel.getNext()); - assertNull(policyTemplateVersionsCollectionModel.getPrevious()); - assertNull(policyTemplateVersionsCollectionModel.getVersions()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java deleted file mode 100644 index 28eba4f9a85..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 Policy model. - */ -public class PolicyTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicy() throws Throwable { - Policy policyModel = new Policy(); - assertNull(policyModel.getType()); - assertNull(policyModel.getDescription()); - assertNull(policyModel.getSubjects()); - assertNull(policyModel.getRoles()); - assertNull(policyModel.getResources()); - assertNull(policyModel.getState()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java deleted file mode 100644 index e3788c51212..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.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 Previous model. - */ -public class PreviousTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPrevious() throws Throwable { - Previous previousModel = new Previous(); - assertNull(previousModel.getStart()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java deleted file mode 100644 index 430f5f63764..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceActionControlTemplateOptions model. - */ -public class ReplaceActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplaceActionControlTemplateOptions() throws Throwable { - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateActionControlModel.serviceName(), "testString"); - assertEquals(templateActionControlModel.description(), "testString"); - assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); - - ReplaceActionControlTemplateOptions replaceActionControlTemplateOptionsModel = new ReplaceActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .ifMatch("testString") - .name("testString") - .description("testString") - .actionControl(templateActionControlModel) - .committed(true) - .build(); - assertEquals(replaceActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.version(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.ifMatch(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.name(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.description(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.actionControl(), templateActionControlModel); - assertEquals(replaceActionControlTemplateOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceActionControlTemplateOptionsError() throws Throwable { - new ReplaceActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java deleted file mode 100644 index 2f20b05f37c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplacePolicyOptions model. - */ -public class ReplacePolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplacePolicyOptions() throws Throwable { - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - assertEquals(subjectAttributeModel.name(), "testString"); - assertEquals(subjectAttributeModel.value(), "testString"); - - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); - - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - assertEquals(policyRoleModel.roleId(), "testString"); - - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceAttributeModel.name(), "testString"); - assertEquals(resourceAttributeModel.value(), "testString"); - assertEquals(resourceAttributeModel.operator(), "testString"); - - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceTagModel.name(), "testString"); - assertEquals(resourceTagModel.value(), "testString"); - assertEquals(resourceTagModel.operator(), "testString"); - - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); - assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); - - ReplacePolicyOptions replacePolicyOptionsModel = new ReplacePolicyOptions.Builder() - .policyId("testString") - .ifMatch("testString") - .type("testString") - .subjects(java.util.Arrays.asList(policySubjectModel)) - .roles(java.util.Arrays.asList(policyRoleModel)) - .resources(java.util.Arrays.asList(policyResourceModel)) - .description("testString") - .build(); - assertEquals(replacePolicyOptionsModel.policyId(), "testString"); - assertEquals(replacePolicyOptionsModel.ifMatch(), "testString"); - assertEquals(replacePolicyOptionsModel.type(), "testString"); - assertEquals(replacePolicyOptionsModel.subjects(), java.util.Arrays.asList(policySubjectModel)); - assertEquals(replacePolicyOptionsModel.roles(), java.util.Arrays.asList(policyRoleModel)); - assertEquals(replacePolicyOptionsModel.resources(), java.util.Arrays.asList(policyResourceModel)); - assertEquals(replacePolicyOptionsModel.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplacePolicyOptionsError() throws Throwable { - new ReplacePolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java deleted file mode 100644 index 2dc2430daca..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplacePolicyTemplateOptions model. - */ -public class ReplacePolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplacePolicyTemplateOptions() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - assertEquals(templatePolicyModel.type(), "access"); - assertEquals(templatePolicyModel.description(), "testString"); - assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); - assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); - assertEquals(templatePolicyModel.pattern(), "testString"); - assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), templateControlModel); - - ReplacePolicyTemplateOptions replacePolicyTemplateOptionsModel = new ReplacePolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .ifMatch("testString") - .policy(templatePolicyModel) - .name("testString") - .description("testString") - .committed(true) - .build(); - assertEquals(replacePolicyTemplateOptionsModel.policyTemplateId(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.version(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.ifMatch(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.policy(), templatePolicyModel); - assertEquals(replacePolicyTemplateOptionsModel.name(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.description(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplacePolicyTemplateOptionsError() throws Throwable { - new ReplacePolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java deleted file mode 100644 index 9900abb2543..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceRoleOptions model. - */ -public class ReplaceRoleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplaceRoleOptions() throws Throwable { - ReplaceRoleOptions replaceRoleOptionsModel = new ReplaceRoleOptions.Builder() - .roleId("testString") - .ifMatch("testString") - .displayName("testString") - .actions(java.util.Arrays.asList("testString")) - .description("testString") - .build(); - assertEquals(replaceRoleOptionsModel.roleId(), "testString"); - assertEquals(replaceRoleOptionsModel.ifMatch(), "testString"); - assertEquals(replaceRoleOptionsModel.displayName(), "testString"); - assertEquals(replaceRoleOptionsModel.actions(), java.util.Arrays.asList("testString")); - assertEquals(replaceRoleOptionsModel.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceRoleOptionsError() throws Throwable { - new ReplaceRoleOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java deleted file mode 100644 index 2f731aea7d4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceRoleTemplateOptions model. - */ -public class ReplaceRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplaceRoleTemplateOptions() throws Throwable { - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateRoleModel.displayName(), "testString"); - assertEquals(templateRoleModel.serviceName(), "testString"); - assertEquals(templateRoleModel.description(), "testString"); - assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); - - ReplaceRoleTemplateOptions replaceRoleTemplateOptionsModel = new ReplaceRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .ifMatch("testString") - .name("testString") - .description("testString") - .role(templateRoleModel) - .committed(true) - .build(); - assertEquals(replaceRoleTemplateOptionsModel.roleTemplateId(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.version(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.ifMatch(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.name(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.description(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.role(), templateRoleModel); - assertEquals(replaceRoleTemplateOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceRoleTemplateOptionsError() throws Throwable { - new ReplaceRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java deleted file mode 100644 index 23690eda780..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceV2PolicyOptions model. - */ -public class ReplaceV2PolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplaceV2PolicyOptions() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); - - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - assertEquals(controlModel.grant(), grantModel); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - ReplaceV2PolicyOptions replaceV2PolicyOptionsModel = new ReplaceV2PolicyOptions.Builder() - .id("testString") - .ifMatch("testString") - .control(controlModel) - .type("access") - .description("testString") - .subject(v2PolicySubjectModel) - .resource(v2PolicyResourceModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .build(); - assertEquals(replaceV2PolicyOptionsModel.id(), "testString"); - assertEquals(replaceV2PolicyOptionsModel.ifMatch(), "testString"); - assertEquals(replaceV2PolicyOptionsModel.control(), controlModel); - assertEquals(replaceV2PolicyOptionsModel.type(), "access"); - assertEquals(replaceV2PolicyOptionsModel.description(), "testString"); - assertEquals(replaceV2PolicyOptionsModel.subject(), v2PolicySubjectModel); - assertEquals(replaceV2PolicyOptionsModel.resource(), v2PolicyResourceModel); - assertEquals(replaceV2PolicyOptionsModel.pattern(), "testString"); - assertEquals(replaceV2PolicyOptionsModel.rule(), v2PolicyRuleModel); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceV2PolicyOptionsError() throws Throwable { - new ReplaceV2PolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java deleted file mode 100644 index bd50b514f43..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 ResourceAttribute model. - */ -public class ResourceAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testResourceAttribute() throws Throwable { - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceAttributeModel.name(), "testString"); - assertEquals(resourceAttributeModel.value(), "testString"); - assertEquals(resourceAttributeModel.operator(), "testString"); - - String json = TestUtilities.serialize(resourceAttributeModel); - - ResourceAttribute resourceAttributeModelNew = TestUtilities.deserialize(json, ResourceAttribute.class); - assertTrue(resourceAttributeModelNew instanceof ResourceAttribute); - assertEquals(resourceAttributeModelNew.name(), "testString"); - assertEquals(resourceAttributeModelNew.value(), "testString"); - assertEquals(resourceAttributeModelNew.operator(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testResourceAttributeError() throws Throwable { - new ResourceAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java deleted file mode 100644 index 88a1eb5d5b6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.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 ResourceTag model. - */ -public class ResourceTagTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testResourceTag() throws Throwable { - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceTagModel.name(), "testString"); - assertEquals(resourceTagModel.value(), "testString"); - assertEquals(resourceTagModel.operator(), "testString"); - - String json = TestUtilities.serialize(resourceTagModel); - - ResourceTag resourceTagModelNew = TestUtilities.deserialize(json, ResourceTag.class); - assertTrue(resourceTagModelNew instanceof ResourceTag); - assertEquals(resourceTagModelNew.name(), "testString"); - assertEquals(resourceTagModelNew.value(), "testString"); - assertEquals(resourceTagModelNew.operator(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testResourceTagError() throws Throwable { - new ResourceTag.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java deleted file mode 100644 index e4c0bcc6f92..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAction model. - */ -public class RoleActionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAction() throws Throwable { - RoleAction roleActionModel = new RoleAction(); - assertNull(roleActionModel.getId()); - assertNull(roleActionModel.getDisplayName()); - assertNull(roleActionModel.getDescription()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java deleted file mode 100644 index 42801bc7771..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentCollection model. - */ -public class RoleAssignmentCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentCollection() throws Throwable { - RoleAssignmentCollection roleAssignmentCollectionModel = new RoleAssignmentCollection(); - assertNull(roleAssignmentCollectionModel.getLimit()); - assertNull(roleAssignmentCollectionModel.getFirst()); - assertNull(roleAssignmentCollectionModel.getNext()); - assertNull(roleAssignmentCollectionModel.getPrevious()); - assertNull(roleAssignmentCollectionModel.getAssignments()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java deleted file mode 100644 index bef8b71b0fa..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResourceCreated model. - */ -public class RoleAssignmentResourceCreatedTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentResourceCreated() throws Throwable { - RoleAssignmentResourceCreated roleAssignmentResourceCreatedModel = new RoleAssignmentResourceCreated(); - assertNull(roleAssignmentResourceCreatedModel.getId()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java deleted file mode 100644 index c346ca0f48f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResourceRole model. - */ -public class RoleAssignmentResourceRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentResourceRole() throws Throwable { - RoleAssignmentResourceRole roleAssignmentResourceRoleModel = new RoleAssignmentResourceRole(); - assertNull(roleAssignmentResourceRoleModel.getResourceCreated()); - assertNull(roleAssignmentResourceRoleModel.getErrorMessage()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java deleted file mode 100644 index 4fca1b25b5b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResource model. - */ -public class RoleAssignmentResourceTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentResource() throws Throwable { - RoleAssignmentResource roleAssignmentResourceModel = new RoleAssignmentResource(); - assertNull(roleAssignmentResourceModel.getTarget()); - assertNull(roleAssignmentResourceModel.getRole()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java deleted file mode 100644 index 4f2e3a37200..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentTemplate model. - */ -public class RoleAssignmentTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentTemplate() throws Throwable { - RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(roleAssignmentTemplateModel.id(), "testString"); - assertEquals(roleAssignmentTemplateModel.version(), "testString"); - - String json = TestUtilities.serialize(roleAssignmentTemplateModel); - - RoleAssignmentTemplate roleAssignmentTemplateModelNew = TestUtilities.deserialize(json, RoleAssignmentTemplate.class); - assertTrue(roleAssignmentTemplateModelNew instanceof RoleAssignmentTemplate); - assertEquals(roleAssignmentTemplateModelNew.id(), "testString"); - assertEquals(roleAssignmentTemplateModelNew.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRoleAssignmentTemplateError() throws Throwable { - new RoleAssignmentTemplate.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java deleted file mode 100644 index bd3bda7ce24..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignment model. - */ -public class RoleAssignmentTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignment() throws Throwable { - RoleAssignment roleAssignmentModel = new RoleAssignment(); - assertNull(roleAssignmentModel.getTemplate()); - assertNull(roleAssignmentModel.getTarget()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java deleted file mode 100644 index 812c2dcb131..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleCollection model. - */ -public class RoleCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleCollection() throws Throwable { - RoleCollection roleCollectionModel = new RoleCollection(); - assertNull(roleCollectionModel.getCustomRoles()); - assertNull(roleCollectionModel.getServiceRoles()); - assertNull(roleCollectionModel.getSystemRoles()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java deleted file mode 100644 index fde4d11ff4c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateCollection model. - */ -public class RoleTemplateCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplateCollection() throws Throwable { - RoleTemplateCollection roleTemplateCollectionModel = new RoleTemplateCollection(); - assertNull(roleTemplateCollectionModel.getLimit()); - assertNull(roleTemplateCollectionModel.getFirst()); - assertNull(roleTemplateCollectionModel.getNext()); - assertNull(roleTemplateCollectionModel.getPrevious()); - assertNull(roleTemplateCollectionModel.getRoleTemplates()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java deleted file mode 100644 index 6c208e1c38f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplatePrototypeRole model. - */ -public class RoleTemplatePrototypeRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplatePrototypeRole() throws Throwable { - RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() - .name("testString") - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(roleTemplatePrototypeRoleModel.name(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.displayName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.serviceName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.description(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.actions(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(roleTemplatePrototypeRoleModel); - - RoleTemplatePrototypeRole roleTemplatePrototypeRoleModelNew = TestUtilities.deserialize(json, RoleTemplatePrototypeRole.class); - assertTrue(roleTemplatePrototypeRoleModelNew instanceof RoleTemplatePrototypeRole); - assertEquals(roleTemplatePrototypeRoleModelNew.name(), "testString"); - assertEquals(roleTemplatePrototypeRoleModelNew.displayName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModelNew.serviceName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModelNew.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRoleTemplatePrototypeRoleError() throws Throwable { - new RoleTemplatePrototypeRole.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java deleted file mode 100644 index af9de718e23..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateReferencesItem model. - */ -public class RoleTemplateReferencesItemTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplateReferencesItem() throws Throwable { - RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(roleTemplateReferencesItemModel.id(), "testString"); - assertEquals(roleTemplateReferencesItemModel.version(), "testString"); - - String json = TestUtilities.serialize(roleTemplateReferencesItemModel); - - RoleTemplateReferencesItem roleTemplateReferencesItemModelNew = TestUtilities.deserialize(json, RoleTemplateReferencesItem.class); - assertTrue(roleTemplateReferencesItemModelNew instanceof RoleTemplateReferencesItem); - assertEquals(roleTemplateReferencesItemModelNew.id(), "testString"); - assertEquals(roleTemplateReferencesItemModelNew.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRoleTemplateReferencesItemError() throws Throwable { - new RoleTemplateReferencesItem.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java deleted file mode 100644 index 8bb27d8dd62..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplate model. - */ -public class RoleTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplate() throws Throwable { - RoleTemplate roleTemplateModel = new RoleTemplate(); - assertNull(roleTemplateModel.getName()); - assertNull(roleTemplateModel.getDescription()); - assertNull(roleTemplateModel.getAccountId()); - assertNull(roleTemplateModel.isCommitted()); - assertNull(roleTemplateModel.getRole()); - assertNull(roleTemplateModel.getVersion()); - assertNull(roleTemplateModel.getState()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java deleted file mode 100644 index 068cf309bd6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateVersionsCollection model. - */ -public class RoleTemplateVersionsCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplateVersionsCollection() throws Throwable { - RoleTemplateVersionsCollection roleTemplateVersionsCollectionModel = new RoleTemplateVersionsCollection(); - assertNull(roleTemplateVersionsCollectionModel.getLimit()); - assertNull(roleTemplateVersionsCollectionModel.getFirst()); - assertNull(roleTemplateVersionsCollectionModel.getNext()); - assertNull(roleTemplateVersionsCollectionModel.getPrevious()); - assertNull(roleTemplateVersionsCollectionModel.getVersions()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java deleted file mode 100644 index a632e63587f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; -import com.ibm.cloud.platform_services.iam_policy_management.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 Role model. - */ -public class RoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRole() throws Throwable { - Role roleModel = new Role.Builder() - .displayName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(roleModel.displayName(), "testString"); - assertEquals(roleModel.description(), "testString"); - assertEquals(roleModel.actions(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(roleModel); - - Role roleModelNew = TestUtilities.deserialize(json, Role.class); - assertTrue(roleModelNew instanceof Role); - assertEquals(roleModelNew.displayName(), "testString"); - assertEquals(roleModelNew.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRoleError() throws Throwable { - new Role.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java deleted file mode 100644 index 8383ef794a9..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 Roles model. - */ -public class RolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoles() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - String json = TestUtilities.serialize(rolesModel); - - Roles rolesModelNew = TestUtilities.deserialize(json, Roles.class); - assertTrue(rolesModelNew instanceof Roles); - assertEquals(rolesModelNew.roleId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRolesError() throws Throwable { - new Roles.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java deleted file mode 100644 index a05e5ee8704..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 RuleAttribute model. - */ -public class RuleAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRuleAttribute() throws Throwable { - RuleAttribute ruleAttributeModel = new RuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(ruleAttributeModel.key(), "testString"); - assertEquals(ruleAttributeModel.operator(), "stringEquals"); - assertEquals(ruleAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(ruleAttributeModel); - - RuleAttribute ruleAttributeModelNew = TestUtilities.deserialize(json, RuleAttribute.class); - assertTrue(ruleAttributeModelNew instanceof RuleAttribute); - assertEquals(ruleAttributeModelNew.key(), "testString"); - assertEquals(ruleAttributeModelNew.operator(), "stringEquals"); - assertEquals(ruleAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRuleAttributeError() throws Throwable { - new RuleAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java deleted file mode 100644 index 7bae03a42e0..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 SubjectAttribute model. - */ -public class SubjectAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testSubjectAttribute() throws Throwable { - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - assertEquals(subjectAttributeModel.name(), "testString"); - assertEquals(subjectAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(subjectAttributeModel); - - SubjectAttribute subjectAttributeModelNew = TestUtilities.deserialize(json, SubjectAttribute.class); - assertTrue(subjectAttributeModelNew instanceof SubjectAttribute); - assertEquals(subjectAttributeModelNew.name(), "testString"); - assertEquals(subjectAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testSubjectAttributeError() throws Throwable { - new SubjectAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java deleted file mode 100644 index d3a6d4ef53a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateActionControl model. - */ -public class TemplateActionControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateActionControl() throws Throwable { - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateActionControlModel.serviceName(), "testString"); - assertEquals(templateActionControlModel.description(), "testString"); - assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(templateActionControlModel); - - TemplateActionControl templateActionControlModelNew = TestUtilities.deserialize(json, TemplateActionControl.class); - assertTrue(templateActionControlModelNew instanceof TemplateActionControl); - assertEquals(templateActionControlModelNew.serviceName(), "testString"); - assertEquals(templateActionControlModelNew.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateActionControlError() throws Throwable { - new TemplateActionControl.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java deleted file mode 100644 index fba96e64cef..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateControl model. - */ -public class TemplateControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateControl() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - String json = TestUtilities.serialize(templateControlModel); - - TemplateControl templateControlModelNew = TestUtilities.deserialize(json, TemplateControl.class); - assertTrue(templateControlModelNew instanceof TemplateControl); - assertEquals(templateControlModelNew.grant().toString(), templateGrantModel.toString()); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateControlError() throws Throwable { - new TemplateControl.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java deleted file mode 100644 index b440cf19100..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateCountData model. - */ -public class TemplateCountDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateCountData() throws Throwable { - TemplateCountData templateCountDataModel = new TemplateCountData(); - assertNull(templateCountDataModel.getTemplate()); - assertNull(templateCountDataModel.getVersion()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java deleted file mode 100644 index e7759eacc21..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoleReferences; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrantRoleReferences model. - */ -public class TemplateGrantRoleReferencesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateGrantRoleReferences() throws Throwable { - RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(roleTemplateReferencesItemModel.id(), "testString"); - assertEquals(roleTemplateReferencesItemModel.version(), "testString"); - - TemplateGrantRoleReferences templateGrantRoleReferencesModel = new TemplateGrantRoleReferences.Builder() - .roleTemplateReferences(java.util.Arrays.asList(roleTemplateReferencesItemModel)) - .build(); - assertEquals(templateGrantRoleReferencesModel.roleTemplateReferences(), java.util.Arrays.asList(roleTemplateReferencesItemModel)); - - String json = TestUtilities.serialize(templateGrantRoleReferencesModel); - - TemplateGrantRoleReferences templateGrantRoleReferencesModelNew = TestUtilities.deserialize(json, TemplateGrantRoleReferences.class); - assertTrue(templateGrantRoleReferencesModelNew instanceof TemplateGrantRoleReferences); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateGrantRoleReferencesError() throws Throwable { - new TemplateGrantRoleReferences.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java deleted file mode 100644 index 8cddc6f9a19..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrantRoles model. - */ -public class TemplateGrantRolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateGrantRoles() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantRolesModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantRolesModel.roles(), java.util.Arrays.asList(rolesModel)); - - String json = TestUtilities.serialize(templateGrantRolesModel); - - TemplateGrantRoles templateGrantRolesModelNew = TestUtilities.deserialize(json, TemplateGrantRoles.class); - assertTrue(templateGrantRolesModelNew instanceof TemplateGrantRoles); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateGrantRolesError() throws Throwable { - new TemplateGrantRoles.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java deleted file mode 100644 index 90e6fdc2b9f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrant model. - */ -public class TemplateGrantTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testTemplateGrant() throws Throwable { - TemplateGrant templateGrantModel = new TemplateGrant(); - assertNotNull(templateGrantModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java deleted file mode 100644 index c2688232e2b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateMetadata model. - */ -public class TemplateMetadataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateMetadata() throws Throwable { - TemplateMetadata templateMetadataModel = new TemplateMetadata(); - assertNull(templateMetadataModel.getId()); - assertNull(templateMetadataModel.getVersion()); - assertNull(templateMetadataModel.getAssignmentId()); - assertNull(templateMetadataModel.getRootId()); - assertNull(templateMetadataModel.getRootVersion()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java deleted file mode 100644 index 0e256ffd599..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplatePolicy model. - */ -public class TemplatePolicyTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplatePolicy() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - assertEquals(templatePolicyModel.type(), "access"); - assertEquals(templatePolicyModel.description(), "testString"); - assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); - assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); - assertEquals(templatePolicyModel.pattern(), "testString"); - assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), templateControlModel); - - String json = TestUtilities.serialize(templatePolicyModel); - - TemplatePolicy templatePolicyModelNew = TestUtilities.deserialize(json, TemplatePolicy.class); - assertTrue(templatePolicyModelNew instanceof TemplatePolicy); - assertEquals(templatePolicyModelNew.type(), "access"); - assertEquals(templatePolicyModelNew.description(), "testString"); - assertEquals(templatePolicyModelNew.resource().toString(), v2PolicyResourceModel.toString()); - assertEquals(templatePolicyModelNew.subject().toString(), v2PolicySubjectModel.toString()); - assertEquals(templatePolicyModelNew.pattern(), "testString"); - assertEquals(templatePolicyModelNew.rule().toString(), v2PolicyRuleModel.toString()); - assertEquals(templatePolicyModelNew.control().toString(), templateControlModel.toString()); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplatePolicyError() throws Throwable { - new TemplatePolicy.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java deleted file mode 100644 index 1735364bc85..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateRole model. - */ -public class TemplateRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateRole() throws Throwable { - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateRoleModel.displayName(), "testString"); - assertEquals(templateRoleModel.serviceName(), "testString"); - assertEquals(templateRoleModel.description(), "testString"); - assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(templateRoleModel); - - TemplateRole templateRoleModelNew = TestUtilities.deserialize(json, TemplateRole.class); - assertTrue(templateRoleModelNew instanceof TemplateRole); - assertEquals(templateRoleModelNew.displayName(), "testString"); - assertEquals(templateRoleModelNew.serviceName(), "testString"); - assertEquals(templateRoleModelNew.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateRoleError() throws Throwable { - new TemplateRole.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java deleted file mode 100644 index df7a09c2829..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateActionControlAssignmentOptions model. - */ -public class UpdateActionControlAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdateActionControlAssignmentOptions() throws Throwable { - UpdateActionControlAssignmentOptions updateActionControlAssignmentOptionsModel = new UpdateActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .ifMatch("testString") - .templateVersion("testString") - .build(); - assertEquals(updateActionControlAssignmentOptionsModel.assignmentId(), "testString"); - assertEquals(updateActionControlAssignmentOptionsModel.ifMatch(), "testString"); - assertEquals(updateActionControlAssignmentOptionsModel.templateVersion(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateActionControlAssignmentOptionsError() throws Throwable { - new UpdateActionControlAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java deleted file mode 100644 index 0008325ffcf..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdatePolicyAssignmentOptions model. - */ -public class UpdatePolicyAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdatePolicyAssignmentOptions() throws Throwable { - UpdatePolicyAssignmentOptions updatePolicyAssignmentOptionsModel = new UpdatePolicyAssignmentOptions.Builder() - .assignmentId("testString") - .version("1.0") - .ifMatch("testString") - .templateVersion("testString") - .build(); - assertEquals(updatePolicyAssignmentOptionsModel.assignmentId(), "testString"); - assertEquals(updatePolicyAssignmentOptionsModel.version(), "1.0"); - assertEquals(updatePolicyAssignmentOptionsModel.ifMatch(), "testString"); - assertEquals(updatePolicyAssignmentOptionsModel.templateVersion(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdatePolicyAssignmentOptionsError() throws Throwable { - new UpdatePolicyAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java deleted file mode 100644 index de000e8c745..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdatePolicyStateOptions model. - */ -public class UpdatePolicyStateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdatePolicyStateOptions() throws Throwable { - UpdatePolicyStateOptions updatePolicyStateOptionsModel = new UpdatePolicyStateOptions.Builder() - .policyId("testString") - .ifMatch("testString") - .state("active") - .build(); - assertEquals(updatePolicyStateOptionsModel.policyId(), "testString"); - assertEquals(updatePolicyStateOptionsModel.ifMatch(), "testString"); - assertEquals(updatePolicyStateOptionsModel.state(), "active"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdatePolicyStateOptionsError() throws Throwable { - new UpdatePolicyStateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java deleted file mode 100644 index 879c3d5f456..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateRoleAssignmentOptions model. - */ -public class UpdateRoleAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdateRoleAssignmentOptions() throws Throwable { - UpdateRoleAssignmentOptions updateRoleAssignmentOptionsModel = new UpdateRoleAssignmentOptions.Builder() - .assignmentId("testString") - .ifMatch("testString") - .templateVersion("testString") - .build(); - assertEquals(updateRoleAssignmentOptionsModel.assignmentId(), "testString"); - assertEquals(updateRoleAssignmentOptionsModel.ifMatch(), "testString"); - assertEquals(updateRoleAssignmentOptionsModel.templateVersion(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateRoleAssignmentOptionsError() throws Throwable { - new UpdateRoleAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java deleted file mode 100644 index 1d69d016781..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateSettingsOptions model. - */ -public class UpdateSettingsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdateSettingsOptions() throws Throwable { - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - assertEquals(identityTypesBaseModel.state(), "enabled"); - assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); - - IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() - .user(identityTypesBaseModel) - .serviceId(identityTypesBaseModel) - .service(identityTypesBaseModel) - .build(); - assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); - - ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() - .identityTypes(identityTypesPatchModel) - .build(); - assertEquals(externalAccountIdentityInteractionPatchModel.identityTypes(), identityTypesPatchModel); - - UpdateSettingsOptions updateSettingsOptionsModel = new UpdateSettingsOptions.Builder() - .accountId("testString") - .ifMatch("testString") - .externalAccountIdentityInteraction(externalAccountIdentityInteractionPatchModel) - .acceptLanguage("default") - .build(); - assertEquals(updateSettingsOptionsModel.accountId(), "testString"); - assertEquals(updateSettingsOptionsModel.ifMatch(), "testString"); - assertEquals(updateSettingsOptionsModel.externalAccountIdentityInteraction(), externalAccountIdentityInteractionPatchModel); - assertEquals(updateSettingsOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateSettingsOptionsError() throws Throwable { - new UpdateSettingsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java deleted file mode 100644 index aff020c8985..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyCollection model. - */ -public class V2PolicyCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyCollection() throws Throwable { - V2PolicyCollection v2PolicyCollectionModel = new V2PolicyCollection(); - assertNull(v2PolicyCollectionModel.getLimit()); - assertNull(v2PolicyCollectionModel.getFirst()); - assertNull(v2PolicyCollectionModel.getNext()); - assertNull(v2PolicyCollectionModel.getPrevious()); - assertNull(v2PolicyCollectionModel.getPolicies()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java deleted file mode 100644 index 407eaadb155..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResourceAttribute model. - */ -public class V2PolicyResourceAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyResourceAttribute() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(v2PolicyResourceAttributeModel); - - V2PolicyResourceAttribute v2PolicyResourceAttributeModelNew = TestUtilities.deserialize(json, V2PolicyResourceAttribute.class); - assertTrue(v2PolicyResourceAttributeModelNew instanceof V2PolicyResourceAttribute); - assertEquals(v2PolicyResourceAttributeModelNew.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModelNew.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyResourceAttributeError() throws Throwable { - new V2PolicyResourceAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java deleted file mode 100644 index 97c9c813216..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResourceTag model. - */ -public class V2PolicyResourceTagTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyResourceTag() throws Throwable { - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - String json = TestUtilities.serialize(v2PolicyResourceTagModel); - - V2PolicyResourceTag v2PolicyResourceTagModelNew = TestUtilities.deserialize(json, V2PolicyResourceTag.class); - assertTrue(v2PolicyResourceTagModelNew instanceof V2PolicyResourceTag); - assertEquals(v2PolicyResourceTagModelNew.key(), "testString"); - assertEquals(v2PolicyResourceTagModelNew.value(), "testString"); - assertEquals(v2PolicyResourceTagModelNew.operator(), "stringEquals"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyResourceTagError() throws Throwable { - new V2PolicyResourceTag.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java deleted file mode 100644 index d153fd97be6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResource model. - */ -public class V2PolicyResourceTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyResource() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - String json = TestUtilities.serialize(v2PolicyResourceModel); - - V2PolicyResource v2PolicyResourceModelNew = TestUtilities.deserialize(json, V2PolicyResource.class); - assertTrue(v2PolicyResourceModelNew instanceof V2PolicyResource); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyResourceError() throws Throwable { - new V2PolicyResource.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java deleted file mode 100644 index 6d6da85f2b4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRuleRuleAttribute model. - */ -public class V2PolicyRuleRuleAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyRuleRuleAttribute() throws Throwable { - V2PolicyRuleRuleAttribute v2PolicyRuleRuleAttributeModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleRuleAttributeModel.key(), "testString"); - assertEquals(v2PolicyRuleRuleAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleRuleAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(v2PolicyRuleRuleAttributeModel); - - V2PolicyRuleRuleAttribute v2PolicyRuleRuleAttributeModelNew = TestUtilities.deserialize(json, V2PolicyRuleRuleAttribute.class); - assertTrue(v2PolicyRuleRuleAttributeModelNew instanceof V2PolicyRuleRuleAttribute); - assertEquals(v2PolicyRuleRuleAttributeModelNew.key(), "testString"); - assertEquals(v2PolicyRuleRuleAttributeModelNew.operator(), "stringEquals"); - assertEquals(v2PolicyRuleRuleAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyRuleRuleAttributeError() throws Throwable { - new V2PolicyRuleRuleAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java deleted file mode 100644 index fdf25669ef7..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleWithNestedConditions; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRuleRuleWithNestedConditions model. - */ -public class V2PolicyRuleRuleWithNestedConditionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyRuleRuleWithNestedConditions() throws Throwable { - NestedConditionRuleAttribute nestedConditionModel = new NestedConditionRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(nestedConditionModel.key(), "testString"); - assertEquals(nestedConditionModel.operator(), "stringEquals"); - assertEquals(nestedConditionModel.value(), "testString"); - - V2PolicyRuleRuleWithNestedConditions v2PolicyRuleRuleWithNestedConditionsModel = new V2PolicyRuleRuleWithNestedConditions.Builder() - .operator("and") - .conditions(java.util.Arrays.asList(nestedConditionModel)) - .build(); - assertEquals(v2PolicyRuleRuleWithNestedConditionsModel.operator(), "and"); - assertEquals(v2PolicyRuleRuleWithNestedConditionsModel.conditions(), java.util.Arrays.asList(nestedConditionModel)); - - String json = TestUtilities.serialize(v2PolicyRuleRuleWithNestedConditionsModel); - - V2PolicyRuleRuleWithNestedConditions v2PolicyRuleRuleWithNestedConditionsModelNew = TestUtilities.deserialize(json, V2PolicyRuleRuleWithNestedConditions.class); - assertTrue(v2PolicyRuleRuleWithNestedConditionsModelNew instanceof V2PolicyRuleRuleWithNestedConditions); - assertEquals(v2PolicyRuleRuleWithNestedConditionsModelNew.operator(), "and"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyRuleRuleWithNestedConditionsError() throws Throwable { - new V2PolicyRuleRuleWithNestedConditions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java deleted file mode 100644 index e0af599840c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRule; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRule model. - */ -public class V2PolicyRuleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testV2PolicyRule() throws Throwable { - V2PolicyRule v2PolicyRuleModel = new V2PolicyRule(); - assertNotNull(v2PolicyRuleModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java deleted file mode 100644 index a6e8f9d8922..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicySubjectAttribute model. - */ -public class V2PolicySubjectAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicySubjectAttribute() throws Throwable { - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(v2PolicySubjectAttributeModel); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModelNew = TestUtilities.deserialize(json, V2PolicySubjectAttribute.class); - assertTrue(v2PolicySubjectAttributeModelNew instanceof V2PolicySubjectAttribute); - assertEquals(v2PolicySubjectAttributeModelNew.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModelNew.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicySubjectAttributeError() throws Throwable { - new V2PolicySubjectAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java deleted file mode 100644 index 37adbaff5df..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicySubject model. - */ -public class V2PolicySubjectTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicySubject() throws Throwable { - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - String json = TestUtilities.serialize(v2PolicySubjectModel); - - V2PolicySubject v2PolicySubjectModelNew = TestUtilities.deserialize(json, V2PolicySubject.class); - assertTrue(v2PolicySubjectModelNew instanceof V2PolicySubject); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicySubjectError() throws Throwable { - new V2PolicySubject.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java deleted file mode 100644 index 2ffbe45575b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyTemplateMetaData model. - */ -public class V2PolicyTemplateMetaDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyTemplateMetaData() throws Throwable { - V2PolicyTemplateMetaData v2PolicyTemplateMetaDataModel = new V2PolicyTemplateMetaData(); - assertNull(v2PolicyTemplateMetaDataModel.getType()); - assertNull(v2PolicyTemplateMetaDataModel.getDescription()); - assertNull(v2PolicyTemplateMetaDataModel.getSubject()); - assertNull(v2PolicyTemplateMetaDataModel.getResource()); - assertNull(v2PolicyTemplateMetaDataModel.getPattern()); - assertNull(v2PolicyTemplateMetaDataModel.getRule()); - assertNull(v2PolicyTemplateMetaDataModel.getControl()); - assertNull(v2PolicyTemplateMetaDataModel.getState()); - assertNull(v2PolicyTemplateMetaDataModel.getLastPermitAt()); - assertNull(v2PolicyTemplateMetaDataModel.getLastPermitFrequency()); - assertNull(v2PolicyTemplateMetaDataModel.getTemplate()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java deleted file mode 100644 index 1630201062c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2Policy model. - */ -public class V2PolicyTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2Policy() throws Throwable { - V2Policy v2PolicyModel = new V2Policy(); - assertNull(v2PolicyModel.getType()); - assertNull(v2PolicyModel.getDescription()); - assertNull(v2PolicyModel.getSubject()); - assertNull(v2PolicyModel.getResource()); - assertNull(v2PolicyModel.getPattern()); - assertNull(v2PolicyModel.getRule()); - assertNull(v2PolicyModel.getControl()); - assertNull(v2PolicyModel.getState()); - assertNull(v2PolicyModel.getLastPermitAt()); - assertNull(v2PolicyModel.getLastPermitFrequency()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java deleted file mode 100644 index 04aaecc16ae..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * (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_policy_management.v1.utils; - -import java.util.Base64; -import java.util.Map; -import java.util.Set; -import java.util.List; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.io.InputStream; -import java.io.ByteArrayInputStream; - -import okhttp3.mockwebserver.RecordedRequest; -import okhttp3.HttpUrl; -import com.ibm.cloud.sdk.core.util.DateUtils; -import com.ibm.cloud.sdk.core.util.GsonSingleton; -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; - -/** - * A class used by the unit tests containing utility functions. - */ -public class TestUtilities { - public static Map createMockMap() { - Map mockMap = new HashMap<>(); - mockMap.put("foo", "bar"); - return mockMap; - } - - public static HashMap createMockStreamMap() { - return new HashMap() { - { put("key1", createMockStream("This is a mock file.")); } - }; - } - - public static Map parseQueryString(RecordedRequest req) { - Map queryMap = new HashMap<>(); - - try { - HttpUrl requestUrl = req.getRequestUrl(); - - if (requestUrl != null) { - Set queryParamsNames = requestUrl.queryParameterNames(); - // map the parameter name to its corresponding value - for (String p : queryParamsNames) { - // get the corresponding value for the parameter (p) - List val = requestUrl.queryParameterValues(p); - if (val != null && !val.isEmpty()) { - String joinedQuery = String.join(",", val); - queryMap.put(p, joinedQuery); - } - } - } - if (queryMap.isEmpty()) { - return null; - } - } catch (Exception e) { - return null; - } - - return queryMap; - } - - public static String parseReqPath(RecordedRequest req) { - String parsedPath = null; - - try { - String fullPath = req.getPath(); - if (fullPath != null && !fullPath.isEmpty()) { - // retrieve the path segment before the query parameter - parsedPath = fullPath.split("\\?", 2)[0]; - } - if (parsedPath.isEmpty() || parsedPath == null) { - return null; - } - - } catch (Exception e) { - return null; - } - - return parsedPath; - } - - public static String serialize(Object obj) { - return GsonSingleton.getGson().toJson(obj); - } - - public static T deserialize(String json, Class clazz) { - return GsonSingleton.getGson().fromJson(json, clazz); - } - - public static InputStream createMockStream(String s) { - return new ByteArrayInputStream(s.getBytes()); - } - - public static List creatMockListFileWithMetadata() { - List list = new ArrayList(); - byte[] fileBytes = {(byte) 0xde, (byte) 0xad, (byte) 0xbe, (byte) 0xef}; - InputStream inputStream = new ByteArrayInputStream(fileBytes); - FileWithMetadata.Builder builder = new FileWithMetadata.Builder(); - builder.data(inputStream); - FileWithMetadata fileWithMetadata = builder.build(); - list.add(fileWithMetadata); - - return list; - } - - public static byte[] createMockByteArray(String encodedString) throws Exception { - return Base64.getDecoder().decode(encodedString); - } - - public static Date createMockDate(String date) throws Exception { - return DateUtils.parseAsDate(date); - } - - public static Date createMockDateTime(String date) throws Exception { - return DateUtils.parseAsDateTime(date); - } -} \ No newline at end of file From 10d6de048c7c64ba33630e07df2cd71d5876a898 Mon Sep 17 00:00:00 2001 From: Bhavana Bellamgari Date: Wed, 10 Dec 2025 13:12:26 +0530 Subject: [PATCH 06/13] Updated template grant schema Signed-off-by: Bhavana Bellamgari Signed-off-by: Bhavana Bellamgari --- .../v1/IamPolicyManagement.java | 2566 +++++++++ .../AccountSettingsAccessManagement.java | 40 + .../v1/model/ActionControlAssignment.java | 207 + .../ActionControlAssignmentCollection.java | 88 + .../ActionControlAssignmentResource.java | 52 + ...ontrolAssignmentResourceActionControl.java | 53 + ...ctionControlAssignmentResourceCreated.java | 38 + .../ActionControlAssignmentTemplate.java | 134 + .../model/ActionControlAssignmentsPager.java | 108 + .../v1/model/ActionControlTemplate.java | 203 + .../ActionControlTemplateCollection.java | 90 + ...tionControlTemplateVersionsCollection.java | 88 + .../ActionControlTemplateVersionsPager.java | 108 + .../v1/model/ActionControlTemplatesPager.java | 108 + .../v1/model/AssignmentResourceCreated.java | 38 + .../v1/model/AssignmentResourceError.java | 88 + .../v1/model/AssignmentTargetDetails.java | 142 + .../v1/model/AssignmentTemplateDetails.java | 119 + .../CommitActionControlTemplateOptions.java | 134 + .../v1/model/CommitPolicyTemplateOptions.java | 134 + .../v1/model/CommitRoleTemplateOptions.java | 134 + .../v1/model/ConflictsWith.java | 62 + .../v1/model/Control.java | 104 + .../v1/model/ControlResponse.java | 42 + .../v1/model/ControlResponseControl.java | 24 + ...ntrolResponseControlWithEnrichedRoles.java | 24 + ...ctionControlTemplateAssignmentOptions.java | 191 + .../CreateActionControlTemplateOptions.java | 251 + ...teActionControlTemplateVersionOptions.java | 211 + .../v1/model/CreatePolicyOptions.java | 311 + ...CreatePolicyTemplateAssignmentOptions.java | 221 + .../v1/model/CreatePolicyTemplateOptions.java | 255 + .../CreatePolicyTemplateVersionOptions.java | 214 + .../v1/model/CreateRoleOptions.java | 308 + .../CreateRoleTemplateAssignmentOptions.java | 191 + .../v1/model/CreateRoleTemplateOptions.java | 251 + .../CreateRoleTemplateVersionOptions.java | 211 + .../v1/model/CreateV2PolicyOptions.java | 312 + .../v1/model/CustomRole.java | 195 + .../DeleteActionControlAssignmentOptions.java | 104 + .../DeleteActionControlTemplateOptions.java | 104 + ...teActionControlTemplateVersionOptions.java | 134 + .../model/DeletePolicyAssignmentOptions.java | 104 + .../v1/model/DeletePolicyOptions.java | 104 + .../v1/model/DeletePolicyTemplateOptions.java | 104 + .../DeletePolicyTemplateVersionOptions.java | 134 + .../v1/model/DeleteRoleAssignmentOptions.java | 104 + .../v1/model/DeleteRoleOptions.java | 104 + .../v1/model/DeleteRoleTemplateOptions.java | 104 + .../DeleteRoleTemplateVersionOptions.java | 134 + .../v1/model/DeleteV2PolicyOptions.java | 104 + .../v1/model/EnrichedRoles.java | 81 + .../v1/model/ErrorDetails.java | 40 + .../v1/model/ErrorObject.java | 128 + .../ExternalAccountIdentityInteraction.java | 40 + ...ternalAccountIdentityInteractionPatch.java | 95 + .../iam_policy_management/v1/model/First.java | 38 + .../GetActionControlAssignmentOptions.java | 104 + .../GetActionControlTemplateOptions.java | 140 + ...etActionControlTemplateVersionOptions.java | 134 + .../v1/model/GetPolicyAssignmentOptions.java | 134 + .../v1/model/GetPolicyOptions.java | 104 + .../v1/model/GetPolicyTemplateOptions.java | 140 + .../GetPolicyTemplateVersionOptions.java | 134 + .../v1/model/GetRoleAssignmentOptions.java | 104 + .../v1/model/GetRoleOptions.java | 104 + .../v1/model/GetRoleTemplateOptions.java | 140 + .../model/GetRoleTemplateVersionOptions.java | 134 + .../v1/model/GetSettingsOptions.java | 141 + .../v1/model/GetV2PolicyOptions.java | 148 + .../iam_policy_management/v1/model/Grant.java | 124 + .../v1/model/GrantWithEnrichedRoles.java | 40 + .../v1/model/IdentityTypes.java | 64 + .../v1/model/IdentityTypesBase.java | 168 + .../v1/model/IdentityTypesPatch.java | 147 + .../v1/model/LimitData.java | 50 + .../ListActionControlAssignmentsOptions.java | 245 + ...tActionControlTemplateVersionsOptions.java | 192 + .../ListActionControlTemplatesOptions.java | 193 + .../v1/model/ListPoliciesOptions.java | 501 ++ .../model/ListPolicyAssignmentsOptions.java | 275 + .../ListPolicyTemplateVersionsOptions.java | 192 + .../v1/model/ListPolicyTemplatesOptions.java | 379 ++ .../v1/model/ListRoleAssignmentsOptions.java | 245 + .../ListRoleTemplateVersionsOptions.java | 192 + .../v1/model/ListRoleTemplatesOptions.java | 307 + .../v1/model/ListRolesOptions.java | 234 + .../v1/model/ListV2PoliciesOptions.java | 492 ++ .../v1/model/NestedCondition.java | 126 + .../model/NestedConditionRuleAttribute.java | 170 + .../NestedConditionRuleWithConditions.java | 139 + .../iam_policy_management/v1/model/Next.java | 50 + .../v1/model/PoliciesPager.java | 108 + .../v1/model/Policy.java | 188 + .../model/PolicyAssignmentResourcePolicy.java | 65 + .../v1/model/PolicyAssignmentResources.java | 50 + .../v1/model/PolicyAssignmentV1.java | 193 + .../model/PolicyAssignmentV1Collection.java | 88 + .../v1/model/PolicyAssignmentV1Resources.java | 50 + .../v1/model/PolicyAssignmentV1Subject.java | 60 + .../v1/model/PolicyAssignmentsPager.java | 108 + .../v1/model/PolicyCollection.java | 88 + .../v1/model/PolicyResource.java | 167 + .../v1/model/PolicyRole.java | 131 + .../v1/model/PolicySubject.java | 124 + .../v1/model/PolicyTemplate.java | 202 + .../PolicyTemplateAssignmentCollection.java | 88 + .../model/PolicyTemplateAssignmentItems.java | 261 + ...mplateAssignmentItemsPolicyAssignment.java | 50 + ...lateAssignmentItemsPolicyAssignmentV1.java | 38 + .../v1/model/PolicyTemplateCollection.java | 90 + .../v1/model/PolicyTemplateLimitData.java | 214 + .../v1/model/PolicyTemplateMetaData.java | 201 + .../PolicyTemplateVersionsCollection.java | 88 + .../v1/model/PolicyTemplateVersionsPager.java | 108 + .../v1/model/PolicyTemplatesPager.java | 108 + .../v1/model/Previous.java | 50 + .../ReplaceActionControlTemplateOptions.java | 273 + .../v1/model/ReplacePolicyOptions.java | 335 ++ .../model/ReplacePolicyTemplateOptions.java | 276 + .../v1/model/ReplaceRoleOptions.java | 255 + .../v1/model/ReplaceRoleTemplateOptions.java | 273 + .../v1/model/ReplaceV2PolicyOptions.java | 336 ++ .../v1/model/ResourceAttribute.java | 160 + .../v1/model/ResourceTag.java | 160 + .../iam_policy_management/v1/model/Role.java | 196 + .../v1/model/RoleAction.java | 64 + .../v1/model/RoleAssignment.java | 207 + .../v1/model/RoleAssignmentCollection.java | 88 + .../v1/model/RoleAssignmentResource.java | 50 + .../model/RoleAssignmentResourceCreated.java | 38 + .../v1/model/RoleAssignmentResourceRole.java | 53 + .../v1/model/RoleAssignmentTemplate.java | 134 + .../v1/model/RoleAssignmentsPager.java | 108 + .../v1/model/RoleCollection.java | 68 + .../v1/model/RoleTemplate.java | 202 + .../v1/model/RoleTemplateCollection.java | 90 + .../v1/model/RoleTemplatePrototypeRole.java | 239 + .../v1/model/RoleTemplateReferencesItem.java | 134 + .../model/RoleTemplateVersionsCollection.java | 88 + .../v1/model/RoleTemplateVersionsPager.java | 108 + .../v1/model/RoleTemplatesPager.java | 108 + .../iam_policy_management/v1/model/Roles.java | 106 + .../v1/model/RuleAttribute.java | 209 + .../v1/model/SubjectAttribute.java | 134 + .../v1/model/TemplateActionControl.java | 182 + .../v1/model/TemplateControl.java | 104 + .../v1/model/TemplateCountData.java | 50 + .../v1/model/TemplateGrant.java | 58 + .../v1/model/TemplateGrantRoleReferences.java | 110 + .../v1/model/TemplateGrantRoles.java | 110 + .../v1/model/TemplateMetadata.java | 91 + .../v1/model/TemplatePolicy.java | 272 + .../v1/model/TemplateRole.java | 209 + .../UpdateActionControlAssignmentOptions.java | 166 + .../model/UpdatePolicyAssignmentOptions.java | 196 + .../v1/model/UpdatePolicyStateOptions.java | 171 + .../v1/model/UpdateRoleAssignmentOptions.java | 166 + .../v1/model/UpdateSettingsOptions.java | 199 + .../v1/model/V2PoliciesPager.java | 108 + .../v1/model/V2Policy.java | 247 + .../v1/model/V2PolicyCollection.java | 88 + .../v1/model/V2PolicyResource.java | 167 + .../v1/model/V2PolicyResourceAttribute.java | 181 + .../v1/model/V2PolicyResourceTag.java | 174 + .../v1/model/V2PolicyRule.java | 126 + .../v1/model/V2PolicyRuleRuleAttribute.java | 170 + .../V2PolicyRuleRuleWithNestedConditions.java | 139 + .../v1/model/V2PolicySubject.java | 124 + .../v1/model/V2PolicySubjectAttribute.java | 175 + .../v1/model/V2PolicyTemplateMetaData.java | 260 + .../v1/package-info.java | 17 + .../v1/IamPolicyManagementTest.java | 5007 +++++++++++++++++ .../AccountSettingsAccessManagementTest.java | 40 + ...ActionControlAssignmentCollectionTest.java | 47 + ...olAssignmentResourceActionControlTest.java | 43 + ...nControlAssignmentResourceCreatedTest.java | 37 + .../ActionControlAssignmentResourceTest.java | 45 + .../ActionControlAssignmentTemplateTest.java | 54 + .../v1/model/ActionControlAssignmentTest.java | 40 + .../ActionControlTemplateCollectionTest.java | 46 + .../v1/model/ActionControlTemplateTest.java | 44 + ...ControlTemplateVersionsCollectionTest.java | 46 + .../model/AssignmentResourceCreatedTest.java | 37 + .../v1/model/AssignmentResourceErrorTest.java | 44 + .../v1/model/AssignmentTargetDetailsTest.java | 54 + .../model/AssignmentTemplateDetailsTest.java | 48 + ...ommitActionControlTemplateOptionsTest.java | 47 + .../CommitPolicyTemplateOptionsTest.java | 47 + .../model/CommitRoleTemplateOptionsTest.java | 47 + .../v1/model/ConflictsWithTest.java | 39 + .../v1/model/ControlResponseControlTest.java | 39 + ...lResponseControlWithEnrichedRolesTest.java | 40 + .../v1/model/ControlResponseTest.java | 40 + .../v1/model/ControlTest.java | 63 + ...nControlTemplateAssignmentOptionsTest.java | 65 + ...reateActionControlTemplateOptionsTest.java | 65 + ...tionControlTemplateVersionOptionsTest.java | 63 + .../v1/model/CreatePolicyOptionsTest.java | 103 + ...tePolicyTemplateAssignmentOptionsTest.java | 67 + .../CreatePolicyTemplateOptionsTest.java | 145 + ...reatePolicyTemplateVersionOptionsTest.java | 143 + .../v1/model/CreateRoleOptionsTest.java | 57 + ...eateRoleTemplateAssignmentOptionsTest.java | 65 + .../model/CreateRoleTemplateOptionsTest.java | 69 + .../CreateRoleTemplateVersionOptionsTest.java | 65 + .../v1/model/CreateV2PolicyOptionsTest.java | 131 + .../v1/model/CustomRoleTest.java | 42 + ...eteActionControlAssignmentOptionsTest.java | 45 + ...eleteActionControlTemplateOptionsTest.java | 45 + ...tionControlTemplateVersionOptionsTest.java | 47 + .../DeletePolicyAssignmentOptionsTest.java | 45 + .../v1/model/DeletePolicyOptionsTest.java | 45 + .../DeletePolicyTemplateOptionsTest.java | 45 + ...eletePolicyTemplateVersionOptionsTest.java | 47 + .../DeleteRoleAssignmentOptionsTest.java | 45 + .../v1/model/DeleteRoleOptionsTest.java | 45 + .../model/DeleteRoleTemplateOptionsTest.java | 45 + .../DeleteRoleTemplateVersionOptionsTest.java | 47 + .../v1/model/DeleteV2PolicyOptionsTest.java | 45 + .../v1/model/EnrichedRolesTest.java | 39 + .../v1/model/ErrorDetailsTest.java | 38 + .../v1/model/ErrorObjectTest.java | 42 + ...alAccountIdentityInteractionPatchTest.java | 63 + ...xternalAccountIdentityInteractionTest.java | 39 + .../v1/model/FirstTest.java | 36 + ...GetActionControlAssignmentOptionsTest.java | 45 + .../GetActionControlTemplateOptionsTest.java | 47 + ...tionControlTemplateVersionOptionsTest.java | 47 + .../model/GetPolicyAssignmentOptionsTest.java | 47 + .../v1/model/GetPolicyOptionsTest.java | 45 + .../model/GetPolicyTemplateOptionsTest.java | 47 + .../GetPolicyTemplateVersionOptionsTest.java | 47 + .../model/GetRoleAssignmentOptionsTest.java | 45 + .../v1/model/GetRoleOptionsTest.java | 45 + .../v1/model/GetRoleTemplateOptionsTest.java | 47 + .../GetRoleTemplateVersionOptionsTest.java | 47 + .../v1/model/GetSettingsOptionsTest.java | 47 + .../v1/model/GetV2PolicyOptionsTest.java | 47 + .../v1/model/GrantTest.java | 56 + .../v1/model/GrantWithEnrichedRolesTest.java | 39 + .../v1/model/IdentityTypesBaseTest.java | 53 + .../v1/model/IdentityTypesPatchTest.java | 59 + .../v1/model/IdentityTypesTest.java | 40 + .../v1/model/LimitDataTest.java | 36 + ...stActionControlAssignmentsOptionsTest.java | 55 + ...ionControlTemplateVersionsOptionsTest.java | 51 + ...ListActionControlTemplatesOptionsTest.java | 51 + .../v1/model/ListPoliciesOptionsTest.java | 69 + .../ListPolicyAssignmentsOptionsTest.java | 57 + ...ListPolicyTemplateVersionsOptionsTest.java | 51 + .../model/ListPolicyTemplatesOptionsTest.java | 63 + .../model/ListRoleAssignmentsOptionsTest.java | 55 + .../ListRoleTemplateVersionsOptionsTest.java | 51 + .../model/ListRoleTemplatesOptionsTest.java | 59 + .../v1/model/ListRolesOptionsTest.java | 49 + .../v1/model/ListV2PoliciesOptionsTest.java | 69 + .../NestedConditionRuleAttributeTest.java | 57 + ...NestedConditionRuleWithConditionsTest.java | 63 + .../v1/model/NestedConditionTest.java | 38 + .../v1/model/NextTest.java | 37 + .../PolicyAssignmentResourcePolicyTest.java | 44 + .../model/PolicyAssignmentResourcesTest.java | 44 + .../PolicyAssignmentV1CollectionTest.java | 55 + .../PolicyAssignmentV1ResourcesTest.java | 45 + .../model/PolicyAssignmentV1SubjectTest.java | 36 + .../v1/model/PolicyAssignmentV1Test.java | 51 + .../v1/model/PolicyCollectionTest.java | 52 + .../v1/model/PolicyResourceTest.java | 72 + .../v1/model/PolicyRoleTest.java | 51 + .../v1/model/PolicySubjectTest.java | 58 + ...olicyTemplateAssignmentCollectionTest.java | 55 + ...teAssignmentItemsPolicyAssignmentTest.java | 50 + ...AssignmentItemsPolicyAssignmentV1Test.java | 51 + .../PolicyTemplateAssignmentItemsTest.java | 48 + .../model/PolicyTemplateCollectionTest.java | 55 + .../v1/model/PolicyTemplateLimitDataTest.java | 56 + .../v1/model/PolicyTemplateMetaDataTest.java | 50 + .../v1/model/PolicyTemplateTest.java | 53 + .../PolicyTemplateVersionsCollectionTest.java | 55 + .../v1/model/PolicyTest.java | 48 + .../v1/model/PreviousTest.java | 37 + ...placeActionControlTemplateOptionsTest.java | 67 + .../v1/model/ReplacePolicyOptionsTest.java | 105 + .../ReplacePolicyTemplateOptionsTest.java | 147 + .../v1/model/ReplaceRoleOptionsTest.java | 53 + .../model/ReplaceRoleTemplateOptionsTest.java | 69 + .../v1/model/ReplaceV2PolicyOptionsTest.java | 133 + .../v1/model/ResourceAttributeTest.java | 57 + .../v1/model/ResourceTagTest.java | 57 + .../v1/model/RoleActionTest.java | 39 + .../model/RoleAssignmentCollectionTest.java | 47 + .../RoleAssignmentResourceCreatedTest.java | 37 + .../model/RoleAssignmentResourceRoleTest.java | 43 + .../v1/model/RoleAssignmentResourceTest.java | 45 + .../v1/model/RoleAssignmentTemplateTest.java | 54 + .../v1/model/RoleAssignmentTest.java | 40 + .../v1/model/RoleCollectionTest.java | 41 + .../v1/model/RoleTemplateCollectionTest.java | 46 + .../model/RoleTemplatePrototypeRoleTest.java | 62 + .../model/RoleTemplateReferencesItemTest.java | 54 + .../v1/model/RoleTemplateTest.java | 44 + .../RoleTemplateVersionsCollectionTest.java | 46 + .../v1/model/RoleTest.java | 56 + .../v1/model/RolesTest.java | 51 + .../v1/model/RuleAttributeTest.java | 57 + .../v1/model/SubjectAttributeTest.java | 54 + .../v1/model/TemplateActionControlTest.java | 56 + .../v1/model/TemplateControlTest.java | 63 + .../v1/model/TemplateCountDataTest.java | 39 + .../TemplateGrantRoleReferencesTest.java | 58 + .../v1/model/TemplateGrantRolesTest.java | 56 + .../v1/model/TemplateGrantTest.java | 39 + .../v1/model/TemplateMetadataTest.java | 41 + .../v1/model/TemplatePolicyTest.java | 141 + .../v1/model/TemplateRoleTest.java | 59 + ...ateActionControlAssignmentOptionsTest.java | 49 + .../UpdatePolicyAssignmentOptionsTest.java | 51 + .../model/UpdatePolicyStateOptionsTest.java | 49 + .../UpdateRoleAssignmentOptionsTest.java | 49 + .../v1/model/UpdateSettingsOptionsTest.java | 75 + .../v1/model/V2PolicyCollectionTest.java | 55 + .../model/V2PolicyResourceAttributeTest.java | 57 + .../v1/model/V2PolicyResourceTagTest.java | 57 + .../v1/model/V2PolicyResourceTest.java | 72 + .../model/V2PolicyRuleRuleAttributeTest.java | 57 + ...olicyRuleRuleWithNestedConditionsTest.java | 63 + .../v1/model/V2PolicyRuleTest.java | 38 + .../model/V2PolicySubjectAttributeTest.java | 57 + .../v1/model/V2PolicySubjectTest.java | 60 + .../model/V2PolicyTemplateMetaDataTest.java | 57 + .../v1/model/V2PolicyTest.java | 55 + .../v1/utils/TestUtilities.java | 131 + 333 files changed, 41258 insertions(+) create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java new file mode 100644 index 00000000000..2abe3baea4e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java @@ -0,0 +1,2566 @@ +/* + * (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. + */ + +/* + * IBM OpenAPI SDK Code Generator Version: 3.107.1-41b0fbd0-20250825-080732 + */ + +package com.ibm.cloud.platform_services.iam_policy_management.v1; + +import com.google.gson.JsonObject; +import com.ibm.cloud.platform_services.common.SdkCommon; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; +import com.ibm.cloud.sdk.core.http.RequestBuilder; +import com.ibm.cloud.sdk.core.http.ResponseConverter; +import com.ibm.cloud.sdk.core.http.ServiceCall; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.ConfigBasedAuthenticatorFactory; +import com.ibm.cloud.sdk.core.service.BaseService; +import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; + +/** + * IAM Policy Management API. + * + * API Version: 1.0.1 + */ +public class IamPolicyManagement extends BaseService { + + /** + * Default service name used when configuring the `IamPolicyManagement` client. + */ + public static final String DEFAULT_SERVICE_NAME = "iam_policy_management"; + + /** + * Default service endpoint URL. + */ + public static final String DEFAULT_SERVICE_URL = "https://iam.cloud.ibm.com"; + + /** + * Class method which constructs an instance of the `IamPolicyManagement` client. + * The default service name is used to configure the client instance. + * + * @return an instance of the `IamPolicyManagement` client using external configuration + */ + public static IamPolicyManagement newInstance() { + return newInstance(DEFAULT_SERVICE_NAME); + } + + /** + * Class method which constructs an instance of the `IamPolicyManagement` client. + * The specified service name is used to configure the client instance. + * + * @param serviceName the service name to be used when configuring the client instance + * @return an instance of the `IamPolicyManagement` client using external configuration + */ + public static IamPolicyManagement newInstance(String serviceName) { + Authenticator authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(serviceName); + IamPolicyManagement service = new IamPolicyManagement(serviceName, authenticator); + service.configureService(serviceName); + return service; + } + + /** + * Constructs an instance of the `IamPolicyManagement` client. + * The specified service name and authenticator are used to configure the client instance. + * + * @param serviceName the service name to be used when configuring the client instance + * @param authenticator the {@link Authenticator} instance to be configured for this client + */ + public IamPolicyManagement(String serviceName, Authenticator authenticator) { + super(serviceName, authenticator); + setServiceUrl(DEFAULT_SERVICE_URL); + } + + /** + * Get policies by attributes. + * + * Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account + * and filter by attribute values. This can be done through query parameters. The following attributes are supported: + * account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query + * parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If + * the caller does not have read access to any policies an empty array is returned. + * + * @param listPoliciesOptions the {@link ListPoliciesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyCollection} + */ + public ServiceCall listPolicies(ListPoliciesOptions listPoliciesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listPoliciesOptions, + "listPoliciesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicies"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listPoliciesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listPoliciesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listPoliciesOptions.accountId())); + if (listPoliciesOptions.iamId() != null) { + builder.query("iam_id", String.valueOf(listPoliciesOptions.iamId())); + } + if (listPoliciesOptions.accessGroupId() != null) { + builder.query("access_group_id", String.valueOf(listPoliciesOptions.accessGroupId())); + } + if (listPoliciesOptions.type() != null) { + builder.query("type", String.valueOf(listPoliciesOptions.type())); + } + if (listPoliciesOptions.serviceType() != null) { + builder.query("service_type", String.valueOf(listPoliciesOptions.serviceType())); + } + if (listPoliciesOptions.tagName() != null) { + builder.query("tag_name", String.valueOf(listPoliciesOptions.tagName())); + } + if (listPoliciesOptions.tagValue() != null) { + builder.query("tag_value", String.valueOf(listPoliciesOptions.tagValue())); + } + if (listPoliciesOptions.sort() != null) { + builder.query("sort", String.valueOf(listPoliciesOptions.sort())); + } + if (listPoliciesOptions.format() != null) { + builder.query("format", String.valueOf(listPoliciesOptions.format())); + } + if (listPoliciesOptions.state() != null) { + builder.query("state", String.valueOf(listPoliciesOptions.state())); + } + if (listPoliciesOptions.limit() != null) { + builder.query("limit", String.valueOf(listPoliciesOptions.limit())); + } + if (listPoliciesOptions.start() != null) { + builder.query("start", String.valueOf(listPoliciesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a policy. + * + * Creates a policy to grant access between a subject and a resource. There are two types of policies: **access** and + * **authorization**. A policy administrator might want to create an access policy which grants access to a user, + * service-id, or an access group. They might also want to create an authorization policy and setup access between + * services. + * + * ### Access + * + * To create an access policy, use **`"type": "access"`** in the body. The possible subject attributes are + * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or + * service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. Assign roles + * that are supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or + * **`service_group_id`** attribute and the **`accountId`** attribute. The IAM Services group (`IAM`) is a subset of + * account management services that includes the IAM platform services IAM Identity, IAM Access Management, IAM Users + * Management, IAM Groups, and future IAM services. If the subject is a locked service-id, the request will fail. + * + * ### Authorization + * + * Authorization policies are supported by services on a case by case basis. Refer to service documentation to verify + * their support of authorization policies. To create an authorization policy, use **`"type": "authorization"`** in + * the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject + * attributes might be provided. The following attributes are supported: + * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are + * supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access + * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject + * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. + * + * ### Attribute Operators + * + * Currently, only the `stringEquals` and the `stringMatch` operators are available. Resource attributes may support + * one or both operators. For more information, see [Assigning access by using wildcard + * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). + * + * ### Attribute Validations + * + * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like + * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated + * against Global Catalog locations. + * + * @param createPolicyOptions the {@link CreatePolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Policy} + */ + public ServiceCall createPolicy(CreatePolicyOptions createPolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyOptions, + "createPolicyOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createPolicyOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createPolicyOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("type", createPolicyOptions.type()); + contentJson.add("subjects", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.subjects())); + contentJson.add("roles", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.roles())); + contentJson.add("resources", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.resources())); + if (createPolicyOptions.description() != null) { + contentJson.addProperty("description", createPolicyOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a policy. + * + * Update a policy to grant access between a subject and a resource. A policy administrator might want to update an + * existing policy. The policy type cannot be changed (You cannot change an access policy to an authorization policy). + * + * ### Access + * + * To update an access policy, use **`"type": "access"`** in the body. The possible subject attributes are + * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or + * service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. Assign roles + * that are supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * The policy resource must include either the **`serviceType`**, **`serviceName`**, or **`resourceGroupId`** + * attribute and the **`accountId`** attribute.` If the subject is a locked service-id, the request will fail. + * + * ### Authorization + * + * To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match + * the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following + * attributes are supported: + * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are + * supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access + * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject + * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. + * + * ### Attribute Operators + * + * Currently, only the `stringEquals` and the `stringMatch` operators are available. Resource attributes might support + * one or both operators. For more information, see [Assigning access by using wildcard + * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). + * + * ### Attribute Validations + * + * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like + * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated + * against Global Catalog locations. + * + * @param replacePolicyOptions the {@link ReplacePolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Policy} + */ + public ServiceCall replacePolicy(ReplacePolicyOptions replacePolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replacePolicyOptions, + "replacePolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_id", replacePolicyOptions.policyId()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replacePolicy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replacePolicyOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("type", replacePolicyOptions.type()); + contentJson.add("subjects", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.subjects())); + contentJson.add("roles", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.roles())); + contentJson.add("resources", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.resources())); + if (replacePolicyOptions.description() != null) { + contentJson.addProperty("description", replacePolicyOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a policy by ID. + * + * Retrieve a policy by providing a policy ID. + * + * @param getPolicyOptions the {@link GetPolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateMetaData} + */ + public ServiceCall getPolicy(GetPolicyOptions getPolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyOptions, + "getPolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_id", getPolicyOptions.policyId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicy"); + 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); + } + + /** + * Delete a policy by ID. + * + * Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service + * ID. If the subject of the policy is a locked service-id, the request will fail. + * + * @param deletePolicyOptions the {@link DeletePolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deletePolicy(DeletePolicyOptions deletePolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyOptions, + "deletePolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_id", deletePolicyOptions.policyId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Restore a deleted policy by ID. + * + * Restore a policy that has recently been deleted. A policy administrator might want to restore a deleted policy. To + * restore a policy, use **`"state": "active"`** in the body. + * + * @param updatePolicyStateOptions the {@link UpdatePolicyStateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Policy} + */ + public ServiceCall updatePolicyState(UpdatePolicyStateOptions updatePolicyStateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updatePolicyStateOptions, + "updatePolicyStateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_id", updatePolicyStateOptions.policyId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updatePolicyState"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updatePolicyStateOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + if (updatePolicyStateOptions.state() != null) { + contentJson.addProperty("state", updatePolicyStateOptions.state()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get roles by filters. + * + * Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can + * be done through query parameters. Currently, we only support the following attributes: account_id, service_name, + * service_group_id, source_service_name and policy_type. Both service_name and service_group_id attributes are + * mutually exclusive. Only roles that match the filter and that the caller has read access to are returned. If the + * caller does not have read access to any roles an empty array is returned. + * + * @param listRolesOptions the {@link ListRolesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleCollection} + */ + public ServiceCall listRoles(ListRolesOptions listRolesOptions) { + if (listRolesOptions == null) { + listRolesOptions = new ListRolesOptions.Builder().build(); + } + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoles"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listRolesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listRolesOptions.acceptLanguage()); + } + if (listRolesOptions.accountId() != null) { + builder.query("account_id", String.valueOf(listRolesOptions.accountId())); + } + if (listRolesOptions.serviceName() != null) { + builder.query("service_name", String.valueOf(listRolesOptions.serviceName())); + } + if (listRolesOptions.sourceServiceName() != null) { + builder.query("source_service_name", String.valueOf(listRolesOptions.sourceServiceName())); + } + if (listRolesOptions.policyType() != null) { + builder.query("policy_type", String.valueOf(listRolesOptions.policyType())); + } + if (listRolesOptions.serviceGroupId() != null) { + builder.query("service_group_id", String.valueOf(listRolesOptions.serviceGroupId())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get roles by filters. + * + * Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can + * be done through query parameters. Currently, we only support the following attributes: account_id, service_name, + * service_group_id, source_service_name and policy_type. Both service_name and service_group_id attributes are + * mutually exclusive. Only roles that match the filter and that the caller has read access to are returned. If the + * caller does not have read access to any roles an empty array is returned. + * + * @return a {@link ServiceCall} with a result of type {@link RoleCollection} + */ + public ServiceCall listRoles() { + return listRoles(null); + } + + /** + * Create a role. + * + * Creates a custom role for a specific service within the account. An account owner or a user assigned the + * Administrator role on the Role management service can create a custom role. Any number of actions for a single + * service can be mapped to the new role, but there must be at least one service-defined action to successfully create + * the new role. + * + * @param createRoleOptions the {@link CreateRoleOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link CustomRole} + */ + public ServiceCall createRole(CreateRoleOptions createRoleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleOptions, + "createRoleOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRole"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createRoleOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createRoleOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("display_name", createRoleOptions.displayName()); + contentJson.add("actions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleOptions.actions())); + contentJson.addProperty("name", createRoleOptions.name()); + contentJson.addProperty("account_id", createRoleOptions.accountId()); + contentJson.addProperty("service_name", createRoleOptions.serviceName()); + if (createRoleOptions.description() != null) { + contentJson.addProperty("description", createRoleOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a role. + * + * Update a custom role. A role administrator might want to update an existing role by updating the display name, + * description, or the actions that are mapped to the role. The name, account_id, and service_name can't be changed. + * + * @param replaceRoleOptions the {@link ReplaceRoleOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link CustomRole} + */ + public ServiceCall replaceRole(ReplaceRoleOptions replaceRoleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceRoleOptions, + "replaceRoleOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_id", replaceRoleOptions.roleId()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceRole"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replaceRoleOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("display_name", replaceRoleOptions.displayName()); + contentJson.add("actions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRoleOptions.actions())); + if (replaceRoleOptions.description() != null) { + contentJson.addProperty("description", replaceRoleOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a role by ID. + * + * Retrieve a role by providing a role ID. + * + * @param getRoleOptions the {@link GetRoleOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link CustomRole} + */ + public ServiceCall getRole(GetRoleOptions getRoleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleOptions, + "getRoleOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_id", getRoleOptions.roleId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRole"); + 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); + } + + /** + * Delete a role by ID. + * + * Delete a role by providing a role ID. + * + * @param deleteRoleOptions the {@link DeleteRoleOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteRole(DeleteRoleOptions deleteRoleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleOptions, + "deleteRoleOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_id", deleteRoleOptions.roleId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRole"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get policies by attributes. + * + * Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account + * and filter by attribute values. This can be done through query parameters. The following attributes are supported: + * account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query + * parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If + * the caller does not have read access to any policies an empty array is returned. + * + * @param listV2PoliciesOptions the {@link ListV2PoliciesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link V2PolicyCollection} + */ + public ServiceCall listV2Policies(ListV2PoliciesOptions listV2PoliciesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listV2PoliciesOptions, + "listV2PoliciesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listV2Policies"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listV2PoliciesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listV2PoliciesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listV2PoliciesOptions.accountId())); + if (listV2PoliciesOptions.iamId() != null) { + builder.query("iam_id", String.valueOf(listV2PoliciesOptions.iamId())); + } + if (listV2PoliciesOptions.accessGroupId() != null) { + builder.query("access_group_id", String.valueOf(listV2PoliciesOptions.accessGroupId())); + } + if (listV2PoliciesOptions.type() != null) { + builder.query("type", String.valueOf(listV2PoliciesOptions.type())); + } + if (listV2PoliciesOptions.serviceType() != null) { + builder.query("service_type", String.valueOf(listV2PoliciesOptions.serviceType())); + } + if (listV2PoliciesOptions.serviceName() != null) { + builder.query("service_name", String.valueOf(listV2PoliciesOptions.serviceName())); + } + if (listV2PoliciesOptions.serviceGroupId() != null) { + builder.query("service_group_id", String.valueOf(listV2PoliciesOptions.serviceGroupId())); + } + if (listV2PoliciesOptions.sort() != null) { + builder.query("sort", String.valueOf(listV2PoliciesOptions.sort())); + } + if (listV2PoliciesOptions.format() != null) { + builder.query("format", String.valueOf(listV2PoliciesOptions.format())); + } + if (listV2PoliciesOptions.state() != null) { + builder.query("state", String.valueOf(listV2PoliciesOptions.state())); + } + if (listV2PoliciesOptions.limit() != null) { + builder.query("limit", String.valueOf(listV2PoliciesOptions.limit())); + } + if (listV2PoliciesOptions.start() != null) { + builder.query("start", String.valueOf(listV2PoliciesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a policy. + * + * Creates a policy to grant access between a subject and a resource. Currently, there is one type of a v2/policy: + * **access**. A policy administrator might want to create an access policy that grants access to a user, service-id, + * or an access group. + * + * ### Access + * + * To create an access policy, use **`"type": "access"`** in the body. The supported subject attributes are + * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute to assign access to a user or + * service-id. Use the **`access_group_id`** subject attribute to assign access to an access group. Assign roles that + * are supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or + * **`service_group_id`** attribute and the **`accountId`** attribute. In the rule field, you can specify a single + * condition by using **`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`** with a + * combination **`operator`**. The possible combination operators are **`and`** and **`or`**. + * + * Currently, we support two types of patterns: + * + * 1. `time-based`: Used to specify a time-based restriction + * + * Combine conditions to specify a time-based restriction (e.g., access only during business hours, during the + * Monday-Friday work week). For example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following + * rule: + * ```json + * "rule": { + * "operator": "and", + * "conditions": [{ + * "key": "{{environment.attributes.day_of_week}}", + * "operator": "dayOfWeekAnyOf", + * "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] + * }, + * "key": "{{environment.attributes.current_time}}", + * "operator": "timeGreaterThanOrEquals", + * "value": "09:00:00+00:00" + * }, + * "key": "{{environment.attributes.current_time}}", + * "operator": "timeLessThanOrEquals", + * "value": "17:00:00+00:00" + * }] + * } + * ``` You can use the following operators in the **`key`** and **`value`** pair: + * ``` + * 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', + * 'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan', 'dateGreaterThanOrEquals', + * 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', + * 'dayOfWeekEquals', 'dayOfWeekAnyOf' + * ``` + * + * The pattern field that matches the rule is required when rule is provided. For the business hour rule example + * above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions + * operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) and + * [Limiting access with time-based conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the + * subject is a locked service-id, the request will fail. + * + * 2. `attribute-based`: Used to specify a combination of OR/AND based conditions applied on resource attributes. + * + * Combine conditions to specify an attribute-based condition using AND/OR-based operators. + * + * For example, a policy can grant access based on multiple conditions applied on the resource attributes below: + * ```json + * "pattern": "attribute-based-condition:resource:literal-and-wildcard" + * "rule": { + * "operator": "or", + * "conditions": [ + * { + * "operator": "and", + * "conditions": [ + * { + * "key": "{{resource.attributes.prefix}}", + * "operator": "stringEquals", + * "value": "home/test" + * }, + * { + * "key": "{{environment.attributes.delimiter}}", + * "operator": "stringEquals", + * "value": "/" + * } + * ] + * }, + * { + * "key": "{{resource.attributes.path}}", + * "operator": "stringMatch", + * "value": "home/David/_*" + * } + * ] + * } + * ``` + * + * In addition to satisfying the `resources` section, the policy grants permission only if either the `path` begins + * with `home/David/` **OR** the `prefix` is `home/test` and the `delimiter` is `/`. This mechanism helps you + * consolidate multiple policies in to a single policy, making policies easier to administer and stay within the + * policy limit for an account. View the list of operators that can be used in the condition + * [here](/docs/account?topic=account-wildcard#string-comparisons). + * + * ### Authorization + * + * Authorization policies are supported by services on a case by case basis. Refer to service documentation to verify + * their support of authorization policies. To create an authorization policy, use **`"type": "authorization"`** in + * the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject + * attributes might be provided. The following attributes are supported: + * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are + * supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access + * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject + * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. + * + * ### Attribute Operators + * + * Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators are available. For more + * information, see [Assigning access by using wildcard + * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). + * + * ### Attribute Validations + * + * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like + * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated + * against Global Catalog locations. + * + * @param createV2PolicyOptions the {@link CreateV2PolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link V2Policy} + */ + public ServiceCall createV2Policy(CreateV2PolicyOptions createV2PolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createV2PolicyOptions, + "createV2PolicyOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createV2Policy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createV2PolicyOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createV2PolicyOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.add("control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.control())); + contentJson.addProperty("type", createV2PolicyOptions.type()); + if (createV2PolicyOptions.description() != null) { + contentJson.addProperty("description", createV2PolicyOptions.description()); + } + if (createV2PolicyOptions.subject() != null) { + contentJson.add("subject", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.subject())); + } + if (createV2PolicyOptions.resource() != null) { + contentJson.add("resource", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.resource())); + } + if (createV2PolicyOptions.pattern() != null) { + contentJson.addProperty("pattern", createV2PolicyOptions.pattern()); + } + if (createV2PolicyOptions.rule() != null) { + contentJson.add("rule", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.rule())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a policy. + * + * Update a policy to grant access between a subject and a resource. A policy administrator might want to update an + * existing policy. + * + * ### Access + * + * To update an access policy, use **`"type": "access"`** in the body. The supported subject attributes are + * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute to assign access to a user or + * service-id. Use the **`access_group_id`** subject attribute to assign access to an access group. Assign roles that + * are supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or + * **`service_group_id`** attribute and the **`accountId`** attribute. In the rule field, you can specify a single + * condition by using **`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`** with a + * combination **`operator`**. The possible combination operators are **`and`** and **`or`**. + * + * Currently, we support two types of patterns: + * + * 1. `time-based`: Used to specify a time-based restriction + * + * Combine conditions to specify a time-based restriction (e.g., access only during business hours, during the + * Monday-Friday work week). For example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following + * rule: + * ```json + * "rule": { + * "operator": "and", + * "conditions": [{ + * "key": "{{environment.attributes.day_of_week}}", + * "operator": "dayOfWeekAnyOf", + * "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] + * }, + * "key": "{{environment.attributes.current_time}}", + * "operator": "timeGreaterThanOrEquals", + * "value": "09:00:00+00:00" + * }, + * "key": "{{environment.attributes.current_time}}", + * "operator": "timeLessThanOrEquals", + * "value": "17:00:00+00:00" + * }] + * } + * ``` You can use the following operators in the **`key`** and **`value`** pair: + * ``` + * 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', + * 'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan', 'dateGreaterThanOrEquals', + * 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', + * 'dayOfWeekEquals', 'dayOfWeekAnyOf' + * ``` The pattern field that matches the rule is required when rule is provided. For the business hour rule example + * above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions + * operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) and + * [Limiting access with time-based conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the + * subject is a locked service-id, the request will fail. + * + * 2. `attribute-based`: Used to specify a combination of OR/AND based conditions applied on resource attributes. + * + * Combine conditions to specify an attribute-based condition using AND/OR-based operators. + * + * For example, a policy can grant access based on multiple conditions applied on the resource attributes below: + * ```json + * "pattern": "attribute-based-condition:resource:literal-and-wildcard" + * "rule": { + * "operator": "or", + * "conditions": [ + * { + * "operator": "and", + * "conditions": [ + * { + * "key": "{{resource.attributes.prefix}}", + * "operator": "stringEquals", + * "value": "home/test" + * }, + * { + * "key": "{{environment.attributes.delimiter}}", + * "operator": "stringEquals", + * "value": "/" + * } + * ] + * }, + * { + * "key": "{{resource.attributes.path}}", + * "operator": "stringMatch", + * "value": "home/David/_*" + * } + * ] + * } + * ``` + * + * In addition to satisfying the `resources` section, the policy grants permission only if either the `path` begins + * with `home/David/` **OR** the `prefix` is `home/test` and the `delimiter` is `/`. This mechanism helps you + * consolidate multiple policies in to a single policy, making policies easier to administer and stay within the + * policy limit for an account. View the list of operators that can be used in the condition + * [here](/docs/account?topic=account-wildcard#string-comparisons). + * + * ### Authorization + * + * To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match + * the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following + * attributes are supported: + * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are + * supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access + * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject + * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. + * + * ### Attribute Operators + * + * Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators are available. For more + * information, see [Assigning access by using wildcard + * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). + * + * ### Attribute Validations + * + * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like + * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated + * against Global Catalog locations. + * + * @param replaceV2PolicyOptions the {@link ReplaceV2PolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link V2Policy} + */ + public ServiceCall replaceV2Policy(ReplaceV2PolicyOptions replaceV2PolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceV2PolicyOptions, + "replaceV2PolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("id", replaceV2PolicyOptions.id()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceV2Policy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replaceV2PolicyOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.add("control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.control())); + contentJson.addProperty("type", replaceV2PolicyOptions.type()); + if (replaceV2PolicyOptions.description() != null) { + contentJson.addProperty("description", replaceV2PolicyOptions.description()); + } + if (replaceV2PolicyOptions.subject() != null) { + contentJson.add("subject", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.subject())); + } + if (replaceV2PolicyOptions.resource() != null) { + contentJson.add("resource", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.resource())); + } + if (replaceV2PolicyOptions.pattern() != null) { + contentJson.addProperty("pattern", replaceV2PolicyOptions.pattern()); + } + if (replaceV2PolicyOptions.rule() != null) { + contentJson.add("rule", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.rule())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a policy by ID. + * + * Retrieve a policy by providing a policy ID. + * + * @param getV2PolicyOptions the {@link GetV2PolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link V2PolicyTemplateMetaData} + */ + public ServiceCall getV2Policy(GetV2PolicyOptions getV2PolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getV2PolicyOptions, + "getV2PolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("id", getV2PolicyOptions.id()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getV2Policy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getV2PolicyOptions.format() != null) { + builder.query("format", String.valueOf(getV2PolicyOptions.format())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a policy by ID. + * + * Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service + * ID. If the subject of the policy is a locked service-id, the request will fail. + * + * @param deleteV2PolicyOptions the {@link DeleteV2PolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteV2Policy(DeleteV2PolicyOptions deleteV2PolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteV2PolicyOptions, + "deleteV2PolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("id", deleteV2PolicyOptions.id()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteV2Policy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * List policy templates by attributes. + * + * List policy templates and filter by attributes by using query parameters. The following attributes are supported: + * `account_id`, `policy_service_name`, `policy_service_type`, `policy_service_group_id` and `policy_type`. + * `account_id` is a required query parameter. These attributes `policy_service_name`, `policy_service_type` and + * `policy_service_group_id` are mutually exclusive. Only policy templates that have the specified attributes and that + * the caller has read access to are returned. If the caller does not have read access to any policy templates an + * empty array is returned. + * + * @param listPolicyTemplatesOptions the {@link ListPolicyTemplatesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateCollection} + */ + public ServiceCall listPolicyTemplates(ListPolicyTemplatesOptions listPolicyTemplatesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyTemplatesOptions, + "listPolicyTemplatesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyTemplates"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listPolicyTemplatesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listPolicyTemplatesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listPolicyTemplatesOptions.accountId())); + if (listPolicyTemplatesOptions.state() != null) { + builder.query("state", String.valueOf(listPolicyTemplatesOptions.state())); + } + if (listPolicyTemplatesOptions.name() != null) { + builder.query("name", String.valueOf(listPolicyTemplatesOptions.name())); + } + if (listPolicyTemplatesOptions.policyServiceType() != null) { + builder.query("policy_service_type", String.valueOf(listPolicyTemplatesOptions.policyServiceType())); + } + if (listPolicyTemplatesOptions.policyServiceName() != null) { + builder.query("policy_service_name", String.valueOf(listPolicyTemplatesOptions.policyServiceName())); + } + if (listPolicyTemplatesOptions.policyServiceGroupId() != null) { + builder.query("policy_service_group_id", String.valueOf(listPolicyTemplatesOptions.policyServiceGroupId())); + } + if (listPolicyTemplatesOptions.policyType() != null) { + builder.query("policy_type", String.valueOf(listPolicyTemplatesOptions.policyType())); + } + if (listPolicyTemplatesOptions.limit() != null) { + builder.query("limit", String.valueOf(listPolicyTemplatesOptions.limit())); + } + if (listPolicyTemplatesOptions.start() != null) { + builder.query("start", String.valueOf(listPolicyTemplatesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a policy template. + * + * Create a policy template. Policy templates define a policy without requiring a subject, and you can use them to + * grant access to multiple subjects. + * + * @param createPolicyTemplateOptions the {@link CreatePolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateLimitData} + */ + public ServiceCall createPolicyTemplate(CreatePolicyTemplateOptions createPolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateOptions, + "createPolicyTemplateOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createPolicyTemplateOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createPolicyTemplateOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("name", createPolicyTemplateOptions.name()); + contentJson.addProperty("account_id", createPolicyTemplateOptions.accountId()); + contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateOptions.policy())); + if (createPolicyTemplateOptions.description() != null) { + contentJson.addProperty("description", createPolicyTemplateOptions.description()); + } + if (createPolicyTemplateOptions.committed() != null) { + contentJson.addProperty("committed", createPolicyTemplateOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve latest version of a policy template. + * + * Retrieve the latest version of a policy template by providing a policy template ID. + * + * @param getPolicyTemplateOptions the {@link GetPolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} + */ + public ServiceCall getPolicyTemplate(GetPolicyTemplateOptions getPolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyTemplateOptions, + "getPolicyTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", getPolicyTemplateOptions.policyTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getPolicyTemplateOptions.state() != null) { + builder.query("state", String.valueOf(getPolicyTemplateOptions.state())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a policy template. + * + * Delete a policy template by providing the policy template ID. This deletes all versions of this template. A policy + * template can't be deleted if any version of the template is assigned to one or more child accounts. You must remove + * the policy assignments first. + * + * @param deletePolicyTemplateOptions the {@link DeletePolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deletePolicyTemplate(DeletePolicyTemplateOptions deletePolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyTemplateOptions, + "deletePolicyTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", deletePolicyTemplateOptions.policyTemplateId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a new policy template version. + * + * Create a new version of a policy template. Use this if you need to make updates to a policy template that is + * committed. + * + * @param createPolicyTemplateVersionOptions the {@link CreatePolicyTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateLimitData} + */ + public ServiceCall createPolicyTemplateVersion(CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateVersionOptions, + "createPolicyTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", createPolicyTemplateVersionOptions.policyTemplateId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateVersionOptions.policy())); + if (createPolicyTemplateVersionOptions.name() != null) { + contentJson.addProperty("name", createPolicyTemplateVersionOptions.name()); + } + if (createPolicyTemplateVersionOptions.description() != null) { + contentJson.addProperty("description", createPolicyTemplateVersionOptions.description()); + } + if (createPolicyTemplateVersionOptions.committed() != null) { + contentJson.addProperty("committed", createPolicyTemplateVersionOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve policy template versions. + * + * Retrieve the versions of a policy template by providing a policy template ID. + * + * @param listPolicyTemplateVersionsOptions the {@link ListPolicyTemplateVersionsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateVersionsCollection} + */ + public ServiceCall listPolicyTemplateVersions(ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyTemplateVersionsOptions, + "listPolicyTemplateVersionsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", listPolicyTemplateVersionsOptions.policyTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyTemplateVersions"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listPolicyTemplateVersionsOptions.state() != null) { + builder.query("state", String.valueOf(listPolicyTemplateVersionsOptions.state())); + } + if (listPolicyTemplateVersionsOptions.limit() != null) { + builder.query("limit", String.valueOf(listPolicyTemplateVersionsOptions.limit())); + } + if (listPolicyTemplateVersionsOptions.start() != null) { + builder.query("start", String.valueOf(listPolicyTemplateVersionsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a policy template version. + * + * Update a specific version of a policy template. You can use this only if the version isn't committed. + * + * @param replacePolicyTemplateOptions the {@link ReplacePolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} + */ + public ServiceCall replacePolicyTemplate(ReplacePolicyTemplateOptions replacePolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replacePolicyTemplateOptions, + "replacePolicyTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", replacePolicyTemplateOptions.policyTemplateId()); + pathParamsMap.put("version", replacePolicyTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replacePolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replacePolicyTemplateOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyTemplateOptions.policy())); + if (replacePolicyTemplateOptions.name() != null) { + contentJson.addProperty("name", replacePolicyTemplateOptions.name()); + } + if (replacePolicyTemplateOptions.description() != null) { + contentJson.addProperty("description", replacePolicyTemplateOptions.description()); + } + if (replacePolicyTemplateOptions.committed() != null) { + contentJson.addProperty("committed", replacePolicyTemplateOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a policy template version. + * + * Delete a specific version of a policy template by providing a policy template ID and version number. You can't + * delete a policy template version that is assigned to one or more child accounts. You must remove the policy + * assignments first. + * + * @param deletePolicyTemplateVersionOptions the {@link DeletePolicyTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deletePolicyTemplateVersion(DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyTemplateVersionOptions, + "deletePolicyTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", deletePolicyTemplateVersionOptions.policyTemplateId()); + pathParamsMap.put("version", deletePolicyTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a policy template version. + * + * Retrieve a policy template by providing a policy template ID and version number. + * + * @param getPolicyTemplateVersionOptions the {@link GetPolicyTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} + */ + public ServiceCall getPolicyTemplateVersion(GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyTemplateVersionOptions, + "getPolicyTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", getPolicyTemplateVersionOptions.policyTemplateId()); + pathParamsMap.put("version", getPolicyTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyTemplateVersion"); + 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); + } + + /** + * Commit a policy template version. + * + * Commit a policy template version. You can make no further changes to the policy template once it's committed. If + * you need to make updates after committing a version, create a new version. + * + * @param commitPolicyTemplateOptions the {@link CommitPolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall commitPolicyTemplate(CommitPolicyTemplateOptions commitPolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(commitPolicyTemplateOptions, + "commitPolicyTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", commitPolicyTemplateOptions.policyTemplateId()); + pathParamsMap.put("version", commitPolicyTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}/commit", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitPolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get policy template assignments. + * + * Get policy template assignments by attributes. The following attributes are supported: + * `account_id`, `template_id`, `template_version`, `sort`. + * `account_id` is a required query parameter. Only policy template assignments that have the specified attributes and + * that the caller has read access to are returned. If the caller does not have read access to any policy template + * assignments an empty array is returned. + * + * @param listPolicyAssignmentsOptions the {@link ListPolicyAssignmentsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateAssignmentCollection} + */ + public ServiceCall listPolicyAssignments(ListPolicyAssignmentsOptions listPolicyAssignmentsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyAssignmentsOptions, + "listPolicyAssignmentsOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyAssignments"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listPolicyAssignmentsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listPolicyAssignmentsOptions.acceptLanguage()); + } + builder.query("version", String.valueOf(listPolicyAssignmentsOptions.version())); + builder.query("account_id", String.valueOf(listPolicyAssignmentsOptions.accountId())); + if (listPolicyAssignmentsOptions.templateId() != null) { + builder.query("template_id", String.valueOf(listPolicyAssignmentsOptions.templateId())); + } + if (listPolicyAssignmentsOptions.templateVersion() != null) { + builder.query("template_version", String.valueOf(listPolicyAssignmentsOptions.templateVersion())); + } + if (listPolicyAssignmentsOptions.limit() != null) { + builder.query("limit", String.valueOf(listPolicyAssignmentsOptions.limit())); + } + if (listPolicyAssignmentsOptions.start() != null) { + builder.query("start", String.valueOf(listPolicyAssignmentsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a policy authorization template assignment. + * + * Assign a policy template to child accounts and account groups. This creates the policy in the accounts and account + * groups that you specify. + * + * @param createPolicyTemplateAssignmentOptions the {@link CreatePolicyTemplateAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyAssignmentV1Collection} + */ + public ServiceCall createPolicyTemplateAssignment(CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateAssignmentOptions, + "createPolicyTemplateAssignmentOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplateAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createPolicyTemplateAssignmentOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createPolicyTemplateAssignmentOptions.acceptLanguage()); + } + builder.query("version", String.valueOf(createPolicyTemplateAssignmentOptions.version())); + final JsonObject contentJson = new JsonObject(); + contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateAssignmentOptions.target())); + contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateAssignmentOptions.templates())); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a policy assignment. + * + * Retrieve a policy template assignment by providing a policy assignment ID. + * + * @param getPolicyAssignmentOptions the {@link GetPolicyAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateAssignmentItems} + */ + public ServiceCall getPolicyAssignment(GetPolicyAssignmentOptions getPolicyAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyAssignmentOptions, + "getPolicyAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", getPolicyAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.query("version", String.valueOf(getPolicyAssignmentOptions.version())); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a policy authorization type assignment. + * + * Update a policy assignment by providing a policy assignment ID. + * + * @param updatePolicyAssignmentOptions the {@link UpdatePolicyAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyAssignmentV1} + */ + public ServiceCall updatePolicyAssignment(UpdatePolicyAssignmentOptions updatePolicyAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updatePolicyAssignmentOptions, + "updatePolicyAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", updatePolicyAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updatePolicyAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updatePolicyAssignmentOptions.ifMatch()); + builder.query("version", String.valueOf(updatePolicyAssignmentOptions.version())); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("template_version", updatePolicyAssignmentOptions.templateVersion()); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Remove a policy assignment. + * + * Remove a policy template assignment by providing a policy assignment ID. You can't delete a policy assignment if + * the status is "in_progress". + * + * @param deletePolicyAssignmentOptions the {@link DeletePolicyAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deletePolicyAssignment(DeletePolicyAssignmentOptions deletePolicyAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyAssignmentOptions, + "deletePolicyAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", deletePolicyAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve Access Management account settings by account ID. + * + * Retrieve Access Management settings for an account by providing the account ID. + * + * @param getSettingsOptions the {@link GetSettingsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccountSettingsAccessManagement} + */ + public ServiceCall getSettings(GetSettingsOptions getSettingsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getSettingsOptions, + "getSettingsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("account_id", getSettingsOptions.accountId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/settings/access_management", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getSettings"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getSettingsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", getSettingsOptions.acceptLanguage()); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update Access Management account settings by account ID. + * + * Update access management settings for an account. + * + * ### External Account Identity Interaction + * + * Update the way identities within an external account are allowed to interact with the requested account by + * providing: + * * the `account_id` as a parameter + * * one or more external account ID(s) and state for the specific identity in the request body + * + * External account identity interaction includes the following `identity_types`: `user` (user identities that are + * defined as [IBMid's](https://cloud.ibm.com/docs/account?topic=account-identity-overview#users-bestpract)), + * `service_id` (defined as [IAM + * ServiceIds](https://cloud.ibm.com/docs/account?topic=account-identity-overview#serviceid-bestpract)), `service` + * (defined by a service’s [CRN](https://cloud.ibm.com/docs/account?topic=account-crn)). To update an Identity’s + * setting, the `state` and `external_allowed_accounts` fields are required. + * + * Different identity states are: + * * "enabled": An identity type is allowed to access resources in the account provided it has access policies on + * those resources. + * * "limited": An identity type is allowed to access resources in the account provided it has access policies on + * those resources AND it is associated with either the account the resources are in or one of the allowed accounts. + * This setting uses the "external_allowed_accounts" list. + * * "monitor": It has no direct impact on an Identity’s access. Instead, it creates AT events for access decisions as + * if the account were in a limited “state”. + * + * **Note**: The state "enabled" is a special case. In this case, access is given to all accounts and there is no need + * to specify a particular list. Therefore, when updating "state" to "enabled" for an identity type + * "external_allowed_accounts" should be left empty. + * + * @param updateSettingsOptions the {@link UpdateSettingsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccountSettingsAccessManagement} + */ + public ServiceCall updateSettings(UpdateSettingsOptions updateSettingsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateSettingsOptions, + "updateSettingsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("account_id", updateSettingsOptions.accountId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/settings/access_management", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateSettings"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updateSettingsOptions.ifMatch()); + if (updateSettingsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", updateSettingsOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + if (updateSettingsOptions.externalAccountIdentityInteraction() != null) { + contentJson.add("external_account_identity_interaction", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateSettingsOptions.externalAccountIdentityInteraction())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * List action control templates by attributes. + * + * List action control templates and filter by attributes by using query parameters. The following attributes are + * supported: + * `account_id` + * `account_id` is a required query parameter. Only action control templates that have the specified attributes and + * that the caller has read access to are returned. If the caller does not have read access to any action control + * templates an empty array is returned. + * + * @param listActionControlTemplatesOptions the {@link ListActionControlTemplatesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplateCollection} + */ + public ServiceCall listActionControlTemplates(ListActionControlTemplatesOptions listActionControlTemplatesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlTemplatesOptions, + "listActionControlTemplatesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlTemplates"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listActionControlTemplatesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listActionControlTemplatesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listActionControlTemplatesOptions.accountId())); + if (listActionControlTemplatesOptions.limit() != null) { + builder.query("limit", String.valueOf(listActionControlTemplatesOptions.limit())); + } + if (listActionControlTemplatesOptions.start() != null) { + builder.query("start", String.valueOf(listActionControlTemplatesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create an action control template. + * + * Create an action control template. Action control templates define a service action control. + * + * @param createActionControlTemplateOptions the {@link CreateActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall createActionControlTemplate(CreateActionControlTemplateOptions createActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateOptions, + "createActionControlTemplateOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createActionControlTemplateOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createActionControlTemplateOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("name", createActionControlTemplateOptions.name()); + contentJson.addProperty("account_id", createActionControlTemplateOptions.accountId()); + if (createActionControlTemplateOptions.description() != null) { + contentJson.addProperty("description", createActionControlTemplateOptions.description()); + } + if (createActionControlTemplateOptions.committed() != null) { + contentJson.addProperty("committed", createActionControlTemplateOptions.committed()); + } + if (createActionControlTemplateOptions.actionControl() != null) { + contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateOptions.actionControl())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve the latest version of an action control template. + * + * Retrieve the latest version of an action control template by providing an action control template ID. + * + * @param getActionControlTemplateOptions the {@link GetActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall getActionControlTemplate(GetActionControlTemplateOptions getActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlTemplateOptions, + "getActionControlTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", getActionControlTemplateOptions.actionControlTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getActionControlTemplateOptions.state() != null) { + builder.query("state", String.valueOf(getActionControlTemplateOptions.state())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete an action control template. + * + * Delete an action control template by providing the action control template ID. This deletes all versions of this + * template. An action control template can't be deleted if any version of the template is assigned to one or more + * child accounts. You must remove the action control assignments first. + * + * @param deleteActionControlTemplateOptions the {@link DeleteActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteActionControlTemplate(DeleteActionControlTemplateOptions deleteActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlTemplateOptions, + "deleteActionControlTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", deleteActionControlTemplateOptions.actionControlTemplateId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a new action control template version. + * + * Create a new version of an action control template. Use this if you need to make updates to an action control + * template that is committed. + * + * @param createActionControlTemplateVersionOptions the {@link CreateActionControlTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall createActionControlTemplateVersion(CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateVersionOptions, + "createActionControlTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", createActionControlTemplateVersionOptions.actionControlTemplateId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + if (createActionControlTemplateVersionOptions.name() != null) { + contentJson.addProperty("name", createActionControlTemplateVersionOptions.name()); + } + if (createActionControlTemplateVersionOptions.description() != null) { + contentJson.addProperty("description", createActionControlTemplateVersionOptions.description()); + } + if (createActionControlTemplateVersionOptions.actionControl() != null) { + contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateVersionOptions.actionControl())); + } + if (createActionControlTemplateVersionOptions.committed() != null) { + contentJson.addProperty("committed", createActionControlTemplateVersionOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve action control template versions. + * + * Retrieve the versions of an action control template by providing an action control template ID. + * + * @param listActionControlTemplateVersionsOptions the {@link ListActionControlTemplateVersionsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplateVersionsCollection} + */ + public ServiceCall listActionControlTemplateVersions(ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlTemplateVersionsOptions, + "listActionControlTemplateVersionsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", listActionControlTemplateVersionsOptions.actionControlTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlTemplateVersions"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listActionControlTemplateVersionsOptions.state() != null) { + builder.query("state", String.valueOf(listActionControlTemplateVersionsOptions.state())); + } + if (listActionControlTemplateVersionsOptions.limit() != null) { + builder.query("limit", String.valueOf(listActionControlTemplateVersionsOptions.limit())); + } + if (listActionControlTemplateVersionsOptions.start() != null) { + builder.query("start", String.valueOf(listActionControlTemplateVersionsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update an action control template version. + * + * Update a specific version of an action control template. You can use this only if the version isn't committed. + * + * @param replaceActionControlTemplateOptions the {@link ReplaceActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall replaceActionControlTemplate(ReplaceActionControlTemplateOptions replaceActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceActionControlTemplateOptions, + "replaceActionControlTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", replaceActionControlTemplateOptions.actionControlTemplateId()); + pathParamsMap.put("version", replaceActionControlTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replaceActionControlTemplateOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + if (replaceActionControlTemplateOptions.name() != null) { + contentJson.addProperty("name", replaceActionControlTemplateOptions.name()); + } + if (replaceActionControlTemplateOptions.description() != null) { + contentJson.addProperty("description", replaceActionControlTemplateOptions.description()); + } + if (replaceActionControlTemplateOptions.actionControl() != null) { + contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceActionControlTemplateOptions.actionControl())); + } + if (replaceActionControlTemplateOptions.committed() != null) { + contentJson.addProperty("committed", replaceActionControlTemplateOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete an action control template version. + * + * Delete a specific version of an action control template by providing an action control template ID and version + * number. You can't delete an action control template version that is assigned to one or more child accounts. You + * must remove the action control assignments first. + * + * @param deleteActionControlTemplateVersionOptions the {@link DeleteActionControlTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteActionControlTemplateVersion(DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlTemplateVersionOptions, + "deleteActionControlTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", deleteActionControlTemplateVersionOptions.actionControlTemplateId()); + pathParamsMap.put("version", deleteActionControlTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve an action control template version. + * + * Retrieve an action control template by providing an action control template ID and version number. + * + * @param getActionControlTemplateVersionOptions the {@link GetActionControlTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall getActionControlTemplateVersion(GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlTemplateVersionOptions, + "getActionControlTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", getActionControlTemplateVersionOptions.actionControlTemplateId()); + pathParamsMap.put("version", getActionControlTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlTemplateVersion"); + 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); + } + + /** + * Commit an action control template version. + * + * Commit an action control template version. You cannot make any further changes to the action control template once + * it's committed. If you have to make updates after committing a version, create a new version. + * + * @param commitActionControlTemplateOptions the {@link CommitActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall commitActionControlTemplate(CommitActionControlTemplateOptions commitActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(commitActionControlTemplateOptions, + "commitActionControlTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", commitActionControlTemplateOptions.actionControlTemplateId()); + pathParamsMap.put("version", commitActionControlTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}/commit", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get action control template assignments. + * + * Get action control template assignments by attributes. The following attributes are supported: + * `account_id`, `template_id`, `template_version`, `sort`. + * `account_id` is a required query parameter. Only action control template assignments with the specified attributes + * and accessible by the caller are returned. If the caller does not have read access to any action control template + * assignments, an empty array is returned. + * + * @param listActionControlAssignmentsOptions the {@link ListActionControlAssignmentsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignmentCollection} + */ + public ServiceCall listActionControlAssignments(ListActionControlAssignmentsOptions listActionControlAssignmentsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlAssignmentsOptions, + "listActionControlAssignmentsOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlAssignments"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listActionControlAssignmentsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listActionControlAssignmentsOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listActionControlAssignmentsOptions.accountId())); + if (listActionControlAssignmentsOptions.templateId() != null) { + builder.query("template_id", String.valueOf(listActionControlAssignmentsOptions.templateId())); + } + if (listActionControlAssignmentsOptions.templateVersion() != null) { + builder.query("template_version", String.valueOf(listActionControlAssignmentsOptions.templateVersion())); + } + if (listActionControlAssignmentsOptions.limit() != null) { + builder.query("limit", String.valueOf(listActionControlAssignmentsOptions.limit())); + } + if (listActionControlAssignmentsOptions.start() != null) { + builder.query("start", String.valueOf(listActionControlAssignmentsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create an action control template assignment. + * + * Assign an action control template to child accounts and account groups. This creates the action control in the + * accounts and account groups that you specify. + * + * @param createActionControlTemplateAssignmentOptions the {@link CreateActionControlTemplateAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignmentCollection} + */ + public ServiceCall createActionControlTemplateAssignment(CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateAssignmentOptions, + "createActionControlTemplateAssignmentOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplateAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createActionControlTemplateAssignmentOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createActionControlTemplateAssignmentOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateAssignmentOptions.target())); + contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateAssignmentOptions.templates())); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve an action control assignment. + * + * Retrieve an action control template assignment by providing an action control assignment ID. + * + * @param getActionControlAssignmentOptions the {@link GetActionControlAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignment} + */ + public ServiceCall getActionControlAssignment(GetActionControlAssignmentOptions getActionControlAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlAssignmentOptions, + "getActionControlAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", getActionControlAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlAssignment"); + 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 an action control assignment. + * + * Update an action control assignment by providing an action control assignment ID. + * + * @param updateActionControlAssignmentOptions the {@link UpdateActionControlAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignment} + */ + public ServiceCall updateActionControlAssignment(UpdateActionControlAssignmentOptions updateActionControlAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateActionControlAssignmentOptions, + "updateActionControlAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", updateActionControlAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateActionControlAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updateActionControlAssignmentOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("template_version", updateActionControlAssignmentOptions.templateVersion()); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Remove an action control assignment. + * + * Remove an action control template assignment by providing an action control assignment ID. You can't delete an + * action control assignment if the status is "in_progress". + * + * @param deleteActionControlAssignmentOptions the {@link DeleteActionControlAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteActionControlAssignment(DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlAssignmentOptions, + "deleteActionControlAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", deleteActionControlAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * List role templates by attributes. + * + * List role templates and filter by attributes by using query parameters. The following attributes are supported: + * `account_id`, `name`, `role_name`, `role_service_name`, `state`, `limit`, `start`. + * `account_id` is a required query parameter. Only role templates that have the specified attributes and that the + * caller has read access to are returned. If the caller does not have read access to any role templates an empty + * array is returned. + * + * @param listRoleTemplatesOptions the {@link ListRoleTemplatesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplateCollection} + */ + public ServiceCall listRoleTemplates(ListRoleTemplatesOptions listRoleTemplatesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleTemplatesOptions, + "listRoleTemplatesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleTemplates"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listRoleTemplatesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listRoleTemplatesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listRoleTemplatesOptions.accountId())); + if (listRoleTemplatesOptions.name() != null) { + builder.query("name", String.valueOf(listRoleTemplatesOptions.name())); + } + if (listRoleTemplatesOptions.roleName() != null) { + builder.query("role_name", String.valueOf(listRoleTemplatesOptions.roleName())); + } + if (listRoleTemplatesOptions.roleServiceName() != null) { + builder.query("role_service_name", String.valueOf(listRoleTemplatesOptions.roleServiceName())); + } + if (listRoleTemplatesOptions.state() != null) { + builder.query("state", String.valueOf(listRoleTemplatesOptions.state())); + } + if (listRoleTemplatesOptions.limit() != null) { + builder.query("limit", String.valueOf(listRoleTemplatesOptions.limit())); + } + if (listRoleTemplatesOptions.start() != null) { + builder.query("start", String.valueOf(listRoleTemplatesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create role template. + * + * Create a role template. Role templates define roles from an existing system or service defined role. + * + * @param createRoleTemplateOptions the {@link CreateRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall createRoleTemplate(CreateRoleTemplateOptions createRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateOptions, + "createRoleTemplateOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createRoleTemplateOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createRoleTemplateOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("name", createRoleTemplateOptions.name()); + contentJson.addProperty("account_id", createRoleTemplateOptions.accountId()); + if (createRoleTemplateOptions.description() != null) { + contentJson.addProperty("description", createRoleTemplateOptions.description()); + } + if (createRoleTemplateOptions.committed() != null) { + contentJson.addProperty("committed", createRoleTemplateOptions.committed()); + } + if (createRoleTemplateOptions.role() != null) { + contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateOptions.role())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve the latest version of a role template. + * + * Retrieve the latest version of a role template by providing a role template ID. + * + * @param getRoleTemplateOptions the {@link GetRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall getRoleTemplate(GetRoleTemplateOptions getRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleTemplateOptions, + "getRoleTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", getRoleTemplateOptions.roleTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getRoleTemplateOptions.state() != null) { + builder.query("state", String.valueOf(getRoleTemplateOptions.state())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a Role template. + * + * Delete a role template by providing the role template ID. This deletes all versions of this template. A role + * template can't be deleted if any version of the template is assigned to one or more child accounts. You must remove + * the role assignments first. + * + * @param deleteRoleTemplateOptions the {@link DeleteRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteRoleTemplate(DeleteRoleTemplateOptions deleteRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleTemplateOptions, + "deleteRoleTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", deleteRoleTemplateOptions.roleTemplateId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a new role template version. + * + * Create a new version of a role template. Use this if you need to make updates to a role template that is committed. + * + * @param createRoleTemplateVersionOptions the {@link CreateRoleTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall createRoleTemplateVersion(CreateRoleTemplateVersionOptions createRoleTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateVersionOptions, + "createRoleTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", createRoleTemplateVersionOptions.roleTemplateId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + if (createRoleTemplateVersionOptions.name() != null) { + contentJson.addProperty("name", createRoleTemplateVersionOptions.name()); + } + if (createRoleTemplateVersionOptions.description() != null) { + contentJson.addProperty("description", createRoleTemplateVersionOptions.description()); + } + if (createRoleTemplateVersionOptions.role() != null) { + contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateVersionOptions.role())); + } + if (createRoleTemplateVersionOptions.committed() != null) { + contentJson.addProperty("committed", createRoleTemplateVersionOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve role template versions. + * + * Retrieve the versions of a role template by providing a role template ID. + * + * @param listRoleTemplateVersionsOptions the {@link ListRoleTemplateVersionsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplateVersionsCollection} + */ + public ServiceCall listRoleTemplateVersions(ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleTemplateVersionsOptions, + "listRoleTemplateVersionsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", listRoleTemplateVersionsOptions.roleTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleTemplateVersions"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listRoleTemplateVersionsOptions.state() != null) { + builder.query("state", String.valueOf(listRoleTemplateVersionsOptions.state())); + } + if (listRoleTemplateVersionsOptions.limit() != null) { + builder.query("limit", String.valueOf(listRoleTemplateVersionsOptions.limit())); + } + if (listRoleTemplateVersionsOptions.start() != null) { + builder.query("start", String.valueOf(listRoleTemplateVersionsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a role template version. + * + * Update a specific version of a role template. You can use this only if the version isn't committed. + * + * @param replaceRoleTemplateOptions the {@link ReplaceRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall replaceRoleTemplate(ReplaceRoleTemplateOptions replaceRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceRoleTemplateOptions, + "replaceRoleTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", replaceRoleTemplateOptions.roleTemplateId()); + pathParamsMap.put("version", replaceRoleTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replaceRoleTemplateOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + if (replaceRoleTemplateOptions.name() != null) { + contentJson.addProperty("name", replaceRoleTemplateOptions.name()); + } + if (replaceRoleTemplateOptions.description() != null) { + contentJson.addProperty("description", replaceRoleTemplateOptions.description()); + } + if (replaceRoleTemplateOptions.role() != null) { + contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRoleTemplateOptions.role())); + } + if (replaceRoleTemplateOptions.committed() != null) { + contentJson.addProperty("committed", replaceRoleTemplateOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a role template version. + * + * Delete a specific version of a role template by providing a role template ID and version number. You can't delete a + * role template version that is assigned to one or more child accounts. You must remove the role assignments first. + * + * @param deleteRoleTemplateVersionOptions the {@link DeleteRoleTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteRoleTemplateVersion(DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleTemplateVersionOptions, + "deleteRoleTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", deleteRoleTemplateVersionOptions.roleTemplateId()); + pathParamsMap.put("version", deleteRoleTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a role template version. + * + * Retrieve a role template by providing a role template ID and version number. + * + * @param getRoleTemplateVersionOptions the {@link GetRoleTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall getRoleTemplateVersion(GetRoleTemplateVersionOptions getRoleTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleTemplateVersionOptions, + "getRoleTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", getRoleTemplateVersionOptions.roleTemplateId()); + pathParamsMap.put("version", getRoleTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleTemplateVersion"); + 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); + } + + /** + * Commit a role template version. + * + * Commit a role template version. You cannot make any further changes to the role template once it's committed. If + * you have to make updates after committing a version, create a new version. + * + * @param commitRoleTemplateOptions the {@link CommitRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall commitRoleTemplate(CommitRoleTemplateOptions commitRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(commitRoleTemplateOptions, + "commitRoleTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", commitRoleTemplateOptions.roleTemplateId()); + pathParamsMap.put("version", commitRoleTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}/commit", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get role template assignments. + * + * Get role template assignments by attributes. The following attributes are supported: + * `account_id`, `template_id`, `template_version`, `target`, `target_type`, `limit`, `start`. + * `account_id` is a required query parameter. Only role template assignments with the specified attributes and + * accessible by the caller are returned. If the caller does not have read access to any role template assignments, an + * empty array is returned. + * + * @param listRoleAssignmentsOptions the {@link ListRoleAssignmentsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleAssignmentCollection} + */ + public ServiceCall listRoleAssignments(ListRoleAssignmentsOptions listRoleAssignmentsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleAssignmentsOptions, + "listRoleAssignmentsOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleAssignments"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listRoleAssignmentsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listRoleAssignmentsOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listRoleAssignmentsOptions.accountId())); + if (listRoleAssignmentsOptions.templateId() != null) { + builder.query("template_id", String.valueOf(listRoleAssignmentsOptions.templateId())); + } + if (listRoleAssignmentsOptions.templateVersion() != null) { + builder.query("template_version", String.valueOf(listRoleAssignmentsOptions.templateVersion())); + } + if (listRoleAssignmentsOptions.limit() != null) { + builder.query("limit", String.valueOf(listRoleAssignmentsOptions.limit())); + } + if (listRoleAssignmentsOptions.start() != null) { + builder.query("start", String.valueOf(listRoleAssignmentsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a role template assignment. + * + * Assign a role template to child accounts and account groups. This creates the role in the accounts and account + * groups that you specify. + * + * @param createRoleTemplateAssignmentOptions the {@link CreateRoleTemplateAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleAssignmentCollection} + */ + public ServiceCall createRoleTemplateAssignment(CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateAssignmentOptions, + "createRoleTemplateAssignmentOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplateAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createRoleTemplateAssignmentOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createRoleTemplateAssignmentOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateAssignmentOptions.target())); + contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateAssignmentOptions.templates())); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a role assignment. + * + * Retrieve a role template assignment by providing a role assignment ID. + * + * @param getRoleAssignmentOptions the {@link GetRoleAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleAssignment} + */ + public ServiceCall getRoleAssignment(GetRoleAssignmentOptions getRoleAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleAssignmentOptions, + "getRoleAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", getRoleAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleAssignment"); + 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 a role assignment. + * + * Update a role assignment by providing a role assignment ID. + * + * @param updateRoleAssignmentOptions the {@link UpdateRoleAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleAssignment} + */ + public ServiceCall updateRoleAssignment(UpdateRoleAssignmentOptions updateRoleAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateRoleAssignmentOptions, + "updateRoleAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", updateRoleAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateRoleAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updateRoleAssignmentOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("template_version", updateRoleAssignmentOptions.templateVersion()); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Remove a role assignment. + * + * Remove a role template assignment by providing a role assignment ID. You can't delete a role assignment if the + * status is "in_progress". + * + * @param deleteRoleAssignmentOptions the {@link DeleteRoleAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteRoleAssignment(DeleteRoleAssignmentOptions deleteRoleAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleAssignmentOptions, + "deleteRoleAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", deleteRoleAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java new file mode 100644 index 00000000000..af82ea2abe8 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The Access Management Account Settings that are currently set for the requested account. + */ +public class AccountSettingsAccessManagement extends GenericModel { + + @SerializedName("external_account_identity_interaction") + protected ExternalAccountIdentityInteraction externalAccountIdentityInteraction; + + protected AccountSettingsAccessManagement() { } + + /** + * Gets the externalAccountIdentityInteraction. + * + * How external accounts can interact in relation to the requested account. + * + * @return the externalAccountIdentityInteraction + */ + public ExternalAccountIdentityInteraction getExternalAccountIdentityInteraction() { + return externalAccountIdentityInteraction; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java new file mode 100644 index 00000000000..ea230f57263 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java @@ -0,0 +1,207 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the assigned action control template. + */ +public class ActionControlAssignment extends GenericModel { + + /** + * The current operation of the action control assignment. + */ + public interface Operation { + /** create. */ + String CREATE = "create"; + /** apply. */ + String APPLY = "apply"; + /** update. */ + String UPDATE = "update"; + /** remove. */ + String REMOVE = "remove"; + } + + /** + * The action control assignment status. + */ + public interface Status { + /** accepted. */ + String ACCEPTED = "accepted"; + /** failure. */ + String FAILURE = "failure"; + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** superseded. */ + String SUPERSEDED = "superseded"; + } + + protected String id; + @SerializedName("account_id") + protected String accountId; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String operation; + protected List resources; + protected ActionControlAssignmentTemplate template; + protected AssignmentTargetDetails target; + protected String status; + + protected ActionControlAssignment() { } + + /** + * Gets the id. + * + * Action control assignment ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the accountId. + * + * The account GUID that the action control assignments belong to. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the href. + * + * The href URL that links to the action control assignments API by action control assignment ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the action control assignment was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the action control assignment. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the action control assignment was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the action control assignment. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the operation. + * + * The current operation of the action control assignment. + * + * @return the operation + */ + public String getOperation() { + return operation; + } + + /** + * Gets the resources. + * + * Resources created when action control template is assigned. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the template. + * + * The action control template id and version that will be assigned. + * + * @return the template + */ + public ActionControlAssignmentTemplate getTemplate() { + return template; + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the status. + * + * The action control assignment status. + * + * @return the status + */ + public String getStatus() { + return status; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java new file mode 100644 index 00000000000..a9d6b28ce39 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of action control assignments. + */ +public class ActionControlAssignmentCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List assignments; + + protected ActionControlAssignmentCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the assignments. + * + * List of action control assignments. + * + * @return the assignments + */ + public List getAssignments() { + return assignments; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java new file mode 100644 index 00000000000..122d3c8277b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java @@ -0,0 +1,52 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The action control assignment resources and target where the template is assigned. + */ +public class ActionControlAssignmentResource extends GenericModel { + + protected AssignmentTargetDetails target; + @SerializedName("action_control") + protected ActionControlAssignmentResourceActionControl actionControl; + + protected ActionControlAssignmentResource() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the actionControl. + * + * Set of properties of the assigned resource or error message if assignment failed. + * + * @return the actionControl + */ + public ActionControlAssignmentResourceActionControl getActionControl() { + return actionControl; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java new file mode 100644 index 00000000000..0e5550eb4da --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Set of properties of the assigned resource or error message if assignment failed. + */ +public class ActionControlAssignmentResourceActionControl extends GenericModel { + + @SerializedName("resource_created") + protected ActionControlAssignmentResourceCreated resourceCreated; + @SerializedName("error_message") + protected AssignmentResourceError errorMessage; + + protected ActionControlAssignmentResourceActionControl() { } + + /** + * Gets the resourceCreated. + * + * On success, it includes the action control assigned. + * + * @return the resourceCreated + */ + public ActionControlAssignmentResourceCreated getResourceCreated() { + return resourceCreated; + } + + /** + * Gets the errorMessage. + * + * Body parameters for assignment error. + * + * @return the errorMessage + */ + public AssignmentResourceError getErrorMessage() { + return errorMessage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java new file mode 100644 index 00000000000..6ecbd23392a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * On success, it includes the action control assigned. + */ +public class ActionControlAssignmentResourceCreated extends GenericModel { + + protected String id; + + protected ActionControlAssignmentResourceCreated() { } + + /** + * Gets the id. + * + * action control id. + * + * @return the id + */ + public String getId() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java new file mode 100644 index 00000000000..4e6d2543e18 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The action control template id and version that will be assigned. + */ +public class ActionControlAssignmentTemplate extends GenericModel { + + protected String id; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String version; + + /** + * Instantiates a new Builder from an existing ActionControlAssignmentTemplate instance. + * + * @param actionControlAssignmentTemplate the instance to initialize the Builder with + */ + private Builder(ActionControlAssignmentTemplate actionControlAssignmentTemplate) { + this.id = actionControlAssignmentTemplate.id; + this.version = actionControlAssignmentTemplate.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + * @param version the version + */ + public Builder(String id, String version) { + this.id = id; + this.version = version; + } + + /** + * Builds a ActionControlAssignmentTemplate. + * + * @return the new ActionControlAssignmentTemplate instance + */ + public ActionControlAssignmentTemplate build() { + return new ActionControlAssignmentTemplate(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the ActionControlAssignmentTemplate builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the ActionControlAssignmentTemplate builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected ActionControlAssignmentTemplate() { } + + protected ActionControlAssignmentTemplate(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, + "id cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + id = builder.id; + version = builder.version; + } + + /** + * New builder. + * + * @return a ActionControlAssignmentTemplate builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * Action control template ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java new file mode 100644 index 00000000000..78b6d56be6d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * ActionControlAssignmentsPager can be used to simplify the use of the "listActionControlAssignments" method. + */ +public class ActionControlAssignmentsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListActionControlAssignmentsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected ActionControlAssignmentsPager() { } + + /** + * Constructs a new ActionControlAssignmentsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlAssignments" method + * @param options the ListActionControlAssignmentsOptions instance to be used to invoke the "listActionControlAssignments" method + */ + public ActionControlAssignmentsPager(IamPolicyManagement client, ListActionControlAssignmentsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<ActionControlAssignment> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListActionControlAssignmentsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + ActionControlAssignmentCollection result = client.listActionControlAssignments(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getAssignments(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<ActionControlAssignment> containing all results returned by the "listActionControlAssignments" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java new file mode 100644 index 00000000000..157c9f6a390 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java @@ -0,0 +1,203 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the action control template. + */ +public class ActionControlTemplate extends GenericModel { + + /** + * State of action control template. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String name; + protected String description; + @SerializedName("account_id") + protected String accountId; + protected Boolean committed; + @SerializedName("action_control") + protected TemplateActionControl actionControl; + protected String id; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String version; + protected String state; + + protected ActionControlTemplate() { } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Description of the action control template. This is shown to users in the enterprise account. Use this to describe + * the purpose or context of the action control for enterprise users managing IAM templates. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the committed. + * + * Committed status of the template. If committed is set to true, then the template version can no longer be updated. + * + * @return the committed + */ + public Boolean isCommitted() { + return committed; + } + + /** + * Gets the actionControl. + * + * The action control properties that are created in an action resource when the template is assigned. + * + * @return the actionControl + */ + public TemplateActionControl getActionControl() { + return actionControl; + } + + /** + * Gets the id. + * + * The action control template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the action control templates API by action control template ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the action control template was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the action control template. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the action control template was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the action control template. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the version. + * + * The version number of the template used to identify different versions of same template. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the state. + * + * State of action control template. + * + * @return the state + */ + public String getState() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java new file mode 100644 index 00000000000..e7536d2c9ae --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java @@ -0,0 +1,90 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of action control templates. + */ +public class ActionControlTemplateCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + @SerializedName("action_control_templates") + protected List actionControlTemplates; + + protected ActionControlTemplateCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the actionControlTemplates. + * + * List of action control templates. + * + * @return the actionControlTemplates + */ + public List getActionControlTemplates() { + return actionControlTemplates; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java new file mode 100644 index 00000000000..5e26f45cf46 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of versions for a specific action control template. + */ +public class ActionControlTemplateVersionsCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List versions; + + protected ActionControlTemplateVersionsCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the versions. + * + * List of action control templates versions. + * + * @return the versions + */ + public List getVersions() { + return versions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java new file mode 100644 index 00000000000..660aefe11ba --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * ActionControlTemplateVersionsPager can be used to simplify the use of the "listActionControlTemplateVersions" method. + */ +public class ActionControlTemplateVersionsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListActionControlTemplateVersionsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected ActionControlTemplateVersionsPager() { } + + /** + * Constructs a new ActionControlTemplateVersionsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlTemplateVersions" method + * @param options the ListActionControlTemplateVersionsOptions instance to be used to invoke the "listActionControlTemplateVersions" method + */ + public ActionControlTemplateVersionsPager(IamPolicyManagement client, ListActionControlTemplateVersionsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<ActionControlTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListActionControlTemplateVersionsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + ActionControlTemplateVersionsCollection result = client.listActionControlTemplateVersions(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getVersions(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<ActionControlTemplate> containing all results returned by the "listActionControlTemplateVersions" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java new file mode 100644 index 00000000000..bd326c8d7ec --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * ActionControlTemplatesPager can be used to simplify the use of the "listActionControlTemplates" method. + */ +public class ActionControlTemplatesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListActionControlTemplatesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected ActionControlTemplatesPager() { } + + /** + * Constructs a new ActionControlTemplatesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlTemplates" method + * @param options the ListActionControlTemplatesOptions instance to be used to invoke the "listActionControlTemplates" method + */ + public ActionControlTemplatesPager(IamPolicyManagement client, ListActionControlTemplatesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<ActionControlTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListActionControlTemplatesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + ActionControlTemplateCollection result = client.listActionControlTemplates(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getActionControlTemplates(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<ActionControlTemplate> containing all results returned by the "listActionControlTemplates" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java new file mode 100644 index 00000000000..c454c7a3ef5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * On success, includes the policy that is assigned. + */ +public class AssignmentResourceCreated extends GenericModel { + + protected String id; + + protected AssignmentResourceCreated() { } + + /** + * Gets the id. + * + * Policy id. + * + * @return the id + */ + public String getId() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java new file mode 100644 index 00000000000..e74dbe58b3a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Body parameters for assignment error. + */ +public class AssignmentResourceError extends GenericModel { + + protected String name; + protected String errorCode; + protected String message; + protected String code; + protected List errors; + + protected AssignmentResourceError() { } + + /** + * Gets the name. + * + * Name of the error. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the errorCode. + * + * error code. + * + * @return the errorCode + */ + public String getErrorCode() { + return errorCode; + } + + /** + * Gets the message. + * + * Error message detailing the nature of the error. + * + * @return the message + */ + public String getMessage() { + return message; + } + + /** + * Gets the code. + * + * Internal status code for the error. + * + * @return the code + */ + public String getCode() { + return code; + } + + /** + * Gets the errors. + * + * The errors encountered during the response. + * + * @return the errors + */ + public List getErrors() { + return errors; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java new file mode 100644 index 00000000000..893d528604c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java @@ -0,0 +1,142 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * assignment target account and type. + */ +public class AssignmentTargetDetails extends GenericModel { + + /** + * Assignment target type. + */ + public interface Type { + /** Account. */ + String ACCOUNT = "Account"; + } + + protected String type; + protected String id; + + /** + * Builder. + */ + public static class Builder { + private String type; + private String id; + + /** + * Instantiates a new Builder from an existing AssignmentTargetDetails instance. + * + * @param assignmentTargetDetails the instance to initialize the Builder with + */ + private Builder(AssignmentTargetDetails assignmentTargetDetails) { + this.type = assignmentTargetDetails.type; + this.id = assignmentTargetDetails.id; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param type the type + * @param id the id + */ + public Builder(String type, String id) { + this.type = type; + this.id = id; + } + + /** + * Builds a AssignmentTargetDetails. + * + * @return the new AssignmentTargetDetails instance + */ + public AssignmentTargetDetails build() { + return new AssignmentTargetDetails(this); + } + + /** + * Set the type. + * + * @param type the type + * @return the AssignmentTargetDetails builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the id. + * + * @param id the id + * @return the AssignmentTargetDetails builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + } + + protected AssignmentTargetDetails() { } + + protected AssignmentTargetDetails(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, + "id cannot be null"); + type = builder.type; + id = builder.id; + } + + /** + * New builder. + * + * @return a AssignmentTargetDetails builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the type. + * + * Assignment target type. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the id. + * + * ID of the target account. + * + * @return the id + */ + public String id() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java new file mode 100644 index 00000000000..b8025e305a9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java @@ -0,0 +1,119 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * policy template details. + */ +public class AssignmentTemplateDetails extends GenericModel { + + protected String id; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String version; + + /** + * Instantiates a new Builder from an existing AssignmentTemplateDetails instance. + * + * @param assignmentTemplateDetails the instance to initialize the Builder with + */ + private Builder(AssignmentTemplateDetails assignmentTemplateDetails) { + this.id = assignmentTemplateDetails.id; + this.version = assignmentTemplateDetails.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a AssignmentTemplateDetails. + * + * @return the new AssignmentTemplateDetails instance + */ + public AssignmentTemplateDetails build() { + return new AssignmentTemplateDetails(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the AssignmentTemplateDetails builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the AssignmentTemplateDetails builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected AssignmentTemplateDetails() { } + + protected AssignmentTemplateDetails(Builder builder) { + id = builder.id; + version = builder.version; + } + + /** + * New builder. + * + * @return a AssignmentTemplateDetails builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * Policy template ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the version. + * + * Policy template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java new file mode 100644 index 00000000000..78291e6c2c5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The commitActionControlTemplate options. + */ +public class CommitActionControlTemplateOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing CommitActionControlTemplateOptions instance. + * + * @param commitActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(CommitActionControlTemplateOptions commitActionControlTemplateOptions) { + this.actionControlTemplateId = commitActionControlTemplateOptions.actionControlTemplateId; + this.version = commitActionControlTemplateOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + * @param version the version + */ + public Builder(String actionControlTemplateId, String version) { + this.actionControlTemplateId = actionControlTemplateId; + this.version = version; + } + + /** + * Builds a CommitActionControlTemplateOptions. + * + * @return the new CommitActionControlTemplateOptions instance + */ + public CommitActionControlTemplateOptions build() { + return new CommitActionControlTemplateOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the CommitActionControlTemplateOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the CommitActionControlTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected CommitActionControlTemplateOptions() { } + + protected CommitActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a CommitActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the version. + * + * The action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java new file mode 100644 index 00000000000..61283194c44 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The commitPolicyTemplate options. + */ +public class CommitPolicyTemplateOptions extends GenericModel { + + protected String policyTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing CommitPolicyTemplateOptions instance. + * + * @param commitPolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(CommitPolicyTemplateOptions commitPolicyTemplateOptions) { + this.policyTemplateId = commitPolicyTemplateOptions.policyTemplateId; + this.version = commitPolicyTemplateOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param version the version + */ + public Builder(String policyTemplateId, String version) { + this.policyTemplateId = policyTemplateId; + this.version = version; + } + + /** + * Builds a CommitPolicyTemplateOptions. + * + * @return the new CommitPolicyTemplateOptions instance + */ + public CommitPolicyTemplateOptions build() { + return new CommitPolicyTemplateOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the CommitPolicyTemplateOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the CommitPolicyTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected CommitPolicyTemplateOptions() { } + + protected CommitPolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + policyTemplateId = builder.policyTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a CommitPolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the version. + * + * The policy template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java new file mode 100644 index 00000000000..7e93c92fb0b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The commitRoleTemplate options. + */ +public class CommitRoleTemplateOptions extends GenericModel { + + protected String roleTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing CommitRoleTemplateOptions instance. + * + * @param commitRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(CommitRoleTemplateOptions commitRoleTemplateOptions) { + this.roleTemplateId = commitRoleTemplateOptions.roleTemplateId; + this.version = commitRoleTemplateOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + * @param version the version + */ + public Builder(String roleTemplateId, String version) { + this.roleTemplateId = roleTemplateId; + this.version = version; + } + + /** + * Builds a CommitRoleTemplateOptions. + * + * @return the new CommitRoleTemplateOptions instance + */ + public CommitRoleTemplateOptions build() { + return new CommitRoleTemplateOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the CommitRoleTemplateOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the CommitRoleTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected CommitRoleTemplateOptions() { } + + protected CommitRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + roleTemplateId = builder.roleTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a CommitRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the version. + * + * The role template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java new file mode 100644 index 00000000000..be0c3d0aa98 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java @@ -0,0 +1,62 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Details of conflicting resource. + */ +public class ConflictsWith extends GenericModel { + + protected String etag; + protected String role; + protected String policy; + + protected ConflictsWith() { } + + /** + * Gets the etag. + * + * The revision number of the resource. + * + * @return the etag + */ + public String getEtag() { + return etag; + } + + /** + * Gets the role. + * + * The conflicting role of ID. + * + * @return the role + */ + public String getRole() { + return role; + } + + /** + * Gets the policy. + * + * The conflicting policy ID. + * + * @return the policy + */ + public String getPolicy() { + return policy; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java new file mode 100644 index 00000000000..15e502ac214 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Specifies the type of access that is granted by the policy. + */ +public class Control extends GenericModel { + + protected Grant grant; + + /** + * Builder. + */ + public static class Builder { + private Grant grant; + + /** + * Instantiates a new Builder from an existing Control instance. + * + * @param control the instance to initialize the Builder with + */ + private Builder(Control control) { + this.grant = control.grant; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param grant the grant + */ + public Builder(Grant grant) { + this.grant = grant; + } + + /** + * Builds a Control. + * + * @return the new Control instance + */ + public Control build() { + return new Control(this); + } + + /** + * Set the grant. + * + * @param grant the grant + * @return the Control builder + */ + public Builder grant(Grant grant) { + this.grant = grant; + return this; + } + } + + protected Control() { } + + protected Control(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.grant, + "grant cannot be null"); + grant = builder.grant; + } + + /** + * New builder. + * + * @return a Control builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the grant. + * + * Permission is granted by the policy. + * + * @return the grant + */ + public Grant grant() { + return grant; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java new file mode 100644 index 00000000000..5055d290c80 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * ControlResponse. + * + * Classes which extend this class: + * - ControlResponseControl + * - ControlResponseControlWithEnrichedRoles + */ +public class ControlResponse extends GenericModel { + + protected Grant grant; + + protected ControlResponse() { } + + /** + * Gets the grant. + * + * Permission is granted by the policy. + * + * @return the grant + */ + public Grant getGrant() { + return grant; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java new file mode 100644 index 00000000000..5934ebf7c76 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java @@ -0,0 +1,24 @@ +/* + * (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_policy_management.v1.model; + +/** + * Specifies the type of access that is granted by the policy. + */ +public class ControlResponseControl extends ControlResponse { + + + protected ControlResponseControl() { } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java new file mode 100644 index 00000000000..8b3c73d73c0 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java @@ -0,0 +1,24 @@ +/* + * (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_policy_management.v1.model; + +/** + * Specifies the type of access that is granted by the policy with additional role information. + */ +public class ControlResponseControlWithEnrichedRoles extends ControlResponse { + + + protected ControlResponseControlWithEnrichedRoles() { } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java new file mode 100644 index 00000000000..1ccd3f8b4dd --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java @@ -0,0 +1,191 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createActionControlTemplateAssignment options. + */ +public class CreateActionControlTemplateAssignmentOptions extends GenericModel { + + protected AssignmentTargetDetails target; + protected List templates; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private AssignmentTargetDetails target; + private List templates; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateActionControlTemplateAssignmentOptions instance. + * + * @param createActionControlTemplateAssignmentOptions the instance to initialize the Builder with + */ + private Builder(CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptions) { + this.target = createActionControlTemplateAssignmentOptions.target; + this.templates = createActionControlTemplateAssignmentOptions.templates; + this.acceptLanguage = createActionControlTemplateAssignmentOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param target the target + * @param templates the templates + */ + public Builder(AssignmentTargetDetails target, List templates) { + this.target = target; + this.templates = templates; + } + + /** + * Builds a CreateActionControlTemplateAssignmentOptions. + * + * @return the new CreateActionControlTemplateAssignmentOptions instance + */ + public CreateActionControlTemplateAssignmentOptions build() { + return new CreateActionControlTemplateAssignmentOptions(this); + } + + /** + * Adds a new element to templates. + * + * @param templates the new element to be added + * @return the CreateActionControlTemplateAssignmentOptions builder + */ + public Builder addTemplates(ActionControlAssignmentTemplate templates) { + com.ibm.cloud.sdk.core.util.Validator.notNull(templates, + "templates cannot be null"); + if (this.templates == null) { + this.templates = new ArrayList(); + } + this.templates.add(templates); + return this; + } + + /** + * Set the target. + * + * @param target the target + * @return the CreateActionControlTemplateAssignmentOptions builder + */ + public Builder target(AssignmentTargetDetails target) { + this.target = target; + return this; + } + + /** + * Set the templates. + * Existing templates will be replaced. + * + * @param templates the templates + * @return the CreateActionControlTemplateAssignmentOptions builder + */ + public Builder templates(List templates) { + this.templates = templates; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateActionControlTemplateAssignmentOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateActionControlTemplateAssignmentOptions() { } + + protected CreateActionControlTemplateAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, + "target cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, + "templates cannot be null"); + target = builder.target; + templates = builder.templates; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateActionControlTemplateAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails target() { + return target; + } + + /** + * Gets the templates. + * + * List of action control template details for action control assignment. + * + * @return the templates + */ + public List templates() { + return templates; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java new file mode 100644 index 00000000000..37594a7a440 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java @@ -0,0 +1,251 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createActionControlTemplate options. + */ +public class CreateActionControlTemplateOptions extends GenericModel { + + protected String name; + protected String accountId; + protected String description; + protected Boolean committed; + protected TemplateActionControl actionControl; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String accountId; + private String description; + private Boolean committed; + private TemplateActionControl actionControl; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateActionControlTemplateOptions instance. + * + * @param createActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(CreateActionControlTemplateOptions createActionControlTemplateOptions) { + this.name = createActionControlTemplateOptions.name; + this.accountId = createActionControlTemplateOptions.accountId; + this.description = createActionControlTemplateOptions.description; + this.committed = createActionControlTemplateOptions.committed; + this.actionControl = createActionControlTemplateOptions.actionControl; + this.acceptLanguage = createActionControlTemplateOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param accountId the accountId + */ + public Builder(String name, String accountId) { + this.name = name; + this.accountId = accountId; + } + + /** + * Builds a CreateActionControlTemplateOptions. + * + * @return the new CreateActionControlTemplateOptions instance + */ + public CreateActionControlTemplateOptions build() { + return new CreateActionControlTemplateOptions(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateActionControlTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreateActionControlTemplateOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateActionControlTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreateActionControlTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + + /** + * Set the actionControl. + * + * @param actionControl the actionControl + * @return the CreateActionControlTemplateOptions builder + */ + public Builder actionControl(TemplateActionControl actionControl) { + this.actionControl = actionControl; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateActionControlTemplateOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateActionControlTemplateOptions() { } + + protected CreateActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + name = builder.name; + accountId = builder.accountId; + description = builder.description; + committed = builder.committed; + actionControl = builder.actionControl; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the description. + * + * Description of the action control template. This is shown to users in the enterprise account. Use this to describe + * the purpose or context of the action control for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template. If committed is set to true, then the template version can no longer be updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } + + /** + * Gets the actionControl. + * + * The action control properties that are created in an action resource when the template is assigned. + * + * @return the actionControl + */ + public TemplateActionControl actionControl() { + return actionControl; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java new file mode 100644 index 00000000000..13ce1a8e60f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java @@ -0,0 +1,211 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createActionControlTemplateVersion options. + */ +public class CreateActionControlTemplateVersionOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String name; + protected String description; + protected TemplateActionControl actionControl; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String name; + private String description; + private TemplateActionControl actionControl; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing CreateActionControlTemplateVersionOptions instance. + * + * @param createActionControlTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptions) { + this.actionControlTemplateId = createActionControlTemplateVersionOptions.actionControlTemplateId; + this.name = createActionControlTemplateVersionOptions.name; + this.description = createActionControlTemplateVersionOptions.description; + this.actionControl = createActionControlTemplateVersionOptions.actionControl; + this.committed = createActionControlTemplateVersionOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + */ + public Builder(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + } + + /** + * Builds a CreateActionControlTemplateVersionOptions. + * + * @return the new CreateActionControlTemplateVersionOptions instance + */ + public CreateActionControlTemplateVersionOptions build() { + return new CreateActionControlTemplateVersionOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actionControl. + * + * @param actionControl the actionControl + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder actionControl(TemplateActionControl actionControl) { + this.actionControl = actionControl; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected CreateActionControlTemplateVersionOptions() { } + + protected CreateActionControlTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + name = builder.name; + description = builder.description; + actionControl = builder.actionControl; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a CreateActionControlTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * The action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will + * change the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the action control template. This is shown to users in the enterprise account. Use this to describe + * the purpose or context of the action control for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actionControl. + * + * The action control properties that are created in an action resource when the template is assigned. + * + * @return the actionControl + */ + public TemplateActionControl actionControl() { + return actionControl; + } + + /** + * Gets the committed. + * + * Committed status of the template version. If committed is set to true, then the template version can no longer be + * updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java new file mode 100644 index 00000000000..b6ec9f78c02 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java @@ -0,0 +1,311 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createPolicy options. + */ +public class CreatePolicyOptions extends GenericModel { + + protected String type; + protected List subjects; + protected List roles; + protected List resources; + protected String description; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String type; + private List subjects; + private List roles; + private List resources; + private String description; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreatePolicyOptions instance. + * + * @param createPolicyOptions the instance to initialize the Builder with + */ + private Builder(CreatePolicyOptions createPolicyOptions) { + this.type = createPolicyOptions.type; + this.subjects = createPolicyOptions.subjects; + this.roles = createPolicyOptions.roles; + this.resources = createPolicyOptions.resources; + this.description = createPolicyOptions.description; + this.acceptLanguage = createPolicyOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param type the type + * @param subjects the subjects + * @param roles the roles + * @param resources the resources + */ + public Builder(String type, List subjects, List roles, List resources) { + this.type = type; + this.subjects = subjects; + this.roles = roles; + this.resources = resources; + } + + /** + * Builds a CreatePolicyOptions. + * + * @return the new CreatePolicyOptions instance + */ + public CreatePolicyOptions build() { + return new CreatePolicyOptions(this); + } + + /** + * Adds a new element to subjects. + * + * @param subjects the new element to be added + * @return the CreatePolicyOptions builder + */ + public Builder addSubjects(PolicySubject subjects) { + com.ibm.cloud.sdk.core.util.Validator.notNull(subjects, + "subjects cannot be null"); + if (this.subjects == null) { + this.subjects = new ArrayList(); + } + this.subjects.add(subjects); + return this; + } + + /** + * Adds a new element to roles. + * + * @param roles the new element to be added + * @return the CreatePolicyOptions builder + */ + public Builder addRoles(PolicyRole roles) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roles, + "roles cannot be null"); + if (this.roles == null) { + this.roles = new ArrayList(); + } + this.roles.add(roles); + return this; + } + + /** + * Adds a new element to resources. + * + * @param resources the new element to be added + * @return the CreatePolicyOptions builder + */ + public Builder addResources(PolicyResource resources) { + com.ibm.cloud.sdk.core.util.Validator.notNull(resources, + "resources cannot be null"); + if (this.resources == null) { + this.resources = new ArrayList(); + } + this.resources.add(resources); + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the CreatePolicyOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the subjects. + * Existing subjects will be replaced. + * + * @param subjects the subjects + * @return the CreatePolicyOptions builder + */ + public Builder subjects(List subjects) { + this.subjects = subjects; + return this; + } + + /** + * Set the roles. + * Existing roles will be replaced. + * + * @param roles the roles + * @return the CreatePolicyOptions builder + */ + public Builder roles(List roles) { + this.roles = roles; + return this; + } + + /** + * Set the resources. + * Existing resources will be replaced. + * + * @param resources the resources + * @return the CreatePolicyOptions builder + */ + public Builder resources(List resources) { + this.resources = resources; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreatePolicyOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreatePolicyOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreatePolicyOptions() { } + + protected CreatePolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subjects, + "subjects cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, + "roles cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resources, + "resources cannot be null"); + type = builder.type; + subjects = builder.subjects; + roles = builder.roles; + resources = builder.resources; + description = builder.description; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreatePolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the subjects. + * + * The subjects associated with a policy. + * + * @return the subjects + */ + public List subjects() { + return subjects; + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List roles() { + return roles; + } + + /** + * Gets the resources. + * + * The resources associated with a policy. + * + * @return the resources + */ + public List resources() { + return resources; + } + + /** + * Gets the description. + * + * Customer-defined description. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java new file mode 100644 index 00000000000..b71ca393f11 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java @@ -0,0 +1,221 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createPolicyTemplateAssignment options. + */ +public class CreatePolicyTemplateAssignmentOptions extends GenericModel { + + protected String version; + protected AssignmentTargetDetails target; + protected List templates; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String version; + private AssignmentTargetDetails target; + private List templates; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreatePolicyTemplateAssignmentOptions instance. + * + * @param createPolicyTemplateAssignmentOptions the instance to initialize the Builder with + */ + private Builder(CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptions) { + this.version = createPolicyTemplateAssignmentOptions.version; + this.target = createPolicyTemplateAssignmentOptions.target; + this.templates = createPolicyTemplateAssignmentOptions.templates; + this.acceptLanguage = createPolicyTemplateAssignmentOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param version the version + * @param target the target + * @param templates the templates + */ + public Builder(String version, AssignmentTargetDetails target, List templates) { + this.version = version; + this.target = target; + this.templates = templates; + } + + /** + * Builds a CreatePolicyTemplateAssignmentOptions. + * + * @return the new CreatePolicyTemplateAssignmentOptions instance + */ + public CreatePolicyTemplateAssignmentOptions build() { + return new CreatePolicyTemplateAssignmentOptions(this); + } + + /** + * Adds a new element to templates. + * + * @param templates the new element to be added + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder addTemplates(AssignmentTemplateDetails templates) { + com.ibm.cloud.sdk.core.util.Validator.notNull(templates, + "templates cannot be null"); + if (this.templates == null) { + this.templates = new ArrayList(); + } + this.templates.add(templates); + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the target. + * + * @param target the target + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder target(AssignmentTargetDetails target) { + this.target = target; + return this; + } + + /** + * Set the templates. + * Existing templates will be replaced. + * + * @param templates the templates + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder templates(List templates) { + this.templates = templates; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreatePolicyTemplateAssignmentOptions() { } + + protected CreatePolicyTemplateAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, + "target cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, + "templates cannot be null"); + version = builder.version; + target = builder.target; + templates = builder.templates; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreatePolicyTemplateAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the version. + * + * specify version of response body format. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails target() { + return target; + } + + /** + * Gets the templates. + * + * List of template details for policy assignment. + * + * @return the templates + */ + public List templates() { + return templates; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java new file mode 100644 index 00000000000..72944308428 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java @@ -0,0 +1,255 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createPolicyTemplate options. + */ +public class CreatePolicyTemplateOptions extends GenericModel { + + protected String name; + protected String accountId; + protected TemplatePolicy policy; + protected String description; + protected Boolean committed; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String accountId; + private TemplatePolicy policy; + private String description; + private Boolean committed; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreatePolicyTemplateOptions instance. + * + * @param createPolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(CreatePolicyTemplateOptions createPolicyTemplateOptions) { + this.name = createPolicyTemplateOptions.name; + this.accountId = createPolicyTemplateOptions.accountId; + this.policy = createPolicyTemplateOptions.policy; + this.description = createPolicyTemplateOptions.description; + this.committed = createPolicyTemplateOptions.committed; + this.acceptLanguage = createPolicyTemplateOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param accountId the accountId + * @param policy the policy + */ + public Builder(String name, String accountId, TemplatePolicy policy) { + this.name = name; + this.accountId = accountId; + this.policy = policy; + } + + /** + * Builds a CreatePolicyTemplateOptions. + * + * @return the new CreatePolicyTemplateOptions instance + */ + public CreatePolicyTemplateOptions build() { + return new CreatePolicyTemplateOptions(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the CreatePolicyTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreatePolicyTemplateOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the policy. + * + * @param policy the policy + * @return the CreatePolicyTemplateOptions builder + */ + public Builder policy(TemplatePolicy policy) { + this.policy = policy; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreatePolicyTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreatePolicyTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreatePolicyTemplateOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreatePolicyTemplateOptions() { } + + protected CreatePolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.policy, + "policy cannot be null"); + name = builder.name; + accountId = builder.accountId; + policy = builder.policy; + description = builder.description; + committed = builder.committed; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreatePolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy policy() { + return policy; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java new file mode 100644 index 00000000000..6903774c335 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java @@ -0,0 +1,214 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createPolicyTemplateVersion options. + */ +public class CreatePolicyTemplateVersionOptions extends GenericModel { + + protected String policyTemplateId; + protected TemplatePolicy policy; + protected String name; + protected String description; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private TemplatePolicy policy; + private String name; + private String description; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing CreatePolicyTemplateVersionOptions instance. + * + * @param createPolicyTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptions) { + this.policyTemplateId = createPolicyTemplateVersionOptions.policyTemplateId; + this.policy = createPolicyTemplateVersionOptions.policy; + this.name = createPolicyTemplateVersionOptions.name; + this.description = createPolicyTemplateVersionOptions.description; + this.committed = createPolicyTemplateVersionOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param policy the policy + */ + public Builder(String policyTemplateId, TemplatePolicy policy) { + this.policyTemplateId = policyTemplateId; + this.policy = policy; + } + + /** + * Builds a CreatePolicyTemplateVersionOptions. + * + * @return the new CreatePolicyTemplateVersionOptions instance + */ + public CreatePolicyTemplateVersionOptions build() { + return new CreatePolicyTemplateVersionOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the policy. + * + * @param policy the policy + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder policy(TemplatePolicy policy) { + this.policy = policy; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected CreatePolicyTemplateVersionOptions() { } + + protected CreatePolicyTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.policy, + "policy cannot be null"); + policyTemplateId = builder.policyTemplateId; + policy = builder.policy; + name = builder.name; + description = builder.description; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a CreatePolicyTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy policy() { + return policy; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template version. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java new file mode 100644 index 00000000000..725ec5d8a53 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java @@ -0,0 +1,308 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createRole options. + */ +public class CreateRoleOptions extends GenericModel { + + protected String displayName; + protected List actions; + protected String name; + protected String accountId; + protected String serviceName; + protected String description; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String displayName; + private List actions; + private String name; + private String accountId; + private String serviceName; + private String description; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateRoleOptions instance. + * + * @param createRoleOptions the instance to initialize the Builder with + */ + private Builder(CreateRoleOptions createRoleOptions) { + this.displayName = createRoleOptions.displayName; + this.actions = createRoleOptions.actions; + this.name = createRoleOptions.name; + this.accountId = createRoleOptions.accountId; + this.serviceName = createRoleOptions.serviceName; + this.description = createRoleOptions.description; + this.acceptLanguage = createRoleOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param displayName the displayName + * @param actions the actions + * @param name the name + * @param accountId the accountId + * @param serviceName the serviceName + */ + public Builder(String displayName, List actions, String name, String accountId, String serviceName) { + this.displayName = displayName; + this.actions = actions; + this.name = name; + this.accountId = accountId; + this.serviceName = serviceName; + } + + /** + * Builds a CreateRoleOptions. + * + * @return the new CreateRoleOptions instance + */ + public CreateRoleOptions build() { + return new CreateRoleOptions(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the CreateRoleOptions builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the CreateRoleOptions builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the CreateRoleOptions builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateRoleOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreateRoleOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the CreateRoleOptions builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateRoleOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateRoleOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateRoleOptions() { } + + protected CreateRoleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, + "serviceName cannot be null"); + displayName = builder.displayName; + actions = builder.actions; + name = builder.name; + accountId = builder.accountId; + serviceName = builder.serviceName; + description = builder.description; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateRoleOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List actions() { + return actions; + } + + /** + * Gets the name. + * + * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the accountId. + * + * The account GUID. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the serviceName. + * + * The service name. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java new file mode 100644 index 00000000000..c9bef88e703 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java @@ -0,0 +1,191 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createRoleTemplateAssignment options. + */ +public class CreateRoleTemplateAssignmentOptions extends GenericModel { + + protected AssignmentTargetDetails target; + protected List templates; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private AssignmentTargetDetails target; + private List templates; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateRoleTemplateAssignmentOptions instance. + * + * @param createRoleTemplateAssignmentOptions the instance to initialize the Builder with + */ + private Builder(CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptions) { + this.target = createRoleTemplateAssignmentOptions.target; + this.templates = createRoleTemplateAssignmentOptions.templates; + this.acceptLanguage = createRoleTemplateAssignmentOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param target the target + * @param templates the templates + */ + public Builder(AssignmentTargetDetails target, List templates) { + this.target = target; + this.templates = templates; + } + + /** + * Builds a CreateRoleTemplateAssignmentOptions. + * + * @return the new CreateRoleTemplateAssignmentOptions instance + */ + public CreateRoleTemplateAssignmentOptions build() { + return new CreateRoleTemplateAssignmentOptions(this); + } + + /** + * Adds a new element to templates. + * + * @param templates the new element to be added + * @return the CreateRoleTemplateAssignmentOptions builder + */ + public Builder addTemplates(RoleAssignmentTemplate templates) { + com.ibm.cloud.sdk.core.util.Validator.notNull(templates, + "templates cannot be null"); + if (this.templates == null) { + this.templates = new ArrayList(); + } + this.templates.add(templates); + return this; + } + + /** + * Set the target. + * + * @param target the target + * @return the CreateRoleTemplateAssignmentOptions builder + */ + public Builder target(AssignmentTargetDetails target) { + this.target = target; + return this; + } + + /** + * Set the templates. + * Existing templates will be replaced. + * + * @param templates the templates + * @return the CreateRoleTemplateAssignmentOptions builder + */ + public Builder templates(List templates) { + this.templates = templates; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateRoleTemplateAssignmentOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateRoleTemplateAssignmentOptions() { } + + protected CreateRoleTemplateAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, + "target cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, + "templates cannot be null"); + target = builder.target; + templates = builder.templates; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateRoleTemplateAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails target() { + return target; + } + + /** + * Gets the templates. + * + * List of role template details for role assignment. + * + * @return the templates + */ + public List templates() { + return templates; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java new file mode 100644 index 00000000000..baf82e17961 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java @@ -0,0 +1,251 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createRoleTemplate options. + */ +public class CreateRoleTemplateOptions extends GenericModel { + + protected String name; + protected String accountId; + protected String description; + protected Boolean committed; + protected RoleTemplatePrototypeRole role; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String accountId; + private String description; + private Boolean committed; + private RoleTemplatePrototypeRole role; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateRoleTemplateOptions instance. + * + * @param createRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(CreateRoleTemplateOptions createRoleTemplateOptions) { + this.name = createRoleTemplateOptions.name; + this.accountId = createRoleTemplateOptions.accountId; + this.description = createRoleTemplateOptions.description; + this.committed = createRoleTemplateOptions.committed; + this.role = createRoleTemplateOptions.role; + this.acceptLanguage = createRoleTemplateOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param accountId the accountId + */ + public Builder(String name, String accountId) { + this.name = name; + this.accountId = accountId; + } + + /** + * Builds a CreateRoleTemplateOptions. + * + * @return the new CreateRoleTemplateOptions instance + */ + public CreateRoleTemplateOptions build() { + return new CreateRoleTemplateOptions(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateRoleTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreateRoleTemplateOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateRoleTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreateRoleTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + + /** + * Set the role. + * + * @param role the role + * @return the CreateRoleTemplateOptions builder + */ + public Builder role(RoleTemplatePrototypeRole role) { + this.role = role; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateRoleTemplateOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateRoleTemplateOptions() { } + + protected CreateRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + name = builder.name; + accountId = builder.accountId; + description = builder.description; + committed = builder.committed; + role = builder.role; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the description. + * + * Description of the role template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the role for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template. If committed is set to true, then the template version can no longer be updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } + + /** + * Gets the role. + * + * The role properties that are created in an action resource when the template is assigned. + * + * @return the role + */ + public RoleTemplatePrototypeRole role() { + return role; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java new file mode 100644 index 00000000000..c322c5a332d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java @@ -0,0 +1,211 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createRoleTemplateVersion options. + */ +public class CreateRoleTemplateVersionOptions extends GenericModel { + + protected String roleTemplateId; + protected String name; + protected String description; + protected TemplateRole role; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String name; + private String description; + private TemplateRole role; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing CreateRoleTemplateVersionOptions instance. + * + * @param createRoleTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(CreateRoleTemplateVersionOptions createRoleTemplateVersionOptions) { + this.roleTemplateId = createRoleTemplateVersionOptions.roleTemplateId; + this.name = createRoleTemplateVersionOptions.name; + this.description = createRoleTemplateVersionOptions.description; + this.role = createRoleTemplateVersionOptions.role; + this.committed = createRoleTemplateVersionOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + */ + public Builder(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + } + + /** + * Builds a CreateRoleTemplateVersionOptions. + * + * @return the new CreateRoleTemplateVersionOptions instance + */ + public CreateRoleTemplateVersionOptions build() { + return new CreateRoleTemplateVersionOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the role. + * + * @param role the role + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder role(TemplateRole role) { + this.role = role; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected CreateRoleTemplateVersionOptions() { } + + protected CreateRoleTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + roleTemplateId = builder.roleTemplateId; + name = builder.name; + description = builder.description; + role = builder.role; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a CreateRoleTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * The role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will + * change the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the role template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the role for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the role. + * + * The role properties that are created in an action resource when the template is assigned. + * + * @return the role + */ + public TemplateRole role() { + return role; + } + + /** + * Gets the committed. + * + * Committed status of the template version. If committed is set to true, then the template version can no longer be + * updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java new file mode 100644 index 00000000000..59ccb4b908a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java @@ -0,0 +1,312 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createV2Policy options. + */ +public class CreateV2PolicyOptions extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + protected Control control; + protected String type; + protected String description; + protected V2PolicySubject subject; + protected V2PolicyResource resource; + protected String pattern; + protected V2PolicyRule rule; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private Control control; + private String type; + private String description; + private V2PolicySubject subject; + private V2PolicyResource resource; + private String pattern; + private V2PolicyRule rule; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateV2PolicyOptions instance. + * + * @param createV2PolicyOptions the instance to initialize the Builder with + */ + private Builder(CreateV2PolicyOptions createV2PolicyOptions) { + this.control = createV2PolicyOptions.control; + this.type = createV2PolicyOptions.type; + this.description = createV2PolicyOptions.description; + this.subject = createV2PolicyOptions.subject; + this.resource = createV2PolicyOptions.resource; + this.pattern = createV2PolicyOptions.pattern; + this.rule = createV2PolicyOptions.rule; + this.acceptLanguage = createV2PolicyOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param control the control + * @param type the type + */ + public Builder(Control control, String type) { + this.control = control; + this.type = type; + } + + /** + * Builds a CreateV2PolicyOptions. + * + * @return the new CreateV2PolicyOptions instance + */ + public CreateV2PolicyOptions build() { + return new CreateV2PolicyOptions(this); + } + + /** + * Set the control. + * + * @param control the control + * @return the CreateV2PolicyOptions builder + */ + public Builder control(Control control) { + this.control = control; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the CreateV2PolicyOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateV2PolicyOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the subject. + * + * @param subject the subject + * @return the CreateV2PolicyOptions builder + */ + public Builder subject(V2PolicySubject subject) { + this.subject = subject; + return this; + } + + /** + * Set the resource. + * + * @param resource the resource + * @return the CreateV2PolicyOptions builder + */ + public Builder resource(V2PolicyResource resource) { + this.resource = resource; + return this; + } + + /** + * Set the pattern. + * + * @param pattern the pattern + * @return the CreateV2PolicyOptions builder + */ + public Builder pattern(String pattern) { + this.pattern = pattern; + return this; + } + + /** + * Set the rule. + * + * @param rule the rule + * @return the CreateV2PolicyOptions builder + */ + public Builder rule(V2PolicyRule rule) { + this.rule = rule; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateV2PolicyOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateV2PolicyOptions() { } + + protected CreateV2PolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.control, + "control cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + control = builder.control; + type = builder.type; + description = builder.description; + subject = builder.subject; + resource = builder.resource; + pattern = builder.pattern; + rule = builder.rule; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateV2PolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the control. + * + * Specifies the type of access that is granted by the policy. + * + * @return the control + */ + public Control control() { + return control; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject subject() { + return subject; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource resource() { + return resource; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String pattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule rule() { + return rule; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java new file mode 100644 index 00000000000..f5e35c13d9f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java @@ -0,0 +1,195 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * An additional set of properties associated with a role. + */ +public class CustomRole extends GenericModel { + + protected String id; + @SerializedName("display_name") + protected String displayName; + protected String description; + protected List actions; + protected String crn; + protected String name; + @SerializedName("account_id") + protected String accountId; + @SerializedName("service_name") + protected String serviceName; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String href; + + protected CustomRole() { } + + /** + * Gets the id. + * + * The role ID. Composed of hexadecimal characters. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String getDisplayName() { + return displayName; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List getActions() { + return actions; + } + + /** + * Gets the crn. + * + * The role Cloud Resource Name (CRN). Example CRN: + * 'crn:v1:ibmcloud:public:iam-access-management::a/exampleAccountId::customRole:ExampleRoleName'. + * + * @return the crn + */ + public String getCrn() { + return crn; + } + + /** + * Gets the name. + * + * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the accountId. + * + * The account GUID. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the serviceName. + * + * The service name. + * + * @return the serviceName + */ + public String getServiceName() { + return serviceName; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the role was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the role. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the role was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the href. + * + * The href links back to the role. + * + * @return the href + */ + public String getHref() { + return href; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java new file mode 100644 index 00000000000..f71d2c2ab9d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteActionControlAssignment options. + */ +public class DeleteActionControlAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing DeleteActionControlAssignmentOptions instance. + * + * @param deleteActionControlAssignmentOptions the instance to initialize the Builder with + */ + private Builder(DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptions) { + this.assignmentId = deleteActionControlAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a DeleteActionControlAssignmentOptions. + * + * @return the new DeleteActionControlAssignmentOptions instance + */ + public DeleteActionControlAssignmentOptions build() { + return new DeleteActionControlAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the DeleteActionControlAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected DeleteActionControlAssignmentOptions() { } + + protected DeleteActionControlAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a DeleteActionControlAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Action control template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java new file mode 100644 index 00000000000..6ff35d83603 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteActionControlTemplate options. + */ +public class DeleteActionControlTemplateOptions extends GenericModel { + + protected String actionControlTemplateId; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + + /** + * Instantiates a new Builder from an existing DeleteActionControlTemplateOptions instance. + * + * @param deleteActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(DeleteActionControlTemplateOptions deleteActionControlTemplateOptions) { + this.actionControlTemplateId = deleteActionControlTemplateOptions.actionControlTemplateId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + */ + public Builder(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + } + + /** + * Builds a DeleteActionControlTemplateOptions. + * + * @return the new DeleteActionControlTemplateOptions instance + */ + public DeleteActionControlTemplateOptions build() { + return new DeleteActionControlTemplateOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the DeleteActionControlTemplateOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + } + + protected DeleteActionControlTemplateOptions() { } + + protected DeleteActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + } + + /** + * New builder. + * + * @return a DeleteActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java new file mode 100644 index 00000000000..69aca0555a1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteActionControlTemplateVersion options. + */ +public class DeleteActionControlTemplateVersionOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing DeleteActionControlTemplateVersionOptions instance. + * + * @param deleteActionControlTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptions) { + this.actionControlTemplateId = deleteActionControlTemplateVersionOptions.actionControlTemplateId; + this.version = deleteActionControlTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + * @param version the version + */ + public Builder(String actionControlTemplateId, String version) { + this.actionControlTemplateId = actionControlTemplateId; + this.version = version; + } + + /** + * Builds a DeleteActionControlTemplateVersionOptions. + * + * @return the new DeleteActionControlTemplateVersionOptions instance + */ + public DeleteActionControlTemplateVersionOptions build() { + return new DeleteActionControlTemplateVersionOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the DeleteActionControlTemplateVersionOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the DeleteActionControlTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected DeleteActionControlTemplateVersionOptions() { } + + protected DeleteActionControlTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a DeleteActionControlTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java new file mode 100644 index 00000000000..3ab2cf17469 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deletePolicyAssignment options. + */ +public class DeletePolicyAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing DeletePolicyAssignmentOptions instance. + * + * @param deletePolicyAssignmentOptions the instance to initialize the Builder with + */ + private Builder(DeletePolicyAssignmentOptions deletePolicyAssignmentOptions) { + this.assignmentId = deletePolicyAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a DeletePolicyAssignmentOptions. + * + * @return the new DeletePolicyAssignmentOptions instance + */ + public DeletePolicyAssignmentOptions build() { + return new DeletePolicyAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the DeletePolicyAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected DeletePolicyAssignmentOptions() { } + + protected DeletePolicyAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a DeletePolicyAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * The policy template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java new file mode 100644 index 00000000000..fe070b2064a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deletePolicy options. + */ +public class DeletePolicyOptions extends GenericModel { + + protected String policyId; + + /** + * Builder. + */ + public static class Builder { + private String policyId; + + /** + * Instantiates a new Builder from an existing DeletePolicyOptions instance. + * + * @param deletePolicyOptions the instance to initialize the Builder with + */ + private Builder(DeletePolicyOptions deletePolicyOptions) { + this.policyId = deletePolicyOptions.policyId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyId the policyId + */ + public Builder(String policyId) { + this.policyId = policyId; + } + + /** + * Builds a DeletePolicyOptions. + * + * @return the new DeletePolicyOptions instance + */ + public DeletePolicyOptions build() { + return new DeletePolicyOptions(this); + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the DeletePolicyOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + } + + protected DeletePolicyOptions() { } + + protected DeletePolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId cannot be empty"); + policyId = builder.policyId; + } + + /** + * New builder. + * + * @return a DeletePolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyId. + * + * The policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java new file mode 100644 index 00000000000..bb70b0d6727 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deletePolicyTemplate options. + */ +public class DeletePolicyTemplateOptions extends GenericModel { + + protected String policyTemplateId; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + + /** + * Instantiates a new Builder from an existing DeletePolicyTemplateOptions instance. + * + * @param deletePolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(DeletePolicyTemplateOptions deletePolicyTemplateOptions) { + this.policyTemplateId = deletePolicyTemplateOptions.policyTemplateId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + */ + public Builder(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + } + + /** + * Builds a DeletePolicyTemplateOptions. + * + * @return the new DeletePolicyTemplateOptions instance + */ + public DeletePolicyTemplateOptions build() { + return new DeletePolicyTemplateOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the DeletePolicyTemplateOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + } + + protected DeletePolicyTemplateOptions() { } + + protected DeletePolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + policyTemplateId = builder.policyTemplateId; + } + + /** + * New builder. + * + * @return a DeletePolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java new file mode 100644 index 00000000000..9a04a5157b6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deletePolicyTemplateVersion options. + */ +public class DeletePolicyTemplateVersionOptions extends GenericModel { + + protected String policyTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing DeletePolicyTemplateVersionOptions instance. + * + * @param deletePolicyTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptions) { + this.policyTemplateId = deletePolicyTemplateVersionOptions.policyTemplateId; + this.version = deletePolicyTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param version the version + */ + public Builder(String policyTemplateId, String version) { + this.policyTemplateId = policyTemplateId; + this.version = version; + } + + /** + * Builds a DeletePolicyTemplateVersionOptions. + * + * @return the new DeletePolicyTemplateVersionOptions instance + */ + public DeletePolicyTemplateVersionOptions build() { + return new DeletePolicyTemplateVersionOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the DeletePolicyTemplateVersionOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the DeletePolicyTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected DeletePolicyTemplateVersionOptions() { } + + protected DeletePolicyTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + policyTemplateId = builder.policyTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a DeletePolicyTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the version. + * + * The policy template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java new file mode 100644 index 00000000000..b9341a9f414 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteRoleAssignment options. + */ +public class DeleteRoleAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing DeleteRoleAssignmentOptions instance. + * + * @param deleteRoleAssignmentOptions the instance to initialize the Builder with + */ + private Builder(DeleteRoleAssignmentOptions deleteRoleAssignmentOptions) { + this.assignmentId = deleteRoleAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a DeleteRoleAssignmentOptions. + * + * @return the new DeleteRoleAssignmentOptions instance + */ + public DeleteRoleAssignmentOptions build() { + return new DeleteRoleAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the DeleteRoleAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected DeleteRoleAssignmentOptions() { } + + protected DeleteRoleAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a DeleteRoleAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Role template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java new file mode 100644 index 00000000000..8675777719e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteRole options. + */ +public class DeleteRoleOptions extends GenericModel { + + protected String roleId; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + + /** + * Instantiates a new Builder from an existing DeleteRoleOptions instance. + * + * @param deleteRoleOptions the instance to initialize the Builder with + */ + private Builder(DeleteRoleOptions deleteRoleOptions) { + this.roleId = deleteRoleOptions.roleId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + */ + public Builder(String roleId) { + this.roleId = roleId; + } + + /** + * Builds a DeleteRoleOptions. + * + * @return the new DeleteRoleOptions instance + */ + public DeleteRoleOptions build() { + return new DeleteRoleOptions(this); + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the DeleteRoleOptions builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + } + + protected DeleteRoleOptions() { } + + protected DeleteRoleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, + "roleId cannot be empty"); + roleId = builder.roleId; + } + + /** + * New builder. + * + * @return a DeleteRoleOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role ID. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java new file mode 100644 index 00000000000..c76bf3bfda4 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteRoleTemplate options. + */ +public class DeleteRoleTemplateOptions extends GenericModel { + + protected String roleTemplateId; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + + /** + * Instantiates a new Builder from an existing DeleteRoleTemplateOptions instance. + * + * @param deleteRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(DeleteRoleTemplateOptions deleteRoleTemplateOptions) { + this.roleTemplateId = deleteRoleTemplateOptions.roleTemplateId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + */ + public Builder(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + } + + /** + * Builds a DeleteRoleTemplateOptions. + * + * @return the new DeleteRoleTemplateOptions instance + */ + public DeleteRoleTemplateOptions build() { + return new DeleteRoleTemplateOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the DeleteRoleTemplateOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + } + + protected DeleteRoleTemplateOptions() { } + + protected DeleteRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + roleTemplateId = builder.roleTemplateId; + } + + /** + * New builder. + * + * @return a DeleteRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java new file mode 100644 index 00000000000..9f974213165 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteRoleTemplateVersion options. + */ +public class DeleteRoleTemplateVersionOptions extends GenericModel { + + protected String roleTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing DeleteRoleTemplateVersionOptions instance. + * + * @param deleteRoleTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptions) { + this.roleTemplateId = deleteRoleTemplateVersionOptions.roleTemplateId; + this.version = deleteRoleTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + * @param version the version + */ + public Builder(String roleTemplateId, String version) { + this.roleTemplateId = roleTemplateId; + this.version = version; + } + + /** + * Builds a DeleteRoleTemplateVersionOptions. + * + * @return the new DeleteRoleTemplateVersionOptions instance + */ + public DeleteRoleTemplateVersionOptions build() { + return new DeleteRoleTemplateVersionOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the DeleteRoleTemplateVersionOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the DeleteRoleTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected DeleteRoleTemplateVersionOptions() { } + + protected DeleteRoleTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + roleTemplateId = builder.roleTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a DeleteRoleTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the version. + * + * Role template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java new file mode 100644 index 00000000000..92c1caaa34c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteV2Policy options. + */ +public class DeleteV2PolicyOptions extends GenericModel { + + protected String id; + + /** + * Builder. + */ + public static class Builder { + private String id; + + /** + * Instantiates a new Builder from an existing DeleteV2PolicyOptions instance. + * + * @param deleteV2PolicyOptions the instance to initialize the Builder with + */ + private Builder(DeleteV2PolicyOptions deleteV2PolicyOptions) { + this.id = deleteV2PolicyOptions.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 DeleteV2PolicyOptions. + * + * @return the new DeleteV2PolicyOptions instance + */ + public DeleteV2PolicyOptions build() { + return new DeleteV2PolicyOptions(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the DeleteV2PolicyOptions builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + } + + protected DeleteV2PolicyOptions() { } + + protected DeleteV2PolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, + "id cannot be empty"); + id = builder.id; + } + + /** + * New builder. + * + * @return a DeleteV2PolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String id() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java new file mode 100644 index 00000000000..0978eb1040b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java @@ -0,0 +1,81 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role associated with a policy with additional information (display_name, description, actions) when + * `format=display`. + */ +public class EnrichedRoles extends GenericModel { + + @SerializedName("role_id") + protected String roleId; + @SerializedName("display_name") + protected String displayName; + protected String description; + protected List actions; + + protected EnrichedRoles() { } + + /** + * Gets the roleId. + * + * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. + * + * @return the roleId + */ + public String getRoleId() { + return roleId; + } + + /** + * Gets the displayName. + * + * The display name of the role, either service-defined or user-defined for custom roles. + * + * @return the displayName + */ + public String getDisplayName() { + return displayName; + } + + /** + * Gets the description. + * + * The role description, either service-defined or user-defined for custom roles. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List getActions() { + return actions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java new file mode 100644 index 00000000000..e99ea48f5f6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Additional error details. + */ +public class ErrorDetails extends GenericModel { + + @SerializedName("conflicts_with") + protected ConflictsWith conflictsWith; + + protected ErrorDetails() { } + + /** + * Gets the conflictsWith. + * + * Details of conflicting resource. + * + * @return the conflictsWith + */ + public ConflictsWith getConflictsWith() { + return conflictsWith; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java new file mode 100644 index 00000000000..b5411a7bb36 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java @@ -0,0 +1,128 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * ErrorObject. + */ +public class ErrorObject extends GenericModel { + + /** + * The API error code for the error. + */ + public interface Code { + /** insufficent_permissions. */ + String INSUFFICENT_PERMISSIONS = "insufficent_permissions"; + /** invalid_body. */ + String INVALID_BODY = "invalid_body"; + /** invalid_token. */ + String INVALID_TOKEN = "invalid_token"; + /** missing_required_query_parameter. */ + String MISSING_REQUIRED_QUERY_PARAMETER = "missing_required_query_parameter"; + /** not_found. */ + String NOT_FOUND = "not_found"; + /** policy_conflict_error. */ + String POLICY_CONFLICT_ERROR = "policy_conflict_error"; + /** policy_not_found. */ + String POLICY_NOT_FOUND = "policy_not_found"; + /** request_not_processed. */ + String REQUEST_NOT_PROCESSED = "request_not_processed"; + /** role_conflict_error. */ + String ROLE_CONFLICT_ERROR = "role_conflict_error"; + /** role_not_found. */ + String ROLE_NOT_FOUND = "role_not_found"; + /** too_many_requests. */ + String TOO_MANY_REQUESTS = "too_many_requests"; + /** unable_to_process. */ + String UNABLE_TO_PROCESS = "unable_to_process"; + /** unsupported_content_type. */ + String UNSUPPORTED_CONTENT_TYPE = "unsupported_content_type"; + /** policy_template_conflict_error. */ + String POLICY_TEMPLATE_CONFLICT_ERROR = "policy_template_conflict_error"; + /** policy_template_not_found. */ + String POLICY_TEMPLATE_NOT_FOUND = "policy_template_not_found"; + /** policy_assignment_not_found. */ + String POLICY_ASSIGNMENT_NOT_FOUND = "policy_assignment_not_found"; + /** policy_assignment_conflict_error. */ + String POLICY_ASSIGNMENT_CONFLICT_ERROR = "policy_assignment_conflict_error"; + /** resource_not_found. */ + String RESOURCE_NOT_FOUND = "resource_not_found"; + /** action_control_template_not_found. */ + String ACTION_CONTROL_TEMPLATE_NOT_FOUND = "action_control_template_not_found"; + /** action_control_assignment_not_found. */ + String ACTION_CONTROL_ASSIGNMENT_NOT_FOUND = "action_control_assignment_not_found"; + /** role_template_conflict_error. */ + String ROLE_TEMPLATE_CONFLICT_ERROR = "role_template_conflict_error"; + /** role_template_not_found. */ + String ROLE_TEMPLATE_NOT_FOUND = "role_template_not_found"; + /** role_assignment_not_found. */ + String ROLE_ASSIGNMENT_NOT_FOUND = "role_assignment_not_found"; + } + + protected String code; + protected String message; + protected ErrorDetails details; + @SerializedName("more_info") + protected String moreInfo; + + protected ErrorObject() { } + + /** + * Gets the code. + * + * The API error code for the error. + * + * @return the code + */ + public String getCode() { + return code; + } + + /** + * Gets the message. + * + * The error message returned by the API. + * + * @return the message + */ + public String getMessage() { + return message; + } + + /** + * Gets the details. + * + * Additional error details. + * + * @return the details + */ + public ErrorDetails getDetails() { + return details; + } + + /** + * Gets the moreInfo. + * + * Additional info for error. + * + * @return the moreInfo + */ + public String getMoreInfo() { + return moreInfo; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java new file mode 100644 index 00000000000..5c1c9a9fad6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * How external accounts can interact in relation to the requested account. + */ +public class ExternalAccountIdentityInteraction extends GenericModel { + + @SerializedName("identity_types") + protected IdentityTypes identityTypes; + + protected ExternalAccountIdentityInteraction() { } + + /** + * Gets the identityTypes. + * + * The settings for each identity type. + * + * @return the identityTypes + */ + public IdentityTypes getIdentityTypes() { + return identityTypes; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java new file mode 100644 index 00000000000..1efd0673e9d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java @@ -0,0 +1,95 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Update to how external accounts can interact in relation to the requested account. + */ +public class ExternalAccountIdentityInteractionPatch extends GenericModel { + + @SerializedName("identity_types") + protected IdentityTypesPatch identityTypes; + + /** + * Builder. + */ + public static class Builder { + private IdentityTypesPatch identityTypes; + + /** + * Instantiates a new Builder from an existing ExternalAccountIdentityInteractionPatch instance. + * + * @param externalAccountIdentityInteractionPatch the instance to initialize the Builder with + */ + private Builder(ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatch) { + this.identityTypes = externalAccountIdentityInteractionPatch.identityTypes; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ExternalAccountIdentityInteractionPatch. + * + * @return the new ExternalAccountIdentityInteractionPatch instance + */ + public ExternalAccountIdentityInteractionPatch build() { + return new ExternalAccountIdentityInteractionPatch(this); + } + + /** + * Set the identityTypes. + * + * @param identityTypes the identityTypes + * @return the ExternalAccountIdentityInteractionPatch builder + */ + public Builder identityTypes(IdentityTypesPatch identityTypes) { + this.identityTypes = identityTypes; + return this; + } + } + + protected ExternalAccountIdentityInteractionPatch() { } + + protected ExternalAccountIdentityInteractionPatch(Builder builder) { + identityTypes = builder.identityTypes; + } + + /** + * New builder. + * + * @return a ExternalAccountIdentityInteractionPatch builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the identityTypes. + * + * The settings to apply for each identity type for a request. + * + * @return the identityTypes + */ + public IdentityTypesPatch identityTypes() { + return identityTypes; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java new file mode 100644 index 00000000000..83cd67d33c9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Details with linking href to first page of requested collection. + */ +public class First extends GenericModel { + + protected String href; + + protected First() { } + + /** + * Gets the href. + * + * The href linking to the page of requested collection. + * + * @return the href + */ + public String getHref() { + return href; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java new file mode 100644 index 00000000000..f87e7d741a4 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getActionControlAssignment options. + */ +public class GetActionControlAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing GetActionControlAssignmentOptions instance. + * + * @param getActionControlAssignmentOptions the instance to initialize the Builder with + */ + private Builder(GetActionControlAssignmentOptions getActionControlAssignmentOptions) { + this.assignmentId = getActionControlAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a GetActionControlAssignmentOptions. + * + * @return the new GetActionControlAssignmentOptions instance + */ + public GetActionControlAssignmentOptions build() { + return new GetActionControlAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the GetActionControlAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected GetActionControlAssignmentOptions() { } + + protected GetActionControlAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a GetActionControlAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Action control template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java new file mode 100644 index 00000000000..963c68e8876 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java @@ -0,0 +1,140 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getActionControlTemplate options. + */ +public class GetActionControlTemplateOptions extends GenericModel { + + /** + * The action control template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String actionControlTemplateId; + protected String state; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String state; + + /** + * Instantiates a new Builder from an existing GetActionControlTemplateOptions instance. + * + * @param getActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(GetActionControlTemplateOptions getActionControlTemplateOptions) { + this.actionControlTemplateId = getActionControlTemplateOptions.actionControlTemplateId; + this.state = getActionControlTemplateOptions.state; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + */ + public Builder(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + } + + /** + * Builds a GetActionControlTemplateOptions. + * + * @return the new GetActionControlTemplateOptions instance + */ + public GetActionControlTemplateOptions build() { + return new GetActionControlTemplateOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the GetActionControlTemplateOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the GetActionControlTemplateOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + } + + protected GetActionControlTemplateOptions() { } + + protected GetActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + state = builder.state; + } + + /** + * New builder. + * + * @return a GetActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the state. + * + * The action control template state. + * + * @return the state + */ + public String state() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java new file mode 100644 index 00000000000..95bc94950bb --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getActionControlTemplateVersion options. + */ +public class GetActionControlTemplateVersionOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing GetActionControlTemplateVersionOptions instance. + * + * @param getActionControlTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptions) { + this.actionControlTemplateId = getActionControlTemplateVersionOptions.actionControlTemplateId; + this.version = getActionControlTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + * @param version the version + */ + public Builder(String actionControlTemplateId, String version) { + this.actionControlTemplateId = actionControlTemplateId; + this.version = version; + } + + /** + * Builds a GetActionControlTemplateVersionOptions. + * + * @return the new GetActionControlTemplateVersionOptions instance + */ + public GetActionControlTemplateVersionOptions build() { + return new GetActionControlTemplateVersionOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the GetActionControlTemplateVersionOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the GetActionControlTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected GetActionControlTemplateVersionOptions() { } + + protected GetActionControlTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a GetActionControlTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java new file mode 100644 index 00000000000..d1c7c359003 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getPolicyAssignment options. + */ +public class GetPolicyAssignmentOptions extends GenericModel { + + protected String assignmentId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + private String version; + + /** + * Instantiates a new Builder from an existing GetPolicyAssignmentOptions instance. + * + * @param getPolicyAssignmentOptions the instance to initialize the Builder with + */ + private Builder(GetPolicyAssignmentOptions getPolicyAssignmentOptions) { + this.assignmentId = getPolicyAssignmentOptions.assignmentId; + this.version = getPolicyAssignmentOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + * @param version the version + */ + public Builder(String assignmentId, String version) { + this.assignmentId = assignmentId; + this.version = version; + } + + /** + * Builds a GetPolicyAssignmentOptions. + * + * @return the new GetPolicyAssignmentOptions instance + */ + public GetPolicyAssignmentOptions build() { + return new GetPolicyAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the GetPolicyAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the GetPolicyAssignmentOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected GetPolicyAssignmentOptions() { } + + protected GetPolicyAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + assignmentId = builder.assignmentId; + version = builder.version; + } + + /** + * New builder. + * + * @return a GetPolicyAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * The policy template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } + + /** + * Gets the version. + * + * specify version of response body format. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java new file mode 100644 index 00000000000..e780ac06896 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getPolicy options. + */ +public class GetPolicyOptions extends GenericModel { + + protected String policyId; + + /** + * Builder. + */ + public static class Builder { + private String policyId; + + /** + * Instantiates a new Builder from an existing GetPolicyOptions instance. + * + * @param getPolicyOptions the instance to initialize the Builder with + */ + private Builder(GetPolicyOptions getPolicyOptions) { + this.policyId = getPolicyOptions.policyId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyId the policyId + */ + public Builder(String policyId) { + this.policyId = policyId; + } + + /** + * Builds a GetPolicyOptions. + * + * @return the new GetPolicyOptions instance + */ + public GetPolicyOptions build() { + return new GetPolicyOptions(this); + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the GetPolicyOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + } + + protected GetPolicyOptions() { } + + protected GetPolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId cannot be empty"); + policyId = builder.policyId; + } + + /** + * New builder. + * + * @return a GetPolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyId. + * + * The policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java new file mode 100644 index 00000000000..ee604554a85 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java @@ -0,0 +1,140 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getPolicyTemplate options. + */ +public class GetPolicyTemplateOptions extends GenericModel { + + /** + * The policy template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String policyTemplateId; + protected String state; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String state; + + /** + * Instantiates a new Builder from an existing GetPolicyTemplateOptions instance. + * + * @param getPolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(GetPolicyTemplateOptions getPolicyTemplateOptions) { + this.policyTemplateId = getPolicyTemplateOptions.policyTemplateId; + this.state = getPolicyTemplateOptions.state; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + */ + public Builder(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + } + + /** + * Builds a GetPolicyTemplateOptions. + * + * @return the new GetPolicyTemplateOptions instance + */ + public GetPolicyTemplateOptions build() { + return new GetPolicyTemplateOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the GetPolicyTemplateOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the GetPolicyTemplateOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + } + + protected GetPolicyTemplateOptions() { } + + protected GetPolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + policyTemplateId = builder.policyTemplateId; + state = builder.state; + } + + /** + * New builder. + * + * @return a GetPolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the state. + * + * The policy template state. + * + * @return the state + */ + public String state() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java new file mode 100644 index 00000000000..8741f83357d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getPolicyTemplateVersion options. + */ +public class GetPolicyTemplateVersionOptions extends GenericModel { + + protected String policyTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing GetPolicyTemplateVersionOptions instance. + * + * @param getPolicyTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptions) { + this.policyTemplateId = getPolicyTemplateVersionOptions.policyTemplateId; + this.version = getPolicyTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param version the version + */ + public Builder(String policyTemplateId, String version) { + this.policyTemplateId = policyTemplateId; + this.version = version; + } + + /** + * Builds a GetPolicyTemplateVersionOptions. + * + * @return the new GetPolicyTemplateVersionOptions instance + */ + public GetPolicyTemplateVersionOptions build() { + return new GetPolicyTemplateVersionOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the GetPolicyTemplateVersionOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the GetPolicyTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected GetPolicyTemplateVersionOptions() { } + + protected GetPolicyTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + policyTemplateId = builder.policyTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a GetPolicyTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the version. + * + * The policy template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java new file mode 100644 index 00000000000..35313b9b746 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getRoleAssignment options. + */ +public class GetRoleAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing GetRoleAssignmentOptions instance. + * + * @param getRoleAssignmentOptions the instance to initialize the Builder with + */ + private Builder(GetRoleAssignmentOptions getRoleAssignmentOptions) { + this.assignmentId = getRoleAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a GetRoleAssignmentOptions. + * + * @return the new GetRoleAssignmentOptions instance + */ + public GetRoleAssignmentOptions build() { + return new GetRoleAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the GetRoleAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected GetRoleAssignmentOptions() { } + + protected GetRoleAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a GetRoleAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Role template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java new file mode 100644 index 00000000000..8c56ac7f58a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getRole options. + */ +public class GetRoleOptions extends GenericModel { + + protected String roleId; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + + /** + * Instantiates a new Builder from an existing GetRoleOptions instance. + * + * @param getRoleOptions the instance to initialize the Builder with + */ + private Builder(GetRoleOptions getRoleOptions) { + this.roleId = getRoleOptions.roleId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + */ + public Builder(String roleId) { + this.roleId = roleId; + } + + /** + * Builds a GetRoleOptions. + * + * @return the new GetRoleOptions instance + */ + public GetRoleOptions build() { + return new GetRoleOptions(this); + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the GetRoleOptions builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + } + + protected GetRoleOptions() { } + + protected GetRoleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, + "roleId cannot be empty"); + roleId = builder.roleId; + } + + /** + * New builder. + * + * @return a GetRoleOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role ID. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java new file mode 100644 index 00000000000..e33fcf29b32 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java @@ -0,0 +1,140 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getRoleTemplate options. + */ +public class GetRoleTemplateOptions extends GenericModel { + + /** + * The role template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String roleTemplateId; + protected String state; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String state; + + /** + * Instantiates a new Builder from an existing GetRoleTemplateOptions instance. + * + * @param getRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(GetRoleTemplateOptions getRoleTemplateOptions) { + this.roleTemplateId = getRoleTemplateOptions.roleTemplateId; + this.state = getRoleTemplateOptions.state; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + */ + public Builder(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + } + + /** + * Builds a GetRoleTemplateOptions. + * + * @return the new GetRoleTemplateOptions instance + */ + public GetRoleTemplateOptions build() { + return new GetRoleTemplateOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the GetRoleTemplateOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the GetRoleTemplateOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + } + + protected GetRoleTemplateOptions() { } + + protected GetRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + roleTemplateId = builder.roleTemplateId; + state = builder.state; + } + + /** + * New builder. + * + * @return a GetRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the state. + * + * The role template state. + * + * @return the state + */ + public String state() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java new file mode 100644 index 00000000000..4757484f969 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getRoleTemplateVersion options. + */ +public class GetRoleTemplateVersionOptions extends GenericModel { + + protected String roleTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing GetRoleTemplateVersionOptions instance. + * + * @param getRoleTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(GetRoleTemplateVersionOptions getRoleTemplateVersionOptions) { + this.roleTemplateId = getRoleTemplateVersionOptions.roleTemplateId; + this.version = getRoleTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + * @param version the version + */ + public Builder(String roleTemplateId, String version) { + this.roleTemplateId = roleTemplateId; + this.version = version; + } + + /** + * Builds a GetRoleTemplateVersionOptions. + * + * @return the new GetRoleTemplateVersionOptions instance + */ + public GetRoleTemplateVersionOptions build() { + return new GetRoleTemplateVersionOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the GetRoleTemplateVersionOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the GetRoleTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected GetRoleTemplateVersionOptions() { } + + protected GetRoleTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + roleTemplateId = builder.roleTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a GetRoleTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the version. + * + * Role template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java new file mode 100644 index 00000000000..ebc88bbf45c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getSettings options. + */ +public class GetSettingsOptions extends GenericModel { + + protected String accountId; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing GetSettingsOptions instance. + * + * @param getSettingsOptions the instance to initialize the Builder with + */ + private Builder(GetSettingsOptions getSettingsOptions) { + this.accountId = getSettingsOptions.accountId; + this.acceptLanguage = getSettingsOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a GetSettingsOptions. + * + * @return the new GetSettingsOptions instance + */ + public GetSettingsOptions build() { + return new GetSettingsOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the GetSettingsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the GetSettingsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected GetSettingsOptions() { } + + protected GetSettingsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.accountId, + "accountId cannot be empty"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a GetSettingsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the settings belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java new file mode 100644 index 00000000000..23a950cc815 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java @@ -0,0 +1,148 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getV2Policy options. + */ +public class GetV2PolicyOptions extends GenericModel { + + /** + * Include additional data for policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles and translations for all + * relevant fields. + */ + public interface Format { + /** include_last_permit. */ + String INCLUDE_LAST_PERMIT = "include_last_permit"; + /** display. */ + String DISPLAY = "display"; + } + + protected String id; + protected String format; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String format; + + /** + * Instantiates a new Builder from an existing GetV2PolicyOptions instance. + * + * @param getV2PolicyOptions the instance to initialize the Builder with + */ + private Builder(GetV2PolicyOptions getV2PolicyOptions) { + this.id = getV2PolicyOptions.id; + this.format = getV2PolicyOptions.format; + } + + /** + * 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 GetV2PolicyOptions. + * + * @return the new GetV2PolicyOptions instance + */ + public GetV2PolicyOptions build() { + return new GetV2PolicyOptions(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the GetV2PolicyOptions builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the format. + * + * @param format the format + * @return the GetV2PolicyOptions builder + */ + public Builder format(String format) { + this.format = format; + return this; + } + } + + protected GetV2PolicyOptions() { } + + protected GetV2PolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, + "id cannot be empty"); + id = builder.id; + format = builder.format; + } + + /** + * New builder. + * + * @return a GetV2PolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the format. + * + * Include additional data for policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles and translations for all + * relevant fields. + * + * @return the format + */ + public String format() { + return format; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java new file mode 100644 index 00000000000..d8439c9d6f7 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java @@ -0,0 +1,124 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Permission is granted by the policy. + */ +public class Grant extends GenericModel { + + protected List roles; + + /** + * Builder. + */ + public static class Builder { + private List roles; + + /** + * Instantiates a new Builder from an existing Grant instance. + * + * @param grant the instance to initialize the Builder with + */ + private Builder(Grant grant) { + this.roles = grant.roles; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roles the roles + */ + public Builder(List roles) { + this.roles = roles; + } + + /** + * Builds a Grant. + * + * @return the new Grant instance + */ + public Grant build() { + return new Grant(this); + } + + /** + * Adds a new element to roles. + * + * @param roles the new element to be added + * @return the Grant builder + */ + public Builder addRoles(Roles roles) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roles, + "roles cannot be null"); + if (this.roles == null) { + this.roles = new ArrayList(); + } + this.roles.add(roles); + return this; + } + + /** + * Set the roles. + * Existing roles will be replaced. + * + * @param roles the roles + * @return the Grant builder + */ + public Builder roles(List roles) { + this.roles = roles; + return this; + } + } + + protected Grant() { } + + protected Grant(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, + "roles cannot be null"); + roles = builder.roles; + } + + /** + * New builder. + * + * @return a Grant builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List roles() { + return roles; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java new file mode 100644 index 00000000000..1dbc53fefb6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Permission granted by the policy with translated roles and additional role information. + */ +public class GrantWithEnrichedRoles extends GenericModel { + + protected List roles; + + protected GrantWithEnrichedRoles() { } + + /** + * Gets the roles. + * + * A set of roles granted by the policy. + * + * @return the roles + */ + public List getRoles() { + return roles; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java new file mode 100644 index 00000000000..0ac71d8192b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java @@ -0,0 +1,64 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The settings for each identity type. + */ +public class IdentityTypes extends GenericModel { + + protected IdentityTypesBase user; + @SerializedName("service_id") + protected IdentityTypesBase serviceId; + protected IdentityTypesBase service; + + protected IdentityTypes() { } + + /** + * Gets the user. + * + * The core set of properties associated with an identity type. + * + * @return the user + */ + public IdentityTypesBase getUser() { + return user; + } + + /** + * Gets the serviceId. + * + * The core set of properties associated with an identity type. + * + * @return the serviceId + */ + public IdentityTypesBase getServiceId() { + return serviceId; + } + + /** + * Gets the service. + * + * The core set of properties associated with an identity type. + * + * @return the service + */ + public IdentityTypesBase getService() { + return service; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java new file mode 100644 index 00000000000..e8df91a1e5d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java @@ -0,0 +1,168 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with an identity type. + */ +public class IdentityTypesBase extends GenericModel { + + /** + * The state of the identity type. + */ + public interface State { + /** enabled. */ + String ENABLED = "enabled"; + /** monitor. */ + String MONITOR = "monitor"; + /** limited. */ + String LIMITED = "limited"; + } + + protected String state; + @SerializedName("external_allowed_accounts") + protected List externalAllowedAccounts; + + /** + * Builder. + */ + public static class Builder { + private String state; + private List externalAllowedAccounts; + + /** + * Instantiates a new Builder from an existing IdentityTypesBase instance. + * + * @param identityTypesBase the instance to initialize the Builder with + */ + private Builder(IdentityTypesBase identityTypesBase) { + this.state = identityTypesBase.state; + this.externalAllowedAccounts = identityTypesBase.externalAllowedAccounts; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param state the state + * @param externalAllowedAccounts the externalAllowedAccounts + */ + public Builder(String state, List externalAllowedAccounts) { + this.state = state; + this.externalAllowedAccounts = externalAllowedAccounts; + } + + /** + * Builds a IdentityTypesBase. + * + * @return the new IdentityTypesBase instance + */ + public IdentityTypesBase build() { + return new IdentityTypesBase(this); + } + + /** + * Adds a new element to externalAllowedAccounts. + * + * @param externalAllowedAccounts the new element to be added + * @return the IdentityTypesBase builder + */ + public Builder addExternalAllowedAccounts(String externalAllowedAccounts) { + com.ibm.cloud.sdk.core.util.Validator.notNull(externalAllowedAccounts, + "externalAllowedAccounts cannot be null"); + if (this.externalAllowedAccounts == null) { + this.externalAllowedAccounts = new ArrayList(); + } + this.externalAllowedAccounts.add(externalAllowedAccounts); + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the IdentityTypesBase builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the externalAllowedAccounts. + * Existing externalAllowedAccounts will be replaced. + * + * @param externalAllowedAccounts the externalAllowedAccounts + * @return the IdentityTypesBase builder + */ + public Builder externalAllowedAccounts(List externalAllowedAccounts) { + this.externalAllowedAccounts = externalAllowedAccounts; + return this; + } + } + + protected IdentityTypesBase() { } + + protected IdentityTypesBase(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.state, + "state cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.externalAllowedAccounts, + "externalAllowedAccounts cannot be null"); + state = builder.state; + externalAllowedAccounts = builder.externalAllowedAccounts; + } + + /** + * New builder. + * + * @return a IdentityTypesBase builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the state. + * + * The state of the identity type. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the externalAllowedAccounts. + * + * List of accounts that the state applies to for a given identity. + * + * @return the externalAllowedAccounts + */ + public List externalAllowedAccounts() { + return externalAllowedAccounts; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java new file mode 100644 index 00000000000..77aa5a26366 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java @@ -0,0 +1,147 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The settings to apply for each identity type for a request. + */ +public class IdentityTypesPatch extends GenericModel { + + protected IdentityTypesBase user; + @SerializedName("service_id") + protected IdentityTypesBase serviceId; + protected IdentityTypesBase service; + + /** + * Builder. + */ + public static class Builder { + private IdentityTypesBase user; + private IdentityTypesBase serviceId; + private IdentityTypesBase service; + + /** + * Instantiates a new Builder from an existing IdentityTypesPatch instance. + * + * @param identityTypesPatch the instance to initialize the Builder with + */ + private Builder(IdentityTypesPatch identityTypesPatch) { + this.user = identityTypesPatch.user; + this.serviceId = identityTypesPatch.serviceId; + this.service = identityTypesPatch.service; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a IdentityTypesPatch. + * + * @return the new IdentityTypesPatch instance + */ + public IdentityTypesPatch build() { + return new IdentityTypesPatch(this); + } + + /** + * Set the user. + * + * @param user the user + * @return the IdentityTypesPatch builder + */ + public Builder user(IdentityTypesBase user) { + this.user = user; + return this; + } + + /** + * Set the serviceId. + * + * @param serviceId the serviceId + * @return the IdentityTypesPatch builder + */ + public Builder serviceId(IdentityTypesBase serviceId) { + this.serviceId = serviceId; + return this; + } + + /** + * Set the service. + * + * @param service the service + * @return the IdentityTypesPatch builder + */ + public Builder service(IdentityTypesBase service) { + this.service = service; + return this; + } + } + + protected IdentityTypesPatch() { } + + protected IdentityTypesPatch(Builder builder) { + user = builder.user; + serviceId = builder.serviceId; + service = builder.service; + } + + /** + * New builder. + * + * @return a IdentityTypesPatch builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the user. + * + * The core set of properties associated with an identity type. + * + * @return the user + */ + public IdentityTypesBase user() { + return user; + } + + /** + * Gets the serviceId. + * + * The core set of properties associated with an identity type. + * + * @return the serviceId + */ + public IdentityTypesBase serviceId() { + return serviceId; + } + + /** + * Gets the service. + * + * The core set of properties associated with an identity type. + * + * @return the service + */ + public IdentityTypesBase service() { + return service; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java new file mode 100644 index 00000000000..5aa0b39573b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * policy template current and limit details with in an account. + */ +public class LimitData extends GenericModel { + + protected Long current; + protected Long limit; + + protected LimitData() { } + + /** + * Gets the current. + * + * policy template current count. + * + * @return the current + */ + public Long getCurrent() { + return current; + } + + /** + * Gets the limit. + * + * policy template limit count. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java new file mode 100644 index 00000000000..6835f5afccc --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java @@ -0,0 +1,245 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listActionControlAssignments options. + */ +public class ListActionControlAssignmentsOptions extends GenericModel { + + protected String accountId; + protected String acceptLanguage; + protected String templateId; + protected String templateVersion; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String templateId; + private String templateVersion; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListActionControlAssignmentsOptions instance. + * + * @param listActionControlAssignmentsOptions the instance to initialize the Builder with + */ + private Builder(ListActionControlAssignmentsOptions listActionControlAssignmentsOptions) { + this.accountId = listActionControlAssignmentsOptions.accountId; + this.acceptLanguage = listActionControlAssignmentsOptions.acceptLanguage; + this.templateId = listActionControlAssignmentsOptions.templateId; + this.templateVersion = listActionControlAssignmentsOptions.templateVersion; + this.limit = listActionControlAssignmentsOptions.limit; + this.start = listActionControlAssignmentsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListActionControlAssignmentsOptions. + * + * @return the new ListActionControlAssignmentsOptions instance + */ + public ListActionControlAssignmentsOptions build() { + return new ListActionControlAssignmentsOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the templateId. + * + * @param templateId the templateId + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder templateId(String templateId) { + this.templateId = templateId; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListActionControlAssignmentsOptions() { } + + protected ListActionControlAssignmentsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + templateId = builder.templateId; + templateVersion = builder.templateVersion; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListActionControlAssignmentsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID in which the action control assignment belongs to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the templateId. + * + * Optional template ID. + * + * @return the templateId + */ + public String templateId() { + return templateId; + } + + /** + * Gets the templateVersion. + * + * Optional action control template version. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java new file mode 100644 index 00000000000..984d1060c83 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listActionControlTemplateVersions options. + */ +public class ListActionControlTemplateVersionsOptions extends GenericModel { + + /** + * Action control template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String actionControlTemplateId; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListActionControlTemplateVersionsOptions instance. + * + * @param listActionControlTemplateVersionsOptions the instance to initialize the Builder with + */ + private Builder(ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions) { + this.actionControlTemplateId = listActionControlTemplateVersionsOptions.actionControlTemplateId; + this.state = listActionControlTemplateVersionsOptions.state; + this.limit = listActionControlTemplateVersionsOptions.limit; + this.start = listActionControlTemplateVersionsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + */ + public Builder(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + } + + /** + * Builds a ListActionControlTemplateVersionsOptions. + * + * @return the new ListActionControlTemplateVersionsOptions instance + */ + public ListActionControlTemplateVersionsOptions build() { + return new ListActionControlTemplateVersionsOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the ListActionControlTemplateVersionsOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListActionControlTemplateVersionsOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListActionControlTemplateVersionsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListActionControlTemplateVersionsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListActionControlTemplateVersionsOptions() { } + + protected ListActionControlTemplateVersionsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListActionControlTemplateVersionsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * The action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the state. + * + * Action control template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java new file mode 100644 index 00000000000..d019db6119f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java @@ -0,0 +1,193 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listActionControlTemplates options. + */ +public class ListActionControlTemplatesOptions extends GenericModel { + + protected String accountId; + protected String acceptLanguage; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListActionControlTemplatesOptions instance. + * + * @param listActionControlTemplatesOptions the instance to initialize the Builder with + */ + private Builder(ListActionControlTemplatesOptions listActionControlTemplatesOptions) { + this.accountId = listActionControlTemplatesOptions.accountId; + this.acceptLanguage = listActionControlTemplatesOptions.acceptLanguage; + this.limit = listActionControlTemplatesOptions.limit; + this.start = listActionControlTemplatesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListActionControlTemplatesOptions. + * + * @return the new ListActionControlTemplatesOptions instance + */ + public ListActionControlTemplatesOptions build() { + return new ListActionControlTemplatesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListActionControlTemplatesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListActionControlTemplatesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListActionControlTemplatesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListActionControlTemplatesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListActionControlTemplatesOptions() { } + + protected ListActionControlTemplatesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListActionControlTemplatesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the action control templates belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java new file mode 100644 index 00000000000..90ecb352c37 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java @@ -0,0 +1,501 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listPolicies options. + */ +public class ListPoliciesOptions extends GenericModel { + + /** + * Optional type of policy. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + /** + * Optional type of service. + */ + public interface ServiceType { + /** service. */ + String SERVICE = "service"; + /** platform_service. */ + String PLATFORM_SERVICE = "platform_service"; + } + + /** + * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending + * '-' to field. Example '-last_modified_at'. + */ + public interface Sort { + /** id. */ + String ID = "id"; + /** type. */ + String TYPE = "type"; + /** href. */ + String HREF = "href"; + /** created_at. */ + String CREATED_AT = "created_at"; + /** created_by_id. */ + String CREATED_BY_ID = "created_by_id"; + /** last_modified_at. */ + String LAST_MODIFIED_AT = "last_modified_at"; + /** last_modified_by_id. */ + String LAST_MODIFIED_BY_ID = "last_modified_by_id"; + /** state. */ + String STATE = "state"; + } + + /** + * Include additional data per policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles. + */ + public interface Format { + /** include_last_permit. */ + String INCLUDE_LAST_PERMIT = "include_last_permit"; + /** display. */ + String DISPLAY = "display"; + } + + /** + * The state of the policy. + * * `active` - returns active policies + * * `deleted` - returns non-active policies. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String accountId; + protected String acceptLanguage; + protected String iamId; + protected String accessGroupId; + protected String type; + protected String serviceType; + protected String tagName; + protected String tagValue; + protected String sort; + protected String format; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String iamId; + private String accessGroupId; + private String type; + private String serviceType; + private String tagName; + private String tagValue; + private String sort; + private String format; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListPoliciesOptions instance. + * + * @param listPoliciesOptions the instance to initialize the Builder with + */ + private Builder(ListPoliciesOptions listPoliciesOptions) { + this.accountId = listPoliciesOptions.accountId; + this.acceptLanguage = listPoliciesOptions.acceptLanguage; + this.iamId = listPoliciesOptions.iamId; + this.accessGroupId = listPoliciesOptions.accessGroupId; + this.type = listPoliciesOptions.type; + this.serviceType = listPoliciesOptions.serviceType; + this.tagName = listPoliciesOptions.tagName; + this.tagValue = listPoliciesOptions.tagValue; + this.sort = listPoliciesOptions.sort; + this.format = listPoliciesOptions.format; + this.state = listPoliciesOptions.state; + this.limit = listPoliciesOptions.limit; + this.start = listPoliciesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListPoliciesOptions. + * + * @return the new ListPoliciesOptions instance + */ + public ListPoliciesOptions build() { + return new ListPoliciesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListPoliciesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListPoliciesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the iamId. + * + * @param iamId the iamId + * @return the ListPoliciesOptions builder + */ + public Builder iamId(String iamId) { + this.iamId = iamId; + return this; + } + + /** + * Set the accessGroupId. + * + * @param accessGroupId the accessGroupId + * @return the ListPoliciesOptions builder + */ + public Builder accessGroupId(String accessGroupId) { + this.accessGroupId = accessGroupId; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the ListPoliciesOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the serviceType. + * + * @param serviceType the serviceType + * @return the ListPoliciesOptions builder + */ + public Builder serviceType(String serviceType) { + this.serviceType = serviceType; + return this; + } + + /** + * Set the tagName. + * + * @param tagName the tagName + * @return the ListPoliciesOptions builder + */ + public Builder tagName(String tagName) { + this.tagName = tagName; + return this; + } + + /** + * Set the tagValue. + * + * @param tagValue the tagValue + * @return the ListPoliciesOptions builder + */ + public Builder tagValue(String tagValue) { + this.tagValue = tagValue; + return this; + } + + /** + * Set the sort. + * + * @param sort the sort + * @return the ListPoliciesOptions builder + */ + public Builder sort(String sort) { + this.sort = sort; + return this; + } + + /** + * Set the format. + * + * @param format the format + * @return the ListPoliciesOptions builder + */ + public Builder format(String format) { + this.format = format; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListPoliciesOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListPoliciesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListPoliciesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListPoliciesOptions() { } + + protected ListPoliciesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + iamId = builder.iamId; + accessGroupId = builder.accessGroupId; + type = builder.type; + serviceType = builder.serviceType; + tagName = builder.tagName; + tagValue = builder.tagValue; + sort = builder.sort; + format = builder.format; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListPoliciesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the policies belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the iamId. + * + * Optional IAM ID used to identify the subject. + * + * @return the iamId + */ + public String iamId() { + return iamId; + } + + /** + * Gets the accessGroupId. + * + * Optional access group id. + * + * @return the accessGroupId + */ + public String accessGroupId() { + return accessGroupId; + } + + /** + * Gets the type. + * + * Optional type of policy. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the serviceType. + * + * Optional type of service. + * + * @return the serviceType + */ + public String serviceType() { + return serviceType; + } + + /** + * Gets the tagName. + * + * Optional name of the access tag in the policy. + * + * @return the tagName + */ + public String tagName() { + return tagName; + } + + /** + * Gets the tagValue. + * + * Optional value of the access tag in the policy. + * + * @return the tagValue + */ + public String tagValue() { + return tagValue; + } + + /** + * Gets the sort. + * + * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending + * '-' to field. Example '-last_modified_at'. + * + * @return the sort + */ + public String sort() { + return sort; + } + + /** + * Gets the format. + * + * Include additional data per policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles. + * + * @return the format + */ + public String format() { + return format; + } + + /** + * Gets the state. + * + * The state of the policy. + * * `active` - returns active policies + * * `deleted` - returns non-active policies. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java new file mode 100644 index 00000000000..9362749c670 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java @@ -0,0 +1,275 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listPolicyAssignments options. + */ +public class ListPolicyAssignmentsOptions extends GenericModel { + + protected String version; + protected String accountId; + protected String acceptLanguage; + protected String templateId; + protected String templateVersion; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String version; + private String accountId; + private String acceptLanguage; + private String templateId; + private String templateVersion; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListPolicyAssignmentsOptions instance. + * + * @param listPolicyAssignmentsOptions the instance to initialize the Builder with + */ + private Builder(ListPolicyAssignmentsOptions listPolicyAssignmentsOptions) { + this.version = listPolicyAssignmentsOptions.version; + this.accountId = listPolicyAssignmentsOptions.accountId; + this.acceptLanguage = listPolicyAssignmentsOptions.acceptLanguage; + this.templateId = listPolicyAssignmentsOptions.templateId; + this.templateVersion = listPolicyAssignmentsOptions.templateVersion; + this.limit = listPolicyAssignmentsOptions.limit; + this.start = listPolicyAssignmentsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param version the version + * @param accountId the accountId + */ + public Builder(String version, String accountId) { + this.version = version; + this.accountId = accountId; + } + + /** + * Builds a ListPolicyAssignmentsOptions. + * + * @return the new ListPolicyAssignmentsOptions instance + */ + public ListPolicyAssignmentsOptions build() { + return new ListPolicyAssignmentsOptions(this); + } + + /** + * Set the version. + * + * @param version the version + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the templateId. + * + * @param templateId the templateId + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder templateId(String templateId) { + this.templateId = templateId; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListPolicyAssignmentsOptions() { } + + protected ListPolicyAssignmentsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + version = builder.version; + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + templateId = builder.templateId; + templateVersion = builder.templateVersion; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListPolicyAssignmentsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the version. + * + * specify version of response body format. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the accountId. + * + * The account GUID in which the policies belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the templateId. + * + * Optional template id. + * + * @return the templateId + */ + public String templateId() { + return templateId; + } + + /** + * Gets the templateVersion. + * + * Optional policy template version. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java new file mode 100644 index 00000000000..c7965ba6c31 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listPolicyTemplateVersions options. + */ +public class ListPolicyTemplateVersionsOptions extends GenericModel { + + /** + * The policy template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String policyTemplateId; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListPolicyTemplateVersionsOptions instance. + * + * @param listPolicyTemplateVersionsOptions the instance to initialize the Builder with + */ + private Builder(ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions) { + this.policyTemplateId = listPolicyTemplateVersionsOptions.policyTemplateId; + this.state = listPolicyTemplateVersionsOptions.state; + this.limit = listPolicyTemplateVersionsOptions.limit; + this.start = listPolicyTemplateVersionsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + */ + public Builder(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + } + + /** + * Builds a ListPolicyTemplateVersionsOptions. + * + * @return the new ListPolicyTemplateVersionsOptions instance + */ + public ListPolicyTemplateVersionsOptions build() { + return new ListPolicyTemplateVersionsOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the ListPolicyTemplateVersionsOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListPolicyTemplateVersionsOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListPolicyTemplateVersionsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListPolicyTemplateVersionsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListPolicyTemplateVersionsOptions() { } + + protected ListPolicyTemplateVersionsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + policyTemplateId = builder.policyTemplateId; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListPolicyTemplateVersionsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the state. + * + * The policy template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java new file mode 100644 index 00000000000..f230c9bd549 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java @@ -0,0 +1,379 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listPolicyTemplates options. + */ +public class ListPolicyTemplatesOptions extends GenericModel { + + /** + * The policy template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + /** + * Service type, Optional. + */ + public interface PolicyServiceType { + /** service. */ + String SERVICE = "service"; + /** platform_service. */ + String PLATFORM_SERVICE = "platform_service"; + } + + /** + * Policy type, Optional. + */ + public interface PolicyType { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + protected String accountId; + protected String acceptLanguage; + protected String state; + protected String name; + protected String policyServiceType; + protected String policyServiceName; + protected String policyServiceGroupId; + protected String policyType; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String state; + private String name; + private String policyServiceType; + private String policyServiceName; + private String policyServiceGroupId; + private String policyType; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListPolicyTemplatesOptions instance. + * + * @param listPolicyTemplatesOptions the instance to initialize the Builder with + */ + private Builder(ListPolicyTemplatesOptions listPolicyTemplatesOptions) { + this.accountId = listPolicyTemplatesOptions.accountId; + this.acceptLanguage = listPolicyTemplatesOptions.acceptLanguage; + this.state = listPolicyTemplatesOptions.state; + this.name = listPolicyTemplatesOptions.name; + this.policyServiceType = listPolicyTemplatesOptions.policyServiceType; + this.policyServiceName = listPolicyTemplatesOptions.policyServiceName; + this.policyServiceGroupId = listPolicyTemplatesOptions.policyServiceGroupId; + this.policyType = listPolicyTemplatesOptions.policyType; + this.limit = listPolicyTemplatesOptions.limit; + this.start = listPolicyTemplatesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListPolicyTemplatesOptions. + * + * @return the new ListPolicyTemplatesOptions instance + */ + public ListPolicyTemplatesOptions build() { + return new ListPolicyTemplatesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListPolicyTemplatesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListPolicyTemplatesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListPolicyTemplatesOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ListPolicyTemplatesOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the policyServiceType. + * + * @param policyServiceType the policyServiceType + * @return the ListPolicyTemplatesOptions builder + */ + public Builder policyServiceType(String policyServiceType) { + this.policyServiceType = policyServiceType; + return this; + } + + /** + * Set the policyServiceName. + * + * @param policyServiceName the policyServiceName + * @return the ListPolicyTemplatesOptions builder + */ + public Builder policyServiceName(String policyServiceName) { + this.policyServiceName = policyServiceName; + return this; + } + + /** + * Set the policyServiceGroupId. + * + * @param policyServiceGroupId the policyServiceGroupId + * @return the ListPolicyTemplatesOptions builder + */ + public Builder policyServiceGroupId(String policyServiceGroupId) { + this.policyServiceGroupId = policyServiceGroupId; + return this; + } + + /** + * Set the policyType. + * + * @param policyType the policyType + * @return the ListPolicyTemplatesOptions builder + */ + public Builder policyType(String policyType) { + this.policyType = policyType; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListPolicyTemplatesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListPolicyTemplatesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListPolicyTemplatesOptions() { } + + protected ListPolicyTemplatesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + state = builder.state; + name = builder.name; + policyServiceType = builder.policyServiceType; + policyServiceName = builder.policyServiceName; + policyServiceGroupId = builder.policyServiceGroupId; + policyType = builder.policyType; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListPolicyTemplatesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the policy templates belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the state. + * + * The policy template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the name. + * + * The policy template name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the policyServiceType. + * + * Service type, Optional. + * + * @return the policyServiceType + */ + public String policyServiceType() { + return policyServiceType; + } + + /** + * Gets the policyServiceName. + * + * Service name, Optional. + * + * @return the policyServiceName + */ + public String policyServiceName() { + return policyServiceName; + } + + /** + * Gets the policyServiceGroupId. + * + * Service group id, Optional. + * + * @return the policyServiceGroupId + */ + public String policyServiceGroupId() { + return policyServiceGroupId; + } + + /** + * Gets the policyType. + * + * Policy type, Optional. + * + * @return the policyType + */ + public String policyType() { + return policyType; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java new file mode 100644 index 00000000000..adcb3f0cc90 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java @@ -0,0 +1,245 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listRoleAssignments options. + */ +public class ListRoleAssignmentsOptions extends GenericModel { + + protected String accountId; + protected String acceptLanguage; + protected String templateId; + protected String templateVersion; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String templateId; + private String templateVersion; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListRoleAssignmentsOptions instance. + * + * @param listRoleAssignmentsOptions the instance to initialize the Builder with + */ + private Builder(ListRoleAssignmentsOptions listRoleAssignmentsOptions) { + this.accountId = listRoleAssignmentsOptions.accountId; + this.acceptLanguage = listRoleAssignmentsOptions.acceptLanguage; + this.templateId = listRoleAssignmentsOptions.templateId; + this.templateVersion = listRoleAssignmentsOptions.templateVersion; + this.limit = listRoleAssignmentsOptions.limit; + this.start = listRoleAssignmentsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListRoleAssignmentsOptions. + * + * @return the new ListRoleAssignmentsOptions instance + */ + public ListRoleAssignmentsOptions build() { + return new ListRoleAssignmentsOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListRoleAssignmentsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListRoleAssignmentsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the templateId. + * + * @param templateId the templateId + * @return the ListRoleAssignmentsOptions builder + */ + public Builder templateId(String templateId) { + this.templateId = templateId; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the ListRoleAssignmentsOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListRoleAssignmentsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListRoleAssignmentsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListRoleAssignmentsOptions() { } + + protected ListRoleAssignmentsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + templateId = builder.templateId; + templateVersion = builder.templateVersion; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListRoleAssignmentsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID in which the role assignment belongs to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the templateId. + * + * Optional template ID. + * + * @return the templateId + */ + public String templateId() { + return templateId; + } + + /** + * Gets the templateVersion. + * + * Optional role template version. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java new file mode 100644 index 00000000000..e22751433e5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listRoleTemplateVersions options. + */ +public class ListRoleTemplateVersionsOptions extends GenericModel { + + /** + * Role template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String roleTemplateId; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListRoleTemplateVersionsOptions instance. + * + * @param listRoleTemplateVersionsOptions the instance to initialize the Builder with + */ + private Builder(ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions) { + this.roleTemplateId = listRoleTemplateVersionsOptions.roleTemplateId; + this.state = listRoleTemplateVersionsOptions.state; + this.limit = listRoleTemplateVersionsOptions.limit; + this.start = listRoleTemplateVersionsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + */ + public Builder(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + } + + /** + * Builds a ListRoleTemplateVersionsOptions. + * + * @return the new ListRoleTemplateVersionsOptions instance + */ + public ListRoleTemplateVersionsOptions build() { + return new ListRoleTemplateVersionsOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the ListRoleTemplateVersionsOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListRoleTemplateVersionsOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListRoleTemplateVersionsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListRoleTemplateVersionsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListRoleTemplateVersionsOptions() { } + + protected ListRoleTemplateVersionsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + roleTemplateId = builder.roleTemplateId; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListRoleTemplateVersionsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * The role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the state. + * + * Role template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java new file mode 100644 index 00000000000..8f889bdce96 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java @@ -0,0 +1,307 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listRoleTemplates options. + */ +public class ListRoleTemplatesOptions extends GenericModel { + + /** + * The role template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String accountId; + protected String acceptLanguage; + protected String name; + protected String roleName; + protected String roleServiceName; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String name; + private String roleName; + private String roleServiceName; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListRoleTemplatesOptions instance. + * + * @param listRoleTemplatesOptions the instance to initialize the Builder with + */ + private Builder(ListRoleTemplatesOptions listRoleTemplatesOptions) { + this.accountId = listRoleTemplatesOptions.accountId; + this.acceptLanguage = listRoleTemplatesOptions.acceptLanguage; + this.name = listRoleTemplatesOptions.name; + this.roleName = listRoleTemplatesOptions.roleName; + this.roleServiceName = listRoleTemplatesOptions.roleServiceName; + this.state = listRoleTemplatesOptions.state; + this.limit = listRoleTemplatesOptions.limit; + this.start = listRoleTemplatesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListRoleTemplatesOptions. + * + * @return the new ListRoleTemplatesOptions instance + */ + public ListRoleTemplatesOptions build() { + return new ListRoleTemplatesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListRoleTemplatesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListRoleTemplatesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ListRoleTemplatesOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the roleName. + * + * @param roleName the roleName + * @return the ListRoleTemplatesOptions builder + */ + public Builder roleName(String roleName) { + this.roleName = roleName; + return this; + } + + /** + * Set the roleServiceName. + * + * @param roleServiceName the roleServiceName + * @return the ListRoleTemplatesOptions builder + */ + public Builder roleServiceName(String roleServiceName) { + this.roleServiceName = roleServiceName; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListRoleTemplatesOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListRoleTemplatesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListRoleTemplatesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListRoleTemplatesOptions() { } + + protected ListRoleTemplatesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + name = builder.name; + roleName = builder.roleName; + roleServiceName = builder.roleServiceName; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListRoleTemplatesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the role templates belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the name. + * + * The role template name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the roleName. + * + * The template role name. + * + * @return the roleName + */ + public String roleName() { + return roleName; + } + + /** + * Gets the roleServiceName. + * + * The template role service name. + * + * @return the roleServiceName + */ + public String roleServiceName() { + return roleServiceName; + } + + /** + * Gets the state. + * + * The role template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java new file mode 100644 index 00000000000..2ca364c53a3 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java @@ -0,0 +1,234 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listRoles options. + */ +public class ListRolesOptions extends GenericModel { + + protected String acceptLanguage; + protected String accountId; + protected String serviceName; + protected String sourceServiceName; + protected String policyType; + protected String serviceGroupId; + + /** + * Builder. + */ + public static class Builder { + private String acceptLanguage; + private String accountId; + private String serviceName; + private String sourceServiceName; + private String policyType; + private String serviceGroupId; + + /** + * Instantiates a new Builder from an existing ListRolesOptions instance. + * + * @param listRolesOptions the instance to initialize the Builder with + */ + private Builder(ListRolesOptions listRolesOptions) { + this.acceptLanguage = listRolesOptions.acceptLanguage; + this.accountId = listRolesOptions.accountId; + this.serviceName = listRolesOptions.serviceName; + this.sourceServiceName = listRolesOptions.sourceServiceName; + this.policyType = listRolesOptions.policyType; + this.serviceGroupId = listRolesOptions.serviceGroupId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ListRolesOptions. + * + * @return the new ListRolesOptions instance + */ + public ListRolesOptions build() { + return new ListRolesOptions(this); + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListRolesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListRolesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the ListRolesOptions builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the sourceServiceName. + * + * @param sourceServiceName the sourceServiceName + * @return the ListRolesOptions builder + */ + public Builder sourceServiceName(String sourceServiceName) { + this.sourceServiceName = sourceServiceName; + return this; + } + + /** + * Set the policyType. + * + * @param policyType the policyType + * @return the ListRolesOptions builder + */ + public Builder policyType(String policyType) { + this.policyType = policyType; + return this; + } + + /** + * Set the serviceGroupId. + * + * @param serviceGroupId the serviceGroupId + * @return the ListRolesOptions builder + */ + public Builder serviceGroupId(String serviceGroupId) { + this.serviceGroupId = serviceGroupId; + return this; + } + } + + protected ListRolesOptions() { } + + protected ListRolesOptions(Builder builder) { + acceptLanguage = builder.acceptLanguage; + accountId = builder.accountId; + serviceName = builder.serviceName; + sourceServiceName = builder.sourceServiceName; + policyType = builder.policyType; + serviceGroupId = builder.serviceGroupId; + } + + /** + * New builder. + * + * @return a ListRolesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the accountId. + * + * Optional account GUID in which the roles belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the serviceName. + * + * Optional name of IAM enabled service. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the sourceServiceName. + * + * Optional name of source IAM enabled service. + * + * @return the sourceServiceName + */ + public String sourceServiceName() { + return sourceServiceName; + } + + /** + * Gets the policyType. + * + * Optional Policy Type. + * + * @return the policyType + */ + public String policyType() { + return policyType; + } + + /** + * Gets the serviceGroupId. + * + * Optional id of service group. + * + * @return the serviceGroupId + */ + public String serviceGroupId() { + return serviceGroupId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java new file mode 100644 index 00000000000..65849c3d9a6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java @@ -0,0 +1,492 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listV2Policies options. + */ +public class ListV2PoliciesOptions extends GenericModel { + + /** + * Optional type of policy. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + /** + * Optional type of service. + */ + public interface ServiceType { + /** service. */ + String SERVICE = "service"; + /** platform_service. */ + String PLATFORM_SERVICE = "platform_service"; + } + + /** + * Include additional data per policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles and translations for all + * relevant fields. + */ + public interface Format { + /** include_last_permit. */ + String INCLUDE_LAST_PERMIT = "include_last_permit"; + /** display. */ + String DISPLAY = "display"; + } + + /** + * The state of the policy. + * * `active` - returns active policies + * * `deleted` - returns non-active policies. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String accountId; + protected String acceptLanguage; + protected String iamId; + protected String accessGroupId; + protected String type; + protected String serviceType; + protected String serviceName; + protected String serviceGroupId; + protected String sort; + protected String format; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String iamId; + private String accessGroupId; + private String type; + private String serviceType; + private String serviceName; + private String serviceGroupId; + private String sort; + private String format; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListV2PoliciesOptions instance. + * + * @param listV2PoliciesOptions the instance to initialize the Builder with + */ + private Builder(ListV2PoliciesOptions listV2PoliciesOptions) { + this.accountId = listV2PoliciesOptions.accountId; + this.acceptLanguage = listV2PoliciesOptions.acceptLanguage; + this.iamId = listV2PoliciesOptions.iamId; + this.accessGroupId = listV2PoliciesOptions.accessGroupId; + this.type = listV2PoliciesOptions.type; + this.serviceType = listV2PoliciesOptions.serviceType; + this.serviceName = listV2PoliciesOptions.serviceName; + this.serviceGroupId = listV2PoliciesOptions.serviceGroupId; + this.sort = listV2PoliciesOptions.sort; + this.format = listV2PoliciesOptions.format; + this.state = listV2PoliciesOptions.state; + this.limit = listV2PoliciesOptions.limit; + this.start = listV2PoliciesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListV2PoliciesOptions. + * + * @return the new ListV2PoliciesOptions instance + */ + public ListV2PoliciesOptions build() { + return new ListV2PoliciesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListV2PoliciesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListV2PoliciesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the iamId. + * + * @param iamId the iamId + * @return the ListV2PoliciesOptions builder + */ + public Builder iamId(String iamId) { + this.iamId = iamId; + return this; + } + + /** + * Set the accessGroupId. + * + * @param accessGroupId the accessGroupId + * @return the ListV2PoliciesOptions builder + */ + public Builder accessGroupId(String accessGroupId) { + this.accessGroupId = accessGroupId; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the ListV2PoliciesOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the serviceType. + * + * @param serviceType the serviceType + * @return the ListV2PoliciesOptions builder + */ + public Builder serviceType(String serviceType) { + this.serviceType = serviceType; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the ListV2PoliciesOptions builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the serviceGroupId. + * + * @param serviceGroupId the serviceGroupId + * @return the ListV2PoliciesOptions builder + */ + public Builder serviceGroupId(String serviceGroupId) { + this.serviceGroupId = serviceGroupId; + return this; + } + + /** + * Set the sort. + * + * @param sort the sort + * @return the ListV2PoliciesOptions builder + */ + public Builder sort(String sort) { + this.sort = sort; + return this; + } + + /** + * Set the format. + * + * @param format the format + * @return the ListV2PoliciesOptions builder + */ + public Builder format(String format) { + this.format = format; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListV2PoliciesOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListV2PoliciesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListV2PoliciesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListV2PoliciesOptions() { } + + protected ListV2PoliciesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + iamId = builder.iamId; + accessGroupId = builder.accessGroupId; + type = builder.type; + serviceType = builder.serviceType; + serviceName = builder.serviceName; + serviceGroupId = builder.serviceGroupId; + sort = builder.sort; + format = builder.format; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListV2PoliciesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID in which the policies belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the iamId. + * + * Optional IAM ID used to identify the subject. + * + * @return the iamId + */ + public String iamId() { + return iamId; + } + + /** + * Gets the accessGroupId. + * + * Optional access group id. + * + * @return the accessGroupId + */ + public String accessGroupId() { + return accessGroupId; + } + + /** + * Gets the type. + * + * Optional type of policy. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the serviceType. + * + * Optional type of service. + * + * @return the serviceType + */ + public String serviceType() { + return serviceType; + } + + /** + * Gets the serviceName. + * + * Optional name of service. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the serviceGroupId. + * + * Optional ID of service group. + * + * @return the serviceGroupId + */ + public String serviceGroupId() { + return serviceGroupId; + } + + /** + * Gets the sort. + * + * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending + * '-' to field, for example, '-last_modified_at'. Note that last permit information is only included when + * 'format=include_last_permit', for example, "format=include_last_permit&sort=last_permit_at" Example fields that + * can be sorted on: + * - 'id' + * - 'type' + * - 'href' + * - 'created_at' + * - 'created_by_id' + * - 'last_modified_at' + * - 'last_modified_by_id' + * - 'state' + * - 'last_permit_at' + * - 'last_permit_frequency'. + * + * @return the sort + */ + public String sort() { + return sort; + } + + /** + * Gets the format. + * + * Include additional data per policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles and translations for all + * relevant fields. + * + * @return the format + */ + public String format() { + return format; + } + + /** + * Gets the state. + * + * The state of the policy. + * * `active` - returns active policies + * * `deleted` - returns non-active policies. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java new file mode 100644 index 00000000000..4d43d84dbba --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java @@ -0,0 +1,126 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Condition that specifies additional conditions or RuleAttribute to grant access. + * + * Classes which extend this class: + * - NestedConditionRuleAttribute + * - NestedConditionRuleWithConditions + */ +public class NestedCondition extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + protected String key; + protected String operator; + protected Object value; + protected List conditions; + + protected NestedCondition() { } + + /** + * Gets the key. + * + * The name of an attribute. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } + + /** + * Gets the conditions. + * + * List of conditions associated with a policy. For example, time-based conditions that grant access over a certain + * time period. + * + * @return the conditions + */ + public List conditions() { + return conditions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java new file mode 100644 index 00000000000..b1d44da3f6b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java @@ -0,0 +1,170 @@ +/* + * (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_policy_management.v1.model; + +/** + * Rule that specifies additional access that is granted (For example, time-based condition). + */ +public class NestedConditionRuleAttribute extends NestedCondition { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing NestedConditionRuleAttribute instance. + * + * @param nestedConditionRuleAttribute the instance to initialize the Builder with + */ + public Builder(NestedCondition nestedConditionRuleAttribute) { + this.key = nestedConditionRuleAttribute.key; + this.operator = nestedConditionRuleAttribute.operator; + this.value = nestedConditionRuleAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a NestedConditionRuleAttribute. + * + * @return the new NestedConditionRuleAttribute instance + */ + public NestedConditionRuleAttribute build() { + return new NestedConditionRuleAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the NestedConditionRuleAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the NestedConditionRuleAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the NestedConditionRuleAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected NestedConditionRuleAttribute() { } + + protected NestedConditionRuleAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a NestedConditionRuleAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java new file mode 100644 index 00000000000..20d0faac795 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java @@ -0,0 +1,139 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * Rule that specifies additional access that is granted (for example, time-based condition) accross multiple + * conditions. + */ +public class NestedConditionRuleWithConditions extends NestedCondition { + + /** + * Operator to evaluate conditions. + */ + public interface Operator { + /** and. */ + String AND = "and"; + /** or. */ + String OR = "or"; + } + + + /** + * Builder. + */ + public static class Builder { + private String operator; + private List conditions; + + /** + * Instantiates a new Builder from an existing NestedConditionRuleWithConditions instance. + * + * @param nestedConditionRuleWithConditions the instance to initialize the Builder with + */ + public Builder(NestedCondition nestedConditionRuleWithConditions) { + this.operator = nestedConditionRuleWithConditions.operator; + this.conditions = nestedConditionRuleWithConditions.conditions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param operator the operator + * @param conditions the conditions + */ + public Builder(String operator, List conditions) { + this.operator = operator; + this.conditions = conditions; + } + + /** + * Builds a NestedConditionRuleWithConditions. + * + * @return the new NestedConditionRuleWithConditions instance + */ + public NestedConditionRuleWithConditions build() { + return new NestedConditionRuleWithConditions(this); + } + + /** + * Adds a new element to conditions. + * + * @param conditions the new element to be added + * @return the NestedConditionRuleWithConditions builder + */ + public Builder addConditions(RuleAttribute conditions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(conditions, + "conditions cannot be null"); + if (this.conditions == null) { + this.conditions = new ArrayList(); + } + this.conditions.add(conditions); + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the NestedConditionRuleWithConditions builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the conditions. + * Existing conditions will be replaced. + * + * @param conditions the conditions + * @return the NestedConditionRuleWithConditions builder + */ + public Builder conditions(List conditions) { + this.conditions = conditions; + return this; + } + } + + protected NestedConditionRuleWithConditions() { } + + protected NestedConditionRuleWithConditions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.conditions, + "conditions cannot be null"); + operator = builder.operator; + conditions = builder.conditions; + } + + /** + * New builder. + * + * @return a NestedConditionRuleWithConditions builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java new file mode 100644 index 00000000000..b0442f902bc --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Details with href linking to the following page of requested collection. + */ +public class Next extends GenericModel { + + protected String href; + protected String start; + + protected Next() { } + + /** + * Gets the href. + * + * The href linking to the page of requested collection. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection. + * + * @return the start + */ + public String getStart() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java new file mode 100644 index 00000000000..8f12053c72e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * PoliciesPager can be used to simplify the use of the "listPolicies" method. + */ +public class PoliciesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListPoliciesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected PoliciesPager() { } + + /** + * Constructs a new PoliciesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listPolicies" method + * @param options the ListPoliciesOptions instance to be used to invoke the "listPolicies" method + */ + public PoliciesPager(IamPolicyManagement client, ListPoliciesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<PolicyTemplateMetaData> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListPoliciesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + PolicyCollection result = client.listPolicies(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getPolicies(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<PolicyTemplateMetaData> containing all results returned by the "listPolicies" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java new file mode 100644 index 00000000000..af852b7cd74 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java @@ -0,0 +1,188 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with a policy. + */ +public class Policy extends GenericModel { + + /** + * The policy state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String id; + protected String type; + protected String description; + protected List subjects; + protected List roles; + protected List resources; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String state; + + protected Policy() { } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the description. + * + * Customer-defined description. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the subjects. + * + * The subjects associated with a policy. + * + * @return the subjects + */ + public List getSubjects() { + return subjects; + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List getRoles() { + return roles; + } + + /** + * Gets the resources. + * + * The resources associated with a policy. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the href. + * + * The href links back to the policy. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the state. + * + * The policy state. + * + * @return the state + */ + public String getState() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java new file mode 100644 index 00000000000..3e566ce7bdf --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Set of properties for the assigned resource. + */ +public class PolicyAssignmentResourcePolicy extends GenericModel { + + @SerializedName("resource_created") + protected AssignmentResourceCreated resourceCreated; + protected String status; + @SerializedName("error_message") + protected AssignmentResourceError errorMessage; + + protected PolicyAssignmentResourcePolicy() { } + + /** + * Gets the resourceCreated. + * + * On success, includes the policy that is assigned. + * + * @return the resourceCreated + */ + public AssignmentResourceCreated getResourceCreated() { + return resourceCreated; + } + + /** + * Gets the status. + * + * policy status. + * + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * Gets the errorMessage. + * + * Body parameters for assignment error. + * + * @return the errorMessage + */ + public AssignmentResourceError getErrorMessage() { + return errorMessage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java new file mode 100644 index 00000000000..ad944536b0d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The policy assignment resources. + */ +public class PolicyAssignmentResources extends GenericModel { + + protected String target; + protected PolicyAssignmentResourcePolicy policy; + + protected PolicyAssignmentResources() { } + + /** + * Gets the target. + * + * Account ID where resources are assigned. + * + * @return the target + */ + public String getTarget() { + return target; + } + + /** + * Gets the policy. + * + * Set of properties for the assigned resource. + * + * @return the policy + */ + public PolicyAssignmentResourcePolicy getPolicy() { + return policy; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java new file mode 100644 index 00000000000..f1ea295713c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java @@ -0,0 +1,193 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the policy template assignment. + */ +public class PolicyAssignmentV1 extends GenericModel { + + /** + * The policy assignment status. + */ + public interface Status { + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** succeeded. */ + String SUCCEEDED = "succeeded"; + /** succeed_with_errors. */ + String SUCCEED_WITH_ERRORS = "succeed_with_errors"; + /** failed. */ + String FAILED = "failed"; + } + + protected AssignmentTargetDetails target; + protected String id; + @SerializedName("account_id") + protected String accountId; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected List resources; + protected PolicyAssignmentV1Subject subject; + protected AssignmentTemplateDetails template; + protected String status; + + protected PolicyAssignmentV1() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the id. + * + * Policy assignment ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the accountId. + * + * The account GUID that the policies assignments belong to. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the href. + * + * The href URL that links to the policies assignments API by policy assignment ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy assignment was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy assignment. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy assignment was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy assignment. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the resources. + * + * Object for each account assigned. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the subject. + * + * Subject details of access type assignment. + * + * @return the subject + */ + public PolicyAssignmentV1Subject getSubject() { + return subject; + } + + /** + * Gets the template. + * + * policy template details. + * + * @return the template + */ + public AssignmentTemplateDetails getTemplate() { + return template; + } + + /** + * Gets the status. + * + * The policy assignment status. + * + * @return the status + */ + public String getStatus() { + return status; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java new file mode 100644 index 00000000000..7331ee5a854 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Policy assignment response. + */ +public class PolicyAssignmentV1Collection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List assignments; + + protected PolicyAssignmentV1Collection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the assignments. + * + * Response of policy assignments. + * + * @return the assignments + */ + public List getAssignments() { + return assignments; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java new file mode 100644 index 00000000000..c05eb90816b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The policy assignment resources. + */ +public class PolicyAssignmentV1Resources extends GenericModel { + + protected AssignmentTargetDetails target; + protected PolicyAssignmentResourcePolicy policy; + + protected PolicyAssignmentV1Resources() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the policy. + * + * Set of properties for the assigned resource. + * + * @return the policy + */ + public PolicyAssignmentResourcePolicy getPolicy() { + return policy; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java new file mode 100644 index 00000000000..58b2cd240ba --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java @@ -0,0 +1,60 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Subject details of access type assignment. + */ +public class PolicyAssignmentV1Subject extends GenericModel { + + /** + * The identity type of the subject of the assignment. + */ + public interface Type { + /** iam_id. */ + String IAM_ID = "iam_id"; + /** access_group_id. */ + String ACCESS_GROUP_ID = "access_group_id"; + } + + protected String id; + protected String type; + + protected PolicyAssignmentV1Subject() { } + + /** + * Gets the id. + * + * The unique identifier of the subject of the assignment. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the type. + * + * The identity type of the subject of the assignment. + * + * @return the type + */ + public String getType() { + return type; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java new file mode 100644 index 00000000000..931769daed5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * PolicyAssignmentsPager can be used to simplify the use of the "listPolicyAssignments" method. + */ +public class PolicyAssignmentsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListPolicyAssignmentsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected PolicyAssignmentsPager() { } + + /** + * Constructs a new PolicyAssignmentsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyAssignments" method + * @param options the ListPolicyAssignmentsOptions instance to be used to invoke the "listPolicyAssignments" method + */ + public PolicyAssignmentsPager(IamPolicyManagement client, ListPolicyAssignmentsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<PolicyTemplateAssignmentItems> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListPolicyAssignmentsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + PolicyTemplateAssignmentCollection result = client.listPolicyAssignments(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getAssignments(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<PolicyTemplateAssignmentItems> containing all results returned by the "listPolicyAssignments" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java new file mode 100644 index 00000000000..25062dd0a52 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of policies. + */ +public class PolicyCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List policies; + + protected PolicyCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the policies. + * + * List of policies. + * + * @return the policies + */ + public List getPolicies() { + return policies; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java new file mode 100644 index 00000000000..4033f2dbc9d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java @@ -0,0 +1,167 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The attributes of the resource. Note that only one resource is allowed in a policy. + */ +public class PolicyResource extends GenericModel { + + protected List attributes; + protected List tags; + + /** + * Builder. + */ + public static class Builder { + private List attributes; + private List tags; + + /** + * Instantiates a new Builder from an existing PolicyResource instance. + * + * @param policyResource the instance to initialize the Builder with + */ + private Builder(PolicyResource policyResource) { + this.attributes = policyResource.attributes; + this.tags = policyResource.tags; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param attributes the attributes + */ + public Builder(List attributes) { + this.attributes = attributes; + } + + /** + * Builds a PolicyResource. + * + * @return the new PolicyResource instance + */ + public PolicyResource build() { + return new PolicyResource(this); + } + + /** + * Adds a new element to attributes. + * + * @param attributes the new element to be added + * @return the PolicyResource builder + */ + public Builder addAttributes(ResourceAttribute attributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, + "attributes cannot be null"); + if (this.attributes == null) { + this.attributes = new ArrayList(); + } + this.attributes.add(attributes); + return this; + } + + /** + * Adds a new element to tags. + * + * @param tags the new element to be added + * @return the PolicyResource builder + */ + public Builder addTags(ResourceTag tags) { + com.ibm.cloud.sdk.core.util.Validator.notNull(tags, + "tags cannot be null"); + if (this.tags == null) { + this.tags = new ArrayList(); + } + this.tags.add(tags); + return this; + } + + /** + * Set the attributes. + * Existing attributes will be replaced. + * + * @param attributes the attributes + * @return the PolicyResource builder + */ + public Builder attributes(List attributes) { + this.attributes = attributes; + return this; + } + + /** + * Set the tags. + * Existing tags will be replaced. + * + * @param tags the tags + * @return the PolicyResource builder + */ + public Builder tags(List tags) { + this.tags = tags; + return this; + } + } + + protected PolicyResource() { } + + protected PolicyResource(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, + "attributes cannot be null"); + attributes = builder.attributes; + tags = builder.tags; + } + + /** + * New builder. + * + * @return a PolicyResource builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the attributes. + * + * List of resource attributes. + * + * @return the attributes + */ + public List attributes() { + return attributes; + } + + /** + * Gets the tags. + * + * List of access management tags. + * + * @return the tags + */ + public List tags() { + return tags; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java new file mode 100644 index 00000000000..7319eabce7b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java @@ -0,0 +1,131 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role associated with a policy. + */ +public class PolicyRole extends GenericModel { + + @SerializedName("role_id") + protected String roleId; + @SerializedName("display_name") + protected String displayName; + protected String description; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + + /** + * Instantiates a new Builder from an existing PolicyRole instance. + * + * @param policyRole the instance to initialize the Builder with + */ + private Builder(PolicyRole policyRole) { + this.roleId = policyRole.roleId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + */ + public Builder(String roleId) { + this.roleId = roleId; + } + + /** + * Builds a PolicyRole. + * + * @return the new PolicyRole instance + */ + public PolicyRole build() { + return new PolicyRole(this); + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the PolicyRole builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + } + + protected PolicyRole() { } + + protected PolicyRole(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleId, + "roleId cannot be null"); + roleId = builder.roleId; + } + + /** + * New builder. + * + * @return a PolicyRole builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } + + /** + * Gets the displayName. + * + * The display name of the role. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String description() { + return description; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java new file mode 100644 index 00000000000..bf1b035a6b7 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java @@ -0,0 +1,124 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The subject attribute values that must match in order for this policy to apply in a permission decision. + */ +public class PolicySubject extends GenericModel { + + protected List attributes; + + /** + * Builder. + */ + public static class Builder { + private List attributes; + + /** + * Instantiates a new Builder from an existing PolicySubject instance. + * + * @param policySubject the instance to initialize the Builder with + */ + private Builder(PolicySubject policySubject) { + this.attributes = policySubject.attributes; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param attributes the attributes + */ + public Builder(List attributes) { + this.attributes = attributes; + } + + /** + * Builds a PolicySubject. + * + * @return the new PolicySubject instance + */ + public PolicySubject build() { + return new PolicySubject(this); + } + + /** + * Adds a new element to attributes. + * + * @param attributes the new element to be added + * @return the PolicySubject builder + */ + public Builder addAttributes(SubjectAttribute attributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, + "attributes cannot be null"); + if (this.attributes == null) { + this.attributes = new ArrayList(); + } + this.attributes.add(attributes); + return this; + } + + /** + * Set the attributes. + * Existing attributes will be replaced. + * + * @param attributes the attributes + * @return the PolicySubject builder + */ + public Builder attributes(List attributes) { + this.attributes = attributes; + return this; + } + } + + protected PolicySubject() { } + + protected PolicySubject(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, + "attributes cannot be null"); + attributes = builder.attributes; + } + + /** + * New builder. + * + * @return a PolicySubject builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the attributes. + * + * List of subject attributes. + * + * @return the attributes + */ + public List attributes() { + return attributes; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java new file mode 100644 index 00000000000..bdffbe98c10 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java @@ -0,0 +1,202 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the policy template. + */ +public class PolicyTemplate extends GenericModel { + + /** + * State of policy template. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String name; + protected String description; + @SerializedName("account_id") + protected String accountId; + protected String version; + protected Boolean committed; + protected TemplatePolicy policy; + protected String state; + protected String id; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + + protected PolicyTemplate() { } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the version. + * + * Template version. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the committed. + * + * Committed status of the template version. + * + * @return the committed + */ + public Boolean isCommitted() { + return committed; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy getPolicy() { + return policy; + } + + /** + * Gets the state. + * + * State of policy template. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the id. + * + * The policy template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the policy templates API by policy template ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy template was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy template. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy template was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy template. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java new file mode 100644 index 00000000000..54727eadf4d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of policies assignments. + */ +public class PolicyTemplateAssignmentCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List assignments; + + protected PolicyTemplateAssignmentCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the assignments. + * + * List of policy assignments. + * + * @return the assignments + */ + public List getAssignments() { + return assignments; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java new file mode 100644 index 00000000000..2c8e82df441 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java @@ -0,0 +1,261 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * PolicyTemplateAssignmentItems. + * + * Classes which extend this class: + * - PolicyTemplateAssignmentItemsPolicyAssignmentV1 + * - PolicyTemplateAssignmentItemsPolicyAssignment + */ +public class PolicyTemplateAssignmentItems extends GenericModel { + + /** + * The policy assignment status. + */ + public interface Status { + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** succeeded. */ + String SUCCEEDED = "succeeded"; + /** succeed_with_errors. */ + String SUCCEED_WITH_ERRORS = "succeed_with_errors"; + /** failed. */ + String FAILED = "failed"; + } + + /** + * Assignment target type. + */ + public interface TargetType { + /** Account. */ + String ACCOUNT = "Account"; + /** AccountGroup. */ + String ACCOUNTGROUP = "AccountGroup"; + /** Enterprise. */ + String ENTERPRISE = "Enterprise"; + } + + protected AssignmentTargetDetails target; + protected String id; + @SerializedName("account_id") + protected String accountId; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected List resources; + protected PolicyAssignmentV1Subject subject; + protected AssignmentTemplateDetails template; + protected String status; + @SerializedName("template_id") + protected String templateId; + @SerializedName("template_version") + protected String templateVersion; + @SerializedName("assignment_id") + protected String assignmentId; + @SerializedName("target_type") + protected String targetType; + + protected PolicyTemplateAssignmentItems() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the id. + * + * Policy assignment ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the accountId. + * + * The account GUID that the policies assignments belong to. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the href. + * + * The href URL that links to the policies assignments API by policy assignment ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy assignment was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy assignment. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy assignment was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy assignment. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the resources. + * + * Object for each account assigned. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the subject. + * + * Subject details of access type assignment. + * + * @return the subject + */ + public PolicyAssignmentV1Subject getSubject() { + return subject; + } + + /** + * Gets the template. + * + * policy template details. + * + * @return the template + */ + public AssignmentTemplateDetails getTemplate() { + return template; + } + + /** + * Gets the status. + * + * The policy assignment status. + * + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * Gets the templateId. + * + * policy template ID. + * + * @return the templateId + */ + public String getTemplateId() { + return templateId; + } + + /** + * Gets the templateVersion. + * + * policy template version. + * + * @return the templateVersion + */ + public String getTemplateVersion() { + return templateVersion; + } + + /** + * Gets the assignmentId. + * + * Passed in value to correlate with other assignments. + * + * @return the assignmentId + */ + public String getAssignmentId() { + return assignmentId; + } + + /** + * Gets the targetType. + * + * Assignment target type. + * + * @return the targetType + */ + public String getTargetType() { + return targetType; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java new file mode 100644 index 00000000000..ec9c32e5bdd --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +/** + * The set of properties associated with the policy template assignment. + */ +public class PolicyTemplateAssignmentItemsPolicyAssignment extends PolicyTemplateAssignmentItems { + + /** + * Assignment target type. + */ + public interface TargetType { + /** Account. */ + String ACCOUNT = "Account"; + /** AccountGroup. */ + String ACCOUNTGROUP = "AccountGroup"; + /** Enterprise. */ + String ENTERPRISE = "Enterprise"; + } + + /** + * The policy assignment status. + */ + public interface Status { + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** succeeded. */ + String SUCCEEDED = "succeeded"; + /** succeed_with_errors. */ + String SUCCEED_WITH_ERRORS = "succeed_with_errors"; + /** failed. */ + String FAILED = "failed"; + } + + + protected PolicyTemplateAssignmentItemsPolicyAssignment() { } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java new file mode 100644 index 00000000000..4cebdbb17b1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.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_policy_management.v1.model; + +/** + * The set of properties associated with the policy template assignment. + */ +public class PolicyTemplateAssignmentItemsPolicyAssignmentV1 extends PolicyTemplateAssignmentItems { + + /** + * The policy assignment status. + */ + public interface Status { + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** succeeded. */ + String SUCCEEDED = "succeeded"; + /** succeed_with_errors. */ + String SUCCEED_WITH_ERRORS = "succeed_with_errors"; + /** failed. */ + String FAILED = "failed"; + } + + + protected PolicyTemplateAssignmentItemsPolicyAssignmentV1() { } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java new file mode 100644 index 00000000000..2a262c584b5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java @@ -0,0 +1,90 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of policy Templates. + */ +public class PolicyTemplateCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + @SerializedName("policy_templates") + protected List policyTemplates; + + protected PolicyTemplateCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the policyTemplates. + * + * List of policy templates. + * + * @return the policyTemplates + */ + public List getPolicyTemplates() { + return policyTemplates; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java new file mode 100644 index 00000000000..5a2876dfe28 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java @@ -0,0 +1,214 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the policy template. + */ +public class PolicyTemplateLimitData extends GenericModel { + + /** + * State of policy template. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String name; + protected String description; + @SerializedName("account_id") + protected String accountId; + protected String version; + protected Boolean committed; + protected TemplatePolicy policy; + protected String state; + protected String id; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected TemplateCountData counts; + + protected PolicyTemplateLimitData() { } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the version. + * + * Template version. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the committed. + * + * Committed status of the template version. + * + * @return the committed + */ + public Boolean isCommitted() { + return committed; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy getPolicy() { + return policy; + } + + /** + * Gets the state. + * + * State of policy template. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the id. + * + * The policy template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the policy templates API by policy template ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy template was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy template. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy template was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy template. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the counts. + * + * policy template count details. + * + * @return the counts + */ + public TemplateCountData getCounts() { + return counts; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java new file mode 100644 index 00000000000..07effc5b3ad --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java @@ -0,0 +1,201 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with a policy. + */ +public class PolicyTemplateMetaData extends GenericModel { + + /** + * The policy state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String id; + protected String type; + protected String description; + protected List subjects; + protected List roles; + protected List resources; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String state; + protected TemplateMetadata template; + + protected PolicyTemplateMetaData() { } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the description. + * + * Customer-defined description. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the subjects. + * + * The subjects associated with a policy. + * + * @return the subjects + */ + public List getSubjects() { + return subjects; + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List getRoles() { + return roles; + } + + /** + * Gets the resources. + * + * The resources associated with a policy. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the href. + * + * The href links back to the policy. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the state. + * + * The policy state. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the template. + * + * The details of the IAM template that was used to create an enterprise-managed policy in your account. When + * returned, this indicates that the policy is created from and managed by a template in the root enterprise account. + * + * @return the template + */ + public TemplateMetadata getTemplate() { + return template; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java new file mode 100644 index 00000000000..a4f95bc6562 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of versions for a specific policy template. + */ +public class PolicyTemplateVersionsCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List versions; + + protected PolicyTemplateVersionsCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the versions. + * + * List of policy templates versions. + * + * @return the versions + */ + public List getVersions() { + return versions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java new file mode 100644 index 00000000000..f6a2496cf91 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * PolicyTemplateVersionsPager can be used to simplify the use of the "listPolicyTemplateVersions" method. + */ +public class PolicyTemplateVersionsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListPolicyTemplateVersionsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected PolicyTemplateVersionsPager() { } + + /** + * Constructs a new PolicyTemplateVersionsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyTemplateVersions" method + * @param options the ListPolicyTemplateVersionsOptions instance to be used to invoke the "listPolicyTemplateVersions" method + */ + public PolicyTemplateVersionsPager(IamPolicyManagement client, ListPolicyTemplateVersionsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<PolicyTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListPolicyTemplateVersionsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + PolicyTemplateVersionsCollection result = client.listPolicyTemplateVersions(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getVersions(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<PolicyTemplate> containing all results returned by the "listPolicyTemplateVersions" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java new file mode 100644 index 00000000000..eba6e6c8fad --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * PolicyTemplatesPager can be used to simplify the use of the "listPolicyTemplates" method. + */ +public class PolicyTemplatesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListPolicyTemplatesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected PolicyTemplatesPager() { } + + /** + * Constructs a new PolicyTemplatesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyTemplates" method + * @param options the ListPolicyTemplatesOptions instance to be used to invoke the "listPolicyTemplates" method + */ + public PolicyTemplatesPager(IamPolicyManagement client, ListPolicyTemplatesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<PolicyTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListPolicyTemplatesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + PolicyTemplateCollection result = client.listPolicyTemplates(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getPolicyTemplates(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<PolicyTemplate> containing all results returned by the "listPolicyTemplates" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java new file mode 100644 index 00000000000..2656f3fb790 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Details with linking href to previous page of requested collection. + */ +public class Previous extends GenericModel { + + protected String href; + protected String start; + + protected Previous() { } + + /** + * Gets the href. + * + * The href linking to the page of requested collection. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection. + * + * @return the start + */ + public String getStart() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java new file mode 100644 index 00000000000..151a77e8cb9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java @@ -0,0 +1,273 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replaceActionControlTemplate options. + */ +public class ReplaceActionControlTemplateOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String version; + protected String ifMatch; + protected String name; + protected String description; + protected TemplateActionControl actionControl; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String version; + private String ifMatch; + private String name; + private String description; + private TemplateActionControl actionControl; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing ReplaceActionControlTemplateOptions instance. + * + * @param replaceActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(ReplaceActionControlTemplateOptions replaceActionControlTemplateOptions) { + this.actionControlTemplateId = replaceActionControlTemplateOptions.actionControlTemplateId; + this.version = replaceActionControlTemplateOptions.version; + this.ifMatch = replaceActionControlTemplateOptions.ifMatch; + this.name = replaceActionControlTemplateOptions.name; + this.description = replaceActionControlTemplateOptions.description; + this.actionControl = replaceActionControlTemplateOptions.actionControl; + this.committed = replaceActionControlTemplateOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + * @param version the version + * @param ifMatch the ifMatch + */ + public Builder(String actionControlTemplateId, String version, String ifMatch) { + this.actionControlTemplateId = actionControlTemplateId; + this.version = version; + this.ifMatch = ifMatch; + } + + /** + * Builds a ReplaceActionControlTemplateOptions. + * + * @return the new ReplaceActionControlTemplateOptions instance + */ + public ReplaceActionControlTemplateOptions build() { + return new ReplaceActionControlTemplateOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actionControl. + * + * @param actionControl the actionControl + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder actionControl(TemplateActionControl actionControl) { + this.actionControl = actionControl; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected ReplaceActionControlTemplateOptions() { } + + protected ReplaceActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + actionControlTemplateId = builder.actionControlTemplateId; + version = builder.version; + ifMatch = builder.ifMatch; + name = builder.name; + description = builder.description; + actionControl = builder.actionControl; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a ReplaceActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating an action control template version must match the Etag value of the existing + * action control template version. The Etag can be retrieved using the GET + * /v1/action_control_templates/{template_id}/versions/{version} API and looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will + * change the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the action control template. This is shown to users in the enterprise account. Use this to describe + * the purpose or context of the action control for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actionControl. + * + * The action control properties that are created in an action resource when the template is assigned. + * + * @return the actionControl + */ + public TemplateActionControl actionControl() { + return actionControl; + } + + /** + * Gets the committed. + * + * Committed status of the template version. If committed is set to true, then the template version can no longer be + * updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java new file mode 100644 index 00000000000..80cbe9e4c79 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java @@ -0,0 +1,335 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replacePolicy options. + */ +public class ReplacePolicyOptions extends GenericModel { + + protected String policyId; + protected String ifMatch; + protected String type; + protected List subjects; + protected List roles; + protected List resources; + protected String description; + + /** + * Builder. + */ + public static class Builder { + private String policyId; + private String ifMatch; + private String type; + private List subjects; + private List roles; + private List resources; + private String description; + + /** + * Instantiates a new Builder from an existing ReplacePolicyOptions instance. + * + * @param replacePolicyOptions the instance to initialize the Builder with + */ + private Builder(ReplacePolicyOptions replacePolicyOptions) { + this.policyId = replacePolicyOptions.policyId; + this.ifMatch = replacePolicyOptions.ifMatch; + this.type = replacePolicyOptions.type; + this.subjects = replacePolicyOptions.subjects; + this.roles = replacePolicyOptions.roles; + this.resources = replacePolicyOptions.resources; + this.description = replacePolicyOptions.description; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyId the policyId + * @param ifMatch the ifMatch + * @param type the type + * @param subjects the subjects + * @param roles the roles + * @param resources the resources + */ + public Builder(String policyId, String ifMatch, String type, List subjects, List roles, List resources) { + this.policyId = policyId; + this.ifMatch = ifMatch; + this.type = type; + this.subjects = subjects; + this.roles = roles; + this.resources = resources; + } + + /** + * Builds a ReplacePolicyOptions. + * + * @return the new ReplacePolicyOptions instance + */ + public ReplacePolicyOptions build() { + return new ReplacePolicyOptions(this); + } + + /** + * Adds a new element to subjects. + * + * @param subjects the new element to be added + * @return the ReplacePolicyOptions builder + */ + public Builder addSubjects(PolicySubject subjects) { + com.ibm.cloud.sdk.core.util.Validator.notNull(subjects, + "subjects cannot be null"); + if (this.subjects == null) { + this.subjects = new ArrayList(); + } + this.subjects.add(subjects); + return this; + } + + /** + * Adds a new element to roles. + * + * @param roles the new element to be added + * @return the ReplacePolicyOptions builder + */ + public Builder addRoles(PolicyRole roles) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roles, + "roles cannot be null"); + if (this.roles == null) { + this.roles = new ArrayList(); + } + this.roles.add(roles); + return this; + } + + /** + * Adds a new element to resources. + * + * @param resources the new element to be added + * @return the ReplacePolicyOptions builder + */ + public Builder addResources(PolicyResource resources) { + com.ibm.cloud.sdk.core.util.Validator.notNull(resources, + "resources cannot be null"); + if (this.resources == null) { + this.resources = new ArrayList(); + } + this.resources.add(resources); + return this; + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the ReplacePolicyOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplacePolicyOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the ReplacePolicyOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the subjects. + * Existing subjects will be replaced. + * + * @param subjects the subjects + * @return the ReplacePolicyOptions builder + */ + public Builder subjects(List subjects) { + this.subjects = subjects; + return this; + } + + /** + * Set the roles. + * Existing roles will be replaced. + * + * @param roles the roles + * @return the ReplacePolicyOptions builder + */ + public Builder roles(List roles) { + this.roles = roles; + return this; + } + + /** + * Set the resources. + * Existing resources will be replaced. + * + * @param resources the resources + * @return the ReplacePolicyOptions builder + */ + public Builder resources(List resources) { + this.resources = resources; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplacePolicyOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + } + + protected ReplacePolicyOptions() { } + + protected ReplacePolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId 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.type, + "type cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subjects, + "subjects cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, + "roles cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resources, + "resources cannot be null"); + policyId = builder.policyId; + ifMatch = builder.ifMatch; + type = builder.type; + subjects = builder.subjects; + roles = builder.roles; + resources = builder.resources; + description = builder.description; + } + + /** + * New builder. + * + * @return a ReplacePolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyId. + * + * The policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be + * retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the subjects. + * + * The subjects associated with a policy. + * + * @return the subjects + */ + public List subjects() { + return subjects; + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List roles() { + return roles; + } + + /** + * Gets the resources. + * + * The resources associated with a policy. + * + * @return the resources + */ + public List resources() { + return resources; + } + + /** + * Gets the description. + * + * Customer-defined description. + * + * @return the description + */ + public String description() { + return description; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java new file mode 100644 index 00000000000..5a55c4898e5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java @@ -0,0 +1,276 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replacePolicyTemplate options. + */ +public class ReplacePolicyTemplateOptions extends GenericModel { + + protected String policyTemplateId; + protected String version; + protected String ifMatch; + protected TemplatePolicy policy; + protected String name; + protected String description; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String version; + private String ifMatch; + private TemplatePolicy policy; + private String name; + private String description; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing ReplacePolicyTemplateOptions instance. + * + * @param replacePolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(ReplacePolicyTemplateOptions replacePolicyTemplateOptions) { + this.policyTemplateId = replacePolicyTemplateOptions.policyTemplateId; + this.version = replacePolicyTemplateOptions.version; + this.ifMatch = replacePolicyTemplateOptions.ifMatch; + this.policy = replacePolicyTemplateOptions.policy; + this.name = replacePolicyTemplateOptions.name; + this.description = replacePolicyTemplateOptions.description; + this.committed = replacePolicyTemplateOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param version the version + * @param ifMatch the ifMatch + * @param policy the policy + */ + public Builder(String policyTemplateId, String version, String ifMatch, TemplatePolicy policy) { + this.policyTemplateId = policyTemplateId; + this.version = version; + this.ifMatch = ifMatch; + this.policy = policy; + } + + /** + * Builds a ReplacePolicyTemplateOptions. + * + * @return the new ReplacePolicyTemplateOptions instance + */ + public ReplacePolicyTemplateOptions build() { + return new ReplacePolicyTemplateOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the policy. + * + * @param policy the policy + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder policy(TemplatePolicy policy) { + this.policy = policy; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected ReplacePolicyTemplateOptions() { } + + protected ReplacePolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version 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.policy, + "policy cannot be null"); + policyTemplateId = builder.policyTemplateId; + version = builder.version; + ifMatch = builder.ifMatch; + policy = builder.policy; + name = builder.name; + description = builder.description; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a ReplacePolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the version. + * + * The policy template version. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy template version and must match the Etag value of the existing policy + * template version. The Etag can be retrieved using the GET + * /v1/policy_templates/{policy_template_id}/versions/{version} API and looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy policy() { + return policy; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template version. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java new file mode 100644 index 00000000000..fc4b536103d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java @@ -0,0 +1,255 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replaceRole options. + */ +public class ReplaceRoleOptions extends GenericModel { + + protected String roleId; + protected String ifMatch; + protected String displayName; + protected List actions; + protected String description; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + private String ifMatch; + private String displayName; + private List actions; + private String description; + + /** + * Instantiates a new Builder from an existing ReplaceRoleOptions instance. + * + * @param replaceRoleOptions the instance to initialize the Builder with + */ + private Builder(ReplaceRoleOptions replaceRoleOptions) { + this.roleId = replaceRoleOptions.roleId; + this.ifMatch = replaceRoleOptions.ifMatch; + this.displayName = replaceRoleOptions.displayName; + this.actions = replaceRoleOptions.actions; + this.description = replaceRoleOptions.description; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + * @param ifMatch the ifMatch + * @param displayName the displayName + * @param actions the actions + */ + public Builder(String roleId, String ifMatch, String displayName, List actions) { + this.roleId = roleId; + this.ifMatch = ifMatch; + this.displayName = displayName; + this.actions = actions; + } + + /** + * Builds a ReplaceRoleOptions. + * + * @return the new ReplaceRoleOptions instance + */ + public ReplaceRoleOptions build() { + return new ReplaceRoleOptions(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the ReplaceRoleOptions builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the ReplaceRoleOptions builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplaceRoleOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the ReplaceRoleOptions builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the ReplaceRoleOptions builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplaceRoleOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the role. + * + * @param role the role + * @return the ReplaceRoleOptions builder + */ + public Builder role(Role role) { + this.displayName = role.displayName(); + this.actions = role.actions(); + this.description = role.description(); + return this; + } + } + + protected ReplaceRoleOptions() { } + + protected ReplaceRoleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, + "roleId 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.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + roleId = builder.roleId; + ifMatch = builder.ifMatch; + displayName = builder.displayName; + actions = builder.actions; + description = builder.description; + } + + /** + * New builder. + * + * @return a ReplaceRoleOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role ID. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a role and must match the ETag value of the existing role. The Etag can be + * retrieved using the GET /v2/roles/{role_id} API and looking at the ETag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List actions() { + return actions; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String description() { + return description; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java new file mode 100644 index 00000000000..9a69b13326c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java @@ -0,0 +1,273 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replaceRoleTemplate options. + */ +public class ReplaceRoleTemplateOptions extends GenericModel { + + protected String roleTemplateId; + protected String version; + protected String ifMatch; + protected String name; + protected String description; + protected TemplateRole role; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String version; + private String ifMatch; + private String name; + private String description; + private TemplateRole role; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing ReplaceRoleTemplateOptions instance. + * + * @param replaceRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(ReplaceRoleTemplateOptions replaceRoleTemplateOptions) { + this.roleTemplateId = replaceRoleTemplateOptions.roleTemplateId; + this.version = replaceRoleTemplateOptions.version; + this.ifMatch = replaceRoleTemplateOptions.ifMatch; + this.name = replaceRoleTemplateOptions.name; + this.description = replaceRoleTemplateOptions.description; + this.role = replaceRoleTemplateOptions.role; + this.committed = replaceRoleTemplateOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + * @param version the version + * @param ifMatch the ifMatch + */ + public Builder(String roleTemplateId, String version, String ifMatch) { + this.roleTemplateId = roleTemplateId; + this.version = version; + this.ifMatch = ifMatch; + } + + /** + * Builds a ReplaceRoleTemplateOptions. + * + * @return the new ReplaceRoleTemplateOptions instance + */ + public ReplaceRoleTemplateOptions build() { + return new ReplaceRoleTemplateOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the role. + * + * @param role the role + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder role(TemplateRole role) { + this.role = role; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected ReplaceRoleTemplateOptions() { } + + protected ReplaceRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + roleTemplateId = builder.roleTemplateId; + version = builder.version; + ifMatch = builder.ifMatch; + name = builder.name; + description = builder.description; + role = builder.role; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a ReplaceRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the version. + * + * Role template version. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a role template version must match the Etag value of the existing role template + * version. The Etag can be retrieved using the GET /v1/role_templates/{template_id}/versions/{version} API and + * looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will + * change the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the role template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the role for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the role. + * + * The role properties that are created in an action resource when the template is assigned. + * + * @return the role + */ + public TemplateRole role() { + return role; + } + + /** + * Gets the committed. + * + * Committed status of the template version. If committed is set to true, then the template version can no longer be + * updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java new file mode 100644 index 00000000000..960f4782635 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java @@ -0,0 +1,336 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replaceV2Policy options. + */ +public class ReplaceV2PolicyOptions extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + protected String id; + protected String ifMatch; + protected Control control; + protected String type; + protected String description; + protected V2PolicySubject subject; + protected V2PolicyResource resource; + protected String pattern; + protected V2PolicyRule rule; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String ifMatch; + private Control control; + private String type; + private String description; + private V2PolicySubject subject; + private V2PolicyResource resource; + private String pattern; + private V2PolicyRule rule; + + /** + * Instantiates a new Builder from an existing ReplaceV2PolicyOptions instance. + * + * @param replaceV2PolicyOptions the instance to initialize the Builder with + */ + private Builder(ReplaceV2PolicyOptions replaceV2PolicyOptions) { + this.id = replaceV2PolicyOptions.id; + this.ifMatch = replaceV2PolicyOptions.ifMatch; + this.control = replaceV2PolicyOptions.control; + this.type = replaceV2PolicyOptions.type; + this.description = replaceV2PolicyOptions.description; + this.subject = replaceV2PolicyOptions.subject; + this.resource = replaceV2PolicyOptions.resource; + this.pattern = replaceV2PolicyOptions.pattern; + this.rule = replaceV2PolicyOptions.rule; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + * @param ifMatch the ifMatch + * @param control the control + * @param type the type + */ + public Builder(String id, String ifMatch, Control control, String type) { + this.id = id; + this.ifMatch = ifMatch; + this.control = control; + this.type = type; + } + + /** + * Builds a ReplaceV2PolicyOptions. + * + * @return the new ReplaceV2PolicyOptions instance + */ + public ReplaceV2PolicyOptions build() { + return new ReplaceV2PolicyOptions(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the ReplaceV2PolicyOptions builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplaceV2PolicyOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the control. + * + * @param control the control + * @return the ReplaceV2PolicyOptions builder + */ + public Builder control(Control control) { + this.control = control; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the ReplaceV2PolicyOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplaceV2PolicyOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the subject. + * + * @param subject the subject + * @return the ReplaceV2PolicyOptions builder + */ + public Builder subject(V2PolicySubject subject) { + this.subject = subject; + return this; + } + + /** + * Set the resource. + * + * @param resource the resource + * @return the ReplaceV2PolicyOptions builder + */ + public Builder resource(V2PolicyResource resource) { + this.resource = resource; + return this; + } + + /** + * Set the pattern. + * + * @param pattern the pattern + * @return the ReplaceV2PolicyOptions builder + */ + public Builder pattern(String pattern) { + this.pattern = pattern; + return this; + } + + /** + * Set the rule. + * + * @param rule the rule + * @return the ReplaceV2PolicyOptions builder + */ + public Builder rule(V2PolicyRule rule) { + this.rule = rule; + return this; + } + } + + protected ReplaceV2PolicyOptions() { } + + protected ReplaceV2PolicyOptions(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.control, + "control cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + id = builder.id; + ifMatch = builder.ifMatch; + control = builder.control; + type = builder.type; + description = builder.description; + subject = builder.subject; + resource = builder.resource; + pattern = builder.pattern; + rule = builder.rule; + } + + /** + * New builder. + * + * @return a ReplaceV2PolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be + * retrieved using the GET /v2/policies/{id} API and looking at the ETag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the control. + * + * Specifies the type of access that is granted by the policy. + * + * @return the control + */ + public Control control() { + return control; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject subject() { + return subject; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource resource() { + return resource; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String pattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule rule() { + return rule; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java new file mode 100644 index 00000000000..3a8b7e87b9e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * An attribute associated with a resource. + */ +public class ResourceAttribute extends GenericModel { + + protected String name; + protected String value; + protected String operator; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String value; + private String operator; + + /** + * Instantiates a new Builder from an existing ResourceAttribute instance. + * + * @param resourceAttribute the instance to initialize the Builder with + */ + private Builder(ResourceAttribute resourceAttribute) { + this.name = resourceAttribute.name; + this.value = resourceAttribute.value; + this.operator = resourceAttribute.operator; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param value the value + */ + public Builder(String name, String value) { + this.name = name; + this.value = value; + } + + /** + * Builds a ResourceAttribute. + * + * @return the new ResourceAttribute instance + */ + public ResourceAttribute build() { + return new ResourceAttribute(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the ResourceAttribute builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the ResourceAttribute builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the ResourceAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + } + + protected ResourceAttribute() { } + + protected ResourceAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + name = builder.name; + value = builder.value; + operator = builder.operator; + } + + /** + * New builder. + * + * @return a ResourceAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The name of an attribute. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the value. + * + * The value of an attribute. + * + * @return the value + */ + public String value() { + return value; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java new file mode 100644 index 00000000000..7da4cffee56 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A tag associated with a resource. + */ +public class ResourceTag extends GenericModel { + + protected String name; + protected String value; + protected String operator; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String value; + private String operator; + + /** + * Instantiates a new Builder from an existing ResourceTag instance. + * + * @param resourceTag the instance to initialize the Builder with + */ + private Builder(ResourceTag resourceTag) { + this.name = resourceTag.name; + this.value = resourceTag.value; + this.operator = resourceTag.operator; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param value the value + */ + public Builder(String name, String value) { + this.name = name; + this.value = value; + } + + /** + * Builds a ResourceTag. + * + * @return the new ResourceTag instance + */ + public ResourceTag build() { + return new ResourceTag(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the ResourceTag builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the ResourceTag builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the ResourceTag builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + } + + protected ResourceTag() { } + + protected ResourceTag(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + name = builder.name; + value = builder.value; + operator = builder.operator; + } + + /** + * New builder. + * + * @return a ResourceTag builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The name of an access management tag. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the value. + * + * The value of an access management tag. + * + * @return the value + */ + public String value() { + return value; + } + + /** + * Gets the operator. + * + * The operator of an access management tag. + * + * @return the operator + */ + public String operator() { + return operator; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java new file mode 100644 index 00000000000..24b99c9bd08 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java @@ -0,0 +1,196 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role resource. + */ +public class Role extends GenericModel { + + @SerializedName("display_name") + protected String displayName; + protected String description; + protected List actions; + protected String crn; + + /** + * Builder. + */ + public static class Builder { + private String displayName; + private String description; + private List actions; + + /** + * Instantiates a new Builder from an existing Role instance. + * + * @param role the instance to initialize the Builder with + */ + private Builder(Role role) { + this.displayName = role.displayName; + this.description = role.description; + this.actions = role.actions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param displayName the displayName + * @param actions the actions + */ + public Builder(String displayName, List actions) { + this.displayName = displayName; + this.actions = actions; + } + + /** + * Builds a Role. + * + * @return the new Role instance + */ + public Role build() { + return new Role(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the Role builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the Role builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the Role builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the Role builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + } + + protected Role() { } + + protected Role(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + displayName = builder.displayName; + description = builder.description; + actions = builder.actions; + } + + /** + * New builder. + * + * @return a Role builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List actions() { + return actions; + } + + /** + * Gets the crn. + * + * The role Cloud Resource Name (CRN). Example CRN: + * 'crn:v1:ibmcloud:public:iam-access-management::a/exampleAccountId::customRole:ExampleRoleName'. + * + * @return the crn + */ + public String crn() { + return crn; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java new file mode 100644 index 00000000000..9169fc88572 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java @@ -0,0 +1,64 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * An action that can be performed by the policy subject when assigned a role. + */ +public class RoleAction extends GenericModel { + + protected String id; + @SerializedName("display_name") + protected String displayName; + protected String description; + + protected RoleAction() { } + + /** + * Gets the id. + * + * Unique identifier for action with structure service.resource.action. For example, cbr.rule.read. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the displayName. + * + * Services defined display name for action. + * + * @return the displayName + */ + public String getDisplayName() { + return displayName; + } + + /** + * Gets the description. + * + * Service defined description for action. + * + * @return the description + */ + public String getDescription() { + return description; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java new file mode 100644 index 00000000000..23bb4b65c6f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java @@ -0,0 +1,207 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the assigned role template. + */ +public class RoleAssignment extends GenericModel { + + /** + * The current operation of the role assignment. + */ + public interface Operation { + /** create. */ + String CREATE = "create"; + /** apply. */ + String APPLY = "apply"; + /** update. */ + String UPDATE = "update"; + /** remove. */ + String REMOVE = "remove"; + } + + /** + * The role assignment status. + */ + public interface Status { + /** accepted. */ + String ACCEPTED = "accepted"; + /** failure. */ + String FAILURE = "failure"; + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** superseded. */ + String SUPERSEDED = "superseded"; + } + + protected String id; + @SerializedName("account_id") + protected String accountId; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String operation; + protected List resources; + protected RoleAssignmentTemplate template; + protected AssignmentTargetDetails target; + protected String status; + + protected RoleAssignment() { } + + /** + * Gets the id. + * + * Action control assignment ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the accountId. + * + * The account GUID that the role assignments belong to. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the href. + * + * The href URL that links to the role assignments API by role assignment ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the role assignment was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the role assignment. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the role assignment was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the role assignment. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the operation. + * + * The current operation of the role assignment. + * + * @return the operation + */ + public String getOperation() { + return operation; + } + + /** + * Gets the resources. + * + * Resources created when role template is assigned. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the template. + * + * The role template id and version that will be assigned. + * + * @return the template + */ + public RoleAssignmentTemplate getTemplate() { + return template; + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the status. + * + * The role assignment status. + * + * @return the status + */ + public String getStatus() { + return status; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java new file mode 100644 index 00000000000..658ac5b8c99 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of role assignments. + */ +public class RoleAssignmentCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List assignments; + + protected RoleAssignmentCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the assignments. + * + * List of role assignments. + * + * @return the assignments + */ + public List getAssignments() { + return assignments; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java new file mode 100644 index 00000000000..60d7a02d604 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The role assignment resources and target where the template is assigned. + */ +public class RoleAssignmentResource extends GenericModel { + + protected AssignmentTargetDetails target; + protected RoleAssignmentResourceRole role; + + protected RoleAssignmentResource() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the role. + * + * Set of properties of the assigned resource or error message if assignment failed. + * + * @return the role + */ + public RoleAssignmentResourceRole getRole() { + return role; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java new file mode 100644 index 00000000000..9ea359d63fb --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * On success, it includes the role assigned. + */ +public class RoleAssignmentResourceCreated extends GenericModel { + + protected String id; + + protected RoleAssignmentResourceCreated() { } + + /** + * Gets the id. + * + * role id. + * + * @return the id + */ + public String getId() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java new file mode 100644 index 00000000000..22d40bdaef4 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Set of properties of the assigned resource or error message if assignment failed. + */ +public class RoleAssignmentResourceRole extends GenericModel { + + @SerializedName("resource_created") + protected RoleAssignmentResourceCreated resourceCreated; + @SerializedName("error_message") + protected AssignmentResourceError errorMessage; + + protected RoleAssignmentResourceRole() { } + + /** + * Gets the resourceCreated. + * + * On success, it includes the role assigned. + * + * @return the resourceCreated + */ + public RoleAssignmentResourceCreated getResourceCreated() { + return resourceCreated; + } + + /** + * Gets the errorMessage. + * + * Body parameters for assignment error. + * + * @return the errorMessage + */ + public AssignmentResourceError getErrorMessage() { + return errorMessage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java new file mode 100644 index 00000000000..3524b91f4d5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The role template id and version that will be assigned. + */ +public class RoleAssignmentTemplate extends GenericModel { + + protected String id; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String version; + + /** + * Instantiates a new Builder from an existing RoleAssignmentTemplate instance. + * + * @param roleAssignmentTemplate the instance to initialize the Builder with + */ + private Builder(RoleAssignmentTemplate roleAssignmentTemplate) { + this.id = roleAssignmentTemplate.id; + this.version = roleAssignmentTemplate.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + * @param version the version + */ + public Builder(String id, String version) { + this.id = id; + this.version = version; + } + + /** + * Builds a RoleAssignmentTemplate. + * + * @return the new RoleAssignmentTemplate instance + */ + public RoleAssignmentTemplate build() { + return new RoleAssignmentTemplate(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the RoleAssignmentTemplate builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the RoleAssignmentTemplate builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected RoleAssignmentTemplate() { } + + protected RoleAssignmentTemplate(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, + "id cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + id = builder.id; + version = builder.version; + } + + /** + * New builder. + * + * @return a RoleAssignmentTemplate builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * Action control template ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java new file mode 100644 index 00000000000..16296a82e40 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * RoleAssignmentsPager can be used to simplify the use of the "listRoleAssignments" method. + */ +public class RoleAssignmentsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListRoleAssignmentsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected RoleAssignmentsPager() { } + + /** + * Constructs a new RoleAssignmentsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listRoleAssignments" method + * @param options the ListRoleAssignmentsOptions instance to be used to invoke the "listRoleAssignments" method + */ + public RoleAssignmentsPager(IamPolicyManagement client, ListRoleAssignmentsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<RoleAssignment> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListRoleAssignmentsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + RoleAssignmentCollection result = client.listRoleAssignments(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getAssignments(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<RoleAssignment> containing all results returned by the "listRoleAssignments" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java new file mode 100644 index 00000000000..282730a2dfc --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java @@ -0,0 +1,68 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of roles returned by the 'list roles' operation. + */ +public class RoleCollection extends GenericModel { + + @SerializedName("custom_roles") + protected List customRoles; + @SerializedName("service_roles") + protected List serviceRoles; + @SerializedName("system_roles") + protected List systemRoles; + + protected RoleCollection() { } + + /** + * Gets the customRoles. + * + * List of custom roles. + * + * @return the customRoles + */ + public List getCustomRoles() { + return customRoles; + } + + /** + * Gets the serviceRoles. + * + * List of service roles. + * + * @return the serviceRoles + */ + public List getServiceRoles() { + return serviceRoles; + } + + /** + * Gets the systemRoles. + * + * List of system roles. + * + * @return the systemRoles + */ + public List getSystemRoles() { + return systemRoles; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java new file mode 100644 index 00000000000..663d0f7f1d0 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java @@ -0,0 +1,202 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the role template. + */ +public class RoleTemplate extends GenericModel { + + /** + * State of role template. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String name; + protected String description; + @SerializedName("account_id") + protected String accountId; + protected Boolean committed; + protected RoleTemplatePrototypeRole role; + protected String id; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String version; + protected String state; + + protected RoleTemplate() { } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Description of the role template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the role for enterprise users managing IAM templates. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the committed. + * + * Committed status of the template. If committed is set to true, then the template version can no longer be updated. + * + * @return the committed + */ + public Boolean isCommitted() { + return committed; + } + + /** + * Gets the role. + * + * The role properties that are created in an action resource when the template is assigned. + * + * @return the role + */ + public RoleTemplatePrototypeRole getRole() { + return role; + } + + /** + * Gets the id. + * + * The role template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the role templates API by role template ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the role template was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the role template. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the role template was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the role template. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the version. + * + * The version number of the template used to identify different versions of same template. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the state. + * + * State of role template. + * + * @return the state + */ + public String getState() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java new file mode 100644 index 00000000000..22a739b4a58 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java @@ -0,0 +1,90 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of role templates. + */ +public class RoleTemplateCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + @SerializedName("role_templates") + protected List roleTemplates; + + protected RoleTemplateCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the roleTemplates. + * + * List of role templates. + * + * @return the roleTemplates + */ + public List getRoleTemplates() { + return roleTemplates; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java new file mode 100644 index 00000000000..43197620689 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java @@ -0,0 +1,239 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The role properties that are created in an action resource when the template is assigned. + */ +public class RoleTemplatePrototypeRole extends GenericModel { + + protected String name; + @SerializedName("display_name") + protected String displayName; + @SerializedName("service_name") + protected String serviceName; + protected String description; + protected List actions; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String displayName; + private String serviceName; + private String description; + private List actions; + + /** + * Instantiates a new Builder from an existing RoleTemplatePrototypeRole instance. + * + * @param roleTemplatePrototypeRole the instance to initialize the Builder with + */ + private Builder(RoleTemplatePrototypeRole roleTemplatePrototypeRole) { + this.name = roleTemplatePrototypeRole.name; + this.displayName = roleTemplatePrototypeRole.displayName; + this.serviceName = roleTemplatePrototypeRole.serviceName; + this.description = roleTemplatePrototypeRole.description; + this.actions = roleTemplatePrototypeRole.actions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param displayName the displayName + * @param actions the actions + */ + public Builder(String name, String displayName, List actions) { + this.name = name; + this.displayName = displayName; + this.actions = actions; + } + + /** + * Builds a RoleTemplatePrototypeRole. + * + * @return the new RoleTemplatePrototypeRole instance + */ + public RoleTemplatePrototypeRole build() { + return new RoleTemplatePrototypeRole(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the RoleTemplatePrototypeRole builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the RoleTemplatePrototypeRole builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the RoleTemplatePrototypeRole builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the RoleTemplatePrototypeRole builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the RoleTemplatePrototypeRole builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the RoleTemplatePrototypeRole builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + } + + protected RoleTemplatePrototypeRole() { } + + protected RoleTemplatePrototypeRole(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + name = builder.name; + displayName = builder.displayName; + serviceName = builder.serviceName; + description = builder.description; + actions = builder.actions; + } + + /** + * New builder. + * + * @return a RoleTemplatePrototypeRole builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the serviceName. + * + * The service name that the role refers. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the description. + * + * Description of the role. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. + * + * @return the actions + */ + public List actions() { + return actions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java new file mode 100644 index 00000000000..673ff7f9750 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role template reference associated with a policy template. + */ +public class RoleTemplateReferencesItem extends GenericModel { + + protected String id; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String version; + + /** + * Instantiates a new Builder from an existing RoleTemplateReferencesItem instance. + * + * @param roleTemplateReferencesItem the instance to initialize the Builder with + */ + private Builder(RoleTemplateReferencesItem roleTemplateReferencesItem) { + this.id = roleTemplateReferencesItem.id; + this.version = roleTemplateReferencesItem.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + * @param version the version + */ + public Builder(String id, String version) { + this.id = id; + this.version = version; + } + + /** + * Builds a RoleTemplateReferencesItem. + * + * @return the new RoleTemplateReferencesItem instance + */ + public RoleTemplateReferencesItem build() { + return new RoleTemplateReferencesItem(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the RoleTemplateReferencesItem builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the RoleTemplateReferencesItem builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected RoleTemplateReferencesItem() { } + + protected RoleTemplateReferencesItem(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, + "id cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + id = builder.id; + version = builder.version; + } + + /** + * New builder. + * + * @return a RoleTemplateReferencesItem builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The role template ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the version. + * + * Role template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java new file mode 100644 index 00000000000..a983208afe3 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of versions for a specific role template. + */ +public class RoleTemplateVersionsCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List versions; + + protected RoleTemplateVersionsCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the versions. + * + * List of role templates versions. + * + * @return the versions + */ + public List getVersions() { + return versions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java new file mode 100644 index 00000000000..7af200cd72f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * RoleTemplateVersionsPager can be used to simplify the use of the "listRoleTemplateVersions" method. + */ +public class RoleTemplateVersionsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListRoleTemplateVersionsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected RoleTemplateVersionsPager() { } + + /** + * Constructs a new RoleTemplateVersionsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listRoleTemplateVersions" method + * @param options the ListRoleTemplateVersionsOptions instance to be used to invoke the "listRoleTemplateVersions" method + */ + public RoleTemplateVersionsPager(IamPolicyManagement client, ListRoleTemplateVersionsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<RoleTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListRoleTemplateVersionsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + RoleTemplateVersionsCollection result = client.listRoleTemplateVersions(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getVersions(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<RoleTemplate> containing all results returned by the "listRoleTemplateVersions" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java new file mode 100644 index 00000000000..3654e0757ba --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * RoleTemplatesPager can be used to simplify the use of the "listRoleTemplates" method. + */ +public class RoleTemplatesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListRoleTemplatesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected RoleTemplatesPager() { } + + /** + * Constructs a new RoleTemplatesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listRoleTemplates" method + * @param options the ListRoleTemplatesOptions instance to be used to invoke the "listRoleTemplates" method + */ + public RoleTemplatesPager(IamPolicyManagement client, ListRoleTemplatesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<RoleTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListRoleTemplatesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + RoleTemplateCollection result = client.listRoleTemplates(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getRoleTemplates(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<RoleTemplate> containing all results returned by the "listRoleTemplates" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java new file mode 100644 index 00000000000..03b6ff75eb1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java @@ -0,0 +1,106 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role associated with a policy. + */ +public class Roles extends GenericModel { + + @SerializedName("role_id") + protected String roleId; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + + /** + * Instantiates a new Builder from an existing Roles instance. + * + * @param roles the instance to initialize the Builder with + */ + private Builder(Roles roles) { + this.roleId = roles.roleId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + */ + public Builder(String roleId) { + this.roleId = roleId; + } + + /** + * Builds a Roles. + * + * @return the new Roles instance + */ + public Roles build() { + return new Roles(this); + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the Roles builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + } + + protected Roles() { } + + protected Roles(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleId, + "roleId cannot be null"); + roleId = builder.roleId; + } + + /** + * New builder. + * + * @return a Roles builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java new file mode 100644 index 00000000000..fbf66d53ae1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java @@ -0,0 +1,209 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Rule that specifies additional access that is granted (For example, time-based condition). + */ +public class RuleAttribute extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + protected String key; + protected String operator; + protected Object value; + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing RuleAttribute instance. + * + * @param ruleAttribute the instance to initialize the Builder with + */ + private Builder(RuleAttribute ruleAttribute) { + this.key = ruleAttribute.key; + this.operator = ruleAttribute.operator; + this.value = ruleAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a RuleAttribute. + * + * @return the new RuleAttribute instance + */ + public RuleAttribute build() { + return new RuleAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the RuleAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the RuleAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the RuleAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected RuleAttribute() { } + + protected RuleAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a RuleAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the key. + * + * The name of an attribute. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java new file mode 100644 index 00000000000..d7e54e112c5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * An attribute associated with a subject. + */ +public class SubjectAttribute extends GenericModel { + + protected String name; + protected String value; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String value; + + /** + * Instantiates a new Builder from an existing SubjectAttribute instance. + * + * @param subjectAttribute the instance to initialize the Builder with + */ + private Builder(SubjectAttribute subjectAttribute) { + this.name = subjectAttribute.name; + this.value = subjectAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param value the value + */ + public Builder(String name, String value) { + this.name = name; + this.value = value; + } + + /** + * Builds a SubjectAttribute. + * + * @return the new SubjectAttribute instance + */ + public SubjectAttribute build() { + return new SubjectAttribute(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the SubjectAttribute builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the SubjectAttribute builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + } + + protected SubjectAttribute() { } + + protected SubjectAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + name = builder.name; + value = builder.value; + } + + /** + * New builder. + * + * @return a SubjectAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The name of an attribute. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the value. + * + * The value of an attribute. + * + * @return the value + */ + public String value() { + return value; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java new file mode 100644 index 00000000000..62f4bd77f87 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java @@ -0,0 +1,182 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The action control properties that are created in an action resource when the template is assigned. + */ +public class TemplateActionControl extends GenericModel { + + @SerializedName("service_name") + protected String serviceName; + protected String description; + protected List actions; + + /** + * Builder. + */ + public static class Builder { + private String serviceName; + private String description; + private List actions; + + /** + * Instantiates a new Builder from an existing TemplateActionControl instance. + * + * @param templateActionControl the instance to initialize the Builder with + */ + private Builder(TemplateActionControl templateActionControl) { + this.serviceName = templateActionControl.serviceName; + this.description = templateActionControl.description; + this.actions = templateActionControl.actions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param serviceName the serviceName + * @param actions the actions + */ + public Builder(String serviceName, List actions) { + this.serviceName = serviceName; + this.actions = actions; + } + + /** + * Builds a TemplateActionControl. + * + * @return the new TemplateActionControl instance + */ + public TemplateActionControl build() { + return new TemplateActionControl(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the TemplateActionControl builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the TemplateActionControl builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the TemplateActionControl builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the TemplateActionControl builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + } + + protected TemplateActionControl() { } + + protected TemplateActionControl(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, + "serviceName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + serviceName = builder.serviceName; + description = builder.description; + actions = builder.actions; + } + + /** + * New builder. + * + * @return a TemplateActionControl builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the serviceName. + * + * The service name that the action control refers. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the description. + * + * Description of the action control. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actions. + * + * List of actions to control access. + * + * @return the actions + */ + public List actions() { + return actions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java new file mode 100644 index 00000000000..c74a77d9b6d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Specifies the type of access that is granted by the policy. + */ +public class TemplateControl extends GenericModel { + + protected TemplateGrant grant; + + /** + * Builder. + */ + public static class Builder { + private TemplateGrant grant; + + /** + * Instantiates a new Builder from an existing TemplateControl instance. + * + * @param templateControl the instance to initialize the Builder with + */ + private Builder(TemplateControl templateControl) { + this.grant = templateControl.grant; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param grant the grant + */ + public Builder(TemplateGrant grant) { + this.grant = grant; + } + + /** + * Builds a TemplateControl. + * + * @return the new TemplateControl instance + */ + public TemplateControl build() { + return new TemplateControl(this); + } + + /** + * Set the grant. + * + * @param grant the grant + * @return the TemplateControl builder + */ + public Builder grant(TemplateGrant grant) { + this.grant = grant; + return this; + } + } + + protected TemplateControl() { } + + protected TemplateControl(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.grant, + "grant cannot be null"); + grant = builder.grant; + } + + /** + * New builder. + * + * @return a TemplateControl builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the grant. + * + * Permission is granted by the policy. + * + * @return the grant + */ + public TemplateGrant grant() { + return grant; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java new file mode 100644 index 00000000000..edb134e1270 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * policy template count details. + */ +public class TemplateCountData extends GenericModel { + + protected LimitData template; + protected LimitData version; + + protected TemplateCountData() { } + + /** + * Gets the template. + * + * policy template current and limit details with in an account. + * + * @return the template + */ + public LimitData getTemplate() { + return template; + } + + /** + * Gets the version. + * + * policy template current and limit details with in an account. + * + * @return the version + */ + public LimitData getVersion() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java new file mode 100644 index 00000000000..fd0daff9665 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java @@ -0,0 +1,58 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Permission is granted by the policy. + * + * Classes which extend this class: + * - TemplateGrantRoles + * - TemplateGrantRoleReferences + */ +public class TemplateGrant extends GenericModel { + + protected List roles; + @SerializedName("role_template_references") + protected List roleTemplateReferences; + + protected TemplateGrant() { } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List roles() { + return roles; + } + + /** + * Gets the roleTemplateReferences. + * + * A set of role template reference IDs granted by the policy. + * + * @return the roleTemplateReferences + */ + public List roleTemplateReferences() { + return roleTemplateReferences; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java new file mode 100644 index 00000000000..248eb121b72 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java @@ -0,0 +1,110 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * TemplateGrantRoleReferences. + */ +public class TemplateGrantRoleReferences extends TemplateGrant { + + + /** + * Builder. + */ + public static class Builder { + private List roleTemplateReferences; + + /** + * Instantiates a new Builder from an existing TemplateGrantRoleReferences instance. + * + * @param templateGrantRoleReferences the instance to initialize the Builder with + */ + public Builder(TemplateGrant templateGrantRoleReferences) { + this.roleTemplateReferences = templateGrantRoleReferences.roleTemplateReferences; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateReferences the roleTemplateReferences + */ + public Builder(List roleTemplateReferences) { + this.roleTemplateReferences = roleTemplateReferences; + } + + /** + * Builds a TemplateGrantRoleReferences. + * + * @return the new TemplateGrantRoleReferences instance + */ + public TemplateGrantRoleReferences build() { + return new TemplateGrantRoleReferences(this); + } + + /** + * Adds a new element to roleTemplateReferences. + * + * @param roleTemplateReferences the new element to be added + * @return the TemplateGrantRoleReferences builder + */ + public Builder addRoleTemplateReferences(RoleTemplateReferencesItem roleTemplateReferences) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roleTemplateReferences, + "roleTemplateReferences cannot be null"); + if (this.roleTemplateReferences == null) { + this.roleTemplateReferences = new ArrayList(); + } + this.roleTemplateReferences.add(roleTemplateReferences); + return this; + } + + /** + * Set the roleTemplateReferences. + * Existing roleTemplateReferences will be replaced. + * + * @param roleTemplateReferences the roleTemplateReferences + * @return the TemplateGrantRoleReferences builder + */ + public Builder roleTemplateReferences(List roleTemplateReferences) { + this.roleTemplateReferences = roleTemplateReferences; + return this; + } + } + + protected TemplateGrantRoleReferences() { } + + protected TemplateGrantRoleReferences(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleTemplateReferences, + "roleTemplateReferences cannot be null"); + roleTemplateReferences = builder.roleTemplateReferences; + } + + /** + * New builder. + * + * @return a TemplateGrantRoleReferences builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java new file mode 100644 index 00000000000..6524b3645eb --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java @@ -0,0 +1,110 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * TemplateGrantRoles. + */ +public class TemplateGrantRoles extends TemplateGrant { + + + /** + * Builder. + */ + public static class Builder { + private List roles; + + /** + * Instantiates a new Builder from an existing TemplateGrantRoles instance. + * + * @param templateGrantRoles the instance to initialize the Builder with + */ + public Builder(TemplateGrant templateGrantRoles) { + this.roles = templateGrantRoles.roles; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roles the roles + */ + public Builder(List roles) { + this.roles = roles; + } + + /** + * Builds a TemplateGrantRoles. + * + * @return the new TemplateGrantRoles instance + */ + public TemplateGrantRoles build() { + return new TemplateGrantRoles(this); + } + + /** + * Adds a new element to roles. + * + * @param roles the new element to be added + * @return the TemplateGrantRoles builder + */ + public Builder addRoles(Roles roles) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roles, + "roles cannot be null"); + if (this.roles == null) { + this.roles = new ArrayList(); + } + this.roles.add(roles); + return this; + } + + /** + * Set the roles. + * Existing roles will be replaced. + * + * @param roles the roles + * @return the TemplateGrantRoles builder + */ + public Builder roles(List roles) { + this.roles = roles; + return this; + } + } + + protected TemplateGrantRoles() { } + + protected TemplateGrantRoles(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, + "roles cannot be null"); + roles = builder.roles; + } + + /** + * New builder. + * + * @return a TemplateGrantRoles builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java new file mode 100644 index 00000000000..41f112312cd --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java @@ -0,0 +1,91 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The details of the IAM template that was used to create an enterprise-managed policy in your account. When returned, + * this indicates that the policy is created from and managed by a template in the root enterprise account. + */ +public class TemplateMetadata extends GenericModel { + + protected String id; + protected String version; + @SerializedName("assignment_id") + protected String assignmentId; + @SerializedName("root_id") + protected String rootId; + @SerializedName("root_version") + protected String rootVersion; + + protected TemplateMetadata() { } + + /** + * Gets the id. + * + * The policy template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the version. + * + * Template version. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the assignmentId. + * + * Policy assignment ID. + * + * @return the assignmentId + */ + public String getAssignmentId() { + return assignmentId; + } + + /** + * Gets the rootId. + * + * Orchestrator template ID. + * + * @return the rootId + */ + public String getRootId() { + return rootId; + } + + /** + * Gets the rootVersion. + * + * Orchestrator template version. + * + * @return the rootVersion + */ + public String getRootVersion() { + return rootVersion; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java new file mode 100644 index 00000000000..496b2e70e40 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java @@ -0,0 +1,272 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the template's policy object. + */ +public class TemplatePolicy extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + protected String type; + protected String description; + protected V2PolicyResource resource; + protected V2PolicySubject subject; + protected String pattern; + protected V2PolicyRule rule; + protected TemplateControl control; + + /** + * Builder. + */ + public static class Builder { + private String type; + private String description; + private V2PolicyResource resource; + private V2PolicySubject subject; + private String pattern; + private V2PolicyRule rule; + private TemplateControl control; + + /** + * Instantiates a new Builder from an existing TemplatePolicy instance. + * + * @param templatePolicy the instance to initialize the Builder with + */ + private Builder(TemplatePolicy templatePolicy) { + this.type = templatePolicy.type; + this.description = templatePolicy.description; + this.resource = templatePolicy.resource; + this.subject = templatePolicy.subject; + this.pattern = templatePolicy.pattern; + this.rule = templatePolicy.rule; + this.control = templatePolicy.control; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param type the type + */ + public Builder(String type) { + this.type = type; + } + + /** + * Builds a TemplatePolicy. + * + * @return the new TemplatePolicy instance + */ + public TemplatePolicy build() { + return new TemplatePolicy(this); + } + + /** + * Set the type. + * + * @param type the type + * @return the TemplatePolicy builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the TemplatePolicy builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the resource. + * + * @param resource the resource + * @return the TemplatePolicy builder + */ + public Builder resource(V2PolicyResource resource) { + this.resource = resource; + return this; + } + + /** + * Set the subject. + * + * @param subject the subject + * @return the TemplatePolicy builder + */ + public Builder subject(V2PolicySubject subject) { + this.subject = subject; + return this; + } + + /** + * Set the pattern. + * + * @param pattern the pattern + * @return the TemplatePolicy builder + */ + public Builder pattern(String pattern) { + this.pattern = pattern; + return this; + } + + /** + * Set the rule. + * + * @param rule the rule + * @return the TemplatePolicy builder + */ + public Builder rule(V2PolicyRule rule) { + this.rule = rule; + return this; + } + + /** + * Set the control. + * + * @param control the control + * @return the TemplatePolicy builder + */ + public Builder control(TemplateControl control) { + this.control = control; + return this; + } + } + + protected TemplatePolicy() { } + + protected TemplatePolicy(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + type = builder.type; + description = builder.description; + resource = builder.resource; + subject = builder.subject; + pattern = builder.pattern; + rule = builder.rule; + control = builder.control; + } + + /** + * New builder. + * + * @return a TemplatePolicy builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. This is shown in child accounts when an access group or trusted profile template uses + * the policy template to assign access. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource resource() { + return resource; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject subject() { + return subject; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String pattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule rule() { + return rule; + } + + /** + * Gets the control. + * + * Specifies the type of access that is granted by the policy. + * + * @return the control + */ + public TemplateControl control() { + return control; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java new file mode 100644 index 00000000000..b76beb3bddb --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java @@ -0,0 +1,209 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The role properties that are created in an action resource when the template is assigned. + */ +public class TemplateRole extends GenericModel { + + @SerializedName("display_name") + protected String displayName; + @SerializedName("service_name") + protected String serviceName; + protected String description; + protected List actions; + + /** + * Builder. + */ + public static class Builder { + private String displayName; + private String serviceName; + private String description; + private List actions; + + /** + * Instantiates a new Builder from an existing TemplateRole instance. + * + * @param templateRole the instance to initialize the Builder with + */ + private Builder(TemplateRole templateRole) { + this.displayName = templateRole.displayName; + this.serviceName = templateRole.serviceName; + this.description = templateRole.description; + this.actions = templateRole.actions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param displayName the displayName + * @param actions the actions + */ + public Builder(String displayName, List actions) { + this.displayName = displayName; + this.actions = actions; + } + + /** + * Builds a TemplateRole. + * + * @return the new TemplateRole instance + */ + public TemplateRole build() { + return new TemplateRole(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the TemplateRole builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the TemplateRole builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the TemplateRole builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the TemplateRole builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the TemplateRole builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + } + + protected TemplateRole() { } + + protected TemplateRole(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + displayName = builder.displayName; + serviceName = builder.serviceName; + description = builder.description; + actions = builder.actions; + } + + /** + * New builder. + * + * @return a TemplateRole builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the serviceName. + * + * The service name that the role refers. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the description. + * + * Description of the role. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. + * + * @return the actions + */ + public List actions() { + return actions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java new file mode 100644 index 00000000000..caf2f737b55 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java @@ -0,0 +1,166 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updateActionControlAssignment options. + */ +public class UpdateActionControlAssignmentOptions extends GenericModel { + + protected String assignmentId; + protected String ifMatch; + protected String templateVersion; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + private String ifMatch; + private String templateVersion; + + /** + * Instantiates a new Builder from an existing UpdateActionControlAssignmentOptions instance. + * + * @param updateActionControlAssignmentOptions the instance to initialize the Builder with + */ + private Builder(UpdateActionControlAssignmentOptions updateActionControlAssignmentOptions) { + this.assignmentId = updateActionControlAssignmentOptions.assignmentId; + this.ifMatch = updateActionControlAssignmentOptions.ifMatch; + this.templateVersion = updateActionControlAssignmentOptions.templateVersion; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + * @param ifMatch the ifMatch + * @param templateVersion the templateVersion + */ + public Builder(String assignmentId, String ifMatch, String templateVersion) { + this.assignmentId = assignmentId; + this.ifMatch = ifMatch; + this.templateVersion = templateVersion; + } + + /** + * Builds a UpdateActionControlAssignmentOptions. + * + * @return the new UpdateActionControlAssignmentOptions instance + */ + public UpdateActionControlAssignmentOptions build() { + return new UpdateActionControlAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the UpdateActionControlAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdateActionControlAssignmentOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the UpdateActionControlAssignmentOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + } + + protected UpdateActionControlAssignmentOptions() { } + + protected UpdateActionControlAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId 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.templateVersion, + "templateVersion cannot be null"); + assignmentId = builder.assignmentId; + ifMatch = builder.ifMatch; + templateVersion = builder.templateVersion; + } + + /** + * New builder. + * + * @return a UpdateActionControlAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Action control template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating an action control assignment and must match the Etag value of the existing action + * control assignment. The Etag can be retrieved using the GET /v1/action_control_assignments/{assignment_id} API and + * looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the templateVersion. + * + * The version number of the template used to identify different versions of same template. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java new file mode 100644 index 00000000000..869eb357802 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java @@ -0,0 +1,196 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updatePolicyAssignment options. + */ +public class UpdatePolicyAssignmentOptions extends GenericModel { + + protected String assignmentId; + protected String version; + protected String ifMatch; + protected String templateVersion; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + private String version; + private String ifMatch; + private String templateVersion; + + /** + * Instantiates a new Builder from an existing UpdatePolicyAssignmentOptions instance. + * + * @param updatePolicyAssignmentOptions the instance to initialize the Builder with + */ + private Builder(UpdatePolicyAssignmentOptions updatePolicyAssignmentOptions) { + this.assignmentId = updatePolicyAssignmentOptions.assignmentId; + this.version = updatePolicyAssignmentOptions.version; + this.ifMatch = updatePolicyAssignmentOptions.ifMatch; + this.templateVersion = updatePolicyAssignmentOptions.templateVersion; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + * @param version the version + * @param ifMatch the ifMatch + * @param templateVersion the templateVersion + */ + public Builder(String assignmentId, String version, String ifMatch, String templateVersion) { + this.assignmentId = assignmentId; + this.version = version; + this.ifMatch = ifMatch; + this.templateVersion = templateVersion; + } + + /** + * Builds a UpdatePolicyAssignmentOptions. + * + * @return the new UpdatePolicyAssignmentOptions instance + */ + public UpdatePolicyAssignmentOptions build() { + return new UpdatePolicyAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the UpdatePolicyAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the UpdatePolicyAssignmentOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdatePolicyAssignmentOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the UpdatePolicyAssignmentOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + } + + protected UpdatePolicyAssignmentOptions() { } + + protected UpdatePolicyAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templateVersion, + "templateVersion cannot be null"); + assignmentId = builder.assignmentId; + version = builder.version; + ifMatch = builder.ifMatch; + templateVersion = builder.templateVersion; + } + + /** + * New builder. + * + * @return a UpdatePolicyAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * The policy template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } + + /** + * Gets the version. + * + * specify version of response body format. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy assignment and must match the Etag value of the existing policy + * assignment. The Etag can be retrieved using the GET /v1/policy_assignments/{assignment_id} API and looking at the + * Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the templateVersion. + * + * The policy template version to update to. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java new file mode 100644 index 00000000000..a28b357641f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java @@ -0,0 +1,171 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updatePolicyState options. + */ +public class UpdatePolicyStateOptions extends GenericModel { + + /** + * The policy state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String policyId; + protected String ifMatch; + protected String state; + + /** + * Builder. + */ + public static class Builder { + private String policyId; + private String ifMatch; + private String state; + + /** + * Instantiates a new Builder from an existing UpdatePolicyStateOptions instance. + * + * @param updatePolicyStateOptions the instance to initialize the Builder with + */ + private Builder(UpdatePolicyStateOptions updatePolicyStateOptions) { + this.policyId = updatePolicyStateOptions.policyId; + this.ifMatch = updatePolicyStateOptions.ifMatch; + this.state = updatePolicyStateOptions.state; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyId the policyId + * @param ifMatch the ifMatch + */ + public Builder(String policyId, String ifMatch) { + this.policyId = policyId; + this.ifMatch = ifMatch; + } + + /** + * Builds a UpdatePolicyStateOptions. + * + * @return the new UpdatePolicyStateOptions instance + */ + public UpdatePolicyStateOptions build() { + return new UpdatePolicyStateOptions(this); + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the UpdatePolicyStateOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdatePolicyStateOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the UpdatePolicyStateOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + } + + protected UpdatePolicyStateOptions() { } + + protected UpdatePolicyStateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + policyId = builder.policyId; + ifMatch = builder.ifMatch; + state = builder.state; + } + + /** + * New builder. + * + * @return a UpdatePolicyStateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyId. + * + * The policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be + * retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the state. + * + * The policy state. + * + * @return the state + */ + public String state() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java new file mode 100644 index 00000000000..f10cba5fe93 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java @@ -0,0 +1,166 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updateRoleAssignment options. + */ +public class UpdateRoleAssignmentOptions extends GenericModel { + + protected String assignmentId; + protected String ifMatch; + protected String templateVersion; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + private String ifMatch; + private String templateVersion; + + /** + * Instantiates a new Builder from an existing UpdateRoleAssignmentOptions instance. + * + * @param updateRoleAssignmentOptions the instance to initialize the Builder with + */ + private Builder(UpdateRoleAssignmentOptions updateRoleAssignmentOptions) { + this.assignmentId = updateRoleAssignmentOptions.assignmentId; + this.ifMatch = updateRoleAssignmentOptions.ifMatch; + this.templateVersion = updateRoleAssignmentOptions.templateVersion; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + * @param ifMatch the ifMatch + * @param templateVersion the templateVersion + */ + public Builder(String assignmentId, String ifMatch, String templateVersion) { + this.assignmentId = assignmentId; + this.ifMatch = ifMatch; + this.templateVersion = templateVersion; + } + + /** + * Builds a UpdateRoleAssignmentOptions. + * + * @return the new UpdateRoleAssignmentOptions instance + */ + public UpdateRoleAssignmentOptions build() { + return new UpdateRoleAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the UpdateRoleAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdateRoleAssignmentOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the UpdateRoleAssignmentOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + } + + protected UpdateRoleAssignmentOptions() { } + + protected UpdateRoleAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId 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.templateVersion, + "templateVersion cannot be null"); + assignmentId = builder.assignmentId; + ifMatch = builder.ifMatch; + templateVersion = builder.templateVersion; + } + + /** + * New builder. + * + * @return a UpdateRoleAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Role template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a role assignment and must match the Etag value of the existing role assignment. + * The Etag can be retrieved using the GET /v1/role_assignments/{assignment_id} API and looking at the Etag response + * header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the templateVersion. + * + * The version number of the template used to identify different versions of same template. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java new file mode 100644 index 00000000000..3d9dbb43fb3 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java @@ -0,0 +1,199 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updateSettings options. + */ +public class UpdateSettingsOptions extends GenericModel { + + protected String accountId; + protected String ifMatch; + protected ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String ifMatch; + private ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing UpdateSettingsOptions instance. + * + * @param updateSettingsOptions the instance to initialize the Builder with + */ + private Builder(UpdateSettingsOptions updateSettingsOptions) { + this.accountId = updateSettingsOptions.accountId; + this.ifMatch = updateSettingsOptions.ifMatch; + this.externalAccountIdentityInteraction = updateSettingsOptions.externalAccountIdentityInteraction; + this.acceptLanguage = updateSettingsOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + * @param ifMatch the ifMatch + */ + public Builder(String accountId, String ifMatch) { + this.accountId = accountId; + this.ifMatch = ifMatch; + } + + /** + * Builds a UpdateSettingsOptions. + * + * @return the new UpdateSettingsOptions instance + */ + public UpdateSettingsOptions build() { + return new UpdateSettingsOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the UpdateSettingsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdateSettingsOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the externalAccountIdentityInteraction. + * + * @param externalAccountIdentityInteraction the externalAccountIdentityInteraction + * @return the UpdateSettingsOptions builder + */ + public Builder externalAccountIdentityInteraction(ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction) { + this.externalAccountIdentityInteraction = externalAccountIdentityInteraction; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the UpdateSettingsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected UpdateSettingsOptions() { } + + protected UpdateSettingsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.accountId, + "accountId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + accountId = builder.accountId; + ifMatch = builder.ifMatch; + externalAccountIdentityInteraction = builder.externalAccountIdentityInteraction; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a UpdateSettingsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the settings belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating Access Management Account Settings and must match the Etag value of the existing + * Access Management Account Settings. The Etag can be retrieved using the GET + * /v1/accounts/{account_id}/settings/access_management API and looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the externalAccountIdentityInteraction. + * + * Update to how external accounts can interact in relation to the requested account. + * + * @return the externalAccountIdentityInteraction + */ + public ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction() { + return externalAccountIdentityInteraction; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java new file mode 100644 index 00000000000..fdae9e28c12 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * V2PoliciesPager can be used to simplify the use of the "listV2Policies" method. + */ +public class V2PoliciesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListV2PoliciesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected V2PoliciesPager() { } + + /** + * Constructs a new V2PoliciesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listV2Policies" method + * @param options the ListV2PoliciesOptions instance to be used to invoke the "listV2Policies" method + */ + public V2PoliciesPager(IamPolicyManagement client, ListV2PoliciesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<V2PolicyTemplateMetaData> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListV2PoliciesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + V2PolicyCollection result = client.listV2Policies(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getPolicies(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<V2PolicyTemplateMetaData> containing all results returned by the "listV2Policies" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java new file mode 100644 index 00000000000..842a354b7b1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java @@ -0,0 +1,247 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the policy. + */ +public class V2Policy extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + /** + * The policy state, either 'deleted' or 'active'. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String type; + protected String description; + protected V2PolicySubject subject; + protected V2PolicyResource resource; + protected String pattern; + protected V2PolicyRule rule; + protected String id; + protected String href; + protected ControlResponse control; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String state; + @SerializedName("last_permit_at") + protected String lastPermitAt; + @SerializedName("last_permit_frequency") + protected Long lastPermitFrequency; + + protected V2Policy() { } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject getSubject() { + return subject; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource getResource() { + return resource; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String getPattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule getRule() { + return rule; + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the policies API by policy ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the control. + * + * @return the control + */ + public ControlResponse getControl() { + return control; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the state. + * + * The policy state, either 'deleted' or 'active'. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the lastPermitAt. + * + * The optional last permit time of policy, when passing query parameter format=include_last_permit. + * + * @return the lastPermitAt + */ + public String getLastPermitAt() { + return lastPermitAt; + } + + /** + * Gets the lastPermitFrequency. + * + * The optional count of times that policy has provided a permit, when passing query parameter + * format=include_last_permit. + * + * @return the lastPermitFrequency + */ + public Long getLastPermitFrequency() { + return lastPermitFrequency; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java new file mode 100644 index 00000000000..d392025f8d8 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of policies. + */ +public class V2PolicyCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List policies; + + protected V2PolicyCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the policies. + * + * List of policies. + * + * @return the policies + */ + public List getPolicies() { + return policies; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java new file mode 100644 index 00000000000..caf8dd522a9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java @@ -0,0 +1,167 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The resource attributes to which the policy grants access. + */ +public class V2PolicyResource extends GenericModel { + + protected List attributes; + protected List tags; + + /** + * Builder. + */ + public static class Builder { + private List attributes; + private List tags; + + /** + * Instantiates a new Builder from an existing V2PolicyResource instance. + * + * @param v2PolicyResource the instance to initialize the Builder with + */ + private Builder(V2PolicyResource v2PolicyResource) { + this.attributes = v2PolicyResource.attributes; + this.tags = v2PolicyResource.tags; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param attributes the attributes + */ + public Builder(List attributes) { + this.attributes = attributes; + } + + /** + * Builds a V2PolicyResource. + * + * @return the new V2PolicyResource instance + */ + public V2PolicyResource build() { + return new V2PolicyResource(this); + } + + /** + * Adds a new element to attributes. + * + * @param attributes the new element to be added + * @return the V2PolicyResource builder + */ + public Builder addAttributes(V2PolicyResourceAttribute attributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, + "attributes cannot be null"); + if (this.attributes == null) { + this.attributes = new ArrayList(); + } + this.attributes.add(attributes); + return this; + } + + /** + * Adds a new element to tags. + * + * @param tags the new element to be added + * @return the V2PolicyResource builder + */ + public Builder addTags(V2PolicyResourceTag tags) { + com.ibm.cloud.sdk.core.util.Validator.notNull(tags, + "tags cannot be null"); + if (this.tags == null) { + this.tags = new ArrayList(); + } + this.tags.add(tags); + return this; + } + + /** + * Set the attributes. + * Existing attributes will be replaced. + * + * @param attributes the attributes + * @return the V2PolicyResource builder + */ + public Builder attributes(List attributes) { + this.attributes = attributes; + return this; + } + + /** + * Set the tags. + * Existing tags will be replaced. + * + * @param tags the tags + * @return the V2PolicyResource builder + */ + public Builder tags(List tags) { + this.tags = tags; + return this; + } + } + + protected V2PolicyResource() { } + + protected V2PolicyResource(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, + "attributes cannot be null"); + attributes = builder.attributes; + tags = builder.tags; + } + + /** + * New builder. + * + * @return a V2PolicyResource builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the attributes. + * + * List of resource attributes to which the policy grants access. + * + * @return the attributes + */ + public List attributes() { + return attributes; + } + + /** + * Gets the tags. + * + * Optional list of resource tags to which the policy grants access. + * + * @return the tags + */ + public List tags() { + return tags; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java new file mode 100644 index 00000000000..73e7cedd55e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java @@ -0,0 +1,181 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Resource attribute to which the policy grants access. + */ +public class V2PolicyResourceAttribute extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + } + + protected String key; + protected String operator; + protected Object value; + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing V2PolicyResourceAttribute instance. + * + * @param v2PolicyResourceAttribute the instance to initialize the Builder with + */ + private Builder(V2PolicyResourceAttribute v2PolicyResourceAttribute) { + this.key = v2PolicyResourceAttribute.key; + this.operator = v2PolicyResourceAttribute.operator; + this.value = v2PolicyResourceAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a V2PolicyResourceAttribute. + * + * @return the new V2PolicyResourceAttribute instance + */ + public V2PolicyResourceAttribute build() { + return new V2PolicyResourceAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the V2PolicyResourceAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicyResourceAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the V2PolicyResourceAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected V2PolicyResourceAttribute() { } + + protected V2PolicyResourceAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a V2PolicyResourceAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the key. + * + * The name of a resource attribute. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java new file mode 100644 index 00000000000..bb32772b8dc --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java @@ -0,0 +1,174 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A tag associated with a resource. + */ +public class V2PolicyResourceTag extends GenericModel { + + /** + * The operator of an access management tag. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + } + + protected String key; + protected String value; + protected String operator; + + /** + * Builder. + */ + public static class Builder { + private String key; + private String value; + private String operator; + + /** + * Instantiates a new Builder from an existing V2PolicyResourceTag instance. + * + * @param v2PolicyResourceTag the instance to initialize the Builder with + */ + private Builder(V2PolicyResourceTag v2PolicyResourceTag) { + this.key = v2PolicyResourceTag.key; + this.value = v2PolicyResourceTag.value; + this.operator = v2PolicyResourceTag.operator; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param value the value + * @param operator the operator + */ + public Builder(String key, String value, String operator) { + this.key = key; + this.value = value; + this.operator = operator; + } + + /** + * Builds a V2PolicyResourceTag. + * + * @return the new V2PolicyResourceTag instance + */ + public V2PolicyResourceTag build() { + return new V2PolicyResourceTag(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the V2PolicyResourceTag builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the V2PolicyResourceTag builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicyResourceTag builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + } + + protected V2PolicyResourceTag() { } + + protected V2PolicyResourceTag(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + key = builder.key; + value = builder.value; + operator = builder.operator; + } + + /** + * New builder. + * + * @return a V2PolicyResourceTag builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the key. + * + * The name of an access management tag. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the value. + * + * The value of an access management tag. + * + * @return the value + */ + public String value() { + return value; + } + + /** + * Gets the operator. + * + * The operator of an access management tag. + * + * @return the operator + */ + public String operator() { + return operator; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java new file mode 100644 index 00000000000..13a9f5fbd94 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java @@ -0,0 +1,126 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Additional access conditions associated with the policy. + * + * Classes which extend this class: + * - V2PolicyRuleRuleAttribute + * - V2PolicyRuleRuleWithNestedConditions + */ +public class V2PolicyRule extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + protected String key; + protected String operator; + protected Object value; + protected List conditions; + + protected V2PolicyRule() { } + + /** + * Gets the key. + * + * The name of an attribute. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } + + /** + * Gets the conditions. + * + * List of conditions associated with a policy. For example, time-based conditions that grant access over a certain + * time period. + * + * @return the conditions + */ + public List conditions() { + return conditions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java new file mode 100644 index 00000000000..c20b3a8cb0c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java @@ -0,0 +1,170 @@ +/* + * (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_policy_management.v1.model; + +/** + * Rule that specifies additional access that is granted (For example, time-based condition). + */ +public class V2PolicyRuleRuleAttribute extends V2PolicyRule { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing V2PolicyRuleRuleAttribute instance. + * + * @param v2PolicyRuleRuleAttribute the instance to initialize the Builder with + */ + public Builder(V2PolicyRule v2PolicyRuleRuleAttribute) { + this.key = v2PolicyRuleRuleAttribute.key; + this.operator = v2PolicyRuleRuleAttribute.operator; + this.value = v2PolicyRuleRuleAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a V2PolicyRuleRuleAttribute. + * + * @return the new V2PolicyRuleRuleAttribute instance + */ + public V2PolicyRuleRuleAttribute build() { + return new V2PolicyRuleRuleAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the V2PolicyRuleRuleAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicyRuleRuleAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the V2PolicyRuleRuleAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected V2PolicyRuleRuleAttribute() { } + + protected V2PolicyRuleRuleAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a V2PolicyRuleRuleAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java new file mode 100644 index 00000000000..8d6e57920f9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java @@ -0,0 +1,139 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * Rule that specifies additional access that is granted (for example, time-based condition) accross multiple + * conditions. + */ +public class V2PolicyRuleRuleWithNestedConditions extends V2PolicyRule { + + /** + * Operator to evaluate conditions. + */ + public interface Operator { + /** and. */ + String AND = "and"; + /** or. */ + String OR = "or"; + } + + + /** + * Builder. + */ + public static class Builder { + private String operator; + private List conditions; + + /** + * Instantiates a new Builder from an existing V2PolicyRuleRuleWithNestedConditions instance. + * + * @param v2PolicyRuleRuleWithNestedConditions the instance to initialize the Builder with + */ + public Builder(V2PolicyRule v2PolicyRuleRuleWithNestedConditions) { + this.operator = v2PolicyRuleRuleWithNestedConditions.operator; + this.conditions = v2PolicyRuleRuleWithNestedConditions.conditions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param operator the operator + * @param conditions the conditions + */ + public Builder(String operator, List conditions) { + this.operator = operator; + this.conditions = conditions; + } + + /** + * Builds a V2PolicyRuleRuleWithNestedConditions. + * + * @return the new V2PolicyRuleRuleWithNestedConditions instance + */ + public V2PolicyRuleRuleWithNestedConditions build() { + return new V2PolicyRuleRuleWithNestedConditions(this); + } + + /** + * Adds a new element to conditions. + * + * @param conditions the new element to be added + * @return the V2PolicyRuleRuleWithNestedConditions builder + */ + public Builder addConditions(NestedCondition conditions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(conditions, + "conditions cannot be null"); + if (this.conditions == null) { + this.conditions = new ArrayList(); + } + this.conditions.add(conditions); + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicyRuleRuleWithNestedConditions builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the conditions. + * Existing conditions will be replaced. + * + * @param conditions the conditions + * @return the V2PolicyRuleRuleWithNestedConditions builder + */ + public Builder conditions(List conditions) { + this.conditions = conditions; + return this; + } + } + + protected V2PolicyRuleRuleWithNestedConditions() { } + + protected V2PolicyRuleRuleWithNestedConditions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.conditions, + "conditions cannot be null"); + operator = builder.operator; + conditions = builder.conditions; + } + + /** + * New builder. + * + * @return a V2PolicyRuleRuleWithNestedConditions builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java new file mode 100644 index 00000000000..891513fd45a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java @@ -0,0 +1,124 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The subject attributes for whom the policy grants access. + */ +public class V2PolicySubject extends GenericModel { + + protected List attributes; + + /** + * Builder. + */ + public static class Builder { + private List attributes; + + /** + * Instantiates a new Builder from an existing V2PolicySubject instance. + * + * @param v2PolicySubject the instance to initialize the Builder with + */ + private Builder(V2PolicySubject v2PolicySubject) { + this.attributes = v2PolicySubject.attributes; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param attributes the attributes + */ + public Builder(List attributes) { + this.attributes = attributes; + } + + /** + * Builds a V2PolicySubject. + * + * @return the new V2PolicySubject instance + */ + public V2PolicySubject build() { + return new V2PolicySubject(this); + } + + /** + * Adds a new element to attributes. + * + * @param attributes the new element to be added + * @return the V2PolicySubject builder + */ + public Builder addAttributes(V2PolicySubjectAttribute attributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, + "attributes cannot be null"); + if (this.attributes == null) { + this.attributes = new ArrayList(); + } + this.attributes.add(attributes); + return this; + } + + /** + * Set the attributes. + * Existing attributes will be replaced. + * + * @param attributes the attributes + * @return the V2PolicySubject builder + */ + public Builder attributes(List attributes) { + this.attributes = attributes; + return this; + } + } + + protected V2PolicySubject() { } + + protected V2PolicySubject(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, + "attributes cannot be null"); + attributes = builder.attributes; + } + + /** + * New builder. + * + * @return a V2PolicySubject builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the attributes. + * + * List of subject attributes associated with policy. + * + * @return the attributes + */ + public List attributes() { + return attributes; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java new file mode 100644 index 00000000000..c90606429df --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java @@ -0,0 +1,175 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Subject attribute for whom the policy grants access. + */ +public class V2PolicySubjectAttribute extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + } + + protected String key; + protected String operator; + protected Object value; + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing V2PolicySubjectAttribute instance. + * + * @param v2PolicySubjectAttribute the instance to initialize the Builder with + */ + private Builder(V2PolicySubjectAttribute v2PolicySubjectAttribute) { + this.key = v2PolicySubjectAttribute.key; + this.operator = v2PolicySubjectAttribute.operator; + this.value = v2PolicySubjectAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a V2PolicySubjectAttribute. + * + * @return the new V2PolicySubjectAttribute instance + */ + public V2PolicySubjectAttribute build() { + return new V2PolicySubjectAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the V2PolicySubjectAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicySubjectAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the V2PolicySubjectAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected V2PolicySubjectAttribute() { } + + protected V2PolicySubjectAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a V2PolicySubjectAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the key. + * + * The name of a subject attribute. For example, iam_id, access_group_id. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java new file mode 100644 index 00000000000..720f7b57d4e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java @@ -0,0 +1,260 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the policy. + */ +public class V2PolicyTemplateMetaData extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + /** + * The policy state, either 'deleted' or 'active'. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String type; + protected String description; + protected V2PolicySubject subject; + protected V2PolicyResource resource; + protected String pattern; + protected V2PolicyRule rule; + protected String id; + protected String href; + protected ControlResponse control; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String state; + @SerializedName("last_permit_at") + protected String lastPermitAt; + @SerializedName("last_permit_frequency") + protected Long lastPermitFrequency; + protected TemplateMetadata template; + + protected V2PolicyTemplateMetaData() { } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject getSubject() { + return subject; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource getResource() { + return resource; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String getPattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule getRule() { + return rule; + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the policies API by policy ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the control. + * + * @return the control + */ + public ControlResponse getControl() { + return control; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the state. + * + * The policy state, either 'deleted' or 'active'. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the lastPermitAt. + * + * The optional last permit time of policy, when passing query parameter format=include_last_permit. + * + * @return the lastPermitAt + */ + public String getLastPermitAt() { + return lastPermitAt; + } + + /** + * Gets the lastPermitFrequency. + * + * The optional count of times that policy has provided a permit, when passing query parameter + * format=include_last_permit. + * + * @return the lastPermitFrequency + */ + public Long getLastPermitFrequency() { + return lastPermitFrequency; + } + + /** + * Gets the template. + * + * The details of the IAM template that was used to create an enterprise-managed policy in your account. When + * returned, this indicates that the policy is created from and managed by a template in the root enterprise account. + * + * @return the template + */ + public TemplateMetadata getTemplate() { + return template; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java new file mode 100644 index 00000000000..63a87389391 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java @@ -0,0 +1,17 @@ +/* + * (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. + */ + +/** + * IAM Policy Management v1. + */ +package com.ibm.cloud.platform_services.iam_policy_management.v1; diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java new file mode 100644 index 00000000000..b38933306a6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java @@ -0,0 +1,5007 @@ +/* + * (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_policy_management.v1; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplatesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponse; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControlWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedCondition; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleWithConditions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PoliciesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplatesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoleReferences; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PoliciesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRule; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleWithNestedConditions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.http.Response; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import okhttp3.mockwebserver.RecordedRequest; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the IamPolicyManagement service. + */ +public class IamPolicyManagementTest { + + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + protected MockWebServer server; + protected IamPolicyManagement iamPolicyManagementService; + + // Construct the service with a null authenticator (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testConstructorWithNullAuthenticator() throws Throwable { + final String serviceName = "testService"; + new IamPolicyManagement(serviceName, null); + } + + // Test the listPolicies operation with a valid options model parameter + @Test + public void testListPoliciesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policies\": [{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}]}"; + String listPoliciesPath = "/v1/policies"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListPoliciesOptions model + ListPoliciesOptions listPoliciesOptionsModel = new ListPoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .tagName("testString") + .tagValue("testString") + .sort("id") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listPolicies() with a valid options model and verify the result + Response response = iamPolicyManagementService.listPolicies(listPoliciesOptionsModel).execute(); + assertNotNull(response); + PolicyCollection 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, listPoliciesPath); + // 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("access_group_id"), "testString"); + assertEquals(query.get("type"), "access"); + assertEquals(query.get("service_type"), "service"); + assertEquals(query.get("tag_name"), "testString"); + assertEquals(query.get("tag_value"), "testString"); + assertEquals(query.get("sort"), "id"); + assertEquals(query.get("format"), "include_last_permit"); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listPolicies operation with and without retries enabled + @Test + public void testListPoliciesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListPoliciesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListPoliciesWOptions(); + } + + // Test the listPolicies operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPoliciesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listPolicies(null).execute(); + } + + // Test the listPolicies operation using the PoliciesPager.getNext() method + @Test + public void testListPoliciesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPoliciesOptions listPoliciesOptions = new ListPoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .tagName("testString") + .tagValue("testString") + .sort("id") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + PoliciesPager pager = new PoliciesPager(iamPolicyManagementService, listPoliciesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listPolicies operation using the PoliciesPager.getAll() method + @Test + public void testListPoliciesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPoliciesOptions listPoliciesOptions = new ListPoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .tagName("testString") + .tagValue("testString") + .sort("id") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + PoliciesPager pager = new PoliciesPager(iamPolicyManagementService, listPoliciesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createPolicy operation with a valid options model parameter + @Test + public void testCreatePolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; + String createPolicyPath = "/v1/policies"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the SubjectAttribute model + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + + // Construct an instance of the PolicySubject model + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + + // Construct an instance of the PolicyRole model + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the ResourceAttribute model + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + + // Construct an instance of the ResourceTag model + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + + // Construct an instance of the PolicyResource model + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + + // Construct an instance of the CreatePolicyOptions model + CreatePolicyOptions createPolicyOptionsModel = new CreatePolicyOptions.Builder() + .type("testString") + .subjects(java.util.Arrays.asList(policySubjectModel)) + .roles(java.util.Arrays.asList(policyRoleModel)) + .resources(java.util.Arrays.asList(policyResourceModel)) + .description("testString") + .acceptLanguage("default") + .build(); + + // Invoke createPolicy() with a valid options model and verify the result + Response response = iamPolicyManagementService.createPolicy(createPolicyOptionsModel).execute(); + assertNotNull(response); + Policy 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createPolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createPolicy operation with and without retries enabled + @Test + public void testCreatePolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreatePolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreatePolicyWOptions(); + } + + // Test the createPolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createPolicy(null).execute(); + } + + // Test the replacePolicy operation with a valid options model parameter + @Test + public void testReplacePolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; + String replacePolicyPath = "/v1/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the SubjectAttribute model + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + + // Construct an instance of the PolicySubject model + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + + // Construct an instance of the PolicyRole model + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the ResourceAttribute model + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + + // Construct an instance of the ResourceTag model + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + + // Construct an instance of the PolicyResource model + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + + // Construct an instance of the ReplacePolicyOptions model + ReplacePolicyOptions replacePolicyOptionsModel = new ReplacePolicyOptions.Builder() + .policyId("testString") + .ifMatch("testString") + .type("testString") + .subjects(java.util.Arrays.asList(policySubjectModel)) + .roles(java.util.Arrays.asList(policyRoleModel)) + .resources(java.util.Arrays.asList(policyResourceModel)) + .description("testString") + .build(); + + // Invoke replacePolicy() with a valid options model and verify the result + Response response = iamPolicyManagementService.replacePolicy(replacePolicyOptionsModel).execute(); + assertNotNull(response); + Policy 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, replacePolicyPath); + // 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 replacePolicy operation with and without retries enabled + @Test + public void testReplacePolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplacePolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplacePolicyWOptions(); + } + + // Test the replacePolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplacePolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replacePolicy(null).execute(); + } + + // Test the getPolicy operation with a valid options model parameter + @Test + public void testGetPolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}"; + String getPolicyPath = "/v1/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetPolicyOptions model + GetPolicyOptions getPolicyOptionsModel = new GetPolicyOptions.Builder() + .policyId("testString") + .build(); + + // Invoke getPolicy() with a valid options model and verify the result + Response response = iamPolicyManagementService.getPolicy(getPolicyOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateMetaData 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, getPolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getPolicy operation with and without retries enabled + @Test + public void testGetPolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetPolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetPolicyWOptions(); + } + + // Test the getPolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getPolicy(null).execute(); + } + + // Test the deletePolicy operation with a valid options model parameter + @Test + public void testDeletePolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deletePolicyPath = "/v1/policies/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeletePolicyOptions model + DeletePolicyOptions deletePolicyOptionsModel = new DeletePolicyOptions.Builder() + .policyId("testString") + .build(); + + // Invoke deletePolicy() with a valid options model and verify the result + Response response = iamPolicyManagementService.deletePolicy(deletePolicyOptionsModel).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, deletePolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deletePolicy operation with and without retries enabled + @Test + public void testDeletePolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeletePolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeletePolicyWOptions(); + } + + // Test the deletePolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deletePolicy(null).execute(); + } + + // Test the updatePolicyState operation with a valid options model parameter + @Test + public void testUpdatePolicyStateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; + String updatePolicyStatePath = "/v1/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdatePolicyStateOptions model + UpdatePolicyStateOptions updatePolicyStateOptionsModel = new UpdatePolicyStateOptions.Builder() + .policyId("testString") + .ifMatch("testString") + .state("active") + .build(); + + // Invoke updatePolicyState() with a valid options model and verify the result + Response response = iamPolicyManagementService.updatePolicyState(updatePolicyStateOptionsModel).execute(); + assertNotNull(response); + Policy 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updatePolicyStatePath); + // 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 updatePolicyState operation with and without retries enabled + @Test + public void testUpdatePolicyStateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdatePolicyStateWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdatePolicyStateWOptions(); + } + + // Test the updatePolicyState operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdatePolicyStateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updatePolicyState(null).execute(); + } + + // Test the listRoles operation with a valid options model parameter + @Test + public void testListRolesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"custom_roles\": [{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}], \"service_roles\": [{\"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\"}], \"system_roles\": [{\"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\"}]}"; + String listRolesPath = "/v2/roles"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListRolesOptions model + ListRolesOptions listRolesOptionsModel = new ListRolesOptions.Builder() + .acceptLanguage("default") + .accountId("testString") + .serviceName("iam-groups") + .sourceServiceName("iam-groups") + .policyType("authorization") + .serviceGroupId("IAM") + .build(); + + // Invoke listRoles() with a valid options model and verify the result + Response response = iamPolicyManagementService.listRoles(listRolesOptionsModel).execute(); + assertNotNull(response); + RoleCollection 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, listRolesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("service_name"), "iam-groups"); + assertEquals(query.get("source_service_name"), "iam-groups"); + assertEquals(query.get("policy_type"), "authorization"); + assertEquals(query.get("service_group_id"), "IAM"); + } + + // Test the listRoles operation with and without retries enabled + @Test + public void testListRolesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListRolesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListRolesWOptions(); + } + + // Test the createRole operation with a valid options model parameter + @Test + public void testCreateRoleWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; + String createRolePath = "/v2/roles"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the CreateRoleOptions model + CreateRoleOptions createRoleOptionsModel = new CreateRoleOptions.Builder() + .displayName("testString") + .actions(java.util.Arrays.asList("testString")) + .name("Developer") + .accountId("testString") + .serviceName("iam-groups") + .description("testString") + .acceptLanguage("default") + .build(); + + // Invoke createRole() with a valid options model and verify the result + Response response = iamPolicyManagementService.createRole(createRoleOptionsModel).execute(); + assertNotNull(response); + CustomRole 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createRolePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createRole operation with and without retries enabled + @Test + public void testCreateRoleWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateRoleWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateRoleWOptions(); + } + + // Test the createRole operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createRole(null).execute(); + } + + // Test the replaceRole operation with a valid options model parameter + @Test + public void testReplaceRoleWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; + String replaceRolePath = "/v2/roles/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ReplaceRoleOptions model + ReplaceRoleOptions replaceRoleOptionsModel = new ReplaceRoleOptions.Builder() + .roleId("testString") + .ifMatch("testString") + .displayName("testString") + .actions(java.util.Arrays.asList("testString")) + .description("testString") + .build(); + + // Invoke replaceRole() with a valid options model and verify the result + Response response = iamPolicyManagementService.replaceRole(replaceRoleOptionsModel).execute(); + assertNotNull(response); + CustomRole 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, replaceRolePath); + // 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 replaceRole operation with and without retries enabled + @Test + public void testReplaceRoleWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplaceRoleWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplaceRoleWOptions(); + } + + // Test the replaceRole operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceRoleNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replaceRole(null).execute(); + } + + // Test the getRole operation with a valid options model parameter + @Test + public void testGetRoleWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; + String getRolePath = "/v2/roles/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetRoleOptions model + GetRoleOptions getRoleOptionsModel = new GetRoleOptions.Builder() + .roleId("testString") + .build(); + + // Invoke getRole() with a valid options model and verify the result + Response response = iamPolicyManagementService.getRole(getRoleOptionsModel).execute(); + assertNotNull(response); + CustomRole 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, getRolePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getRole operation with and without retries enabled + @Test + public void testGetRoleWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetRoleWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetRoleWOptions(); + } + + // Test the getRole operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getRole(null).execute(); + } + + // Test the deleteRole operation with a valid options model parameter + @Test + public void testDeleteRoleWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteRolePath = "/v2/roles/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteRoleOptions model + DeleteRoleOptions deleteRoleOptionsModel = new DeleteRoleOptions.Builder() + .roleId("testString") + .build(); + + // Invoke deleteRole() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteRole(deleteRoleOptionsModel).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, deleteRolePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteRole operation with and without retries enabled + @Test + public void testDeleteRoleWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteRoleWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteRoleWOptions(); + } + + // Test the deleteRole operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteRole(null).execute(); + } + + // Test the listV2Policies operation with a valid options model parameter + @Test + public void testListV2PoliciesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policies\": [{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19, \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}]}"; + String listV2PoliciesPath = "/v2/policies"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListV2PoliciesOptions model + ListV2PoliciesOptions listV2PoliciesOptionsModel = new ListV2PoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .serviceName("testString") + .serviceGroupId("testString") + .sort("testString") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listV2Policies() with a valid options model and verify the result + Response response = iamPolicyManagementService.listV2Policies(listV2PoliciesOptionsModel).execute(); + assertNotNull(response); + V2PolicyCollection 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, listV2PoliciesPath); + // 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("access_group_id"), "testString"); + assertEquals(query.get("type"), "access"); + assertEquals(query.get("service_type"), "service"); + assertEquals(query.get("service_name"), "testString"); + assertEquals(query.get("service_group_id"), "testString"); + assertEquals(query.get("sort"), "testString"); + assertEquals(query.get("format"), "include_last_permit"); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listV2Policies operation with and without retries enabled + @Test + public void testListV2PoliciesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListV2PoliciesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListV2PoliciesWOptions(); + } + + // Test the listV2Policies operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListV2PoliciesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listV2Policies(null).execute(); + } + + // Test the listV2Policies operation using the V2PoliciesPager.getNext() method + @Test + public void testListV2PoliciesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListV2PoliciesOptions listV2PoliciesOptions = new ListV2PoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .serviceName("testString") + .serviceGroupId("testString") + .sort("testString") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + V2PoliciesPager pager = new V2PoliciesPager(iamPolicyManagementService, listV2PoliciesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listV2Policies operation using the V2PoliciesPager.getAll() method + @Test + public void testListV2PoliciesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListV2PoliciesOptions listV2PoliciesOptions = new ListV2PoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .serviceName("testString") + .serviceGroupId("testString") + .sort("testString") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + V2PoliciesPager pager = new V2PoliciesPager(iamPolicyManagementService, listV2PoliciesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createV2Policy operation with a valid options model parameter + @Test + public void testCreateV2PolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19}"; + String createV2PolicyPath = "/v2/policies"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the Grant model + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the Control model + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the CreateV2PolicyOptions model + CreateV2PolicyOptions createV2PolicyOptionsModel = new CreateV2PolicyOptions.Builder() + .control(controlModel) + .type("access") + .description("testString") + .subject(v2PolicySubjectModel) + .resource(v2PolicyResourceModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .acceptLanguage("default") + .build(); + + // Invoke createV2Policy() with a valid options model and verify the result + Response response = iamPolicyManagementService.createV2Policy(createV2PolicyOptionsModel).execute(); + assertNotNull(response); + V2Policy 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createV2PolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createV2Policy operation with and without retries enabled + @Test + public void testCreateV2PolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateV2PolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateV2PolicyWOptions(); + } + + // Test the createV2Policy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateV2PolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createV2Policy(null).execute(); + } + + // Test the replaceV2Policy operation with a valid options model parameter + @Test + public void testReplaceV2PolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19}"; + String replaceV2PolicyPath = "/v2/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the Grant model + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the Control model + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the ReplaceV2PolicyOptions model + ReplaceV2PolicyOptions replaceV2PolicyOptionsModel = new ReplaceV2PolicyOptions.Builder() + .id("testString") + .ifMatch("testString") + .control(controlModel) + .type("access") + .description("testString") + .subject(v2PolicySubjectModel) + .resource(v2PolicyResourceModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .build(); + + // Invoke replaceV2Policy() with a valid options model and verify the result + Response response = iamPolicyManagementService.replaceV2Policy(replaceV2PolicyOptionsModel).execute(); + assertNotNull(response); + V2Policy 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, replaceV2PolicyPath); + // 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 replaceV2Policy operation with and without retries enabled + @Test + public void testReplaceV2PolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplaceV2PolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplaceV2PolicyWOptions(); + } + + // Test the replaceV2Policy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceV2PolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replaceV2Policy(null).execute(); + } + + // Test the getV2Policy operation with a valid options model parameter + @Test + public void testGetV2PolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19, \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}"; + String getV2PolicyPath = "/v2/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetV2PolicyOptions model + GetV2PolicyOptions getV2PolicyOptionsModel = new GetV2PolicyOptions.Builder() + .id("testString") + .format("include_last_permit") + .build(); + + // Invoke getV2Policy() with a valid options model and verify the result + Response response = iamPolicyManagementService.getV2Policy(getV2PolicyOptionsModel).execute(); + assertNotNull(response); + V2PolicyTemplateMetaData 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, getV2PolicyPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("format"), "include_last_permit"); + } + + // Test the getV2Policy operation with and without retries enabled + @Test + public void testGetV2PolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetV2PolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetV2PolicyWOptions(); + } + + // Test the getV2Policy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetV2PolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getV2Policy(null).execute(); + } + + // Test the deleteV2Policy operation with a valid options model parameter + @Test + public void testDeleteV2PolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteV2PolicyPath = "/v2/policies/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteV2PolicyOptions model + DeleteV2PolicyOptions deleteV2PolicyOptionsModel = new DeleteV2PolicyOptions.Builder() + .id("testString") + .build(); + + // Invoke deleteV2Policy() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteV2Policy(deleteV2PolicyOptionsModel).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, deleteV2PolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteV2Policy operation with and without retries enabled + @Test + public void testDeleteV2PolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteV2PolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteV2PolicyWOptions(); + } + + // Test the deleteV2Policy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteV2PolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteV2Policy(null).execute(); + } + + // Test the listPolicyTemplates operation with a valid options model parameter + @Test + public void testListPolicyTemplatesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policy_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; + String listPolicyTemplatesPath = "/v1/policy_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListPolicyTemplatesOptions model + ListPolicyTemplatesOptions listPolicyTemplatesOptionsModel = new ListPolicyTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .state("active") + .name("testString") + .policyServiceType("service") + .policyServiceName("testString") + .policyServiceGroupId("testString") + .policyType("access") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listPolicyTemplates() with a valid options model and verify the result + Response response = iamPolicyManagementService.listPolicyTemplates(listPolicyTemplatesOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateCollection 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, listPolicyTemplatesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("state"), "active"); + assertEquals(query.get("name"), "testString"); + assertEquals(query.get("policy_service_type"), "service"); + assertEquals(query.get("policy_service_name"), "testString"); + assertEquals(query.get("policy_service_group_id"), "testString"); + assertEquals(query.get("policy_type"), "access"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listPolicyTemplates operation with and without retries enabled + @Test + public void testListPolicyTemplatesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListPolicyTemplatesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListPolicyTemplatesWOptions(); + } + + // Test the listPolicyTemplates operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyTemplatesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listPolicyTemplates(null).execute(); + } + + // Test the listPolicyTemplates operation using the PolicyTemplatesPager.getNext() method + @Test + public void testListPolicyTemplatesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyTemplatesOptions listPolicyTemplatesOptions = new ListPolicyTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .state("active") + .name("testString") + .policyServiceType("service") + .policyServiceName("testString") + .policyServiceGroupId("testString") + .policyType("access") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + PolicyTemplatesPager pager = new PolicyTemplatesPager(iamPolicyManagementService, listPolicyTemplatesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listPolicyTemplates operation using the PolicyTemplatesPager.getAll() method + @Test + public void testListPolicyTemplatesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyTemplatesOptions listPolicyTemplatesOptions = new ListPolicyTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .state("active") + .name("testString") + .policyServiceType("service") + .policyServiceName("testString") + .policyServiceGroupId("testString") + .policyType("access") + .limit(Long.valueOf("10")) + .build(); + + PolicyTemplatesPager pager = new PolicyTemplatesPager(iamPolicyManagementService, listPolicyTemplatesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createPolicyTemplate operation with a valid options model parameter + @Test + public void testCreatePolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; + String createPolicyTemplatePath = "/v1/policy_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the TemplateGrantRoles model + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the TemplateControl model + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + + // Construct an instance of the TemplatePolicy model + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + + // Construct an instance of the CreatePolicyTemplateOptions model + CreatePolicyTemplateOptions createPolicyTemplateOptionsModel = new CreatePolicyTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .policy(templatePolicyModel) + .description("testString") + .committed(true) + .acceptLanguage("default") + .build(); + + // Invoke createPolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.createPolicyTemplate(createPolicyTemplateOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateLimitData 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createPolicyTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createPolicyTemplate operation with and without retries enabled + @Test + public void testCreatePolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreatePolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreatePolicyTemplateWOptions(); + } + + // Test the createPolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createPolicyTemplate(null).execute(); + } + + // Test the getPolicyTemplate operation with a valid options model parameter + @Test + public void testGetPolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String getPolicyTemplatePath = "/v1/policy_templates/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetPolicyTemplateOptions model + GetPolicyTemplateOptions getPolicyTemplateOptionsModel = new GetPolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .state("active") + .build(); + + // Invoke getPolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.getPolicyTemplate(getPolicyTemplateOptionsModel).execute(); + assertNotNull(response); + PolicyTemplate 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, getPolicyTemplatePath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + } + + // Test the getPolicyTemplate operation with and without retries enabled + @Test + public void testGetPolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetPolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetPolicyTemplateWOptions(); + } + + // Test the getPolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getPolicyTemplate(null).execute(); + } + + // Test the deletePolicyTemplate operation with a valid options model parameter + @Test + public void testDeletePolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deletePolicyTemplatePath = "/v1/policy_templates/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeletePolicyTemplateOptions model + DeletePolicyTemplateOptions deletePolicyTemplateOptionsModel = new DeletePolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .build(); + + // Invoke deletePolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.deletePolicyTemplate(deletePolicyTemplateOptionsModel).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, deletePolicyTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deletePolicyTemplate operation with and without retries enabled + @Test + public void testDeletePolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeletePolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeletePolicyTemplateWOptions(); + } + + // Test the deletePolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deletePolicyTemplate(null).execute(); + } + + // Test the createPolicyTemplateVersion operation with a valid options model parameter + @Test + public void testCreatePolicyTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; + String createPolicyTemplateVersionPath = "/v1/policy_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the TemplateGrantRoles model + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the TemplateControl model + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + + // Construct an instance of the TemplatePolicy model + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + + // Construct an instance of the CreatePolicyTemplateVersionOptions model + CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptionsModel = new CreatePolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .policy(templatePolicyModel) + .name("testString") + .description("testString") + .committed(true) + .build(); + + // Invoke createPolicyTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.createPolicyTemplateVersion(createPolicyTemplateVersionOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateLimitData 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createPolicyTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createPolicyTemplateVersion operation with and without retries enabled + @Test + public void testCreatePolicyTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreatePolicyTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreatePolicyTemplateVersionWOptions(); + } + + // Test the createPolicyTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createPolicyTemplateVersion(null).execute(); + } + + // Test the listPolicyTemplateVersions operation with a valid options model parameter + @Test + public void testListPolicyTemplateVersionsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; + String listPolicyTemplateVersionsPath = "/v1/policy_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListPolicyTemplateVersionsOptions model + ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptionsModel = new ListPolicyTemplateVersionsOptions.Builder() + .policyTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listPolicyTemplateVersions() with a valid options model and verify the result + Response response = iamPolicyManagementService.listPolicyTemplateVersions(listPolicyTemplateVersionsOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateVersionsCollection 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, listPolicyTemplateVersionsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listPolicyTemplateVersions operation with and without retries enabled + @Test + public void testListPolicyTemplateVersionsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListPolicyTemplateVersionsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListPolicyTemplateVersionsWOptions(); + } + + // Test the listPolicyTemplateVersions operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyTemplateVersionsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listPolicyTemplateVersions(null).execute(); + } + + // Test the listPolicyTemplateVersions operation using the PolicyTemplateVersionsPager.getNext() method + @Test + public void testListPolicyTemplateVersionsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions = new ListPolicyTemplateVersionsOptions.Builder() + .policyTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + PolicyTemplateVersionsPager pager = new PolicyTemplateVersionsPager(iamPolicyManagementService, listPolicyTemplateVersionsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listPolicyTemplateVersions operation using the PolicyTemplateVersionsPager.getAll() method + @Test + public void testListPolicyTemplateVersionsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions = new ListPolicyTemplateVersionsOptions.Builder() + .policyTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + PolicyTemplateVersionsPager pager = new PolicyTemplateVersionsPager(iamPolicyManagementService, listPolicyTemplateVersionsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the replacePolicyTemplate operation with a valid options model parameter + @Test + public void testReplacePolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String replacePolicyTemplatePath = "/v1/policy_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the TemplateGrantRoles model + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the TemplateControl model + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + + // Construct an instance of the TemplatePolicy model + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + + // Construct an instance of the ReplacePolicyTemplateOptions model + ReplacePolicyTemplateOptions replacePolicyTemplateOptionsModel = new ReplacePolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .ifMatch("testString") + .policy(templatePolicyModel) + .name("testString") + .description("testString") + .committed(true) + .build(); + + // Invoke replacePolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.replacePolicyTemplate(replacePolicyTemplateOptionsModel).execute(); + assertNotNull(response); + PolicyTemplate 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, replacePolicyTemplatePath); + // 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 replacePolicyTemplate operation with and without retries enabled + @Test + public void testReplacePolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplacePolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplacePolicyTemplateWOptions(); + } + + // Test the replacePolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplacePolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replacePolicyTemplate(null).execute(); + } + + // Test the deletePolicyTemplateVersion operation with a valid options model parameter + @Test + public void testDeletePolicyTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deletePolicyTemplateVersionPath = "/v1/policy_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeletePolicyTemplateVersionOptions model + DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptionsModel = new DeletePolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + + // Invoke deletePolicyTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.deletePolicyTemplateVersion(deletePolicyTemplateVersionOptionsModel).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, deletePolicyTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deletePolicyTemplateVersion operation with and without retries enabled + @Test + public void testDeletePolicyTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeletePolicyTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeletePolicyTemplateVersionWOptions(); + } + + // Test the deletePolicyTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deletePolicyTemplateVersion(null).execute(); + } + + // Test the getPolicyTemplateVersion operation with a valid options model parameter + @Test + public void testGetPolicyTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String getPolicyTemplateVersionPath = "/v1/policy_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetPolicyTemplateVersionOptions model + GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptionsModel = new GetPolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + + // Invoke getPolicyTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.getPolicyTemplateVersion(getPolicyTemplateVersionOptionsModel).execute(); + assertNotNull(response); + PolicyTemplate 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, getPolicyTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getPolicyTemplateVersion operation with and without retries enabled + @Test + public void testGetPolicyTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetPolicyTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetPolicyTemplateVersionWOptions(); + } + + // Test the getPolicyTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getPolicyTemplateVersion(null).execute(); + } + + // Test the commitPolicyTemplate operation with a valid options model parameter + @Test + public void testCommitPolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String commitPolicyTemplatePath = "/v1/policy_templates/testString/versions/testString/commit"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the CommitPolicyTemplateOptions model + CommitPolicyTemplateOptions commitPolicyTemplateOptionsModel = new CommitPolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + + // Invoke commitPolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.commitPolicyTemplate(commitPolicyTemplateOptionsModel).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, commitPolicyTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the commitPolicyTemplate operation with and without retries enabled + @Test + public void testCommitPolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCommitPolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCommitPolicyTemplateWOptions(); + } + + // Test the commitPolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitPolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.commitPolicyTemplate(null).execute(); + } + + // Test the listPolicyAssignments operation with a valid options model parameter + @Test + public void testListPolicyAssignmentsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}]}"; + String listPolicyAssignmentsPath = "/v1/policy_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListPolicyAssignmentsOptions model + ListPolicyAssignmentsOptions listPolicyAssignmentsOptionsModel = new ListPolicyAssignmentsOptions.Builder() + .version("1.0") + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listPolicyAssignments() with a valid options model and verify the result + Response response = iamPolicyManagementService.listPolicyAssignments(listPolicyAssignmentsOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateAssignmentCollection 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, listPolicyAssignmentsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "1.0"); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("template_id"), "testString"); + assertEquals(query.get("template_version"), "testString"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listPolicyAssignments operation with and without retries enabled + @Test + public void testListPolicyAssignmentsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListPolicyAssignmentsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListPolicyAssignmentsWOptions(); + } + + // Test the listPolicyAssignments operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyAssignmentsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listPolicyAssignments(null).execute(); + } + + // Test the listPolicyAssignments operation using the PolicyAssignmentsPager.getNext() method + @Test + public void testListPolicyAssignmentsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyAssignmentsOptions listPolicyAssignmentsOptions = new ListPolicyAssignmentsOptions.Builder() + .version("1.0") + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + PolicyAssignmentsPager pager = new PolicyAssignmentsPager(iamPolicyManagementService, listPolicyAssignmentsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listPolicyAssignments operation using the PolicyAssignmentsPager.getAll() method + @Test + public void testListPolicyAssignmentsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyAssignmentsOptions listPolicyAssignmentsOptions = new ListPolicyAssignmentsOptions.Builder() + .version("1.0") + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + PolicyAssignmentsPager pager = new PolicyAssignmentsPager(iamPolicyManagementService, listPolicyAssignmentsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createPolicyTemplateAssignment operation with a valid options model parameter + @Test + public void testCreatePolicyTemplateAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}]}"; + String createPolicyTemplateAssignmentPath = "/v1/policy_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the AssignmentTargetDetails model + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + + // Construct an instance of the AssignmentTemplateDetails model + AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() + .id("testString") + .version("testString") + .build(); + + // Construct an instance of the CreatePolicyTemplateAssignmentOptions model + CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptionsModel = new CreatePolicyTemplateAssignmentOptions.Builder() + .version("1.0") + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(assignmentTemplateDetailsModel)) + .acceptLanguage("default") + .build(); + + // Invoke createPolicyTemplateAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.createPolicyTemplateAssignment(createPolicyTemplateAssignmentOptionsModel).execute(); + assertNotNull(response); + PolicyAssignmentV1Collection 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createPolicyTemplateAssignmentPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "1.0"); + } + + // Test the createPolicyTemplateAssignment operation with and without retries enabled + @Test + public void testCreatePolicyTemplateAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreatePolicyTemplateAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreatePolicyTemplateAssignmentWOptions(); + } + + // Test the createPolicyTemplateAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createPolicyTemplateAssignment(null).execute(); + } + + // Test the getPolicyAssignment operation with a valid options model parameter + @Test + public void testGetPolicyAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}"; + String getPolicyAssignmentPath = "/v1/policy_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetPolicyAssignmentOptions model + GetPolicyAssignmentOptions getPolicyAssignmentOptionsModel = new GetPolicyAssignmentOptions.Builder() + .assignmentId("testString") + .version("1.0") + .build(); + + // Invoke getPolicyAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.getPolicyAssignment(getPolicyAssignmentOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateAssignmentItems 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, getPolicyAssignmentPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "1.0"); + } + + // Test the getPolicyAssignment operation with and without retries enabled + @Test + public void testGetPolicyAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetPolicyAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetPolicyAssignmentWOptions(); + } + + // Test the getPolicyAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getPolicyAssignment(null).execute(); + } + + // Test the updatePolicyAssignment operation with a valid options model parameter + @Test + public void testUpdatePolicyAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}"; + String updatePolicyAssignmentPath = "/v1/policy_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdatePolicyAssignmentOptions model + UpdatePolicyAssignmentOptions updatePolicyAssignmentOptionsModel = new UpdatePolicyAssignmentOptions.Builder() + .assignmentId("testString") + .version("1.0") + .ifMatch("testString") + .templateVersion("testString") + .build(); + + // Invoke updatePolicyAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.updatePolicyAssignment(updatePolicyAssignmentOptionsModel).execute(); + assertNotNull(response); + PolicyAssignmentV1 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updatePolicyAssignmentPath); + // Verify header parameters + assertEquals(request.getHeader("If-Match"), "testString"); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "1.0"); + } + + // Test the updatePolicyAssignment operation with and without retries enabled + @Test + public void testUpdatePolicyAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdatePolicyAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdatePolicyAssignmentWOptions(); + } + + // Test the updatePolicyAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdatePolicyAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updatePolicyAssignment(null).execute(); + } + + // Test the deletePolicyAssignment operation with a valid options model parameter + @Test + public void testDeletePolicyAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deletePolicyAssignmentPath = "/v1/policy_assignments/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeletePolicyAssignmentOptions model + DeletePolicyAssignmentOptions deletePolicyAssignmentOptionsModel = new DeletePolicyAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke deletePolicyAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.deletePolicyAssignment(deletePolicyAssignmentOptionsModel).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, deletePolicyAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deletePolicyAssignment operation with and without retries enabled + @Test + public void testDeletePolicyAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeletePolicyAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeletePolicyAssignmentWOptions(); + } + + // Test the deletePolicyAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deletePolicyAssignment(null).execute(); + } + + // Test the getSettings operation with a valid options model parameter + @Test + public void testGetSettingsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"external_account_identity_interaction\": {\"identity_types\": {\"user\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service_id\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}}}}"; + String getSettingsPath = "/v1/accounts/testString/settings/access_management"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetSettingsOptions model + GetSettingsOptions getSettingsOptionsModel = new GetSettingsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .build(); + + // Invoke getSettings() with a valid options model and verify the result + Response response = iamPolicyManagementService.getSettings(getSettingsOptionsModel).execute(); + assertNotNull(response); + AccountSettingsAccessManagement 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, getSettingsPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getSettings operation with and without retries enabled + @Test + public void testGetSettingsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetSettingsWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetSettingsWOptions(); + } + + // Test the getSettings operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetSettingsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getSettings(null).execute(); + } + + // Test the updateSettings operation with a valid options model parameter + @Test + public void testUpdateSettingsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"external_account_identity_interaction\": {\"identity_types\": {\"user\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service_id\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}}}}"; + String updateSettingsPath = "/v1/accounts/testString/settings/access_management"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the IdentityTypesBase model + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the IdentityTypesPatch model + IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() + .user(identityTypesBaseModel) + .serviceId(identityTypesBaseModel) + .service(identityTypesBaseModel) + .build(); + + // Construct an instance of the ExternalAccountIdentityInteractionPatch model + ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() + .identityTypes(identityTypesPatchModel) + .build(); + + // Construct an instance of the UpdateSettingsOptions model + UpdateSettingsOptions updateSettingsOptionsModel = new UpdateSettingsOptions.Builder() + .accountId("testString") + .ifMatch("testString") + .externalAccountIdentityInteraction(externalAccountIdentityInteractionPatchModel) + .acceptLanguage("default") + .build(); + + // Invoke updateSettings() with a valid options model and verify the result + Response response = iamPolicyManagementService.updateSettings(updateSettingsOptionsModel).execute(); + assertNotNull(response); + AccountSettingsAccessManagement 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updateSettingsPath); + // 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 updateSettings operation with and without retries enabled + @Test + public void testUpdateSettingsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdateSettingsWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdateSettingsWOptions(); + } + + // Test the updateSettings operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateSettingsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updateSettings(null).execute(); + } + + // Test the listActionControlTemplates operation with a valid options model parameter + @Test + public void testListActionControlTemplatesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"action_control_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; + String listActionControlTemplatesPath = "/v1/action_control_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListActionControlTemplatesOptions model + ListActionControlTemplatesOptions listActionControlTemplatesOptionsModel = new ListActionControlTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listActionControlTemplates() with a valid options model and verify the result + Response response = iamPolicyManagementService.listActionControlTemplates(listActionControlTemplatesOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplateCollection 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, listActionControlTemplatesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listActionControlTemplates operation with and without retries enabled + @Test + public void testListActionControlTemplatesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListActionControlTemplatesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListActionControlTemplatesWOptions(); + } + + // Test the listActionControlTemplates operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlTemplatesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listActionControlTemplates(null).execute(); + } + + // Test the listActionControlTemplates operation using the ActionControlTemplatesPager.getNext() method + @Test + public void testListActionControlTemplatesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlTemplatesOptions listActionControlTemplatesOptions = new ListActionControlTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + ActionControlTemplatesPager pager = new ActionControlTemplatesPager(iamPolicyManagementService, listActionControlTemplatesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listActionControlTemplates operation using the ActionControlTemplatesPager.getAll() method + @Test + public void testListActionControlTemplatesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlTemplatesOptions listActionControlTemplatesOptions = new ListActionControlTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .limit(Long.valueOf("10")) + .build(); + + ActionControlTemplatesPager pager = new ActionControlTemplatesPager(iamPolicyManagementService, listActionControlTemplatesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createActionControlTemplate operation with a valid options model parameter + @Test + public void testCreateActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String createActionControlTemplatePath = "/v1/action_control_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateActionControl model + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the CreateActionControlTemplateOptions model + CreateActionControlTemplateOptions createActionControlTemplateOptionsModel = new CreateActionControlTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .description("testString") + .committed(true) + .actionControl(templateActionControlModel) + .acceptLanguage("default") + .build(); + + // Invoke createActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.createActionControlTemplate(createActionControlTemplateOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createActionControlTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createActionControlTemplate operation with and without retries enabled + @Test + public void testCreateActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateActionControlTemplateWOptions(); + } + + // Test the createActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createActionControlTemplate(null).execute(); + } + + // Test the getActionControlTemplate operation with a valid options model parameter + @Test + public void testGetActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String getActionControlTemplatePath = "/v1/action_control_templates/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetActionControlTemplateOptions model + GetActionControlTemplateOptions getActionControlTemplateOptionsModel = new GetActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .build(); + + // Invoke getActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.getActionControlTemplate(getActionControlTemplateOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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, getActionControlTemplatePath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + } + + // Test the getActionControlTemplate operation with and without retries enabled + @Test + public void testGetActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetActionControlTemplateWOptions(); + } + + // Test the getActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getActionControlTemplate(null).execute(); + } + + // Test the deleteActionControlTemplate operation with a valid options model parameter + @Test + public void testDeleteActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteActionControlTemplatePath = "/v1/action_control_templates/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteActionControlTemplateOptions model + DeleteActionControlTemplateOptions deleteActionControlTemplateOptionsModel = new DeleteActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .build(); + + // Invoke deleteActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteActionControlTemplate(deleteActionControlTemplateOptionsModel).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, deleteActionControlTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteActionControlTemplate operation with and without retries enabled + @Test + public void testDeleteActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteActionControlTemplateWOptions(); + } + + // Test the deleteActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteActionControlTemplate(null).execute(); + } + + // Test the createActionControlTemplateVersion operation with a valid options model parameter + @Test + public void testCreateActionControlTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String createActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateActionControl model + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the CreateActionControlTemplateVersionOptions model + CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptionsModel = new CreateActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .name("testString") + .description("testString") + .actionControl(templateActionControlModel) + .committed(true) + .build(); + + // Invoke createActionControlTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.createActionControlTemplateVersion(createActionControlTemplateVersionOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createActionControlTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createActionControlTemplateVersion operation with and without retries enabled + @Test + public void testCreateActionControlTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateActionControlTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateActionControlTemplateVersionWOptions(); + } + + // Test the createActionControlTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createActionControlTemplateVersion(null).execute(); + } + + // Test the listActionControlTemplateVersions operation with a valid options model parameter + @Test + public void testListActionControlTemplateVersionsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; + String listActionControlTemplateVersionsPath = "/v1/action_control_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListActionControlTemplateVersionsOptions model + ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptionsModel = new ListActionControlTemplateVersionsOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listActionControlTemplateVersions() with a valid options model and verify the result + Response response = iamPolicyManagementService.listActionControlTemplateVersions(listActionControlTemplateVersionsOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplateVersionsCollection 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, listActionControlTemplateVersionsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listActionControlTemplateVersions operation with and without retries enabled + @Test + public void testListActionControlTemplateVersionsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListActionControlTemplateVersionsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListActionControlTemplateVersionsWOptions(); + } + + // Test the listActionControlTemplateVersions operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlTemplateVersionsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listActionControlTemplateVersions(null).execute(); + } + + // Test the listActionControlTemplateVersions operation using the ActionControlTemplateVersionsPager.getNext() method + @Test + public void testListActionControlTemplateVersionsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions = new ListActionControlTemplateVersionsOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + ActionControlTemplateVersionsPager pager = new ActionControlTemplateVersionsPager(iamPolicyManagementService, listActionControlTemplateVersionsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listActionControlTemplateVersions operation using the ActionControlTemplateVersionsPager.getAll() method + @Test + public void testListActionControlTemplateVersionsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions = new ListActionControlTemplateVersionsOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + ActionControlTemplateVersionsPager pager = new ActionControlTemplateVersionsPager(iamPolicyManagementService, listActionControlTemplateVersionsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the replaceActionControlTemplate operation with a valid options model parameter + @Test + public void testReplaceActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String replaceActionControlTemplatePath = "/v1/action_control_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateActionControl model + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the ReplaceActionControlTemplateOptions model + ReplaceActionControlTemplateOptions replaceActionControlTemplateOptionsModel = new ReplaceActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .actionControl(templateActionControlModel) + .committed(true) + .build(); + + // Invoke replaceActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.replaceActionControlTemplate(replaceActionControlTemplateOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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, replaceActionControlTemplatePath); + // 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 replaceActionControlTemplate operation with and without retries enabled + @Test + public void testReplaceActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplaceActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplaceActionControlTemplateWOptions(); + } + + // Test the replaceActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replaceActionControlTemplate(null).execute(); + } + + // Test the deleteActionControlTemplateVersion operation with a valid options model parameter + @Test + public void testDeleteActionControlTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteActionControlTemplateVersionOptions model + DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptionsModel = new DeleteActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + + // Invoke deleteActionControlTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteActionControlTemplateVersion(deleteActionControlTemplateVersionOptionsModel).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, deleteActionControlTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteActionControlTemplateVersion operation with and without retries enabled + @Test + public void testDeleteActionControlTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteActionControlTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteActionControlTemplateVersionWOptions(); + } + + // Test the deleteActionControlTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteActionControlTemplateVersion(null).execute(); + } + + // Test the getActionControlTemplateVersion operation with a valid options model parameter + @Test + public void testGetActionControlTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String getActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetActionControlTemplateVersionOptions model + GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptionsModel = new GetActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + + // Invoke getActionControlTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.getActionControlTemplateVersion(getActionControlTemplateVersionOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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, getActionControlTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getActionControlTemplateVersion operation with and without retries enabled + @Test + public void testGetActionControlTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetActionControlTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetActionControlTemplateVersionWOptions(); + } + + // Test the getActionControlTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getActionControlTemplateVersion(null).execute(); + } + + // Test the commitActionControlTemplate operation with a valid options model parameter + @Test + public void testCommitActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String commitActionControlTemplatePath = "/v1/action_control_templates/testString/versions/testString/commit"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the CommitActionControlTemplateOptions model + CommitActionControlTemplateOptions commitActionControlTemplateOptionsModel = new CommitActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + + // Invoke commitActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.commitActionControlTemplate(commitActionControlTemplateOptionsModel).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, commitActionControlTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the commitActionControlTemplate operation with and without retries enabled + @Test + public void testCommitActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCommitActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCommitActionControlTemplateWOptions(); + } + + // Test the commitActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.commitActionControlTemplate(null).execute(); + } + + // Test the listActionControlAssignments operation with a valid options model parameter + @Test + public void testListActionControlAssignmentsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; + String listActionControlAssignmentsPath = "/v1/action_control_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListActionControlAssignmentsOptions model + ListActionControlAssignmentsOptions listActionControlAssignmentsOptionsModel = new ListActionControlAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listActionControlAssignments() with a valid options model and verify the result + Response response = iamPolicyManagementService.listActionControlAssignments(listActionControlAssignmentsOptionsModel).execute(); + assertNotNull(response); + ActionControlAssignmentCollection 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, listActionControlAssignmentsPath); + // 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(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listActionControlAssignments operation with and without retries enabled + @Test + public void testListActionControlAssignmentsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListActionControlAssignmentsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListActionControlAssignmentsWOptions(); + } + + // Test the listActionControlAssignments operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlAssignmentsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listActionControlAssignments(null).execute(); + } + + // Test the listActionControlAssignments operation using the ActionControlAssignmentsPager.getNext() method + @Test + public void testListActionControlAssignmentsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlAssignmentsOptions listActionControlAssignmentsOptions = new ListActionControlAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + ActionControlAssignmentsPager pager = new ActionControlAssignmentsPager(iamPolicyManagementService, listActionControlAssignmentsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listActionControlAssignments operation using the ActionControlAssignmentsPager.getAll() method + @Test + public void testListActionControlAssignmentsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlAssignmentsOptions listActionControlAssignmentsOptions = new ListActionControlAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + ActionControlAssignmentsPager pager = new ActionControlAssignmentsPager(iamPolicyManagementService, listActionControlAssignmentsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createActionControlTemplateAssignment operation with a valid options model parameter + @Test + public void testCreateActionControlTemplateAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; + String createActionControlTemplateAssignmentPath = "/v1/action_control_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the AssignmentTargetDetails model + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + + // Construct an instance of the ActionControlAssignmentTemplate model + ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + + // Construct an instance of the CreateActionControlTemplateAssignmentOptions model + CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptionsModel = new CreateActionControlTemplateAssignmentOptions.Builder() + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(actionControlAssignmentTemplateModel)) + .acceptLanguage("default") + .build(); + + // Invoke createActionControlTemplateAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.createActionControlTemplateAssignment(createActionControlTemplateAssignmentOptionsModel).execute(); + assertNotNull(response); + ActionControlAssignmentCollection 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createActionControlTemplateAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createActionControlTemplateAssignment operation with and without retries enabled + @Test + public void testCreateActionControlTemplateAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateActionControlTemplateAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateActionControlTemplateAssignmentWOptions(); + } + + // Test the createActionControlTemplateAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createActionControlTemplateAssignment(null).execute(); + } + + // Test the getActionControlAssignment operation with a valid options model parameter + @Test + public void testGetActionControlAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; + String getActionControlAssignmentPath = "/v1/action_control_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetActionControlAssignmentOptions model + GetActionControlAssignmentOptions getActionControlAssignmentOptionsModel = new GetActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke getActionControlAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.getActionControlAssignment(getActionControlAssignmentOptionsModel).execute(); + assertNotNull(response); + ActionControlAssignment 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, getActionControlAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getActionControlAssignment operation with and without retries enabled + @Test + public void testGetActionControlAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetActionControlAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetActionControlAssignmentWOptions(); + } + + // Test the getActionControlAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getActionControlAssignment(null).execute(); + } + + // Test the updateActionControlAssignment operation with a valid options model parameter + @Test + public void testUpdateActionControlAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; + String updateActionControlAssignmentPath = "/v1/action_control_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdateActionControlAssignmentOptions model + UpdateActionControlAssignmentOptions updateActionControlAssignmentOptionsModel = new UpdateActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .ifMatch("testString") + .templateVersion("testString") + .build(); + + // Invoke updateActionControlAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.updateActionControlAssignment(updateActionControlAssignmentOptionsModel).execute(); + assertNotNull(response); + ActionControlAssignment 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updateActionControlAssignmentPath); + // 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 updateActionControlAssignment operation with and without retries enabled + @Test + public void testUpdateActionControlAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdateActionControlAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdateActionControlAssignmentWOptions(); + } + + // Test the updateActionControlAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateActionControlAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updateActionControlAssignment(null).execute(); + } + + // Test the deleteActionControlAssignment operation with a valid options model parameter + @Test + public void testDeleteActionControlAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteActionControlAssignmentPath = "/v1/action_control_assignments/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteActionControlAssignmentOptions model + DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptionsModel = new DeleteActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke deleteActionControlAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteActionControlAssignment(deleteActionControlAssignmentOptionsModel).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, deleteActionControlAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteActionControlAssignment operation with and without retries enabled + @Test + public void testDeleteActionControlAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteActionControlAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteActionControlAssignmentWOptions(); + } + + // Test the deleteActionControlAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteActionControlAssignment(null).execute(); + } + + // Test the listRoleTemplates operation with a valid options model parameter + @Test + public void testListRoleTemplatesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"role_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; + String listRoleTemplatesPath = "/v1/role_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListRoleTemplatesOptions model + ListRoleTemplatesOptions listRoleTemplatesOptionsModel = new ListRoleTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .name("testString") + .roleName("testString") + .roleServiceName("testString") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listRoleTemplates() with a valid options model and verify the result + Response response = iamPolicyManagementService.listRoleTemplates(listRoleTemplatesOptionsModel).execute(); + assertNotNull(response); + RoleTemplateCollection 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, listRoleTemplatesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("name"), "testString"); + assertEquals(query.get("role_name"), "testString"); + assertEquals(query.get("role_service_name"), "testString"); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listRoleTemplates operation with and without retries enabled + @Test + public void testListRoleTemplatesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListRoleTemplatesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListRoleTemplatesWOptions(); + } + + // Test the listRoleTemplates operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleTemplatesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listRoleTemplates(null).execute(); + } + + // Test the listRoleTemplates operation using the RoleTemplatesPager.getNext() method + @Test + public void testListRoleTemplatesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleTemplatesOptions listRoleTemplatesOptions = new ListRoleTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .name("testString") + .roleName("testString") + .roleServiceName("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + RoleTemplatesPager pager = new RoleTemplatesPager(iamPolicyManagementService, listRoleTemplatesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listRoleTemplates operation using the RoleTemplatesPager.getAll() method + @Test + public void testListRoleTemplatesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleTemplatesOptions listRoleTemplatesOptions = new ListRoleTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .name("testString") + .roleName("testString") + .roleServiceName("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + RoleTemplatesPager pager = new RoleTemplatesPager(iamPolicyManagementService, listRoleTemplatesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createRoleTemplate operation with a valid options model parameter + @Test + public void testCreateRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String createRoleTemplatePath = "/v1/role_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the RoleTemplatePrototypeRole model + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() + .name("testString") + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the CreateRoleTemplateOptions model + CreateRoleTemplateOptions createRoleTemplateOptionsModel = new CreateRoleTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .description("testString") + .committed(true) + .role(roleTemplatePrototypeRoleModel) + .acceptLanguage("default") + .build(); + + // Invoke createRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.createRoleTemplate(createRoleTemplateOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createRoleTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createRoleTemplate operation with and without retries enabled + @Test + public void testCreateRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateRoleTemplateWOptions(); + } + + // Test the createRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createRoleTemplate(null).execute(); + } + + // Test the getRoleTemplate operation with a valid options model parameter + @Test + public void testGetRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String getRoleTemplatePath = "/v1/role_templates/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetRoleTemplateOptions model + GetRoleTemplateOptions getRoleTemplateOptionsModel = new GetRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .state("active") + .build(); + + // Invoke getRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.getRoleTemplate(getRoleTemplateOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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, getRoleTemplatePath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + } + + // Test the getRoleTemplate operation with and without retries enabled + @Test + public void testGetRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetRoleTemplateWOptions(); + } + + // Test the getRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getRoleTemplate(null).execute(); + } + + // Test the deleteRoleTemplate operation with a valid options model parameter + @Test + public void testDeleteRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteRoleTemplatePath = "/v1/role_templates/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteRoleTemplateOptions model + DeleteRoleTemplateOptions deleteRoleTemplateOptionsModel = new DeleteRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .build(); + + // Invoke deleteRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteRoleTemplate(deleteRoleTemplateOptionsModel).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, deleteRoleTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteRoleTemplate operation with and without retries enabled + @Test + public void testDeleteRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteRoleTemplateWOptions(); + } + + // Test the deleteRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteRoleTemplate(null).execute(); + } + + // Test the createRoleTemplateVersion operation with a valid options model parameter + @Test + public void testCreateRoleTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String createRoleTemplateVersionPath = "/v1/role_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateRole model + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the CreateRoleTemplateVersionOptions model + CreateRoleTemplateVersionOptions createRoleTemplateVersionOptionsModel = new CreateRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .name("testString") + .description("testString") + .role(templateRoleModel) + .committed(true) + .build(); + + // Invoke createRoleTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.createRoleTemplateVersion(createRoleTemplateVersionOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createRoleTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createRoleTemplateVersion operation with and without retries enabled + @Test + public void testCreateRoleTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateRoleTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateRoleTemplateVersionWOptions(); + } + + // Test the createRoleTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createRoleTemplateVersion(null).execute(); + } + + // Test the listRoleTemplateVersions operation with a valid options model parameter + @Test + public void testListRoleTemplateVersionsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; + String listRoleTemplateVersionsPath = "/v1/role_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListRoleTemplateVersionsOptions model + ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptionsModel = new ListRoleTemplateVersionsOptions.Builder() + .roleTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listRoleTemplateVersions() with a valid options model and verify the result + Response response = iamPolicyManagementService.listRoleTemplateVersions(listRoleTemplateVersionsOptionsModel).execute(); + assertNotNull(response); + RoleTemplateVersionsCollection 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, listRoleTemplateVersionsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listRoleTemplateVersions operation with and without retries enabled + @Test + public void testListRoleTemplateVersionsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListRoleTemplateVersionsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListRoleTemplateVersionsWOptions(); + } + + // Test the listRoleTemplateVersions operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleTemplateVersionsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listRoleTemplateVersions(null).execute(); + } + + // Test the listRoleTemplateVersions operation using the RoleTemplateVersionsPager.getNext() method + @Test + public void testListRoleTemplateVersionsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions = new ListRoleTemplateVersionsOptions.Builder() + .roleTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + RoleTemplateVersionsPager pager = new RoleTemplateVersionsPager(iamPolicyManagementService, listRoleTemplateVersionsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listRoleTemplateVersions operation using the RoleTemplateVersionsPager.getAll() method + @Test + public void testListRoleTemplateVersionsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions = new ListRoleTemplateVersionsOptions.Builder() + .roleTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + RoleTemplateVersionsPager pager = new RoleTemplateVersionsPager(iamPolicyManagementService, listRoleTemplateVersionsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the replaceRoleTemplate operation with a valid options model parameter + @Test + public void testReplaceRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String replaceRoleTemplatePath = "/v1/role_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateRole model + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the ReplaceRoleTemplateOptions model + ReplaceRoleTemplateOptions replaceRoleTemplateOptionsModel = new ReplaceRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .role(templateRoleModel) + .committed(true) + .build(); + + // Invoke replaceRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.replaceRoleTemplate(replaceRoleTemplateOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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, replaceRoleTemplatePath); + // 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 replaceRoleTemplate operation with and without retries enabled + @Test + public void testReplaceRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplaceRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplaceRoleTemplateWOptions(); + } + + // Test the replaceRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replaceRoleTemplate(null).execute(); + } + + // Test the deleteRoleTemplateVersion operation with a valid options model parameter + @Test + public void testDeleteRoleTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteRoleTemplateVersionPath = "/v1/role_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteRoleTemplateVersionOptions model + DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptionsModel = new DeleteRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + + // Invoke deleteRoleTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteRoleTemplateVersion(deleteRoleTemplateVersionOptionsModel).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, deleteRoleTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteRoleTemplateVersion operation with and without retries enabled + @Test + public void testDeleteRoleTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteRoleTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteRoleTemplateVersionWOptions(); + } + + // Test the deleteRoleTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteRoleTemplateVersion(null).execute(); + } + + // Test the getRoleTemplateVersion operation with a valid options model parameter + @Test + public void testGetRoleTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String getRoleTemplateVersionPath = "/v1/role_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetRoleTemplateVersionOptions model + GetRoleTemplateVersionOptions getRoleTemplateVersionOptionsModel = new GetRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + + // Invoke getRoleTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.getRoleTemplateVersion(getRoleTemplateVersionOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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, getRoleTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getRoleTemplateVersion operation with and without retries enabled + @Test + public void testGetRoleTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetRoleTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetRoleTemplateVersionWOptions(); + } + + // Test the getRoleTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getRoleTemplateVersion(null).execute(); + } + + // Test the commitRoleTemplate operation with a valid options model parameter + @Test + public void testCommitRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String commitRoleTemplatePath = "/v1/role_templates/testString/versions/testString/commit"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the CommitRoleTemplateOptions model + CommitRoleTemplateOptions commitRoleTemplateOptionsModel = new CommitRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + + // Invoke commitRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.commitRoleTemplate(commitRoleTemplateOptionsModel).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, commitRoleTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the commitRoleTemplate operation with and without retries enabled + @Test + public void testCommitRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCommitRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCommitRoleTemplateWOptions(); + } + + // Test the commitRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.commitRoleTemplate(null).execute(); + } + + // Test the listRoleAssignments operation with a valid options model parameter + @Test + public void testListRoleAssignmentsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; + String listRoleAssignmentsPath = "/v1/role_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListRoleAssignmentsOptions model + ListRoleAssignmentsOptions listRoleAssignmentsOptionsModel = new ListRoleAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listRoleAssignments() with a valid options model and verify the result + Response response = iamPolicyManagementService.listRoleAssignments(listRoleAssignmentsOptionsModel).execute(); + assertNotNull(response); + RoleAssignmentCollection 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, listRoleAssignmentsPath); + // 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(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listRoleAssignments operation with and without retries enabled + @Test + public void testListRoleAssignmentsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListRoleAssignmentsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListRoleAssignmentsWOptions(); + } + + // Test the listRoleAssignments operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleAssignmentsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listRoleAssignments(null).execute(); + } + + // Test the listRoleAssignments operation using the RoleAssignmentsPager.getNext() method + @Test + public void testListRoleAssignmentsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleAssignmentsOptions listRoleAssignmentsOptions = new ListRoleAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + RoleAssignmentsPager pager = new RoleAssignmentsPager(iamPolicyManagementService, listRoleAssignmentsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listRoleAssignments operation using the RoleAssignmentsPager.getAll() method + @Test + public void testListRoleAssignmentsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleAssignmentsOptions listRoleAssignmentsOptions = new ListRoleAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + RoleAssignmentsPager pager = new RoleAssignmentsPager(iamPolicyManagementService, listRoleAssignmentsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createRoleTemplateAssignment operation with a valid options model parameter + @Test + public void testCreateRoleTemplateAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; + String createRoleTemplateAssignmentPath = "/v1/role_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the AssignmentTargetDetails model + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + + // Construct an instance of the RoleAssignmentTemplate model + RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + + // Construct an instance of the CreateRoleTemplateAssignmentOptions model + CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptionsModel = new CreateRoleTemplateAssignmentOptions.Builder() + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(roleAssignmentTemplateModel)) + .acceptLanguage("default") + .build(); + + // Invoke createRoleTemplateAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.createRoleTemplateAssignment(createRoleTemplateAssignmentOptionsModel).execute(); + assertNotNull(response); + RoleAssignmentCollection 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createRoleTemplateAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createRoleTemplateAssignment operation with and without retries enabled + @Test + public void testCreateRoleTemplateAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateRoleTemplateAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateRoleTemplateAssignmentWOptions(); + } + + // Test the createRoleTemplateAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createRoleTemplateAssignment(null).execute(); + } + + // Test the getRoleAssignment operation with a valid options model parameter + @Test + public void testGetRoleAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; + String getRoleAssignmentPath = "/v1/role_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetRoleAssignmentOptions model + GetRoleAssignmentOptions getRoleAssignmentOptionsModel = new GetRoleAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke getRoleAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.getRoleAssignment(getRoleAssignmentOptionsModel).execute(); + assertNotNull(response); + RoleAssignment 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, getRoleAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getRoleAssignment operation with and without retries enabled + @Test + public void testGetRoleAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetRoleAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetRoleAssignmentWOptions(); + } + + // Test the getRoleAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getRoleAssignment(null).execute(); + } + + // Test the updateRoleAssignment operation with a valid options model parameter + @Test + public void testUpdateRoleAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; + String updateRoleAssignmentPath = "/v1/role_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdateRoleAssignmentOptions model + UpdateRoleAssignmentOptions updateRoleAssignmentOptionsModel = new UpdateRoleAssignmentOptions.Builder() + .assignmentId("testString") + .ifMatch("testString") + .templateVersion("testString") + .build(); + + // Invoke updateRoleAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.updateRoleAssignment(updateRoleAssignmentOptionsModel).execute(); + assertNotNull(response); + RoleAssignment 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updateRoleAssignmentPath); + // 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 updateRoleAssignment operation with and without retries enabled + @Test + public void testUpdateRoleAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdateRoleAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdateRoleAssignmentWOptions(); + } + + // Test the updateRoleAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateRoleAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updateRoleAssignment(null).execute(); + } + + // Test the deleteRoleAssignment operation with a valid options model parameter + @Test + public void testDeleteRoleAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteRoleAssignmentPath = "/v1/role_assignments/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteRoleAssignmentOptions model + DeleteRoleAssignmentOptions deleteRoleAssignmentOptionsModel = new DeleteRoleAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke deleteRoleAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteRoleAssignment(deleteRoleAssignmentOptionsModel).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, deleteRoleAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteRoleAssignment operation with and without retries enabled + @Test + public void testDeleteRoleAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteRoleAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteRoleAssignmentWOptions(); + } + + // Test the deleteRoleAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteRoleAssignment(null).execute(); + } + + // Perform setup needed before each test method + @BeforeMethod + public void beforeEachTest() { + // Start the mock server. + try { + server = new MockWebServer(); + server.start(); + } catch (IOException err) { + fail("Failed to instantiate mock web server"); + } + + // Construct an instance of the service + constructClientService(); + } + + // Perform tear down after each test method + @AfterMethod + public void afterEachTest() throws IOException { + server.shutdown(); + iamPolicyManagementService = null; + } + + // Constructs an instance of the service to be used by the tests + public void constructClientService() { + System.setProperty("TESTSERVICE_AUTH_TYPE", "noAuth"); + final String serviceName = "testService"; + + iamPolicyManagementService = IamPolicyManagement.newInstance(serviceName); + String url = server.url("/").toString(); + iamPolicyManagementService.setServiceUrl(url); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java new file mode 100644 index 00000000000..5630ccb0c03 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.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 AccountSettingsAccessManagement model. + */ +public class AccountSettingsAccessManagementTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAccountSettingsAccessManagement() throws Throwable { + AccountSettingsAccessManagement accountSettingsAccessManagementModel = new AccountSettingsAccessManagement(); + assertNull(accountSettingsAccessManagementModel.getExternalAccountIdentityInteraction()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java new file mode 100644 index 00000000000..d4dfc8863c6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentCollection model. + */ +public class ActionControlAssignmentCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentCollection() throws Throwable { + ActionControlAssignmentCollection actionControlAssignmentCollectionModel = new ActionControlAssignmentCollection(); + assertNull(actionControlAssignmentCollectionModel.getLimit()); + assertNull(actionControlAssignmentCollectionModel.getFirst()); + assertNull(actionControlAssignmentCollectionModel.getNext()); + assertNull(actionControlAssignmentCollectionModel.getPrevious()); + assertNull(actionControlAssignmentCollectionModel.getAssignments()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java new file mode 100644 index 00000000000..cb53bc44d1c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java @@ -0,0 +1,43 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResourceActionControl model. + */ +public class ActionControlAssignmentResourceActionControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentResourceActionControl() throws Throwable { + ActionControlAssignmentResourceActionControl actionControlAssignmentResourceActionControlModel = new ActionControlAssignmentResourceActionControl(); + assertNull(actionControlAssignmentResourceActionControlModel.getResourceCreated()); + assertNull(actionControlAssignmentResourceActionControlModel.getErrorMessage()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java new file mode 100644 index 00000000000..284ec17a0f0 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResourceCreated model. + */ +public class ActionControlAssignmentResourceCreatedTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentResourceCreated() throws Throwable { + ActionControlAssignmentResourceCreated actionControlAssignmentResourceCreatedModel = new ActionControlAssignmentResourceCreated(); + assertNull(actionControlAssignmentResourceCreatedModel.getId()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java new file mode 100644 index 00000000000..eaa560dce78 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResource model. + */ +public class ActionControlAssignmentResourceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentResource() throws Throwable { + ActionControlAssignmentResource actionControlAssignmentResourceModel = new ActionControlAssignmentResource(); + assertNull(actionControlAssignmentResourceModel.getTarget()); + assertNull(actionControlAssignmentResourceModel.getActionControl()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java new file mode 100644 index 00000000000..262a74bea45 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentTemplate model. + */ +public class ActionControlAssignmentTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentTemplate() throws Throwable { + ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(actionControlAssignmentTemplateModel.id(), "testString"); + assertEquals(actionControlAssignmentTemplateModel.version(), "testString"); + + String json = TestUtilities.serialize(actionControlAssignmentTemplateModel); + + ActionControlAssignmentTemplate actionControlAssignmentTemplateModelNew = TestUtilities.deserialize(json, ActionControlAssignmentTemplate.class); + assertTrue(actionControlAssignmentTemplateModelNew instanceof ActionControlAssignmentTemplate); + assertEquals(actionControlAssignmentTemplateModelNew.id(), "testString"); + assertEquals(actionControlAssignmentTemplateModelNew.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testActionControlAssignmentTemplateError() throws Throwable { + new ActionControlAssignmentTemplate.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java new file mode 100644 index 00000000000..c5173f940c4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignment model. + */ +public class ActionControlAssignmentTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignment() throws Throwable { + ActionControlAssignment actionControlAssignmentModel = new ActionControlAssignment(); + assertNull(actionControlAssignmentModel.getTemplate()); + assertNull(actionControlAssignmentModel.getTarget()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java new file mode 100644 index 00000000000..58155ee1e7e --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java @@ -0,0 +1,46 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplateCollection model. + */ +public class ActionControlTemplateCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlTemplateCollection() throws Throwable { + ActionControlTemplateCollection actionControlTemplateCollectionModel = new ActionControlTemplateCollection(); + assertNull(actionControlTemplateCollectionModel.getLimit()); + assertNull(actionControlTemplateCollectionModel.getFirst()); + assertNull(actionControlTemplateCollectionModel.getNext()); + assertNull(actionControlTemplateCollectionModel.getPrevious()); + assertNull(actionControlTemplateCollectionModel.getActionControlTemplates()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java new file mode 100644 index 00000000000..a086106a57e --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplate model. + */ +public class ActionControlTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlTemplate() throws Throwable { + ActionControlTemplate actionControlTemplateModel = new ActionControlTemplate(); + assertNull(actionControlTemplateModel.getName()); + assertNull(actionControlTemplateModel.getDescription()); + assertNull(actionControlTemplateModel.getAccountId()); + assertNull(actionControlTemplateModel.isCommitted()); + assertNull(actionControlTemplateModel.getActionControl()); + assertNull(actionControlTemplateModel.getVersion()); + assertNull(actionControlTemplateModel.getState()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java new file mode 100644 index 00000000000..7b6bf014357 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java @@ -0,0 +1,46 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplateVersionsCollection model. + */ +public class ActionControlTemplateVersionsCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlTemplateVersionsCollection() throws Throwable { + ActionControlTemplateVersionsCollection actionControlTemplateVersionsCollectionModel = new ActionControlTemplateVersionsCollection(); + assertNull(actionControlTemplateVersionsCollectionModel.getLimit()); + assertNull(actionControlTemplateVersionsCollectionModel.getFirst()); + assertNull(actionControlTemplateVersionsCollectionModel.getNext()); + assertNull(actionControlTemplateVersionsCollectionModel.getPrevious()); + assertNull(actionControlTemplateVersionsCollectionModel.getVersions()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java new file mode 100644 index 00000000000..4038d52606c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentResourceCreated model. + */ +public class AssignmentResourceCreatedTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAssignmentResourceCreated() throws Throwable { + AssignmentResourceCreated assignmentResourceCreatedModel = new AssignmentResourceCreated(); + assertNull(assignmentResourceCreatedModel.getId()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java new file mode 100644 index 00000000000..81e3799a42c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentResourceError model. + */ +public class AssignmentResourceErrorTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAssignmentResourceError() throws Throwable { + AssignmentResourceError assignmentResourceErrorModel = new AssignmentResourceError(); + assertNull(assignmentResourceErrorModel.getName()); + assertNull(assignmentResourceErrorModel.getErrorCode()); + assertNull(assignmentResourceErrorModel.getMessage()); + assertNull(assignmentResourceErrorModel.getCode()); + assertNull(assignmentResourceErrorModel.getErrors()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java new file mode 100644 index 00000000000..48e4a605cbb --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentTargetDetails model. + */ +public class AssignmentTargetDetailsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAssignmentTargetDetails() throws Throwable { + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + assertEquals(assignmentTargetDetailsModel.type(), "Account"); + assertEquals(assignmentTargetDetailsModel.id(), "testString"); + + String json = TestUtilities.serialize(assignmentTargetDetailsModel); + + AssignmentTargetDetails assignmentTargetDetailsModelNew = TestUtilities.deserialize(json, AssignmentTargetDetails.class); + assertTrue(assignmentTargetDetailsModelNew instanceof AssignmentTargetDetails); + assertEquals(assignmentTargetDetailsModelNew.type(), "Account"); + assertEquals(assignmentTargetDetailsModelNew.id(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testAssignmentTargetDetailsError() throws Throwable { + new AssignmentTargetDetails.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java new file mode 100644 index 00000000000..bcecf27ed27 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java @@ -0,0 +1,48 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentTemplateDetails model. + */ +public class AssignmentTemplateDetailsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAssignmentTemplateDetails() throws Throwable { + AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(assignmentTemplateDetailsModel.id(), "testString"); + assertEquals(assignmentTemplateDetailsModel.version(), "testString"); + + String json = TestUtilities.serialize(assignmentTemplateDetailsModel); + + AssignmentTemplateDetails assignmentTemplateDetailsModelNew = TestUtilities.deserialize(json, AssignmentTemplateDetails.class); + assertTrue(assignmentTemplateDetailsModelNew instanceof AssignmentTemplateDetails); + assertEquals(assignmentTemplateDetailsModelNew.id(), "testString"); + assertEquals(assignmentTemplateDetailsModelNew.version(), "testString"); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..2b5ed42c76a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CommitActionControlTemplateOptions model. + */ +public class CommitActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCommitActionControlTemplateOptions() throws Throwable { + CommitActionControlTemplateOptions commitActionControlTemplateOptionsModel = new CommitActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + assertEquals(commitActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(commitActionControlTemplateOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitActionControlTemplateOptionsError() throws Throwable { + new CommitActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..66cdca59588 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CommitPolicyTemplateOptions model. + */ +public class CommitPolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCommitPolicyTemplateOptions() throws Throwable { + CommitPolicyTemplateOptions commitPolicyTemplateOptionsModel = new CommitPolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + assertEquals(commitPolicyTemplateOptionsModel.policyTemplateId(), "testString"); + assertEquals(commitPolicyTemplateOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitPolicyTemplateOptionsError() throws Throwable { + new CommitPolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..09c48b8e80e --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CommitRoleTemplateOptions model. + */ +public class CommitRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCommitRoleTemplateOptions() throws Throwable { + CommitRoleTemplateOptions commitRoleTemplateOptionsModel = new CommitRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + assertEquals(commitRoleTemplateOptionsModel.roleTemplateId(), "testString"); + assertEquals(commitRoleTemplateOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitRoleTemplateOptionsError() throws Throwable { + new CommitRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java new file mode 100644 index 00000000000..94ef6ce21e8 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.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 ConflictsWith model. + */ +public class ConflictsWithTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testConflictsWith() throws Throwable { + ConflictsWith conflictsWithModel = new ConflictsWith(); + assertNull(conflictsWithModel.getEtag()); + assertNull(conflictsWithModel.getRole()); + assertNull(conflictsWithModel.getPolicy()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java new file mode 100644 index 00000000000..bbe19a7b9b1 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponseControl model. + */ +public class ControlResponseControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testControlResponseControl() throws Throwable { + ControlResponseControl controlResponseControlModel = new ControlResponseControl(); + assertNull(controlResponseControlModel.getGrant()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java new file mode 100644 index 00000000000..7b2fbfae90d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControlWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponseControlWithEnrichedRoles model. + */ +public class ControlResponseControlWithEnrichedRolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testControlResponseControlWithEnrichedRoles() throws Throwable { + ControlResponseControlWithEnrichedRoles controlResponseControlWithEnrichedRolesModel = new ControlResponseControlWithEnrichedRoles(); + assertNull(controlResponseControlWithEnrichedRolesModel.getGrant()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java new file mode 100644 index 00000000000..f42cbc0a2d8 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponse; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponse model. + */ +public class ControlResponseTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testControlResponse() throws Throwable { + ControlResponse controlResponseModel = new ControlResponse(); + assertNotNull(controlResponseModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java new file mode 100644 index 00000000000..c8b1e3000f9 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 Control model. + */ +public class ControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testControl() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + assertEquals(controlModel.grant(), grantModel); + + String json = TestUtilities.serialize(controlModel); + + Control controlModelNew = TestUtilities.deserialize(json, Control.class); + assertTrue(controlModelNew instanceof Control); + assertEquals(controlModelNew.grant().toString(), grantModel.toString()); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testControlError() throws Throwable { + new Control.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java new file mode 100644 index 00000000000..f2557c8f64f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateAssignmentOptions model. + */ +public class CreateActionControlTemplateAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateActionControlTemplateAssignmentOptions() throws Throwable { + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + assertEquals(assignmentTargetDetailsModel.type(), "Account"); + assertEquals(assignmentTargetDetailsModel.id(), "testString"); + + ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(actionControlAssignmentTemplateModel.id(), "testString"); + assertEquals(actionControlAssignmentTemplateModel.version(), "testString"); + + CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptionsModel = new CreateActionControlTemplateAssignmentOptions.Builder() + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(actionControlAssignmentTemplateModel)) + .acceptLanguage("default") + .build(); + assertEquals(createActionControlTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); + assertEquals(createActionControlTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(actionControlAssignmentTemplateModel)); + assertEquals(createActionControlTemplateAssignmentOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateAssignmentOptionsError() throws Throwable { + new CreateActionControlTemplateAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..2508072a03c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateOptions model. + */ +public class CreateActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateActionControlTemplateOptions() throws Throwable { + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateActionControlModel.serviceName(), "testString"); + assertEquals(templateActionControlModel.description(), "testString"); + assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); + + CreateActionControlTemplateOptions createActionControlTemplateOptionsModel = new CreateActionControlTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .description("testString") + .committed(true) + .actionControl(templateActionControlModel) + .acceptLanguage("default") + .build(); + assertEquals(createActionControlTemplateOptionsModel.name(), "testString"); + assertEquals(createActionControlTemplateOptionsModel.accountId(), "testString"); + assertEquals(createActionControlTemplateOptionsModel.description(), "testString"); + assertEquals(createActionControlTemplateOptionsModel.committed(), Boolean.valueOf(true)); + assertEquals(createActionControlTemplateOptionsModel.actionControl(), templateActionControlModel); + assertEquals(createActionControlTemplateOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateOptionsError() throws Throwable { + new CreateActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..d5070249115 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateVersionOptions model. + */ +public class CreateActionControlTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateActionControlTemplateVersionOptions() throws Throwable { + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateActionControlModel.serviceName(), "testString"); + assertEquals(templateActionControlModel.description(), "testString"); + assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); + + CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptionsModel = new CreateActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .name("testString") + .description("testString") + .actionControl(templateActionControlModel) + .committed(true) + .build(); + assertEquals(createActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(createActionControlTemplateVersionOptionsModel.name(), "testString"); + assertEquals(createActionControlTemplateVersionOptionsModel.description(), "testString"); + assertEquals(createActionControlTemplateVersionOptionsModel.actionControl(), templateActionControlModel); + assertEquals(createActionControlTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateVersionOptionsError() throws Throwable { + new CreateActionControlTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java new file mode 100644 index 00000000000..c2dd24fd213 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java @@ -0,0 +1,103 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyOptions model. + */ +public class CreatePolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreatePolicyOptions() throws Throwable { + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(subjectAttributeModel.name(), "testString"); + assertEquals(subjectAttributeModel.value(), "testString"); + + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); + + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + assertEquals(policyRoleModel.roleId(), "testString"); + + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceAttributeModel.name(), "testString"); + assertEquals(resourceAttributeModel.value(), "testString"); + assertEquals(resourceAttributeModel.operator(), "testString"); + + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceTagModel.name(), "testString"); + assertEquals(resourceTagModel.value(), "testString"); + assertEquals(resourceTagModel.operator(), "testString"); + + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); + assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); + + CreatePolicyOptions createPolicyOptionsModel = new CreatePolicyOptions.Builder() + .type("testString") + .subjects(java.util.Arrays.asList(policySubjectModel)) + .roles(java.util.Arrays.asList(policyRoleModel)) + .resources(java.util.Arrays.asList(policyResourceModel)) + .description("testString") + .acceptLanguage("default") + .build(); + assertEquals(createPolicyOptionsModel.type(), "testString"); + assertEquals(createPolicyOptionsModel.subjects(), java.util.Arrays.asList(policySubjectModel)); + assertEquals(createPolicyOptionsModel.roles(), java.util.Arrays.asList(policyRoleModel)); + assertEquals(createPolicyOptionsModel.resources(), java.util.Arrays.asList(policyResourceModel)); + assertEquals(createPolicyOptionsModel.description(), "testString"); + assertEquals(createPolicyOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyOptionsError() throws Throwable { + new CreatePolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java new file mode 100644 index 00000000000..5b08b4b398a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java @@ -0,0 +1,67 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateAssignmentOptions model. + */ +public class CreatePolicyTemplateAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreatePolicyTemplateAssignmentOptions() throws Throwable { + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + assertEquals(assignmentTargetDetailsModel.type(), "Account"); + assertEquals(assignmentTargetDetailsModel.id(), "testString"); + + AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(assignmentTemplateDetailsModel.id(), "testString"); + assertEquals(assignmentTemplateDetailsModel.version(), "testString"); + + CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptionsModel = new CreatePolicyTemplateAssignmentOptions.Builder() + .version("1.0") + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(assignmentTemplateDetailsModel)) + .acceptLanguage("default") + .build(); + assertEquals(createPolicyTemplateAssignmentOptionsModel.version(), "1.0"); + assertEquals(createPolicyTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); + assertEquals(createPolicyTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(assignmentTemplateDetailsModel)); + assertEquals(createPolicyTemplateAssignmentOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateAssignmentOptionsError() throws Throwable { + new CreatePolicyTemplateAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..68617451831 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java @@ -0,0 +1,145 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateOptions model. + */ +public class CreatePolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreatePolicyTemplateOptions() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + assertEquals(templatePolicyModel.type(), "access"); + assertEquals(templatePolicyModel.description(), "testString"); + assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); + assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); + assertEquals(templatePolicyModel.pattern(), "testString"); + assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); + assertEquals(templatePolicyModel.control(), templateControlModel); + + CreatePolicyTemplateOptions createPolicyTemplateOptionsModel = new CreatePolicyTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .policy(templatePolicyModel) + .description("testString") + .committed(true) + .acceptLanguage("default") + .build(); + assertEquals(createPolicyTemplateOptionsModel.name(), "testString"); + assertEquals(createPolicyTemplateOptionsModel.accountId(), "testString"); + assertEquals(createPolicyTemplateOptionsModel.policy(), templatePolicyModel); + assertEquals(createPolicyTemplateOptionsModel.description(), "testString"); + assertEquals(createPolicyTemplateOptionsModel.committed(), Boolean.valueOf(true)); + assertEquals(createPolicyTemplateOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateOptionsError() throws Throwable { + new CreatePolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..d6919e6e1b9 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java @@ -0,0 +1,143 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateVersionOptions model. + */ +public class CreatePolicyTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreatePolicyTemplateVersionOptions() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + assertEquals(templatePolicyModel.type(), "access"); + assertEquals(templatePolicyModel.description(), "testString"); + assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); + assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); + assertEquals(templatePolicyModel.pattern(), "testString"); + assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); + assertEquals(templatePolicyModel.control(), templateControlModel); + + CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptionsModel = new CreatePolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .policy(templatePolicyModel) + .name("testString") + .description("testString") + .committed(true) + .build(); + assertEquals(createPolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); + assertEquals(createPolicyTemplateVersionOptionsModel.policy(), templatePolicyModel); + assertEquals(createPolicyTemplateVersionOptionsModel.name(), "testString"); + assertEquals(createPolicyTemplateVersionOptionsModel.description(), "testString"); + assertEquals(createPolicyTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateVersionOptionsError() throws Throwable { + new CreatePolicyTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java new file mode 100644 index 00000000000..849512f2bda --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleOptions model. + */ +public class CreateRoleOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateRoleOptions() throws Throwable { + CreateRoleOptions createRoleOptionsModel = new CreateRoleOptions.Builder() + .displayName("testString") + .actions(java.util.Arrays.asList("testString")) + .name("Developer") + .accountId("testString") + .serviceName("iam-groups") + .description("testString") + .acceptLanguage("default") + .build(); + assertEquals(createRoleOptionsModel.displayName(), "testString"); + assertEquals(createRoleOptionsModel.actions(), java.util.Arrays.asList("testString")); + assertEquals(createRoleOptionsModel.name(), "Developer"); + assertEquals(createRoleOptionsModel.accountId(), "testString"); + assertEquals(createRoleOptionsModel.serviceName(), "iam-groups"); + assertEquals(createRoleOptionsModel.description(), "testString"); + assertEquals(createRoleOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleOptionsError() throws Throwable { + new CreateRoleOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java new file mode 100644 index 00000000000..bff414389a5 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateAssignmentOptions model. + */ +public class CreateRoleTemplateAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateRoleTemplateAssignmentOptions() throws Throwable { + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + assertEquals(assignmentTargetDetailsModel.type(), "Account"); + assertEquals(assignmentTargetDetailsModel.id(), "testString"); + + RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleAssignmentTemplateModel.id(), "testString"); + assertEquals(roleAssignmentTemplateModel.version(), "testString"); + + CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptionsModel = new CreateRoleTemplateAssignmentOptions.Builder() + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(roleAssignmentTemplateModel)) + .acceptLanguage("default") + .build(); + assertEquals(createRoleTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); + assertEquals(createRoleTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(roleAssignmentTemplateModel)); + assertEquals(createRoleTemplateAssignmentOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateAssignmentOptionsError() throws Throwable { + new CreateRoleTemplateAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..799743ddbf4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateOptions model. + */ +public class CreateRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateRoleTemplateOptions() throws Throwable { + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() + .name("testString") + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(roleTemplatePrototypeRoleModel.name(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.displayName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.serviceName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.description(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.actions(), java.util.Arrays.asList("testString")); + + CreateRoleTemplateOptions createRoleTemplateOptionsModel = new CreateRoleTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .description("testString") + .committed(true) + .role(roleTemplatePrototypeRoleModel) + .acceptLanguage("default") + .build(); + assertEquals(createRoleTemplateOptionsModel.name(), "testString"); + assertEquals(createRoleTemplateOptionsModel.accountId(), "testString"); + assertEquals(createRoleTemplateOptionsModel.description(), "testString"); + assertEquals(createRoleTemplateOptionsModel.committed(), Boolean.valueOf(true)); + assertEquals(createRoleTemplateOptionsModel.role(), roleTemplatePrototypeRoleModel); + assertEquals(createRoleTemplateOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateOptionsError() throws Throwable { + new CreateRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..a7d2d312afa --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateVersionOptions model. + */ +public class CreateRoleTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateRoleTemplateVersionOptions() throws Throwable { + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateRoleModel.displayName(), "testString"); + assertEquals(templateRoleModel.serviceName(), "testString"); + assertEquals(templateRoleModel.description(), "testString"); + assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); + + CreateRoleTemplateVersionOptions createRoleTemplateVersionOptionsModel = new CreateRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .name("testString") + .description("testString") + .role(templateRoleModel) + .committed(true) + .build(); + assertEquals(createRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); + assertEquals(createRoleTemplateVersionOptionsModel.name(), "testString"); + assertEquals(createRoleTemplateVersionOptionsModel.description(), "testString"); + assertEquals(createRoleTemplateVersionOptionsModel.role(), templateRoleModel); + assertEquals(createRoleTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateVersionOptionsError() throws Throwable { + new CreateRoleTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java new file mode 100644 index 00000000000..acce8b7b537 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java @@ -0,0 +1,131 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateV2PolicyOptions model. + */ +public class CreateV2PolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateV2PolicyOptions() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + assertEquals(controlModel.grant(), grantModel); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + CreateV2PolicyOptions createV2PolicyOptionsModel = new CreateV2PolicyOptions.Builder() + .control(controlModel) + .type("access") + .description("testString") + .subject(v2PolicySubjectModel) + .resource(v2PolicyResourceModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .acceptLanguage("default") + .build(); + assertEquals(createV2PolicyOptionsModel.control(), controlModel); + assertEquals(createV2PolicyOptionsModel.type(), "access"); + assertEquals(createV2PolicyOptionsModel.description(), "testString"); + assertEquals(createV2PolicyOptionsModel.subject(), v2PolicySubjectModel); + assertEquals(createV2PolicyOptionsModel.resource(), v2PolicyResourceModel); + assertEquals(createV2PolicyOptionsModel.pattern(), "testString"); + assertEquals(createV2PolicyOptionsModel.rule(), v2PolicyRuleModel); + assertEquals(createV2PolicyOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateV2PolicyOptionsError() throws Throwable { + new CreateV2PolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java new file mode 100644 index 00000000000..acc0dc0a3c1 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 CustomRole model. + */ +public class CustomRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCustomRole() throws Throwable { + CustomRole customRoleModel = new CustomRole(); + assertNull(customRoleModel.getDisplayName()); + assertNull(customRoleModel.getDescription()); + assertNull(customRoleModel.getActions()); + assertNull(customRoleModel.getName()); + assertNull(customRoleModel.getAccountId()); + assertNull(customRoleModel.getServiceName()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java new file mode 100644 index 00000000000..1a38606ede5 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlAssignmentOptions model. + */ +public class DeleteActionControlAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteActionControlAssignmentOptions() throws Throwable { + DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptionsModel = new DeleteActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(deleteActionControlAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlAssignmentOptionsError() throws Throwable { + new DeleteActionControlAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..75b111e9214 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlTemplateOptions model. + */ +public class DeleteActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteActionControlTemplateOptions() throws Throwable { + DeleteActionControlTemplateOptions deleteActionControlTemplateOptionsModel = new DeleteActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .build(); + assertEquals(deleteActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlTemplateOptionsError() throws Throwable { + new DeleteActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..64fb5790244 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlTemplateVersionOptions model. + */ +public class DeleteActionControlTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteActionControlTemplateVersionOptions() throws Throwable { + DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptionsModel = new DeleteActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + assertEquals(deleteActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(deleteActionControlTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlTemplateVersionOptionsError() throws Throwable { + new DeleteActionControlTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java new file mode 100644 index 00000000000..75aed905222 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyAssignmentOptions model. + */ +public class DeletePolicyAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeletePolicyAssignmentOptions() throws Throwable { + DeletePolicyAssignmentOptions deletePolicyAssignmentOptionsModel = new DeletePolicyAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(deletePolicyAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyAssignmentOptionsError() throws Throwable { + new DeletePolicyAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java new file mode 100644 index 00000000000..1b130eb0f79 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyOptions model. + */ +public class DeletePolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeletePolicyOptions() throws Throwable { + DeletePolicyOptions deletePolicyOptionsModel = new DeletePolicyOptions.Builder() + .policyId("testString") + .build(); + assertEquals(deletePolicyOptionsModel.policyId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyOptionsError() throws Throwable { + new DeletePolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..288517222aa --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyTemplateOptions model. + */ +public class DeletePolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeletePolicyTemplateOptions() throws Throwable { + DeletePolicyTemplateOptions deletePolicyTemplateOptionsModel = new DeletePolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .build(); + assertEquals(deletePolicyTemplateOptionsModel.policyTemplateId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyTemplateOptionsError() throws Throwable { + new DeletePolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..7b1c6cffa1d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyTemplateVersionOptions model. + */ +public class DeletePolicyTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeletePolicyTemplateVersionOptions() throws Throwable { + DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptionsModel = new DeletePolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + assertEquals(deletePolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); + assertEquals(deletePolicyTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyTemplateVersionOptionsError() throws Throwable { + new DeletePolicyTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java new file mode 100644 index 00000000000..7f9b614304f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleAssignmentOptions model. + */ +public class DeleteRoleAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteRoleAssignmentOptions() throws Throwable { + DeleteRoleAssignmentOptions deleteRoleAssignmentOptionsModel = new DeleteRoleAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(deleteRoleAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleAssignmentOptionsError() throws Throwable { + new DeleteRoleAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java new file mode 100644 index 00000000000..9c6690cda7b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleOptions model. + */ +public class DeleteRoleOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteRoleOptions() throws Throwable { + DeleteRoleOptions deleteRoleOptionsModel = new DeleteRoleOptions.Builder() + .roleId("testString") + .build(); + assertEquals(deleteRoleOptionsModel.roleId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleOptionsError() throws Throwable { + new DeleteRoleOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..3fc04286ed3 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleTemplateOptions model. + */ +public class DeleteRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteRoleTemplateOptions() throws Throwable { + DeleteRoleTemplateOptions deleteRoleTemplateOptionsModel = new DeleteRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .build(); + assertEquals(deleteRoleTemplateOptionsModel.roleTemplateId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleTemplateOptionsError() throws Throwable { + new DeleteRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..ff652fa335c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleTemplateVersionOptions model. + */ +public class DeleteRoleTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteRoleTemplateVersionOptions() throws Throwable { + DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptionsModel = new DeleteRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + assertEquals(deleteRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); + assertEquals(deleteRoleTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleTemplateVersionOptionsError() throws Throwable { + new DeleteRoleTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java new file mode 100644 index 00000000000..6a33aa8f116 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteV2PolicyOptions model. + */ +public class DeleteV2PolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteV2PolicyOptions() throws Throwable { + DeleteV2PolicyOptions deleteV2PolicyOptionsModel = new DeleteV2PolicyOptions.Builder() + .id("testString") + .build(); + assertEquals(deleteV2PolicyOptionsModel.id(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteV2PolicyOptionsError() throws Throwable { + new DeleteV2PolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java new file mode 100644 index 00000000000..104a5210ed9 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.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 EnrichedRoles model. + */ +public class EnrichedRolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testEnrichedRoles() throws Throwable { + EnrichedRoles enrichedRolesModel = new EnrichedRoles(); + assertNull(enrichedRolesModel.getRoleId()); + assertNull(enrichedRolesModel.getActions()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java new file mode 100644 index 00000000000..460b37f8105 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.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 ErrorDetails model. + */ +public class ErrorDetailsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testErrorDetails() throws Throwable { + ErrorDetails errorDetailsModel = new ErrorDetails(); + assertNull(errorDetailsModel.getConflictsWith()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java new file mode 100644 index 00000000000..e7f7f9afbfc --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.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 ErrorObject model. + */ +public class ErrorObjectTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testErrorObject() throws Throwable { + ErrorObject errorObjectModel = new ErrorObject(); + assertNull(errorObjectModel.getCode()); + assertNull(errorObjectModel.getMessage()); + assertNull(errorObjectModel.getDetails()); + assertNull(errorObjectModel.getMoreInfo()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java new file mode 100644 index 00000000000..90c91c8fcaf --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; +import com.ibm.cloud.platform_services.iam_policy_management.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 ExternalAccountIdentityInteractionPatch model. + */ +public class ExternalAccountIdentityInteractionPatchTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testExternalAccountIdentityInteractionPatch() throws Throwable { + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + assertEquals(identityTypesBaseModel.state(), "enabled"); + assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); + + IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() + .user(identityTypesBaseModel) + .serviceId(identityTypesBaseModel) + .service(identityTypesBaseModel) + .build(); + assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); + + ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() + .identityTypes(identityTypesPatchModel) + .build(); + assertEquals(externalAccountIdentityInteractionPatchModel.identityTypes(), identityTypesPatchModel); + + String json = TestUtilities.serialize(externalAccountIdentityInteractionPatchModel); + + ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModelNew = TestUtilities.deserialize(json, ExternalAccountIdentityInteractionPatch.class); + assertTrue(externalAccountIdentityInteractionPatchModelNew instanceof ExternalAccountIdentityInteractionPatch); + assertEquals(externalAccountIdentityInteractionPatchModelNew.identityTypes().toString(), identityTypesPatchModel.toString()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java new file mode 100644 index 00000000000..2e4aaef7e07 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.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 ExternalAccountIdentityInteraction model. + */ +public class ExternalAccountIdentityInteractionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testExternalAccountIdentityInteraction() throws Throwable { + ExternalAccountIdentityInteraction externalAccountIdentityInteractionModel = new ExternalAccountIdentityInteraction(); + assertNull(externalAccountIdentityInteractionModel.getIdentityTypes()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java new file mode 100644 index 00000000000..b4d68673091 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java @@ -0,0 +1,36 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.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 First model. + */ +public class FirstTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testFirst() throws Throwable { + First firstModel = new First(); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java new file mode 100644 index 00000000000..73e66a5a756 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlAssignmentOptions model. + */ +public class GetActionControlAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetActionControlAssignmentOptions() throws Throwable { + GetActionControlAssignmentOptions getActionControlAssignmentOptionsModel = new GetActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(getActionControlAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlAssignmentOptionsError() throws Throwable { + new GetActionControlAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..d6e66ce6939 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlTemplateOptions model. + */ +public class GetActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetActionControlTemplateOptions() throws Throwable { + GetActionControlTemplateOptions getActionControlTemplateOptionsModel = new GetActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .build(); + assertEquals(getActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(getActionControlTemplateOptionsModel.state(), "active"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlTemplateOptionsError() throws Throwable { + new GetActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..ac8e17fe083 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlTemplateVersionOptions model. + */ +public class GetActionControlTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetActionControlTemplateVersionOptions() throws Throwable { + GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptionsModel = new GetActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + assertEquals(getActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(getActionControlTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlTemplateVersionOptionsError() throws Throwable { + new GetActionControlTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java new file mode 100644 index 00000000000..6b2a479c37d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyAssignmentOptions model. + */ +public class GetPolicyAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetPolicyAssignmentOptions() throws Throwable { + GetPolicyAssignmentOptions getPolicyAssignmentOptionsModel = new GetPolicyAssignmentOptions.Builder() + .assignmentId("testString") + .version("1.0") + .build(); + assertEquals(getPolicyAssignmentOptionsModel.assignmentId(), "testString"); + assertEquals(getPolicyAssignmentOptionsModel.version(), "1.0"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyAssignmentOptionsError() throws Throwable { + new GetPolicyAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java new file mode 100644 index 00000000000..2a7348c2c2d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyOptions model. + */ +public class GetPolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetPolicyOptions() throws Throwable { + GetPolicyOptions getPolicyOptionsModel = new GetPolicyOptions.Builder() + .policyId("testString") + .build(); + assertEquals(getPolicyOptionsModel.policyId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyOptionsError() throws Throwable { + new GetPolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..06535ed77ed --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyTemplateOptions model. + */ +public class GetPolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetPolicyTemplateOptions() throws Throwable { + GetPolicyTemplateOptions getPolicyTemplateOptionsModel = new GetPolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .state("active") + .build(); + assertEquals(getPolicyTemplateOptionsModel.policyTemplateId(), "testString"); + assertEquals(getPolicyTemplateOptionsModel.state(), "active"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyTemplateOptionsError() throws Throwable { + new GetPolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..264b5db4912 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyTemplateVersionOptions model. + */ +public class GetPolicyTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetPolicyTemplateVersionOptions() throws Throwable { + GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptionsModel = new GetPolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + assertEquals(getPolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); + assertEquals(getPolicyTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyTemplateVersionOptionsError() throws Throwable { + new GetPolicyTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java new file mode 100644 index 00000000000..0c1f6b2bb5a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleAssignmentOptions model. + */ +public class GetRoleAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetRoleAssignmentOptions() throws Throwable { + GetRoleAssignmentOptions getRoleAssignmentOptionsModel = new GetRoleAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(getRoleAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleAssignmentOptionsError() throws Throwable { + new GetRoleAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java new file mode 100644 index 00000000000..e589b8d1285 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleOptions model. + */ +public class GetRoleOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetRoleOptions() throws Throwable { + GetRoleOptions getRoleOptionsModel = new GetRoleOptions.Builder() + .roleId("testString") + .build(); + assertEquals(getRoleOptionsModel.roleId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleOptionsError() throws Throwable { + new GetRoleOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..3c10b5207dc --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleTemplateOptions model. + */ +public class GetRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetRoleTemplateOptions() throws Throwable { + GetRoleTemplateOptions getRoleTemplateOptionsModel = new GetRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .state("active") + .build(); + assertEquals(getRoleTemplateOptionsModel.roleTemplateId(), "testString"); + assertEquals(getRoleTemplateOptionsModel.state(), "active"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleTemplateOptionsError() throws Throwable { + new GetRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..3bd5d278630 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleTemplateVersionOptions model. + */ +public class GetRoleTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetRoleTemplateVersionOptions() throws Throwable { + GetRoleTemplateVersionOptions getRoleTemplateVersionOptionsModel = new GetRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + assertEquals(getRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); + assertEquals(getRoleTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleTemplateVersionOptionsError() throws Throwable { + new GetRoleTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java new file mode 100644 index 00000000000..00f780c4153 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetSettingsOptions model. + */ +public class GetSettingsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetSettingsOptions() throws Throwable { + GetSettingsOptions getSettingsOptionsModel = new GetSettingsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .build(); + assertEquals(getSettingsOptionsModel.accountId(), "testString"); + assertEquals(getSettingsOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetSettingsOptionsError() throws Throwable { + new GetSettingsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java new file mode 100644 index 00000000000..ebad7af7371 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetV2PolicyOptions model. + */ +public class GetV2PolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetV2PolicyOptions() throws Throwable { + GetV2PolicyOptions getV2PolicyOptionsModel = new GetV2PolicyOptions.Builder() + .id("testString") + .format("include_last_permit") + .build(); + assertEquals(getV2PolicyOptionsModel.id(), "testString"); + assertEquals(getV2PolicyOptionsModel.format(), "include_last_permit"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetV2PolicyOptionsError() throws Throwable { + new GetV2PolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java new file mode 100644 index 00000000000..f627a54ecc2 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 Grant model. + */ +public class GrantTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGrant() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + + String json = TestUtilities.serialize(grantModel); + + Grant grantModelNew = TestUtilities.deserialize(json, Grant.class); + assertTrue(grantModelNew instanceof Grant); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGrantError() throws Throwable { + new Grant.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java new file mode 100644 index 00000000000..f86af34fab8 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.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 GrantWithEnrichedRoles model. + */ +public class GrantWithEnrichedRolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGrantWithEnrichedRoles() throws Throwable { + GrantWithEnrichedRoles grantWithEnrichedRolesModel = new GrantWithEnrichedRoles(); + assertNull(grantWithEnrichedRolesModel.getRoles()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java new file mode 100644 index 00000000000..2a4d38de51a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypesBase model. + */ +public class IdentityTypesBaseTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testIdentityTypesBase() throws Throwable { + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + assertEquals(identityTypesBaseModel.state(), "enabled"); + assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(identityTypesBaseModel); + + IdentityTypesBase identityTypesBaseModelNew = TestUtilities.deserialize(json, IdentityTypesBase.class); + assertTrue(identityTypesBaseModelNew instanceof IdentityTypesBase); + assertEquals(identityTypesBaseModelNew.state(), "enabled"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testIdentityTypesBaseError() throws Throwable { + new IdentityTypesBase.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java new file mode 100644 index 00000000000..3e762536695 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java @@ -0,0 +1,59 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; +import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypesPatch model. + */ +public class IdentityTypesPatchTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testIdentityTypesPatch() throws Throwable { + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + assertEquals(identityTypesBaseModel.state(), "enabled"); + assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); + + IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() + .user(identityTypesBaseModel) + .serviceId(identityTypesBaseModel) + .service(identityTypesBaseModel) + .build(); + assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); + + String json = TestUtilities.serialize(identityTypesPatchModel); + + IdentityTypesPatch identityTypesPatchModelNew = TestUtilities.deserialize(json, IdentityTypesPatch.class); + assertTrue(identityTypesPatchModelNew instanceof IdentityTypesPatch); + assertEquals(identityTypesPatchModelNew.user().toString(), identityTypesBaseModel.toString()); + assertEquals(identityTypesPatchModelNew.serviceId().toString(), identityTypesBaseModel.toString()); + assertEquals(identityTypesPatchModelNew.service().toString(), identityTypesBaseModel.toString()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java new file mode 100644 index 00000000000..e2b6c77338f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypes model. + */ +public class IdentityTypesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testIdentityTypes() throws Throwable { + IdentityTypes identityTypesModel = new IdentityTypes(); + assertNull(identityTypesModel.getUser()); + assertNull(identityTypesModel.getServiceId()); + assertNull(identityTypesModel.getService()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java new file mode 100644 index 00000000000..c3f51516e25 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java @@ -0,0 +1,36 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; +import com.ibm.cloud.platform_services.iam_policy_management.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 LimitData model. + */ +public class LimitDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testLimitData() throws Throwable { + LimitData limitDataModel = new LimitData(); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java new file mode 100644 index 00000000000..0d64653d829 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlAssignmentsOptions model. + */ +public class ListActionControlAssignmentsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListActionControlAssignmentsOptions() throws Throwable { + ListActionControlAssignmentsOptions listActionControlAssignmentsOptionsModel = new ListActionControlAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listActionControlAssignmentsOptionsModel.accountId(), "testString"); + assertEquals(listActionControlAssignmentsOptionsModel.acceptLanguage(), "default"); + assertEquals(listActionControlAssignmentsOptionsModel.templateId(), "testString"); + assertEquals(listActionControlAssignmentsOptionsModel.templateVersion(), "testString"); + assertEquals(listActionControlAssignmentsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listActionControlAssignmentsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlAssignmentsOptionsError() throws Throwable { + new ListActionControlAssignmentsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java new file mode 100644 index 00000000000..dfe91662d83 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlTemplateVersionsOptions model. + */ +public class ListActionControlTemplateVersionsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListActionControlTemplateVersionsOptions() throws Throwable { + ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptionsModel = new ListActionControlTemplateVersionsOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listActionControlTemplateVersionsOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(listActionControlTemplateVersionsOptionsModel.state(), "active"); + assertEquals(listActionControlTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listActionControlTemplateVersionsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlTemplateVersionsOptionsError() throws Throwable { + new ListActionControlTemplateVersionsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java new file mode 100644 index 00000000000..9e2e6a18158 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlTemplatesOptions model. + */ +public class ListActionControlTemplatesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListActionControlTemplatesOptions() throws Throwable { + ListActionControlTemplatesOptions listActionControlTemplatesOptionsModel = new ListActionControlTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listActionControlTemplatesOptionsModel.accountId(), "testString"); + assertEquals(listActionControlTemplatesOptionsModel.acceptLanguage(), "default"); + assertEquals(listActionControlTemplatesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listActionControlTemplatesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlTemplatesOptionsError() throws Throwable { + new ListActionControlTemplatesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java new file mode 100644 index 00000000000..8bfe5000355 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListPoliciesOptions model. + */ +public class ListPoliciesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListPoliciesOptions() throws Throwable { + ListPoliciesOptions listPoliciesOptionsModel = new ListPoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .tagName("testString") + .tagValue("testString") + .sort("id") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listPoliciesOptionsModel.accountId(), "testString"); + assertEquals(listPoliciesOptionsModel.acceptLanguage(), "default"); + assertEquals(listPoliciesOptionsModel.iamId(), "testString"); + assertEquals(listPoliciesOptionsModel.accessGroupId(), "testString"); + assertEquals(listPoliciesOptionsModel.type(), "access"); + assertEquals(listPoliciesOptionsModel.serviceType(), "service"); + assertEquals(listPoliciesOptionsModel.tagName(), "testString"); + assertEquals(listPoliciesOptionsModel.tagValue(), "testString"); + assertEquals(listPoliciesOptionsModel.sort(), "id"); + assertEquals(listPoliciesOptionsModel.format(), "include_last_permit"); + assertEquals(listPoliciesOptionsModel.state(), "active"); + assertEquals(listPoliciesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listPoliciesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPoliciesOptionsError() throws Throwable { + new ListPoliciesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java new file mode 100644 index 00000000000..32729befeda --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyAssignmentsOptions model. + */ +public class ListPolicyAssignmentsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListPolicyAssignmentsOptions() throws Throwable { + ListPolicyAssignmentsOptions listPolicyAssignmentsOptionsModel = new ListPolicyAssignmentsOptions.Builder() + .version("1.0") + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listPolicyAssignmentsOptionsModel.version(), "1.0"); + assertEquals(listPolicyAssignmentsOptionsModel.accountId(), "testString"); + assertEquals(listPolicyAssignmentsOptionsModel.acceptLanguage(), "default"); + assertEquals(listPolicyAssignmentsOptionsModel.templateId(), "testString"); + assertEquals(listPolicyAssignmentsOptionsModel.templateVersion(), "testString"); + assertEquals(listPolicyAssignmentsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listPolicyAssignmentsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyAssignmentsOptionsError() throws Throwable { + new ListPolicyAssignmentsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java new file mode 100644 index 00000000000..1053d41b84b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyTemplateVersionsOptions model. + */ +public class ListPolicyTemplateVersionsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListPolicyTemplateVersionsOptions() throws Throwable { + ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptionsModel = new ListPolicyTemplateVersionsOptions.Builder() + .policyTemplateId("testString") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listPolicyTemplateVersionsOptionsModel.policyTemplateId(), "testString"); + assertEquals(listPolicyTemplateVersionsOptionsModel.state(), "active"); + assertEquals(listPolicyTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listPolicyTemplateVersionsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyTemplateVersionsOptionsError() throws Throwable { + new ListPolicyTemplateVersionsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java new file mode 100644 index 00000000000..5065a9d9495 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyTemplatesOptions model. + */ +public class ListPolicyTemplatesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListPolicyTemplatesOptions() throws Throwable { + ListPolicyTemplatesOptions listPolicyTemplatesOptionsModel = new ListPolicyTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .state("active") + .name("testString") + .policyServiceType("service") + .policyServiceName("testString") + .policyServiceGroupId("testString") + .policyType("access") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listPolicyTemplatesOptionsModel.accountId(), "testString"); + assertEquals(listPolicyTemplatesOptionsModel.acceptLanguage(), "default"); + assertEquals(listPolicyTemplatesOptionsModel.state(), "active"); + assertEquals(listPolicyTemplatesOptionsModel.name(), "testString"); + assertEquals(listPolicyTemplatesOptionsModel.policyServiceType(), "service"); + assertEquals(listPolicyTemplatesOptionsModel.policyServiceName(), "testString"); + assertEquals(listPolicyTemplatesOptionsModel.policyServiceGroupId(), "testString"); + assertEquals(listPolicyTemplatesOptionsModel.policyType(), "access"); + assertEquals(listPolicyTemplatesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listPolicyTemplatesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyTemplatesOptionsError() throws Throwable { + new ListPolicyTemplatesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java new file mode 100644 index 00000000000..bd82df9bfd5 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleAssignmentsOptions model. + */ +public class ListRoleAssignmentsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListRoleAssignmentsOptions() throws Throwable { + ListRoleAssignmentsOptions listRoleAssignmentsOptionsModel = new ListRoleAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listRoleAssignmentsOptionsModel.accountId(), "testString"); + assertEquals(listRoleAssignmentsOptionsModel.acceptLanguage(), "default"); + assertEquals(listRoleAssignmentsOptionsModel.templateId(), "testString"); + assertEquals(listRoleAssignmentsOptionsModel.templateVersion(), "testString"); + assertEquals(listRoleAssignmentsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listRoleAssignmentsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleAssignmentsOptionsError() throws Throwable { + new ListRoleAssignmentsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java new file mode 100644 index 00000000000..2e89527b653 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleTemplateVersionsOptions model. + */ +public class ListRoleTemplateVersionsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListRoleTemplateVersionsOptions() throws Throwable { + ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptionsModel = new ListRoleTemplateVersionsOptions.Builder() + .roleTemplateId("testString") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listRoleTemplateVersionsOptionsModel.roleTemplateId(), "testString"); + assertEquals(listRoleTemplateVersionsOptionsModel.state(), "active"); + assertEquals(listRoleTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listRoleTemplateVersionsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleTemplateVersionsOptionsError() throws Throwable { + new ListRoleTemplateVersionsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java new file mode 100644 index 00000000000..21d23a7be0f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java @@ -0,0 +1,59 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleTemplatesOptions model. + */ +public class ListRoleTemplatesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListRoleTemplatesOptions() throws Throwable { + ListRoleTemplatesOptions listRoleTemplatesOptionsModel = new ListRoleTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .name("testString") + .roleName("testString") + .roleServiceName("testString") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listRoleTemplatesOptionsModel.accountId(), "testString"); + assertEquals(listRoleTemplatesOptionsModel.acceptLanguage(), "default"); + assertEquals(listRoleTemplatesOptionsModel.name(), "testString"); + assertEquals(listRoleTemplatesOptionsModel.roleName(), "testString"); + assertEquals(listRoleTemplatesOptionsModel.roleServiceName(), "testString"); + assertEquals(listRoleTemplatesOptionsModel.state(), "active"); + assertEquals(listRoleTemplatesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listRoleTemplatesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleTemplatesOptionsError() throws Throwable { + new ListRoleTemplatesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java new file mode 100644 index 00000000000..4fb97c7fc9a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListRolesOptions model. + */ +public class ListRolesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListRolesOptions() throws Throwable { + ListRolesOptions listRolesOptionsModel = new ListRolesOptions.Builder() + .acceptLanguage("default") + .accountId("testString") + .serviceName("iam-groups") + .sourceServiceName("iam-groups") + .policyType("authorization") + .serviceGroupId("IAM") + .build(); + assertEquals(listRolesOptionsModel.acceptLanguage(), "default"); + assertEquals(listRolesOptionsModel.accountId(), "testString"); + assertEquals(listRolesOptionsModel.serviceName(), "iam-groups"); + assertEquals(listRolesOptionsModel.sourceServiceName(), "iam-groups"); + assertEquals(listRolesOptionsModel.policyType(), "authorization"); + assertEquals(listRolesOptionsModel.serviceGroupId(), "IAM"); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java new file mode 100644 index 00000000000..8c72945373b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListV2PoliciesOptions model. + */ +public class ListV2PoliciesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListV2PoliciesOptions() throws Throwable { + ListV2PoliciesOptions listV2PoliciesOptionsModel = new ListV2PoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .serviceName("testString") + .serviceGroupId("testString") + .sort("testString") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listV2PoliciesOptionsModel.accountId(), "testString"); + assertEquals(listV2PoliciesOptionsModel.acceptLanguage(), "default"); + assertEquals(listV2PoliciesOptionsModel.iamId(), "testString"); + assertEquals(listV2PoliciesOptionsModel.accessGroupId(), "testString"); + assertEquals(listV2PoliciesOptionsModel.type(), "access"); + assertEquals(listV2PoliciesOptionsModel.serviceType(), "service"); + assertEquals(listV2PoliciesOptionsModel.serviceName(), "testString"); + assertEquals(listV2PoliciesOptionsModel.serviceGroupId(), "testString"); + assertEquals(listV2PoliciesOptionsModel.sort(), "testString"); + assertEquals(listV2PoliciesOptionsModel.format(), "include_last_permit"); + assertEquals(listV2PoliciesOptionsModel.state(), "active"); + assertEquals(listV2PoliciesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listV2PoliciesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListV2PoliciesOptionsError() throws Throwable { + new ListV2PoliciesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java new file mode 100644 index 00000000000..0661d4245a2 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 NestedConditionRuleAttribute model. + */ +public class NestedConditionRuleAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testNestedConditionRuleAttribute() throws Throwable { + NestedConditionRuleAttribute nestedConditionRuleAttributeModel = new NestedConditionRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(nestedConditionRuleAttributeModel.key(), "testString"); + assertEquals(nestedConditionRuleAttributeModel.operator(), "stringEquals"); + assertEquals(nestedConditionRuleAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(nestedConditionRuleAttributeModel); + + NestedConditionRuleAttribute nestedConditionRuleAttributeModelNew = TestUtilities.deserialize(json, NestedConditionRuleAttribute.class); + assertTrue(nestedConditionRuleAttributeModelNew instanceof NestedConditionRuleAttribute); + assertEquals(nestedConditionRuleAttributeModelNew.key(), "testString"); + assertEquals(nestedConditionRuleAttributeModelNew.operator(), "stringEquals"); + assertEquals(nestedConditionRuleAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testNestedConditionRuleAttributeError() throws Throwable { + new NestedConditionRuleAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java new file mode 100644 index 00000000000..1ba394dbb7d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleWithConditions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 NestedConditionRuleWithConditions model. + */ +public class NestedConditionRuleWithConditionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testNestedConditionRuleWithConditions() throws Throwable { + RuleAttribute ruleAttributeModel = new RuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(ruleAttributeModel.key(), "testString"); + assertEquals(ruleAttributeModel.operator(), "stringEquals"); + assertEquals(ruleAttributeModel.value(), "testString"); + + NestedConditionRuleWithConditions nestedConditionRuleWithConditionsModel = new NestedConditionRuleWithConditions.Builder() + .operator("and") + .conditions(java.util.Arrays.asList(ruleAttributeModel)) + .build(); + assertEquals(nestedConditionRuleWithConditionsModel.operator(), "and"); + assertEquals(nestedConditionRuleWithConditionsModel.conditions(), java.util.Arrays.asList(ruleAttributeModel)); + + String json = TestUtilities.serialize(nestedConditionRuleWithConditionsModel); + + NestedConditionRuleWithConditions nestedConditionRuleWithConditionsModelNew = TestUtilities.deserialize(json, NestedConditionRuleWithConditions.class); + assertTrue(nestedConditionRuleWithConditionsModelNew instanceof NestedConditionRuleWithConditions); + assertEquals(nestedConditionRuleWithConditionsModelNew.operator(), "and"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testNestedConditionRuleWithConditionsError() throws Throwable { + new NestedConditionRuleWithConditions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java new file mode 100644 index 00000000000..4956eea2675 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedCondition; +import com.ibm.cloud.platform_services.iam_policy_management.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 NestedCondition model. + */ +public class NestedConditionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testNestedCondition() throws Throwable { + NestedCondition nestedConditionModel = new NestedCondition(); + assertNotNull(nestedConditionModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java new file mode 100644 index 00000000000..c5e084a44d5 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.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 Next model. + */ +public class NextTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testNext() throws Throwable { + Next nextModel = new Next(); + assertNull(nextModel.getStart()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java new file mode 100644 index 00000000000..d5b05ede760 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentResourcePolicy model. + */ +public class PolicyAssignmentResourcePolicyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentResourcePolicy() throws Throwable { + PolicyAssignmentResourcePolicy policyAssignmentResourcePolicyModel = new PolicyAssignmentResourcePolicy(); + assertNull(policyAssignmentResourcePolicyModel.getResourceCreated()); + assertNull(policyAssignmentResourcePolicyModel.getStatus()); + assertNull(policyAssignmentResourcePolicyModel.getErrorMessage()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java new file mode 100644 index 00000000000..8b146425617 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentResources model. + */ +public class PolicyAssignmentResourcesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentResources() throws Throwable { + PolicyAssignmentResources policyAssignmentResourcesModel = new PolicyAssignmentResources(); + assertNull(policyAssignmentResourcesModel.getTarget()); + assertNull(policyAssignmentResourcesModel.getPolicy()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java new file mode 100644 index 00000000000..8a3a6b67703 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Collection model. + */ +public class PolicyAssignmentV1CollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentV1Collection() throws Throwable { + PolicyAssignmentV1Collection policyAssignmentV1CollectionModel = new PolicyAssignmentV1Collection(); + assertNull(policyAssignmentV1CollectionModel.getLimit()); + assertNull(policyAssignmentV1CollectionModel.getFirst()); + assertNull(policyAssignmentV1CollectionModel.getNext()); + assertNull(policyAssignmentV1CollectionModel.getPrevious()); + assertNull(policyAssignmentV1CollectionModel.getAssignments()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java new file mode 100644 index 00000000000..56c843a232e --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Resources model. + */ +public class PolicyAssignmentV1ResourcesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentV1Resources() throws Throwable { + PolicyAssignmentV1Resources policyAssignmentV1ResourcesModel = new PolicyAssignmentV1Resources(); + assertNull(policyAssignmentV1ResourcesModel.getTarget()); + assertNull(policyAssignmentV1ResourcesModel.getPolicy()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java new file mode 100644 index 00000000000..f5d14b29447 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java @@ -0,0 +1,36 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Subject model. + */ +public class PolicyAssignmentV1SubjectTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentV1Subject() throws Throwable { + PolicyAssignmentV1Subject policyAssignmentV1SubjectModel = new PolicyAssignmentV1Subject(); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java new file mode 100644 index 00000000000..d9889483421 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1 model. + */ +public class PolicyAssignmentV1Test { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentV1() throws Throwable { + PolicyAssignmentV1 policyAssignmentV1Model = new PolicyAssignmentV1(); + assertNull(policyAssignmentV1Model.getTarget()); + assertNull(policyAssignmentV1Model.getResources()); + assertNull(policyAssignmentV1Model.getSubject()); + assertNull(policyAssignmentV1Model.getTemplate()); + assertNull(policyAssignmentV1Model.getStatus()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java new file mode 100644 index 00000000000..3d372dfaf20 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java @@ -0,0 +1,52 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyCollection model. + */ +public class PolicyCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyCollection() throws Throwable { + PolicyCollection policyCollectionModel = new PolicyCollection(); + assertNull(policyCollectionModel.getLimit()); + assertNull(policyCollectionModel.getFirst()); + assertNull(policyCollectionModel.getNext()); + assertNull(policyCollectionModel.getPrevious()); + assertNull(policyCollectionModel.getPolicies()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java new file mode 100644 index 00000000000..cb2f203a5c3 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java @@ -0,0 +1,72 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyResource model. + */ +public class PolicyResourceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyResource() throws Throwable { + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceAttributeModel.name(), "testString"); + assertEquals(resourceAttributeModel.value(), "testString"); + assertEquals(resourceAttributeModel.operator(), "testString"); + + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceTagModel.name(), "testString"); + assertEquals(resourceTagModel.value(), "testString"); + assertEquals(resourceTagModel.operator(), "testString"); + + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); + assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); + + String json = TestUtilities.serialize(policyResourceModel); + + PolicyResource policyResourceModelNew = TestUtilities.deserialize(json, PolicyResource.class); + assertTrue(policyResourceModelNew instanceof PolicyResource); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPolicyResourceError() throws Throwable { + new PolicyResource.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java new file mode 100644 index 00000000000..299e15b1fd4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyRole model. + */ +public class PolicyRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyRole() throws Throwable { + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + assertEquals(policyRoleModel.roleId(), "testString"); + + String json = TestUtilities.serialize(policyRoleModel); + + PolicyRole policyRoleModelNew = TestUtilities.deserialize(json, PolicyRole.class); + assertTrue(policyRoleModelNew instanceof PolicyRole); + assertEquals(policyRoleModelNew.roleId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPolicyRoleError() throws Throwable { + new PolicyRole.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java new file mode 100644 index 00000000000..6d0a937bd53 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java @@ -0,0 +1,58 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicySubject model. + */ +public class PolicySubjectTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicySubject() throws Throwable { + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(subjectAttributeModel.name(), "testString"); + assertEquals(subjectAttributeModel.value(), "testString"); + + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); + + String json = TestUtilities.serialize(policySubjectModel); + + PolicySubject policySubjectModelNew = TestUtilities.deserialize(json, PolicySubject.class); + assertTrue(policySubjectModelNew instanceof PolicySubject); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPolicySubjectError() throws Throwable { + new PolicySubject.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java new file mode 100644 index 00000000000..8cb98be3d32 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentCollection model. + */ +public class PolicyTemplateAssignmentCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateAssignmentCollection() throws Throwable { + PolicyTemplateAssignmentCollection policyTemplateAssignmentCollectionModel = new PolicyTemplateAssignmentCollection(); + assertNull(policyTemplateAssignmentCollectionModel.getLimit()); + assertNull(policyTemplateAssignmentCollectionModel.getFirst()); + assertNull(policyTemplateAssignmentCollectionModel.getNext()); + assertNull(policyTemplateAssignmentCollectionModel.getPrevious()); + assertNull(policyTemplateAssignmentCollectionModel.getAssignments()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java new file mode 100644 index 00000000000..fded12633d2 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItemsPolicyAssignment model. + */ +public class PolicyTemplateAssignmentItemsPolicyAssignmentTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateAssignmentItemsPolicyAssignment() throws Throwable { + PolicyTemplateAssignmentItemsPolicyAssignment policyTemplateAssignmentItemsPolicyAssignmentModel = new PolicyTemplateAssignmentItemsPolicyAssignment(); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTemplateId()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTemplateVersion()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getAssignmentId()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTargetType()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTarget()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getResources()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getStatus()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java new file mode 100644 index 00000000000..6b74125d238 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItemsPolicyAssignmentV1 model. + */ +public class PolicyTemplateAssignmentItemsPolicyAssignmentV1Test { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateAssignmentItemsPolicyAssignmentV1() throws Throwable { + PolicyTemplateAssignmentItemsPolicyAssignmentV1 policyTemplateAssignmentItemsPolicyAssignmentV1Model = new PolicyTemplateAssignmentItemsPolicyAssignmentV1(); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getTarget()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getResources()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getSubject()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getTemplate()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getStatus()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java new file mode 100644 index 00000000000..05b400e91c1 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java @@ -0,0 +1,48 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItems model. + */ +public class PolicyTemplateAssignmentItemsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testPolicyTemplateAssignmentItems() throws Throwable { + PolicyTemplateAssignmentItems policyTemplateAssignmentItemsModel = new PolicyTemplateAssignmentItems(); + assertNotNull(policyTemplateAssignmentItemsModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java new file mode 100644 index 00000000000..52041b1a6a3 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateCollection model. + */ +public class PolicyTemplateCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateCollection() throws Throwable { + PolicyTemplateCollection policyTemplateCollectionModel = new PolicyTemplateCollection(); + assertNull(policyTemplateCollectionModel.getLimit()); + assertNull(policyTemplateCollectionModel.getFirst()); + assertNull(policyTemplateCollectionModel.getNext()); + assertNull(policyTemplateCollectionModel.getPrevious()); + assertNull(policyTemplateCollectionModel.getPolicyTemplates()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java new file mode 100644 index 00000000000..b6ee06990a2 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateLimitData model. + */ +public class PolicyTemplateLimitDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateLimitData() throws Throwable { + PolicyTemplateLimitData policyTemplateLimitDataModel = new PolicyTemplateLimitData(); + assertNull(policyTemplateLimitDataModel.getName()); + assertNull(policyTemplateLimitDataModel.getDescription()); + assertNull(policyTemplateLimitDataModel.getAccountId()); + assertNull(policyTemplateLimitDataModel.getVersion()); + assertNull(policyTemplateLimitDataModel.isCommitted()); + assertNull(policyTemplateLimitDataModel.getPolicy()); + assertNull(policyTemplateLimitDataModel.getState()); + assertNull(policyTemplateLimitDataModel.getCounts()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java new file mode 100644 index 00000000000..edeb45c4d96 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateMetaData model. + */ +public class PolicyTemplateMetaDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateMetaData() throws Throwable { + PolicyTemplateMetaData policyTemplateMetaDataModel = new PolicyTemplateMetaData(); + assertNull(policyTemplateMetaDataModel.getType()); + assertNull(policyTemplateMetaDataModel.getDescription()); + assertNull(policyTemplateMetaDataModel.getSubjects()); + assertNull(policyTemplateMetaDataModel.getRoles()); + assertNull(policyTemplateMetaDataModel.getResources()); + assertNull(policyTemplateMetaDataModel.getState()); + assertNull(policyTemplateMetaDataModel.getTemplate()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java new file mode 100644 index 00000000000..c349e4a3415 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplate model. + */ +public class PolicyTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplate() throws Throwable { + PolicyTemplate policyTemplateModel = new PolicyTemplate(); + assertNull(policyTemplateModel.getName()); + assertNull(policyTemplateModel.getDescription()); + assertNull(policyTemplateModel.getAccountId()); + assertNull(policyTemplateModel.getVersion()); + assertNull(policyTemplateModel.isCommitted()); + assertNull(policyTemplateModel.getPolicy()); + assertNull(policyTemplateModel.getState()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java new file mode 100644 index 00000000000..da651956461 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateVersionsCollection model. + */ +public class PolicyTemplateVersionsCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateVersionsCollection() throws Throwable { + PolicyTemplateVersionsCollection policyTemplateVersionsCollectionModel = new PolicyTemplateVersionsCollection(); + assertNull(policyTemplateVersionsCollectionModel.getLimit()); + assertNull(policyTemplateVersionsCollectionModel.getFirst()); + assertNull(policyTemplateVersionsCollectionModel.getNext()); + assertNull(policyTemplateVersionsCollectionModel.getPrevious()); + assertNull(policyTemplateVersionsCollectionModel.getVersions()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java new file mode 100644 index 00000000000..28eba4f9a85 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java @@ -0,0 +1,48 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 Policy model. + */ +public class PolicyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicy() throws Throwable { + Policy policyModel = new Policy(); + assertNull(policyModel.getType()); + assertNull(policyModel.getDescription()); + assertNull(policyModel.getSubjects()); + assertNull(policyModel.getRoles()); + assertNull(policyModel.getResources()); + assertNull(policyModel.getState()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java new file mode 100644 index 00000000000..e3788c51212 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.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 Previous model. + */ +public class PreviousTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPrevious() throws Throwable { + Previous previousModel = new Previous(); + assertNull(previousModel.getStart()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..430f5f63764 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java @@ -0,0 +1,67 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceActionControlTemplateOptions model. + */ +public class ReplaceActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplaceActionControlTemplateOptions() throws Throwable { + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateActionControlModel.serviceName(), "testString"); + assertEquals(templateActionControlModel.description(), "testString"); + assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); + + ReplaceActionControlTemplateOptions replaceActionControlTemplateOptionsModel = new ReplaceActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .actionControl(templateActionControlModel) + .committed(true) + .build(); + assertEquals(replaceActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.version(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.ifMatch(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.name(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.description(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.actionControl(), templateActionControlModel); + assertEquals(replaceActionControlTemplateOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceActionControlTemplateOptionsError() throws Throwable { + new ReplaceActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java new file mode 100644 index 00000000000..2f20b05f37c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java @@ -0,0 +1,105 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplacePolicyOptions model. + */ +public class ReplacePolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplacePolicyOptions() throws Throwable { + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(subjectAttributeModel.name(), "testString"); + assertEquals(subjectAttributeModel.value(), "testString"); + + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); + + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + assertEquals(policyRoleModel.roleId(), "testString"); + + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceAttributeModel.name(), "testString"); + assertEquals(resourceAttributeModel.value(), "testString"); + assertEquals(resourceAttributeModel.operator(), "testString"); + + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceTagModel.name(), "testString"); + assertEquals(resourceTagModel.value(), "testString"); + assertEquals(resourceTagModel.operator(), "testString"); + + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); + assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); + + ReplacePolicyOptions replacePolicyOptionsModel = new ReplacePolicyOptions.Builder() + .policyId("testString") + .ifMatch("testString") + .type("testString") + .subjects(java.util.Arrays.asList(policySubjectModel)) + .roles(java.util.Arrays.asList(policyRoleModel)) + .resources(java.util.Arrays.asList(policyResourceModel)) + .description("testString") + .build(); + assertEquals(replacePolicyOptionsModel.policyId(), "testString"); + assertEquals(replacePolicyOptionsModel.ifMatch(), "testString"); + assertEquals(replacePolicyOptionsModel.type(), "testString"); + assertEquals(replacePolicyOptionsModel.subjects(), java.util.Arrays.asList(policySubjectModel)); + assertEquals(replacePolicyOptionsModel.roles(), java.util.Arrays.asList(policyRoleModel)); + assertEquals(replacePolicyOptionsModel.resources(), java.util.Arrays.asList(policyResourceModel)); + assertEquals(replacePolicyOptionsModel.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplacePolicyOptionsError() throws Throwable { + new ReplacePolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..2dc2430daca --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java @@ -0,0 +1,147 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplacePolicyTemplateOptions model. + */ +public class ReplacePolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplacePolicyTemplateOptions() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + assertEquals(templatePolicyModel.type(), "access"); + assertEquals(templatePolicyModel.description(), "testString"); + assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); + assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); + assertEquals(templatePolicyModel.pattern(), "testString"); + assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); + assertEquals(templatePolicyModel.control(), templateControlModel); + + ReplacePolicyTemplateOptions replacePolicyTemplateOptionsModel = new ReplacePolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .ifMatch("testString") + .policy(templatePolicyModel) + .name("testString") + .description("testString") + .committed(true) + .build(); + assertEquals(replacePolicyTemplateOptionsModel.policyTemplateId(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.version(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.ifMatch(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.policy(), templatePolicyModel); + assertEquals(replacePolicyTemplateOptionsModel.name(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.description(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplacePolicyTemplateOptionsError() throws Throwable { + new ReplacePolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java new file mode 100644 index 00000000000..9900abb2543 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceRoleOptions model. + */ +public class ReplaceRoleOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplaceRoleOptions() throws Throwable { + ReplaceRoleOptions replaceRoleOptionsModel = new ReplaceRoleOptions.Builder() + .roleId("testString") + .ifMatch("testString") + .displayName("testString") + .actions(java.util.Arrays.asList("testString")) + .description("testString") + .build(); + assertEquals(replaceRoleOptionsModel.roleId(), "testString"); + assertEquals(replaceRoleOptionsModel.ifMatch(), "testString"); + assertEquals(replaceRoleOptionsModel.displayName(), "testString"); + assertEquals(replaceRoleOptionsModel.actions(), java.util.Arrays.asList("testString")); + assertEquals(replaceRoleOptionsModel.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceRoleOptionsError() throws Throwable { + new ReplaceRoleOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..2f731aea7d4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceRoleTemplateOptions model. + */ +public class ReplaceRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplaceRoleTemplateOptions() throws Throwable { + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateRoleModel.displayName(), "testString"); + assertEquals(templateRoleModel.serviceName(), "testString"); + assertEquals(templateRoleModel.description(), "testString"); + assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); + + ReplaceRoleTemplateOptions replaceRoleTemplateOptionsModel = new ReplaceRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .role(templateRoleModel) + .committed(true) + .build(); + assertEquals(replaceRoleTemplateOptionsModel.roleTemplateId(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.version(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.ifMatch(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.name(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.description(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.role(), templateRoleModel); + assertEquals(replaceRoleTemplateOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceRoleTemplateOptionsError() throws Throwable { + new ReplaceRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java new file mode 100644 index 00000000000..23690eda780 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java @@ -0,0 +1,133 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceV2PolicyOptions model. + */ +public class ReplaceV2PolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplaceV2PolicyOptions() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + assertEquals(controlModel.grant(), grantModel); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + ReplaceV2PolicyOptions replaceV2PolicyOptionsModel = new ReplaceV2PolicyOptions.Builder() + .id("testString") + .ifMatch("testString") + .control(controlModel) + .type("access") + .description("testString") + .subject(v2PolicySubjectModel) + .resource(v2PolicyResourceModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .build(); + assertEquals(replaceV2PolicyOptionsModel.id(), "testString"); + assertEquals(replaceV2PolicyOptionsModel.ifMatch(), "testString"); + assertEquals(replaceV2PolicyOptionsModel.control(), controlModel); + assertEquals(replaceV2PolicyOptionsModel.type(), "access"); + assertEquals(replaceV2PolicyOptionsModel.description(), "testString"); + assertEquals(replaceV2PolicyOptionsModel.subject(), v2PolicySubjectModel); + assertEquals(replaceV2PolicyOptionsModel.resource(), v2PolicyResourceModel); + assertEquals(replaceV2PolicyOptionsModel.pattern(), "testString"); + assertEquals(replaceV2PolicyOptionsModel.rule(), v2PolicyRuleModel); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceV2PolicyOptionsError() throws Throwable { + new ReplaceV2PolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java new file mode 100644 index 00000000000..bd50b514f43 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 ResourceAttribute model. + */ +public class ResourceAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testResourceAttribute() throws Throwable { + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceAttributeModel.name(), "testString"); + assertEquals(resourceAttributeModel.value(), "testString"); + assertEquals(resourceAttributeModel.operator(), "testString"); + + String json = TestUtilities.serialize(resourceAttributeModel); + + ResourceAttribute resourceAttributeModelNew = TestUtilities.deserialize(json, ResourceAttribute.class); + assertTrue(resourceAttributeModelNew instanceof ResourceAttribute); + assertEquals(resourceAttributeModelNew.name(), "testString"); + assertEquals(resourceAttributeModelNew.value(), "testString"); + assertEquals(resourceAttributeModelNew.operator(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testResourceAttributeError() throws Throwable { + new ResourceAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java new file mode 100644 index 00000000000..88a1eb5d5b6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.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 ResourceTag model. + */ +public class ResourceTagTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testResourceTag() throws Throwable { + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceTagModel.name(), "testString"); + assertEquals(resourceTagModel.value(), "testString"); + assertEquals(resourceTagModel.operator(), "testString"); + + String json = TestUtilities.serialize(resourceTagModel); + + ResourceTag resourceTagModelNew = TestUtilities.deserialize(json, ResourceTag.class); + assertTrue(resourceTagModelNew instanceof ResourceTag); + assertEquals(resourceTagModelNew.name(), "testString"); + assertEquals(resourceTagModelNew.value(), "testString"); + assertEquals(resourceTagModelNew.operator(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testResourceTagError() throws Throwable { + new ResourceTag.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java new file mode 100644 index 00000000000..e4c0bcc6f92 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAction model. + */ +public class RoleActionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAction() throws Throwable { + RoleAction roleActionModel = new RoleAction(); + assertNull(roleActionModel.getId()); + assertNull(roleActionModel.getDisplayName()); + assertNull(roleActionModel.getDescription()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java new file mode 100644 index 00000000000..42801bc7771 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentCollection model. + */ +public class RoleAssignmentCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentCollection() throws Throwable { + RoleAssignmentCollection roleAssignmentCollectionModel = new RoleAssignmentCollection(); + assertNull(roleAssignmentCollectionModel.getLimit()); + assertNull(roleAssignmentCollectionModel.getFirst()); + assertNull(roleAssignmentCollectionModel.getNext()); + assertNull(roleAssignmentCollectionModel.getPrevious()); + assertNull(roleAssignmentCollectionModel.getAssignments()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java new file mode 100644 index 00000000000..bef8b71b0fa --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResourceCreated model. + */ +public class RoleAssignmentResourceCreatedTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentResourceCreated() throws Throwable { + RoleAssignmentResourceCreated roleAssignmentResourceCreatedModel = new RoleAssignmentResourceCreated(); + assertNull(roleAssignmentResourceCreatedModel.getId()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java new file mode 100644 index 00000000000..c346ca0f48f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java @@ -0,0 +1,43 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResourceRole model. + */ +public class RoleAssignmentResourceRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentResourceRole() throws Throwable { + RoleAssignmentResourceRole roleAssignmentResourceRoleModel = new RoleAssignmentResourceRole(); + assertNull(roleAssignmentResourceRoleModel.getResourceCreated()); + assertNull(roleAssignmentResourceRoleModel.getErrorMessage()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java new file mode 100644 index 00000000000..4fca1b25b5b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResource model. + */ +public class RoleAssignmentResourceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentResource() throws Throwable { + RoleAssignmentResource roleAssignmentResourceModel = new RoleAssignmentResource(); + assertNull(roleAssignmentResourceModel.getTarget()); + assertNull(roleAssignmentResourceModel.getRole()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java new file mode 100644 index 00000000000..4f2e3a37200 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentTemplate model. + */ +public class RoleAssignmentTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentTemplate() throws Throwable { + RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleAssignmentTemplateModel.id(), "testString"); + assertEquals(roleAssignmentTemplateModel.version(), "testString"); + + String json = TestUtilities.serialize(roleAssignmentTemplateModel); + + RoleAssignmentTemplate roleAssignmentTemplateModelNew = TestUtilities.deserialize(json, RoleAssignmentTemplate.class); + assertTrue(roleAssignmentTemplateModelNew instanceof RoleAssignmentTemplate); + assertEquals(roleAssignmentTemplateModelNew.id(), "testString"); + assertEquals(roleAssignmentTemplateModelNew.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRoleAssignmentTemplateError() throws Throwable { + new RoleAssignmentTemplate.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java new file mode 100644 index 00000000000..bd3bda7ce24 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignment model. + */ +public class RoleAssignmentTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignment() throws Throwable { + RoleAssignment roleAssignmentModel = new RoleAssignment(); + assertNull(roleAssignmentModel.getTemplate()); + assertNull(roleAssignmentModel.getTarget()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java new file mode 100644 index 00000000000..812c2dcb131 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java @@ -0,0 +1,41 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleCollection model. + */ +public class RoleCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleCollection() throws Throwable { + RoleCollection roleCollectionModel = new RoleCollection(); + assertNull(roleCollectionModel.getCustomRoles()); + assertNull(roleCollectionModel.getServiceRoles()); + assertNull(roleCollectionModel.getSystemRoles()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java new file mode 100644 index 00000000000..fde4d11ff4c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java @@ -0,0 +1,46 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateCollection model. + */ +public class RoleTemplateCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplateCollection() throws Throwable { + RoleTemplateCollection roleTemplateCollectionModel = new RoleTemplateCollection(); + assertNull(roleTemplateCollectionModel.getLimit()); + assertNull(roleTemplateCollectionModel.getFirst()); + assertNull(roleTemplateCollectionModel.getNext()); + assertNull(roleTemplateCollectionModel.getPrevious()); + assertNull(roleTemplateCollectionModel.getRoleTemplates()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java new file mode 100644 index 00000000000..6c208e1c38f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java @@ -0,0 +1,62 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplatePrototypeRole model. + */ +public class RoleTemplatePrototypeRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplatePrototypeRole() throws Throwable { + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() + .name("testString") + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(roleTemplatePrototypeRoleModel.name(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.displayName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.serviceName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.description(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.actions(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(roleTemplatePrototypeRoleModel); + + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModelNew = TestUtilities.deserialize(json, RoleTemplatePrototypeRole.class); + assertTrue(roleTemplatePrototypeRoleModelNew instanceof RoleTemplatePrototypeRole); + assertEquals(roleTemplatePrototypeRoleModelNew.name(), "testString"); + assertEquals(roleTemplatePrototypeRoleModelNew.displayName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModelNew.serviceName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModelNew.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRoleTemplatePrototypeRoleError() throws Throwable { + new RoleTemplatePrototypeRole.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java new file mode 100644 index 00000000000..af9de718e23 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateReferencesItem model. + */ +public class RoleTemplateReferencesItemTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplateReferencesItem() throws Throwable { + RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleTemplateReferencesItemModel.id(), "testString"); + assertEquals(roleTemplateReferencesItemModel.version(), "testString"); + + String json = TestUtilities.serialize(roleTemplateReferencesItemModel); + + RoleTemplateReferencesItem roleTemplateReferencesItemModelNew = TestUtilities.deserialize(json, RoleTemplateReferencesItem.class); + assertTrue(roleTemplateReferencesItemModelNew instanceof RoleTemplateReferencesItem); + assertEquals(roleTemplateReferencesItemModelNew.id(), "testString"); + assertEquals(roleTemplateReferencesItemModelNew.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRoleTemplateReferencesItemError() throws Throwable { + new RoleTemplateReferencesItem.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java new file mode 100644 index 00000000000..8bb27d8dd62 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplate model. + */ +public class RoleTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplate() throws Throwable { + RoleTemplate roleTemplateModel = new RoleTemplate(); + assertNull(roleTemplateModel.getName()); + assertNull(roleTemplateModel.getDescription()); + assertNull(roleTemplateModel.getAccountId()); + assertNull(roleTemplateModel.isCommitted()); + assertNull(roleTemplateModel.getRole()); + assertNull(roleTemplateModel.getVersion()); + assertNull(roleTemplateModel.getState()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java new file mode 100644 index 00000000000..068cf309bd6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java @@ -0,0 +1,46 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateVersionsCollection model. + */ +public class RoleTemplateVersionsCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplateVersionsCollection() throws Throwable { + RoleTemplateVersionsCollection roleTemplateVersionsCollectionModel = new RoleTemplateVersionsCollection(); + assertNull(roleTemplateVersionsCollectionModel.getLimit()); + assertNull(roleTemplateVersionsCollectionModel.getFirst()); + assertNull(roleTemplateVersionsCollectionModel.getNext()); + assertNull(roleTemplateVersionsCollectionModel.getPrevious()); + assertNull(roleTemplateVersionsCollectionModel.getVersions()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java new file mode 100644 index 00000000000..a632e63587f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; +import com.ibm.cloud.platform_services.iam_policy_management.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 Role model. + */ +public class RoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRole() throws Throwable { + Role roleModel = new Role.Builder() + .displayName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(roleModel.displayName(), "testString"); + assertEquals(roleModel.description(), "testString"); + assertEquals(roleModel.actions(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(roleModel); + + Role roleModelNew = TestUtilities.deserialize(json, Role.class); + assertTrue(roleModelNew instanceof Role); + assertEquals(roleModelNew.displayName(), "testString"); + assertEquals(roleModelNew.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRoleError() throws Throwable { + new Role.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java new file mode 100644 index 00000000000..8383ef794a9 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 Roles model. + */ +public class RolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoles() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + String json = TestUtilities.serialize(rolesModel); + + Roles rolesModelNew = TestUtilities.deserialize(json, Roles.class); + assertTrue(rolesModelNew instanceof Roles); + assertEquals(rolesModelNew.roleId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRolesError() throws Throwable { + new Roles.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java new file mode 100644 index 00000000000..a05e5ee8704 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 RuleAttribute model. + */ +public class RuleAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRuleAttribute() throws Throwable { + RuleAttribute ruleAttributeModel = new RuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(ruleAttributeModel.key(), "testString"); + assertEquals(ruleAttributeModel.operator(), "stringEquals"); + assertEquals(ruleAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(ruleAttributeModel); + + RuleAttribute ruleAttributeModelNew = TestUtilities.deserialize(json, RuleAttribute.class); + assertTrue(ruleAttributeModelNew instanceof RuleAttribute); + assertEquals(ruleAttributeModelNew.key(), "testString"); + assertEquals(ruleAttributeModelNew.operator(), "stringEquals"); + assertEquals(ruleAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRuleAttributeError() throws Throwable { + new RuleAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java new file mode 100644 index 00000000000..7bae03a42e0 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 SubjectAttribute model. + */ +public class SubjectAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testSubjectAttribute() throws Throwable { + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(subjectAttributeModel.name(), "testString"); + assertEquals(subjectAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(subjectAttributeModel); + + SubjectAttribute subjectAttributeModelNew = TestUtilities.deserialize(json, SubjectAttribute.class); + assertTrue(subjectAttributeModelNew instanceof SubjectAttribute); + assertEquals(subjectAttributeModelNew.name(), "testString"); + assertEquals(subjectAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testSubjectAttributeError() throws Throwable { + new SubjectAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java new file mode 100644 index 00000000000..d3a6d4ef53a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateActionControl model. + */ +public class TemplateActionControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateActionControl() throws Throwable { + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateActionControlModel.serviceName(), "testString"); + assertEquals(templateActionControlModel.description(), "testString"); + assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(templateActionControlModel); + + TemplateActionControl templateActionControlModelNew = TestUtilities.deserialize(json, TemplateActionControl.class); + assertTrue(templateActionControlModelNew instanceof TemplateActionControl); + assertEquals(templateActionControlModelNew.serviceName(), "testString"); + assertEquals(templateActionControlModelNew.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateActionControlError() throws Throwable { + new TemplateActionControl.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java new file mode 100644 index 00000000000..fba96e64cef --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateControl model. + */ +public class TemplateControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateControl() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + String json = TestUtilities.serialize(templateControlModel); + + TemplateControl templateControlModelNew = TestUtilities.deserialize(json, TemplateControl.class); + assertTrue(templateControlModelNew instanceof TemplateControl); + assertEquals(templateControlModelNew.grant().toString(), templateGrantModel.toString()); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateControlError() throws Throwable { + new TemplateControl.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java new file mode 100644 index 00000000000..b440cf19100 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateCountData model. + */ +public class TemplateCountDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateCountData() throws Throwable { + TemplateCountData templateCountDataModel = new TemplateCountData(); + assertNull(templateCountDataModel.getTemplate()); + assertNull(templateCountDataModel.getVersion()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java new file mode 100644 index 00000000000..e7759eacc21 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java @@ -0,0 +1,58 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoleReferences; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrantRoleReferences model. + */ +public class TemplateGrantRoleReferencesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateGrantRoleReferences() throws Throwable { + RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleTemplateReferencesItemModel.id(), "testString"); + assertEquals(roleTemplateReferencesItemModel.version(), "testString"); + + TemplateGrantRoleReferences templateGrantRoleReferencesModel = new TemplateGrantRoleReferences.Builder() + .roleTemplateReferences(java.util.Arrays.asList(roleTemplateReferencesItemModel)) + .build(); + assertEquals(templateGrantRoleReferencesModel.roleTemplateReferences(), java.util.Arrays.asList(roleTemplateReferencesItemModel)); + + String json = TestUtilities.serialize(templateGrantRoleReferencesModel); + + TemplateGrantRoleReferences templateGrantRoleReferencesModelNew = TestUtilities.deserialize(json, TemplateGrantRoleReferences.class); + assertTrue(templateGrantRoleReferencesModelNew instanceof TemplateGrantRoleReferences); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateGrantRoleReferencesError() throws Throwable { + new TemplateGrantRoleReferences.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java new file mode 100644 index 00000000000..8cddc6f9a19 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrantRoles model. + */ +public class TemplateGrantRolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateGrantRoles() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantRolesModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantRolesModel.roles(), java.util.Arrays.asList(rolesModel)); + + String json = TestUtilities.serialize(templateGrantRolesModel); + + TemplateGrantRoles templateGrantRolesModelNew = TestUtilities.deserialize(json, TemplateGrantRoles.class); + assertTrue(templateGrantRolesModelNew instanceof TemplateGrantRoles); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateGrantRolesError() throws Throwable { + new TemplateGrantRoles.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java new file mode 100644 index 00000000000..90e6fdc2b9f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrant model. + */ +public class TemplateGrantTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testTemplateGrant() throws Throwable { + TemplateGrant templateGrantModel = new TemplateGrant(); + assertNotNull(templateGrantModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java new file mode 100644 index 00000000000..c2688232e2b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java @@ -0,0 +1,41 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateMetadata model. + */ +public class TemplateMetadataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateMetadata() throws Throwable { + TemplateMetadata templateMetadataModel = new TemplateMetadata(); + assertNull(templateMetadataModel.getId()); + assertNull(templateMetadataModel.getVersion()); + assertNull(templateMetadataModel.getAssignmentId()); + assertNull(templateMetadataModel.getRootId()); + assertNull(templateMetadataModel.getRootVersion()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java new file mode 100644 index 00000000000..0e256ffd599 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplatePolicy model. + */ +public class TemplatePolicyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplatePolicy() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + assertEquals(templatePolicyModel.type(), "access"); + assertEquals(templatePolicyModel.description(), "testString"); + assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); + assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); + assertEquals(templatePolicyModel.pattern(), "testString"); + assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); + assertEquals(templatePolicyModel.control(), templateControlModel); + + String json = TestUtilities.serialize(templatePolicyModel); + + TemplatePolicy templatePolicyModelNew = TestUtilities.deserialize(json, TemplatePolicy.class); + assertTrue(templatePolicyModelNew instanceof TemplatePolicy); + assertEquals(templatePolicyModelNew.type(), "access"); + assertEquals(templatePolicyModelNew.description(), "testString"); + assertEquals(templatePolicyModelNew.resource().toString(), v2PolicyResourceModel.toString()); + assertEquals(templatePolicyModelNew.subject().toString(), v2PolicySubjectModel.toString()); + assertEquals(templatePolicyModelNew.pattern(), "testString"); + assertEquals(templatePolicyModelNew.rule().toString(), v2PolicyRuleModel.toString()); + assertEquals(templatePolicyModelNew.control().toString(), templateControlModel.toString()); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplatePolicyError() throws Throwable { + new TemplatePolicy.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java new file mode 100644 index 00000000000..1735364bc85 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java @@ -0,0 +1,59 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateRole model. + */ +public class TemplateRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateRole() throws Throwable { + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateRoleModel.displayName(), "testString"); + assertEquals(templateRoleModel.serviceName(), "testString"); + assertEquals(templateRoleModel.description(), "testString"); + assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(templateRoleModel); + + TemplateRole templateRoleModelNew = TestUtilities.deserialize(json, TemplateRole.class); + assertTrue(templateRoleModelNew instanceof TemplateRole); + assertEquals(templateRoleModelNew.displayName(), "testString"); + assertEquals(templateRoleModelNew.serviceName(), "testString"); + assertEquals(templateRoleModelNew.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateRoleError() throws Throwable { + new TemplateRole.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java new file mode 100644 index 00000000000..df7a09c2829 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateActionControlAssignmentOptions model. + */ +public class UpdateActionControlAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateActionControlAssignmentOptions() throws Throwable { + UpdateActionControlAssignmentOptions updateActionControlAssignmentOptionsModel = new UpdateActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .ifMatch("testString") + .templateVersion("testString") + .build(); + assertEquals(updateActionControlAssignmentOptionsModel.assignmentId(), "testString"); + assertEquals(updateActionControlAssignmentOptionsModel.ifMatch(), "testString"); + assertEquals(updateActionControlAssignmentOptionsModel.templateVersion(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateActionControlAssignmentOptionsError() throws Throwable { + new UpdateActionControlAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java new file mode 100644 index 00000000000..0008325ffcf --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdatePolicyAssignmentOptions model. + */ +public class UpdatePolicyAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdatePolicyAssignmentOptions() throws Throwable { + UpdatePolicyAssignmentOptions updatePolicyAssignmentOptionsModel = new UpdatePolicyAssignmentOptions.Builder() + .assignmentId("testString") + .version("1.0") + .ifMatch("testString") + .templateVersion("testString") + .build(); + assertEquals(updatePolicyAssignmentOptionsModel.assignmentId(), "testString"); + assertEquals(updatePolicyAssignmentOptionsModel.version(), "1.0"); + assertEquals(updatePolicyAssignmentOptionsModel.ifMatch(), "testString"); + assertEquals(updatePolicyAssignmentOptionsModel.templateVersion(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdatePolicyAssignmentOptionsError() throws Throwable { + new UpdatePolicyAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java new file mode 100644 index 00000000000..de000e8c745 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdatePolicyStateOptions model. + */ +public class UpdatePolicyStateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdatePolicyStateOptions() throws Throwable { + UpdatePolicyStateOptions updatePolicyStateOptionsModel = new UpdatePolicyStateOptions.Builder() + .policyId("testString") + .ifMatch("testString") + .state("active") + .build(); + assertEquals(updatePolicyStateOptionsModel.policyId(), "testString"); + assertEquals(updatePolicyStateOptionsModel.ifMatch(), "testString"); + assertEquals(updatePolicyStateOptionsModel.state(), "active"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdatePolicyStateOptionsError() throws Throwable { + new UpdatePolicyStateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java new file mode 100644 index 00000000000..879c3d5f456 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateRoleAssignmentOptions model. + */ +public class UpdateRoleAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateRoleAssignmentOptions() throws Throwable { + UpdateRoleAssignmentOptions updateRoleAssignmentOptionsModel = new UpdateRoleAssignmentOptions.Builder() + .assignmentId("testString") + .ifMatch("testString") + .templateVersion("testString") + .build(); + assertEquals(updateRoleAssignmentOptionsModel.assignmentId(), "testString"); + assertEquals(updateRoleAssignmentOptionsModel.ifMatch(), "testString"); + assertEquals(updateRoleAssignmentOptionsModel.templateVersion(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateRoleAssignmentOptionsError() throws Throwable { + new UpdateRoleAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java new file mode 100644 index 00000000000..1d69d016781 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java @@ -0,0 +1,75 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateSettingsOptions model. + */ +public class UpdateSettingsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateSettingsOptions() throws Throwable { + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + assertEquals(identityTypesBaseModel.state(), "enabled"); + assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); + + IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() + .user(identityTypesBaseModel) + .serviceId(identityTypesBaseModel) + .service(identityTypesBaseModel) + .build(); + assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); + + ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() + .identityTypes(identityTypesPatchModel) + .build(); + assertEquals(externalAccountIdentityInteractionPatchModel.identityTypes(), identityTypesPatchModel); + + UpdateSettingsOptions updateSettingsOptionsModel = new UpdateSettingsOptions.Builder() + .accountId("testString") + .ifMatch("testString") + .externalAccountIdentityInteraction(externalAccountIdentityInteractionPatchModel) + .acceptLanguage("default") + .build(); + assertEquals(updateSettingsOptionsModel.accountId(), "testString"); + assertEquals(updateSettingsOptionsModel.ifMatch(), "testString"); + assertEquals(updateSettingsOptionsModel.externalAccountIdentityInteraction(), externalAccountIdentityInteractionPatchModel); + assertEquals(updateSettingsOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateSettingsOptionsError() throws Throwable { + new UpdateSettingsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java new file mode 100644 index 00000000000..aff020c8985 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyCollection model. + */ +public class V2PolicyCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyCollection() throws Throwable { + V2PolicyCollection v2PolicyCollectionModel = new V2PolicyCollection(); + assertNull(v2PolicyCollectionModel.getLimit()); + assertNull(v2PolicyCollectionModel.getFirst()); + assertNull(v2PolicyCollectionModel.getNext()); + assertNull(v2PolicyCollectionModel.getPrevious()); + assertNull(v2PolicyCollectionModel.getPolicies()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java new file mode 100644 index 00000000000..407eaadb155 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResourceAttribute model. + */ +public class V2PolicyResourceAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyResourceAttribute() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(v2PolicyResourceAttributeModel); + + V2PolicyResourceAttribute v2PolicyResourceAttributeModelNew = TestUtilities.deserialize(json, V2PolicyResourceAttribute.class); + assertTrue(v2PolicyResourceAttributeModelNew instanceof V2PolicyResourceAttribute); + assertEquals(v2PolicyResourceAttributeModelNew.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModelNew.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyResourceAttributeError() throws Throwable { + new V2PolicyResourceAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java new file mode 100644 index 00000000000..97c9c813216 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResourceTag model. + */ +public class V2PolicyResourceTagTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyResourceTag() throws Throwable { + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + String json = TestUtilities.serialize(v2PolicyResourceTagModel); + + V2PolicyResourceTag v2PolicyResourceTagModelNew = TestUtilities.deserialize(json, V2PolicyResourceTag.class); + assertTrue(v2PolicyResourceTagModelNew instanceof V2PolicyResourceTag); + assertEquals(v2PolicyResourceTagModelNew.key(), "testString"); + assertEquals(v2PolicyResourceTagModelNew.value(), "testString"); + assertEquals(v2PolicyResourceTagModelNew.operator(), "stringEquals"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyResourceTagError() throws Throwable { + new V2PolicyResourceTag.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java new file mode 100644 index 00000000000..d153fd97be6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java @@ -0,0 +1,72 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResource model. + */ +public class V2PolicyResourceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyResource() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + String json = TestUtilities.serialize(v2PolicyResourceModel); + + V2PolicyResource v2PolicyResourceModelNew = TestUtilities.deserialize(json, V2PolicyResource.class); + assertTrue(v2PolicyResourceModelNew instanceof V2PolicyResource); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyResourceError() throws Throwable { + new V2PolicyResource.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java new file mode 100644 index 00000000000..6d6da85f2b4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRuleRuleAttribute model. + */ +public class V2PolicyRuleRuleAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyRuleRuleAttribute() throws Throwable { + V2PolicyRuleRuleAttribute v2PolicyRuleRuleAttributeModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleRuleAttributeModel.key(), "testString"); + assertEquals(v2PolicyRuleRuleAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleRuleAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(v2PolicyRuleRuleAttributeModel); + + V2PolicyRuleRuleAttribute v2PolicyRuleRuleAttributeModelNew = TestUtilities.deserialize(json, V2PolicyRuleRuleAttribute.class); + assertTrue(v2PolicyRuleRuleAttributeModelNew instanceof V2PolicyRuleRuleAttribute); + assertEquals(v2PolicyRuleRuleAttributeModelNew.key(), "testString"); + assertEquals(v2PolicyRuleRuleAttributeModelNew.operator(), "stringEquals"); + assertEquals(v2PolicyRuleRuleAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyRuleRuleAttributeError() throws Throwable { + new V2PolicyRuleRuleAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java new file mode 100644 index 00000000000..fdf25669ef7 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleWithNestedConditions; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRuleRuleWithNestedConditions model. + */ +public class V2PolicyRuleRuleWithNestedConditionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyRuleRuleWithNestedConditions() throws Throwable { + NestedConditionRuleAttribute nestedConditionModel = new NestedConditionRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(nestedConditionModel.key(), "testString"); + assertEquals(nestedConditionModel.operator(), "stringEquals"); + assertEquals(nestedConditionModel.value(), "testString"); + + V2PolicyRuleRuleWithNestedConditions v2PolicyRuleRuleWithNestedConditionsModel = new V2PolicyRuleRuleWithNestedConditions.Builder() + .operator("and") + .conditions(java.util.Arrays.asList(nestedConditionModel)) + .build(); + assertEquals(v2PolicyRuleRuleWithNestedConditionsModel.operator(), "and"); + assertEquals(v2PolicyRuleRuleWithNestedConditionsModel.conditions(), java.util.Arrays.asList(nestedConditionModel)); + + String json = TestUtilities.serialize(v2PolicyRuleRuleWithNestedConditionsModel); + + V2PolicyRuleRuleWithNestedConditions v2PolicyRuleRuleWithNestedConditionsModelNew = TestUtilities.deserialize(json, V2PolicyRuleRuleWithNestedConditions.class); + assertTrue(v2PolicyRuleRuleWithNestedConditionsModelNew instanceof V2PolicyRuleRuleWithNestedConditions); + assertEquals(v2PolicyRuleRuleWithNestedConditionsModelNew.operator(), "and"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyRuleRuleWithNestedConditionsError() throws Throwable { + new V2PolicyRuleRuleWithNestedConditions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java new file mode 100644 index 00000000000..e0af599840c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRule; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRule model. + */ +public class V2PolicyRuleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testV2PolicyRule() throws Throwable { + V2PolicyRule v2PolicyRuleModel = new V2PolicyRule(); + assertNotNull(v2PolicyRuleModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java new file mode 100644 index 00000000000..a6e8f9d8922 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicySubjectAttribute model. + */ +public class V2PolicySubjectAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicySubjectAttribute() throws Throwable { + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(v2PolicySubjectAttributeModel); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModelNew = TestUtilities.deserialize(json, V2PolicySubjectAttribute.class); + assertTrue(v2PolicySubjectAttributeModelNew instanceof V2PolicySubjectAttribute); + assertEquals(v2PolicySubjectAttributeModelNew.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModelNew.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicySubjectAttributeError() throws Throwable { + new V2PolicySubjectAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java new file mode 100644 index 00000000000..37adbaff5df --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java @@ -0,0 +1,60 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicySubject model. + */ +public class V2PolicySubjectTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicySubject() throws Throwable { + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + String json = TestUtilities.serialize(v2PolicySubjectModel); + + V2PolicySubject v2PolicySubjectModelNew = TestUtilities.deserialize(json, V2PolicySubject.class); + assertTrue(v2PolicySubjectModelNew instanceof V2PolicySubject); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicySubjectError() throws Throwable { + new V2PolicySubject.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java new file mode 100644 index 00000000000..2ffbe45575b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyTemplateMetaData model. + */ +public class V2PolicyTemplateMetaDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyTemplateMetaData() throws Throwable { + V2PolicyTemplateMetaData v2PolicyTemplateMetaDataModel = new V2PolicyTemplateMetaData(); + assertNull(v2PolicyTemplateMetaDataModel.getType()); + assertNull(v2PolicyTemplateMetaDataModel.getDescription()); + assertNull(v2PolicyTemplateMetaDataModel.getSubject()); + assertNull(v2PolicyTemplateMetaDataModel.getResource()); + assertNull(v2PolicyTemplateMetaDataModel.getPattern()); + assertNull(v2PolicyTemplateMetaDataModel.getRule()); + assertNull(v2PolicyTemplateMetaDataModel.getControl()); + assertNull(v2PolicyTemplateMetaDataModel.getState()); + assertNull(v2PolicyTemplateMetaDataModel.getLastPermitAt()); + assertNull(v2PolicyTemplateMetaDataModel.getLastPermitFrequency()); + assertNull(v2PolicyTemplateMetaDataModel.getTemplate()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java new file mode 100644 index 00000000000..1630201062c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2Policy model. + */ +public class V2PolicyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2Policy() throws Throwable { + V2Policy v2PolicyModel = new V2Policy(); + assertNull(v2PolicyModel.getType()); + assertNull(v2PolicyModel.getDescription()); + assertNull(v2PolicyModel.getSubject()); + assertNull(v2PolicyModel.getResource()); + assertNull(v2PolicyModel.getPattern()); + assertNull(v2PolicyModel.getRule()); + assertNull(v2PolicyModel.getControl()); + assertNull(v2PolicyModel.getState()); + assertNull(v2PolicyModel.getLastPermitAt()); + assertNull(v2PolicyModel.getLastPermitFrequency()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java new file mode 100644 index 00000000000..04aaecc16ae --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java @@ -0,0 +1,131 @@ +/* + * (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_policy_management.v1.utils; + +import java.util.Base64; +import java.util.Map; +import java.util.Set; +import java.util.List; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.io.InputStream; +import java.io.ByteArrayInputStream; + +import okhttp3.mockwebserver.RecordedRequest; +import okhttp3.HttpUrl; +import com.ibm.cloud.sdk.core.util.DateUtils; +import com.ibm.cloud.sdk.core.util.GsonSingleton; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; + +/** + * A class used by the unit tests containing utility functions. + */ +public class TestUtilities { + public static Map createMockMap() { + Map mockMap = new HashMap<>(); + mockMap.put("foo", "bar"); + return mockMap; + } + + public static HashMap createMockStreamMap() { + return new HashMap() { + { put("key1", createMockStream("This is a mock file.")); } + }; + } + + public static Map parseQueryString(RecordedRequest req) { + Map queryMap = new HashMap<>(); + + try { + HttpUrl requestUrl = req.getRequestUrl(); + + if (requestUrl != null) { + Set queryParamsNames = requestUrl.queryParameterNames(); + // map the parameter name to its corresponding value + for (String p : queryParamsNames) { + // get the corresponding value for the parameter (p) + List val = requestUrl.queryParameterValues(p); + if (val != null && !val.isEmpty()) { + String joinedQuery = String.join(",", val); + queryMap.put(p, joinedQuery); + } + } + } + if (queryMap.isEmpty()) { + return null; + } + } catch (Exception e) { + return null; + } + + return queryMap; + } + + public static String parseReqPath(RecordedRequest req) { + String parsedPath = null; + + try { + String fullPath = req.getPath(); + if (fullPath != null && !fullPath.isEmpty()) { + // retrieve the path segment before the query parameter + parsedPath = fullPath.split("\\?", 2)[0]; + } + if (parsedPath.isEmpty() || parsedPath == null) { + return null; + } + + } catch (Exception e) { + return null; + } + + return parsedPath; + } + + public static String serialize(Object obj) { + return GsonSingleton.getGson().toJson(obj); + } + + public static T deserialize(String json, Class clazz) { + return GsonSingleton.getGson().fromJson(json, clazz); + } + + public static InputStream createMockStream(String s) { + return new ByteArrayInputStream(s.getBytes()); + } + + public static List creatMockListFileWithMetadata() { + List list = new ArrayList(); + byte[] fileBytes = {(byte) 0xde, (byte) 0xad, (byte) 0xbe, (byte) 0xef}; + InputStream inputStream = new ByteArrayInputStream(fileBytes); + FileWithMetadata.Builder builder = new FileWithMetadata.Builder(); + builder.data(inputStream); + FileWithMetadata fileWithMetadata = builder.build(); + list.add(fileWithMetadata); + + return list; + } + + public static byte[] createMockByteArray(String encodedString) throws Exception { + return Base64.getDecoder().decode(encodedString); + } + + public static Date createMockDate(String date) throws Exception { + return DateUtils.parseAsDate(date); + } + + public static Date createMockDateTime(String date) throws Exception { + return DateUtils.parseAsDateTime(date); + } +} \ No newline at end of file From f609a328ef57718a5c234c490901001226ebc9fb Mon Sep 17 00:00:00 2001 From: Bhavana Bellamgari Date: Wed, 10 Dec 2025 15:31:23 +0530 Subject: [PATCH 07/13] Removed the wrongly generated code Signed-off-by: Bhavana Bellamgari Signed-off-by: Bhavana Bellamgari --- .../v1/IamPolicyManagement.java | 2566 --------- .../AccountSettingsAccessManagement.java | 40 - .../v1/model/ActionControlAssignment.java | 207 - .../ActionControlAssignmentCollection.java | 88 - .../ActionControlAssignmentResource.java | 52 - ...ontrolAssignmentResourceActionControl.java | 53 - ...ctionControlAssignmentResourceCreated.java | 38 - .../ActionControlAssignmentTemplate.java | 134 - .../model/ActionControlAssignmentsPager.java | 108 - .../v1/model/ActionControlTemplate.java | 203 - .../ActionControlTemplateCollection.java | 90 - ...tionControlTemplateVersionsCollection.java | 88 - .../ActionControlTemplateVersionsPager.java | 108 - .../v1/model/ActionControlTemplatesPager.java | 108 - .../v1/model/AssignmentResourceCreated.java | 38 - .../v1/model/AssignmentResourceError.java | 88 - .../v1/model/AssignmentTargetDetails.java | 142 - .../v1/model/AssignmentTemplateDetails.java | 119 - .../CommitActionControlTemplateOptions.java | 134 - .../v1/model/CommitPolicyTemplateOptions.java | 134 - .../v1/model/CommitRoleTemplateOptions.java | 134 - .../v1/model/ConflictsWith.java | 62 - .../v1/model/Control.java | 104 - .../v1/model/ControlResponse.java | 42 - .../v1/model/ControlResponseControl.java | 24 - ...ntrolResponseControlWithEnrichedRoles.java | 24 - ...ctionControlTemplateAssignmentOptions.java | 191 - .../CreateActionControlTemplateOptions.java | 251 - ...teActionControlTemplateVersionOptions.java | 211 - .../v1/model/CreatePolicyOptions.java | 311 - ...CreatePolicyTemplateAssignmentOptions.java | 221 - .../v1/model/CreatePolicyTemplateOptions.java | 255 - .../CreatePolicyTemplateVersionOptions.java | 214 - .../v1/model/CreateRoleOptions.java | 308 - .../CreateRoleTemplateAssignmentOptions.java | 191 - .../v1/model/CreateRoleTemplateOptions.java | 251 - .../CreateRoleTemplateVersionOptions.java | 211 - .../v1/model/CreateV2PolicyOptions.java | 312 - .../v1/model/CustomRole.java | 195 - .../DeleteActionControlAssignmentOptions.java | 104 - .../DeleteActionControlTemplateOptions.java | 104 - ...teActionControlTemplateVersionOptions.java | 134 - .../model/DeletePolicyAssignmentOptions.java | 104 - .../v1/model/DeletePolicyOptions.java | 104 - .../v1/model/DeletePolicyTemplateOptions.java | 104 - .../DeletePolicyTemplateVersionOptions.java | 134 - .../v1/model/DeleteRoleAssignmentOptions.java | 104 - .../v1/model/DeleteRoleOptions.java | 104 - .../v1/model/DeleteRoleTemplateOptions.java | 104 - .../DeleteRoleTemplateVersionOptions.java | 134 - .../v1/model/DeleteV2PolicyOptions.java | 104 - .../v1/model/EnrichedRoles.java | 81 - .../v1/model/ErrorDetails.java | 40 - .../v1/model/ErrorObject.java | 128 - .../ExternalAccountIdentityInteraction.java | 40 - ...ternalAccountIdentityInteractionPatch.java | 95 - .../iam_policy_management/v1/model/First.java | 38 - .../GetActionControlAssignmentOptions.java | 104 - .../GetActionControlTemplateOptions.java | 140 - ...etActionControlTemplateVersionOptions.java | 134 - .../v1/model/GetPolicyAssignmentOptions.java | 134 - .../v1/model/GetPolicyOptions.java | 104 - .../v1/model/GetPolicyTemplateOptions.java | 140 - .../GetPolicyTemplateVersionOptions.java | 134 - .../v1/model/GetRoleAssignmentOptions.java | 104 - .../v1/model/GetRoleOptions.java | 104 - .../v1/model/GetRoleTemplateOptions.java | 140 - .../model/GetRoleTemplateVersionOptions.java | 134 - .../v1/model/GetSettingsOptions.java | 141 - .../v1/model/GetV2PolicyOptions.java | 148 - .../iam_policy_management/v1/model/Grant.java | 124 - .../v1/model/GrantWithEnrichedRoles.java | 40 - .../v1/model/IdentityTypes.java | 64 - .../v1/model/IdentityTypesBase.java | 168 - .../v1/model/IdentityTypesPatch.java | 147 - .../v1/model/LimitData.java | 50 - .../ListActionControlAssignmentsOptions.java | 245 - ...tActionControlTemplateVersionsOptions.java | 192 - .../ListActionControlTemplatesOptions.java | 193 - .../v1/model/ListPoliciesOptions.java | 501 -- .../model/ListPolicyAssignmentsOptions.java | 275 - .../ListPolicyTemplateVersionsOptions.java | 192 - .../v1/model/ListPolicyTemplatesOptions.java | 379 -- .../v1/model/ListRoleAssignmentsOptions.java | 245 - .../ListRoleTemplateVersionsOptions.java | 192 - .../v1/model/ListRoleTemplatesOptions.java | 307 - .../v1/model/ListRolesOptions.java | 234 - .../v1/model/ListV2PoliciesOptions.java | 492 -- .../v1/model/NestedCondition.java | 126 - .../model/NestedConditionRuleAttribute.java | 170 - .../NestedConditionRuleWithConditions.java | 139 - .../iam_policy_management/v1/model/Next.java | 50 - .../v1/model/PoliciesPager.java | 108 - .../v1/model/Policy.java | 188 - .../model/PolicyAssignmentResourcePolicy.java | 65 - .../v1/model/PolicyAssignmentResources.java | 50 - .../v1/model/PolicyAssignmentV1.java | 193 - .../model/PolicyAssignmentV1Collection.java | 88 - .../v1/model/PolicyAssignmentV1Resources.java | 50 - .../v1/model/PolicyAssignmentV1Subject.java | 60 - .../v1/model/PolicyAssignmentsPager.java | 108 - .../v1/model/PolicyCollection.java | 88 - .../v1/model/PolicyResource.java | 167 - .../v1/model/PolicyRole.java | 131 - .../v1/model/PolicySubject.java | 124 - .../v1/model/PolicyTemplate.java | 202 - .../PolicyTemplateAssignmentCollection.java | 88 - .../model/PolicyTemplateAssignmentItems.java | 261 - ...mplateAssignmentItemsPolicyAssignment.java | 50 - ...lateAssignmentItemsPolicyAssignmentV1.java | 38 - .../v1/model/PolicyTemplateCollection.java | 90 - .../v1/model/PolicyTemplateLimitData.java | 214 - .../v1/model/PolicyTemplateMetaData.java | 201 - .../PolicyTemplateVersionsCollection.java | 88 - .../v1/model/PolicyTemplateVersionsPager.java | 108 - .../v1/model/PolicyTemplatesPager.java | 108 - .../v1/model/Previous.java | 50 - .../ReplaceActionControlTemplateOptions.java | 273 - .../v1/model/ReplacePolicyOptions.java | 335 -- .../model/ReplacePolicyTemplateOptions.java | 276 - .../v1/model/ReplaceRoleOptions.java | 255 - .../v1/model/ReplaceRoleTemplateOptions.java | 273 - .../v1/model/ReplaceV2PolicyOptions.java | 336 -- .../v1/model/ResourceAttribute.java | 160 - .../v1/model/ResourceTag.java | 160 - .../iam_policy_management/v1/model/Role.java | 196 - .../v1/model/RoleAction.java | 64 - .../v1/model/RoleAssignment.java | 207 - .../v1/model/RoleAssignmentCollection.java | 88 - .../v1/model/RoleAssignmentResource.java | 50 - .../model/RoleAssignmentResourceCreated.java | 38 - .../v1/model/RoleAssignmentResourceRole.java | 53 - .../v1/model/RoleAssignmentTemplate.java | 134 - .../v1/model/RoleAssignmentsPager.java | 108 - .../v1/model/RoleCollection.java | 68 - .../v1/model/RoleTemplate.java | 202 - .../v1/model/RoleTemplateCollection.java | 90 - .../v1/model/RoleTemplatePrototypeRole.java | 239 - .../v1/model/RoleTemplateReferencesItem.java | 134 - .../model/RoleTemplateVersionsCollection.java | 88 - .../v1/model/RoleTemplateVersionsPager.java | 108 - .../v1/model/RoleTemplatesPager.java | 108 - .../iam_policy_management/v1/model/Roles.java | 106 - .../v1/model/RuleAttribute.java | 209 - .../v1/model/SubjectAttribute.java | 134 - .../v1/model/TemplateActionControl.java | 182 - .../v1/model/TemplateControl.java | 104 - .../v1/model/TemplateCountData.java | 50 - .../v1/model/TemplateGrant.java | 58 - .../v1/model/TemplateGrantRoleReferences.java | 110 - .../v1/model/TemplateGrantRoles.java | 110 - .../v1/model/TemplateMetadata.java | 91 - .../v1/model/TemplatePolicy.java | 272 - .../v1/model/TemplateRole.java | 209 - .../UpdateActionControlAssignmentOptions.java | 166 - .../model/UpdatePolicyAssignmentOptions.java | 196 - .../v1/model/UpdatePolicyStateOptions.java | 171 - .../v1/model/UpdateRoleAssignmentOptions.java | 166 - .../v1/model/UpdateSettingsOptions.java | 199 - .../v1/model/V2PoliciesPager.java | 108 - .../v1/model/V2Policy.java | 247 - .../v1/model/V2PolicyCollection.java | 88 - .../v1/model/V2PolicyResource.java | 167 - .../v1/model/V2PolicyResourceAttribute.java | 181 - .../v1/model/V2PolicyResourceTag.java | 174 - .../v1/model/V2PolicyRule.java | 126 - .../v1/model/V2PolicyRuleRuleAttribute.java | 170 - .../V2PolicyRuleRuleWithNestedConditions.java | 139 - .../v1/model/V2PolicySubject.java | 124 - .../v1/model/V2PolicySubjectAttribute.java | 175 - .../v1/model/V2PolicyTemplateMetaData.java | 260 - .../v1/package-info.java | 17 - .../v1/IamPolicyManagementTest.java | 5007 ----------------- .../AccountSettingsAccessManagementTest.java | 40 - ...ActionControlAssignmentCollectionTest.java | 47 - ...olAssignmentResourceActionControlTest.java | 43 - ...nControlAssignmentResourceCreatedTest.java | 37 - .../ActionControlAssignmentResourceTest.java | 45 - .../ActionControlAssignmentTemplateTest.java | 54 - .../v1/model/ActionControlAssignmentTest.java | 40 - .../ActionControlTemplateCollectionTest.java | 46 - .../v1/model/ActionControlTemplateTest.java | 44 - ...ControlTemplateVersionsCollectionTest.java | 46 - .../model/AssignmentResourceCreatedTest.java | 37 - .../v1/model/AssignmentResourceErrorTest.java | 44 - .../v1/model/AssignmentTargetDetailsTest.java | 54 - .../model/AssignmentTemplateDetailsTest.java | 48 - ...ommitActionControlTemplateOptionsTest.java | 47 - .../CommitPolicyTemplateOptionsTest.java | 47 - .../model/CommitRoleTemplateOptionsTest.java | 47 - .../v1/model/ConflictsWithTest.java | 39 - .../v1/model/ControlResponseControlTest.java | 39 - ...lResponseControlWithEnrichedRolesTest.java | 40 - .../v1/model/ControlResponseTest.java | 40 - .../v1/model/ControlTest.java | 63 - ...nControlTemplateAssignmentOptionsTest.java | 65 - ...reateActionControlTemplateOptionsTest.java | 65 - ...tionControlTemplateVersionOptionsTest.java | 63 - .../v1/model/CreatePolicyOptionsTest.java | 103 - ...tePolicyTemplateAssignmentOptionsTest.java | 67 - .../CreatePolicyTemplateOptionsTest.java | 145 - ...reatePolicyTemplateVersionOptionsTest.java | 143 - .../v1/model/CreateRoleOptionsTest.java | 57 - ...eateRoleTemplateAssignmentOptionsTest.java | 65 - .../model/CreateRoleTemplateOptionsTest.java | 69 - .../CreateRoleTemplateVersionOptionsTest.java | 65 - .../v1/model/CreateV2PolicyOptionsTest.java | 131 - .../v1/model/CustomRoleTest.java | 42 - ...eteActionControlAssignmentOptionsTest.java | 45 - ...eleteActionControlTemplateOptionsTest.java | 45 - ...tionControlTemplateVersionOptionsTest.java | 47 - .../DeletePolicyAssignmentOptionsTest.java | 45 - .../v1/model/DeletePolicyOptionsTest.java | 45 - .../DeletePolicyTemplateOptionsTest.java | 45 - ...eletePolicyTemplateVersionOptionsTest.java | 47 - .../DeleteRoleAssignmentOptionsTest.java | 45 - .../v1/model/DeleteRoleOptionsTest.java | 45 - .../model/DeleteRoleTemplateOptionsTest.java | 45 - .../DeleteRoleTemplateVersionOptionsTest.java | 47 - .../v1/model/DeleteV2PolicyOptionsTest.java | 45 - .../v1/model/EnrichedRolesTest.java | 39 - .../v1/model/ErrorDetailsTest.java | 38 - .../v1/model/ErrorObjectTest.java | 42 - ...alAccountIdentityInteractionPatchTest.java | 63 - ...xternalAccountIdentityInteractionTest.java | 39 - .../v1/model/FirstTest.java | 36 - ...GetActionControlAssignmentOptionsTest.java | 45 - .../GetActionControlTemplateOptionsTest.java | 47 - ...tionControlTemplateVersionOptionsTest.java | 47 - .../model/GetPolicyAssignmentOptionsTest.java | 47 - .../v1/model/GetPolicyOptionsTest.java | 45 - .../model/GetPolicyTemplateOptionsTest.java | 47 - .../GetPolicyTemplateVersionOptionsTest.java | 47 - .../model/GetRoleAssignmentOptionsTest.java | 45 - .../v1/model/GetRoleOptionsTest.java | 45 - .../v1/model/GetRoleTemplateOptionsTest.java | 47 - .../GetRoleTemplateVersionOptionsTest.java | 47 - .../v1/model/GetSettingsOptionsTest.java | 47 - .../v1/model/GetV2PolicyOptionsTest.java | 47 - .../v1/model/GrantTest.java | 56 - .../v1/model/GrantWithEnrichedRolesTest.java | 39 - .../v1/model/IdentityTypesBaseTest.java | 53 - .../v1/model/IdentityTypesPatchTest.java | 59 - .../v1/model/IdentityTypesTest.java | 40 - .../v1/model/LimitDataTest.java | 36 - ...stActionControlAssignmentsOptionsTest.java | 55 - ...ionControlTemplateVersionsOptionsTest.java | 51 - ...ListActionControlTemplatesOptionsTest.java | 51 - .../v1/model/ListPoliciesOptionsTest.java | 69 - .../ListPolicyAssignmentsOptionsTest.java | 57 - ...ListPolicyTemplateVersionsOptionsTest.java | 51 - .../model/ListPolicyTemplatesOptionsTest.java | 63 - .../model/ListRoleAssignmentsOptionsTest.java | 55 - .../ListRoleTemplateVersionsOptionsTest.java | 51 - .../model/ListRoleTemplatesOptionsTest.java | 59 - .../v1/model/ListRolesOptionsTest.java | 49 - .../v1/model/ListV2PoliciesOptionsTest.java | 69 - .../NestedConditionRuleAttributeTest.java | 57 - ...NestedConditionRuleWithConditionsTest.java | 63 - .../v1/model/NestedConditionTest.java | 38 - .../v1/model/NextTest.java | 37 - .../PolicyAssignmentResourcePolicyTest.java | 44 - .../model/PolicyAssignmentResourcesTest.java | 44 - .../PolicyAssignmentV1CollectionTest.java | 55 - .../PolicyAssignmentV1ResourcesTest.java | 45 - .../model/PolicyAssignmentV1SubjectTest.java | 36 - .../v1/model/PolicyAssignmentV1Test.java | 51 - .../v1/model/PolicyCollectionTest.java | 52 - .../v1/model/PolicyResourceTest.java | 72 - .../v1/model/PolicyRoleTest.java | 51 - .../v1/model/PolicySubjectTest.java | 58 - ...olicyTemplateAssignmentCollectionTest.java | 55 - ...teAssignmentItemsPolicyAssignmentTest.java | 50 - ...AssignmentItemsPolicyAssignmentV1Test.java | 51 - .../PolicyTemplateAssignmentItemsTest.java | 48 - .../model/PolicyTemplateCollectionTest.java | 55 - .../v1/model/PolicyTemplateLimitDataTest.java | 56 - .../v1/model/PolicyTemplateMetaDataTest.java | 50 - .../v1/model/PolicyTemplateTest.java | 53 - .../PolicyTemplateVersionsCollectionTest.java | 55 - .../v1/model/PolicyTest.java | 48 - .../v1/model/PreviousTest.java | 37 - ...placeActionControlTemplateOptionsTest.java | 67 - .../v1/model/ReplacePolicyOptionsTest.java | 105 - .../ReplacePolicyTemplateOptionsTest.java | 147 - .../v1/model/ReplaceRoleOptionsTest.java | 53 - .../model/ReplaceRoleTemplateOptionsTest.java | 69 - .../v1/model/ReplaceV2PolicyOptionsTest.java | 133 - .../v1/model/ResourceAttributeTest.java | 57 - .../v1/model/ResourceTagTest.java | 57 - .../v1/model/RoleActionTest.java | 39 - .../model/RoleAssignmentCollectionTest.java | 47 - .../RoleAssignmentResourceCreatedTest.java | 37 - .../model/RoleAssignmentResourceRoleTest.java | 43 - .../v1/model/RoleAssignmentResourceTest.java | 45 - .../v1/model/RoleAssignmentTemplateTest.java | 54 - .../v1/model/RoleAssignmentTest.java | 40 - .../v1/model/RoleCollectionTest.java | 41 - .../v1/model/RoleTemplateCollectionTest.java | 46 - .../model/RoleTemplatePrototypeRoleTest.java | 62 - .../model/RoleTemplateReferencesItemTest.java | 54 - .../v1/model/RoleTemplateTest.java | 44 - .../RoleTemplateVersionsCollectionTest.java | 46 - .../v1/model/RoleTest.java | 56 - .../v1/model/RolesTest.java | 51 - .../v1/model/RuleAttributeTest.java | 57 - .../v1/model/SubjectAttributeTest.java | 54 - .../v1/model/TemplateActionControlTest.java | 56 - .../v1/model/TemplateControlTest.java | 63 - .../v1/model/TemplateCountDataTest.java | 39 - .../TemplateGrantRoleReferencesTest.java | 58 - .../v1/model/TemplateGrantRolesTest.java | 56 - .../v1/model/TemplateGrantTest.java | 39 - .../v1/model/TemplateMetadataTest.java | 41 - .../v1/model/TemplatePolicyTest.java | 141 - .../v1/model/TemplateRoleTest.java | 59 - ...ateActionControlAssignmentOptionsTest.java | 49 - .../UpdatePolicyAssignmentOptionsTest.java | 51 - .../model/UpdatePolicyStateOptionsTest.java | 49 - .../UpdateRoleAssignmentOptionsTest.java | 49 - .../v1/model/UpdateSettingsOptionsTest.java | 75 - .../v1/model/V2PolicyCollectionTest.java | 55 - .../model/V2PolicyResourceAttributeTest.java | 57 - .../v1/model/V2PolicyResourceTagTest.java | 57 - .../v1/model/V2PolicyResourceTest.java | 72 - .../model/V2PolicyRuleRuleAttributeTest.java | 57 - ...olicyRuleRuleWithNestedConditionsTest.java | 63 - .../v1/model/V2PolicyRuleTest.java | 38 - .../model/V2PolicySubjectAttributeTest.java | 57 - .../v1/model/V2PolicySubjectTest.java | 60 - .../model/V2PolicyTemplateMetaDataTest.java | 57 - .../v1/model/V2PolicyTest.java | 55 - .../v1/utils/TestUtilities.java | 131 - 333 files changed, 41258 deletions(-) delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java deleted file mode 100644 index 2abe3baea4e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java +++ /dev/null @@ -1,2566 +0,0 @@ -/* - * (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. - */ - -/* - * IBM OpenAPI SDK Code Generator Version: 3.107.1-41b0fbd0-20250825-080732 - */ - -package com.ibm.cloud.platform_services.iam_policy_management.v1; - -import com.google.gson.JsonObject; -import com.ibm.cloud.platform_services.common.SdkCommon; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; -import com.ibm.cloud.sdk.core.http.RequestBuilder; -import com.ibm.cloud.sdk.core.http.ResponseConverter; -import com.ibm.cloud.sdk.core.http.ServiceCall; -import com.ibm.cloud.sdk.core.security.Authenticator; -import com.ibm.cloud.sdk.core.security.ConfigBasedAuthenticatorFactory; -import com.ibm.cloud.sdk.core.service.BaseService; -import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -/** - * IAM Policy Management API. - * - * API Version: 1.0.1 - */ -public class IamPolicyManagement extends BaseService { - - /** - * Default service name used when configuring the `IamPolicyManagement` client. - */ - public static final String DEFAULT_SERVICE_NAME = "iam_policy_management"; - - /** - * Default service endpoint URL. - */ - public static final String DEFAULT_SERVICE_URL = "https://iam.cloud.ibm.com"; - - /** - * Class method which constructs an instance of the `IamPolicyManagement` client. - * The default service name is used to configure the client instance. - * - * @return an instance of the `IamPolicyManagement` client using external configuration - */ - public static IamPolicyManagement newInstance() { - return newInstance(DEFAULT_SERVICE_NAME); - } - - /** - * Class method which constructs an instance of the `IamPolicyManagement` client. - * The specified service name is used to configure the client instance. - * - * @param serviceName the service name to be used when configuring the client instance - * @return an instance of the `IamPolicyManagement` client using external configuration - */ - public static IamPolicyManagement newInstance(String serviceName) { - Authenticator authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(serviceName); - IamPolicyManagement service = new IamPolicyManagement(serviceName, authenticator); - service.configureService(serviceName); - return service; - } - - /** - * Constructs an instance of the `IamPolicyManagement` client. - * The specified service name and authenticator are used to configure the client instance. - * - * @param serviceName the service name to be used when configuring the client instance - * @param authenticator the {@link Authenticator} instance to be configured for this client - */ - public IamPolicyManagement(String serviceName, Authenticator authenticator) { - super(serviceName, authenticator); - setServiceUrl(DEFAULT_SERVICE_URL); - } - - /** - * Get policies by attributes. - * - * Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account - * and filter by attribute values. This can be done through query parameters. The following attributes are supported: - * account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query - * parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If - * the caller does not have read access to any policies an empty array is returned. - * - * @param listPoliciesOptions the {@link ListPoliciesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyCollection} - */ - public ServiceCall listPolicies(ListPoliciesOptions listPoliciesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listPoliciesOptions, - "listPoliciesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicies"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listPoliciesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listPoliciesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listPoliciesOptions.accountId())); - if (listPoliciesOptions.iamId() != null) { - builder.query("iam_id", String.valueOf(listPoliciesOptions.iamId())); - } - if (listPoliciesOptions.accessGroupId() != null) { - builder.query("access_group_id", String.valueOf(listPoliciesOptions.accessGroupId())); - } - if (listPoliciesOptions.type() != null) { - builder.query("type", String.valueOf(listPoliciesOptions.type())); - } - if (listPoliciesOptions.serviceType() != null) { - builder.query("service_type", String.valueOf(listPoliciesOptions.serviceType())); - } - if (listPoliciesOptions.tagName() != null) { - builder.query("tag_name", String.valueOf(listPoliciesOptions.tagName())); - } - if (listPoliciesOptions.tagValue() != null) { - builder.query("tag_value", String.valueOf(listPoliciesOptions.tagValue())); - } - if (listPoliciesOptions.sort() != null) { - builder.query("sort", String.valueOf(listPoliciesOptions.sort())); - } - if (listPoliciesOptions.format() != null) { - builder.query("format", String.valueOf(listPoliciesOptions.format())); - } - if (listPoliciesOptions.state() != null) { - builder.query("state", String.valueOf(listPoliciesOptions.state())); - } - if (listPoliciesOptions.limit() != null) { - builder.query("limit", String.valueOf(listPoliciesOptions.limit())); - } - if (listPoliciesOptions.start() != null) { - builder.query("start", String.valueOf(listPoliciesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a policy. - * - * Creates a policy to grant access between a subject and a resource. There are two types of policies: **access** and - * **authorization**. A policy administrator might want to create an access policy which grants access to a user, - * service-id, or an access group. They might also want to create an authorization policy and setup access between - * services. - * - * ### Access - * - * To create an access policy, use **`"type": "access"`** in the body. The possible subject attributes are - * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or - * service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. Assign roles - * that are supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or - * **`service_group_id`** attribute and the **`accountId`** attribute. The IAM Services group (`IAM`) is a subset of - * account management services that includes the IAM platform services IAM Identity, IAM Access Management, IAM Users - * Management, IAM Groups, and future IAM services. If the subject is a locked service-id, the request will fail. - * - * ### Authorization - * - * Authorization policies are supported by services on a case by case basis. Refer to service documentation to verify - * their support of authorization policies. To create an authorization policy, use **`"type": "authorization"`** in - * the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject - * attributes might be provided. The following attributes are supported: - * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are - * supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access - * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject - * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. - * - * ### Attribute Operators - * - * Currently, only the `stringEquals` and the `stringMatch` operators are available. Resource attributes may support - * one or both operators. For more information, see [Assigning access by using wildcard - * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). - * - * ### Attribute Validations - * - * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like - * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated - * against Global Catalog locations. - * - * @param createPolicyOptions the {@link CreatePolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Policy} - */ - public ServiceCall createPolicy(CreatePolicyOptions createPolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyOptions, - "createPolicyOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createPolicyOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createPolicyOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("type", createPolicyOptions.type()); - contentJson.add("subjects", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.subjects())); - contentJson.add("roles", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.roles())); - contentJson.add("resources", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.resources())); - if (createPolicyOptions.description() != null) { - contentJson.addProperty("description", createPolicyOptions.description()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a policy. - * - * Update a policy to grant access between a subject and a resource. A policy administrator might want to update an - * existing policy. The policy type cannot be changed (You cannot change an access policy to an authorization policy). - * - * ### Access - * - * To update an access policy, use **`"type": "access"`** in the body. The possible subject attributes are - * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or - * service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. Assign roles - * that are supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * The policy resource must include either the **`serviceType`**, **`serviceName`**, or **`resourceGroupId`** - * attribute and the **`accountId`** attribute.` If the subject is a locked service-id, the request will fail. - * - * ### Authorization - * - * To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match - * the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following - * attributes are supported: - * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are - * supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access - * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject - * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. - * - * ### Attribute Operators - * - * Currently, only the `stringEquals` and the `stringMatch` operators are available. Resource attributes might support - * one or both operators. For more information, see [Assigning access by using wildcard - * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). - * - * ### Attribute Validations - * - * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like - * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated - * against Global Catalog locations. - * - * @param replacePolicyOptions the {@link ReplacePolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Policy} - */ - public ServiceCall replacePolicy(ReplacePolicyOptions replacePolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replacePolicyOptions, - "replacePolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_id", replacePolicyOptions.policyId()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replacePolicy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replacePolicyOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("type", replacePolicyOptions.type()); - contentJson.add("subjects", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.subjects())); - contentJson.add("roles", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.roles())); - contentJson.add("resources", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.resources())); - if (replacePolicyOptions.description() != null) { - contentJson.addProperty("description", replacePolicyOptions.description()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a policy by ID. - * - * Retrieve a policy by providing a policy ID. - * - * @param getPolicyOptions the {@link GetPolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateMetaData} - */ - public ServiceCall getPolicy(GetPolicyOptions getPolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyOptions, - "getPolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_id", getPolicyOptions.policyId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicy"); - 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); - } - - /** - * Delete a policy by ID. - * - * Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service - * ID. If the subject of the policy is a locked service-id, the request will fail. - * - * @param deletePolicyOptions the {@link DeletePolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deletePolicy(DeletePolicyOptions deletePolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyOptions, - "deletePolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_id", deletePolicyOptions.policyId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Restore a deleted policy by ID. - * - * Restore a policy that has recently been deleted. A policy administrator might want to restore a deleted policy. To - * restore a policy, use **`"state": "active"`** in the body. - * - * @param updatePolicyStateOptions the {@link UpdatePolicyStateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Policy} - */ - public ServiceCall updatePolicyState(UpdatePolicyStateOptions updatePolicyStateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updatePolicyStateOptions, - "updatePolicyStateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_id", updatePolicyStateOptions.policyId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updatePolicyState"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updatePolicyStateOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - if (updatePolicyStateOptions.state() != null) { - contentJson.addProperty("state", updatePolicyStateOptions.state()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get roles by filters. - * - * Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can - * be done through query parameters. Currently, we only support the following attributes: account_id, service_name, - * service_group_id, source_service_name and policy_type. Both service_name and service_group_id attributes are - * mutually exclusive. Only roles that match the filter and that the caller has read access to are returned. If the - * caller does not have read access to any roles an empty array is returned. - * - * @param listRolesOptions the {@link ListRolesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleCollection} - */ - public ServiceCall listRoles(ListRolesOptions listRolesOptions) { - if (listRolesOptions == null) { - listRolesOptions = new ListRolesOptions.Builder().build(); - } - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoles"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listRolesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listRolesOptions.acceptLanguage()); - } - if (listRolesOptions.accountId() != null) { - builder.query("account_id", String.valueOf(listRolesOptions.accountId())); - } - if (listRolesOptions.serviceName() != null) { - builder.query("service_name", String.valueOf(listRolesOptions.serviceName())); - } - if (listRolesOptions.sourceServiceName() != null) { - builder.query("source_service_name", String.valueOf(listRolesOptions.sourceServiceName())); - } - if (listRolesOptions.policyType() != null) { - builder.query("policy_type", String.valueOf(listRolesOptions.policyType())); - } - if (listRolesOptions.serviceGroupId() != null) { - builder.query("service_group_id", String.valueOf(listRolesOptions.serviceGroupId())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get roles by filters. - * - * Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can - * be done through query parameters. Currently, we only support the following attributes: account_id, service_name, - * service_group_id, source_service_name and policy_type. Both service_name and service_group_id attributes are - * mutually exclusive. Only roles that match the filter and that the caller has read access to are returned. If the - * caller does not have read access to any roles an empty array is returned. - * - * @return a {@link ServiceCall} with a result of type {@link RoleCollection} - */ - public ServiceCall listRoles() { - return listRoles(null); - } - - /** - * Create a role. - * - * Creates a custom role for a specific service within the account. An account owner or a user assigned the - * Administrator role on the Role management service can create a custom role. Any number of actions for a single - * service can be mapped to the new role, but there must be at least one service-defined action to successfully create - * the new role. - * - * @param createRoleOptions the {@link CreateRoleOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link CustomRole} - */ - public ServiceCall createRole(CreateRoleOptions createRoleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleOptions, - "createRoleOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRole"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createRoleOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createRoleOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("display_name", createRoleOptions.displayName()); - contentJson.add("actions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleOptions.actions())); - contentJson.addProperty("name", createRoleOptions.name()); - contentJson.addProperty("account_id", createRoleOptions.accountId()); - contentJson.addProperty("service_name", createRoleOptions.serviceName()); - if (createRoleOptions.description() != null) { - contentJson.addProperty("description", createRoleOptions.description()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a role. - * - * Update a custom role. A role administrator might want to update an existing role by updating the display name, - * description, or the actions that are mapped to the role. The name, account_id, and service_name can't be changed. - * - * @param replaceRoleOptions the {@link ReplaceRoleOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link CustomRole} - */ - public ServiceCall replaceRole(ReplaceRoleOptions replaceRoleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceRoleOptions, - "replaceRoleOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_id", replaceRoleOptions.roleId()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceRole"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replaceRoleOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("display_name", replaceRoleOptions.displayName()); - contentJson.add("actions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRoleOptions.actions())); - if (replaceRoleOptions.description() != null) { - contentJson.addProperty("description", replaceRoleOptions.description()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a role by ID. - * - * Retrieve a role by providing a role ID. - * - * @param getRoleOptions the {@link GetRoleOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link CustomRole} - */ - public ServiceCall getRole(GetRoleOptions getRoleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleOptions, - "getRoleOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_id", getRoleOptions.roleId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRole"); - 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); - } - - /** - * Delete a role by ID. - * - * Delete a role by providing a role ID. - * - * @param deleteRoleOptions the {@link DeleteRoleOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteRole(DeleteRoleOptions deleteRoleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleOptions, - "deleteRoleOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_id", deleteRoleOptions.roleId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRole"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get policies by attributes. - * - * Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account - * and filter by attribute values. This can be done through query parameters. The following attributes are supported: - * account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query - * parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If - * the caller does not have read access to any policies an empty array is returned. - * - * @param listV2PoliciesOptions the {@link ListV2PoliciesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link V2PolicyCollection} - */ - public ServiceCall listV2Policies(ListV2PoliciesOptions listV2PoliciesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listV2PoliciesOptions, - "listV2PoliciesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listV2Policies"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listV2PoliciesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listV2PoliciesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listV2PoliciesOptions.accountId())); - if (listV2PoliciesOptions.iamId() != null) { - builder.query("iam_id", String.valueOf(listV2PoliciesOptions.iamId())); - } - if (listV2PoliciesOptions.accessGroupId() != null) { - builder.query("access_group_id", String.valueOf(listV2PoliciesOptions.accessGroupId())); - } - if (listV2PoliciesOptions.type() != null) { - builder.query("type", String.valueOf(listV2PoliciesOptions.type())); - } - if (listV2PoliciesOptions.serviceType() != null) { - builder.query("service_type", String.valueOf(listV2PoliciesOptions.serviceType())); - } - if (listV2PoliciesOptions.serviceName() != null) { - builder.query("service_name", String.valueOf(listV2PoliciesOptions.serviceName())); - } - if (listV2PoliciesOptions.serviceGroupId() != null) { - builder.query("service_group_id", String.valueOf(listV2PoliciesOptions.serviceGroupId())); - } - if (listV2PoliciesOptions.sort() != null) { - builder.query("sort", String.valueOf(listV2PoliciesOptions.sort())); - } - if (listV2PoliciesOptions.format() != null) { - builder.query("format", String.valueOf(listV2PoliciesOptions.format())); - } - if (listV2PoliciesOptions.state() != null) { - builder.query("state", String.valueOf(listV2PoliciesOptions.state())); - } - if (listV2PoliciesOptions.limit() != null) { - builder.query("limit", String.valueOf(listV2PoliciesOptions.limit())); - } - if (listV2PoliciesOptions.start() != null) { - builder.query("start", String.valueOf(listV2PoliciesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a policy. - * - * Creates a policy to grant access between a subject and a resource. Currently, there is one type of a v2/policy: - * **access**. A policy administrator might want to create an access policy that grants access to a user, service-id, - * or an access group. - * - * ### Access - * - * To create an access policy, use **`"type": "access"`** in the body. The supported subject attributes are - * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute to assign access to a user or - * service-id. Use the **`access_group_id`** subject attribute to assign access to an access group. Assign roles that - * are supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or - * **`service_group_id`** attribute and the **`accountId`** attribute. In the rule field, you can specify a single - * condition by using **`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`** with a - * combination **`operator`**. The possible combination operators are **`and`** and **`or`**. - * - * Currently, we support two types of patterns: - * - * 1. `time-based`: Used to specify a time-based restriction - * - * Combine conditions to specify a time-based restriction (e.g., access only during business hours, during the - * Monday-Friday work week). For example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following - * rule: - * ```json - * "rule": { - * "operator": "and", - * "conditions": [{ - * "key": "{{environment.attributes.day_of_week}}", - * "operator": "dayOfWeekAnyOf", - * "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] - * }, - * "key": "{{environment.attributes.current_time}}", - * "operator": "timeGreaterThanOrEquals", - * "value": "09:00:00+00:00" - * }, - * "key": "{{environment.attributes.current_time}}", - * "operator": "timeLessThanOrEquals", - * "value": "17:00:00+00:00" - * }] - * } - * ``` You can use the following operators in the **`key`** and **`value`** pair: - * ``` - * 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', - * 'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan', 'dateGreaterThanOrEquals', - * 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', - * 'dayOfWeekEquals', 'dayOfWeekAnyOf' - * ``` - * - * The pattern field that matches the rule is required when rule is provided. For the business hour rule example - * above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions - * operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) and - * [Limiting access with time-based conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the - * subject is a locked service-id, the request will fail. - * - * 2. `attribute-based`: Used to specify a combination of OR/AND based conditions applied on resource attributes. - * - * Combine conditions to specify an attribute-based condition using AND/OR-based operators. - * - * For example, a policy can grant access based on multiple conditions applied on the resource attributes below: - * ```json - * "pattern": "attribute-based-condition:resource:literal-and-wildcard" - * "rule": { - * "operator": "or", - * "conditions": [ - * { - * "operator": "and", - * "conditions": [ - * { - * "key": "{{resource.attributes.prefix}}", - * "operator": "stringEquals", - * "value": "home/test" - * }, - * { - * "key": "{{environment.attributes.delimiter}}", - * "operator": "stringEquals", - * "value": "/" - * } - * ] - * }, - * { - * "key": "{{resource.attributes.path}}", - * "operator": "stringMatch", - * "value": "home/David/_*" - * } - * ] - * } - * ``` - * - * In addition to satisfying the `resources` section, the policy grants permission only if either the `path` begins - * with `home/David/` **OR** the `prefix` is `home/test` and the `delimiter` is `/`. This mechanism helps you - * consolidate multiple policies in to a single policy, making policies easier to administer and stay within the - * policy limit for an account. View the list of operators that can be used in the condition - * [here](/docs/account?topic=account-wildcard#string-comparisons). - * - * ### Authorization - * - * Authorization policies are supported by services on a case by case basis. Refer to service documentation to verify - * their support of authorization policies. To create an authorization policy, use **`"type": "authorization"`** in - * the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject - * attributes might be provided. The following attributes are supported: - * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are - * supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access - * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject - * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. - * - * ### Attribute Operators - * - * Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators are available. For more - * information, see [Assigning access by using wildcard - * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). - * - * ### Attribute Validations - * - * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like - * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated - * against Global Catalog locations. - * - * @param createV2PolicyOptions the {@link CreateV2PolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link V2Policy} - */ - public ServiceCall createV2Policy(CreateV2PolicyOptions createV2PolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createV2PolicyOptions, - "createV2PolicyOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createV2Policy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createV2PolicyOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createV2PolicyOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.add("control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.control())); - contentJson.addProperty("type", createV2PolicyOptions.type()); - if (createV2PolicyOptions.description() != null) { - contentJson.addProperty("description", createV2PolicyOptions.description()); - } - if (createV2PolicyOptions.subject() != null) { - contentJson.add("subject", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.subject())); - } - if (createV2PolicyOptions.resource() != null) { - contentJson.add("resource", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.resource())); - } - if (createV2PolicyOptions.pattern() != null) { - contentJson.addProperty("pattern", createV2PolicyOptions.pattern()); - } - if (createV2PolicyOptions.rule() != null) { - contentJson.add("rule", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.rule())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a policy. - * - * Update a policy to grant access between a subject and a resource. A policy administrator might want to update an - * existing policy. - * - * ### Access - * - * To update an access policy, use **`"type": "access"`** in the body. The supported subject attributes are - * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute to assign access to a user or - * service-id. Use the **`access_group_id`** subject attribute to assign access to an access group. Assign roles that - * are supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or - * **`service_group_id`** attribute and the **`accountId`** attribute. In the rule field, you can specify a single - * condition by using **`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`** with a - * combination **`operator`**. The possible combination operators are **`and`** and **`or`**. - * - * Currently, we support two types of patterns: - * - * 1. `time-based`: Used to specify a time-based restriction - * - * Combine conditions to specify a time-based restriction (e.g., access only during business hours, during the - * Monday-Friday work week). For example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following - * rule: - * ```json - * "rule": { - * "operator": "and", - * "conditions": [{ - * "key": "{{environment.attributes.day_of_week}}", - * "operator": "dayOfWeekAnyOf", - * "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] - * }, - * "key": "{{environment.attributes.current_time}}", - * "operator": "timeGreaterThanOrEquals", - * "value": "09:00:00+00:00" - * }, - * "key": "{{environment.attributes.current_time}}", - * "operator": "timeLessThanOrEquals", - * "value": "17:00:00+00:00" - * }] - * } - * ``` You can use the following operators in the **`key`** and **`value`** pair: - * ``` - * 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', - * 'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan', 'dateGreaterThanOrEquals', - * 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', - * 'dayOfWeekEquals', 'dayOfWeekAnyOf' - * ``` The pattern field that matches the rule is required when rule is provided. For the business hour rule example - * above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions - * operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) and - * [Limiting access with time-based conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the - * subject is a locked service-id, the request will fail. - * - * 2. `attribute-based`: Used to specify a combination of OR/AND based conditions applied on resource attributes. - * - * Combine conditions to specify an attribute-based condition using AND/OR-based operators. - * - * For example, a policy can grant access based on multiple conditions applied on the resource attributes below: - * ```json - * "pattern": "attribute-based-condition:resource:literal-and-wildcard" - * "rule": { - * "operator": "or", - * "conditions": [ - * { - * "operator": "and", - * "conditions": [ - * { - * "key": "{{resource.attributes.prefix}}", - * "operator": "stringEquals", - * "value": "home/test" - * }, - * { - * "key": "{{environment.attributes.delimiter}}", - * "operator": "stringEquals", - * "value": "/" - * } - * ] - * }, - * { - * "key": "{{resource.attributes.path}}", - * "operator": "stringMatch", - * "value": "home/David/_*" - * } - * ] - * } - * ``` - * - * In addition to satisfying the `resources` section, the policy grants permission only if either the `path` begins - * with `home/David/` **OR** the `prefix` is `home/test` and the `delimiter` is `/`. This mechanism helps you - * consolidate multiple policies in to a single policy, making policies easier to administer and stay within the - * policy limit for an account. View the list of operators that can be used in the condition - * [here](/docs/account?topic=account-wildcard#string-comparisons). - * - * ### Authorization - * - * To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match - * the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following - * attributes are supported: - * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are - * supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access - * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject - * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. - * - * ### Attribute Operators - * - * Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators are available. For more - * information, see [Assigning access by using wildcard - * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). - * - * ### Attribute Validations - * - * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like - * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated - * against Global Catalog locations. - * - * @param replaceV2PolicyOptions the {@link ReplaceV2PolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link V2Policy} - */ - public ServiceCall replaceV2Policy(ReplaceV2PolicyOptions replaceV2PolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceV2PolicyOptions, - "replaceV2PolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", replaceV2PolicyOptions.id()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceV2Policy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replaceV2PolicyOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.add("control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.control())); - contentJson.addProperty("type", replaceV2PolicyOptions.type()); - if (replaceV2PolicyOptions.description() != null) { - contentJson.addProperty("description", replaceV2PolicyOptions.description()); - } - if (replaceV2PolicyOptions.subject() != null) { - contentJson.add("subject", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.subject())); - } - if (replaceV2PolicyOptions.resource() != null) { - contentJson.add("resource", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.resource())); - } - if (replaceV2PolicyOptions.pattern() != null) { - contentJson.addProperty("pattern", replaceV2PolicyOptions.pattern()); - } - if (replaceV2PolicyOptions.rule() != null) { - contentJson.add("rule", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.rule())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a policy by ID. - * - * Retrieve a policy by providing a policy ID. - * - * @param getV2PolicyOptions the {@link GetV2PolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link V2PolicyTemplateMetaData} - */ - public ServiceCall getV2Policy(GetV2PolicyOptions getV2PolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getV2PolicyOptions, - "getV2PolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", getV2PolicyOptions.id()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getV2Policy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getV2PolicyOptions.format() != null) { - builder.query("format", String.valueOf(getV2PolicyOptions.format())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a policy by ID. - * - * Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service - * ID. If the subject of the policy is a locked service-id, the request will fail. - * - * @param deleteV2PolicyOptions the {@link DeleteV2PolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteV2Policy(DeleteV2PolicyOptions deleteV2PolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteV2PolicyOptions, - "deleteV2PolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", deleteV2PolicyOptions.id()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteV2Policy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List policy templates by attributes. - * - * List policy templates and filter by attributes by using query parameters. The following attributes are supported: - * `account_id`, `policy_service_name`, `policy_service_type`, `policy_service_group_id` and `policy_type`. - * `account_id` is a required query parameter. These attributes `policy_service_name`, `policy_service_type` and - * `policy_service_group_id` are mutually exclusive. Only policy templates that have the specified attributes and that - * the caller has read access to are returned. If the caller does not have read access to any policy templates an - * empty array is returned. - * - * @param listPolicyTemplatesOptions the {@link ListPolicyTemplatesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateCollection} - */ - public ServiceCall listPolicyTemplates(ListPolicyTemplatesOptions listPolicyTemplatesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyTemplatesOptions, - "listPolicyTemplatesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyTemplates"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listPolicyTemplatesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listPolicyTemplatesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listPolicyTemplatesOptions.accountId())); - if (listPolicyTemplatesOptions.state() != null) { - builder.query("state", String.valueOf(listPolicyTemplatesOptions.state())); - } - if (listPolicyTemplatesOptions.name() != null) { - builder.query("name", String.valueOf(listPolicyTemplatesOptions.name())); - } - if (listPolicyTemplatesOptions.policyServiceType() != null) { - builder.query("policy_service_type", String.valueOf(listPolicyTemplatesOptions.policyServiceType())); - } - if (listPolicyTemplatesOptions.policyServiceName() != null) { - builder.query("policy_service_name", String.valueOf(listPolicyTemplatesOptions.policyServiceName())); - } - if (listPolicyTemplatesOptions.policyServiceGroupId() != null) { - builder.query("policy_service_group_id", String.valueOf(listPolicyTemplatesOptions.policyServiceGroupId())); - } - if (listPolicyTemplatesOptions.policyType() != null) { - builder.query("policy_type", String.valueOf(listPolicyTemplatesOptions.policyType())); - } - if (listPolicyTemplatesOptions.limit() != null) { - builder.query("limit", String.valueOf(listPolicyTemplatesOptions.limit())); - } - if (listPolicyTemplatesOptions.start() != null) { - builder.query("start", String.valueOf(listPolicyTemplatesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a policy template. - * - * Create a policy template. Policy templates define a policy without requiring a subject, and you can use them to - * grant access to multiple subjects. - * - * @param createPolicyTemplateOptions the {@link CreatePolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateLimitData} - */ - public ServiceCall createPolicyTemplate(CreatePolicyTemplateOptions createPolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateOptions, - "createPolicyTemplateOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createPolicyTemplateOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createPolicyTemplateOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("name", createPolicyTemplateOptions.name()); - contentJson.addProperty("account_id", createPolicyTemplateOptions.accountId()); - contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateOptions.policy())); - if (createPolicyTemplateOptions.description() != null) { - contentJson.addProperty("description", createPolicyTemplateOptions.description()); - } - if (createPolicyTemplateOptions.committed() != null) { - contentJson.addProperty("committed", createPolicyTemplateOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve latest version of a policy template. - * - * Retrieve the latest version of a policy template by providing a policy template ID. - * - * @param getPolicyTemplateOptions the {@link GetPolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} - */ - public ServiceCall getPolicyTemplate(GetPolicyTemplateOptions getPolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyTemplateOptions, - "getPolicyTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", getPolicyTemplateOptions.policyTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getPolicyTemplateOptions.state() != null) { - builder.query("state", String.valueOf(getPolicyTemplateOptions.state())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a policy template. - * - * Delete a policy template by providing the policy template ID. This deletes all versions of this template. A policy - * template can't be deleted if any version of the template is assigned to one or more child accounts. You must remove - * the policy assignments first. - * - * @param deletePolicyTemplateOptions the {@link DeletePolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deletePolicyTemplate(DeletePolicyTemplateOptions deletePolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyTemplateOptions, - "deletePolicyTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", deletePolicyTemplateOptions.policyTemplateId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a new policy template version. - * - * Create a new version of a policy template. Use this if you need to make updates to a policy template that is - * committed. - * - * @param createPolicyTemplateVersionOptions the {@link CreatePolicyTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateLimitData} - */ - public ServiceCall createPolicyTemplateVersion(CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateVersionOptions, - "createPolicyTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", createPolicyTemplateVersionOptions.policyTemplateId()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - final JsonObject contentJson = new JsonObject(); - contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateVersionOptions.policy())); - if (createPolicyTemplateVersionOptions.name() != null) { - contentJson.addProperty("name", createPolicyTemplateVersionOptions.name()); - } - if (createPolicyTemplateVersionOptions.description() != null) { - contentJson.addProperty("description", createPolicyTemplateVersionOptions.description()); - } - if (createPolicyTemplateVersionOptions.committed() != null) { - contentJson.addProperty("committed", createPolicyTemplateVersionOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve policy template versions. - * - * Retrieve the versions of a policy template by providing a policy template ID. - * - * @param listPolicyTemplateVersionsOptions the {@link ListPolicyTemplateVersionsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateVersionsCollection} - */ - public ServiceCall listPolicyTemplateVersions(ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyTemplateVersionsOptions, - "listPolicyTemplateVersionsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", listPolicyTemplateVersionsOptions.policyTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyTemplateVersions"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listPolicyTemplateVersionsOptions.state() != null) { - builder.query("state", String.valueOf(listPolicyTemplateVersionsOptions.state())); - } - if (listPolicyTemplateVersionsOptions.limit() != null) { - builder.query("limit", String.valueOf(listPolicyTemplateVersionsOptions.limit())); - } - if (listPolicyTemplateVersionsOptions.start() != null) { - builder.query("start", String.valueOf(listPolicyTemplateVersionsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a policy template version. - * - * Update a specific version of a policy template. You can use this only if the version isn't committed. - * - * @param replacePolicyTemplateOptions the {@link ReplacePolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} - */ - public ServiceCall replacePolicyTemplate(ReplacePolicyTemplateOptions replacePolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replacePolicyTemplateOptions, - "replacePolicyTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", replacePolicyTemplateOptions.policyTemplateId()); - pathParamsMap.put("version", replacePolicyTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replacePolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replacePolicyTemplateOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyTemplateOptions.policy())); - if (replacePolicyTemplateOptions.name() != null) { - contentJson.addProperty("name", replacePolicyTemplateOptions.name()); - } - if (replacePolicyTemplateOptions.description() != null) { - contentJson.addProperty("description", replacePolicyTemplateOptions.description()); - } - if (replacePolicyTemplateOptions.committed() != null) { - contentJson.addProperty("committed", replacePolicyTemplateOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a policy template version. - * - * Delete a specific version of a policy template by providing a policy template ID and version number. You can't - * delete a policy template version that is assigned to one or more child accounts. You must remove the policy - * assignments first. - * - * @param deletePolicyTemplateVersionOptions the {@link DeletePolicyTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deletePolicyTemplateVersion(DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyTemplateVersionOptions, - "deletePolicyTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", deletePolicyTemplateVersionOptions.policyTemplateId()); - pathParamsMap.put("version", deletePolicyTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a policy template version. - * - * Retrieve a policy template by providing a policy template ID and version number. - * - * @param getPolicyTemplateVersionOptions the {@link GetPolicyTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} - */ - public ServiceCall getPolicyTemplateVersion(GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyTemplateVersionOptions, - "getPolicyTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", getPolicyTemplateVersionOptions.policyTemplateId()); - pathParamsMap.put("version", getPolicyTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyTemplateVersion"); - 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); - } - - /** - * Commit a policy template version. - * - * Commit a policy template version. You can make no further changes to the policy template once it's committed. If - * you need to make updates after committing a version, create a new version. - * - * @param commitPolicyTemplateOptions the {@link CommitPolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall commitPolicyTemplate(CommitPolicyTemplateOptions commitPolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(commitPolicyTemplateOptions, - "commitPolicyTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", commitPolicyTemplateOptions.policyTemplateId()); - pathParamsMap.put("version", commitPolicyTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}/commit", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitPolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get policy template assignments. - * - * Get policy template assignments by attributes. The following attributes are supported: - * `account_id`, `template_id`, `template_version`, `sort`. - * `account_id` is a required query parameter. Only policy template assignments that have the specified attributes and - * that the caller has read access to are returned. If the caller does not have read access to any policy template - * assignments an empty array is returned. - * - * @param listPolicyAssignmentsOptions the {@link ListPolicyAssignmentsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateAssignmentCollection} - */ - public ServiceCall listPolicyAssignments(ListPolicyAssignmentsOptions listPolicyAssignmentsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyAssignmentsOptions, - "listPolicyAssignmentsOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyAssignments"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listPolicyAssignmentsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listPolicyAssignmentsOptions.acceptLanguage()); - } - builder.query("version", String.valueOf(listPolicyAssignmentsOptions.version())); - builder.query("account_id", String.valueOf(listPolicyAssignmentsOptions.accountId())); - if (listPolicyAssignmentsOptions.templateId() != null) { - builder.query("template_id", String.valueOf(listPolicyAssignmentsOptions.templateId())); - } - if (listPolicyAssignmentsOptions.templateVersion() != null) { - builder.query("template_version", String.valueOf(listPolicyAssignmentsOptions.templateVersion())); - } - if (listPolicyAssignmentsOptions.limit() != null) { - builder.query("limit", String.valueOf(listPolicyAssignmentsOptions.limit())); - } - if (listPolicyAssignmentsOptions.start() != null) { - builder.query("start", String.valueOf(listPolicyAssignmentsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a policy authorization template assignment. - * - * Assign a policy template to child accounts and account groups. This creates the policy in the accounts and account - * groups that you specify. - * - * @param createPolicyTemplateAssignmentOptions the {@link CreatePolicyTemplateAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyAssignmentV1Collection} - */ - public ServiceCall createPolicyTemplateAssignment(CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateAssignmentOptions, - "createPolicyTemplateAssignmentOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplateAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createPolicyTemplateAssignmentOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createPolicyTemplateAssignmentOptions.acceptLanguage()); - } - builder.query("version", String.valueOf(createPolicyTemplateAssignmentOptions.version())); - final JsonObject contentJson = new JsonObject(); - contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateAssignmentOptions.target())); - contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateAssignmentOptions.templates())); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a policy assignment. - * - * Retrieve a policy template assignment by providing a policy assignment ID. - * - * @param getPolicyAssignmentOptions the {@link GetPolicyAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateAssignmentItems} - */ - public ServiceCall getPolicyAssignment(GetPolicyAssignmentOptions getPolicyAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyAssignmentOptions, - "getPolicyAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", getPolicyAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(getPolicyAssignmentOptions.version())); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a policy authorization type assignment. - * - * Update a policy assignment by providing a policy assignment ID. - * - * @param updatePolicyAssignmentOptions the {@link UpdatePolicyAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyAssignmentV1} - */ - public ServiceCall updatePolicyAssignment(UpdatePolicyAssignmentOptions updatePolicyAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updatePolicyAssignmentOptions, - "updatePolicyAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", updatePolicyAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updatePolicyAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updatePolicyAssignmentOptions.ifMatch()); - builder.query("version", String.valueOf(updatePolicyAssignmentOptions.version())); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("template_version", updatePolicyAssignmentOptions.templateVersion()); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Remove a policy assignment. - * - * Remove a policy template assignment by providing a policy assignment ID. You can't delete a policy assignment if - * the status is "in_progress". - * - * @param deletePolicyAssignmentOptions the {@link DeletePolicyAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deletePolicyAssignment(DeletePolicyAssignmentOptions deletePolicyAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyAssignmentOptions, - "deletePolicyAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", deletePolicyAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve Access Management account settings by account ID. - * - * Retrieve Access Management settings for an account by providing the account ID. - * - * @param getSettingsOptions the {@link GetSettingsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AccountSettingsAccessManagement} - */ - public ServiceCall getSettings(GetSettingsOptions getSettingsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getSettingsOptions, - "getSettingsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", getSettingsOptions.accountId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/settings/access_management", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getSettings"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getSettingsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", getSettingsOptions.acceptLanguage()); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update Access Management account settings by account ID. - * - * Update access management settings for an account. - * - * ### External Account Identity Interaction - * - * Update the way identities within an external account are allowed to interact with the requested account by - * providing: - * * the `account_id` as a parameter - * * one or more external account ID(s) and state for the specific identity in the request body - * - * External account identity interaction includes the following `identity_types`: `user` (user identities that are - * defined as [IBMid's](https://cloud.ibm.com/docs/account?topic=account-identity-overview#users-bestpract)), - * `service_id` (defined as [IAM - * ServiceIds](https://cloud.ibm.com/docs/account?topic=account-identity-overview#serviceid-bestpract)), `service` - * (defined by a service’s [CRN](https://cloud.ibm.com/docs/account?topic=account-crn)). To update an Identity’s - * setting, the `state` and `external_allowed_accounts` fields are required. - * - * Different identity states are: - * * "enabled": An identity type is allowed to access resources in the account provided it has access policies on - * those resources. - * * "limited": An identity type is allowed to access resources in the account provided it has access policies on - * those resources AND it is associated with either the account the resources are in or one of the allowed accounts. - * This setting uses the "external_allowed_accounts" list. - * * "monitor": It has no direct impact on an Identity’s access. Instead, it creates AT events for access decisions as - * if the account were in a limited “state”. - * - * **Note**: The state "enabled" is a special case. In this case, access is given to all accounts and there is no need - * to specify a particular list. Therefore, when updating "state" to "enabled" for an identity type - * "external_allowed_accounts" should be left empty. - * - * @param updateSettingsOptions the {@link UpdateSettingsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AccountSettingsAccessManagement} - */ - public ServiceCall updateSettings(UpdateSettingsOptions updateSettingsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateSettingsOptions, - "updateSettingsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", updateSettingsOptions.accountId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/settings/access_management", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateSettings"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updateSettingsOptions.ifMatch()); - if (updateSettingsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", updateSettingsOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - if (updateSettingsOptions.externalAccountIdentityInteraction() != null) { - contentJson.add("external_account_identity_interaction", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateSettingsOptions.externalAccountIdentityInteraction())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List action control templates by attributes. - * - * List action control templates and filter by attributes by using query parameters. The following attributes are - * supported: - * `account_id` - * `account_id` is a required query parameter. Only action control templates that have the specified attributes and - * that the caller has read access to are returned. If the caller does not have read access to any action control - * templates an empty array is returned. - * - * @param listActionControlTemplatesOptions the {@link ListActionControlTemplatesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplateCollection} - */ - public ServiceCall listActionControlTemplates(ListActionControlTemplatesOptions listActionControlTemplatesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlTemplatesOptions, - "listActionControlTemplatesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlTemplates"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listActionControlTemplatesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listActionControlTemplatesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listActionControlTemplatesOptions.accountId())); - if (listActionControlTemplatesOptions.limit() != null) { - builder.query("limit", String.valueOf(listActionControlTemplatesOptions.limit())); - } - if (listActionControlTemplatesOptions.start() != null) { - builder.query("start", String.valueOf(listActionControlTemplatesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create an action control template. - * - * Create an action control template. Action control templates define a service action control. - * - * @param createActionControlTemplateOptions the {@link CreateActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall createActionControlTemplate(CreateActionControlTemplateOptions createActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateOptions, - "createActionControlTemplateOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createActionControlTemplateOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createActionControlTemplateOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("name", createActionControlTemplateOptions.name()); - contentJson.addProperty("account_id", createActionControlTemplateOptions.accountId()); - if (createActionControlTemplateOptions.description() != null) { - contentJson.addProperty("description", createActionControlTemplateOptions.description()); - } - if (createActionControlTemplateOptions.committed() != null) { - contentJson.addProperty("committed", createActionControlTemplateOptions.committed()); - } - if (createActionControlTemplateOptions.actionControl() != null) { - contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateOptions.actionControl())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve the latest version of an action control template. - * - * Retrieve the latest version of an action control template by providing an action control template ID. - * - * @param getActionControlTemplateOptions the {@link GetActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall getActionControlTemplate(GetActionControlTemplateOptions getActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlTemplateOptions, - "getActionControlTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", getActionControlTemplateOptions.actionControlTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getActionControlTemplateOptions.state() != null) { - builder.query("state", String.valueOf(getActionControlTemplateOptions.state())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete an action control template. - * - * Delete an action control template by providing the action control template ID. This deletes all versions of this - * template. An action control template can't be deleted if any version of the template is assigned to one or more - * child accounts. You must remove the action control assignments first. - * - * @param deleteActionControlTemplateOptions the {@link DeleteActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteActionControlTemplate(DeleteActionControlTemplateOptions deleteActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlTemplateOptions, - "deleteActionControlTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", deleteActionControlTemplateOptions.actionControlTemplateId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a new action control template version. - * - * Create a new version of an action control template. Use this if you need to make updates to an action control - * template that is committed. - * - * @param createActionControlTemplateVersionOptions the {@link CreateActionControlTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall createActionControlTemplateVersion(CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateVersionOptions, - "createActionControlTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", createActionControlTemplateVersionOptions.actionControlTemplateId()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - final JsonObject contentJson = new JsonObject(); - if (createActionControlTemplateVersionOptions.name() != null) { - contentJson.addProperty("name", createActionControlTemplateVersionOptions.name()); - } - if (createActionControlTemplateVersionOptions.description() != null) { - contentJson.addProperty("description", createActionControlTemplateVersionOptions.description()); - } - if (createActionControlTemplateVersionOptions.actionControl() != null) { - contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateVersionOptions.actionControl())); - } - if (createActionControlTemplateVersionOptions.committed() != null) { - contentJson.addProperty("committed", createActionControlTemplateVersionOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve action control template versions. - * - * Retrieve the versions of an action control template by providing an action control template ID. - * - * @param listActionControlTemplateVersionsOptions the {@link ListActionControlTemplateVersionsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplateVersionsCollection} - */ - public ServiceCall listActionControlTemplateVersions(ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlTemplateVersionsOptions, - "listActionControlTemplateVersionsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", listActionControlTemplateVersionsOptions.actionControlTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlTemplateVersions"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listActionControlTemplateVersionsOptions.state() != null) { - builder.query("state", String.valueOf(listActionControlTemplateVersionsOptions.state())); - } - if (listActionControlTemplateVersionsOptions.limit() != null) { - builder.query("limit", String.valueOf(listActionControlTemplateVersionsOptions.limit())); - } - if (listActionControlTemplateVersionsOptions.start() != null) { - builder.query("start", String.valueOf(listActionControlTemplateVersionsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update an action control template version. - * - * Update a specific version of an action control template. You can use this only if the version isn't committed. - * - * @param replaceActionControlTemplateOptions the {@link ReplaceActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall replaceActionControlTemplate(ReplaceActionControlTemplateOptions replaceActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceActionControlTemplateOptions, - "replaceActionControlTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", replaceActionControlTemplateOptions.actionControlTemplateId()); - pathParamsMap.put("version", replaceActionControlTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replaceActionControlTemplateOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - if (replaceActionControlTemplateOptions.name() != null) { - contentJson.addProperty("name", replaceActionControlTemplateOptions.name()); - } - if (replaceActionControlTemplateOptions.description() != null) { - contentJson.addProperty("description", replaceActionControlTemplateOptions.description()); - } - if (replaceActionControlTemplateOptions.actionControl() != null) { - contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceActionControlTemplateOptions.actionControl())); - } - if (replaceActionControlTemplateOptions.committed() != null) { - contentJson.addProperty("committed", replaceActionControlTemplateOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete an action control template version. - * - * Delete a specific version of an action control template by providing an action control template ID and version - * number. You can't delete an action control template version that is assigned to one or more child accounts. You - * must remove the action control assignments first. - * - * @param deleteActionControlTemplateVersionOptions the {@link DeleteActionControlTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteActionControlTemplateVersion(DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlTemplateVersionOptions, - "deleteActionControlTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", deleteActionControlTemplateVersionOptions.actionControlTemplateId()); - pathParamsMap.put("version", deleteActionControlTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve an action control template version. - * - * Retrieve an action control template by providing an action control template ID and version number. - * - * @param getActionControlTemplateVersionOptions the {@link GetActionControlTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall getActionControlTemplateVersion(GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlTemplateVersionOptions, - "getActionControlTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", getActionControlTemplateVersionOptions.actionControlTemplateId()); - pathParamsMap.put("version", getActionControlTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlTemplateVersion"); - 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); - } - - /** - * Commit an action control template version. - * - * Commit an action control template version. You cannot make any further changes to the action control template once - * it's committed. If you have to make updates after committing a version, create a new version. - * - * @param commitActionControlTemplateOptions the {@link CommitActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall commitActionControlTemplate(CommitActionControlTemplateOptions commitActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(commitActionControlTemplateOptions, - "commitActionControlTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", commitActionControlTemplateOptions.actionControlTemplateId()); - pathParamsMap.put("version", commitActionControlTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}/commit", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get action control template assignments. - * - * Get action control template assignments by attributes. The following attributes are supported: - * `account_id`, `template_id`, `template_version`, `sort`. - * `account_id` is a required query parameter. Only action control template assignments with the specified attributes - * and accessible by the caller are returned. If the caller does not have read access to any action control template - * assignments, an empty array is returned. - * - * @param listActionControlAssignmentsOptions the {@link ListActionControlAssignmentsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignmentCollection} - */ - public ServiceCall listActionControlAssignments(ListActionControlAssignmentsOptions listActionControlAssignmentsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlAssignmentsOptions, - "listActionControlAssignmentsOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlAssignments"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listActionControlAssignmentsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listActionControlAssignmentsOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listActionControlAssignmentsOptions.accountId())); - if (listActionControlAssignmentsOptions.templateId() != null) { - builder.query("template_id", String.valueOf(listActionControlAssignmentsOptions.templateId())); - } - if (listActionControlAssignmentsOptions.templateVersion() != null) { - builder.query("template_version", String.valueOf(listActionControlAssignmentsOptions.templateVersion())); - } - if (listActionControlAssignmentsOptions.limit() != null) { - builder.query("limit", String.valueOf(listActionControlAssignmentsOptions.limit())); - } - if (listActionControlAssignmentsOptions.start() != null) { - builder.query("start", String.valueOf(listActionControlAssignmentsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create an action control template assignment. - * - * Assign an action control template to child accounts and account groups. This creates the action control in the - * accounts and account groups that you specify. - * - * @param createActionControlTemplateAssignmentOptions the {@link CreateActionControlTemplateAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignmentCollection} - */ - public ServiceCall createActionControlTemplateAssignment(CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateAssignmentOptions, - "createActionControlTemplateAssignmentOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplateAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createActionControlTemplateAssignmentOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createActionControlTemplateAssignmentOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateAssignmentOptions.target())); - contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateAssignmentOptions.templates())); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve an action control assignment. - * - * Retrieve an action control template assignment by providing an action control assignment ID. - * - * @param getActionControlAssignmentOptions the {@link GetActionControlAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignment} - */ - public ServiceCall getActionControlAssignment(GetActionControlAssignmentOptions getActionControlAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlAssignmentOptions, - "getActionControlAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", getActionControlAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlAssignment"); - 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 an action control assignment. - * - * Update an action control assignment by providing an action control assignment ID. - * - * @param updateActionControlAssignmentOptions the {@link UpdateActionControlAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignment} - */ - public ServiceCall updateActionControlAssignment(UpdateActionControlAssignmentOptions updateActionControlAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateActionControlAssignmentOptions, - "updateActionControlAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", updateActionControlAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateActionControlAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updateActionControlAssignmentOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("template_version", updateActionControlAssignmentOptions.templateVersion()); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Remove an action control assignment. - * - * Remove an action control template assignment by providing an action control assignment ID. You can't delete an - * action control assignment if the status is "in_progress". - * - * @param deleteActionControlAssignmentOptions the {@link DeleteActionControlAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteActionControlAssignment(DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlAssignmentOptions, - "deleteActionControlAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", deleteActionControlAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List role templates by attributes. - * - * List role templates and filter by attributes by using query parameters. The following attributes are supported: - * `account_id`, `name`, `role_name`, `role_service_name`, `state`, `limit`, `start`. - * `account_id` is a required query parameter. Only role templates that have the specified attributes and that the - * caller has read access to are returned. If the caller does not have read access to any role templates an empty - * array is returned. - * - * @param listRoleTemplatesOptions the {@link ListRoleTemplatesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplateCollection} - */ - public ServiceCall listRoleTemplates(ListRoleTemplatesOptions listRoleTemplatesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleTemplatesOptions, - "listRoleTemplatesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleTemplates"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listRoleTemplatesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listRoleTemplatesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listRoleTemplatesOptions.accountId())); - if (listRoleTemplatesOptions.name() != null) { - builder.query("name", String.valueOf(listRoleTemplatesOptions.name())); - } - if (listRoleTemplatesOptions.roleName() != null) { - builder.query("role_name", String.valueOf(listRoleTemplatesOptions.roleName())); - } - if (listRoleTemplatesOptions.roleServiceName() != null) { - builder.query("role_service_name", String.valueOf(listRoleTemplatesOptions.roleServiceName())); - } - if (listRoleTemplatesOptions.state() != null) { - builder.query("state", String.valueOf(listRoleTemplatesOptions.state())); - } - if (listRoleTemplatesOptions.limit() != null) { - builder.query("limit", String.valueOf(listRoleTemplatesOptions.limit())); - } - if (listRoleTemplatesOptions.start() != null) { - builder.query("start", String.valueOf(listRoleTemplatesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create role template. - * - * Create a role template. Role templates define roles from an existing system or service defined role. - * - * @param createRoleTemplateOptions the {@link CreateRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall createRoleTemplate(CreateRoleTemplateOptions createRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateOptions, - "createRoleTemplateOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createRoleTemplateOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createRoleTemplateOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("name", createRoleTemplateOptions.name()); - contentJson.addProperty("account_id", createRoleTemplateOptions.accountId()); - if (createRoleTemplateOptions.description() != null) { - contentJson.addProperty("description", createRoleTemplateOptions.description()); - } - if (createRoleTemplateOptions.committed() != null) { - contentJson.addProperty("committed", createRoleTemplateOptions.committed()); - } - if (createRoleTemplateOptions.role() != null) { - contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateOptions.role())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve the latest version of a role template. - * - * Retrieve the latest version of a role template by providing a role template ID. - * - * @param getRoleTemplateOptions the {@link GetRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall getRoleTemplate(GetRoleTemplateOptions getRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleTemplateOptions, - "getRoleTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", getRoleTemplateOptions.roleTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getRoleTemplateOptions.state() != null) { - builder.query("state", String.valueOf(getRoleTemplateOptions.state())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a Role template. - * - * Delete a role template by providing the role template ID. This deletes all versions of this template. A role - * template can't be deleted if any version of the template is assigned to one or more child accounts. You must remove - * the role assignments first. - * - * @param deleteRoleTemplateOptions the {@link DeleteRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteRoleTemplate(DeleteRoleTemplateOptions deleteRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleTemplateOptions, - "deleteRoleTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", deleteRoleTemplateOptions.roleTemplateId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a new role template version. - * - * Create a new version of a role template. Use this if you need to make updates to a role template that is committed. - * - * @param createRoleTemplateVersionOptions the {@link CreateRoleTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall createRoleTemplateVersion(CreateRoleTemplateVersionOptions createRoleTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateVersionOptions, - "createRoleTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", createRoleTemplateVersionOptions.roleTemplateId()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - final JsonObject contentJson = new JsonObject(); - if (createRoleTemplateVersionOptions.name() != null) { - contentJson.addProperty("name", createRoleTemplateVersionOptions.name()); - } - if (createRoleTemplateVersionOptions.description() != null) { - contentJson.addProperty("description", createRoleTemplateVersionOptions.description()); - } - if (createRoleTemplateVersionOptions.role() != null) { - contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateVersionOptions.role())); - } - if (createRoleTemplateVersionOptions.committed() != null) { - contentJson.addProperty("committed", createRoleTemplateVersionOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve role template versions. - * - * Retrieve the versions of a role template by providing a role template ID. - * - * @param listRoleTemplateVersionsOptions the {@link ListRoleTemplateVersionsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplateVersionsCollection} - */ - public ServiceCall listRoleTemplateVersions(ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleTemplateVersionsOptions, - "listRoleTemplateVersionsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", listRoleTemplateVersionsOptions.roleTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleTemplateVersions"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listRoleTemplateVersionsOptions.state() != null) { - builder.query("state", String.valueOf(listRoleTemplateVersionsOptions.state())); - } - if (listRoleTemplateVersionsOptions.limit() != null) { - builder.query("limit", String.valueOf(listRoleTemplateVersionsOptions.limit())); - } - if (listRoleTemplateVersionsOptions.start() != null) { - builder.query("start", String.valueOf(listRoleTemplateVersionsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a role template version. - * - * Update a specific version of a role template. You can use this only if the version isn't committed. - * - * @param replaceRoleTemplateOptions the {@link ReplaceRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall replaceRoleTemplate(ReplaceRoleTemplateOptions replaceRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceRoleTemplateOptions, - "replaceRoleTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", replaceRoleTemplateOptions.roleTemplateId()); - pathParamsMap.put("version", replaceRoleTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replaceRoleTemplateOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - if (replaceRoleTemplateOptions.name() != null) { - contentJson.addProperty("name", replaceRoleTemplateOptions.name()); - } - if (replaceRoleTemplateOptions.description() != null) { - contentJson.addProperty("description", replaceRoleTemplateOptions.description()); - } - if (replaceRoleTemplateOptions.role() != null) { - contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRoleTemplateOptions.role())); - } - if (replaceRoleTemplateOptions.committed() != null) { - contentJson.addProperty("committed", replaceRoleTemplateOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a role template version. - * - * Delete a specific version of a role template by providing a role template ID and version number. You can't delete a - * role template version that is assigned to one or more child accounts. You must remove the role assignments first. - * - * @param deleteRoleTemplateVersionOptions the {@link DeleteRoleTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteRoleTemplateVersion(DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleTemplateVersionOptions, - "deleteRoleTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", deleteRoleTemplateVersionOptions.roleTemplateId()); - pathParamsMap.put("version", deleteRoleTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a role template version. - * - * Retrieve a role template by providing a role template ID and version number. - * - * @param getRoleTemplateVersionOptions the {@link GetRoleTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall getRoleTemplateVersion(GetRoleTemplateVersionOptions getRoleTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleTemplateVersionOptions, - "getRoleTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", getRoleTemplateVersionOptions.roleTemplateId()); - pathParamsMap.put("version", getRoleTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleTemplateVersion"); - 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); - } - - /** - * Commit a role template version. - * - * Commit a role template version. You cannot make any further changes to the role template once it's committed. If - * you have to make updates after committing a version, create a new version. - * - * @param commitRoleTemplateOptions the {@link CommitRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall commitRoleTemplate(CommitRoleTemplateOptions commitRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(commitRoleTemplateOptions, - "commitRoleTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", commitRoleTemplateOptions.roleTemplateId()); - pathParamsMap.put("version", commitRoleTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}/commit", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get role template assignments. - * - * Get role template assignments by attributes. The following attributes are supported: - * `account_id`, `template_id`, `template_version`, `target`, `target_type`, `limit`, `start`. - * `account_id` is a required query parameter. Only role template assignments with the specified attributes and - * accessible by the caller are returned. If the caller does not have read access to any role template assignments, an - * empty array is returned. - * - * @param listRoleAssignmentsOptions the {@link ListRoleAssignmentsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleAssignmentCollection} - */ - public ServiceCall listRoleAssignments(ListRoleAssignmentsOptions listRoleAssignmentsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleAssignmentsOptions, - "listRoleAssignmentsOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleAssignments"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listRoleAssignmentsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listRoleAssignmentsOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listRoleAssignmentsOptions.accountId())); - if (listRoleAssignmentsOptions.templateId() != null) { - builder.query("template_id", String.valueOf(listRoleAssignmentsOptions.templateId())); - } - if (listRoleAssignmentsOptions.templateVersion() != null) { - builder.query("template_version", String.valueOf(listRoleAssignmentsOptions.templateVersion())); - } - if (listRoleAssignmentsOptions.limit() != null) { - builder.query("limit", String.valueOf(listRoleAssignmentsOptions.limit())); - } - if (listRoleAssignmentsOptions.start() != null) { - builder.query("start", String.valueOf(listRoleAssignmentsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a role template assignment. - * - * Assign a role template to child accounts and account groups. This creates the role in the accounts and account - * groups that you specify. - * - * @param createRoleTemplateAssignmentOptions the {@link CreateRoleTemplateAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleAssignmentCollection} - */ - public ServiceCall createRoleTemplateAssignment(CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateAssignmentOptions, - "createRoleTemplateAssignmentOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplateAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createRoleTemplateAssignmentOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createRoleTemplateAssignmentOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateAssignmentOptions.target())); - contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateAssignmentOptions.templates())); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a role assignment. - * - * Retrieve a role template assignment by providing a role assignment ID. - * - * @param getRoleAssignmentOptions the {@link GetRoleAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleAssignment} - */ - public ServiceCall getRoleAssignment(GetRoleAssignmentOptions getRoleAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleAssignmentOptions, - "getRoleAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", getRoleAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleAssignment"); - 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 a role assignment. - * - * Update a role assignment by providing a role assignment ID. - * - * @param updateRoleAssignmentOptions the {@link UpdateRoleAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleAssignment} - */ - public ServiceCall updateRoleAssignment(UpdateRoleAssignmentOptions updateRoleAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateRoleAssignmentOptions, - "updateRoleAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", updateRoleAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateRoleAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updateRoleAssignmentOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("template_version", updateRoleAssignmentOptions.templateVersion()); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Remove a role assignment. - * - * Remove a role template assignment by providing a role assignment ID. You can't delete a role assignment if the - * status is "in_progress". - * - * @param deleteRoleAssignmentOptions the {@link DeleteRoleAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteRoleAssignment(DeleteRoleAssignmentOptions deleteRoleAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleAssignmentOptions, - "deleteRoleAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", deleteRoleAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java deleted file mode 100644 index af82ea2abe8..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The Access Management Account Settings that are currently set for the requested account. - */ -public class AccountSettingsAccessManagement extends GenericModel { - - @SerializedName("external_account_identity_interaction") - protected ExternalAccountIdentityInteraction externalAccountIdentityInteraction; - - protected AccountSettingsAccessManagement() { } - - /** - * Gets the externalAccountIdentityInteraction. - * - * How external accounts can interact in relation to the requested account. - * - * @return the externalAccountIdentityInteraction - */ - public ExternalAccountIdentityInteraction getExternalAccountIdentityInteraction() { - return externalAccountIdentityInteraction; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java deleted file mode 100644 index ea230f57263..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the assigned action control template. - */ -public class ActionControlAssignment extends GenericModel { - - /** - * The current operation of the action control assignment. - */ - public interface Operation { - /** create. */ - String CREATE = "create"; - /** apply. */ - String APPLY = "apply"; - /** update. */ - String UPDATE = "update"; - /** remove. */ - String REMOVE = "remove"; - } - - /** - * The action control assignment status. - */ - public interface Status { - /** accepted. */ - String ACCEPTED = "accepted"; - /** failure. */ - String FAILURE = "failure"; - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** superseded. */ - String SUPERSEDED = "superseded"; - } - - protected String id; - @SerializedName("account_id") - protected String accountId; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String operation; - protected List resources; - protected ActionControlAssignmentTemplate template; - protected AssignmentTargetDetails target; - protected String status; - - protected ActionControlAssignment() { } - - /** - * Gets the id. - * - * Action control assignment ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the accountId. - * - * The account GUID that the action control assignments belong to. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the href. - * - * The href URL that links to the action control assignments API by action control assignment ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the action control assignment was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the action control assignment. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the action control assignment was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the action control assignment. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the operation. - * - * The current operation of the action control assignment. - * - * @return the operation - */ - public String getOperation() { - return operation; - } - - /** - * Gets the resources. - * - * Resources created when action control template is assigned. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the template. - * - * The action control template id and version that will be assigned. - * - * @return the template - */ - public ActionControlAssignmentTemplate getTemplate() { - return template; - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the status. - * - * The action control assignment status. - * - * @return the status - */ - public String getStatus() { - return status; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java deleted file mode 100644 index a9d6b28ce39..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of action control assignments. - */ -public class ActionControlAssignmentCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List assignments; - - protected ActionControlAssignmentCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the assignments. - * - * List of action control assignments. - * - * @return the assignments - */ - public List getAssignments() { - return assignments; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java deleted file mode 100644 index 122d3c8277b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The action control assignment resources and target where the template is assigned. - */ -public class ActionControlAssignmentResource extends GenericModel { - - protected AssignmentTargetDetails target; - @SerializedName("action_control") - protected ActionControlAssignmentResourceActionControl actionControl; - - protected ActionControlAssignmentResource() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the actionControl. - * - * Set of properties of the assigned resource or error message if assignment failed. - * - * @return the actionControl - */ - public ActionControlAssignmentResourceActionControl getActionControl() { - return actionControl; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java deleted file mode 100644 index 0e5550eb4da..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Set of properties of the assigned resource or error message if assignment failed. - */ -public class ActionControlAssignmentResourceActionControl extends GenericModel { - - @SerializedName("resource_created") - protected ActionControlAssignmentResourceCreated resourceCreated; - @SerializedName("error_message") - protected AssignmentResourceError errorMessage; - - protected ActionControlAssignmentResourceActionControl() { } - - /** - * Gets the resourceCreated. - * - * On success, it includes the action control assigned. - * - * @return the resourceCreated - */ - public ActionControlAssignmentResourceCreated getResourceCreated() { - return resourceCreated; - } - - /** - * Gets the errorMessage. - * - * Body parameters for assignment error. - * - * @return the errorMessage - */ - public AssignmentResourceError getErrorMessage() { - return errorMessage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java deleted file mode 100644 index 6ecbd23392a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * On success, it includes the action control assigned. - */ -public class ActionControlAssignmentResourceCreated extends GenericModel { - - protected String id; - - protected ActionControlAssignmentResourceCreated() { } - - /** - * Gets the id. - * - * action control id. - * - * @return the id - */ - public String getId() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java deleted file mode 100644 index 4e6d2543e18..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The action control template id and version that will be assigned. - */ -public class ActionControlAssignmentTemplate extends GenericModel { - - protected String id; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String version; - - /** - * Instantiates a new Builder from an existing ActionControlAssignmentTemplate instance. - * - * @param actionControlAssignmentTemplate the instance to initialize the Builder with - */ - private Builder(ActionControlAssignmentTemplate actionControlAssignmentTemplate) { - this.id = actionControlAssignmentTemplate.id; - this.version = actionControlAssignmentTemplate.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param id the id - * @param version the version - */ - public Builder(String id, String version) { - this.id = id; - this.version = version; - } - - /** - * Builds a ActionControlAssignmentTemplate. - * - * @return the new ActionControlAssignmentTemplate instance - */ - public ActionControlAssignmentTemplate build() { - return new ActionControlAssignmentTemplate(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the ActionControlAssignmentTemplate builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the ActionControlAssignmentTemplate builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected ActionControlAssignmentTemplate() { } - - protected ActionControlAssignmentTemplate(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - id = builder.id; - version = builder.version; - } - - /** - * New builder. - * - * @return a ActionControlAssignmentTemplate builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * Action control template ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java deleted file mode 100644 index 78b6d56be6d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * ActionControlAssignmentsPager can be used to simplify the use of the "listActionControlAssignments" method. - */ -public class ActionControlAssignmentsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListActionControlAssignmentsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected ActionControlAssignmentsPager() { } - - /** - * Constructs a new ActionControlAssignmentsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlAssignments" method - * @param options the ListActionControlAssignmentsOptions instance to be used to invoke the "listActionControlAssignments" method - */ - public ActionControlAssignmentsPager(IamPolicyManagement client, ListActionControlAssignmentsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<ActionControlAssignment> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListActionControlAssignmentsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - ActionControlAssignmentCollection result = client.listActionControlAssignments(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getAssignments(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<ActionControlAssignment> containing all results returned by the "listActionControlAssignments" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java deleted file mode 100644 index 157c9f6a390..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the action control template. - */ -public class ActionControlTemplate extends GenericModel { - - /** - * State of action control template. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String name; - protected String description; - @SerializedName("account_id") - protected String accountId; - protected Boolean committed; - @SerializedName("action_control") - protected TemplateActionControl actionControl; - protected String id; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String version; - protected String state; - - protected ActionControlTemplate() { } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the description. - * - * Description of the action control template. This is shown to users in the enterprise account. Use this to describe - * the purpose or context of the action control for enterprise users managing IAM templates. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the committed. - * - * Committed status of the template. If committed is set to true, then the template version can no longer be updated. - * - * @return the committed - */ - public Boolean isCommitted() { - return committed; - } - - /** - * Gets the actionControl. - * - * The action control properties that are created in an action resource when the template is assigned. - * - * @return the actionControl - */ - public TemplateActionControl getActionControl() { - return actionControl; - } - - /** - * Gets the id. - * - * The action control template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the action control templates API by action control template ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the action control template was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the action control template. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the action control template was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the action control template. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the version. - * - * The version number of the template used to identify different versions of same template. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the state. - * - * State of action control template. - * - * @return the state - */ - public String getState() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java deleted file mode 100644 index e7536d2c9ae..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of action control templates. - */ -public class ActionControlTemplateCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - @SerializedName("action_control_templates") - protected List actionControlTemplates; - - protected ActionControlTemplateCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the actionControlTemplates. - * - * List of action control templates. - * - * @return the actionControlTemplates - */ - public List getActionControlTemplates() { - return actionControlTemplates; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java deleted file mode 100644 index 5e26f45cf46..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of versions for a specific action control template. - */ -public class ActionControlTemplateVersionsCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List versions; - - protected ActionControlTemplateVersionsCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the versions. - * - * List of action control templates versions. - * - * @return the versions - */ - public List getVersions() { - return versions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java deleted file mode 100644 index 660aefe11ba..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * ActionControlTemplateVersionsPager can be used to simplify the use of the "listActionControlTemplateVersions" method. - */ -public class ActionControlTemplateVersionsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListActionControlTemplateVersionsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected ActionControlTemplateVersionsPager() { } - - /** - * Constructs a new ActionControlTemplateVersionsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlTemplateVersions" method - * @param options the ListActionControlTemplateVersionsOptions instance to be used to invoke the "listActionControlTemplateVersions" method - */ - public ActionControlTemplateVersionsPager(IamPolicyManagement client, ListActionControlTemplateVersionsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<ActionControlTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListActionControlTemplateVersionsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - ActionControlTemplateVersionsCollection result = client.listActionControlTemplateVersions(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getVersions(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<ActionControlTemplate> containing all results returned by the "listActionControlTemplateVersions" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java deleted file mode 100644 index bd326c8d7ec..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * ActionControlTemplatesPager can be used to simplify the use of the "listActionControlTemplates" method. - */ -public class ActionControlTemplatesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListActionControlTemplatesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected ActionControlTemplatesPager() { } - - /** - * Constructs a new ActionControlTemplatesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlTemplates" method - * @param options the ListActionControlTemplatesOptions instance to be used to invoke the "listActionControlTemplates" method - */ - public ActionControlTemplatesPager(IamPolicyManagement client, ListActionControlTemplatesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<ActionControlTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListActionControlTemplatesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - ActionControlTemplateCollection result = client.listActionControlTemplates(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getActionControlTemplates(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<ActionControlTemplate> containing all results returned by the "listActionControlTemplates" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java deleted file mode 100644 index c454c7a3ef5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * On success, includes the policy that is assigned. - */ -public class AssignmentResourceCreated extends GenericModel { - - protected String id; - - protected AssignmentResourceCreated() { } - - /** - * Gets the id. - * - * Policy id. - * - * @return the id - */ - public String getId() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java deleted file mode 100644 index e74dbe58b3a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Body parameters for assignment error. - */ -public class AssignmentResourceError extends GenericModel { - - protected String name; - protected String errorCode; - protected String message; - protected String code; - protected List errors; - - protected AssignmentResourceError() { } - - /** - * Gets the name. - * - * Name of the error. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the errorCode. - * - * error code. - * - * @return the errorCode - */ - public String getErrorCode() { - return errorCode; - } - - /** - * Gets the message. - * - * Error message detailing the nature of the error. - * - * @return the message - */ - public String getMessage() { - return message; - } - - /** - * Gets the code. - * - * Internal status code for the error. - * - * @return the code - */ - public String getCode() { - return code; - } - - /** - * Gets the errors. - * - * The errors encountered during the response. - * - * @return the errors - */ - public List getErrors() { - return errors; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java deleted file mode 100644 index 893d528604c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * assignment target account and type. - */ -public class AssignmentTargetDetails extends GenericModel { - - /** - * Assignment target type. - */ - public interface Type { - /** Account. */ - String ACCOUNT = "Account"; - } - - protected String type; - protected String id; - - /** - * Builder. - */ - public static class Builder { - private String type; - private String id; - - /** - * Instantiates a new Builder from an existing AssignmentTargetDetails instance. - * - * @param assignmentTargetDetails the instance to initialize the Builder with - */ - private Builder(AssignmentTargetDetails assignmentTargetDetails) { - this.type = assignmentTargetDetails.type; - this.id = assignmentTargetDetails.id; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param type the type - * @param id the id - */ - public Builder(String type, String id) { - this.type = type; - this.id = id; - } - - /** - * Builds a AssignmentTargetDetails. - * - * @return the new AssignmentTargetDetails instance - */ - public AssignmentTargetDetails build() { - return new AssignmentTargetDetails(this); - } - - /** - * Set the type. - * - * @param type the type - * @return the AssignmentTargetDetails builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the id. - * - * @param id the id - * @return the AssignmentTargetDetails builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - } - - protected AssignmentTargetDetails() { } - - protected AssignmentTargetDetails(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - type = builder.type; - id = builder.id; - } - - /** - * New builder. - * - * @return a AssignmentTargetDetails builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the type. - * - * Assignment target type. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the id. - * - * ID of the target account. - * - * @return the id - */ - public String id() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java deleted file mode 100644 index b8025e305a9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * policy template details. - */ -public class AssignmentTemplateDetails extends GenericModel { - - protected String id; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String version; - - /** - * Instantiates a new Builder from an existing AssignmentTemplateDetails instance. - * - * @param assignmentTemplateDetails the instance to initialize the Builder with - */ - private Builder(AssignmentTemplateDetails assignmentTemplateDetails) { - this.id = assignmentTemplateDetails.id; - this.version = assignmentTemplateDetails.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a AssignmentTemplateDetails. - * - * @return the new AssignmentTemplateDetails instance - */ - public AssignmentTemplateDetails build() { - return new AssignmentTemplateDetails(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the AssignmentTemplateDetails builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the AssignmentTemplateDetails builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected AssignmentTemplateDetails() { } - - protected AssignmentTemplateDetails(Builder builder) { - id = builder.id; - version = builder.version; - } - - /** - * New builder. - * - * @return a AssignmentTemplateDetails builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * Policy template ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the version. - * - * Policy template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java deleted file mode 100644 index 78291e6c2c5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The commitActionControlTemplate options. - */ -public class CommitActionControlTemplateOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing CommitActionControlTemplateOptions instance. - * - * @param commitActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(CommitActionControlTemplateOptions commitActionControlTemplateOptions) { - this.actionControlTemplateId = commitActionControlTemplateOptions.actionControlTemplateId; - this.version = commitActionControlTemplateOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - * @param version the version - */ - public Builder(String actionControlTemplateId, String version) { - this.actionControlTemplateId = actionControlTemplateId; - this.version = version; - } - - /** - * Builds a CommitActionControlTemplateOptions. - * - * @return the new CommitActionControlTemplateOptions instance - */ - public CommitActionControlTemplateOptions build() { - return new CommitActionControlTemplateOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the CommitActionControlTemplateOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the CommitActionControlTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected CommitActionControlTemplateOptions() { } - - protected CommitActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a CommitActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the version. - * - * The action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java deleted file mode 100644 index 61283194c44..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The commitPolicyTemplate options. - */ -public class CommitPolicyTemplateOptions extends GenericModel { - - protected String policyTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing CommitPolicyTemplateOptions instance. - * - * @param commitPolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(CommitPolicyTemplateOptions commitPolicyTemplateOptions) { - this.policyTemplateId = commitPolicyTemplateOptions.policyTemplateId; - this.version = commitPolicyTemplateOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param version the version - */ - public Builder(String policyTemplateId, String version) { - this.policyTemplateId = policyTemplateId; - this.version = version; - } - - /** - * Builds a CommitPolicyTemplateOptions. - * - * @return the new CommitPolicyTemplateOptions instance - */ - public CommitPolicyTemplateOptions build() { - return new CommitPolicyTemplateOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the CommitPolicyTemplateOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the CommitPolicyTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected CommitPolicyTemplateOptions() { } - - protected CommitPolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - policyTemplateId = builder.policyTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a CommitPolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the version. - * - * The policy template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java deleted file mode 100644 index 7e93c92fb0b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The commitRoleTemplate options. - */ -public class CommitRoleTemplateOptions extends GenericModel { - - protected String roleTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing CommitRoleTemplateOptions instance. - * - * @param commitRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(CommitRoleTemplateOptions commitRoleTemplateOptions) { - this.roleTemplateId = commitRoleTemplateOptions.roleTemplateId; - this.version = commitRoleTemplateOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - * @param version the version - */ - public Builder(String roleTemplateId, String version) { - this.roleTemplateId = roleTemplateId; - this.version = version; - } - - /** - * Builds a CommitRoleTemplateOptions. - * - * @return the new CommitRoleTemplateOptions instance - */ - public CommitRoleTemplateOptions build() { - return new CommitRoleTemplateOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the CommitRoleTemplateOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the CommitRoleTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected CommitRoleTemplateOptions() { } - - protected CommitRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - roleTemplateId = builder.roleTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a CommitRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the version. - * - * The role template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java deleted file mode 100644 index be0c3d0aa98..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Details of conflicting resource. - */ -public class ConflictsWith extends GenericModel { - - protected String etag; - protected String role; - protected String policy; - - protected ConflictsWith() { } - - /** - * Gets the etag. - * - * The revision number of the resource. - * - * @return the etag - */ - public String getEtag() { - return etag; - } - - /** - * Gets the role. - * - * The conflicting role of ID. - * - * @return the role - */ - public String getRole() { - return role; - } - - /** - * Gets the policy. - * - * The conflicting policy ID. - * - * @return the policy - */ - public String getPolicy() { - return policy; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java deleted file mode 100644 index 15e502ac214..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Specifies the type of access that is granted by the policy. - */ -public class Control extends GenericModel { - - protected Grant grant; - - /** - * Builder. - */ - public static class Builder { - private Grant grant; - - /** - * Instantiates a new Builder from an existing Control instance. - * - * @param control the instance to initialize the Builder with - */ - private Builder(Control control) { - this.grant = control.grant; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param grant the grant - */ - public Builder(Grant grant) { - this.grant = grant; - } - - /** - * Builds a Control. - * - * @return the new Control instance - */ - public Control build() { - return new Control(this); - } - - /** - * Set the grant. - * - * @param grant the grant - * @return the Control builder - */ - public Builder grant(Grant grant) { - this.grant = grant; - return this; - } - } - - protected Control() { } - - protected Control(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.grant, - "grant cannot be null"); - grant = builder.grant; - } - - /** - * New builder. - * - * @return a Control builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the grant. - * - * Permission is granted by the policy. - * - * @return the grant - */ - public Grant grant() { - return grant; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java deleted file mode 100644 index 5055d290c80..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * ControlResponse. - * - * Classes which extend this class: - * - ControlResponseControl - * - ControlResponseControlWithEnrichedRoles - */ -public class ControlResponse extends GenericModel { - - protected Grant grant; - - protected ControlResponse() { } - - /** - * Gets the grant. - * - * Permission is granted by the policy. - * - * @return the grant - */ - public Grant getGrant() { - return grant; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java deleted file mode 100644 index 5934ebf7c76..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * Specifies the type of access that is granted by the policy. - */ -public class ControlResponseControl extends ControlResponse { - - - protected ControlResponseControl() { } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java deleted file mode 100644 index 8b3c73d73c0..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * Specifies the type of access that is granted by the policy with additional role information. - */ -public class ControlResponseControlWithEnrichedRoles extends ControlResponse { - - - protected ControlResponseControlWithEnrichedRoles() { } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java deleted file mode 100644 index 1ccd3f8b4dd..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createActionControlTemplateAssignment options. - */ -public class CreateActionControlTemplateAssignmentOptions extends GenericModel { - - protected AssignmentTargetDetails target; - protected List templates; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private AssignmentTargetDetails target; - private List templates; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateActionControlTemplateAssignmentOptions instance. - * - * @param createActionControlTemplateAssignmentOptions the instance to initialize the Builder with - */ - private Builder(CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptions) { - this.target = createActionControlTemplateAssignmentOptions.target; - this.templates = createActionControlTemplateAssignmentOptions.templates; - this.acceptLanguage = createActionControlTemplateAssignmentOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param target the target - * @param templates the templates - */ - public Builder(AssignmentTargetDetails target, List templates) { - this.target = target; - this.templates = templates; - } - - /** - * Builds a CreateActionControlTemplateAssignmentOptions. - * - * @return the new CreateActionControlTemplateAssignmentOptions instance - */ - public CreateActionControlTemplateAssignmentOptions build() { - return new CreateActionControlTemplateAssignmentOptions(this); - } - - /** - * Adds a new element to templates. - * - * @param templates the new element to be added - * @return the CreateActionControlTemplateAssignmentOptions builder - */ - public Builder addTemplates(ActionControlAssignmentTemplate templates) { - com.ibm.cloud.sdk.core.util.Validator.notNull(templates, - "templates cannot be null"); - if (this.templates == null) { - this.templates = new ArrayList(); - } - this.templates.add(templates); - return this; - } - - /** - * Set the target. - * - * @param target the target - * @return the CreateActionControlTemplateAssignmentOptions builder - */ - public Builder target(AssignmentTargetDetails target) { - this.target = target; - return this; - } - - /** - * Set the templates. - * Existing templates will be replaced. - * - * @param templates the templates - * @return the CreateActionControlTemplateAssignmentOptions builder - */ - public Builder templates(List templates) { - this.templates = templates; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateActionControlTemplateAssignmentOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateActionControlTemplateAssignmentOptions() { } - - protected CreateActionControlTemplateAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, - "target cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, - "templates cannot be null"); - target = builder.target; - templates = builder.templates; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateActionControlTemplateAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails target() { - return target; - } - - /** - * Gets the templates. - * - * List of action control template details for action control assignment. - * - * @return the templates - */ - public List templates() { - return templates; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java deleted file mode 100644 index 37594a7a440..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createActionControlTemplate options. - */ -public class CreateActionControlTemplateOptions extends GenericModel { - - protected String name; - protected String accountId; - protected String description; - protected Boolean committed; - protected TemplateActionControl actionControl; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String accountId; - private String description; - private Boolean committed; - private TemplateActionControl actionControl; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateActionControlTemplateOptions instance. - * - * @param createActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(CreateActionControlTemplateOptions createActionControlTemplateOptions) { - this.name = createActionControlTemplateOptions.name; - this.accountId = createActionControlTemplateOptions.accountId; - this.description = createActionControlTemplateOptions.description; - this.committed = createActionControlTemplateOptions.committed; - this.actionControl = createActionControlTemplateOptions.actionControl; - this.acceptLanguage = createActionControlTemplateOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param accountId the accountId - */ - public Builder(String name, String accountId) { - this.name = name; - this.accountId = accountId; - } - - /** - * Builds a CreateActionControlTemplateOptions. - * - * @return the new CreateActionControlTemplateOptions instance - */ - public CreateActionControlTemplateOptions build() { - return new CreateActionControlTemplateOptions(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateActionControlTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the CreateActionControlTemplateOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateActionControlTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreateActionControlTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - - /** - * Set the actionControl. - * - * @param actionControl the actionControl - * @return the CreateActionControlTemplateOptions builder - */ - public Builder actionControl(TemplateActionControl actionControl) { - this.actionControl = actionControl; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateActionControlTemplateOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateActionControlTemplateOptions() { } - - protected CreateActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - name = builder.name; - accountId = builder.accountId; - description = builder.description; - committed = builder.committed; - actionControl = builder.actionControl; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the description. - * - * Description of the action control template. This is shown to users in the enterprise account. Use this to describe - * the purpose or context of the action control for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template. If committed is set to true, then the template version can no longer be updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } - - /** - * Gets the actionControl. - * - * The action control properties that are created in an action resource when the template is assigned. - * - * @return the actionControl - */ - public TemplateActionControl actionControl() { - return actionControl; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java deleted file mode 100644 index 13ce1a8e60f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createActionControlTemplateVersion options. - */ -public class CreateActionControlTemplateVersionOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String name; - protected String description; - protected TemplateActionControl actionControl; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String name; - private String description; - private TemplateActionControl actionControl; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing CreateActionControlTemplateVersionOptions instance. - * - * @param createActionControlTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptions) { - this.actionControlTemplateId = createActionControlTemplateVersionOptions.actionControlTemplateId; - this.name = createActionControlTemplateVersionOptions.name; - this.description = createActionControlTemplateVersionOptions.description; - this.actionControl = createActionControlTemplateVersionOptions.actionControl; - this.committed = createActionControlTemplateVersionOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - */ - public Builder(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - } - - /** - * Builds a CreateActionControlTemplateVersionOptions. - * - * @return the new CreateActionControlTemplateVersionOptions instance - */ - public CreateActionControlTemplateVersionOptions build() { - return new CreateActionControlTemplateVersionOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actionControl. - * - * @param actionControl the actionControl - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder actionControl(TemplateActionControl actionControl) { - this.actionControl = actionControl; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected CreateActionControlTemplateVersionOptions() { } - - protected CreateActionControlTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - name = builder.name; - description = builder.description; - actionControl = builder.actionControl; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a CreateActionControlTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * The action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will - * change the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the action control template. This is shown to users in the enterprise account. Use this to describe - * the purpose or context of the action control for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actionControl. - * - * The action control properties that are created in an action resource when the template is assigned. - * - * @return the actionControl - */ - public TemplateActionControl actionControl() { - return actionControl; - } - - /** - * Gets the committed. - * - * Committed status of the template version. If committed is set to true, then the template version can no longer be - * updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java deleted file mode 100644 index b6ec9f78c02..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java +++ /dev/null @@ -1,311 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createPolicy options. - */ -public class CreatePolicyOptions extends GenericModel { - - protected String type; - protected List subjects; - protected List roles; - protected List resources; - protected String description; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String type; - private List subjects; - private List roles; - private List resources; - private String description; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreatePolicyOptions instance. - * - * @param createPolicyOptions the instance to initialize the Builder with - */ - private Builder(CreatePolicyOptions createPolicyOptions) { - this.type = createPolicyOptions.type; - this.subjects = createPolicyOptions.subjects; - this.roles = createPolicyOptions.roles; - this.resources = createPolicyOptions.resources; - this.description = createPolicyOptions.description; - this.acceptLanguage = createPolicyOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param type the type - * @param subjects the subjects - * @param roles the roles - * @param resources the resources - */ - public Builder(String type, List subjects, List roles, List resources) { - this.type = type; - this.subjects = subjects; - this.roles = roles; - this.resources = resources; - } - - /** - * Builds a CreatePolicyOptions. - * - * @return the new CreatePolicyOptions instance - */ - public CreatePolicyOptions build() { - return new CreatePolicyOptions(this); - } - - /** - * Adds a new element to subjects. - * - * @param subjects the new element to be added - * @return the CreatePolicyOptions builder - */ - public Builder addSubjects(PolicySubject subjects) { - com.ibm.cloud.sdk.core.util.Validator.notNull(subjects, - "subjects cannot be null"); - if (this.subjects == null) { - this.subjects = new ArrayList(); - } - this.subjects.add(subjects); - return this; - } - - /** - * Adds a new element to roles. - * - * @param roles the new element to be added - * @return the CreatePolicyOptions builder - */ - public Builder addRoles(PolicyRole roles) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roles, - "roles cannot be null"); - if (this.roles == null) { - this.roles = new ArrayList(); - } - this.roles.add(roles); - return this; - } - - /** - * Adds a new element to resources. - * - * @param resources the new element to be added - * @return the CreatePolicyOptions builder - */ - public Builder addResources(PolicyResource resources) { - com.ibm.cloud.sdk.core.util.Validator.notNull(resources, - "resources cannot be null"); - if (this.resources == null) { - this.resources = new ArrayList(); - } - this.resources.add(resources); - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the CreatePolicyOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the subjects. - * Existing subjects will be replaced. - * - * @param subjects the subjects - * @return the CreatePolicyOptions builder - */ - public Builder subjects(List subjects) { - this.subjects = subjects; - return this; - } - - /** - * Set the roles. - * Existing roles will be replaced. - * - * @param roles the roles - * @return the CreatePolicyOptions builder - */ - public Builder roles(List roles) { - this.roles = roles; - return this; - } - - /** - * Set the resources. - * Existing resources will be replaced. - * - * @param resources the resources - * @return the CreatePolicyOptions builder - */ - public Builder resources(List resources) { - this.resources = resources; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreatePolicyOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreatePolicyOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreatePolicyOptions() { } - - protected CreatePolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subjects, - "subjects cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, - "roles cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resources, - "resources cannot be null"); - type = builder.type; - subjects = builder.subjects; - roles = builder.roles; - resources = builder.resources; - description = builder.description; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreatePolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the subjects. - * - * The subjects associated with a policy. - * - * @return the subjects - */ - public List subjects() { - return subjects; - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List roles() { - return roles; - } - - /** - * Gets the resources. - * - * The resources associated with a policy. - * - * @return the resources - */ - public List resources() { - return resources; - } - - /** - * Gets the description. - * - * Customer-defined description. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java deleted file mode 100644 index b71ca393f11..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createPolicyTemplateAssignment options. - */ -public class CreatePolicyTemplateAssignmentOptions extends GenericModel { - - protected String version; - protected AssignmentTargetDetails target; - protected List templates; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String version; - private AssignmentTargetDetails target; - private List templates; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreatePolicyTemplateAssignmentOptions instance. - * - * @param createPolicyTemplateAssignmentOptions the instance to initialize the Builder with - */ - private Builder(CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptions) { - this.version = createPolicyTemplateAssignmentOptions.version; - this.target = createPolicyTemplateAssignmentOptions.target; - this.templates = createPolicyTemplateAssignmentOptions.templates; - this.acceptLanguage = createPolicyTemplateAssignmentOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param version the version - * @param target the target - * @param templates the templates - */ - public Builder(String version, AssignmentTargetDetails target, List templates) { - this.version = version; - this.target = target; - this.templates = templates; - } - - /** - * Builds a CreatePolicyTemplateAssignmentOptions. - * - * @return the new CreatePolicyTemplateAssignmentOptions instance - */ - public CreatePolicyTemplateAssignmentOptions build() { - return new CreatePolicyTemplateAssignmentOptions(this); - } - - /** - * Adds a new element to templates. - * - * @param templates the new element to be added - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder addTemplates(AssignmentTemplateDetails templates) { - com.ibm.cloud.sdk.core.util.Validator.notNull(templates, - "templates cannot be null"); - if (this.templates == null) { - this.templates = new ArrayList(); - } - this.templates.add(templates); - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the target. - * - * @param target the target - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder target(AssignmentTargetDetails target) { - this.target = target; - return this; - } - - /** - * Set the templates. - * Existing templates will be replaced. - * - * @param templates the templates - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder templates(List templates) { - this.templates = templates; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreatePolicyTemplateAssignmentOptions() { } - - protected CreatePolicyTemplateAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, - "target cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, - "templates cannot be null"); - version = builder.version; - target = builder.target; - templates = builder.templates; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreatePolicyTemplateAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the version. - * - * specify version of response body format. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails target() { - return target; - } - - /** - * Gets the templates. - * - * List of template details for policy assignment. - * - * @return the templates - */ - public List templates() { - return templates; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java deleted file mode 100644 index 72944308428..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java +++ /dev/null @@ -1,255 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createPolicyTemplate options. - */ -public class CreatePolicyTemplateOptions extends GenericModel { - - protected String name; - protected String accountId; - protected TemplatePolicy policy; - protected String description; - protected Boolean committed; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String accountId; - private TemplatePolicy policy; - private String description; - private Boolean committed; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreatePolicyTemplateOptions instance. - * - * @param createPolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(CreatePolicyTemplateOptions createPolicyTemplateOptions) { - this.name = createPolicyTemplateOptions.name; - this.accountId = createPolicyTemplateOptions.accountId; - this.policy = createPolicyTemplateOptions.policy; - this.description = createPolicyTemplateOptions.description; - this.committed = createPolicyTemplateOptions.committed; - this.acceptLanguage = createPolicyTemplateOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param accountId the accountId - * @param policy the policy - */ - public Builder(String name, String accountId, TemplatePolicy policy) { - this.name = name; - this.accountId = accountId; - this.policy = policy; - } - - /** - * Builds a CreatePolicyTemplateOptions. - * - * @return the new CreatePolicyTemplateOptions instance - */ - public CreatePolicyTemplateOptions build() { - return new CreatePolicyTemplateOptions(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the CreatePolicyTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the CreatePolicyTemplateOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the policy. - * - * @param policy the policy - * @return the CreatePolicyTemplateOptions builder - */ - public Builder policy(TemplatePolicy policy) { - this.policy = policy; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreatePolicyTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreatePolicyTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreatePolicyTemplateOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreatePolicyTemplateOptions() { } - - protected CreatePolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.policy, - "policy cannot be null"); - name = builder.name; - accountId = builder.accountId; - policy = builder.policy; - description = builder.description; - committed = builder.committed; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreatePolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy policy() { - return policy; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java deleted file mode 100644 index 6903774c335..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createPolicyTemplateVersion options. - */ -public class CreatePolicyTemplateVersionOptions extends GenericModel { - - protected String policyTemplateId; - protected TemplatePolicy policy; - protected String name; - protected String description; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private TemplatePolicy policy; - private String name; - private String description; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing CreatePolicyTemplateVersionOptions instance. - * - * @param createPolicyTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptions) { - this.policyTemplateId = createPolicyTemplateVersionOptions.policyTemplateId; - this.policy = createPolicyTemplateVersionOptions.policy; - this.name = createPolicyTemplateVersionOptions.name; - this.description = createPolicyTemplateVersionOptions.description; - this.committed = createPolicyTemplateVersionOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param policy the policy - */ - public Builder(String policyTemplateId, TemplatePolicy policy) { - this.policyTemplateId = policyTemplateId; - this.policy = policy; - } - - /** - * Builds a CreatePolicyTemplateVersionOptions. - * - * @return the new CreatePolicyTemplateVersionOptions instance - */ - public CreatePolicyTemplateVersionOptions build() { - return new CreatePolicyTemplateVersionOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the policy. - * - * @param policy the policy - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder policy(TemplatePolicy policy) { - this.policy = policy; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected CreatePolicyTemplateVersionOptions() { } - - protected CreatePolicyTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.policy, - "policy cannot be null"); - policyTemplateId = builder.policyTemplateId; - policy = builder.policy; - name = builder.name; - description = builder.description; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a CreatePolicyTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy policy() { - return policy; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template version. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java deleted file mode 100644 index 725ec5d8a53..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java +++ /dev/null @@ -1,308 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createRole options. - */ -public class CreateRoleOptions extends GenericModel { - - protected String displayName; - protected List actions; - protected String name; - protected String accountId; - protected String serviceName; - protected String description; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String displayName; - private List actions; - private String name; - private String accountId; - private String serviceName; - private String description; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateRoleOptions instance. - * - * @param createRoleOptions the instance to initialize the Builder with - */ - private Builder(CreateRoleOptions createRoleOptions) { - this.displayName = createRoleOptions.displayName; - this.actions = createRoleOptions.actions; - this.name = createRoleOptions.name; - this.accountId = createRoleOptions.accountId; - this.serviceName = createRoleOptions.serviceName; - this.description = createRoleOptions.description; - this.acceptLanguage = createRoleOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param displayName the displayName - * @param actions the actions - * @param name the name - * @param accountId the accountId - * @param serviceName the serviceName - */ - public Builder(String displayName, List actions, String name, String accountId, String serviceName) { - this.displayName = displayName; - this.actions = actions; - this.name = name; - this.accountId = accountId; - this.serviceName = serviceName; - } - - /** - * Builds a CreateRoleOptions. - * - * @return the new CreateRoleOptions instance - */ - public CreateRoleOptions build() { - return new CreateRoleOptions(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the CreateRoleOptions builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the CreateRoleOptions builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the CreateRoleOptions builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateRoleOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the CreateRoleOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the CreateRoleOptions builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateRoleOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateRoleOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateRoleOptions() { } - - protected CreateRoleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, - "serviceName cannot be null"); - displayName = builder.displayName; - actions = builder.actions; - name = builder.name; - accountId = builder.accountId; - serviceName = builder.serviceName; - description = builder.description; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateRoleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List actions() { - return actions; - } - - /** - * Gets the name. - * - * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the accountId. - * - * The account GUID. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the serviceName. - * - * The service name. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java deleted file mode 100644 index c9bef88e703..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createRoleTemplateAssignment options. - */ -public class CreateRoleTemplateAssignmentOptions extends GenericModel { - - protected AssignmentTargetDetails target; - protected List templates; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private AssignmentTargetDetails target; - private List templates; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateRoleTemplateAssignmentOptions instance. - * - * @param createRoleTemplateAssignmentOptions the instance to initialize the Builder with - */ - private Builder(CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptions) { - this.target = createRoleTemplateAssignmentOptions.target; - this.templates = createRoleTemplateAssignmentOptions.templates; - this.acceptLanguage = createRoleTemplateAssignmentOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param target the target - * @param templates the templates - */ - public Builder(AssignmentTargetDetails target, List templates) { - this.target = target; - this.templates = templates; - } - - /** - * Builds a CreateRoleTemplateAssignmentOptions. - * - * @return the new CreateRoleTemplateAssignmentOptions instance - */ - public CreateRoleTemplateAssignmentOptions build() { - return new CreateRoleTemplateAssignmentOptions(this); - } - - /** - * Adds a new element to templates. - * - * @param templates the new element to be added - * @return the CreateRoleTemplateAssignmentOptions builder - */ - public Builder addTemplates(RoleAssignmentTemplate templates) { - com.ibm.cloud.sdk.core.util.Validator.notNull(templates, - "templates cannot be null"); - if (this.templates == null) { - this.templates = new ArrayList(); - } - this.templates.add(templates); - return this; - } - - /** - * Set the target. - * - * @param target the target - * @return the CreateRoleTemplateAssignmentOptions builder - */ - public Builder target(AssignmentTargetDetails target) { - this.target = target; - return this; - } - - /** - * Set the templates. - * Existing templates will be replaced. - * - * @param templates the templates - * @return the CreateRoleTemplateAssignmentOptions builder - */ - public Builder templates(List templates) { - this.templates = templates; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateRoleTemplateAssignmentOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateRoleTemplateAssignmentOptions() { } - - protected CreateRoleTemplateAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, - "target cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, - "templates cannot be null"); - target = builder.target; - templates = builder.templates; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateRoleTemplateAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails target() { - return target; - } - - /** - * Gets the templates. - * - * List of role template details for role assignment. - * - * @return the templates - */ - public List templates() { - return templates; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java deleted file mode 100644 index baf82e17961..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createRoleTemplate options. - */ -public class CreateRoleTemplateOptions extends GenericModel { - - protected String name; - protected String accountId; - protected String description; - protected Boolean committed; - protected RoleTemplatePrototypeRole role; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String accountId; - private String description; - private Boolean committed; - private RoleTemplatePrototypeRole role; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateRoleTemplateOptions instance. - * - * @param createRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(CreateRoleTemplateOptions createRoleTemplateOptions) { - this.name = createRoleTemplateOptions.name; - this.accountId = createRoleTemplateOptions.accountId; - this.description = createRoleTemplateOptions.description; - this.committed = createRoleTemplateOptions.committed; - this.role = createRoleTemplateOptions.role; - this.acceptLanguage = createRoleTemplateOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param accountId the accountId - */ - public Builder(String name, String accountId) { - this.name = name; - this.accountId = accountId; - } - - /** - * Builds a CreateRoleTemplateOptions. - * - * @return the new CreateRoleTemplateOptions instance - */ - public CreateRoleTemplateOptions build() { - return new CreateRoleTemplateOptions(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateRoleTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the CreateRoleTemplateOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateRoleTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreateRoleTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - - /** - * Set the role. - * - * @param role the role - * @return the CreateRoleTemplateOptions builder - */ - public Builder role(RoleTemplatePrototypeRole role) { - this.role = role; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateRoleTemplateOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateRoleTemplateOptions() { } - - protected CreateRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - name = builder.name; - accountId = builder.accountId; - description = builder.description; - committed = builder.committed; - role = builder.role; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the description. - * - * Description of the role template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the role for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template. If committed is set to true, then the template version can no longer be updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } - - /** - * Gets the role. - * - * The role properties that are created in an action resource when the template is assigned. - * - * @return the role - */ - public RoleTemplatePrototypeRole role() { - return role; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java deleted file mode 100644 index c322c5a332d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createRoleTemplateVersion options. - */ -public class CreateRoleTemplateVersionOptions extends GenericModel { - - protected String roleTemplateId; - protected String name; - protected String description; - protected TemplateRole role; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String name; - private String description; - private TemplateRole role; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing CreateRoleTemplateVersionOptions instance. - * - * @param createRoleTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(CreateRoleTemplateVersionOptions createRoleTemplateVersionOptions) { - this.roleTemplateId = createRoleTemplateVersionOptions.roleTemplateId; - this.name = createRoleTemplateVersionOptions.name; - this.description = createRoleTemplateVersionOptions.description; - this.role = createRoleTemplateVersionOptions.role; - this.committed = createRoleTemplateVersionOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - */ - public Builder(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - } - - /** - * Builds a CreateRoleTemplateVersionOptions. - * - * @return the new CreateRoleTemplateVersionOptions instance - */ - public CreateRoleTemplateVersionOptions build() { - return new CreateRoleTemplateVersionOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the role. - * - * @param role the role - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder role(TemplateRole role) { - this.role = role; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected CreateRoleTemplateVersionOptions() { } - - protected CreateRoleTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - roleTemplateId = builder.roleTemplateId; - name = builder.name; - description = builder.description; - role = builder.role; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a CreateRoleTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * The role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will - * change the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the role template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the role for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the role. - * - * The role properties that are created in an action resource when the template is assigned. - * - * @return the role - */ - public TemplateRole role() { - return role; - } - - /** - * Gets the committed. - * - * Committed status of the template version. If committed is set to true, then the template version can no longer be - * updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java deleted file mode 100644 index 59ccb4b908a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java +++ /dev/null @@ -1,312 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createV2Policy options. - */ -public class CreateV2PolicyOptions extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - protected Control control; - protected String type; - protected String description; - protected V2PolicySubject subject; - protected V2PolicyResource resource; - protected String pattern; - protected V2PolicyRule rule; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private Control control; - private String type; - private String description; - private V2PolicySubject subject; - private V2PolicyResource resource; - private String pattern; - private V2PolicyRule rule; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateV2PolicyOptions instance. - * - * @param createV2PolicyOptions the instance to initialize the Builder with - */ - private Builder(CreateV2PolicyOptions createV2PolicyOptions) { - this.control = createV2PolicyOptions.control; - this.type = createV2PolicyOptions.type; - this.description = createV2PolicyOptions.description; - this.subject = createV2PolicyOptions.subject; - this.resource = createV2PolicyOptions.resource; - this.pattern = createV2PolicyOptions.pattern; - this.rule = createV2PolicyOptions.rule; - this.acceptLanguage = createV2PolicyOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param control the control - * @param type the type - */ - public Builder(Control control, String type) { - this.control = control; - this.type = type; - } - - /** - * Builds a CreateV2PolicyOptions. - * - * @return the new CreateV2PolicyOptions instance - */ - public CreateV2PolicyOptions build() { - return new CreateV2PolicyOptions(this); - } - - /** - * Set the control. - * - * @param control the control - * @return the CreateV2PolicyOptions builder - */ - public Builder control(Control control) { - this.control = control; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the CreateV2PolicyOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateV2PolicyOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the subject. - * - * @param subject the subject - * @return the CreateV2PolicyOptions builder - */ - public Builder subject(V2PolicySubject subject) { - this.subject = subject; - return this; - } - - /** - * Set the resource. - * - * @param resource the resource - * @return the CreateV2PolicyOptions builder - */ - public Builder resource(V2PolicyResource resource) { - this.resource = resource; - return this; - } - - /** - * Set the pattern. - * - * @param pattern the pattern - * @return the CreateV2PolicyOptions builder - */ - public Builder pattern(String pattern) { - this.pattern = pattern; - return this; - } - - /** - * Set the rule. - * - * @param rule the rule - * @return the CreateV2PolicyOptions builder - */ - public Builder rule(V2PolicyRule rule) { - this.rule = rule; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateV2PolicyOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateV2PolicyOptions() { } - - protected CreateV2PolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.control, - "control cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - control = builder.control; - type = builder.type; - description = builder.description; - subject = builder.subject; - resource = builder.resource; - pattern = builder.pattern; - rule = builder.rule; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateV2PolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the control. - * - * Specifies the type of access that is granted by the policy. - * - * @return the control - */ - public Control control() { - return control; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject subject() { - return subject; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource resource() { - return resource; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String pattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule rule() { - return rule; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java deleted file mode 100644 index f5e35c13d9f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * An additional set of properties associated with a role. - */ -public class CustomRole extends GenericModel { - - protected String id; - @SerializedName("display_name") - protected String displayName; - protected String description; - protected List actions; - protected String crn; - protected String name; - @SerializedName("account_id") - protected String accountId; - @SerializedName("service_name") - protected String serviceName; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String href; - - protected CustomRole() { } - - /** - * Gets the id. - * - * The role ID. Composed of hexadecimal characters. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String getDisplayName() { - return displayName; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List getActions() { - return actions; - } - - /** - * Gets the crn. - * - * The role Cloud Resource Name (CRN). Example CRN: - * 'crn:v1:ibmcloud:public:iam-access-management::a/exampleAccountId::customRole:ExampleRoleName'. - * - * @return the crn - */ - public String getCrn() { - return crn; - } - - /** - * Gets the name. - * - * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the accountId. - * - * The account GUID. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the serviceName. - * - * The service name. - * - * @return the serviceName - */ - public String getServiceName() { - return serviceName; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the role was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the role. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the role was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the href. - * - * The href links back to the role. - * - * @return the href - */ - public String getHref() { - return href; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java deleted file mode 100644 index f71d2c2ab9d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteActionControlAssignment options. - */ -public class DeleteActionControlAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing DeleteActionControlAssignmentOptions instance. - * - * @param deleteActionControlAssignmentOptions the instance to initialize the Builder with - */ - private Builder(DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptions) { - this.assignmentId = deleteActionControlAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a DeleteActionControlAssignmentOptions. - * - * @return the new DeleteActionControlAssignmentOptions instance - */ - public DeleteActionControlAssignmentOptions build() { - return new DeleteActionControlAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the DeleteActionControlAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected DeleteActionControlAssignmentOptions() { } - - protected DeleteActionControlAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a DeleteActionControlAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Action control template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java deleted file mode 100644 index 6ff35d83603..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteActionControlTemplate options. - */ -public class DeleteActionControlTemplateOptions extends GenericModel { - - protected String actionControlTemplateId; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - - /** - * Instantiates a new Builder from an existing DeleteActionControlTemplateOptions instance. - * - * @param deleteActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(DeleteActionControlTemplateOptions deleteActionControlTemplateOptions) { - this.actionControlTemplateId = deleteActionControlTemplateOptions.actionControlTemplateId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - */ - public Builder(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - } - - /** - * Builds a DeleteActionControlTemplateOptions. - * - * @return the new DeleteActionControlTemplateOptions instance - */ - public DeleteActionControlTemplateOptions build() { - return new DeleteActionControlTemplateOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the DeleteActionControlTemplateOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - } - - protected DeleteActionControlTemplateOptions() { } - - protected DeleteActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - } - - /** - * New builder. - * - * @return a DeleteActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java deleted file mode 100644 index 69aca0555a1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteActionControlTemplateVersion options. - */ -public class DeleteActionControlTemplateVersionOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing DeleteActionControlTemplateVersionOptions instance. - * - * @param deleteActionControlTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptions) { - this.actionControlTemplateId = deleteActionControlTemplateVersionOptions.actionControlTemplateId; - this.version = deleteActionControlTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - * @param version the version - */ - public Builder(String actionControlTemplateId, String version) { - this.actionControlTemplateId = actionControlTemplateId; - this.version = version; - } - - /** - * Builds a DeleteActionControlTemplateVersionOptions. - * - * @return the new DeleteActionControlTemplateVersionOptions instance - */ - public DeleteActionControlTemplateVersionOptions build() { - return new DeleteActionControlTemplateVersionOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the DeleteActionControlTemplateVersionOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the DeleteActionControlTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected DeleteActionControlTemplateVersionOptions() { } - - protected DeleteActionControlTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a DeleteActionControlTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java deleted file mode 100644 index 3ab2cf17469..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deletePolicyAssignment options. - */ -public class DeletePolicyAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing DeletePolicyAssignmentOptions instance. - * - * @param deletePolicyAssignmentOptions the instance to initialize the Builder with - */ - private Builder(DeletePolicyAssignmentOptions deletePolicyAssignmentOptions) { - this.assignmentId = deletePolicyAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a DeletePolicyAssignmentOptions. - * - * @return the new DeletePolicyAssignmentOptions instance - */ - public DeletePolicyAssignmentOptions build() { - return new DeletePolicyAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the DeletePolicyAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected DeletePolicyAssignmentOptions() { } - - protected DeletePolicyAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a DeletePolicyAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * The policy template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java deleted file mode 100644 index fe070b2064a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deletePolicy options. - */ -public class DeletePolicyOptions extends GenericModel { - - protected String policyId; - - /** - * Builder. - */ - public static class Builder { - private String policyId; - - /** - * Instantiates a new Builder from an existing DeletePolicyOptions instance. - * - * @param deletePolicyOptions the instance to initialize the Builder with - */ - private Builder(DeletePolicyOptions deletePolicyOptions) { - this.policyId = deletePolicyOptions.policyId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyId the policyId - */ - public Builder(String policyId) { - this.policyId = policyId; - } - - /** - * Builds a DeletePolicyOptions. - * - * @return the new DeletePolicyOptions instance - */ - public DeletePolicyOptions build() { - return new DeletePolicyOptions(this); - } - - /** - * Set the policyId. - * - * @param policyId the policyId - * @return the DeletePolicyOptions builder - */ - public Builder policyId(String policyId) { - this.policyId = policyId; - return this; - } - } - - protected DeletePolicyOptions() { } - - protected DeletePolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, - "policyId cannot be empty"); - policyId = builder.policyId; - } - - /** - * New builder. - * - * @return a DeletePolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyId. - * - * The policy ID. - * - * @return the policyId - */ - public String policyId() { - return policyId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java deleted file mode 100644 index bb70b0d6727..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deletePolicyTemplate options. - */ -public class DeletePolicyTemplateOptions extends GenericModel { - - protected String policyTemplateId; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - - /** - * Instantiates a new Builder from an existing DeletePolicyTemplateOptions instance. - * - * @param deletePolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(DeletePolicyTemplateOptions deletePolicyTemplateOptions) { - this.policyTemplateId = deletePolicyTemplateOptions.policyTemplateId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - */ - public Builder(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - } - - /** - * Builds a DeletePolicyTemplateOptions. - * - * @return the new DeletePolicyTemplateOptions instance - */ - public DeletePolicyTemplateOptions build() { - return new DeletePolicyTemplateOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the DeletePolicyTemplateOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - } - - protected DeletePolicyTemplateOptions() { } - - protected DeletePolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - policyTemplateId = builder.policyTemplateId; - } - - /** - * New builder. - * - * @return a DeletePolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java deleted file mode 100644 index 9a04a5157b6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deletePolicyTemplateVersion options. - */ -public class DeletePolicyTemplateVersionOptions extends GenericModel { - - protected String policyTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing DeletePolicyTemplateVersionOptions instance. - * - * @param deletePolicyTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptions) { - this.policyTemplateId = deletePolicyTemplateVersionOptions.policyTemplateId; - this.version = deletePolicyTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param version the version - */ - public Builder(String policyTemplateId, String version) { - this.policyTemplateId = policyTemplateId; - this.version = version; - } - - /** - * Builds a DeletePolicyTemplateVersionOptions. - * - * @return the new DeletePolicyTemplateVersionOptions instance - */ - public DeletePolicyTemplateVersionOptions build() { - return new DeletePolicyTemplateVersionOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the DeletePolicyTemplateVersionOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the DeletePolicyTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected DeletePolicyTemplateVersionOptions() { } - - protected DeletePolicyTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - policyTemplateId = builder.policyTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a DeletePolicyTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the version. - * - * The policy template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java deleted file mode 100644 index b9341a9f414..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteRoleAssignment options. - */ -public class DeleteRoleAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing DeleteRoleAssignmentOptions instance. - * - * @param deleteRoleAssignmentOptions the instance to initialize the Builder with - */ - private Builder(DeleteRoleAssignmentOptions deleteRoleAssignmentOptions) { - this.assignmentId = deleteRoleAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a DeleteRoleAssignmentOptions. - * - * @return the new DeleteRoleAssignmentOptions instance - */ - public DeleteRoleAssignmentOptions build() { - return new DeleteRoleAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the DeleteRoleAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected DeleteRoleAssignmentOptions() { } - - protected DeleteRoleAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a DeleteRoleAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Role template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java deleted file mode 100644 index 8675777719e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteRole options. - */ -public class DeleteRoleOptions extends GenericModel { - - protected String roleId; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - - /** - * Instantiates a new Builder from an existing DeleteRoleOptions instance. - * - * @param deleteRoleOptions the instance to initialize the Builder with - */ - private Builder(DeleteRoleOptions deleteRoleOptions) { - this.roleId = deleteRoleOptions.roleId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - */ - public Builder(String roleId) { - this.roleId = roleId; - } - - /** - * Builds a DeleteRoleOptions. - * - * @return the new DeleteRoleOptions instance - */ - public DeleteRoleOptions build() { - return new DeleteRoleOptions(this); - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the DeleteRoleOptions builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - } - - protected DeleteRoleOptions() { } - - protected DeleteRoleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, - "roleId cannot be empty"); - roleId = builder.roleId; - } - - /** - * New builder. - * - * @return a DeleteRoleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role ID. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java deleted file mode 100644 index c76bf3bfda4..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteRoleTemplate options. - */ -public class DeleteRoleTemplateOptions extends GenericModel { - - protected String roleTemplateId; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - - /** - * Instantiates a new Builder from an existing DeleteRoleTemplateOptions instance. - * - * @param deleteRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(DeleteRoleTemplateOptions deleteRoleTemplateOptions) { - this.roleTemplateId = deleteRoleTemplateOptions.roleTemplateId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - */ - public Builder(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - } - - /** - * Builds a DeleteRoleTemplateOptions. - * - * @return the new DeleteRoleTemplateOptions instance - */ - public DeleteRoleTemplateOptions build() { - return new DeleteRoleTemplateOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the DeleteRoleTemplateOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - } - - protected DeleteRoleTemplateOptions() { } - - protected DeleteRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - roleTemplateId = builder.roleTemplateId; - } - - /** - * New builder. - * - * @return a DeleteRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java deleted file mode 100644 index 9f974213165..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteRoleTemplateVersion options. - */ -public class DeleteRoleTemplateVersionOptions extends GenericModel { - - protected String roleTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing DeleteRoleTemplateVersionOptions instance. - * - * @param deleteRoleTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptions) { - this.roleTemplateId = deleteRoleTemplateVersionOptions.roleTemplateId; - this.version = deleteRoleTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - * @param version the version - */ - public Builder(String roleTemplateId, String version) { - this.roleTemplateId = roleTemplateId; - this.version = version; - } - - /** - * Builds a DeleteRoleTemplateVersionOptions. - * - * @return the new DeleteRoleTemplateVersionOptions instance - */ - public DeleteRoleTemplateVersionOptions build() { - return new DeleteRoleTemplateVersionOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the DeleteRoleTemplateVersionOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the DeleteRoleTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected DeleteRoleTemplateVersionOptions() { } - - protected DeleteRoleTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - roleTemplateId = builder.roleTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a DeleteRoleTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the version. - * - * Role template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java deleted file mode 100644 index 92c1caaa34c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteV2Policy options. - */ -public class DeleteV2PolicyOptions extends GenericModel { - - protected String id; - - /** - * Builder. - */ - public static class Builder { - private String id; - - /** - * Instantiates a new Builder from an existing DeleteV2PolicyOptions instance. - * - * @param deleteV2PolicyOptions the instance to initialize the Builder with - */ - private Builder(DeleteV2PolicyOptions deleteV2PolicyOptions) { - this.id = deleteV2PolicyOptions.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 DeleteV2PolicyOptions. - * - * @return the new DeleteV2PolicyOptions instance - */ - public DeleteV2PolicyOptions build() { - return new DeleteV2PolicyOptions(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the DeleteV2PolicyOptions builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - } - - protected DeleteV2PolicyOptions() { } - - protected DeleteV2PolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, - "id cannot be empty"); - id = builder.id; - } - - /** - * New builder. - * - * @return a DeleteV2PolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String id() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java deleted file mode 100644 index 0978eb1040b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role associated with a policy with additional information (display_name, description, actions) when - * `format=display`. - */ -public class EnrichedRoles extends GenericModel { - - @SerializedName("role_id") - protected String roleId; - @SerializedName("display_name") - protected String displayName; - protected String description; - protected List actions; - - protected EnrichedRoles() { } - - /** - * Gets the roleId. - * - * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. - * - * @return the roleId - */ - public String getRoleId() { - return roleId; - } - - /** - * Gets the displayName. - * - * The display name of the role, either service-defined or user-defined for custom roles. - * - * @return the displayName - */ - public String getDisplayName() { - return displayName; - } - - /** - * Gets the description. - * - * The role description, either service-defined or user-defined for custom roles. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List getActions() { - return actions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java deleted file mode 100644 index e99ea48f5f6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Additional error details. - */ -public class ErrorDetails extends GenericModel { - - @SerializedName("conflicts_with") - protected ConflictsWith conflictsWith; - - protected ErrorDetails() { } - - /** - * Gets the conflictsWith. - * - * Details of conflicting resource. - * - * @return the conflictsWith - */ - public ConflictsWith getConflictsWith() { - return conflictsWith; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java deleted file mode 100644 index b5411a7bb36..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * ErrorObject. - */ -public class ErrorObject extends GenericModel { - - /** - * The API error code for the error. - */ - public interface Code { - /** insufficent_permissions. */ - String INSUFFICENT_PERMISSIONS = "insufficent_permissions"; - /** invalid_body. */ - String INVALID_BODY = "invalid_body"; - /** invalid_token. */ - String INVALID_TOKEN = "invalid_token"; - /** missing_required_query_parameter. */ - String MISSING_REQUIRED_QUERY_PARAMETER = "missing_required_query_parameter"; - /** not_found. */ - String NOT_FOUND = "not_found"; - /** policy_conflict_error. */ - String POLICY_CONFLICT_ERROR = "policy_conflict_error"; - /** policy_not_found. */ - String POLICY_NOT_FOUND = "policy_not_found"; - /** request_not_processed. */ - String REQUEST_NOT_PROCESSED = "request_not_processed"; - /** role_conflict_error. */ - String ROLE_CONFLICT_ERROR = "role_conflict_error"; - /** role_not_found. */ - String ROLE_NOT_FOUND = "role_not_found"; - /** too_many_requests. */ - String TOO_MANY_REQUESTS = "too_many_requests"; - /** unable_to_process. */ - String UNABLE_TO_PROCESS = "unable_to_process"; - /** unsupported_content_type. */ - String UNSUPPORTED_CONTENT_TYPE = "unsupported_content_type"; - /** policy_template_conflict_error. */ - String POLICY_TEMPLATE_CONFLICT_ERROR = "policy_template_conflict_error"; - /** policy_template_not_found. */ - String POLICY_TEMPLATE_NOT_FOUND = "policy_template_not_found"; - /** policy_assignment_not_found. */ - String POLICY_ASSIGNMENT_NOT_FOUND = "policy_assignment_not_found"; - /** policy_assignment_conflict_error. */ - String POLICY_ASSIGNMENT_CONFLICT_ERROR = "policy_assignment_conflict_error"; - /** resource_not_found. */ - String RESOURCE_NOT_FOUND = "resource_not_found"; - /** action_control_template_not_found. */ - String ACTION_CONTROL_TEMPLATE_NOT_FOUND = "action_control_template_not_found"; - /** action_control_assignment_not_found. */ - String ACTION_CONTROL_ASSIGNMENT_NOT_FOUND = "action_control_assignment_not_found"; - /** role_template_conflict_error. */ - String ROLE_TEMPLATE_CONFLICT_ERROR = "role_template_conflict_error"; - /** role_template_not_found. */ - String ROLE_TEMPLATE_NOT_FOUND = "role_template_not_found"; - /** role_assignment_not_found. */ - String ROLE_ASSIGNMENT_NOT_FOUND = "role_assignment_not_found"; - } - - protected String code; - protected String message; - protected ErrorDetails details; - @SerializedName("more_info") - protected String moreInfo; - - protected ErrorObject() { } - - /** - * Gets the code. - * - * The API error code for the error. - * - * @return the code - */ - public String getCode() { - return code; - } - - /** - * Gets the message. - * - * The error message returned by the API. - * - * @return the message - */ - public String getMessage() { - return message; - } - - /** - * Gets the details. - * - * Additional error details. - * - * @return the details - */ - public ErrorDetails getDetails() { - return details; - } - - /** - * Gets the moreInfo. - * - * Additional info for error. - * - * @return the moreInfo - */ - public String getMoreInfo() { - return moreInfo; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java deleted file mode 100644 index 5c1c9a9fad6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * How external accounts can interact in relation to the requested account. - */ -public class ExternalAccountIdentityInteraction extends GenericModel { - - @SerializedName("identity_types") - protected IdentityTypes identityTypes; - - protected ExternalAccountIdentityInteraction() { } - - /** - * Gets the identityTypes. - * - * The settings for each identity type. - * - * @return the identityTypes - */ - public IdentityTypes getIdentityTypes() { - return identityTypes; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java deleted file mode 100644 index 1efd0673e9d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Update to how external accounts can interact in relation to the requested account. - */ -public class ExternalAccountIdentityInteractionPatch extends GenericModel { - - @SerializedName("identity_types") - protected IdentityTypesPatch identityTypes; - - /** - * Builder. - */ - public static class Builder { - private IdentityTypesPatch identityTypes; - - /** - * Instantiates a new Builder from an existing ExternalAccountIdentityInteractionPatch instance. - * - * @param externalAccountIdentityInteractionPatch the instance to initialize the Builder with - */ - private Builder(ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatch) { - this.identityTypes = externalAccountIdentityInteractionPatch.identityTypes; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a ExternalAccountIdentityInteractionPatch. - * - * @return the new ExternalAccountIdentityInteractionPatch instance - */ - public ExternalAccountIdentityInteractionPatch build() { - return new ExternalAccountIdentityInteractionPatch(this); - } - - /** - * Set the identityTypes. - * - * @param identityTypes the identityTypes - * @return the ExternalAccountIdentityInteractionPatch builder - */ - public Builder identityTypes(IdentityTypesPatch identityTypes) { - this.identityTypes = identityTypes; - return this; - } - } - - protected ExternalAccountIdentityInteractionPatch() { } - - protected ExternalAccountIdentityInteractionPatch(Builder builder) { - identityTypes = builder.identityTypes; - } - - /** - * New builder. - * - * @return a ExternalAccountIdentityInteractionPatch builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the identityTypes. - * - * The settings to apply for each identity type for a request. - * - * @return the identityTypes - */ - public IdentityTypesPatch identityTypes() { - return identityTypes; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java deleted file mode 100644 index 83cd67d33c9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Details with linking href to first page of requested collection. - */ -public class First extends GenericModel { - - protected String href; - - protected First() { } - - /** - * Gets the href. - * - * The href linking to the page of requested collection. - * - * @return the href - */ - public String getHref() { - return href; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java deleted file mode 100644 index f87e7d741a4..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getActionControlAssignment options. - */ -public class GetActionControlAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing GetActionControlAssignmentOptions instance. - * - * @param getActionControlAssignmentOptions the instance to initialize the Builder with - */ - private Builder(GetActionControlAssignmentOptions getActionControlAssignmentOptions) { - this.assignmentId = getActionControlAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a GetActionControlAssignmentOptions. - * - * @return the new GetActionControlAssignmentOptions instance - */ - public GetActionControlAssignmentOptions build() { - return new GetActionControlAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the GetActionControlAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected GetActionControlAssignmentOptions() { } - - protected GetActionControlAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a GetActionControlAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Action control template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java deleted file mode 100644 index 963c68e8876..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getActionControlTemplate options. - */ -public class GetActionControlTemplateOptions extends GenericModel { - - /** - * The action control template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String actionControlTemplateId; - protected String state; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String state; - - /** - * Instantiates a new Builder from an existing GetActionControlTemplateOptions instance. - * - * @param getActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(GetActionControlTemplateOptions getActionControlTemplateOptions) { - this.actionControlTemplateId = getActionControlTemplateOptions.actionControlTemplateId; - this.state = getActionControlTemplateOptions.state; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - */ - public Builder(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - } - - /** - * Builds a GetActionControlTemplateOptions. - * - * @return the new GetActionControlTemplateOptions instance - */ - public GetActionControlTemplateOptions build() { - return new GetActionControlTemplateOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the GetActionControlTemplateOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the GetActionControlTemplateOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - } - - protected GetActionControlTemplateOptions() { } - - protected GetActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - state = builder.state; - } - - /** - * New builder. - * - * @return a GetActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the state. - * - * The action control template state. - * - * @return the state - */ - public String state() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java deleted file mode 100644 index 95bc94950bb..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getActionControlTemplateVersion options. - */ -public class GetActionControlTemplateVersionOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing GetActionControlTemplateVersionOptions instance. - * - * @param getActionControlTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptions) { - this.actionControlTemplateId = getActionControlTemplateVersionOptions.actionControlTemplateId; - this.version = getActionControlTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - * @param version the version - */ - public Builder(String actionControlTemplateId, String version) { - this.actionControlTemplateId = actionControlTemplateId; - this.version = version; - } - - /** - * Builds a GetActionControlTemplateVersionOptions. - * - * @return the new GetActionControlTemplateVersionOptions instance - */ - public GetActionControlTemplateVersionOptions build() { - return new GetActionControlTemplateVersionOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the GetActionControlTemplateVersionOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the GetActionControlTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected GetActionControlTemplateVersionOptions() { } - - protected GetActionControlTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a GetActionControlTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java deleted file mode 100644 index d1c7c359003..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getPolicyAssignment options. - */ -public class GetPolicyAssignmentOptions extends GenericModel { - - protected String assignmentId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - private String version; - - /** - * Instantiates a new Builder from an existing GetPolicyAssignmentOptions instance. - * - * @param getPolicyAssignmentOptions the instance to initialize the Builder with - */ - private Builder(GetPolicyAssignmentOptions getPolicyAssignmentOptions) { - this.assignmentId = getPolicyAssignmentOptions.assignmentId; - this.version = getPolicyAssignmentOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - * @param version the version - */ - public Builder(String assignmentId, String version) { - this.assignmentId = assignmentId; - this.version = version; - } - - /** - * Builds a GetPolicyAssignmentOptions. - * - * @return the new GetPolicyAssignmentOptions instance - */ - public GetPolicyAssignmentOptions build() { - return new GetPolicyAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the GetPolicyAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the GetPolicyAssignmentOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected GetPolicyAssignmentOptions() { } - - protected GetPolicyAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - assignmentId = builder.assignmentId; - version = builder.version; - } - - /** - * New builder. - * - * @return a GetPolicyAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * The policy template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } - - /** - * Gets the version. - * - * specify version of response body format. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java deleted file mode 100644 index e780ac06896..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getPolicy options. - */ -public class GetPolicyOptions extends GenericModel { - - protected String policyId; - - /** - * Builder. - */ - public static class Builder { - private String policyId; - - /** - * Instantiates a new Builder from an existing GetPolicyOptions instance. - * - * @param getPolicyOptions the instance to initialize the Builder with - */ - private Builder(GetPolicyOptions getPolicyOptions) { - this.policyId = getPolicyOptions.policyId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyId the policyId - */ - public Builder(String policyId) { - this.policyId = policyId; - } - - /** - * Builds a GetPolicyOptions. - * - * @return the new GetPolicyOptions instance - */ - public GetPolicyOptions build() { - return new GetPolicyOptions(this); - } - - /** - * Set the policyId. - * - * @param policyId the policyId - * @return the GetPolicyOptions builder - */ - public Builder policyId(String policyId) { - this.policyId = policyId; - return this; - } - } - - protected GetPolicyOptions() { } - - protected GetPolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, - "policyId cannot be empty"); - policyId = builder.policyId; - } - - /** - * New builder. - * - * @return a GetPolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyId. - * - * The policy ID. - * - * @return the policyId - */ - public String policyId() { - return policyId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java deleted file mode 100644 index ee604554a85..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getPolicyTemplate options. - */ -public class GetPolicyTemplateOptions extends GenericModel { - - /** - * The policy template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String policyTemplateId; - protected String state; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String state; - - /** - * Instantiates a new Builder from an existing GetPolicyTemplateOptions instance. - * - * @param getPolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(GetPolicyTemplateOptions getPolicyTemplateOptions) { - this.policyTemplateId = getPolicyTemplateOptions.policyTemplateId; - this.state = getPolicyTemplateOptions.state; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - */ - public Builder(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - } - - /** - * Builds a GetPolicyTemplateOptions. - * - * @return the new GetPolicyTemplateOptions instance - */ - public GetPolicyTemplateOptions build() { - return new GetPolicyTemplateOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the GetPolicyTemplateOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the GetPolicyTemplateOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - } - - protected GetPolicyTemplateOptions() { } - - protected GetPolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - policyTemplateId = builder.policyTemplateId; - state = builder.state; - } - - /** - * New builder. - * - * @return a GetPolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the state. - * - * The policy template state. - * - * @return the state - */ - public String state() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java deleted file mode 100644 index 8741f83357d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getPolicyTemplateVersion options. - */ -public class GetPolicyTemplateVersionOptions extends GenericModel { - - protected String policyTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing GetPolicyTemplateVersionOptions instance. - * - * @param getPolicyTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptions) { - this.policyTemplateId = getPolicyTemplateVersionOptions.policyTemplateId; - this.version = getPolicyTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param version the version - */ - public Builder(String policyTemplateId, String version) { - this.policyTemplateId = policyTemplateId; - this.version = version; - } - - /** - * Builds a GetPolicyTemplateVersionOptions. - * - * @return the new GetPolicyTemplateVersionOptions instance - */ - public GetPolicyTemplateVersionOptions build() { - return new GetPolicyTemplateVersionOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the GetPolicyTemplateVersionOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the GetPolicyTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected GetPolicyTemplateVersionOptions() { } - - protected GetPolicyTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - policyTemplateId = builder.policyTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a GetPolicyTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the version. - * - * The policy template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java deleted file mode 100644 index 35313b9b746..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getRoleAssignment options. - */ -public class GetRoleAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing GetRoleAssignmentOptions instance. - * - * @param getRoleAssignmentOptions the instance to initialize the Builder with - */ - private Builder(GetRoleAssignmentOptions getRoleAssignmentOptions) { - this.assignmentId = getRoleAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a GetRoleAssignmentOptions. - * - * @return the new GetRoleAssignmentOptions instance - */ - public GetRoleAssignmentOptions build() { - return new GetRoleAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the GetRoleAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected GetRoleAssignmentOptions() { } - - protected GetRoleAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a GetRoleAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Role template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java deleted file mode 100644 index 8c56ac7f58a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getRole options. - */ -public class GetRoleOptions extends GenericModel { - - protected String roleId; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - - /** - * Instantiates a new Builder from an existing GetRoleOptions instance. - * - * @param getRoleOptions the instance to initialize the Builder with - */ - private Builder(GetRoleOptions getRoleOptions) { - this.roleId = getRoleOptions.roleId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - */ - public Builder(String roleId) { - this.roleId = roleId; - } - - /** - * Builds a GetRoleOptions. - * - * @return the new GetRoleOptions instance - */ - public GetRoleOptions build() { - return new GetRoleOptions(this); - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the GetRoleOptions builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - } - - protected GetRoleOptions() { } - - protected GetRoleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, - "roleId cannot be empty"); - roleId = builder.roleId; - } - - /** - * New builder. - * - * @return a GetRoleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role ID. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java deleted file mode 100644 index e33fcf29b32..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getRoleTemplate options. - */ -public class GetRoleTemplateOptions extends GenericModel { - - /** - * The role template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String roleTemplateId; - protected String state; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String state; - - /** - * Instantiates a new Builder from an existing GetRoleTemplateOptions instance. - * - * @param getRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(GetRoleTemplateOptions getRoleTemplateOptions) { - this.roleTemplateId = getRoleTemplateOptions.roleTemplateId; - this.state = getRoleTemplateOptions.state; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - */ - public Builder(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - } - - /** - * Builds a GetRoleTemplateOptions. - * - * @return the new GetRoleTemplateOptions instance - */ - public GetRoleTemplateOptions build() { - return new GetRoleTemplateOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the GetRoleTemplateOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the GetRoleTemplateOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - } - - protected GetRoleTemplateOptions() { } - - protected GetRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - roleTemplateId = builder.roleTemplateId; - state = builder.state; - } - - /** - * New builder. - * - * @return a GetRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the state. - * - * The role template state. - * - * @return the state - */ - public String state() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java deleted file mode 100644 index 4757484f969..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getRoleTemplateVersion options. - */ -public class GetRoleTemplateVersionOptions extends GenericModel { - - protected String roleTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing GetRoleTemplateVersionOptions instance. - * - * @param getRoleTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(GetRoleTemplateVersionOptions getRoleTemplateVersionOptions) { - this.roleTemplateId = getRoleTemplateVersionOptions.roleTemplateId; - this.version = getRoleTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - * @param version the version - */ - public Builder(String roleTemplateId, String version) { - this.roleTemplateId = roleTemplateId; - this.version = version; - } - - /** - * Builds a GetRoleTemplateVersionOptions. - * - * @return the new GetRoleTemplateVersionOptions instance - */ - public GetRoleTemplateVersionOptions build() { - return new GetRoleTemplateVersionOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the GetRoleTemplateVersionOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the GetRoleTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected GetRoleTemplateVersionOptions() { } - - protected GetRoleTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - roleTemplateId = builder.roleTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a GetRoleTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the version. - * - * Role template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java deleted file mode 100644 index ebc88bbf45c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getSettings options. - */ -public class GetSettingsOptions extends GenericModel { - - protected String accountId; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing GetSettingsOptions instance. - * - * @param getSettingsOptions the instance to initialize the Builder with - */ - private Builder(GetSettingsOptions getSettingsOptions) { - this.accountId = getSettingsOptions.accountId; - this.acceptLanguage = getSettingsOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a GetSettingsOptions. - * - * @return the new GetSettingsOptions instance - */ - public GetSettingsOptions build() { - return new GetSettingsOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the GetSettingsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the GetSettingsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected GetSettingsOptions() { } - - protected GetSettingsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.accountId, - "accountId cannot be empty"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a GetSettingsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the settings belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java deleted file mode 100644 index 23a950cc815..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getV2Policy options. - */ -public class GetV2PolicyOptions extends GenericModel { - - /** - * Include additional data for policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles and translations for all - * relevant fields. - */ - public interface Format { - /** include_last_permit. */ - String INCLUDE_LAST_PERMIT = "include_last_permit"; - /** display. */ - String DISPLAY = "display"; - } - - protected String id; - protected String format; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String format; - - /** - * Instantiates a new Builder from an existing GetV2PolicyOptions instance. - * - * @param getV2PolicyOptions the instance to initialize the Builder with - */ - private Builder(GetV2PolicyOptions getV2PolicyOptions) { - this.id = getV2PolicyOptions.id; - this.format = getV2PolicyOptions.format; - } - - /** - * 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 GetV2PolicyOptions. - * - * @return the new GetV2PolicyOptions instance - */ - public GetV2PolicyOptions build() { - return new GetV2PolicyOptions(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the GetV2PolicyOptions builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the format. - * - * @param format the format - * @return the GetV2PolicyOptions builder - */ - public Builder format(String format) { - this.format = format; - return this; - } - } - - protected GetV2PolicyOptions() { } - - protected GetV2PolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, - "id cannot be empty"); - id = builder.id; - format = builder.format; - } - - /** - * New builder. - * - * @return a GetV2PolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the format. - * - * Include additional data for policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles and translations for all - * relevant fields. - * - * @return the format - */ - public String format() { - return format; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java deleted file mode 100644 index d8439c9d6f7..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Permission is granted by the policy. - */ -public class Grant extends GenericModel { - - protected List roles; - - /** - * Builder. - */ - public static class Builder { - private List roles; - - /** - * Instantiates a new Builder from an existing Grant instance. - * - * @param grant the instance to initialize the Builder with - */ - private Builder(Grant grant) { - this.roles = grant.roles; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roles the roles - */ - public Builder(List roles) { - this.roles = roles; - } - - /** - * Builds a Grant. - * - * @return the new Grant instance - */ - public Grant build() { - return new Grant(this); - } - - /** - * Adds a new element to roles. - * - * @param roles the new element to be added - * @return the Grant builder - */ - public Builder addRoles(Roles roles) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roles, - "roles cannot be null"); - if (this.roles == null) { - this.roles = new ArrayList(); - } - this.roles.add(roles); - return this; - } - - /** - * Set the roles. - * Existing roles will be replaced. - * - * @param roles the roles - * @return the Grant builder - */ - public Builder roles(List roles) { - this.roles = roles; - return this; - } - } - - protected Grant() { } - - protected Grant(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, - "roles cannot be null"); - roles = builder.roles; - } - - /** - * New builder. - * - * @return a Grant builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List roles() { - return roles; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java deleted file mode 100644 index 1dbc53fefb6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Permission granted by the policy with translated roles and additional role information. - */ -public class GrantWithEnrichedRoles extends GenericModel { - - protected List roles; - - protected GrantWithEnrichedRoles() { } - - /** - * Gets the roles. - * - * A set of roles granted by the policy. - * - * @return the roles - */ - public List getRoles() { - return roles; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java deleted file mode 100644 index 0ac71d8192b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The settings for each identity type. - */ -public class IdentityTypes extends GenericModel { - - protected IdentityTypesBase user; - @SerializedName("service_id") - protected IdentityTypesBase serviceId; - protected IdentityTypesBase service; - - protected IdentityTypes() { } - - /** - * Gets the user. - * - * The core set of properties associated with an identity type. - * - * @return the user - */ - public IdentityTypesBase getUser() { - return user; - } - - /** - * Gets the serviceId. - * - * The core set of properties associated with an identity type. - * - * @return the serviceId - */ - public IdentityTypesBase getServiceId() { - return serviceId; - } - - /** - * Gets the service. - * - * The core set of properties associated with an identity type. - * - * @return the service - */ - public IdentityTypesBase getService() { - return service; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java deleted file mode 100644 index e8df91a1e5d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with an identity type. - */ -public class IdentityTypesBase extends GenericModel { - - /** - * The state of the identity type. - */ - public interface State { - /** enabled. */ - String ENABLED = "enabled"; - /** monitor. */ - String MONITOR = "monitor"; - /** limited. */ - String LIMITED = "limited"; - } - - protected String state; - @SerializedName("external_allowed_accounts") - protected List externalAllowedAccounts; - - /** - * Builder. - */ - public static class Builder { - private String state; - private List externalAllowedAccounts; - - /** - * Instantiates a new Builder from an existing IdentityTypesBase instance. - * - * @param identityTypesBase the instance to initialize the Builder with - */ - private Builder(IdentityTypesBase identityTypesBase) { - this.state = identityTypesBase.state; - this.externalAllowedAccounts = identityTypesBase.externalAllowedAccounts; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param state the state - * @param externalAllowedAccounts the externalAllowedAccounts - */ - public Builder(String state, List externalAllowedAccounts) { - this.state = state; - this.externalAllowedAccounts = externalAllowedAccounts; - } - - /** - * Builds a IdentityTypesBase. - * - * @return the new IdentityTypesBase instance - */ - public IdentityTypesBase build() { - return new IdentityTypesBase(this); - } - - /** - * Adds a new element to externalAllowedAccounts. - * - * @param externalAllowedAccounts the new element to be added - * @return the IdentityTypesBase builder - */ - public Builder addExternalAllowedAccounts(String externalAllowedAccounts) { - com.ibm.cloud.sdk.core.util.Validator.notNull(externalAllowedAccounts, - "externalAllowedAccounts cannot be null"); - if (this.externalAllowedAccounts == null) { - this.externalAllowedAccounts = new ArrayList(); - } - this.externalAllowedAccounts.add(externalAllowedAccounts); - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the IdentityTypesBase builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the externalAllowedAccounts. - * Existing externalAllowedAccounts will be replaced. - * - * @param externalAllowedAccounts the externalAllowedAccounts - * @return the IdentityTypesBase builder - */ - public Builder externalAllowedAccounts(List externalAllowedAccounts) { - this.externalAllowedAccounts = externalAllowedAccounts; - return this; - } - } - - protected IdentityTypesBase() { } - - protected IdentityTypesBase(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.state, - "state cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.externalAllowedAccounts, - "externalAllowedAccounts cannot be null"); - state = builder.state; - externalAllowedAccounts = builder.externalAllowedAccounts; - } - - /** - * New builder. - * - * @return a IdentityTypesBase builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the state. - * - * The state of the identity type. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the externalAllowedAccounts. - * - * List of accounts that the state applies to for a given identity. - * - * @return the externalAllowedAccounts - */ - public List externalAllowedAccounts() { - return externalAllowedAccounts; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java deleted file mode 100644 index 77aa5a26366..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The settings to apply for each identity type for a request. - */ -public class IdentityTypesPatch extends GenericModel { - - protected IdentityTypesBase user; - @SerializedName("service_id") - protected IdentityTypesBase serviceId; - protected IdentityTypesBase service; - - /** - * Builder. - */ - public static class Builder { - private IdentityTypesBase user; - private IdentityTypesBase serviceId; - private IdentityTypesBase service; - - /** - * Instantiates a new Builder from an existing IdentityTypesPatch instance. - * - * @param identityTypesPatch the instance to initialize the Builder with - */ - private Builder(IdentityTypesPatch identityTypesPatch) { - this.user = identityTypesPatch.user; - this.serviceId = identityTypesPatch.serviceId; - this.service = identityTypesPatch.service; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a IdentityTypesPatch. - * - * @return the new IdentityTypesPatch instance - */ - public IdentityTypesPatch build() { - return new IdentityTypesPatch(this); - } - - /** - * Set the user. - * - * @param user the user - * @return the IdentityTypesPatch builder - */ - public Builder user(IdentityTypesBase user) { - this.user = user; - return this; - } - - /** - * Set the serviceId. - * - * @param serviceId the serviceId - * @return the IdentityTypesPatch builder - */ - public Builder serviceId(IdentityTypesBase serviceId) { - this.serviceId = serviceId; - return this; - } - - /** - * Set the service. - * - * @param service the service - * @return the IdentityTypesPatch builder - */ - public Builder service(IdentityTypesBase service) { - this.service = service; - return this; - } - } - - protected IdentityTypesPatch() { } - - protected IdentityTypesPatch(Builder builder) { - user = builder.user; - serviceId = builder.serviceId; - service = builder.service; - } - - /** - * New builder. - * - * @return a IdentityTypesPatch builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the user. - * - * The core set of properties associated with an identity type. - * - * @return the user - */ - public IdentityTypesBase user() { - return user; - } - - /** - * Gets the serviceId. - * - * The core set of properties associated with an identity type. - * - * @return the serviceId - */ - public IdentityTypesBase serviceId() { - return serviceId; - } - - /** - * Gets the service. - * - * The core set of properties associated with an identity type. - * - * @return the service - */ - public IdentityTypesBase service() { - return service; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java deleted file mode 100644 index 5aa0b39573b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * policy template current and limit details with in an account. - */ -public class LimitData extends GenericModel { - - protected Long current; - protected Long limit; - - protected LimitData() { } - - /** - * Gets the current. - * - * policy template current count. - * - * @return the current - */ - public Long getCurrent() { - return current; - } - - /** - * Gets the limit. - * - * policy template limit count. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java deleted file mode 100644 index 6835f5afccc..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listActionControlAssignments options. - */ -public class ListActionControlAssignmentsOptions extends GenericModel { - - protected String accountId; - protected String acceptLanguage; - protected String templateId; - protected String templateVersion; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String templateId; - private String templateVersion; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListActionControlAssignmentsOptions instance. - * - * @param listActionControlAssignmentsOptions the instance to initialize the Builder with - */ - private Builder(ListActionControlAssignmentsOptions listActionControlAssignmentsOptions) { - this.accountId = listActionControlAssignmentsOptions.accountId; - this.acceptLanguage = listActionControlAssignmentsOptions.acceptLanguage; - this.templateId = listActionControlAssignmentsOptions.templateId; - this.templateVersion = listActionControlAssignmentsOptions.templateVersion; - this.limit = listActionControlAssignmentsOptions.limit; - this.start = listActionControlAssignmentsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListActionControlAssignmentsOptions. - * - * @return the new ListActionControlAssignmentsOptions instance - */ - public ListActionControlAssignmentsOptions build() { - return new ListActionControlAssignmentsOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the templateId. - * - * @param templateId the templateId - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder templateId(String templateId) { - this.templateId = templateId; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListActionControlAssignmentsOptions() { } - - protected ListActionControlAssignmentsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - templateId = builder.templateId; - templateVersion = builder.templateVersion; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListActionControlAssignmentsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID in which the action control assignment belongs to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the templateId. - * - * Optional template ID. - * - * @return the templateId - */ - public String templateId() { - return templateId; - } - - /** - * Gets the templateVersion. - * - * Optional action control template version. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java deleted file mode 100644 index 984d1060c83..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listActionControlTemplateVersions options. - */ -public class ListActionControlTemplateVersionsOptions extends GenericModel { - - /** - * Action control template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String actionControlTemplateId; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListActionControlTemplateVersionsOptions instance. - * - * @param listActionControlTemplateVersionsOptions the instance to initialize the Builder with - */ - private Builder(ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions) { - this.actionControlTemplateId = listActionControlTemplateVersionsOptions.actionControlTemplateId; - this.state = listActionControlTemplateVersionsOptions.state; - this.limit = listActionControlTemplateVersionsOptions.limit; - this.start = listActionControlTemplateVersionsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - */ - public Builder(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - } - - /** - * Builds a ListActionControlTemplateVersionsOptions. - * - * @return the new ListActionControlTemplateVersionsOptions instance - */ - public ListActionControlTemplateVersionsOptions build() { - return new ListActionControlTemplateVersionsOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the ListActionControlTemplateVersionsOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListActionControlTemplateVersionsOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListActionControlTemplateVersionsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListActionControlTemplateVersionsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListActionControlTemplateVersionsOptions() { } - - protected ListActionControlTemplateVersionsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListActionControlTemplateVersionsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * The action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the state. - * - * Action control template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java deleted file mode 100644 index d019db6119f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listActionControlTemplates options. - */ -public class ListActionControlTemplatesOptions extends GenericModel { - - protected String accountId; - protected String acceptLanguage; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListActionControlTemplatesOptions instance. - * - * @param listActionControlTemplatesOptions the instance to initialize the Builder with - */ - private Builder(ListActionControlTemplatesOptions listActionControlTemplatesOptions) { - this.accountId = listActionControlTemplatesOptions.accountId; - this.acceptLanguage = listActionControlTemplatesOptions.acceptLanguage; - this.limit = listActionControlTemplatesOptions.limit; - this.start = listActionControlTemplatesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListActionControlTemplatesOptions. - * - * @return the new ListActionControlTemplatesOptions instance - */ - public ListActionControlTemplatesOptions build() { - return new ListActionControlTemplatesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListActionControlTemplatesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListActionControlTemplatesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListActionControlTemplatesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListActionControlTemplatesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListActionControlTemplatesOptions() { } - - protected ListActionControlTemplatesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListActionControlTemplatesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the action control templates belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java deleted file mode 100644 index 90ecb352c37..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java +++ /dev/null @@ -1,501 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listPolicies options. - */ -public class ListPoliciesOptions extends GenericModel { - - /** - * Optional type of policy. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - /** - * Optional type of service. - */ - public interface ServiceType { - /** service. */ - String SERVICE = "service"; - /** platform_service. */ - String PLATFORM_SERVICE = "platform_service"; - } - - /** - * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending - * '-' to field. Example '-last_modified_at'. - */ - public interface Sort { - /** id. */ - String ID = "id"; - /** type. */ - String TYPE = "type"; - /** href. */ - String HREF = "href"; - /** created_at. */ - String CREATED_AT = "created_at"; - /** created_by_id. */ - String CREATED_BY_ID = "created_by_id"; - /** last_modified_at. */ - String LAST_MODIFIED_AT = "last_modified_at"; - /** last_modified_by_id. */ - String LAST_MODIFIED_BY_ID = "last_modified_by_id"; - /** state. */ - String STATE = "state"; - } - - /** - * Include additional data per policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles. - */ - public interface Format { - /** include_last_permit. */ - String INCLUDE_LAST_PERMIT = "include_last_permit"; - /** display. */ - String DISPLAY = "display"; - } - - /** - * The state of the policy. - * * `active` - returns active policies - * * `deleted` - returns non-active policies. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String accountId; - protected String acceptLanguage; - protected String iamId; - protected String accessGroupId; - protected String type; - protected String serviceType; - protected String tagName; - protected String tagValue; - protected String sort; - protected String format; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String iamId; - private String accessGroupId; - private String type; - private String serviceType; - private String tagName; - private String tagValue; - private String sort; - private String format; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListPoliciesOptions instance. - * - * @param listPoliciesOptions the instance to initialize the Builder with - */ - private Builder(ListPoliciesOptions listPoliciesOptions) { - this.accountId = listPoliciesOptions.accountId; - this.acceptLanguage = listPoliciesOptions.acceptLanguage; - this.iamId = listPoliciesOptions.iamId; - this.accessGroupId = listPoliciesOptions.accessGroupId; - this.type = listPoliciesOptions.type; - this.serviceType = listPoliciesOptions.serviceType; - this.tagName = listPoliciesOptions.tagName; - this.tagValue = listPoliciesOptions.tagValue; - this.sort = listPoliciesOptions.sort; - this.format = listPoliciesOptions.format; - this.state = listPoliciesOptions.state; - this.limit = listPoliciesOptions.limit; - this.start = listPoliciesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListPoliciesOptions. - * - * @return the new ListPoliciesOptions instance - */ - public ListPoliciesOptions build() { - return new ListPoliciesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListPoliciesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListPoliciesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the iamId. - * - * @param iamId the iamId - * @return the ListPoliciesOptions builder - */ - public Builder iamId(String iamId) { - this.iamId = iamId; - return this; - } - - /** - * Set the accessGroupId. - * - * @param accessGroupId the accessGroupId - * @return the ListPoliciesOptions builder - */ - public Builder accessGroupId(String accessGroupId) { - this.accessGroupId = accessGroupId; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the ListPoliciesOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the serviceType. - * - * @param serviceType the serviceType - * @return the ListPoliciesOptions builder - */ - public Builder serviceType(String serviceType) { - this.serviceType = serviceType; - return this; - } - - /** - * Set the tagName. - * - * @param tagName the tagName - * @return the ListPoliciesOptions builder - */ - public Builder tagName(String tagName) { - this.tagName = tagName; - return this; - } - - /** - * Set the tagValue. - * - * @param tagValue the tagValue - * @return the ListPoliciesOptions builder - */ - public Builder tagValue(String tagValue) { - this.tagValue = tagValue; - return this; - } - - /** - * Set the sort. - * - * @param sort the sort - * @return the ListPoliciesOptions builder - */ - public Builder sort(String sort) { - this.sort = sort; - return this; - } - - /** - * Set the format. - * - * @param format the format - * @return the ListPoliciesOptions builder - */ - public Builder format(String format) { - this.format = format; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListPoliciesOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListPoliciesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListPoliciesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListPoliciesOptions() { } - - protected ListPoliciesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - iamId = builder.iamId; - accessGroupId = builder.accessGroupId; - type = builder.type; - serviceType = builder.serviceType; - tagName = builder.tagName; - tagValue = builder.tagValue; - sort = builder.sort; - format = builder.format; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListPoliciesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the policies belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the iamId. - * - * Optional IAM ID used to identify the subject. - * - * @return the iamId - */ - public String iamId() { - return iamId; - } - - /** - * Gets the accessGroupId. - * - * Optional access group id. - * - * @return the accessGroupId - */ - public String accessGroupId() { - return accessGroupId; - } - - /** - * Gets the type. - * - * Optional type of policy. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the serviceType. - * - * Optional type of service. - * - * @return the serviceType - */ - public String serviceType() { - return serviceType; - } - - /** - * Gets the tagName. - * - * Optional name of the access tag in the policy. - * - * @return the tagName - */ - public String tagName() { - return tagName; - } - - /** - * Gets the tagValue. - * - * Optional value of the access tag in the policy. - * - * @return the tagValue - */ - public String tagValue() { - return tagValue; - } - - /** - * Gets the sort. - * - * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending - * '-' to field. Example '-last_modified_at'. - * - * @return the sort - */ - public String sort() { - return sort; - } - - /** - * Gets the format. - * - * Include additional data per policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles. - * - * @return the format - */ - public String format() { - return format; - } - - /** - * Gets the state. - * - * The state of the policy. - * * `active` - returns active policies - * * `deleted` - returns non-active policies. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java deleted file mode 100644 index 9362749c670..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java +++ /dev/null @@ -1,275 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listPolicyAssignments options. - */ -public class ListPolicyAssignmentsOptions extends GenericModel { - - protected String version; - protected String accountId; - protected String acceptLanguage; - protected String templateId; - protected String templateVersion; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String version; - private String accountId; - private String acceptLanguage; - private String templateId; - private String templateVersion; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListPolicyAssignmentsOptions instance. - * - * @param listPolicyAssignmentsOptions the instance to initialize the Builder with - */ - private Builder(ListPolicyAssignmentsOptions listPolicyAssignmentsOptions) { - this.version = listPolicyAssignmentsOptions.version; - this.accountId = listPolicyAssignmentsOptions.accountId; - this.acceptLanguage = listPolicyAssignmentsOptions.acceptLanguage; - this.templateId = listPolicyAssignmentsOptions.templateId; - this.templateVersion = listPolicyAssignmentsOptions.templateVersion; - this.limit = listPolicyAssignmentsOptions.limit; - this.start = listPolicyAssignmentsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param version the version - * @param accountId the accountId - */ - public Builder(String version, String accountId) { - this.version = version; - this.accountId = accountId; - } - - /** - * Builds a ListPolicyAssignmentsOptions. - * - * @return the new ListPolicyAssignmentsOptions instance - */ - public ListPolicyAssignmentsOptions build() { - return new ListPolicyAssignmentsOptions(this); - } - - /** - * Set the version. - * - * @param version the version - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the templateId. - * - * @param templateId the templateId - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder templateId(String templateId) { - this.templateId = templateId; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListPolicyAssignmentsOptions() { } - - protected ListPolicyAssignmentsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - version = builder.version; - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - templateId = builder.templateId; - templateVersion = builder.templateVersion; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListPolicyAssignmentsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the version. - * - * specify version of response body format. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the accountId. - * - * The account GUID in which the policies belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the templateId. - * - * Optional template id. - * - * @return the templateId - */ - public String templateId() { - return templateId; - } - - /** - * Gets the templateVersion. - * - * Optional policy template version. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java deleted file mode 100644 index c7965ba6c31..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listPolicyTemplateVersions options. - */ -public class ListPolicyTemplateVersionsOptions extends GenericModel { - - /** - * The policy template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String policyTemplateId; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListPolicyTemplateVersionsOptions instance. - * - * @param listPolicyTemplateVersionsOptions the instance to initialize the Builder with - */ - private Builder(ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions) { - this.policyTemplateId = listPolicyTemplateVersionsOptions.policyTemplateId; - this.state = listPolicyTemplateVersionsOptions.state; - this.limit = listPolicyTemplateVersionsOptions.limit; - this.start = listPolicyTemplateVersionsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - */ - public Builder(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - } - - /** - * Builds a ListPolicyTemplateVersionsOptions. - * - * @return the new ListPolicyTemplateVersionsOptions instance - */ - public ListPolicyTemplateVersionsOptions build() { - return new ListPolicyTemplateVersionsOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the ListPolicyTemplateVersionsOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListPolicyTemplateVersionsOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListPolicyTemplateVersionsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListPolicyTemplateVersionsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListPolicyTemplateVersionsOptions() { } - - protected ListPolicyTemplateVersionsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - policyTemplateId = builder.policyTemplateId; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListPolicyTemplateVersionsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the state. - * - * The policy template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java deleted file mode 100644 index f230c9bd549..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java +++ /dev/null @@ -1,379 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listPolicyTemplates options. - */ -public class ListPolicyTemplatesOptions extends GenericModel { - - /** - * The policy template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - /** - * Service type, Optional. - */ - public interface PolicyServiceType { - /** service. */ - String SERVICE = "service"; - /** platform_service. */ - String PLATFORM_SERVICE = "platform_service"; - } - - /** - * Policy type, Optional. - */ - public interface PolicyType { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - protected String accountId; - protected String acceptLanguage; - protected String state; - protected String name; - protected String policyServiceType; - protected String policyServiceName; - protected String policyServiceGroupId; - protected String policyType; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String state; - private String name; - private String policyServiceType; - private String policyServiceName; - private String policyServiceGroupId; - private String policyType; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListPolicyTemplatesOptions instance. - * - * @param listPolicyTemplatesOptions the instance to initialize the Builder with - */ - private Builder(ListPolicyTemplatesOptions listPolicyTemplatesOptions) { - this.accountId = listPolicyTemplatesOptions.accountId; - this.acceptLanguage = listPolicyTemplatesOptions.acceptLanguage; - this.state = listPolicyTemplatesOptions.state; - this.name = listPolicyTemplatesOptions.name; - this.policyServiceType = listPolicyTemplatesOptions.policyServiceType; - this.policyServiceName = listPolicyTemplatesOptions.policyServiceName; - this.policyServiceGroupId = listPolicyTemplatesOptions.policyServiceGroupId; - this.policyType = listPolicyTemplatesOptions.policyType; - this.limit = listPolicyTemplatesOptions.limit; - this.start = listPolicyTemplatesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListPolicyTemplatesOptions. - * - * @return the new ListPolicyTemplatesOptions instance - */ - public ListPolicyTemplatesOptions build() { - return new ListPolicyTemplatesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListPolicyTemplatesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListPolicyTemplatesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListPolicyTemplatesOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ListPolicyTemplatesOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the policyServiceType. - * - * @param policyServiceType the policyServiceType - * @return the ListPolicyTemplatesOptions builder - */ - public Builder policyServiceType(String policyServiceType) { - this.policyServiceType = policyServiceType; - return this; - } - - /** - * Set the policyServiceName. - * - * @param policyServiceName the policyServiceName - * @return the ListPolicyTemplatesOptions builder - */ - public Builder policyServiceName(String policyServiceName) { - this.policyServiceName = policyServiceName; - return this; - } - - /** - * Set the policyServiceGroupId. - * - * @param policyServiceGroupId the policyServiceGroupId - * @return the ListPolicyTemplatesOptions builder - */ - public Builder policyServiceGroupId(String policyServiceGroupId) { - this.policyServiceGroupId = policyServiceGroupId; - return this; - } - - /** - * Set the policyType. - * - * @param policyType the policyType - * @return the ListPolicyTemplatesOptions builder - */ - public Builder policyType(String policyType) { - this.policyType = policyType; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListPolicyTemplatesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListPolicyTemplatesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListPolicyTemplatesOptions() { } - - protected ListPolicyTemplatesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - state = builder.state; - name = builder.name; - policyServiceType = builder.policyServiceType; - policyServiceName = builder.policyServiceName; - policyServiceGroupId = builder.policyServiceGroupId; - policyType = builder.policyType; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListPolicyTemplatesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the policy templates belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the state. - * - * The policy template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the name. - * - * The policy template name. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the policyServiceType. - * - * Service type, Optional. - * - * @return the policyServiceType - */ - public String policyServiceType() { - return policyServiceType; - } - - /** - * Gets the policyServiceName. - * - * Service name, Optional. - * - * @return the policyServiceName - */ - public String policyServiceName() { - return policyServiceName; - } - - /** - * Gets the policyServiceGroupId. - * - * Service group id, Optional. - * - * @return the policyServiceGroupId - */ - public String policyServiceGroupId() { - return policyServiceGroupId; - } - - /** - * Gets the policyType. - * - * Policy type, Optional. - * - * @return the policyType - */ - public String policyType() { - return policyType; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java deleted file mode 100644 index adcb3f0cc90..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listRoleAssignments options. - */ -public class ListRoleAssignmentsOptions extends GenericModel { - - protected String accountId; - protected String acceptLanguage; - protected String templateId; - protected String templateVersion; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String templateId; - private String templateVersion; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListRoleAssignmentsOptions instance. - * - * @param listRoleAssignmentsOptions the instance to initialize the Builder with - */ - private Builder(ListRoleAssignmentsOptions listRoleAssignmentsOptions) { - this.accountId = listRoleAssignmentsOptions.accountId; - this.acceptLanguage = listRoleAssignmentsOptions.acceptLanguage; - this.templateId = listRoleAssignmentsOptions.templateId; - this.templateVersion = listRoleAssignmentsOptions.templateVersion; - this.limit = listRoleAssignmentsOptions.limit; - this.start = listRoleAssignmentsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListRoleAssignmentsOptions. - * - * @return the new ListRoleAssignmentsOptions instance - */ - public ListRoleAssignmentsOptions build() { - return new ListRoleAssignmentsOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListRoleAssignmentsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListRoleAssignmentsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the templateId. - * - * @param templateId the templateId - * @return the ListRoleAssignmentsOptions builder - */ - public Builder templateId(String templateId) { - this.templateId = templateId; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the ListRoleAssignmentsOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListRoleAssignmentsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListRoleAssignmentsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListRoleAssignmentsOptions() { } - - protected ListRoleAssignmentsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - templateId = builder.templateId; - templateVersion = builder.templateVersion; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListRoleAssignmentsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID in which the role assignment belongs to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the templateId. - * - * Optional template ID. - * - * @return the templateId - */ - public String templateId() { - return templateId; - } - - /** - * Gets the templateVersion. - * - * Optional role template version. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java deleted file mode 100644 index e22751433e5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listRoleTemplateVersions options. - */ -public class ListRoleTemplateVersionsOptions extends GenericModel { - - /** - * Role template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String roleTemplateId; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListRoleTemplateVersionsOptions instance. - * - * @param listRoleTemplateVersionsOptions the instance to initialize the Builder with - */ - private Builder(ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions) { - this.roleTemplateId = listRoleTemplateVersionsOptions.roleTemplateId; - this.state = listRoleTemplateVersionsOptions.state; - this.limit = listRoleTemplateVersionsOptions.limit; - this.start = listRoleTemplateVersionsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - */ - public Builder(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - } - - /** - * Builds a ListRoleTemplateVersionsOptions. - * - * @return the new ListRoleTemplateVersionsOptions instance - */ - public ListRoleTemplateVersionsOptions build() { - return new ListRoleTemplateVersionsOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the ListRoleTemplateVersionsOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListRoleTemplateVersionsOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListRoleTemplateVersionsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListRoleTemplateVersionsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListRoleTemplateVersionsOptions() { } - - protected ListRoleTemplateVersionsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - roleTemplateId = builder.roleTemplateId; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListRoleTemplateVersionsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * The role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the state. - * - * Role template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java deleted file mode 100644 index 8f889bdce96..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java +++ /dev/null @@ -1,307 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listRoleTemplates options. - */ -public class ListRoleTemplatesOptions extends GenericModel { - - /** - * The role template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String accountId; - protected String acceptLanguage; - protected String name; - protected String roleName; - protected String roleServiceName; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String name; - private String roleName; - private String roleServiceName; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListRoleTemplatesOptions instance. - * - * @param listRoleTemplatesOptions the instance to initialize the Builder with - */ - private Builder(ListRoleTemplatesOptions listRoleTemplatesOptions) { - this.accountId = listRoleTemplatesOptions.accountId; - this.acceptLanguage = listRoleTemplatesOptions.acceptLanguage; - this.name = listRoleTemplatesOptions.name; - this.roleName = listRoleTemplatesOptions.roleName; - this.roleServiceName = listRoleTemplatesOptions.roleServiceName; - this.state = listRoleTemplatesOptions.state; - this.limit = listRoleTemplatesOptions.limit; - this.start = listRoleTemplatesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListRoleTemplatesOptions. - * - * @return the new ListRoleTemplatesOptions instance - */ - public ListRoleTemplatesOptions build() { - return new ListRoleTemplatesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListRoleTemplatesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListRoleTemplatesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ListRoleTemplatesOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the roleName. - * - * @param roleName the roleName - * @return the ListRoleTemplatesOptions builder - */ - public Builder roleName(String roleName) { - this.roleName = roleName; - return this; - } - - /** - * Set the roleServiceName. - * - * @param roleServiceName the roleServiceName - * @return the ListRoleTemplatesOptions builder - */ - public Builder roleServiceName(String roleServiceName) { - this.roleServiceName = roleServiceName; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListRoleTemplatesOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListRoleTemplatesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListRoleTemplatesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListRoleTemplatesOptions() { } - - protected ListRoleTemplatesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - name = builder.name; - roleName = builder.roleName; - roleServiceName = builder.roleServiceName; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListRoleTemplatesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the role templates belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the name. - * - * The role template name. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the roleName. - * - * The template role name. - * - * @return the roleName - */ - public String roleName() { - return roleName; - } - - /** - * Gets the roleServiceName. - * - * The template role service name. - * - * @return the roleServiceName - */ - public String roleServiceName() { - return roleServiceName; - } - - /** - * Gets the state. - * - * The role template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java deleted file mode 100644 index 2ca364c53a3..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listRoles options. - */ -public class ListRolesOptions extends GenericModel { - - protected String acceptLanguage; - protected String accountId; - protected String serviceName; - protected String sourceServiceName; - protected String policyType; - protected String serviceGroupId; - - /** - * Builder. - */ - public static class Builder { - private String acceptLanguage; - private String accountId; - private String serviceName; - private String sourceServiceName; - private String policyType; - private String serviceGroupId; - - /** - * Instantiates a new Builder from an existing ListRolesOptions instance. - * - * @param listRolesOptions the instance to initialize the Builder with - */ - private Builder(ListRolesOptions listRolesOptions) { - this.acceptLanguage = listRolesOptions.acceptLanguage; - this.accountId = listRolesOptions.accountId; - this.serviceName = listRolesOptions.serviceName; - this.sourceServiceName = listRolesOptions.sourceServiceName; - this.policyType = listRolesOptions.policyType; - this.serviceGroupId = listRolesOptions.serviceGroupId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a ListRolesOptions. - * - * @return the new ListRolesOptions instance - */ - public ListRolesOptions build() { - return new ListRolesOptions(this); - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListRolesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListRolesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the ListRolesOptions builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the sourceServiceName. - * - * @param sourceServiceName the sourceServiceName - * @return the ListRolesOptions builder - */ - public Builder sourceServiceName(String sourceServiceName) { - this.sourceServiceName = sourceServiceName; - return this; - } - - /** - * Set the policyType. - * - * @param policyType the policyType - * @return the ListRolesOptions builder - */ - public Builder policyType(String policyType) { - this.policyType = policyType; - return this; - } - - /** - * Set the serviceGroupId. - * - * @param serviceGroupId the serviceGroupId - * @return the ListRolesOptions builder - */ - public Builder serviceGroupId(String serviceGroupId) { - this.serviceGroupId = serviceGroupId; - return this; - } - } - - protected ListRolesOptions() { } - - protected ListRolesOptions(Builder builder) { - acceptLanguage = builder.acceptLanguage; - accountId = builder.accountId; - serviceName = builder.serviceName; - sourceServiceName = builder.sourceServiceName; - policyType = builder.policyType; - serviceGroupId = builder.serviceGroupId; - } - - /** - * New builder. - * - * @return a ListRolesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the accountId. - * - * Optional account GUID in which the roles belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the serviceName. - * - * Optional name of IAM enabled service. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the sourceServiceName. - * - * Optional name of source IAM enabled service. - * - * @return the sourceServiceName - */ - public String sourceServiceName() { - return sourceServiceName; - } - - /** - * Gets the policyType. - * - * Optional Policy Type. - * - * @return the policyType - */ - public String policyType() { - return policyType; - } - - /** - * Gets the serviceGroupId. - * - * Optional id of service group. - * - * @return the serviceGroupId - */ - public String serviceGroupId() { - return serviceGroupId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java deleted file mode 100644 index 65849c3d9a6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java +++ /dev/null @@ -1,492 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listV2Policies options. - */ -public class ListV2PoliciesOptions extends GenericModel { - - /** - * Optional type of policy. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - /** - * Optional type of service. - */ - public interface ServiceType { - /** service. */ - String SERVICE = "service"; - /** platform_service. */ - String PLATFORM_SERVICE = "platform_service"; - } - - /** - * Include additional data per policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles and translations for all - * relevant fields. - */ - public interface Format { - /** include_last_permit. */ - String INCLUDE_LAST_PERMIT = "include_last_permit"; - /** display. */ - String DISPLAY = "display"; - } - - /** - * The state of the policy. - * * `active` - returns active policies - * * `deleted` - returns non-active policies. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String accountId; - protected String acceptLanguage; - protected String iamId; - protected String accessGroupId; - protected String type; - protected String serviceType; - protected String serviceName; - protected String serviceGroupId; - protected String sort; - protected String format; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String iamId; - private String accessGroupId; - private String type; - private String serviceType; - private String serviceName; - private String serviceGroupId; - private String sort; - private String format; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListV2PoliciesOptions instance. - * - * @param listV2PoliciesOptions the instance to initialize the Builder with - */ - private Builder(ListV2PoliciesOptions listV2PoliciesOptions) { - this.accountId = listV2PoliciesOptions.accountId; - this.acceptLanguage = listV2PoliciesOptions.acceptLanguage; - this.iamId = listV2PoliciesOptions.iamId; - this.accessGroupId = listV2PoliciesOptions.accessGroupId; - this.type = listV2PoliciesOptions.type; - this.serviceType = listV2PoliciesOptions.serviceType; - this.serviceName = listV2PoliciesOptions.serviceName; - this.serviceGroupId = listV2PoliciesOptions.serviceGroupId; - this.sort = listV2PoliciesOptions.sort; - this.format = listV2PoliciesOptions.format; - this.state = listV2PoliciesOptions.state; - this.limit = listV2PoliciesOptions.limit; - this.start = listV2PoliciesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListV2PoliciesOptions. - * - * @return the new ListV2PoliciesOptions instance - */ - public ListV2PoliciesOptions build() { - return new ListV2PoliciesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListV2PoliciesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListV2PoliciesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the iamId. - * - * @param iamId the iamId - * @return the ListV2PoliciesOptions builder - */ - public Builder iamId(String iamId) { - this.iamId = iamId; - return this; - } - - /** - * Set the accessGroupId. - * - * @param accessGroupId the accessGroupId - * @return the ListV2PoliciesOptions builder - */ - public Builder accessGroupId(String accessGroupId) { - this.accessGroupId = accessGroupId; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the ListV2PoliciesOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the serviceType. - * - * @param serviceType the serviceType - * @return the ListV2PoliciesOptions builder - */ - public Builder serviceType(String serviceType) { - this.serviceType = serviceType; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the ListV2PoliciesOptions builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the serviceGroupId. - * - * @param serviceGroupId the serviceGroupId - * @return the ListV2PoliciesOptions builder - */ - public Builder serviceGroupId(String serviceGroupId) { - this.serviceGroupId = serviceGroupId; - return this; - } - - /** - * Set the sort. - * - * @param sort the sort - * @return the ListV2PoliciesOptions builder - */ - public Builder sort(String sort) { - this.sort = sort; - return this; - } - - /** - * Set the format. - * - * @param format the format - * @return the ListV2PoliciesOptions builder - */ - public Builder format(String format) { - this.format = format; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListV2PoliciesOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListV2PoliciesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListV2PoliciesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListV2PoliciesOptions() { } - - protected ListV2PoliciesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - iamId = builder.iamId; - accessGroupId = builder.accessGroupId; - type = builder.type; - serviceType = builder.serviceType; - serviceName = builder.serviceName; - serviceGroupId = builder.serviceGroupId; - sort = builder.sort; - format = builder.format; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListV2PoliciesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID in which the policies belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the iamId. - * - * Optional IAM ID used to identify the subject. - * - * @return the iamId - */ - public String iamId() { - return iamId; - } - - /** - * Gets the accessGroupId. - * - * Optional access group id. - * - * @return the accessGroupId - */ - public String accessGroupId() { - return accessGroupId; - } - - /** - * Gets the type. - * - * Optional type of policy. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the serviceType. - * - * Optional type of service. - * - * @return the serviceType - */ - public String serviceType() { - return serviceType; - } - - /** - * Gets the serviceName. - * - * Optional name of service. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the serviceGroupId. - * - * Optional ID of service group. - * - * @return the serviceGroupId - */ - public String serviceGroupId() { - return serviceGroupId; - } - - /** - * Gets the sort. - * - * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending - * '-' to field, for example, '-last_modified_at'. Note that last permit information is only included when - * 'format=include_last_permit', for example, "format=include_last_permit&sort=last_permit_at" Example fields that - * can be sorted on: - * - 'id' - * - 'type' - * - 'href' - * - 'created_at' - * - 'created_by_id' - * - 'last_modified_at' - * - 'last_modified_by_id' - * - 'state' - * - 'last_permit_at' - * - 'last_permit_frequency'. - * - * @return the sort - */ - public String sort() { - return sort; - } - - /** - * Gets the format. - * - * Include additional data per policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles and translations for all - * relevant fields. - * - * @return the format - */ - public String format() { - return format; - } - - /** - * Gets the state. - * - * The state of the policy. - * * `active` - returns active policies - * * `deleted` - returns non-active policies. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java deleted file mode 100644 index 4d43d84dbba..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Condition that specifies additional conditions or RuleAttribute to grant access. - * - * Classes which extend this class: - * - NestedConditionRuleAttribute - * - NestedConditionRuleWithConditions - */ -public class NestedCondition extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - protected String key; - protected String operator; - protected Object value; - protected List conditions; - - protected NestedCondition() { } - - /** - * Gets the key. - * - * The name of an attribute. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } - - /** - * Gets the conditions. - * - * List of conditions associated with a policy. For example, time-based conditions that grant access over a certain - * time period. - * - * @return the conditions - */ - public List conditions() { - return conditions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java deleted file mode 100644 index b1d44da3f6b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * Rule that specifies additional access that is granted (For example, time-based condition). - */ -public class NestedConditionRuleAttribute extends NestedCondition { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing NestedConditionRuleAttribute instance. - * - * @param nestedConditionRuleAttribute the instance to initialize the Builder with - */ - public Builder(NestedCondition nestedConditionRuleAttribute) { - this.key = nestedConditionRuleAttribute.key; - this.operator = nestedConditionRuleAttribute.operator; - this.value = nestedConditionRuleAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a NestedConditionRuleAttribute. - * - * @return the new NestedConditionRuleAttribute instance - */ - public NestedConditionRuleAttribute build() { - return new NestedConditionRuleAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the NestedConditionRuleAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the NestedConditionRuleAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the NestedConditionRuleAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected NestedConditionRuleAttribute() { } - - protected NestedConditionRuleAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a NestedConditionRuleAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java deleted file mode 100644 index 20d0faac795..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * Rule that specifies additional access that is granted (for example, time-based condition) accross multiple - * conditions. - */ -public class NestedConditionRuleWithConditions extends NestedCondition { - - /** - * Operator to evaluate conditions. - */ - public interface Operator { - /** and. */ - String AND = "and"; - /** or. */ - String OR = "or"; - } - - - /** - * Builder. - */ - public static class Builder { - private String operator; - private List conditions; - - /** - * Instantiates a new Builder from an existing NestedConditionRuleWithConditions instance. - * - * @param nestedConditionRuleWithConditions the instance to initialize the Builder with - */ - public Builder(NestedCondition nestedConditionRuleWithConditions) { - this.operator = nestedConditionRuleWithConditions.operator; - this.conditions = nestedConditionRuleWithConditions.conditions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param operator the operator - * @param conditions the conditions - */ - public Builder(String operator, List conditions) { - this.operator = operator; - this.conditions = conditions; - } - - /** - * Builds a NestedConditionRuleWithConditions. - * - * @return the new NestedConditionRuleWithConditions instance - */ - public NestedConditionRuleWithConditions build() { - return new NestedConditionRuleWithConditions(this); - } - - /** - * Adds a new element to conditions. - * - * @param conditions the new element to be added - * @return the NestedConditionRuleWithConditions builder - */ - public Builder addConditions(RuleAttribute conditions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(conditions, - "conditions cannot be null"); - if (this.conditions == null) { - this.conditions = new ArrayList(); - } - this.conditions.add(conditions); - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the NestedConditionRuleWithConditions builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the conditions. - * Existing conditions will be replaced. - * - * @param conditions the conditions - * @return the NestedConditionRuleWithConditions builder - */ - public Builder conditions(List conditions) { - this.conditions = conditions; - return this; - } - } - - protected NestedConditionRuleWithConditions() { } - - protected NestedConditionRuleWithConditions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.conditions, - "conditions cannot be null"); - operator = builder.operator; - conditions = builder.conditions; - } - - /** - * New builder. - * - * @return a NestedConditionRuleWithConditions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java deleted file mode 100644 index b0442f902bc..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Details with href linking to the following page of requested collection. - */ -public class Next extends GenericModel { - - protected String href; - protected String start; - - protected Next() { } - - /** - * Gets the href. - * - * The href linking to the page of requested collection. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection. - * - * @return the start - */ - public String getStart() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java deleted file mode 100644 index 8f12053c72e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * PoliciesPager can be used to simplify the use of the "listPolicies" method. - */ -public class PoliciesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListPoliciesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected PoliciesPager() { } - - /** - * Constructs a new PoliciesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listPolicies" method - * @param options the ListPoliciesOptions instance to be used to invoke the "listPolicies" method - */ - public PoliciesPager(IamPolicyManagement client, ListPoliciesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<PolicyTemplateMetaData> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListPoliciesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - PolicyCollection result = client.listPolicies(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getPolicies(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<PolicyTemplateMetaData> containing all results returned by the "listPolicies" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java deleted file mode 100644 index af852b7cd74..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with a policy. - */ -public class Policy extends GenericModel { - - /** - * The policy state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String id; - protected String type; - protected String description; - protected List subjects; - protected List roles; - protected List resources; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String state; - - protected Policy() { } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Gets the description. - * - * Customer-defined description. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the subjects. - * - * The subjects associated with a policy. - * - * @return the subjects - */ - public List getSubjects() { - return subjects; - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List getRoles() { - return roles; - } - - /** - * Gets the resources. - * - * The resources associated with a policy. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the href. - * - * The href links back to the policy. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the state. - * - * The policy state. - * - * @return the state - */ - public String getState() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java deleted file mode 100644 index 3e566ce7bdf..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Set of properties for the assigned resource. - */ -public class PolicyAssignmentResourcePolicy extends GenericModel { - - @SerializedName("resource_created") - protected AssignmentResourceCreated resourceCreated; - protected String status; - @SerializedName("error_message") - protected AssignmentResourceError errorMessage; - - protected PolicyAssignmentResourcePolicy() { } - - /** - * Gets the resourceCreated. - * - * On success, includes the policy that is assigned. - * - * @return the resourceCreated - */ - public AssignmentResourceCreated getResourceCreated() { - return resourceCreated; - } - - /** - * Gets the status. - * - * policy status. - * - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * Gets the errorMessage. - * - * Body parameters for assignment error. - * - * @return the errorMessage - */ - public AssignmentResourceError getErrorMessage() { - return errorMessage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java deleted file mode 100644 index ad944536b0d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The policy assignment resources. - */ -public class PolicyAssignmentResources extends GenericModel { - - protected String target; - protected PolicyAssignmentResourcePolicy policy; - - protected PolicyAssignmentResources() { } - - /** - * Gets the target. - * - * Account ID where resources are assigned. - * - * @return the target - */ - public String getTarget() { - return target; - } - - /** - * Gets the policy. - * - * Set of properties for the assigned resource. - * - * @return the policy - */ - public PolicyAssignmentResourcePolicy getPolicy() { - return policy; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java deleted file mode 100644 index f1ea295713c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the policy template assignment. - */ -public class PolicyAssignmentV1 extends GenericModel { - - /** - * The policy assignment status. - */ - public interface Status { - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** succeeded. */ - String SUCCEEDED = "succeeded"; - /** succeed_with_errors. */ - String SUCCEED_WITH_ERRORS = "succeed_with_errors"; - /** failed. */ - String FAILED = "failed"; - } - - protected AssignmentTargetDetails target; - protected String id; - @SerializedName("account_id") - protected String accountId; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected List resources; - protected PolicyAssignmentV1Subject subject; - protected AssignmentTemplateDetails template; - protected String status; - - protected PolicyAssignmentV1() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the id. - * - * Policy assignment ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the accountId. - * - * The account GUID that the policies assignments belong to. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the href. - * - * The href URL that links to the policies assignments API by policy assignment ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy assignment was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy assignment. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy assignment was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy assignment. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the resources. - * - * Object for each account assigned. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the subject. - * - * Subject details of access type assignment. - * - * @return the subject - */ - public PolicyAssignmentV1Subject getSubject() { - return subject; - } - - /** - * Gets the template. - * - * policy template details. - * - * @return the template - */ - public AssignmentTemplateDetails getTemplate() { - return template; - } - - /** - * Gets the status. - * - * The policy assignment status. - * - * @return the status - */ - public String getStatus() { - return status; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java deleted file mode 100644 index 7331ee5a854..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Policy assignment response. - */ -public class PolicyAssignmentV1Collection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List assignments; - - protected PolicyAssignmentV1Collection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the assignments. - * - * Response of policy assignments. - * - * @return the assignments - */ - public List getAssignments() { - return assignments; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java deleted file mode 100644 index c05eb90816b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The policy assignment resources. - */ -public class PolicyAssignmentV1Resources extends GenericModel { - - protected AssignmentTargetDetails target; - protected PolicyAssignmentResourcePolicy policy; - - protected PolicyAssignmentV1Resources() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the policy. - * - * Set of properties for the assigned resource. - * - * @return the policy - */ - public PolicyAssignmentResourcePolicy getPolicy() { - return policy; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java deleted file mode 100644 index 58b2cd240ba..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Subject details of access type assignment. - */ -public class PolicyAssignmentV1Subject extends GenericModel { - - /** - * The identity type of the subject of the assignment. - */ - public interface Type { - /** iam_id. */ - String IAM_ID = "iam_id"; - /** access_group_id. */ - String ACCESS_GROUP_ID = "access_group_id"; - } - - protected String id; - protected String type; - - protected PolicyAssignmentV1Subject() { } - - /** - * Gets the id. - * - * The unique identifier of the subject of the assignment. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the type. - * - * The identity type of the subject of the assignment. - * - * @return the type - */ - public String getType() { - return type; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java deleted file mode 100644 index 931769daed5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * PolicyAssignmentsPager can be used to simplify the use of the "listPolicyAssignments" method. - */ -public class PolicyAssignmentsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListPolicyAssignmentsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected PolicyAssignmentsPager() { } - - /** - * Constructs a new PolicyAssignmentsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyAssignments" method - * @param options the ListPolicyAssignmentsOptions instance to be used to invoke the "listPolicyAssignments" method - */ - public PolicyAssignmentsPager(IamPolicyManagement client, ListPolicyAssignmentsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<PolicyTemplateAssignmentItems> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListPolicyAssignmentsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - PolicyTemplateAssignmentCollection result = client.listPolicyAssignments(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getAssignments(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<PolicyTemplateAssignmentItems> containing all results returned by the "listPolicyAssignments" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java deleted file mode 100644 index 25062dd0a52..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of policies. - */ -public class PolicyCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List policies; - - protected PolicyCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the policies. - * - * List of policies. - * - * @return the policies - */ - public List getPolicies() { - return policies; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java deleted file mode 100644 index 4033f2dbc9d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The attributes of the resource. Note that only one resource is allowed in a policy. - */ -public class PolicyResource extends GenericModel { - - protected List attributes; - protected List tags; - - /** - * Builder. - */ - public static class Builder { - private List attributes; - private List tags; - - /** - * Instantiates a new Builder from an existing PolicyResource instance. - * - * @param policyResource the instance to initialize the Builder with - */ - private Builder(PolicyResource policyResource) { - this.attributes = policyResource.attributes; - this.tags = policyResource.tags; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param attributes the attributes - */ - public Builder(List attributes) { - this.attributes = attributes; - } - - /** - * Builds a PolicyResource. - * - * @return the new PolicyResource instance - */ - public PolicyResource build() { - return new PolicyResource(this); - } - - /** - * Adds a new element to attributes. - * - * @param attributes the new element to be added - * @return the PolicyResource builder - */ - public Builder addAttributes(ResourceAttribute attributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, - "attributes cannot be null"); - if (this.attributes == null) { - this.attributes = new ArrayList(); - } - this.attributes.add(attributes); - return this; - } - - /** - * Adds a new element to tags. - * - * @param tags the new element to be added - * @return the PolicyResource builder - */ - public Builder addTags(ResourceTag tags) { - com.ibm.cloud.sdk.core.util.Validator.notNull(tags, - "tags cannot be null"); - if (this.tags == null) { - this.tags = new ArrayList(); - } - this.tags.add(tags); - return this; - } - - /** - * Set the attributes. - * Existing attributes will be replaced. - * - * @param attributes the attributes - * @return the PolicyResource builder - */ - public Builder attributes(List attributes) { - this.attributes = attributes; - return this; - } - - /** - * Set the tags. - * Existing tags will be replaced. - * - * @param tags the tags - * @return the PolicyResource builder - */ - public Builder tags(List tags) { - this.tags = tags; - return this; - } - } - - protected PolicyResource() { } - - protected PolicyResource(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, - "attributes cannot be null"); - attributes = builder.attributes; - tags = builder.tags; - } - - /** - * New builder. - * - * @return a PolicyResource builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the attributes. - * - * List of resource attributes. - * - * @return the attributes - */ - public List attributes() { - return attributes; - } - - /** - * Gets the tags. - * - * List of access management tags. - * - * @return the tags - */ - public List tags() { - return tags; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java deleted file mode 100644 index 7319eabce7b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role associated with a policy. - */ -public class PolicyRole extends GenericModel { - - @SerializedName("role_id") - protected String roleId; - @SerializedName("display_name") - protected String displayName; - protected String description; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - - /** - * Instantiates a new Builder from an existing PolicyRole instance. - * - * @param policyRole the instance to initialize the Builder with - */ - private Builder(PolicyRole policyRole) { - this.roleId = policyRole.roleId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - */ - public Builder(String roleId) { - this.roleId = roleId; - } - - /** - * Builds a PolicyRole. - * - * @return the new PolicyRole instance - */ - public PolicyRole build() { - return new PolicyRole(this); - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the PolicyRole builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - } - - protected PolicyRole() { } - - protected PolicyRole(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleId, - "roleId cannot be null"); - roleId = builder.roleId; - } - - /** - * New builder. - * - * @return a PolicyRole builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } - - /** - * Gets the displayName. - * - * The display name of the role. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String description() { - return description; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java deleted file mode 100644 index bf1b035a6b7..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The subject attribute values that must match in order for this policy to apply in a permission decision. - */ -public class PolicySubject extends GenericModel { - - protected List attributes; - - /** - * Builder. - */ - public static class Builder { - private List attributes; - - /** - * Instantiates a new Builder from an existing PolicySubject instance. - * - * @param policySubject the instance to initialize the Builder with - */ - private Builder(PolicySubject policySubject) { - this.attributes = policySubject.attributes; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param attributes the attributes - */ - public Builder(List attributes) { - this.attributes = attributes; - } - - /** - * Builds a PolicySubject. - * - * @return the new PolicySubject instance - */ - public PolicySubject build() { - return new PolicySubject(this); - } - - /** - * Adds a new element to attributes. - * - * @param attributes the new element to be added - * @return the PolicySubject builder - */ - public Builder addAttributes(SubjectAttribute attributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, - "attributes cannot be null"); - if (this.attributes == null) { - this.attributes = new ArrayList(); - } - this.attributes.add(attributes); - return this; - } - - /** - * Set the attributes. - * Existing attributes will be replaced. - * - * @param attributes the attributes - * @return the PolicySubject builder - */ - public Builder attributes(List attributes) { - this.attributes = attributes; - return this; - } - } - - protected PolicySubject() { } - - protected PolicySubject(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, - "attributes cannot be null"); - attributes = builder.attributes; - } - - /** - * New builder. - * - * @return a PolicySubject builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the attributes. - * - * List of subject attributes. - * - * @return the attributes - */ - public List attributes() { - return attributes; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java deleted file mode 100644 index bdffbe98c10..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the policy template. - */ -public class PolicyTemplate extends GenericModel { - - /** - * State of policy template. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String name; - protected String description; - @SerializedName("account_id") - protected String accountId; - protected String version; - protected Boolean committed; - protected TemplatePolicy policy; - protected String state; - protected String id; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - - protected PolicyTemplate() { } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the version. - * - * Template version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the committed. - * - * Committed status of the template version. - * - * @return the committed - */ - public Boolean isCommitted() { - return committed; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy getPolicy() { - return policy; - } - - /** - * Gets the state. - * - * State of policy template. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the id. - * - * The policy template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the policy templates API by policy template ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy template was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy template. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy template was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy template. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java deleted file mode 100644 index 54727eadf4d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of policies assignments. - */ -public class PolicyTemplateAssignmentCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List assignments; - - protected PolicyTemplateAssignmentCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the assignments. - * - * List of policy assignments. - * - * @return the assignments - */ - public List getAssignments() { - return assignments; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java deleted file mode 100644 index 2c8e82df441..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * PolicyTemplateAssignmentItems. - * - * Classes which extend this class: - * - PolicyTemplateAssignmentItemsPolicyAssignmentV1 - * - PolicyTemplateAssignmentItemsPolicyAssignment - */ -public class PolicyTemplateAssignmentItems extends GenericModel { - - /** - * The policy assignment status. - */ - public interface Status { - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** succeeded. */ - String SUCCEEDED = "succeeded"; - /** succeed_with_errors. */ - String SUCCEED_WITH_ERRORS = "succeed_with_errors"; - /** failed. */ - String FAILED = "failed"; - } - - /** - * Assignment target type. - */ - public interface TargetType { - /** Account. */ - String ACCOUNT = "Account"; - /** AccountGroup. */ - String ACCOUNTGROUP = "AccountGroup"; - /** Enterprise. */ - String ENTERPRISE = "Enterprise"; - } - - protected AssignmentTargetDetails target; - protected String id; - @SerializedName("account_id") - protected String accountId; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected List resources; - protected PolicyAssignmentV1Subject subject; - protected AssignmentTemplateDetails template; - protected String status; - @SerializedName("template_id") - protected String templateId; - @SerializedName("template_version") - protected String templateVersion; - @SerializedName("assignment_id") - protected String assignmentId; - @SerializedName("target_type") - protected String targetType; - - protected PolicyTemplateAssignmentItems() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the id. - * - * Policy assignment ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the accountId. - * - * The account GUID that the policies assignments belong to. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the href. - * - * The href URL that links to the policies assignments API by policy assignment ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy assignment was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy assignment. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy assignment was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy assignment. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the resources. - * - * Object for each account assigned. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the subject. - * - * Subject details of access type assignment. - * - * @return the subject - */ - public PolicyAssignmentV1Subject getSubject() { - return subject; - } - - /** - * Gets the template. - * - * policy template details. - * - * @return the template - */ - public AssignmentTemplateDetails getTemplate() { - return template; - } - - /** - * Gets the status. - * - * The policy assignment status. - * - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * Gets the templateId. - * - * policy template ID. - * - * @return the templateId - */ - public String getTemplateId() { - return templateId; - } - - /** - * Gets the templateVersion. - * - * policy template version. - * - * @return the templateVersion - */ - public String getTemplateVersion() { - return templateVersion; - } - - /** - * Gets the assignmentId. - * - * Passed in value to correlate with other assignments. - * - * @return the assignmentId - */ - public String getAssignmentId() { - return assignmentId; - } - - /** - * Gets the targetType. - * - * Assignment target type. - * - * @return the targetType - */ - public String getTargetType() { - return targetType; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java deleted file mode 100644 index ec9c32e5bdd..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * The set of properties associated with the policy template assignment. - */ -public class PolicyTemplateAssignmentItemsPolicyAssignment extends PolicyTemplateAssignmentItems { - - /** - * Assignment target type. - */ - public interface TargetType { - /** Account. */ - String ACCOUNT = "Account"; - /** AccountGroup. */ - String ACCOUNTGROUP = "AccountGroup"; - /** Enterprise. */ - String ENTERPRISE = "Enterprise"; - } - - /** - * The policy assignment status. - */ - public interface Status { - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** succeeded. */ - String SUCCEEDED = "succeeded"; - /** succeed_with_errors. */ - String SUCCEED_WITH_ERRORS = "succeed_with_errors"; - /** failed. */ - String FAILED = "failed"; - } - - - protected PolicyTemplateAssignmentItemsPolicyAssignment() { } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java deleted file mode 100644 index 4cebdbb17b1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * The set of properties associated with the policy template assignment. - */ -public class PolicyTemplateAssignmentItemsPolicyAssignmentV1 extends PolicyTemplateAssignmentItems { - - /** - * The policy assignment status. - */ - public interface Status { - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** succeeded. */ - String SUCCEEDED = "succeeded"; - /** succeed_with_errors. */ - String SUCCEED_WITH_ERRORS = "succeed_with_errors"; - /** failed. */ - String FAILED = "failed"; - } - - - protected PolicyTemplateAssignmentItemsPolicyAssignmentV1() { } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java deleted file mode 100644 index 2a262c584b5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of policy Templates. - */ -public class PolicyTemplateCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - @SerializedName("policy_templates") - protected List policyTemplates; - - protected PolicyTemplateCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the policyTemplates. - * - * List of policy templates. - * - * @return the policyTemplates - */ - public List getPolicyTemplates() { - return policyTemplates; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java deleted file mode 100644 index 5a2876dfe28..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the policy template. - */ -public class PolicyTemplateLimitData extends GenericModel { - - /** - * State of policy template. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String name; - protected String description; - @SerializedName("account_id") - protected String accountId; - protected String version; - protected Boolean committed; - protected TemplatePolicy policy; - protected String state; - protected String id; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected TemplateCountData counts; - - protected PolicyTemplateLimitData() { } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the version. - * - * Template version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the committed. - * - * Committed status of the template version. - * - * @return the committed - */ - public Boolean isCommitted() { - return committed; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy getPolicy() { - return policy; - } - - /** - * Gets the state. - * - * State of policy template. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the id. - * - * The policy template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the policy templates API by policy template ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy template was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy template. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy template was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy template. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the counts. - * - * policy template count details. - * - * @return the counts - */ - public TemplateCountData getCounts() { - return counts; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java deleted file mode 100644 index 07effc5b3ad..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with a policy. - */ -public class PolicyTemplateMetaData extends GenericModel { - - /** - * The policy state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String id; - protected String type; - protected String description; - protected List subjects; - protected List roles; - protected List resources; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String state; - protected TemplateMetadata template; - - protected PolicyTemplateMetaData() { } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Gets the description. - * - * Customer-defined description. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the subjects. - * - * The subjects associated with a policy. - * - * @return the subjects - */ - public List getSubjects() { - return subjects; - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List getRoles() { - return roles; - } - - /** - * Gets the resources. - * - * The resources associated with a policy. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the href. - * - * The href links back to the policy. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the state. - * - * The policy state. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the template. - * - * The details of the IAM template that was used to create an enterprise-managed policy in your account. When - * returned, this indicates that the policy is created from and managed by a template in the root enterprise account. - * - * @return the template - */ - public TemplateMetadata getTemplate() { - return template; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java deleted file mode 100644 index a4f95bc6562..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of versions for a specific policy template. - */ -public class PolicyTemplateVersionsCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List versions; - - protected PolicyTemplateVersionsCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the versions. - * - * List of policy templates versions. - * - * @return the versions - */ - public List getVersions() { - return versions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java deleted file mode 100644 index f6a2496cf91..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * PolicyTemplateVersionsPager can be used to simplify the use of the "listPolicyTemplateVersions" method. - */ -public class PolicyTemplateVersionsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListPolicyTemplateVersionsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected PolicyTemplateVersionsPager() { } - - /** - * Constructs a new PolicyTemplateVersionsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyTemplateVersions" method - * @param options the ListPolicyTemplateVersionsOptions instance to be used to invoke the "listPolicyTemplateVersions" method - */ - public PolicyTemplateVersionsPager(IamPolicyManagement client, ListPolicyTemplateVersionsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<PolicyTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListPolicyTemplateVersionsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - PolicyTemplateVersionsCollection result = client.listPolicyTemplateVersions(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getVersions(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<PolicyTemplate> containing all results returned by the "listPolicyTemplateVersions" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java deleted file mode 100644 index eba6e6c8fad..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * PolicyTemplatesPager can be used to simplify the use of the "listPolicyTemplates" method. - */ -public class PolicyTemplatesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListPolicyTemplatesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected PolicyTemplatesPager() { } - - /** - * Constructs a new PolicyTemplatesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyTemplates" method - * @param options the ListPolicyTemplatesOptions instance to be used to invoke the "listPolicyTemplates" method - */ - public PolicyTemplatesPager(IamPolicyManagement client, ListPolicyTemplatesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<PolicyTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListPolicyTemplatesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - PolicyTemplateCollection result = client.listPolicyTemplates(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getPolicyTemplates(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<PolicyTemplate> containing all results returned by the "listPolicyTemplates" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java deleted file mode 100644 index 2656f3fb790..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Details with linking href to previous page of requested collection. - */ -public class Previous extends GenericModel { - - protected String href; - protected String start; - - protected Previous() { } - - /** - * Gets the href. - * - * The href linking to the page of requested collection. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection. - * - * @return the start - */ - public String getStart() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java deleted file mode 100644 index 151a77e8cb9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java +++ /dev/null @@ -1,273 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replaceActionControlTemplate options. - */ -public class ReplaceActionControlTemplateOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String version; - protected String ifMatch; - protected String name; - protected String description; - protected TemplateActionControl actionControl; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String version; - private String ifMatch; - private String name; - private String description; - private TemplateActionControl actionControl; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing ReplaceActionControlTemplateOptions instance. - * - * @param replaceActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(ReplaceActionControlTemplateOptions replaceActionControlTemplateOptions) { - this.actionControlTemplateId = replaceActionControlTemplateOptions.actionControlTemplateId; - this.version = replaceActionControlTemplateOptions.version; - this.ifMatch = replaceActionControlTemplateOptions.ifMatch; - this.name = replaceActionControlTemplateOptions.name; - this.description = replaceActionControlTemplateOptions.description; - this.actionControl = replaceActionControlTemplateOptions.actionControl; - this.committed = replaceActionControlTemplateOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - * @param version the version - * @param ifMatch the ifMatch - */ - public Builder(String actionControlTemplateId, String version, String ifMatch) { - this.actionControlTemplateId = actionControlTemplateId; - this.version = version; - this.ifMatch = ifMatch; - } - - /** - * Builds a ReplaceActionControlTemplateOptions. - * - * @return the new ReplaceActionControlTemplateOptions instance - */ - public ReplaceActionControlTemplateOptions build() { - return new ReplaceActionControlTemplateOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actionControl. - * - * @param actionControl the actionControl - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder actionControl(TemplateActionControl actionControl) { - this.actionControl = actionControl; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected ReplaceActionControlTemplateOptions() { } - - protected ReplaceActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - actionControlTemplateId = builder.actionControlTemplateId; - version = builder.version; - ifMatch = builder.ifMatch; - name = builder.name; - description = builder.description; - actionControl = builder.actionControl; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a ReplaceActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating an action control template version must match the Etag value of the existing - * action control template version. The Etag can be retrieved using the GET - * /v1/action_control_templates/{template_id}/versions/{version} API and looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will - * change the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the action control template. This is shown to users in the enterprise account. Use this to describe - * the purpose or context of the action control for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actionControl. - * - * The action control properties that are created in an action resource when the template is assigned. - * - * @return the actionControl - */ - public TemplateActionControl actionControl() { - return actionControl; - } - - /** - * Gets the committed. - * - * Committed status of the template version. If committed is set to true, then the template version can no longer be - * updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java deleted file mode 100644 index 80cbe9e4c79..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java +++ /dev/null @@ -1,335 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replacePolicy options. - */ -public class ReplacePolicyOptions extends GenericModel { - - protected String policyId; - protected String ifMatch; - protected String type; - protected List subjects; - protected List roles; - protected List resources; - protected String description; - - /** - * Builder. - */ - public static class Builder { - private String policyId; - private String ifMatch; - private String type; - private List subjects; - private List roles; - private List resources; - private String description; - - /** - * Instantiates a new Builder from an existing ReplacePolicyOptions instance. - * - * @param replacePolicyOptions the instance to initialize the Builder with - */ - private Builder(ReplacePolicyOptions replacePolicyOptions) { - this.policyId = replacePolicyOptions.policyId; - this.ifMatch = replacePolicyOptions.ifMatch; - this.type = replacePolicyOptions.type; - this.subjects = replacePolicyOptions.subjects; - this.roles = replacePolicyOptions.roles; - this.resources = replacePolicyOptions.resources; - this.description = replacePolicyOptions.description; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyId the policyId - * @param ifMatch the ifMatch - * @param type the type - * @param subjects the subjects - * @param roles the roles - * @param resources the resources - */ - public Builder(String policyId, String ifMatch, String type, List subjects, List roles, List resources) { - this.policyId = policyId; - this.ifMatch = ifMatch; - this.type = type; - this.subjects = subjects; - this.roles = roles; - this.resources = resources; - } - - /** - * Builds a ReplacePolicyOptions. - * - * @return the new ReplacePolicyOptions instance - */ - public ReplacePolicyOptions build() { - return new ReplacePolicyOptions(this); - } - - /** - * Adds a new element to subjects. - * - * @param subjects the new element to be added - * @return the ReplacePolicyOptions builder - */ - public Builder addSubjects(PolicySubject subjects) { - com.ibm.cloud.sdk.core.util.Validator.notNull(subjects, - "subjects cannot be null"); - if (this.subjects == null) { - this.subjects = new ArrayList(); - } - this.subjects.add(subjects); - return this; - } - - /** - * Adds a new element to roles. - * - * @param roles the new element to be added - * @return the ReplacePolicyOptions builder - */ - public Builder addRoles(PolicyRole roles) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roles, - "roles cannot be null"); - if (this.roles == null) { - this.roles = new ArrayList(); - } - this.roles.add(roles); - return this; - } - - /** - * Adds a new element to resources. - * - * @param resources the new element to be added - * @return the ReplacePolicyOptions builder - */ - public Builder addResources(PolicyResource resources) { - com.ibm.cloud.sdk.core.util.Validator.notNull(resources, - "resources cannot be null"); - if (this.resources == null) { - this.resources = new ArrayList(); - } - this.resources.add(resources); - return this; - } - - /** - * Set the policyId. - * - * @param policyId the policyId - * @return the ReplacePolicyOptions builder - */ - public Builder policyId(String policyId) { - this.policyId = policyId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplacePolicyOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the ReplacePolicyOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the subjects. - * Existing subjects will be replaced. - * - * @param subjects the subjects - * @return the ReplacePolicyOptions builder - */ - public Builder subjects(List subjects) { - this.subjects = subjects; - return this; - } - - /** - * Set the roles. - * Existing roles will be replaced. - * - * @param roles the roles - * @return the ReplacePolicyOptions builder - */ - public Builder roles(List roles) { - this.roles = roles; - return this; - } - - /** - * Set the resources. - * Existing resources will be replaced. - * - * @param resources the resources - * @return the ReplacePolicyOptions builder - */ - public Builder resources(List resources) { - this.resources = resources; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplacePolicyOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - } - - protected ReplacePolicyOptions() { } - - protected ReplacePolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, - "policyId 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.type, - "type cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subjects, - "subjects cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, - "roles cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resources, - "resources cannot be null"); - policyId = builder.policyId; - ifMatch = builder.ifMatch; - type = builder.type; - subjects = builder.subjects; - roles = builder.roles; - resources = builder.resources; - description = builder.description; - } - - /** - * New builder. - * - * @return a ReplacePolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyId. - * - * The policy ID. - * - * @return the policyId - */ - public String policyId() { - return policyId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be - * retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the subjects. - * - * The subjects associated with a policy. - * - * @return the subjects - */ - public List subjects() { - return subjects; - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List roles() { - return roles; - } - - /** - * Gets the resources. - * - * The resources associated with a policy. - * - * @return the resources - */ - public List resources() { - return resources; - } - - /** - * Gets the description. - * - * Customer-defined description. - * - * @return the description - */ - public String description() { - return description; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java deleted file mode 100644 index 5a55c4898e5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replacePolicyTemplate options. - */ -public class ReplacePolicyTemplateOptions extends GenericModel { - - protected String policyTemplateId; - protected String version; - protected String ifMatch; - protected TemplatePolicy policy; - protected String name; - protected String description; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String version; - private String ifMatch; - private TemplatePolicy policy; - private String name; - private String description; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing ReplacePolicyTemplateOptions instance. - * - * @param replacePolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(ReplacePolicyTemplateOptions replacePolicyTemplateOptions) { - this.policyTemplateId = replacePolicyTemplateOptions.policyTemplateId; - this.version = replacePolicyTemplateOptions.version; - this.ifMatch = replacePolicyTemplateOptions.ifMatch; - this.policy = replacePolicyTemplateOptions.policy; - this.name = replacePolicyTemplateOptions.name; - this.description = replacePolicyTemplateOptions.description; - this.committed = replacePolicyTemplateOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param version the version - * @param ifMatch the ifMatch - * @param policy the policy - */ - public Builder(String policyTemplateId, String version, String ifMatch, TemplatePolicy policy) { - this.policyTemplateId = policyTemplateId; - this.version = version; - this.ifMatch = ifMatch; - this.policy = policy; - } - - /** - * Builds a ReplacePolicyTemplateOptions. - * - * @return the new ReplacePolicyTemplateOptions instance - */ - public ReplacePolicyTemplateOptions build() { - return new ReplacePolicyTemplateOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the policy. - * - * @param policy the policy - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder policy(TemplatePolicy policy) { - this.policy = policy; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected ReplacePolicyTemplateOptions() { } - - protected ReplacePolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version 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.policy, - "policy cannot be null"); - policyTemplateId = builder.policyTemplateId; - version = builder.version; - ifMatch = builder.ifMatch; - policy = builder.policy; - name = builder.name; - description = builder.description; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a ReplacePolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the version. - * - * The policy template version. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy template version and must match the Etag value of the existing policy - * template version. The Etag can be retrieved using the GET - * /v1/policy_templates/{policy_template_id}/versions/{version} API and looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy policy() { - return policy; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template version. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java deleted file mode 100644 index fc4b536103d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java +++ /dev/null @@ -1,255 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replaceRole options. - */ -public class ReplaceRoleOptions extends GenericModel { - - protected String roleId; - protected String ifMatch; - protected String displayName; - protected List actions; - protected String description; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - private String ifMatch; - private String displayName; - private List actions; - private String description; - - /** - * Instantiates a new Builder from an existing ReplaceRoleOptions instance. - * - * @param replaceRoleOptions the instance to initialize the Builder with - */ - private Builder(ReplaceRoleOptions replaceRoleOptions) { - this.roleId = replaceRoleOptions.roleId; - this.ifMatch = replaceRoleOptions.ifMatch; - this.displayName = replaceRoleOptions.displayName; - this.actions = replaceRoleOptions.actions; - this.description = replaceRoleOptions.description; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - * @param ifMatch the ifMatch - * @param displayName the displayName - * @param actions the actions - */ - public Builder(String roleId, String ifMatch, String displayName, List actions) { - this.roleId = roleId; - this.ifMatch = ifMatch; - this.displayName = displayName; - this.actions = actions; - } - - /** - * Builds a ReplaceRoleOptions. - * - * @return the new ReplaceRoleOptions instance - */ - public ReplaceRoleOptions build() { - return new ReplaceRoleOptions(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the ReplaceRoleOptions builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the ReplaceRoleOptions builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplaceRoleOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the ReplaceRoleOptions builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the ReplaceRoleOptions builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplaceRoleOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the role. - * - * @param role the role - * @return the ReplaceRoleOptions builder - */ - public Builder role(Role role) { - this.displayName = role.displayName(); - this.actions = role.actions(); - this.description = role.description(); - return this; - } - } - - protected ReplaceRoleOptions() { } - - protected ReplaceRoleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, - "roleId 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.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - roleId = builder.roleId; - ifMatch = builder.ifMatch; - displayName = builder.displayName; - actions = builder.actions; - description = builder.description; - } - - /** - * New builder. - * - * @return a ReplaceRoleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role ID. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a role and must match the ETag value of the existing role. The Etag can be - * retrieved using the GET /v2/roles/{role_id} API and looking at the ETag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List actions() { - return actions; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String description() { - return description; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java deleted file mode 100644 index 9a69b13326c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java +++ /dev/null @@ -1,273 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replaceRoleTemplate options. - */ -public class ReplaceRoleTemplateOptions extends GenericModel { - - protected String roleTemplateId; - protected String version; - protected String ifMatch; - protected String name; - protected String description; - protected TemplateRole role; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String version; - private String ifMatch; - private String name; - private String description; - private TemplateRole role; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing ReplaceRoleTemplateOptions instance. - * - * @param replaceRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(ReplaceRoleTemplateOptions replaceRoleTemplateOptions) { - this.roleTemplateId = replaceRoleTemplateOptions.roleTemplateId; - this.version = replaceRoleTemplateOptions.version; - this.ifMatch = replaceRoleTemplateOptions.ifMatch; - this.name = replaceRoleTemplateOptions.name; - this.description = replaceRoleTemplateOptions.description; - this.role = replaceRoleTemplateOptions.role; - this.committed = replaceRoleTemplateOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - * @param version the version - * @param ifMatch the ifMatch - */ - public Builder(String roleTemplateId, String version, String ifMatch) { - this.roleTemplateId = roleTemplateId; - this.version = version; - this.ifMatch = ifMatch; - } - - /** - * Builds a ReplaceRoleTemplateOptions. - * - * @return the new ReplaceRoleTemplateOptions instance - */ - public ReplaceRoleTemplateOptions build() { - return new ReplaceRoleTemplateOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the role. - * - * @param role the role - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder role(TemplateRole role) { - this.role = role; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected ReplaceRoleTemplateOptions() { } - - protected ReplaceRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - roleTemplateId = builder.roleTemplateId; - version = builder.version; - ifMatch = builder.ifMatch; - name = builder.name; - description = builder.description; - role = builder.role; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a ReplaceRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the version. - * - * Role template version. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a role template version must match the Etag value of the existing role template - * version. The Etag can be retrieved using the GET /v1/role_templates/{template_id}/versions/{version} API and - * looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will - * change the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the role template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the role for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the role. - * - * The role properties that are created in an action resource when the template is assigned. - * - * @return the role - */ - public TemplateRole role() { - return role; - } - - /** - * Gets the committed. - * - * Committed status of the template version. If committed is set to true, then the template version can no longer be - * updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java deleted file mode 100644 index 960f4782635..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java +++ /dev/null @@ -1,336 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replaceV2Policy options. - */ -public class ReplaceV2PolicyOptions extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - protected String id; - protected String ifMatch; - protected Control control; - protected String type; - protected String description; - protected V2PolicySubject subject; - protected V2PolicyResource resource; - protected String pattern; - protected V2PolicyRule rule; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String ifMatch; - private Control control; - private String type; - private String description; - private V2PolicySubject subject; - private V2PolicyResource resource; - private String pattern; - private V2PolicyRule rule; - - /** - * Instantiates a new Builder from an existing ReplaceV2PolicyOptions instance. - * - * @param replaceV2PolicyOptions the instance to initialize the Builder with - */ - private Builder(ReplaceV2PolicyOptions replaceV2PolicyOptions) { - this.id = replaceV2PolicyOptions.id; - this.ifMatch = replaceV2PolicyOptions.ifMatch; - this.control = replaceV2PolicyOptions.control; - this.type = replaceV2PolicyOptions.type; - this.description = replaceV2PolicyOptions.description; - this.subject = replaceV2PolicyOptions.subject; - this.resource = replaceV2PolicyOptions.resource; - this.pattern = replaceV2PolicyOptions.pattern; - this.rule = replaceV2PolicyOptions.rule; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param id the id - * @param ifMatch the ifMatch - * @param control the control - * @param type the type - */ - public Builder(String id, String ifMatch, Control control, String type) { - this.id = id; - this.ifMatch = ifMatch; - this.control = control; - this.type = type; - } - - /** - * Builds a ReplaceV2PolicyOptions. - * - * @return the new ReplaceV2PolicyOptions instance - */ - public ReplaceV2PolicyOptions build() { - return new ReplaceV2PolicyOptions(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the ReplaceV2PolicyOptions builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplaceV2PolicyOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the control. - * - * @param control the control - * @return the ReplaceV2PolicyOptions builder - */ - public Builder control(Control control) { - this.control = control; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the ReplaceV2PolicyOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplaceV2PolicyOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the subject. - * - * @param subject the subject - * @return the ReplaceV2PolicyOptions builder - */ - public Builder subject(V2PolicySubject subject) { - this.subject = subject; - return this; - } - - /** - * Set the resource. - * - * @param resource the resource - * @return the ReplaceV2PolicyOptions builder - */ - public Builder resource(V2PolicyResource resource) { - this.resource = resource; - return this; - } - - /** - * Set the pattern. - * - * @param pattern the pattern - * @return the ReplaceV2PolicyOptions builder - */ - public Builder pattern(String pattern) { - this.pattern = pattern; - return this; - } - - /** - * Set the rule. - * - * @param rule the rule - * @return the ReplaceV2PolicyOptions builder - */ - public Builder rule(V2PolicyRule rule) { - this.rule = rule; - return this; - } - } - - protected ReplaceV2PolicyOptions() { } - - protected ReplaceV2PolicyOptions(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.control, - "control cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - id = builder.id; - ifMatch = builder.ifMatch; - control = builder.control; - type = builder.type; - description = builder.description; - subject = builder.subject; - resource = builder.resource; - pattern = builder.pattern; - rule = builder.rule; - } - - /** - * New builder. - * - * @return a ReplaceV2PolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be - * retrieved using the GET /v2/policies/{id} API and looking at the ETag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the control. - * - * Specifies the type of access that is granted by the policy. - * - * @return the control - */ - public Control control() { - return control; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject subject() { - return subject; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource resource() { - return resource; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String pattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule rule() { - return rule; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java deleted file mode 100644 index 3a8b7e87b9e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * An attribute associated with a resource. - */ -public class ResourceAttribute extends GenericModel { - - protected String name; - protected String value; - protected String operator; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String value; - private String operator; - - /** - * Instantiates a new Builder from an existing ResourceAttribute instance. - * - * @param resourceAttribute the instance to initialize the Builder with - */ - private Builder(ResourceAttribute resourceAttribute) { - this.name = resourceAttribute.name; - this.value = resourceAttribute.value; - this.operator = resourceAttribute.operator; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param value the value - */ - public Builder(String name, String value) { - this.name = name; - this.value = value; - } - - /** - * Builds a ResourceAttribute. - * - * @return the new ResourceAttribute instance - */ - public ResourceAttribute build() { - return new ResourceAttribute(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the ResourceAttribute builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the ResourceAttribute builder - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the ResourceAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - } - - protected ResourceAttribute() { } - - protected ResourceAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - name = builder.name; - value = builder.value; - operator = builder.operator; - } - - /** - * New builder. - * - * @return a ResourceAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * The name of an attribute. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the value. - * - * The value of an attribute. - * - * @return the value - */ - public String value() { - return value; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java deleted file mode 100644 index 7da4cffee56..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A tag associated with a resource. - */ -public class ResourceTag extends GenericModel { - - protected String name; - protected String value; - protected String operator; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String value; - private String operator; - - /** - * Instantiates a new Builder from an existing ResourceTag instance. - * - * @param resourceTag the instance to initialize the Builder with - */ - private Builder(ResourceTag resourceTag) { - this.name = resourceTag.name; - this.value = resourceTag.value; - this.operator = resourceTag.operator; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param value the value - */ - public Builder(String name, String value) { - this.name = name; - this.value = value; - } - - /** - * Builds a ResourceTag. - * - * @return the new ResourceTag instance - */ - public ResourceTag build() { - return new ResourceTag(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the ResourceTag builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the ResourceTag builder - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the ResourceTag builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - } - - protected ResourceTag() { } - - protected ResourceTag(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - name = builder.name; - value = builder.value; - operator = builder.operator; - } - - /** - * New builder. - * - * @return a ResourceTag builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * The name of an access management tag. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the value. - * - * The value of an access management tag. - * - * @return the value - */ - public String value() { - return value; - } - - /** - * Gets the operator. - * - * The operator of an access management tag. - * - * @return the operator - */ - public String operator() { - return operator; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java deleted file mode 100644 index 24b99c9bd08..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role resource. - */ -public class Role extends GenericModel { - - @SerializedName("display_name") - protected String displayName; - protected String description; - protected List actions; - protected String crn; - - /** - * Builder. - */ - public static class Builder { - private String displayName; - private String description; - private List actions; - - /** - * Instantiates a new Builder from an existing Role instance. - * - * @param role the instance to initialize the Builder with - */ - private Builder(Role role) { - this.displayName = role.displayName; - this.description = role.description; - this.actions = role.actions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param displayName the displayName - * @param actions the actions - */ - public Builder(String displayName, List actions) { - this.displayName = displayName; - this.actions = actions; - } - - /** - * Builds a Role. - * - * @return the new Role instance - */ - public Role build() { - return new Role(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the Role builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the Role builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the Role builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the Role builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - } - - protected Role() { } - - protected Role(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - displayName = builder.displayName; - description = builder.description; - actions = builder.actions; - } - - /** - * New builder. - * - * @return a Role builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List actions() { - return actions; - } - - /** - * Gets the crn. - * - * The role Cloud Resource Name (CRN). Example CRN: - * 'crn:v1:ibmcloud:public:iam-access-management::a/exampleAccountId::customRole:ExampleRoleName'. - * - * @return the crn - */ - public String crn() { - return crn; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java deleted file mode 100644 index 9169fc88572..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * An action that can be performed by the policy subject when assigned a role. - */ -public class RoleAction extends GenericModel { - - protected String id; - @SerializedName("display_name") - protected String displayName; - protected String description; - - protected RoleAction() { } - - /** - * Gets the id. - * - * Unique identifier for action with structure service.resource.action. For example, cbr.rule.read. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the displayName. - * - * Services defined display name for action. - * - * @return the displayName - */ - public String getDisplayName() { - return displayName; - } - - /** - * Gets the description. - * - * Service defined description for action. - * - * @return the description - */ - public String getDescription() { - return description; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java deleted file mode 100644 index 23bb4b65c6f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the assigned role template. - */ -public class RoleAssignment extends GenericModel { - - /** - * The current operation of the role assignment. - */ - public interface Operation { - /** create. */ - String CREATE = "create"; - /** apply. */ - String APPLY = "apply"; - /** update. */ - String UPDATE = "update"; - /** remove. */ - String REMOVE = "remove"; - } - - /** - * The role assignment status. - */ - public interface Status { - /** accepted. */ - String ACCEPTED = "accepted"; - /** failure. */ - String FAILURE = "failure"; - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** superseded. */ - String SUPERSEDED = "superseded"; - } - - protected String id; - @SerializedName("account_id") - protected String accountId; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String operation; - protected List resources; - protected RoleAssignmentTemplate template; - protected AssignmentTargetDetails target; - protected String status; - - protected RoleAssignment() { } - - /** - * Gets the id. - * - * Action control assignment ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the accountId. - * - * The account GUID that the role assignments belong to. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the href. - * - * The href URL that links to the role assignments API by role assignment ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the role assignment was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the role assignment. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the role assignment was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the role assignment. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the operation. - * - * The current operation of the role assignment. - * - * @return the operation - */ - public String getOperation() { - return operation; - } - - /** - * Gets the resources. - * - * Resources created when role template is assigned. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the template. - * - * The role template id and version that will be assigned. - * - * @return the template - */ - public RoleAssignmentTemplate getTemplate() { - return template; - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the status. - * - * The role assignment status. - * - * @return the status - */ - public String getStatus() { - return status; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java deleted file mode 100644 index 658ac5b8c99..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of role assignments. - */ -public class RoleAssignmentCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List assignments; - - protected RoleAssignmentCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the assignments. - * - * List of role assignments. - * - * @return the assignments - */ - public List getAssignments() { - return assignments; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java deleted file mode 100644 index 60d7a02d604..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The role assignment resources and target where the template is assigned. - */ -public class RoleAssignmentResource extends GenericModel { - - protected AssignmentTargetDetails target; - protected RoleAssignmentResourceRole role; - - protected RoleAssignmentResource() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the role. - * - * Set of properties of the assigned resource or error message if assignment failed. - * - * @return the role - */ - public RoleAssignmentResourceRole getRole() { - return role; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java deleted file mode 100644 index 9ea359d63fb..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * On success, it includes the role assigned. - */ -public class RoleAssignmentResourceCreated extends GenericModel { - - protected String id; - - protected RoleAssignmentResourceCreated() { } - - /** - * Gets the id. - * - * role id. - * - * @return the id - */ - public String getId() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java deleted file mode 100644 index 22d40bdaef4..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Set of properties of the assigned resource or error message if assignment failed. - */ -public class RoleAssignmentResourceRole extends GenericModel { - - @SerializedName("resource_created") - protected RoleAssignmentResourceCreated resourceCreated; - @SerializedName("error_message") - protected AssignmentResourceError errorMessage; - - protected RoleAssignmentResourceRole() { } - - /** - * Gets the resourceCreated. - * - * On success, it includes the role assigned. - * - * @return the resourceCreated - */ - public RoleAssignmentResourceCreated getResourceCreated() { - return resourceCreated; - } - - /** - * Gets the errorMessage. - * - * Body parameters for assignment error. - * - * @return the errorMessage - */ - public AssignmentResourceError getErrorMessage() { - return errorMessage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java deleted file mode 100644 index 3524b91f4d5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The role template id and version that will be assigned. - */ -public class RoleAssignmentTemplate extends GenericModel { - - protected String id; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String version; - - /** - * Instantiates a new Builder from an existing RoleAssignmentTemplate instance. - * - * @param roleAssignmentTemplate the instance to initialize the Builder with - */ - private Builder(RoleAssignmentTemplate roleAssignmentTemplate) { - this.id = roleAssignmentTemplate.id; - this.version = roleAssignmentTemplate.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param id the id - * @param version the version - */ - public Builder(String id, String version) { - this.id = id; - this.version = version; - } - - /** - * Builds a RoleAssignmentTemplate. - * - * @return the new RoleAssignmentTemplate instance - */ - public RoleAssignmentTemplate build() { - return new RoleAssignmentTemplate(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the RoleAssignmentTemplate builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the RoleAssignmentTemplate builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected RoleAssignmentTemplate() { } - - protected RoleAssignmentTemplate(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - id = builder.id; - version = builder.version; - } - - /** - * New builder. - * - * @return a RoleAssignmentTemplate builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * Action control template ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java deleted file mode 100644 index 16296a82e40..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * RoleAssignmentsPager can be used to simplify the use of the "listRoleAssignments" method. - */ -public class RoleAssignmentsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListRoleAssignmentsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected RoleAssignmentsPager() { } - - /** - * Constructs a new RoleAssignmentsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listRoleAssignments" method - * @param options the ListRoleAssignmentsOptions instance to be used to invoke the "listRoleAssignments" method - */ - public RoleAssignmentsPager(IamPolicyManagement client, ListRoleAssignmentsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<RoleAssignment> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListRoleAssignmentsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - RoleAssignmentCollection result = client.listRoleAssignments(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getAssignments(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<RoleAssignment> containing all results returned by the "listRoleAssignments" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java deleted file mode 100644 index 282730a2dfc..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of roles returned by the 'list roles' operation. - */ -public class RoleCollection extends GenericModel { - - @SerializedName("custom_roles") - protected List customRoles; - @SerializedName("service_roles") - protected List serviceRoles; - @SerializedName("system_roles") - protected List systemRoles; - - protected RoleCollection() { } - - /** - * Gets the customRoles. - * - * List of custom roles. - * - * @return the customRoles - */ - public List getCustomRoles() { - return customRoles; - } - - /** - * Gets the serviceRoles. - * - * List of service roles. - * - * @return the serviceRoles - */ - public List getServiceRoles() { - return serviceRoles; - } - - /** - * Gets the systemRoles. - * - * List of system roles. - * - * @return the systemRoles - */ - public List getSystemRoles() { - return systemRoles; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java deleted file mode 100644 index 663d0f7f1d0..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the role template. - */ -public class RoleTemplate extends GenericModel { - - /** - * State of role template. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String name; - protected String description; - @SerializedName("account_id") - protected String accountId; - protected Boolean committed; - protected RoleTemplatePrototypeRole role; - protected String id; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String version; - protected String state; - - protected RoleTemplate() { } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the description. - * - * Description of the role template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the role for enterprise users managing IAM templates. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the committed. - * - * Committed status of the template. If committed is set to true, then the template version can no longer be updated. - * - * @return the committed - */ - public Boolean isCommitted() { - return committed; - } - - /** - * Gets the role. - * - * The role properties that are created in an action resource when the template is assigned. - * - * @return the role - */ - public RoleTemplatePrototypeRole getRole() { - return role; - } - - /** - * Gets the id. - * - * The role template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the role templates API by role template ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the role template was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the role template. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the role template was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the role template. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the version. - * - * The version number of the template used to identify different versions of same template. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the state. - * - * State of role template. - * - * @return the state - */ - public String getState() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java deleted file mode 100644 index 22a739b4a58..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of role templates. - */ -public class RoleTemplateCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - @SerializedName("role_templates") - protected List roleTemplates; - - protected RoleTemplateCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the roleTemplates. - * - * List of role templates. - * - * @return the roleTemplates - */ - public List getRoleTemplates() { - return roleTemplates; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java deleted file mode 100644 index 43197620689..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java +++ /dev/null @@ -1,239 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The role properties that are created in an action resource when the template is assigned. - */ -public class RoleTemplatePrototypeRole extends GenericModel { - - protected String name; - @SerializedName("display_name") - protected String displayName; - @SerializedName("service_name") - protected String serviceName; - protected String description; - protected List actions; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String displayName; - private String serviceName; - private String description; - private List actions; - - /** - * Instantiates a new Builder from an existing RoleTemplatePrototypeRole instance. - * - * @param roleTemplatePrototypeRole the instance to initialize the Builder with - */ - private Builder(RoleTemplatePrototypeRole roleTemplatePrototypeRole) { - this.name = roleTemplatePrototypeRole.name; - this.displayName = roleTemplatePrototypeRole.displayName; - this.serviceName = roleTemplatePrototypeRole.serviceName; - this.description = roleTemplatePrototypeRole.description; - this.actions = roleTemplatePrototypeRole.actions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param displayName the displayName - * @param actions the actions - */ - public Builder(String name, String displayName, List actions) { - this.name = name; - this.displayName = displayName; - this.actions = actions; - } - - /** - * Builds a RoleTemplatePrototypeRole. - * - * @return the new RoleTemplatePrototypeRole instance - */ - public RoleTemplatePrototypeRole build() { - return new RoleTemplatePrototypeRole(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the RoleTemplatePrototypeRole builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the RoleTemplatePrototypeRole builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the RoleTemplatePrototypeRole builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the RoleTemplatePrototypeRole builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the RoleTemplatePrototypeRole builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the RoleTemplatePrototypeRole builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - } - - protected RoleTemplatePrototypeRole() { } - - protected RoleTemplatePrototypeRole(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - name = builder.name; - displayName = builder.displayName; - serviceName = builder.serviceName; - description = builder.description; - actions = builder.actions; - } - - /** - * New builder. - * - * @return a RoleTemplatePrototypeRole builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the serviceName. - * - * The service name that the role refers. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the description. - * - * Description of the role. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. - * - * @return the actions - */ - public List actions() { - return actions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java deleted file mode 100644 index 673ff7f9750..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role template reference associated with a policy template. - */ -public class RoleTemplateReferencesItem extends GenericModel { - - protected String id; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String version; - - /** - * Instantiates a new Builder from an existing RoleTemplateReferencesItem instance. - * - * @param roleTemplateReferencesItem the instance to initialize the Builder with - */ - private Builder(RoleTemplateReferencesItem roleTemplateReferencesItem) { - this.id = roleTemplateReferencesItem.id; - this.version = roleTemplateReferencesItem.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param id the id - * @param version the version - */ - public Builder(String id, String version) { - this.id = id; - this.version = version; - } - - /** - * Builds a RoleTemplateReferencesItem. - * - * @return the new RoleTemplateReferencesItem instance - */ - public RoleTemplateReferencesItem build() { - return new RoleTemplateReferencesItem(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the RoleTemplateReferencesItem builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the RoleTemplateReferencesItem builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected RoleTemplateReferencesItem() { } - - protected RoleTemplateReferencesItem(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - id = builder.id; - version = builder.version; - } - - /** - * New builder. - * - * @return a RoleTemplateReferencesItem builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * The role template ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the version. - * - * Role template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java deleted file mode 100644 index a983208afe3..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of versions for a specific role template. - */ -public class RoleTemplateVersionsCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List versions; - - protected RoleTemplateVersionsCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the versions. - * - * List of role templates versions. - * - * @return the versions - */ - public List getVersions() { - return versions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java deleted file mode 100644 index 7af200cd72f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * RoleTemplateVersionsPager can be used to simplify the use of the "listRoleTemplateVersions" method. - */ -public class RoleTemplateVersionsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListRoleTemplateVersionsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected RoleTemplateVersionsPager() { } - - /** - * Constructs a new RoleTemplateVersionsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listRoleTemplateVersions" method - * @param options the ListRoleTemplateVersionsOptions instance to be used to invoke the "listRoleTemplateVersions" method - */ - public RoleTemplateVersionsPager(IamPolicyManagement client, ListRoleTemplateVersionsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<RoleTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListRoleTemplateVersionsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - RoleTemplateVersionsCollection result = client.listRoleTemplateVersions(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getVersions(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<RoleTemplate> containing all results returned by the "listRoleTemplateVersions" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java deleted file mode 100644 index 3654e0757ba..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * RoleTemplatesPager can be used to simplify the use of the "listRoleTemplates" method. - */ -public class RoleTemplatesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListRoleTemplatesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected RoleTemplatesPager() { } - - /** - * Constructs a new RoleTemplatesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listRoleTemplates" method - * @param options the ListRoleTemplatesOptions instance to be used to invoke the "listRoleTemplates" method - */ - public RoleTemplatesPager(IamPolicyManagement client, ListRoleTemplatesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<RoleTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListRoleTemplatesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - RoleTemplateCollection result = client.listRoleTemplates(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getRoleTemplates(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<RoleTemplate> containing all results returned by the "listRoleTemplates" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java deleted file mode 100644 index 03b6ff75eb1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role associated with a policy. - */ -public class Roles extends GenericModel { - - @SerializedName("role_id") - protected String roleId; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - - /** - * Instantiates a new Builder from an existing Roles instance. - * - * @param roles the instance to initialize the Builder with - */ - private Builder(Roles roles) { - this.roleId = roles.roleId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - */ - public Builder(String roleId) { - this.roleId = roleId; - } - - /** - * Builds a Roles. - * - * @return the new Roles instance - */ - public Roles build() { - return new Roles(this); - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the Roles builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - } - - protected Roles() { } - - protected Roles(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleId, - "roleId cannot be null"); - roleId = builder.roleId; - } - - /** - * New builder. - * - * @return a Roles builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java deleted file mode 100644 index fbf66d53ae1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Rule that specifies additional access that is granted (For example, time-based condition). - */ -public class RuleAttribute extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - protected String key; - protected String operator; - protected Object value; - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing RuleAttribute instance. - * - * @param ruleAttribute the instance to initialize the Builder with - */ - private Builder(RuleAttribute ruleAttribute) { - this.key = ruleAttribute.key; - this.operator = ruleAttribute.operator; - this.value = ruleAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a RuleAttribute. - * - * @return the new RuleAttribute instance - */ - public RuleAttribute build() { - return new RuleAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the RuleAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the RuleAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the RuleAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected RuleAttribute() { } - - protected RuleAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a RuleAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the key. - * - * The name of an attribute. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java deleted file mode 100644 index d7e54e112c5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * An attribute associated with a subject. - */ -public class SubjectAttribute extends GenericModel { - - protected String name; - protected String value; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String value; - - /** - * Instantiates a new Builder from an existing SubjectAttribute instance. - * - * @param subjectAttribute the instance to initialize the Builder with - */ - private Builder(SubjectAttribute subjectAttribute) { - this.name = subjectAttribute.name; - this.value = subjectAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param value the value - */ - public Builder(String name, String value) { - this.name = name; - this.value = value; - } - - /** - * Builds a SubjectAttribute. - * - * @return the new SubjectAttribute instance - */ - public SubjectAttribute build() { - return new SubjectAttribute(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the SubjectAttribute builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the SubjectAttribute builder - */ - public Builder value(String value) { - this.value = value; - return this; - } - } - - protected SubjectAttribute() { } - - protected SubjectAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - name = builder.name; - value = builder.value; - } - - /** - * New builder. - * - * @return a SubjectAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * The name of an attribute. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the value. - * - * The value of an attribute. - * - * @return the value - */ - public String value() { - return value; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java deleted file mode 100644 index 62f4bd77f87..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The action control properties that are created in an action resource when the template is assigned. - */ -public class TemplateActionControl extends GenericModel { - - @SerializedName("service_name") - protected String serviceName; - protected String description; - protected List actions; - - /** - * Builder. - */ - public static class Builder { - private String serviceName; - private String description; - private List actions; - - /** - * Instantiates a new Builder from an existing TemplateActionControl instance. - * - * @param templateActionControl the instance to initialize the Builder with - */ - private Builder(TemplateActionControl templateActionControl) { - this.serviceName = templateActionControl.serviceName; - this.description = templateActionControl.description; - this.actions = templateActionControl.actions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param serviceName the serviceName - * @param actions the actions - */ - public Builder(String serviceName, List actions) { - this.serviceName = serviceName; - this.actions = actions; - } - - /** - * Builds a TemplateActionControl. - * - * @return the new TemplateActionControl instance - */ - public TemplateActionControl build() { - return new TemplateActionControl(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the TemplateActionControl builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the TemplateActionControl builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the TemplateActionControl builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the TemplateActionControl builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - } - - protected TemplateActionControl() { } - - protected TemplateActionControl(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, - "serviceName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - serviceName = builder.serviceName; - description = builder.description; - actions = builder.actions; - } - - /** - * New builder. - * - * @return a TemplateActionControl builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the serviceName. - * - * The service name that the action control refers. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the description. - * - * Description of the action control. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actions. - * - * List of actions to control access. - * - * @return the actions - */ - public List actions() { - return actions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java deleted file mode 100644 index c74a77d9b6d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Specifies the type of access that is granted by the policy. - */ -public class TemplateControl extends GenericModel { - - protected TemplateGrant grant; - - /** - * Builder. - */ - public static class Builder { - private TemplateGrant grant; - - /** - * Instantiates a new Builder from an existing TemplateControl instance. - * - * @param templateControl the instance to initialize the Builder with - */ - private Builder(TemplateControl templateControl) { - this.grant = templateControl.grant; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param grant the grant - */ - public Builder(TemplateGrant grant) { - this.grant = grant; - } - - /** - * Builds a TemplateControl. - * - * @return the new TemplateControl instance - */ - public TemplateControl build() { - return new TemplateControl(this); - } - - /** - * Set the grant. - * - * @param grant the grant - * @return the TemplateControl builder - */ - public Builder grant(TemplateGrant grant) { - this.grant = grant; - return this; - } - } - - protected TemplateControl() { } - - protected TemplateControl(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.grant, - "grant cannot be null"); - grant = builder.grant; - } - - /** - * New builder. - * - * @return a TemplateControl builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the grant. - * - * Permission is granted by the policy. - * - * @return the grant - */ - public TemplateGrant grant() { - return grant; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java deleted file mode 100644 index edb134e1270..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * policy template count details. - */ -public class TemplateCountData extends GenericModel { - - protected LimitData template; - protected LimitData version; - - protected TemplateCountData() { } - - /** - * Gets the template. - * - * policy template current and limit details with in an account. - * - * @return the template - */ - public LimitData getTemplate() { - return template; - } - - /** - * Gets the version. - * - * policy template current and limit details with in an account. - * - * @return the version - */ - public LimitData getVersion() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java deleted file mode 100644 index fd0daff9665..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Permission is granted by the policy. - * - * Classes which extend this class: - * - TemplateGrantRoles - * - TemplateGrantRoleReferences - */ -public class TemplateGrant extends GenericModel { - - protected List roles; - @SerializedName("role_template_references") - protected List roleTemplateReferences; - - protected TemplateGrant() { } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List roles() { - return roles; - } - - /** - * Gets the roleTemplateReferences. - * - * A set of role template reference IDs granted by the policy. - * - * @return the roleTemplateReferences - */ - public List roleTemplateReferences() { - return roleTemplateReferences; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java deleted file mode 100644 index 248eb121b72..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * TemplateGrantRoleReferences. - */ -public class TemplateGrantRoleReferences extends TemplateGrant { - - - /** - * Builder. - */ - public static class Builder { - private List roleTemplateReferences; - - /** - * Instantiates a new Builder from an existing TemplateGrantRoleReferences instance. - * - * @param templateGrantRoleReferences the instance to initialize the Builder with - */ - public Builder(TemplateGrant templateGrantRoleReferences) { - this.roleTemplateReferences = templateGrantRoleReferences.roleTemplateReferences; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateReferences the roleTemplateReferences - */ - public Builder(List roleTemplateReferences) { - this.roleTemplateReferences = roleTemplateReferences; - } - - /** - * Builds a TemplateGrantRoleReferences. - * - * @return the new TemplateGrantRoleReferences instance - */ - public TemplateGrantRoleReferences build() { - return new TemplateGrantRoleReferences(this); - } - - /** - * Adds a new element to roleTemplateReferences. - * - * @param roleTemplateReferences the new element to be added - * @return the TemplateGrantRoleReferences builder - */ - public Builder addRoleTemplateReferences(RoleTemplateReferencesItem roleTemplateReferences) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roleTemplateReferences, - "roleTemplateReferences cannot be null"); - if (this.roleTemplateReferences == null) { - this.roleTemplateReferences = new ArrayList(); - } - this.roleTemplateReferences.add(roleTemplateReferences); - return this; - } - - /** - * Set the roleTemplateReferences. - * Existing roleTemplateReferences will be replaced. - * - * @param roleTemplateReferences the roleTemplateReferences - * @return the TemplateGrantRoleReferences builder - */ - public Builder roleTemplateReferences(List roleTemplateReferences) { - this.roleTemplateReferences = roleTemplateReferences; - return this; - } - } - - protected TemplateGrantRoleReferences() { } - - protected TemplateGrantRoleReferences(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleTemplateReferences, - "roleTemplateReferences cannot be null"); - roleTemplateReferences = builder.roleTemplateReferences; - } - - /** - * New builder. - * - * @return a TemplateGrantRoleReferences builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java deleted file mode 100644 index 6524b3645eb..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * TemplateGrantRoles. - */ -public class TemplateGrantRoles extends TemplateGrant { - - - /** - * Builder. - */ - public static class Builder { - private List roles; - - /** - * Instantiates a new Builder from an existing TemplateGrantRoles instance. - * - * @param templateGrantRoles the instance to initialize the Builder with - */ - public Builder(TemplateGrant templateGrantRoles) { - this.roles = templateGrantRoles.roles; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roles the roles - */ - public Builder(List roles) { - this.roles = roles; - } - - /** - * Builds a TemplateGrantRoles. - * - * @return the new TemplateGrantRoles instance - */ - public TemplateGrantRoles build() { - return new TemplateGrantRoles(this); - } - - /** - * Adds a new element to roles. - * - * @param roles the new element to be added - * @return the TemplateGrantRoles builder - */ - public Builder addRoles(Roles roles) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roles, - "roles cannot be null"); - if (this.roles == null) { - this.roles = new ArrayList(); - } - this.roles.add(roles); - return this; - } - - /** - * Set the roles. - * Existing roles will be replaced. - * - * @param roles the roles - * @return the TemplateGrantRoles builder - */ - public Builder roles(List roles) { - this.roles = roles; - return this; - } - } - - protected TemplateGrantRoles() { } - - protected TemplateGrantRoles(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, - "roles cannot be null"); - roles = builder.roles; - } - - /** - * New builder. - * - * @return a TemplateGrantRoles builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java deleted file mode 100644 index 41f112312cd..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The details of the IAM template that was used to create an enterprise-managed policy in your account. When returned, - * this indicates that the policy is created from and managed by a template in the root enterprise account. - */ -public class TemplateMetadata extends GenericModel { - - protected String id; - protected String version; - @SerializedName("assignment_id") - protected String assignmentId; - @SerializedName("root_id") - protected String rootId; - @SerializedName("root_version") - protected String rootVersion; - - protected TemplateMetadata() { } - - /** - * Gets the id. - * - * The policy template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the version. - * - * Template version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the assignmentId. - * - * Policy assignment ID. - * - * @return the assignmentId - */ - public String getAssignmentId() { - return assignmentId; - } - - /** - * Gets the rootId. - * - * Orchestrator template ID. - * - * @return the rootId - */ - public String getRootId() { - return rootId; - } - - /** - * Gets the rootVersion. - * - * Orchestrator template version. - * - * @return the rootVersion - */ - public String getRootVersion() { - return rootVersion; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java deleted file mode 100644 index 496b2e70e40..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java +++ /dev/null @@ -1,272 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the template's policy object. - */ -public class TemplatePolicy extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - protected String type; - protected String description; - protected V2PolicyResource resource; - protected V2PolicySubject subject; - protected String pattern; - protected V2PolicyRule rule; - protected TemplateControl control; - - /** - * Builder. - */ - public static class Builder { - private String type; - private String description; - private V2PolicyResource resource; - private V2PolicySubject subject; - private String pattern; - private V2PolicyRule rule; - private TemplateControl control; - - /** - * Instantiates a new Builder from an existing TemplatePolicy instance. - * - * @param templatePolicy the instance to initialize the Builder with - */ - private Builder(TemplatePolicy templatePolicy) { - this.type = templatePolicy.type; - this.description = templatePolicy.description; - this.resource = templatePolicy.resource; - this.subject = templatePolicy.subject; - this.pattern = templatePolicy.pattern; - this.rule = templatePolicy.rule; - this.control = templatePolicy.control; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param type the type - */ - public Builder(String type) { - this.type = type; - } - - /** - * Builds a TemplatePolicy. - * - * @return the new TemplatePolicy instance - */ - public TemplatePolicy build() { - return new TemplatePolicy(this); - } - - /** - * Set the type. - * - * @param type the type - * @return the TemplatePolicy builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the TemplatePolicy builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the resource. - * - * @param resource the resource - * @return the TemplatePolicy builder - */ - public Builder resource(V2PolicyResource resource) { - this.resource = resource; - return this; - } - - /** - * Set the subject. - * - * @param subject the subject - * @return the TemplatePolicy builder - */ - public Builder subject(V2PolicySubject subject) { - this.subject = subject; - return this; - } - - /** - * Set the pattern. - * - * @param pattern the pattern - * @return the TemplatePolicy builder - */ - public Builder pattern(String pattern) { - this.pattern = pattern; - return this; - } - - /** - * Set the rule. - * - * @param rule the rule - * @return the TemplatePolicy builder - */ - public Builder rule(V2PolicyRule rule) { - this.rule = rule; - return this; - } - - /** - * Set the control. - * - * @param control the control - * @return the TemplatePolicy builder - */ - public Builder control(TemplateControl control) { - this.control = control; - return this; - } - } - - protected TemplatePolicy() { } - - protected TemplatePolicy(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - type = builder.type; - description = builder.description; - resource = builder.resource; - subject = builder.subject; - pattern = builder.pattern; - rule = builder.rule; - control = builder.control; - } - - /** - * New builder. - * - * @return a TemplatePolicy builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. This is shown in child accounts when an access group or trusted profile template uses - * the policy template to assign access. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource resource() { - return resource; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject subject() { - return subject; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String pattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule rule() { - return rule; - } - - /** - * Gets the control. - * - * Specifies the type of access that is granted by the policy. - * - * @return the control - */ - public TemplateControl control() { - return control; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java deleted file mode 100644 index b76beb3bddb..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The role properties that are created in an action resource when the template is assigned. - */ -public class TemplateRole extends GenericModel { - - @SerializedName("display_name") - protected String displayName; - @SerializedName("service_name") - protected String serviceName; - protected String description; - protected List actions; - - /** - * Builder. - */ - public static class Builder { - private String displayName; - private String serviceName; - private String description; - private List actions; - - /** - * Instantiates a new Builder from an existing TemplateRole instance. - * - * @param templateRole the instance to initialize the Builder with - */ - private Builder(TemplateRole templateRole) { - this.displayName = templateRole.displayName; - this.serviceName = templateRole.serviceName; - this.description = templateRole.description; - this.actions = templateRole.actions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param displayName the displayName - * @param actions the actions - */ - public Builder(String displayName, List actions) { - this.displayName = displayName; - this.actions = actions; - } - - /** - * Builds a TemplateRole. - * - * @return the new TemplateRole instance - */ - public TemplateRole build() { - return new TemplateRole(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the TemplateRole builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the TemplateRole builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the TemplateRole builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the TemplateRole builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the TemplateRole builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - } - - protected TemplateRole() { } - - protected TemplateRole(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - displayName = builder.displayName; - serviceName = builder.serviceName; - description = builder.description; - actions = builder.actions; - } - - /** - * New builder. - * - * @return a TemplateRole builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the serviceName. - * - * The service name that the role refers. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the description. - * - * Description of the role. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. - * - * @return the actions - */ - public List actions() { - return actions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java deleted file mode 100644 index caf2f737b55..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updateActionControlAssignment options. - */ -public class UpdateActionControlAssignmentOptions extends GenericModel { - - protected String assignmentId; - protected String ifMatch; - protected String templateVersion; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - private String ifMatch; - private String templateVersion; - - /** - * Instantiates a new Builder from an existing UpdateActionControlAssignmentOptions instance. - * - * @param updateActionControlAssignmentOptions the instance to initialize the Builder with - */ - private Builder(UpdateActionControlAssignmentOptions updateActionControlAssignmentOptions) { - this.assignmentId = updateActionControlAssignmentOptions.assignmentId; - this.ifMatch = updateActionControlAssignmentOptions.ifMatch; - this.templateVersion = updateActionControlAssignmentOptions.templateVersion; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - * @param ifMatch the ifMatch - * @param templateVersion the templateVersion - */ - public Builder(String assignmentId, String ifMatch, String templateVersion) { - this.assignmentId = assignmentId; - this.ifMatch = ifMatch; - this.templateVersion = templateVersion; - } - - /** - * Builds a UpdateActionControlAssignmentOptions. - * - * @return the new UpdateActionControlAssignmentOptions instance - */ - public UpdateActionControlAssignmentOptions build() { - return new UpdateActionControlAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the UpdateActionControlAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdateActionControlAssignmentOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the UpdateActionControlAssignmentOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - } - - protected UpdateActionControlAssignmentOptions() { } - - protected UpdateActionControlAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId 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.templateVersion, - "templateVersion cannot be null"); - assignmentId = builder.assignmentId; - ifMatch = builder.ifMatch; - templateVersion = builder.templateVersion; - } - - /** - * New builder. - * - * @return a UpdateActionControlAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Action control template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating an action control assignment and must match the Etag value of the existing action - * control assignment. The Etag can be retrieved using the GET /v1/action_control_assignments/{assignment_id} API and - * looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the templateVersion. - * - * The version number of the template used to identify different versions of same template. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java deleted file mode 100644 index 869eb357802..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updatePolicyAssignment options. - */ -public class UpdatePolicyAssignmentOptions extends GenericModel { - - protected String assignmentId; - protected String version; - protected String ifMatch; - protected String templateVersion; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - private String version; - private String ifMatch; - private String templateVersion; - - /** - * Instantiates a new Builder from an existing UpdatePolicyAssignmentOptions instance. - * - * @param updatePolicyAssignmentOptions the instance to initialize the Builder with - */ - private Builder(UpdatePolicyAssignmentOptions updatePolicyAssignmentOptions) { - this.assignmentId = updatePolicyAssignmentOptions.assignmentId; - this.version = updatePolicyAssignmentOptions.version; - this.ifMatch = updatePolicyAssignmentOptions.ifMatch; - this.templateVersion = updatePolicyAssignmentOptions.templateVersion; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - * @param version the version - * @param ifMatch the ifMatch - * @param templateVersion the templateVersion - */ - public Builder(String assignmentId, String version, String ifMatch, String templateVersion) { - this.assignmentId = assignmentId; - this.version = version; - this.ifMatch = ifMatch; - this.templateVersion = templateVersion; - } - - /** - * Builds a UpdatePolicyAssignmentOptions. - * - * @return the new UpdatePolicyAssignmentOptions instance - */ - public UpdatePolicyAssignmentOptions build() { - return new UpdatePolicyAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the UpdatePolicyAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the UpdatePolicyAssignmentOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdatePolicyAssignmentOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the UpdatePolicyAssignmentOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - } - - protected UpdatePolicyAssignmentOptions() { } - - protected UpdatePolicyAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templateVersion, - "templateVersion cannot be null"); - assignmentId = builder.assignmentId; - version = builder.version; - ifMatch = builder.ifMatch; - templateVersion = builder.templateVersion; - } - - /** - * New builder. - * - * @return a UpdatePolicyAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * The policy template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } - - /** - * Gets the version. - * - * specify version of response body format. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy assignment and must match the Etag value of the existing policy - * assignment. The Etag can be retrieved using the GET /v1/policy_assignments/{assignment_id} API and looking at the - * Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the templateVersion. - * - * The policy template version to update to. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java deleted file mode 100644 index a28b357641f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updatePolicyState options. - */ -public class UpdatePolicyStateOptions extends GenericModel { - - /** - * The policy state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String policyId; - protected String ifMatch; - protected String state; - - /** - * Builder. - */ - public static class Builder { - private String policyId; - private String ifMatch; - private String state; - - /** - * Instantiates a new Builder from an existing UpdatePolicyStateOptions instance. - * - * @param updatePolicyStateOptions the instance to initialize the Builder with - */ - private Builder(UpdatePolicyStateOptions updatePolicyStateOptions) { - this.policyId = updatePolicyStateOptions.policyId; - this.ifMatch = updatePolicyStateOptions.ifMatch; - this.state = updatePolicyStateOptions.state; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyId the policyId - * @param ifMatch the ifMatch - */ - public Builder(String policyId, String ifMatch) { - this.policyId = policyId; - this.ifMatch = ifMatch; - } - - /** - * Builds a UpdatePolicyStateOptions. - * - * @return the new UpdatePolicyStateOptions instance - */ - public UpdatePolicyStateOptions build() { - return new UpdatePolicyStateOptions(this); - } - - /** - * Set the policyId. - * - * @param policyId the policyId - * @return the UpdatePolicyStateOptions builder - */ - public Builder policyId(String policyId) { - this.policyId = policyId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdatePolicyStateOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the UpdatePolicyStateOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - } - - protected UpdatePolicyStateOptions() { } - - protected UpdatePolicyStateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, - "policyId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - policyId = builder.policyId; - ifMatch = builder.ifMatch; - state = builder.state; - } - - /** - * New builder. - * - * @return a UpdatePolicyStateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyId. - * - * The policy ID. - * - * @return the policyId - */ - public String policyId() { - return policyId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be - * retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the state. - * - * The policy state. - * - * @return the state - */ - public String state() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java deleted file mode 100644 index f10cba5fe93..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updateRoleAssignment options. - */ -public class UpdateRoleAssignmentOptions extends GenericModel { - - protected String assignmentId; - protected String ifMatch; - protected String templateVersion; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - private String ifMatch; - private String templateVersion; - - /** - * Instantiates a new Builder from an existing UpdateRoleAssignmentOptions instance. - * - * @param updateRoleAssignmentOptions the instance to initialize the Builder with - */ - private Builder(UpdateRoleAssignmentOptions updateRoleAssignmentOptions) { - this.assignmentId = updateRoleAssignmentOptions.assignmentId; - this.ifMatch = updateRoleAssignmentOptions.ifMatch; - this.templateVersion = updateRoleAssignmentOptions.templateVersion; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - * @param ifMatch the ifMatch - * @param templateVersion the templateVersion - */ - public Builder(String assignmentId, String ifMatch, String templateVersion) { - this.assignmentId = assignmentId; - this.ifMatch = ifMatch; - this.templateVersion = templateVersion; - } - - /** - * Builds a UpdateRoleAssignmentOptions. - * - * @return the new UpdateRoleAssignmentOptions instance - */ - public UpdateRoleAssignmentOptions build() { - return new UpdateRoleAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the UpdateRoleAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdateRoleAssignmentOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the UpdateRoleAssignmentOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - } - - protected UpdateRoleAssignmentOptions() { } - - protected UpdateRoleAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId 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.templateVersion, - "templateVersion cannot be null"); - assignmentId = builder.assignmentId; - ifMatch = builder.ifMatch; - templateVersion = builder.templateVersion; - } - - /** - * New builder. - * - * @return a UpdateRoleAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Role template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a role assignment and must match the Etag value of the existing role assignment. - * The Etag can be retrieved using the GET /v1/role_assignments/{assignment_id} API and looking at the Etag response - * header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the templateVersion. - * - * The version number of the template used to identify different versions of same template. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java deleted file mode 100644 index 3d9dbb43fb3..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updateSettings options. - */ -public class UpdateSettingsOptions extends GenericModel { - - protected String accountId; - protected String ifMatch; - protected ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String ifMatch; - private ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing UpdateSettingsOptions instance. - * - * @param updateSettingsOptions the instance to initialize the Builder with - */ - private Builder(UpdateSettingsOptions updateSettingsOptions) { - this.accountId = updateSettingsOptions.accountId; - this.ifMatch = updateSettingsOptions.ifMatch; - this.externalAccountIdentityInteraction = updateSettingsOptions.externalAccountIdentityInteraction; - this.acceptLanguage = updateSettingsOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - * @param ifMatch the ifMatch - */ - public Builder(String accountId, String ifMatch) { - this.accountId = accountId; - this.ifMatch = ifMatch; - } - - /** - * Builds a UpdateSettingsOptions. - * - * @return the new UpdateSettingsOptions instance - */ - public UpdateSettingsOptions build() { - return new UpdateSettingsOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the UpdateSettingsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdateSettingsOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the externalAccountIdentityInteraction. - * - * @param externalAccountIdentityInteraction the externalAccountIdentityInteraction - * @return the UpdateSettingsOptions builder - */ - public Builder externalAccountIdentityInteraction(ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction) { - this.externalAccountIdentityInteraction = externalAccountIdentityInteraction; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the UpdateSettingsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected UpdateSettingsOptions() { } - - protected UpdateSettingsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.accountId, - "accountId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - accountId = builder.accountId; - ifMatch = builder.ifMatch; - externalAccountIdentityInteraction = builder.externalAccountIdentityInteraction; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a UpdateSettingsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the settings belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating Access Management Account Settings and must match the Etag value of the existing - * Access Management Account Settings. The Etag can be retrieved using the GET - * /v1/accounts/{account_id}/settings/access_management API and looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the externalAccountIdentityInteraction. - * - * Update to how external accounts can interact in relation to the requested account. - * - * @return the externalAccountIdentityInteraction - */ - public ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction() { - return externalAccountIdentityInteraction; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java deleted file mode 100644 index fdae9e28c12..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * V2PoliciesPager can be used to simplify the use of the "listV2Policies" method. - */ -public class V2PoliciesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListV2PoliciesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected V2PoliciesPager() { } - - /** - * Constructs a new V2PoliciesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listV2Policies" method - * @param options the ListV2PoliciesOptions instance to be used to invoke the "listV2Policies" method - */ - public V2PoliciesPager(IamPolicyManagement client, ListV2PoliciesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<V2PolicyTemplateMetaData> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListV2PoliciesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - V2PolicyCollection result = client.listV2Policies(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getPolicies(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<V2PolicyTemplateMetaData> containing all results returned by the "listV2Policies" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java deleted file mode 100644 index 842a354b7b1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java +++ /dev/null @@ -1,247 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the policy. - */ -public class V2Policy extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - /** - * The policy state, either 'deleted' or 'active'. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String type; - protected String description; - protected V2PolicySubject subject; - protected V2PolicyResource resource; - protected String pattern; - protected V2PolicyRule rule; - protected String id; - protected String href; - protected ControlResponse control; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String state; - @SerializedName("last_permit_at") - protected String lastPermitAt; - @SerializedName("last_permit_frequency") - protected Long lastPermitFrequency; - - protected V2Policy() { } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject getSubject() { - return subject; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource getResource() { - return resource; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String getPattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule getRule() { - return rule; - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the policies API by policy ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the control. - * - * @return the control - */ - public ControlResponse getControl() { - return control; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the state. - * - * The policy state, either 'deleted' or 'active'. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the lastPermitAt. - * - * The optional last permit time of policy, when passing query parameter format=include_last_permit. - * - * @return the lastPermitAt - */ - public String getLastPermitAt() { - return lastPermitAt; - } - - /** - * Gets the lastPermitFrequency. - * - * The optional count of times that policy has provided a permit, when passing query parameter - * format=include_last_permit. - * - * @return the lastPermitFrequency - */ - public Long getLastPermitFrequency() { - return lastPermitFrequency; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java deleted file mode 100644 index d392025f8d8..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of policies. - */ -public class V2PolicyCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List policies; - - protected V2PolicyCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the policies. - * - * List of policies. - * - * @return the policies - */ - public List getPolicies() { - return policies; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java deleted file mode 100644 index caf8dd522a9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The resource attributes to which the policy grants access. - */ -public class V2PolicyResource extends GenericModel { - - protected List attributes; - protected List tags; - - /** - * Builder. - */ - public static class Builder { - private List attributes; - private List tags; - - /** - * Instantiates a new Builder from an existing V2PolicyResource instance. - * - * @param v2PolicyResource the instance to initialize the Builder with - */ - private Builder(V2PolicyResource v2PolicyResource) { - this.attributes = v2PolicyResource.attributes; - this.tags = v2PolicyResource.tags; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param attributes the attributes - */ - public Builder(List attributes) { - this.attributes = attributes; - } - - /** - * Builds a V2PolicyResource. - * - * @return the new V2PolicyResource instance - */ - public V2PolicyResource build() { - return new V2PolicyResource(this); - } - - /** - * Adds a new element to attributes. - * - * @param attributes the new element to be added - * @return the V2PolicyResource builder - */ - public Builder addAttributes(V2PolicyResourceAttribute attributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, - "attributes cannot be null"); - if (this.attributes == null) { - this.attributes = new ArrayList(); - } - this.attributes.add(attributes); - return this; - } - - /** - * Adds a new element to tags. - * - * @param tags the new element to be added - * @return the V2PolicyResource builder - */ - public Builder addTags(V2PolicyResourceTag tags) { - com.ibm.cloud.sdk.core.util.Validator.notNull(tags, - "tags cannot be null"); - if (this.tags == null) { - this.tags = new ArrayList(); - } - this.tags.add(tags); - return this; - } - - /** - * Set the attributes. - * Existing attributes will be replaced. - * - * @param attributes the attributes - * @return the V2PolicyResource builder - */ - public Builder attributes(List attributes) { - this.attributes = attributes; - return this; - } - - /** - * Set the tags. - * Existing tags will be replaced. - * - * @param tags the tags - * @return the V2PolicyResource builder - */ - public Builder tags(List tags) { - this.tags = tags; - return this; - } - } - - protected V2PolicyResource() { } - - protected V2PolicyResource(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, - "attributes cannot be null"); - attributes = builder.attributes; - tags = builder.tags; - } - - /** - * New builder. - * - * @return a V2PolicyResource builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the attributes. - * - * List of resource attributes to which the policy grants access. - * - * @return the attributes - */ - public List attributes() { - return attributes; - } - - /** - * Gets the tags. - * - * Optional list of resource tags to which the policy grants access. - * - * @return the tags - */ - public List tags() { - return tags; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java deleted file mode 100644 index 73e7cedd55e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Resource attribute to which the policy grants access. - */ -public class V2PolicyResourceAttribute extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - } - - protected String key; - protected String operator; - protected Object value; - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing V2PolicyResourceAttribute instance. - * - * @param v2PolicyResourceAttribute the instance to initialize the Builder with - */ - private Builder(V2PolicyResourceAttribute v2PolicyResourceAttribute) { - this.key = v2PolicyResourceAttribute.key; - this.operator = v2PolicyResourceAttribute.operator; - this.value = v2PolicyResourceAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a V2PolicyResourceAttribute. - * - * @return the new V2PolicyResourceAttribute instance - */ - public V2PolicyResourceAttribute build() { - return new V2PolicyResourceAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the V2PolicyResourceAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicyResourceAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the V2PolicyResourceAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected V2PolicyResourceAttribute() { } - - protected V2PolicyResourceAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a V2PolicyResourceAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the key. - * - * The name of a resource attribute. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java deleted file mode 100644 index bb32772b8dc..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A tag associated with a resource. - */ -public class V2PolicyResourceTag extends GenericModel { - - /** - * The operator of an access management tag. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - } - - protected String key; - protected String value; - protected String operator; - - /** - * Builder. - */ - public static class Builder { - private String key; - private String value; - private String operator; - - /** - * Instantiates a new Builder from an existing V2PolicyResourceTag instance. - * - * @param v2PolicyResourceTag the instance to initialize the Builder with - */ - private Builder(V2PolicyResourceTag v2PolicyResourceTag) { - this.key = v2PolicyResourceTag.key; - this.value = v2PolicyResourceTag.value; - this.operator = v2PolicyResourceTag.operator; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param value the value - * @param operator the operator - */ - public Builder(String key, String value, String operator) { - this.key = key; - this.value = value; - this.operator = operator; - } - - /** - * Builds a V2PolicyResourceTag. - * - * @return the new V2PolicyResourceTag instance - */ - public V2PolicyResourceTag build() { - return new V2PolicyResourceTag(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the V2PolicyResourceTag builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the V2PolicyResourceTag builder - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicyResourceTag builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - } - - protected V2PolicyResourceTag() { } - - protected V2PolicyResourceTag(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - key = builder.key; - value = builder.value; - operator = builder.operator; - } - - /** - * New builder. - * - * @return a V2PolicyResourceTag builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the key. - * - * The name of an access management tag. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the value. - * - * The value of an access management tag. - * - * @return the value - */ - public String value() { - return value; - } - - /** - * Gets the operator. - * - * The operator of an access management tag. - * - * @return the operator - */ - public String operator() { - return operator; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java deleted file mode 100644 index 13a9f5fbd94..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Additional access conditions associated with the policy. - * - * Classes which extend this class: - * - V2PolicyRuleRuleAttribute - * - V2PolicyRuleRuleWithNestedConditions - */ -public class V2PolicyRule extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - protected String key; - protected String operator; - protected Object value; - protected List conditions; - - protected V2PolicyRule() { } - - /** - * Gets the key. - * - * The name of an attribute. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } - - /** - * Gets the conditions. - * - * List of conditions associated with a policy. For example, time-based conditions that grant access over a certain - * time period. - * - * @return the conditions - */ - public List conditions() { - return conditions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java deleted file mode 100644 index c20b3a8cb0c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * Rule that specifies additional access that is granted (For example, time-based condition). - */ -public class V2PolicyRuleRuleAttribute extends V2PolicyRule { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing V2PolicyRuleRuleAttribute instance. - * - * @param v2PolicyRuleRuleAttribute the instance to initialize the Builder with - */ - public Builder(V2PolicyRule v2PolicyRuleRuleAttribute) { - this.key = v2PolicyRuleRuleAttribute.key; - this.operator = v2PolicyRuleRuleAttribute.operator; - this.value = v2PolicyRuleRuleAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a V2PolicyRuleRuleAttribute. - * - * @return the new V2PolicyRuleRuleAttribute instance - */ - public V2PolicyRuleRuleAttribute build() { - return new V2PolicyRuleRuleAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the V2PolicyRuleRuleAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicyRuleRuleAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the V2PolicyRuleRuleAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected V2PolicyRuleRuleAttribute() { } - - protected V2PolicyRuleRuleAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a V2PolicyRuleRuleAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java deleted file mode 100644 index 8d6e57920f9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * Rule that specifies additional access that is granted (for example, time-based condition) accross multiple - * conditions. - */ -public class V2PolicyRuleRuleWithNestedConditions extends V2PolicyRule { - - /** - * Operator to evaluate conditions. - */ - public interface Operator { - /** and. */ - String AND = "and"; - /** or. */ - String OR = "or"; - } - - - /** - * Builder. - */ - public static class Builder { - private String operator; - private List conditions; - - /** - * Instantiates a new Builder from an existing V2PolicyRuleRuleWithNestedConditions instance. - * - * @param v2PolicyRuleRuleWithNestedConditions the instance to initialize the Builder with - */ - public Builder(V2PolicyRule v2PolicyRuleRuleWithNestedConditions) { - this.operator = v2PolicyRuleRuleWithNestedConditions.operator; - this.conditions = v2PolicyRuleRuleWithNestedConditions.conditions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param operator the operator - * @param conditions the conditions - */ - public Builder(String operator, List conditions) { - this.operator = operator; - this.conditions = conditions; - } - - /** - * Builds a V2PolicyRuleRuleWithNestedConditions. - * - * @return the new V2PolicyRuleRuleWithNestedConditions instance - */ - public V2PolicyRuleRuleWithNestedConditions build() { - return new V2PolicyRuleRuleWithNestedConditions(this); - } - - /** - * Adds a new element to conditions. - * - * @param conditions the new element to be added - * @return the V2PolicyRuleRuleWithNestedConditions builder - */ - public Builder addConditions(NestedCondition conditions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(conditions, - "conditions cannot be null"); - if (this.conditions == null) { - this.conditions = new ArrayList(); - } - this.conditions.add(conditions); - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicyRuleRuleWithNestedConditions builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the conditions. - * Existing conditions will be replaced. - * - * @param conditions the conditions - * @return the V2PolicyRuleRuleWithNestedConditions builder - */ - public Builder conditions(List conditions) { - this.conditions = conditions; - return this; - } - } - - protected V2PolicyRuleRuleWithNestedConditions() { } - - protected V2PolicyRuleRuleWithNestedConditions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.conditions, - "conditions cannot be null"); - operator = builder.operator; - conditions = builder.conditions; - } - - /** - * New builder. - * - * @return a V2PolicyRuleRuleWithNestedConditions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java deleted file mode 100644 index 891513fd45a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The subject attributes for whom the policy grants access. - */ -public class V2PolicySubject extends GenericModel { - - protected List attributes; - - /** - * Builder. - */ - public static class Builder { - private List attributes; - - /** - * Instantiates a new Builder from an existing V2PolicySubject instance. - * - * @param v2PolicySubject the instance to initialize the Builder with - */ - private Builder(V2PolicySubject v2PolicySubject) { - this.attributes = v2PolicySubject.attributes; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param attributes the attributes - */ - public Builder(List attributes) { - this.attributes = attributes; - } - - /** - * Builds a V2PolicySubject. - * - * @return the new V2PolicySubject instance - */ - public V2PolicySubject build() { - return new V2PolicySubject(this); - } - - /** - * Adds a new element to attributes. - * - * @param attributes the new element to be added - * @return the V2PolicySubject builder - */ - public Builder addAttributes(V2PolicySubjectAttribute attributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, - "attributes cannot be null"); - if (this.attributes == null) { - this.attributes = new ArrayList(); - } - this.attributes.add(attributes); - return this; - } - - /** - * Set the attributes. - * Existing attributes will be replaced. - * - * @param attributes the attributes - * @return the V2PolicySubject builder - */ - public Builder attributes(List attributes) { - this.attributes = attributes; - return this; - } - } - - protected V2PolicySubject() { } - - protected V2PolicySubject(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, - "attributes cannot be null"); - attributes = builder.attributes; - } - - /** - * New builder. - * - * @return a V2PolicySubject builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the attributes. - * - * List of subject attributes associated with policy. - * - * @return the attributes - */ - public List attributes() { - return attributes; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java deleted file mode 100644 index c90606429df..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Subject attribute for whom the policy grants access. - */ -public class V2PolicySubjectAttribute extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - } - - protected String key; - protected String operator; - protected Object value; - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing V2PolicySubjectAttribute instance. - * - * @param v2PolicySubjectAttribute the instance to initialize the Builder with - */ - private Builder(V2PolicySubjectAttribute v2PolicySubjectAttribute) { - this.key = v2PolicySubjectAttribute.key; - this.operator = v2PolicySubjectAttribute.operator; - this.value = v2PolicySubjectAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a V2PolicySubjectAttribute. - * - * @return the new V2PolicySubjectAttribute instance - */ - public V2PolicySubjectAttribute build() { - return new V2PolicySubjectAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the V2PolicySubjectAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicySubjectAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the V2PolicySubjectAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected V2PolicySubjectAttribute() { } - - protected V2PolicySubjectAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a V2PolicySubjectAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the key. - * - * The name of a subject attribute. For example, iam_id, access_group_id. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java deleted file mode 100644 index 720f7b57d4e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the policy. - */ -public class V2PolicyTemplateMetaData extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - /** - * The policy state, either 'deleted' or 'active'. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String type; - protected String description; - protected V2PolicySubject subject; - protected V2PolicyResource resource; - protected String pattern; - protected V2PolicyRule rule; - protected String id; - protected String href; - protected ControlResponse control; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String state; - @SerializedName("last_permit_at") - protected String lastPermitAt; - @SerializedName("last_permit_frequency") - protected Long lastPermitFrequency; - protected TemplateMetadata template; - - protected V2PolicyTemplateMetaData() { } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject getSubject() { - return subject; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource getResource() { - return resource; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String getPattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule getRule() { - return rule; - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the policies API by policy ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the control. - * - * @return the control - */ - public ControlResponse getControl() { - return control; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the state. - * - * The policy state, either 'deleted' or 'active'. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the lastPermitAt. - * - * The optional last permit time of policy, when passing query parameter format=include_last_permit. - * - * @return the lastPermitAt - */ - public String getLastPermitAt() { - return lastPermitAt; - } - - /** - * Gets the lastPermitFrequency. - * - * The optional count of times that policy has provided a permit, when passing query parameter - * format=include_last_permit. - * - * @return the lastPermitFrequency - */ - public Long getLastPermitFrequency() { - return lastPermitFrequency; - } - - /** - * Gets the template. - * - * The details of the IAM template that was used to create an enterprise-managed policy in your account. When - * returned, this indicates that the policy is created from and managed by a template in the root enterprise account. - * - * @return the template - */ - public TemplateMetadata getTemplate() { - return template; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java deleted file mode 100644 index 63a87389391..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * (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. - */ - -/** - * IAM Policy Management v1. - */ -package com.ibm.cloud.platform_services.iam_policy_management.v1; diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java deleted file mode 100644 index b38933306a6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java +++ /dev/null @@ -1,5007 +0,0 @@ -/* - * (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_policy_management.v1; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplatesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponse; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControlWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedCondition; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleWithConditions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PoliciesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplatesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoleReferences; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PoliciesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRule; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleWithNestedConditions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.utils.TestUtilities; -import com.ibm.cloud.sdk.core.http.Response; -import com.ibm.cloud.sdk.core.security.Authenticator; -import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import okhttp3.mockwebserver.MockResponse; -import okhttp3.mockwebserver.MockWebServer; -import okhttp3.mockwebserver.RecordedRequest; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; -import static org.testng.Assert.*; - -/** - * Unit test class for the IamPolicyManagement service. - */ -public class IamPolicyManagementTest { - - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - protected MockWebServer server; - protected IamPolicyManagement iamPolicyManagementService; - - // Construct the service with a null authenticator (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testConstructorWithNullAuthenticator() throws Throwable { - final String serviceName = "testService"; - new IamPolicyManagement(serviceName, null); - } - - // Test the listPolicies operation with a valid options model parameter - @Test - public void testListPoliciesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policies\": [{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}]}"; - String listPoliciesPath = "/v1/policies"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListPoliciesOptions model - ListPoliciesOptions listPoliciesOptionsModel = new ListPoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .tagName("testString") - .tagValue("testString") - .sort("id") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listPolicies() with a valid options model and verify the result - Response response = iamPolicyManagementService.listPolicies(listPoliciesOptionsModel).execute(); - assertNotNull(response); - PolicyCollection 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, listPoliciesPath); - // 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("access_group_id"), "testString"); - assertEquals(query.get("type"), "access"); - assertEquals(query.get("service_type"), "service"); - assertEquals(query.get("tag_name"), "testString"); - assertEquals(query.get("tag_value"), "testString"); - assertEquals(query.get("sort"), "id"); - assertEquals(query.get("format"), "include_last_permit"); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listPolicies operation with and without retries enabled - @Test - public void testListPoliciesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListPoliciesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListPoliciesWOptions(); - } - - // Test the listPolicies operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPoliciesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listPolicies(null).execute(); - } - - // Test the listPolicies operation using the PoliciesPager.getNext() method - @Test - public void testListPoliciesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPoliciesOptions listPoliciesOptions = new ListPoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .tagName("testString") - .tagValue("testString") - .sort("id") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - PoliciesPager pager = new PoliciesPager(iamPolicyManagementService, listPoliciesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listPolicies operation using the PoliciesPager.getAll() method - @Test - public void testListPoliciesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPoliciesOptions listPoliciesOptions = new ListPoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .tagName("testString") - .tagValue("testString") - .sort("id") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - PoliciesPager pager = new PoliciesPager(iamPolicyManagementService, listPoliciesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createPolicy operation with a valid options model parameter - @Test - public void testCreatePolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; - String createPolicyPath = "/v1/policies"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the SubjectAttribute model - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - - // Construct an instance of the PolicySubject model - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - - // Construct an instance of the PolicyRole model - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the ResourceAttribute model - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - - // Construct an instance of the ResourceTag model - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - - // Construct an instance of the PolicyResource model - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - - // Construct an instance of the CreatePolicyOptions model - CreatePolicyOptions createPolicyOptionsModel = new CreatePolicyOptions.Builder() - .type("testString") - .subjects(java.util.Arrays.asList(policySubjectModel)) - .roles(java.util.Arrays.asList(policyRoleModel)) - .resources(java.util.Arrays.asList(policyResourceModel)) - .description("testString") - .acceptLanguage("default") - .build(); - - // Invoke createPolicy() with a valid options model and verify the result - Response response = iamPolicyManagementService.createPolicy(createPolicyOptionsModel).execute(); - assertNotNull(response); - Policy 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createPolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createPolicy operation with and without retries enabled - @Test - public void testCreatePolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreatePolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreatePolicyWOptions(); - } - - // Test the createPolicy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createPolicy(null).execute(); - } - - // Test the replacePolicy operation with a valid options model parameter - @Test - public void testReplacePolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; - String replacePolicyPath = "/v1/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the SubjectAttribute model - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - - // Construct an instance of the PolicySubject model - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - - // Construct an instance of the PolicyRole model - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the ResourceAttribute model - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - - // Construct an instance of the ResourceTag model - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - - // Construct an instance of the PolicyResource model - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - - // Construct an instance of the ReplacePolicyOptions model - ReplacePolicyOptions replacePolicyOptionsModel = new ReplacePolicyOptions.Builder() - .policyId("testString") - .ifMatch("testString") - .type("testString") - .subjects(java.util.Arrays.asList(policySubjectModel)) - .roles(java.util.Arrays.asList(policyRoleModel)) - .resources(java.util.Arrays.asList(policyResourceModel)) - .description("testString") - .build(); - - // Invoke replacePolicy() with a valid options model and verify the result - Response response = iamPolicyManagementService.replacePolicy(replacePolicyOptionsModel).execute(); - assertNotNull(response); - Policy 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, replacePolicyPath); - // 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 replacePolicy operation with and without retries enabled - @Test - public void testReplacePolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplacePolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplacePolicyWOptions(); - } - - // Test the replacePolicy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplacePolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replacePolicy(null).execute(); - } - - // Test the getPolicy operation with a valid options model parameter - @Test - public void testGetPolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}"; - String getPolicyPath = "/v1/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetPolicyOptions model - GetPolicyOptions getPolicyOptionsModel = new GetPolicyOptions.Builder() - .policyId("testString") - .build(); - - // Invoke getPolicy() with a valid options model and verify the result - Response response = iamPolicyManagementService.getPolicy(getPolicyOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateMetaData 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, getPolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getPolicy operation with and without retries enabled - @Test - public void testGetPolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetPolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetPolicyWOptions(); - } - - // Test the getPolicy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getPolicy(null).execute(); - } - - // Test the deletePolicy operation with a valid options model parameter - @Test - public void testDeletePolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deletePolicyPath = "/v1/policies/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeletePolicyOptions model - DeletePolicyOptions deletePolicyOptionsModel = new DeletePolicyOptions.Builder() - .policyId("testString") - .build(); - - // Invoke deletePolicy() with a valid options model and verify the result - Response response = iamPolicyManagementService.deletePolicy(deletePolicyOptionsModel).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, deletePolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deletePolicy operation with and without retries enabled - @Test - public void testDeletePolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeletePolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeletePolicyWOptions(); - } - - // Test the deletePolicy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deletePolicy(null).execute(); - } - - // Test the updatePolicyState operation with a valid options model parameter - @Test - public void testUpdatePolicyStateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; - String updatePolicyStatePath = "/v1/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdatePolicyStateOptions model - UpdatePolicyStateOptions updatePolicyStateOptionsModel = new UpdatePolicyStateOptions.Builder() - .policyId("testString") - .ifMatch("testString") - .state("active") - .build(); - - // Invoke updatePolicyState() with a valid options model and verify the result - Response response = iamPolicyManagementService.updatePolicyState(updatePolicyStateOptionsModel).execute(); - assertNotNull(response); - Policy 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updatePolicyStatePath); - // 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 updatePolicyState operation with and without retries enabled - @Test - public void testUpdatePolicyStateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdatePolicyStateWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdatePolicyStateWOptions(); - } - - // Test the updatePolicyState operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdatePolicyStateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updatePolicyState(null).execute(); - } - - // Test the listRoles operation with a valid options model parameter - @Test - public void testListRolesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"custom_roles\": [{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}], \"service_roles\": [{\"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\"}], \"system_roles\": [{\"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\"}]}"; - String listRolesPath = "/v2/roles"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListRolesOptions model - ListRolesOptions listRolesOptionsModel = new ListRolesOptions.Builder() - .acceptLanguage("default") - .accountId("testString") - .serviceName("iam-groups") - .sourceServiceName("iam-groups") - .policyType("authorization") - .serviceGroupId("IAM") - .build(); - - // Invoke listRoles() with a valid options model and verify the result - Response response = iamPolicyManagementService.listRoles(listRolesOptionsModel).execute(); - assertNotNull(response); - RoleCollection 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, listRolesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("service_name"), "iam-groups"); - assertEquals(query.get("source_service_name"), "iam-groups"); - assertEquals(query.get("policy_type"), "authorization"); - assertEquals(query.get("service_group_id"), "IAM"); - } - - // Test the listRoles operation with and without retries enabled - @Test - public void testListRolesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListRolesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListRolesWOptions(); - } - - // Test the createRole operation with a valid options model parameter - @Test - public void testCreateRoleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; - String createRolePath = "/v2/roles"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the CreateRoleOptions model - CreateRoleOptions createRoleOptionsModel = new CreateRoleOptions.Builder() - .displayName("testString") - .actions(java.util.Arrays.asList("testString")) - .name("Developer") - .accountId("testString") - .serviceName("iam-groups") - .description("testString") - .acceptLanguage("default") - .build(); - - // Invoke createRole() with a valid options model and verify the result - Response response = iamPolicyManagementService.createRole(createRoleOptionsModel).execute(); - assertNotNull(response); - CustomRole 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createRolePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createRole operation with and without retries enabled - @Test - public void testCreateRoleWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateRoleWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateRoleWOptions(); - } - - // Test the createRole operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createRole(null).execute(); - } - - // Test the replaceRole operation with a valid options model parameter - @Test - public void testReplaceRoleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; - String replaceRolePath = "/v2/roles/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ReplaceRoleOptions model - ReplaceRoleOptions replaceRoleOptionsModel = new ReplaceRoleOptions.Builder() - .roleId("testString") - .ifMatch("testString") - .displayName("testString") - .actions(java.util.Arrays.asList("testString")) - .description("testString") - .build(); - - // Invoke replaceRole() with a valid options model and verify the result - Response response = iamPolicyManagementService.replaceRole(replaceRoleOptionsModel).execute(); - assertNotNull(response); - CustomRole 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, replaceRolePath); - // 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 replaceRole operation with and without retries enabled - @Test - public void testReplaceRoleWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplaceRoleWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplaceRoleWOptions(); - } - - // Test the replaceRole operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceRoleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replaceRole(null).execute(); - } - - // Test the getRole operation with a valid options model parameter - @Test - public void testGetRoleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; - String getRolePath = "/v2/roles/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetRoleOptions model - GetRoleOptions getRoleOptionsModel = new GetRoleOptions.Builder() - .roleId("testString") - .build(); - - // Invoke getRole() with a valid options model and verify the result - Response response = iamPolicyManagementService.getRole(getRoleOptionsModel).execute(); - assertNotNull(response); - CustomRole 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, getRolePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getRole operation with and without retries enabled - @Test - public void testGetRoleWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetRoleWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetRoleWOptions(); - } - - // Test the getRole operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getRole(null).execute(); - } - - // Test the deleteRole operation with a valid options model parameter - @Test - public void testDeleteRoleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteRolePath = "/v2/roles/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteRoleOptions model - DeleteRoleOptions deleteRoleOptionsModel = new DeleteRoleOptions.Builder() - .roleId("testString") - .build(); - - // Invoke deleteRole() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteRole(deleteRoleOptionsModel).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, deleteRolePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteRole operation with and without retries enabled - @Test - public void testDeleteRoleWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteRoleWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteRoleWOptions(); - } - - // Test the deleteRole operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteRole(null).execute(); - } - - // Test the listV2Policies operation with a valid options model parameter - @Test - public void testListV2PoliciesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policies\": [{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19, \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}]}"; - String listV2PoliciesPath = "/v2/policies"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListV2PoliciesOptions model - ListV2PoliciesOptions listV2PoliciesOptionsModel = new ListV2PoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .serviceName("testString") - .serviceGroupId("testString") - .sort("testString") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listV2Policies() with a valid options model and verify the result - Response response = iamPolicyManagementService.listV2Policies(listV2PoliciesOptionsModel).execute(); - assertNotNull(response); - V2PolicyCollection 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, listV2PoliciesPath); - // 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("access_group_id"), "testString"); - assertEquals(query.get("type"), "access"); - assertEquals(query.get("service_type"), "service"); - assertEquals(query.get("service_name"), "testString"); - assertEquals(query.get("service_group_id"), "testString"); - assertEquals(query.get("sort"), "testString"); - assertEquals(query.get("format"), "include_last_permit"); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listV2Policies operation with and without retries enabled - @Test - public void testListV2PoliciesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListV2PoliciesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListV2PoliciesWOptions(); - } - - // Test the listV2Policies operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListV2PoliciesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listV2Policies(null).execute(); - } - - // Test the listV2Policies operation using the V2PoliciesPager.getNext() method - @Test - public void testListV2PoliciesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListV2PoliciesOptions listV2PoliciesOptions = new ListV2PoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .serviceName("testString") - .serviceGroupId("testString") - .sort("testString") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - V2PoliciesPager pager = new V2PoliciesPager(iamPolicyManagementService, listV2PoliciesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listV2Policies operation using the V2PoliciesPager.getAll() method - @Test - public void testListV2PoliciesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListV2PoliciesOptions listV2PoliciesOptions = new ListV2PoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .serviceName("testString") - .serviceGroupId("testString") - .sort("testString") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - V2PoliciesPager pager = new V2PoliciesPager(iamPolicyManagementService, listV2PoliciesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createV2Policy operation with a valid options model parameter - @Test - public void testCreateV2PolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19}"; - String createV2PolicyPath = "/v2/policies"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the Grant model - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the Control model - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the CreateV2PolicyOptions model - CreateV2PolicyOptions createV2PolicyOptionsModel = new CreateV2PolicyOptions.Builder() - .control(controlModel) - .type("access") - .description("testString") - .subject(v2PolicySubjectModel) - .resource(v2PolicyResourceModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .acceptLanguage("default") - .build(); - - // Invoke createV2Policy() with a valid options model and verify the result - Response response = iamPolicyManagementService.createV2Policy(createV2PolicyOptionsModel).execute(); - assertNotNull(response); - V2Policy 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createV2PolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createV2Policy operation with and without retries enabled - @Test - public void testCreateV2PolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateV2PolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateV2PolicyWOptions(); - } - - // Test the createV2Policy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateV2PolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createV2Policy(null).execute(); - } - - // Test the replaceV2Policy operation with a valid options model parameter - @Test - public void testReplaceV2PolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19}"; - String replaceV2PolicyPath = "/v2/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the Grant model - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the Control model - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the ReplaceV2PolicyOptions model - ReplaceV2PolicyOptions replaceV2PolicyOptionsModel = new ReplaceV2PolicyOptions.Builder() - .id("testString") - .ifMatch("testString") - .control(controlModel) - .type("access") - .description("testString") - .subject(v2PolicySubjectModel) - .resource(v2PolicyResourceModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .build(); - - // Invoke replaceV2Policy() with a valid options model and verify the result - Response response = iamPolicyManagementService.replaceV2Policy(replaceV2PolicyOptionsModel).execute(); - assertNotNull(response); - V2Policy 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, replaceV2PolicyPath); - // 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 replaceV2Policy operation with and without retries enabled - @Test - public void testReplaceV2PolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplaceV2PolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplaceV2PolicyWOptions(); - } - - // Test the replaceV2Policy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceV2PolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replaceV2Policy(null).execute(); - } - - // Test the getV2Policy operation with a valid options model parameter - @Test - public void testGetV2PolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19, \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}"; - String getV2PolicyPath = "/v2/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetV2PolicyOptions model - GetV2PolicyOptions getV2PolicyOptionsModel = new GetV2PolicyOptions.Builder() - .id("testString") - .format("include_last_permit") - .build(); - - // Invoke getV2Policy() with a valid options model and verify the result - Response response = iamPolicyManagementService.getV2Policy(getV2PolicyOptionsModel).execute(); - assertNotNull(response); - V2PolicyTemplateMetaData 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, getV2PolicyPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("format"), "include_last_permit"); - } - - // Test the getV2Policy operation with and without retries enabled - @Test - public void testGetV2PolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetV2PolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetV2PolicyWOptions(); - } - - // Test the getV2Policy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetV2PolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getV2Policy(null).execute(); - } - - // Test the deleteV2Policy operation with a valid options model parameter - @Test - public void testDeleteV2PolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteV2PolicyPath = "/v2/policies/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteV2PolicyOptions model - DeleteV2PolicyOptions deleteV2PolicyOptionsModel = new DeleteV2PolicyOptions.Builder() - .id("testString") - .build(); - - // Invoke deleteV2Policy() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteV2Policy(deleteV2PolicyOptionsModel).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, deleteV2PolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteV2Policy operation with and without retries enabled - @Test - public void testDeleteV2PolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteV2PolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteV2PolicyWOptions(); - } - - // Test the deleteV2Policy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteV2PolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteV2Policy(null).execute(); - } - - // Test the listPolicyTemplates operation with a valid options model parameter - @Test - public void testListPolicyTemplatesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policy_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; - String listPolicyTemplatesPath = "/v1/policy_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListPolicyTemplatesOptions model - ListPolicyTemplatesOptions listPolicyTemplatesOptionsModel = new ListPolicyTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .state("active") - .name("testString") - .policyServiceType("service") - .policyServiceName("testString") - .policyServiceGroupId("testString") - .policyType("access") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listPolicyTemplates() with a valid options model and verify the result - Response response = iamPolicyManagementService.listPolicyTemplates(listPolicyTemplatesOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateCollection 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, listPolicyTemplatesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("state"), "active"); - assertEquals(query.get("name"), "testString"); - assertEquals(query.get("policy_service_type"), "service"); - assertEquals(query.get("policy_service_name"), "testString"); - assertEquals(query.get("policy_service_group_id"), "testString"); - assertEquals(query.get("policy_type"), "access"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listPolicyTemplates operation with and without retries enabled - @Test - public void testListPolicyTemplatesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListPolicyTemplatesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListPolicyTemplatesWOptions(); - } - - // Test the listPolicyTemplates operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyTemplatesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listPolicyTemplates(null).execute(); - } - - // Test the listPolicyTemplates operation using the PolicyTemplatesPager.getNext() method - @Test - public void testListPolicyTemplatesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyTemplatesOptions listPolicyTemplatesOptions = new ListPolicyTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .state("active") - .name("testString") - .policyServiceType("service") - .policyServiceName("testString") - .policyServiceGroupId("testString") - .policyType("access") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - PolicyTemplatesPager pager = new PolicyTemplatesPager(iamPolicyManagementService, listPolicyTemplatesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listPolicyTemplates operation using the PolicyTemplatesPager.getAll() method - @Test - public void testListPolicyTemplatesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyTemplatesOptions listPolicyTemplatesOptions = new ListPolicyTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .state("active") - .name("testString") - .policyServiceType("service") - .policyServiceName("testString") - .policyServiceGroupId("testString") - .policyType("access") - .limit(Long.valueOf("10")) - .build(); - - PolicyTemplatesPager pager = new PolicyTemplatesPager(iamPolicyManagementService, listPolicyTemplatesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createPolicyTemplate operation with a valid options model parameter - @Test - public void testCreatePolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; - String createPolicyTemplatePath = "/v1/policy_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the TemplateGrantRoles model - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the TemplateControl model - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - - // Construct an instance of the TemplatePolicy model - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - - // Construct an instance of the CreatePolicyTemplateOptions model - CreatePolicyTemplateOptions createPolicyTemplateOptionsModel = new CreatePolicyTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .policy(templatePolicyModel) - .description("testString") - .committed(true) - .acceptLanguage("default") - .build(); - - // Invoke createPolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.createPolicyTemplate(createPolicyTemplateOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateLimitData 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createPolicyTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createPolicyTemplate operation with and without retries enabled - @Test - public void testCreatePolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreatePolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreatePolicyTemplateWOptions(); - } - - // Test the createPolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createPolicyTemplate(null).execute(); - } - - // Test the getPolicyTemplate operation with a valid options model parameter - @Test - public void testGetPolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String getPolicyTemplatePath = "/v1/policy_templates/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetPolicyTemplateOptions model - GetPolicyTemplateOptions getPolicyTemplateOptionsModel = new GetPolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .state("active") - .build(); - - // Invoke getPolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.getPolicyTemplate(getPolicyTemplateOptionsModel).execute(); - assertNotNull(response); - PolicyTemplate 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, getPolicyTemplatePath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - } - - // Test the getPolicyTemplate operation with and without retries enabled - @Test - public void testGetPolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetPolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetPolicyTemplateWOptions(); - } - - // Test the getPolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getPolicyTemplate(null).execute(); - } - - // Test the deletePolicyTemplate operation with a valid options model parameter - @Test - public void testDeletePolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deletePolicyTemplatePath = "/v1/policy_templates/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeletePolicyTemplateOptions model - DeletePolicyTemplateOptions deletePolicyTemplateOptionsModel = new DeletePolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .build(); - - // Invoke deletePolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.deletePolicyTemplate(deletePolicyTemplateOptionsModel).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, deletePolicyTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deletePolicyTemplate operation with and without retries enabled - @Test - public void testDeletePolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeletePolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeletePolicyTemplateWOptions(); - } - - // Test the deletePolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deletePolicyTemplate(null).execute(); - } - - // Test the createPolicyTemplateVersion operation with a valid options model parameter - @Test - public void testCreatePolicyTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; - String createPolicyTemplateVersionPath = "/v1/policy_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the TemplateGrantRoles model - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the TemplateControl model - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - - // Construct an instance of the TemplatePolicy model - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - - // Construct an instance of the CreatePolicyTemplateVersionOptions model - CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptionsModel = new CreatePolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .policy(templatePolicyModel) - .name("testString") - .description("testString") - .committed(true) - .build(); - - // Invoke createPolicyTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.createPolicyTemplateVersion(createPolicyTemplateVersionOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateLimitData 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createPolicyTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createPolicyTemplateVersion operation with and without retries enabled - @Test - public void testCreatePolicyTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreatePolicyTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreatePolicyTemplateVersionWOptions(); - } - - // Test the createPolicyTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createPolicyTemplateVersion(null).execute(); - } - - // Test the listPolicyTemplateVersions operation with a valid options model parameter - @Test - public void testListPolicyTemplateVersionsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; - String listPolicyTemplateVersionsPath = "/v1/policy_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListPolicyTemplateVersionsOptions model - ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptionsModel = new ListPolicyTemplateVersionsOptions.Builder() - .policyTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listPolicyTemplateVersions() with a valid options model and verify the result - Response response = iamPolicyManagementService.listPolicyTemplateVersions(listPolicyTemplateVersionsOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateVersionsCollection 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, listPolicyTemplateVersionsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listPolicyTemplateVersions operation with and without retries enabled - @Test - public void testListPolicyTemplateVersionsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListPolicyTemplateVersionsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListPolicyTemplateVersionsWOptions(); - } - - // Test the listPolicyTemplateVersions operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyTemplateVersionsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listPolicyTemplateVersions(null).execute(); - } - - // Test the listPolicyTemplateVersions operation using the PolicyTemplateVersionsPager.getNext() method - @Test - public void testListPolicyTemplateVersionsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions = new ListPolicyTemplateVersionsOptions.Builder() - .policyTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - PolicyTemplateVersionsPager pager = new PolicyTemplateVersionsPager(iamPolicyManagementService, listPolicyTemplateVersionsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listPolicyTemplateVersions operation using the PolicyTemplateVersionsPager.getAll() method - @Test - public void testListPolicyTemplateVersionsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions = new ListPolicyTemplateVersionsOptions.Builder() - .policyTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - PolicyTemplateVersionsPager pager = new PolicyTemplateVersionsPager(iamPolicyManagementService, listPolicyTemplateVersionsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the replacePolicyTemplate operation with a valid options model parameter - @Test - public void testReplacePolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String replacePolicyTemplatePath = "/v1/policy_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the TemplateGrantRoles model - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the TemplateControl model - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - - // Construct an instance of the TemplatePolicy model - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - - // Construct an instance of the ReplacePolicyTemplateOptions model - ReplacePolicyTemplateOptions replacePolicyTemplateOptionsModel = new ReplacePolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .ifMatch("testString") - .policy(templatePolicyModel) - .name("testString") - .description("testString") - .committed(true) - .build(); - - // Invoke replacePolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.replacePolicyTemplate(replacePolicyTemplateOptionsModel).execute(); - assertNotNull(response); - PolicyTemplate 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, replacePolicyTemplatePath); - // 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 replacePolicyTemplate operation with and without retries enabled - @Test - public void testReplacePolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplacePolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplacePolicyTemplateWOptions(); - } - - // Test the replacePolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplacePolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replacePolicyTemplate(null).execute(); - } - - // Test the deletePolicyTemplateVersion operation with a valid options model parameter - @Test - public void testDeletePolicyTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deletePolicyTemplateVersionPath = "/v1/policy_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeletePolicyTemplateVersionOptions model - DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptionsModel = new DeletePolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - - // Invoke deletePolicyTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.deletePolicyTemplateVersion(deletePolicyTemplateVersionOptionsModel).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, deletePolicyTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deletePolicyTemplateVersion operation with and without retries enabled - @Test - public void testDeletePolicyTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeletePolicyTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeletePolicyTemplateVersionWOptions(); - } - - // Test the deletePolicyTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deletePolicyTemplateVersion(null).execute(); - } - - // Test the getPolicyTemplateVersion operation with a valid options model parameter - @Test - public void testGetPolicyTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String getPolicyTemplateVersionPath = "/v1/policy_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetPolicyTemplateVersionOptions model - GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptionsModel = new GetPolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - - // Invoke getPolicyTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.getPolicyTemplateVersion(getPolicyTemplateVersionOptionsModel).execute(); - assertNotNull(response); - PolicyTemplate 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, getPolicyTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getPolicyTemplateVersion operation with and without retries enabled - @Test - public void testGetPolicyTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetPolicyTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetPolicyTemplateVersionWOptions(); - } - - // Test the getPolicyTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getPolicyTemplateVersion(null).execute(); - } - - // Test the commitPolicyTemplate operation with a valid options model parameter - @Test - public void testCommitPolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String commitPolicyTemplatePath = "/v1/policy_templates/testString/versions/testString/commit"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the CommitPolicyTemplateOptions model - CommitPolicyTemplateOptions commitPolicyTemplateOptionsModel = new CommitPolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - - // Invoke commitPolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.commitPolicyTemplate(commitPolicyTemplateOptionsModel).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, commitPolicyTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the commitPolicyTemplate operation with and without retries enabled - @Test - public void testCommitPolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCommitPolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCommitPolicyTemplateWOptions(); - } - - // Test the commitPolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitPolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.commitPolicyTemplate(null).execute(); - } - - // Test the listPolicyAssignments operation with a valid options model parameter - @Test - public void testListPolicyAssignmentsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}]}"; - String listPolicyAssignmentsPath = "/v1/policy_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListPolicyAssignmentsOptions model - ListPolicyAssignmentsOptions listPolicyAssignmentsOptionsModel = new ListPolicyAssignmentsOptions.Builder() - .version("1.0") - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listPolicyAssignments() with a valid options model and verify the result - Response response = iamPolicyManagementService.listPolicyAssignments(listPolicyAssignmentsOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateAssignmentCollection 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, listPolicyAssignmentsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "1.0"); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("template_id"), "testString"); - assertEquals(query.get("template_version"), "testString"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listPolicyAssignments operation with and without retries enabled - @Test - public void testListPolicyAssignmentsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListPolicyAssignmentsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListPolicyAssignmentsWOptions(); - } - - // Test the listPolicyAssignments operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyAssignmentsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listPolicyAssignments(null).execute(); - } - - // Test the listPolicyAssignments operation using the PolicyAssignmentsPager.getNext() method - @Test - public void testListPolicyAssignmentsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyAssignmentsOptions listPolicyAssignmentsOptions = new ListPolicyAssignmentsOptions.Builder() - .version("1.0") - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - PolicyAssignmentsPager pager = new PolicyAssignmentsPager(iamPolicyManagementService, listPolicyAssignmentsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listPolicyAssignments operation using the PolicyAssignmentsPager.getAll() method - @Test - public void testListPolicyAssignmentsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyAssignmentsOptions listPolicyAssignmentsOptions = new ListPolicyAssignmentsOptions.Builder() - .version("1.0") - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - PolicyAssignmentsPager pager = new PolicyAssignmentsPager(iamPolicyManagementService, listPolicyAssignmentsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createPolicyTemplateAssignment operation with a valid options model parameter - @Test - public void testCreatePolicyTemplateAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}]}"; - String createPolicyTemplateAssignmentPath = "/v1/policy_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the AssignmentTargetDetails model - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - - // Construct an instance of the AssignmentTemplateDetails model - AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() - .id("testString") - .version("testString") - .build(); - - // Construct an instance of the CreatePolicyTemplateAssignmentOptions model - CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptionsModel = new CreatePolicyTemplateAssignmentOptions.Builder() - .version("1.0") - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(assignmentTemplateDetailsModel)) - .acceptLanguage("default") - .build(); - - // Invoke createPolicyTemplateAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.createPolicyTemplateAssignment(createPolicyTemplateAssignmentOptionsModel).execute(); - assertNotNull(response); - PolicyAssignmentV1Collection 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createPolicyTemplateAssignmentPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "1.0"); - } - - // Test the createPolicyTemplateAssignment operation with and without retries enabled - @Test - public void testCreatePolicyTemplateAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreatePolicyTemplateAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreatePolicyTemplateAssignmentWOptions(); - } - - // Test the createPolicyTemplateAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createPolicyTemplateAssignment(null).execute(); - } - - // Test the getPolicyAssignment operation with a valid options model parameter - @Test - public void testGetPolicyAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}"; - String getPolicyAssignmentPath = "/v1/policy_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetPolicyAssignmentOptions model - GetPolicyAssignmentOptions getPolicyAssignmentOptionsModel = new GetPolicyAssignmentOptions.Builder() - .assignmentId("testString") - .version("1.0") - .build(); - - // Invoke getPolicyAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.getPolicyAssignment(getPolicyAssignmentOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateAssignmentItems 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, getPolicyAssignmentPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "1.0"); - } - - // Test the getPolicyAssignment operation with and without retries enabled - @Test - public void testGetPolicyAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetPolicyAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetPolicyAssignmentWOptions(); - } - - // Test the getPolicyAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getPolicyAssignment(null).execute(); - } - - // Test the updatePolicyAssignment operation with a valid options model parameter - @Test - public void testUpdatePolicyAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}"; - String updatePolicyAssignmentPath = "/v1/policy_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdatePolicyAssignmentOptions model - UpdatePolicyAssignmentOptions updatePolicyAssignmentOptionsModel = new UpdatePolicyAssignmentOptions.Builder() - .assignmentId("testString") - .version("1.0") - .ifMatch("testString") - .templateVersion("testString") - .build(); - - // Invoke updatePolicyAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.updatePolicyAssignment(updatePolicyAssignmentOptionsModel).execute(); - assertNotNull(response); - PolicyAssignmentV1 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updatePolicyAssignmentPath); - // Verify header parameters - assertEquals(request.getHeader("If-Match"), "testString"); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "1.0"); - } - - // Test the updatePolicyAssignment operation with and without retries enabled - @Test - public void testUpdatePolicyAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdatePolicyAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdatePolicyAssignmentWOptions(); - } - - // Test the updatePolicyAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdatePolicyAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updatePolicyAssignment(null).execute(); - } - - // Test the deletePolicyAssignment operation with a valid options model parameter - @Test - public void testDeletePolicyAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deletePolicyAssignmentPath = "/v1/policy_assignments/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeletePolicyAssignmentOptions model - DeletePolicyAssignmentOptions deletePolicyAssignmentOptionsModel = new DeletePolicyAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke deletePolicyAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.deletePolicyAssignment(deletePolicyAssignmentOptionsModel).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, deletePolicyAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deletePolicyAssignment operation with and without retries enabled - @Test - public void testDeletePolicyAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeletePolicyAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeletePolicyAssignmentWOptions(); - } - - // Test the deletePolicyAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deletePolicyAssignment(null).execute(); - } - - // Test the getSettings operation with a valid options model parameter - @Test - public void testGetSettingsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"external_account_identity_interaction\": {\"identity_types\": {\"user\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service_id\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}}}}"; - String getSettingsPath = "/v1/accounts/testString/settings/access_management"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetSettingsOptions model - GetSettingsOptions getSettingsOptionsModel = new GetSettingsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .build(); - - // Invoke getSettings() with a valid options model and verify the result - Response response = iamPolicyManagementService.getSettings(getSettingsOptionsModel).execute(); - assertNotNull(response); - AccountSettingsAccessManagement 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, getSettingsPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getSettings operation with and without retries enabled - @Test - public void testGetSettingsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetSettingsWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetSettingsWOptions(); - } - - // Test the getSettings operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetSettingsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getSettings(null).execute(); - } - - // Test the updateSettings operation with a valid options model parameter - @Test - public void testUpdateSettingsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"external_account_identity_interaction\": {\"identity_types\": {\"user\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service_id\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}}}}"; - String updateSettingsPath = "/v1/accounts/testString/settings/access_management"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the IdentityTypesBase model - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the IdentityTypesPatch model - IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() - .user(identityTypesBaseModel) - .serviceId(identityTypesBaseModel) - .service(identityTypesBaseModel) - .build(); - - // Construct an instance of the ExternalAccountIdentityInteractionPatch model - ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() - .identityTypes(identityTypesPatchModel) - .build(); - - // Construct an instance of the UpdateSettingsOptions model - UpdateSettingsOptions updateSettingsOptionsModel = new UpdateSettingsOptions.Builder() - .accountId("testString") - .ifMatch("testString") - .externalAccountIdentityInteraction(externalAccountIdentityInteractionPatchModel) - .acceptLanguage("default") - .build(); - - // Invoke updateSettings() with a valid options model and verify the result - Response response = iamPolicyManagementService.updateSettings(updateSettingsOptionsModel).execute(); - assertNotNull(response); - AccountSettingsAccessManagement 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateSettingsPath); - // 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 updateSettings operation with and without retries enabled - @Test - public void testUpdateSettingsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdateSettingsWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdateSettingsWOptions(); - } - - // Test the updateSettings operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateSettingsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updateSettings(null).execute(); - } - - // Test the listActionControlTemplates operation with a valid options model parameter - @Test - public void testListActionControlTemplatesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"action_control_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; - String listActionControlTemplatesPath = "/v1/action_control_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListActionControlTemplatesOptions model - ListActionControlTemplatesOptions listActionControlTemplatesOptionsModel = new ListActionControlTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listActionControlTemplates() with a valid options model and verify the result - Response response = iamPolicyManagementService.listActionControlTemplates(listActionControlTemplatesOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplateCollection 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, listActionControlTemplatesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listActionControlTemplates operation with and without retries enabled - @Test - public void testListActionControlTemplatesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListActionControlTemplatesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListActionControlTemplatesWOptions(); - } - - // Test the listActionControlTemplates operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlTemplatesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listActionControlTemplates(null).execute(); - } - - // Test the listActionControlTemplates operation using the ActionControlTemplatesPager.getNext() method - @Test - public void testListActionControlTemplatesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlTemplatesOptions listActionControlTemplatesOptions = new ListActionControlTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - ActionControlTemplatesPager pager = new ActionControlTemplatesPager(iamPolicyManagementService, listActionControlTemplatesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listActionControlTemplates operation using the ActionControlTemplatesPager.getAll() method - @Test - public void testListActionControlTemplatesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlTemplatesOptions listActionControlTemplatesOptions = new ListActionControlTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .limit(Long.valueOf("10")) - .build(); - - ActionControlTemplatesPager pager = new ActionControlTemplatesPager(iamPolicyManagementService, listActionControlTemplatesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createActionControlTemplate operation with a valid options model parameter - @Test - public void testCreateActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String createActionControlTemplatePath = "/v1/action_control_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateActionControl model - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the CreateActionControlTemplateOptions model - CreateActionControlTemplateOptions createActionControlTemplateOptionsModel = new CreateActionControlTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .description("testString") - .committed(true) - .actionControl(templateActionControlModel) - .acceptLanguage("default") - .build(); - - // Invoke createActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.createActionControlTemplate(createActionControlTemplateOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createActionControlTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createActionControlTemplate operation with and without retries enabled - @Test - public void testCreateActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateActionControlTemplateWOptions(); - } - - // Test the createActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createActionControlTemplate(null).execute(); - } - - // Test the getActionControlTemplate operation with a valid options model parameter - @Test - public void testGetActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String getActionControlTemplatePath = "/v1/action_control_templates/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetActionControlTemplateOptions model - GetActionControlTemplateOptions getActionControlTemplateOptionsModel = new GetActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .build(); - - // Invoke getActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.getActionControlTemplate(getActionControlTemplateOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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, getActionControlTemplatePath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - } - - // Test the getActionControlTemplate operation with and without retries enabled - @Test - public void testGetActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetActionControlTemplateWOptions(); - } - - // Test the getActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getActionControlTemplate(null).execute(); - } - - // Test the deleteActionControlTemplate operation with a valid options model parameter - @Test - public void testDeleteActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteActionControlTemplatePath = "/v1/action_control_templates/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteActionControlTemplateOptions model - DeleteActionControlTemplateOptions deleteActionControlTemplateOptionsModel = new DeleteActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .build(); - - // Invoke deleteActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteActionControlTemplate(deleteActionControlTemplateOptionsModel).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, deleteActionControlTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteActionControlTemplate operation with and without retries enabled - @Test - public void testDeleteActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteActionControlTemplateWOptions(); - } - - // Test the deleteActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteActionControlTemplate(null).execute(); - } - - // Test the createActionControlTemplateVersion operation with a valid options model parameter - @Test - public void testCreateActionControlTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String createActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateActionControl model - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the CreateActionControlTemplateVersionOptions model - CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptionsModel = new CreateActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .name("testString") - .description("testString") - .actionControl(templateActionControlModel) - .committed(true) - .build(); - - // Invoke createActionControlTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.createActionControlTemplateVersion(createActionControlTemplateVersionOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createActionControlTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createActionControlTemplateVersion operation with and without retries enabled - @Test - public void testCreateActionControlTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateActionControlTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateActionControlTemplateVersionWOptions(); - } - - // Test the createActionControlTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createActionControlTemplateVersion(null).execute(); - } - - // Test the listActionControlTemplateVersions operation with a valid options model parameter - @Test - public void testListActionControlTemplateVersionsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; - String listActionControlTemplateVersionsPath = "/v1/action_control_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListActionControlTemplateVersionsOptions model - ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptionsModel = new ListActionControlTemplateVersionsOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listActionControlTemplateVersions() with a valid options model and verify the result - Response response = iamPolicyManagementService.listActionControlTemplateVersions(listActionControlTemplateVersionsOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplateVersionsCollection 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, listActionControlTemplateVersionsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listActionControlTemplateVersions operation with and without retries enabled - @Test - public void testListActionControlTemplateVersionsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListActionControlTemplateVersionsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListActionControlTemplateVersionsWOptions(); - } - - // Test the listActionControlTemplateVersions operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlTemplateVersionsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listActionControlTemplateVersions(null).execute(); - } - - // Test the listActionControlTemplateVersions operation using the ActionControlTemplateVersionsPager.getNext() method - @Test - public void testListActionControlTemplateVersionsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions = new ListActionControlTemplateVersionsOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - ActionControlTemplateVersionsPager pager = new ActionControlTemplateVersionsPager(iamPolicyManagementService, listActionControlTemplateVersionsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listActionControlTemplateVersions operation using the ActionControlTemplateVersionsPager.getAll() method - @Test - public void testListActionControlTemplateVersionsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions = new ListActionControlTemplateVersionsOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - ActionControlTemplateVersionsPager pager = new ActionControlTemplateVersionsPager(iamPolicyManagementService, listActionControlTemplateVersionsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the replaceActionControlTemplate operation with a valid options model parameter - @Test - public void testReplaceActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String replaceActionControlTemplatePath = "/v1/action_control_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateActionControl model - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the ReplaceActionControlTemplateOptions model - ReplaceActionControlTemplateOptions replaceActionControlTemplateOptionsModel = new ReplaceActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .ifMatch("testString") - .name("testString") - .description("testString") - .actionControl(templateActionControlModel) - .committed(true) - .build(); - - // Invoke replaceActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.replaceActionControlTemplate(replaceActionControlTemplateOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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, replaceActionControlTemplatePath); - // 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 replaceActionControlTemplate operation with and without retries enabled - @Test - public void testReplaceActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplaceActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplaceActionControlTemplateWOptions(); - } - - // Test the replaceActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replaceActionControlTemplate(null).execute(); - } - - // Test the deleteActionControlTemplateVersion operation with a valid options model parameter - @Test - public void testDeleteActionControlTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteActionControlTemplateVersionOptions model - DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptionsModel = new DeleteActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - - // Invoke deleteActionControlTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteActionControlTemplateVersion(deleteActionControlTemplateVersionOptionsModel).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, deleteActionControlTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteActionControlTemplateVersion operation with and without retries enabled - @Test - public void testDeleteActionControlTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteActionControlTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteActionControlTemplateVersionWOptions(); - } - - // Test the deleteActionControlTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteActionControlTemplateVersion(null).execute(); - } - - // Test the getActionControlTemplateVersion operation with a valid options model parameter - @Test - public void testGetActionControlTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String getActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetActionControlTemplateVersionOptions model - GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptionsModel = new GetActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - - // Invoke getActionControlTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.getActionControlTemplateVersion(getActionControlTemplateVersionOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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, getActionControlTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getActionControlTemplateVersion operation with and without retries enabled - @Test - public void testGetActionControlTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetActionControlTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetActionControlTemplateVersionWOptions(); - } - - // Test the getActionControlTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getActionControlTemplateVersion(null).execute(); - } - - // Test the commitActionControlTemplate operation with a valid options model parameter - @Test - public void testCommitActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String commitActionControlTemplatePath = "/v1/action_control_templates/testString/versions/testString/commit"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the CommitActionControlTemplateOptions model - CommitActionControlTemplateOptions commitActionControlTemplateOptionsModel = new CommitActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - - // Invoke commitActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.commitActionControlTemplate(commitActionControlTemplateOptionsModel).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, commitActionControlTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the commitActionControlTemplate operation with and without retries enabled - @Test - public void testCommitActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCommitActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCommitActionControlTemplateWOptions(); - } - - // Test the commitActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.commitActionControlTemplate(null).execute(); - } - - // Test the listActionControlAssignments operation with a valid options model parameter - @Test - public void testListActionControlAssignmentsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; - String listActionControlAssignmentsPath = "/v1/action_control_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListActionControlAssignmentsOptions model - ListActionControlAssignmentsOptions listActionControlAssignmentsOptionsModel = new ListActionControlAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listActionControlAssignments() with a valid options model and verify the result - Response response = iamPolicyManagementService.listActionControlAssignments(listActionControlAssignmentsOptionsModel).execute(); - assertNotNull(response); - ActionControlAssignmentCollection 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, listActionControlAssignmentsPath); - // 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(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listActionControlAssignments operation with and without retries enabled - @Test - public void testListActionControlAssignmentsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListActionControlAssignmentsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListActionControlAssignmentsWOptions(); - } - - // Test the listActionControlAssignments operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlAssignmentsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listActionControlAssignments(null).execute(); - } - - // Test the listActionControlAssignments operation using the ActionControlAssignmentsPager.getNext() method - @Test - public void testListActionControlAssignmentsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlAssignmentsOptions listActionControlAssignmentsOptions = new ListActionControlAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - ActionControlAssignmentsPager pager = new ActionControlAssignmentsPager(iamPolicyManagementService, listActionControlAssignmentsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listActionControlAssignments operation using the ActionControlAssignmentsPager.getAll() method - @Test - public void testListActionControlAssignmentsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlAssignmentsOptions listActionControlAssignmentsOptions = new ListActionControlAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - ActionControlAssignmentsPager pager = new ActionControlAssignmentsPager(iamPolicyManagementService, listActionControlAssignmentsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createActionControlTemplateAssignment operation with a valid options model parameter - @Test - public void testCreateActionControlTemplateAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; - String createActionControlTemplateAssignmentPath = "/v1/action_control_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the AssignmentTargetDetails model - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - - // Construct an instance of the ActionControlAssignmentTemplate model - ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - - // Construct an instance of the CreateActionControlTemplateAssignmentOptions model - CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptionsModel = new CreateActionControlTemplateAssignmentOptions.Builder() - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(actionControlAssignmentTemplateModel)) - .acceptLanguage("default") - .build(); - - // Invoke createActionControlTemplateAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.createActionControlTemplateAssignment(createActionControlTemplateAssignmentOptionsModel).execute(); - assertNotNull(response); - ActionControlAssignmentCollection 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createActionControlTemplateAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createActionControlTemplateAssignment operation with and without retries enabled - @Test - public void testCreateActionControlTemplateAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateActionControlTemplateAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateActionControlTemplateAssignmentWOptions(); - } - - // Test the createActionControlTemplateAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createActionControlTemplateAssignment(null).execute(); - } - - // Test the getActionControlAssignment operation with a valid options model parameter - @Test - public void testGetActionControlAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; - String getActionControlAssignmentPath = "/v1/action_control_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetActionControlAssignmentOptions model - GetActionControlAssignmentOptions getActionControlAssignmentOptionsModel = new GetActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke getActionControlAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.getActionControlAssignment(getActionControlAssignmentOptionsModel).execute(); - assertNotNull(response); - ActionControlAssignment 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, getActionControlAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getActionControlAssignment operation with and without retries enabled - @Test - public void testGetActionControlAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetActionControlAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetActionControlAssignmentWOptions(); - } - - // Test the getActionControlAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getActionControlAssignment(null).execute(); - } - - // Test the updateActionControlAssignment operation with a valid options model parameter - @Test - public void testUpdateActionControlAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; - String updateActionControlAssignmentPath = "/v1/action_control_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdateActionControlAssignmentOptions model - UpdateActionControlAssignmentOptions updateActionControlAssignmentOptionsModel = new UpdateActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .ifMatch("testString") - .templateVersion("testString") - .build(); - - // Invoke updateActionControlAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.updateActionControlAssignment(updateActionControlAssignmentOptionsModel).execute(); - assertNotNull(response); - ActionControlAssignment 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateActionControlAssignmentPath); - // 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 updateActionControlAssignment operation with and without retries enabled - @Test - public void testUpdateActionControlAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdateActionControlAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdateActionControlAssignmentWOptions(); - } - - // Test the updateActionControlAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateActionControlAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updateActionControlAssignment(null).execute(); - } - - // Test the deleteActionControlAssignment operation with a valid options model parameter - @Test - public void testDeleteActionControlAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteActionControlAssignmentPath = "/v1/action_control_assignments/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteActionControlAssignmentOptions model - DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptionsModel = new DeleteActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke deleteActionControlAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteActionControlAssignment(deleteActionControlAssignmentOptionsModel).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, deleteActionControlAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteActionControlAssignment operation with and without retries enabled - @Test - public void testDeleteActionControlAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteActionControlAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteActionControlAssignmentWOptions(); - } - - // Test the deleteActionControlAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteActionControlAssignment(null).execute(); - } - - // Test the listRoleTemplates operation with a valid options model parameter - @Test - public void testListRoleTemplatesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"role_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; - String listRoleTemplatesPath = "/v1/role_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListRoleTemplatesOptions model - ListRoleTemplatesOptions listRoleTemplatesOptionsModel = new ListRoleTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .name("testString") - .roleName("testString") - .roleServiceName("testString") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listRoleTemplates() with a valid options model and verify the result - Response response = iamPolicyManagementService.listRoleTemplates(listRoleTemplatesOptionsModel).execute(); - assertNotNull(response); - RoleTemplateCollection 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, listRoleTemplatesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("name"), "testString"); - assertEquals(query.get("role_name"), "testString"); - assertEquals(query.get("role_service_name"), "testString"); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listRoleTemplates operation with and without retries enabled - @Test - public void testListRoleTemplatesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListRoleTemplatesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListRoleTemplatesWOptions(); - } - - // Test the listRoleTemplates operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleTemplatesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listRoleTemplates(null).execute(); - } - - // Test the listRoleTemplates operation using the RoleTemplatesPager.getNext() method - @Test - public void testListRoleTemplatesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleTemplatesOptions listRoleTemplatesOptions = new ListRoleTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .name("testString") - .roleName("testString") - .roleServiceName("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - RoleTemplatesPager pager = new RoleTemplatesPager(iamPolicyManagementService, listRoleTemplatesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listRoleTemplates operation using the RoleTemplatesPager.getAll() method - @Test - public void testListRoleTemplatesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleTemplatesOptions listRoleTemplatesOptions = new ListRoleTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .name("testString") - .roleName("testString") - .roleServiceName("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - RoleTemplatesPager pager = new RoleTemplatesPager(iamPolicyManagementService, listRoleTemplatesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createRoleTemplate operation with a valid options model parameter - @Test - public void testCreateRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String createRoleTemplatePath = "/v1/role_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the RoleTemplatePrototypeRole model - RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() - .name("testString") - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the CreateRoleTemplateOptions model - CreateRoleTemplateOptions createRoleTemplateOptionsModel = new CreateRoleTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .description("testString") - .committed(true) - .role(roleTemplatePrototypeRoleModel) - .acceptLanguage("default") - .build(); - - // Invoke createRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.createRoleTemplate(createRoleTemplateOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createRoleTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createRoleTemplate operation with and without retries enabled - @Test - public void testCreateRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateRoleTemplateWOptions(); - } - - // Test the createRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createRoleTemplate(null).execute(); - } - - // Test the getRoleTemplate operation with a valid options model parameter - @Test - public void testGetRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String getRoleTemplatePath = "/v1/role_templates/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetRoleTemplateOptions model - GetRoleTemplateOptions getRoleTemplateOptionsModel = new GetRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .state("active") - .build(); - - // Invoke getRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.getRoleTemplate(getRoleTemplateOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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, getRoleTemplatePath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - } - - // Test the getRoleTemplate operation with and without retries enabled - @Test - public void testGetRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetRoleTemplateWOptions(); - } - - // Test the getRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getRoleTemplate(null).execute(); - } - - // Test the deleteRoleTemplate operation with a valid options model parameter - @Test - public void testDeleteRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteRoleTemplatePath = "/v1/role_templates/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteRoleTemplateOptions model - DeleteRoleTemplateOptions deleteRoleTemplateOptionsModel = new DeleteRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .build(); - - // Invoke deleteRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteRoleTemplate(deleteRoleTemplateOptionsModel).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, deleteRoleTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteRoleTemplate operation with and without retries enabled - @Test - public void testDeleteRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteRoleTemplateWOptions(); - } - - // Test the deleteRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteRoleTemplate(null).execute(); - } - - // Test the createRoleTemplateVersion operation with a valid options model parameter - @Test - public void testCreateRoleTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String createRoleTemplateVersionPath = "/v1/role_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateRole model - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the CreateRoleTemplateVersionOptions model - CreateRoleTemplateVersionOptions createRoleTemplateVersionOptionsModel = new CreateRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .name("testString") - .description("testString") - .role(templateRoleModel) - .committed(true) - .build(); - - // Invoke createRoleTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.createRoleTemplateVersion(createRoleTemplateVersionOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createRoleTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createRoleTemplateVersion operation with and without retries enabled - @Test - public void testCreateRoleTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateRoleTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateRoleTemplateVersionWOptions(); - } - - // Test the createRoleTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createRoleTemplateVersion(null).execute(); - } - - // Test the listRoleTemplateVersions operation with a valid options model parameter - @Test - public void testListRoleTemplateVersionsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; - String listRoleTemplateVersionsPath = "/v1/role_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListRoleTemplateVersionsOptions model - ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptionsModel = new ListRoleTemplateVersionsOptions.Builder() - .roleTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listRoleTemplateVersions() with a valid options model and verify the result - Response response = iamPolicyManagementService.listRoleTemplateVersions(listRoleTemplateVersionsOptionsModel).execute(); - assertNotNull(response); - RoleTemplateVersionsCollection 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, listRoleTemplateVersionsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listRoleTemplateVersions operation with and without retries enabled - @Test - public void testListRoleTemplateVersionsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListRoleTemplateVersionsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListRoleTemplateVersionsWOptions(); - } - - // Test the listRoleTemplateVersions operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleTemplateVersionsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listRoleTemplateVersions(null).execute(); - } - - // Test the listRoleTemplateVersions operation using the RoleTemplateVersionsPager.getNext() method - @Test - public void testListRoleTemplateVersionsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions = new ListRoleTemplateVersionsOptions.Builder() - .roleTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - RoleTemplateVersionsPager pager = new RoleTemplateVersionsPager(iamPolicyManagementService, listRoleTemplateVersionsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listRoleTemplateVersions operation using the RoleTemplateVersionsPager.getAll() method - @Test - public void testListRoleTemplateVersionsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions = new ListRoleTemplateVersionsOptions.Builder() - .roleTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - RoleTemplateVersionsPager pager = new RoleTemplateVersionsPager(iamPolicyManagementService, listRoleTemplateVersionsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the replaceRoleTemplate operation with a valid options model parameter - @Test - public void testReplaceRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String replaceRoleTemplatePath = "/v1/role_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateRole model - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the ReplaceRoleTemplateOptions model - ReplaceRoleTemplateOptions replaceRoleTemplateOptionsModel = new ReplaceRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .ifMatch("testString") - .name("testString") - .description("testString") - .role(templateRoleModel) - .committed(true) - .build(); - - // Invoke replaceRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.replaceRoleTemplate(replaceRoleTemplateOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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, replaceRoleTemplatePath); - // 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 replaceRoleTemplate operation with and without retries enabled - @Test - public void testReplaceRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplaceRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplaceRoleTemplateWOptions(); - } - - // Test the replaceRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replaceRoleTemplate(null).execute(); - } - - // Test the deleteRoleTemplateVersion operation with a valid options model parameter - @Test - public void testDeleteRoleTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteRoleTemplateVersionPath = "/v1/role_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteRoleTemplateVersionOptions model - DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptionsModel = new DeleteRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - - // Invoke deleteRoleTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteRoleTemplateVersion(deleteRoleTemplateVersionOptionsModel).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, deleteRoleTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteRoleTemplateVersion operation with and without retries enabled - @Test - public void testDeleteRoleTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteRoleTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteRoleTemplateVersionWOptions(); - } - - // Test the deleteRoleTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteRoleTemplateVersion(null).execute(); - } - - // Test the getRoleTemplateVersion operation with a valid options model parameter - @Test - public void testGetRoleTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String getRoleTemplateVersionPath = "/v1/role_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetRoleTemplateVersionOptions model - GetRoleTemplateVersionOptions getRoleTemplateVersionOptionsModel = new GetRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - - // Invoke getRoleTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.getRoleTemplateVersion(getRoleTemplateVersionOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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, getRoleTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getRoleTemplateVersion operation with and without retries enabled - @Test - public void testGetRoleTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetRoleTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetRoleTemplateVersionWOptions(); - } - - // Test the getRoleTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getRoleTemplateVersion(null).execute(); - } - - // Test the commitRoleTemplate operation with a valid options model parameter - @Test - public void testCommitRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String commitRoleTemplatePath = "/v1/role_templates/testString/versions/testString/commit"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the CommitRoleTemplateOptions model - CommitRoleTemplateOptions commitRoleTemplateOptionsModel = new CommitRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - - // Invoke commitRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.commitRoleTemplate(commitRoleTemplateOptionsModel).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, commitRoleTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the commitRoleTemplate operation with and without retries enabled - @Test - public void testCommitRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCommitRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCommitRoleTemplateWOptions(); - } - - // Test the commitRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.commitRoleTemplate(null).execute(); - } - - // Test the listRoleAssignments operation with a valid options model parameter - @Test - public void testListRoleAssignmentsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; - String listRoleAssignmentsPath = "/v1/role_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListRoleAssignmentsOptions model - ListRoleAssignmentsOptions listRoleAssignmentsOptionsModel = new ListRoleAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listRoleAssignments() with a valid options model and verify the result - Response response = iamPolicyManagementService.listRoleAssignments(listRoleAssignmentsOptionsModel).execute(); - assertNotNull(response); - RoleAssignmentCollection 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, listRoleAssignmentsPath); - // 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(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listRoleAssignments operation with and without retries enabled - @Test - public void testListRoleAssignmentsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListRoleAssignmentsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListRoleAssignmentsWOptions(); - } - - // Test the listRoleAssignments operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleAssignmentsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listRoleAssignments(null).execute(); - } - - // Test the listRoleAssignments operation using the RoleAssignmentsPager.getNext() method - @Test - public void testListRoleAssignmentsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleAssignmentsOptions listRoleAssignmentsOptions = new ListRoleAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - RoleAssignmentsPager pager = new RoleAssignmentsPager(iamPolicyManagementService, listRoleAssignmentsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listRoleAssignments operation using the RoleAssignmentsPager.getAll() method - @Test - public void testListRoleAssignmentsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleAssignmentsOptions listRoleAssignmentsOptions = new ListRoleAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - RoleAssignmentsPager pager = new RoleAssignmentsPager(iamPolicyManagementService, listRoleAssignmentsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createRoleTemplateAssignment operation with a valid options model parameter - @Test - public void testCreateRoleTemplateAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; - String createRoleTemplateAssignmentPath = "/v1/role_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the AssignmentTargetDetails model - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - - // Construct an instance of the RoleAssignmentTemplate model - RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - - // Construct an instance of the CreateRoleTemplateAssignmentOptions model - CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptionsModel = new CreateRoleTemplateAssignmentOptions.Builder() - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(roleAssignmentTemplateModel)) - .acceptLanguage("default") - .build(); - - // Invoke createRoleTemplateAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.createRoleTemplateAssignment(createRoleTemplateAssignmentOptionsModel).execute(); - assertNotNull(response); - RoleAssignmentCollection 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createRoleTemplateAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createRoleTemplateAssignment operation with and without retries enabled - @Test - public void testCreateRoleTemplateAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateRoleTemplateAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateRoleTemplateAssignmentWOptions(); - } - - // Test the createRoleTemplateAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createRoleTemplateAssignment(null).execute(); - } - - // Test the getRoleAssignment operation with a valid options model parameter - @Test - public void testGetRoleAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; - String getRoleAssignmentPath = "/v1/role_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetRoleAssignmentOptions model - GetRoleAssignmentOptions getRoleAssignmentOptionsModel = new GetRoleAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke getRoleAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.getRoleAssignment(getRoleAssignmentOptionsModel).execute(); - assertNotNull(response); - RoleAssignment 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, getRoleAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getRoleAssignment operation with and without retries enabled - @Test - public void testGetRoleAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetRoleAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetRoleAssignmentWOptions(); - } - - // Test the getRoleAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getRoleAssignment(null).execute(); - } - - // Test the updateRoleAssignment operation with a valid options model parameter - @Test - public void testUpdateRoleAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; - String updateRoleAssignmentPath = "/v1/role_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdateRoleAssignmentOptions model - UpdateRoleAssignmentOptions updateRoleAssignmentOptionsModel = new UpdateRoleAssignmentOptions.Builder() - .assignmentId("testString") - .ifMatch("testString") - .templateVersion("testString") - .build(); - - // Invoke updateRoleAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.updateRoleAssignment(updateRoleAssignmentOptionsModel).execute(); - assertNotNull(response); - RoleAssignment 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateRoleAssignmentPath); - // 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 updateRoleAssignment operation with and without retries enabled - @Test - public void testUpdateRoleAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdateRoleAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdateRoleAssignmentWOptions(); - } - - // Test the updateRoleAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateRoleAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updateRoleAssignment(null).execute(); - } - - // Test the deleteRoleAssignment operation with a valid options model parameter - @Test - public void testDeleteRoleAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteRoleAssignmentPath = "/v1/role_assignments/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteRoleAssignmentOptions model - DeleteRoleAssignmentOptions deleteRoleAssignmentOptionsModel = new DeleteRoleAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke deleteRoleAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteRoleAssignment(deleteRoleAssignmentOptionsModel).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, deleteRoleAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteRoleAssignment operation with and without retries enabled - @Test - public void testDeleteRoleAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteRoleAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteRoleAssignmentWOptions(); - } - - // Test the deleteRoleAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteRoleAssignment(null).execute(); - } - - // Perform setup needed before each test method - @BeforeMethod - public void beforeEachTest() { - // Start the mock server. - try { - server = new MockWebServer(); - server.start(); - } catch (IOException err) { - fail("Failed to instantiate mock web server"); - } - - // Construct an instance of the service - constructClientService(); - } - - // Perform tear down after each test method - @AfterMethod - public void afterEachTest() throws IOException { - server.shutdown(); - iamPolicyManagementService = null; - } - - // Constructs an instance of the service to be used by the tests - public void constructClientService() { - System.setProperty("TESTSERVICE_AUTH_TYPE", "noAuth"); - final String serviceName = "testService"; - - iamPolicyManagementService = IamPolicyManagement.newInstance(serviceName); - String url = server.url("/").toString(); - iamPolicyManagementService.setServiceUrl(url); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java deleted file mode 100644 index 5630ccb0c03..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.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 AccountSettingsAccessManagement model. - */ -public class AccountSettingsAccessManagementTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAccountSettingsAccessManagement() throws Throwable { - AccountSettingsAccessManagement accountSettingsAccessManagementModel = new AccountSettingsAccessManagement(); - assertNull(accountSettingsAccessManagementModel.getExternalAccountIdentityInteraction()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java deleted file mode 100644 index d4dfc8863c6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentCollection model. - */ -public class ActionControlAssignmentCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentCollection() throws Throwable { - ActionControlAssignmentCollection actionControlAssignmentCollectionModel = new ActionControlAssignmentCollection(); - assertNull(actionControlAssignmentCollectionModel.getLimit()); - assertNull(actionControlAssignmentCollectionModel.getFirst()); - assertNull(actionControlAssignmentCollectionModel.getNext()); - assertNull(actionControlAssignmentCollectionModel.getPrevious()); - assertNull(actionControlAssignmentCollectionModel.getAssignments()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java deleted file mode 100644 index cb53bc44d1c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResourceActionControl model. - */ -public class ActionControlAssignmentResourceActionControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentResourceActionControl() throws Throwable { - ActionControlAssignmentResourceActionControl actionControlAssignmentResourceActionControlModel = new ActionControlAssignmentResourceActionControl(); - assertNull(actionControlAssignmentResourceActionControlModel.getResourceCreated()); - assertNull(actionControlAssignmentResourceActionControlModel.getErrorMessage()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java deleted file mode 100644 index 284ec17a0f0..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResourceCreated model. - */ -public class ActionControlAssignmentResourceCreatedTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentResourceCreated() throws Throwable { - ActionControlAssignmentResourceCreated actionControlAssignmentResourceCreatedModel = new ActionControlAssignmentResourceCreated(); - assertNull(actionControlAssignmentResourceCreatedModel.getId()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java deleted file mode 100644 index eaa560dce78..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResource model. - */ -public class ActionControlAssignmentResourceTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentResource() throws Throwable { - ActionControlAssignmentResource actionControlAssignmentResourceModel = new ActionControlAssignmentResource(); - assertNull(actionControlAssignmentResourceModel.getTarget()); - assertNull(actionControlAssignmentResourceModel.getActionControl()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java deleted file mode 100644 index 262a74bea45..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentTemplate model. - */ -public class ActionControlAssignmentTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentTemplate() throws Throwable { - ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(actionControlAssignmentTemplateModel.id(), "testString"); - assertEquals(actionControlAssignmentTemplateModel.version(), "testString"); - - String json = TestUtilities.serialize(actionControlAssignmentTemplateModel); - - ActionControlAssignmentTemplate actionControlAssignmentTemplateModelNew = TestUtilities.deserialize(json, ActionControlAssignmentTemplate.class); - assertTrue(actionControlAssignmentTemplateModelNew instanceof ActionControlAssignmentTemplate); - assertEquals(actionControlAssignmentTemplateModelNew.id(), "testString"); - assertEquals(actionControlAssignmentTemplateModelNew.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testActionControlAssignmentTemplateError() throws Throwable { - new ActionControlAssignmentTemplate.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java deleted file mode 100644 index c5173f940c4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignment model. - */ -public class ActionControlAssignmentTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignment() throws Throwable { - ActionControlAssignment actionControlAssignmentModel = new ActionControlAssignment(); - assertNull(actionControlAssignmentModel.getTemplate()); - assertNull(actionControlAssignmentModel.getTarget()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java deleted file mode 100644 index 58155ee1e7e..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplateCollection model. - */ -public class ActionControlTemplateCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlTemplateCollection() throws Throwable { - ActionControlTemplateCollection actionControlTemplateCollectionModel = new ActionControlTemplateCollection(); - assertNull(actionControlTemplateCollectionModel.getLimit()); - assertNull(actionControlTemplateCollectionModel.getFirst()); - assertNull(actionControlTemplateCollectionModel.getNext()); - assertNull(actionControlTemplateCollectionModel.getPrevious()); - assertNull(actionControlTemplateCollectionModel.getActionControlTemplates()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java deleted file mode 100644 index a086106a57e..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplate model. - */ -public class ActionControlTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlTemplate() throws Throwable { - ActionControlTemplate actionControlTemplateModel = new ActionControlTemplate(); - assertNull(actionControlTemplateModel.getName()); - assertNull(actionControlTemplateModel.getDescription()); - assertNull(actionControlTemplateModel.getAccountId()); - assertNull(actionControlTemplateModel.isCommitted()); - assertNull(actionControlTemplateModel.getActionControl()); - assertNull(actionControlTemplateModel.getVersion()); - assertNull(actionControlTemplateModel.getState()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java deleted file mode 100644 index 7b6bf014357..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplateVersionsCollection model. - */ -public class ActionControlTemplateVersionsCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlTemplateVersionsCollection() throws Throwable { - ActionControlTemplateVersionsCollection actionControlTemplateVersionsCollectionModel = new ActionControlTemplateVersionsCollection(); - assertNull(actionControlTemplateVersionsCollectionModel.getLimit()); - assertNull(actionControlTemplateVersionsCollectionModel.getFirst()); - assertNull(actionControlTemplateVersionsCollectionModel.getNext()); - assertNull(actionControlTemplateVersionsCollectionModel.getPrevious()); - assertNull(actionControlTemplateVersionsCollectionModel.getVersions()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java deleted file mode 100644 index 4038d52606c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentResourceCreated model. - */ -public class AssignmentResourceCreatedTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAssignmentResourceCreated() throws Throwable { - AssignmentResourceCreated assignmentResourceCreatedModel = new AssignmentResourceCreated(); - assertNull(assignmentResourceCreatedModel.getId()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java deleted file mode 100644 index 81e3799a42c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentResourceError model. - */ -public class AssignmentResourceErrorTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAssignmentResourceError() throws Throwable { - AssignmentResourceError assignmentResourceErrorModel = new AssignmentResourceError(); - assertNull(assignmentResourceErrorModel.getName()); - assertNull(assignmentResourceErrorModel.getErrorCode()); - assertNull(assignmentResourceErrorModel.getMessage()); - assertNull(assignmentResourceErrorModel.getCode()); - assertNull(assignmentResourceErrorModel.getErrors()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java deleted file mode 100644 index 48e4a605cbb..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentTargetDetails model. - */ -public class AssignmentTargetDetailsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAssignmentTargetDetails() throws Throwable { - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - assertEquals(assignmentTargetDetailsModel.type(), "Account"); - assertEquals(assignmentTargetDetailsModel.id(), "testString"); - - String json = TestUtilities.serialize(assignmentTargetDetailsModel); - - AssignmentTargetDetails assignmentTargetDetailsModelNew = TestUtilities.deserialize(json, AssignmentTargetDetails.class); - assertTrue(assignmentTargetDetailsModelNew instanceof AssignmentTargetDetails); - assertEquals(assignmentTargetDetailsModelNew.type(), "Account"); - assertEquals(assignmentTargetDetailsModelNew.id(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testAssignmentTargetDetailsError() throws Throwable { - new AssignmentTargetDetails.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java deleted file mode 100644 index bcecf27ed27..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentTemplateDetails model. - */ -public class AssignmentTemplateDetailsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAssignmentTemplateDetails() throws Throwable { - AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(assignmentTemplateDetailsModel.id(), "testString"); - assertEquals(assignmentTemplateDetailsModel.version(), "testString"); - - String json = TestUtilities.serialize(assignmentTemplateDetailsModel); - - AssignmentTemplateDetails assignmentTemplateDetailsModelNew = TestUtilities.deserialize(json, AssignmentTemplateDetails.class); - assertTrue(assignmentTemplateDetailsModelNew instanceof AssignmentTemplateDetails); - assertEquals(assignmentTemplateDetailsModelNew.id(), "testString"); - assertEquals(assignmentTemplateDetailsModelNew.version(), "testString"); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java deleted file mode 100644 index 2b5ed42c76a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CommitActionControlTemplateOptions model. - */ -public class CommitActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCommitActionControlTemplateOptions() throws Throwable { - CommitActionControlTemplateOptions commitActionControlTemplateOptionsModel = new CommitActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - assertEquals(commitActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(commitActionControlTemplateOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitActionControlTemplateOptionsError() throws Throwable { - new CommitActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java deleted file mode 100644 index 66cdca59588..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CommitPolicyTemplateOptions model. - */ -public class CommitPolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCommitPolicyTemplateOptions() throws Throwable { - CommitPolicyTemplateOptions commitPolicyTemplateOptionsModel = new CommitPolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - assertEquals(commitPolicyTemplateOptionsModel.policyTemplateId(), "testString"); - assertEquals(commitPolicyTemplateOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitPolicyTemplateOptionsError() throws Throwable { - new CommitPolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java deleted file mode 100644 index 09c48b8e80e..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CommitRoleTemplateOptions model. - */ -public class CommitRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCommitRoleTemplateOptions() throws Throwable { - CommitRoleTemplateOptions commitRoleTemplateOptionsModel = new CommitRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - assertEquals(commitRoleTemplateOptionsModel.roleTemplateId(), "testString"); - assertEquals(commitRoleTemplateOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitRoleTemplateOptionsError() throws Throwable { - new CommitRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java deleted file mode 100644 index 94ef6ce21e8..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.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 ConflictsWith model. - */ -public class ConflictsWithTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testConflictsWith() throws Throwable { - ConflictsWith conflictsWithModel = new ConflictsWith(); - assertNull(conflictsWithModel.getEtag()); - assertNull(conflictsWithModel.getRole()); - assertNull(conflictsWithModel.getPolicy()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java deleted file mode 100644 index bbe19a7b9b1..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponseControl model. - */ -public class ControlResponseControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testControlResponseControl() throws Throwable { - ControlResponseControl controlResponseControlModel = new ControlResponseControl(); - assertNull(controlResponseControlModel.getGrant()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java deleted file mode 100644 index 7b2fbfae90d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControlWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponseControlWithEnrichedRoles model. - */ -public class ControlResponseControlWithEnrichedRolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testControlResponseControlWithEnrichedRoles() throws Throwable { - ControlResponseControlWithEnrichedRoles controlResponseControlWithEnrichedRolesModel = new ControlResponseControlWithEnrichedRoles(); - assertNull(controlResponseControlWithEnrichedRolesModel.getGrant()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java deleted file mode 100644 index f42cbc0a2d8..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponse; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponse model. - */ -public class ControlResponseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testControlResponse() throws Throwable { - ControlResponse controlResponseModel = new ControlResponse(); - assertNotNull(controlResponseModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java deleted file mode 100644 index c8b1e3000f9..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 Control model. - */ -public class ControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testControl() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); - - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - assertEquals(controlModel.grant(), grantModel); - - String json = TestUtilities.serialize(controlModel); - - Control controlModelNew = TestUtilities.deserialize(json, Control.class); - assertTrue(controlModelNew instanceof Control); - assertEquals(controlModelNew.grant().toString(), grantModel.toString()); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testControlError() throws Throwable { - new Control.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java deleted file mode 100644 index f2557c8f64f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateAssignmentOptions model. - */ -public class CreateActionControlTemplateAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateActionControlTemplateAssignmentOptions() throws Throwable { - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - assertEquals(assignmentTargetDetailsModel.type(), "Account"); - assertEquals(assignmentTargetDetailsModel.id(), "testString"); - - ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(actionControlAssignmentTemplateModel.id(), "testString"); - assertEquals(actionControlAssignmentTemplateModel.version(), "testString"); - - CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptionsModel = new CreateActionControlTemplateAssignmentOptions.Builder() - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(actionControlAssignmentTemplateModel)) - .acceptLanguage("default") - .build(); - assertEquals(createActionControlTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); - assertEquals(createActionControlTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(actionControlAssignmentTemplateModel)); - assertEquals(createActionControlTemplateAssignmentOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateAssignmentOptionsError() throws Throwable { - new CreateActionControlTemplateAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java deleted file mode 100644 index 2508072a03c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateOptions model. - */ -public class CreateActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateActionControlTemplateOptions() throws Throwable { - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateActionControlModel.serviceName(), "testString"); - assertEquals(templateActionControlModel.description(), "testString"); - assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); - - CreateActionControlTemplateOptions createActionControlTemplateOptionsModel = new CreateActionControlTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .description("testString") - .committed(true) - .actionControl(templateActionControlModel) - .acceptLanguage("default") - .build(); - assertEquals(createActionControlTemplateOptionsModel.name(), "testString"); - assertEquals(createActionControlTemplateOptionsModel.accountId(), "testString"); - assertEquals(createActionControlTemplateOptionsModel.description(), "testString"); - assertEquals(createActionControlTemplateOptionsModel.committed(), Boolean.valueOf(true)); - assertEquals(createActionControlTemplateOptionsModel.actionControl(), templateActionControlModel); - assertEquals(createActionControlTemplateOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateOptionsError() throws Throwable { - new CreateActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java deleted file mode 100644 index d5070249115..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateVersionOptions model. - */ -public class CreateActionControlTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateActionControlTemplateVersionOptions() throws Throwable { - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateActionControlModel.serviceName(), "testString"); - assertEquals(templateActionControlModel.description(), "testString"); - assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); - - CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptionsModel = new CreateActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .name("testString") - .description("testString") - .actionControl(templateActionControlModel) - .committed(true) - .build(); - assertEquals(createActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(createActionControlTemplateVersionOptionsModel.name(), "testString"); - assertEquals(createActionControlTemplateVersionOptionsModel.description(), "testString"); - assertEquals(createActionControlTemplateVersionOptionsModel.actionControl(), templateActionControlModel); - assertEquals(createActionControlTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateVersionOptionsError() throws Throwable { - new CreateActionControlTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java deleted file mode 100644 index c2dd24fd213..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyOptions model. - */ -public class CreatePolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreatePolicyOptions() throws Throwable { - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - assertEquals(subjectAttributeModel.name(), "testString"); - assertEquals(subjectAttributeModel.value(), "testString"); - - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); - - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - assertEquals(policyRoleModel.roleId(), "testString"); - - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceAttributeModel.name(), "testString"); - assertEquals(resourceAttributeModel.value(), "testString"); - assertEquals(resourceAttributeModel.operator(), "testString"); - - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceTagModel.name(), "testString"); - assertEquals(resourceTagModel.value(), "testString"); - assertEquals(resourceTagModel.operator(), "testString"); - - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); - assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); - - CreatePolicyOptions createPolicyOptionsModel = new CreatePolicyOptions.Builder() - .type("testString") - .subjects(java.util.Arrays.asList(policySubjectModel)) - .roles(java.util.Arrays.asList(policyRoleModel)) - .resources(java.util.Arrays.asList(policyResourceModel)) - .description("testString") - .acceptLanguage("default") - .build(); - assertEquals(createPolicyOptionsModel.type(), "testString"); - assertEquals(createPolicyOptionsModel.subjects(), java.util.Arrays.asList(policySubjectModel)); - assertEquals(createPolicyOptionsModel.roles(), java.util.Arrays.asList(policyRoleModel)); - assertEquals(createPolicyOptionsModel.resources(), java.util.Arrays.asList(policyResourceModel)); - assertEquals(createPolicyOptionsModel.description(), "testString"); - assertEquals(createPolicyOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyOptionsError() throws Throwable { - new CreatePolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java deleted file mode 100644 index 5b08b4b398a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateAssignmentOptions model. - */ -public class CreatePolicyTemplateAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreatePolicyTemplateAssignmentOptions() throws Throwable { - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - assertEquals(assignmentTargetDetailsModel.type(), "Account"); - assertEquals(assignmentTargetDetailsModel.id(), "testString"); - - AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(assignmentTemplateDetailsModel.id(), "testString"); - assertEquals(assignmentTemplateDetailsModel.version(), "testString"); - - CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptionsModel = new CreatePolicyTemplateAssignmentOptions.Builder() - .version("1.0") - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(assignmentTemplateDetailsModel)) - .acceptLanguage("default") - .build(); - assertEquals(createPolicyTemplateAssignmentOptionsModel.version(), "1.0"); - assertEquals(createPolicyTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); - assertEquals(createPolicyTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(assignmentTemplateDetailsModel)); - assertEquals(createPolicyTemplateAssignmentOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateAssignmentOptionsError() throws Throwable { - new CreatePolicyTemplateAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java deleted file mode 100644 index 68617451831..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateOptions model. - */ -public class CreatePolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreatePolicyTemplateOptions() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - assertEquals(templatePolicyModel.type(), "access"); - assertEquals(templatePolicyModel.description(), "testString"); - assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); - assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); - assertEquals(templatePolicyModel.pattern(), "testString"); - assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), templateControlModel); - - CreatePolicyTemplateOptions createPolicyTemplateOptionsModel = new CreatePolicyTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .policy(templatePolicyModel) - .description("testString") - .committed(true) - .acceptLanguage("default") - .build(); - assertEquals(createPolicyTemplateOptionsModel.name(), "testString"); - assertEquals(createPolicyTemplateOptionsModel.accountId(), "testString"); - assertEquals(createPolicyTemplateOptionsModel.policy(), templatePolicyModel); - assertEquals(createPolicyTemplateOptionsModel.description(), "testString"); - assertEquals(createPolicyTemplateOptionsModel.committed(), Boolean.valueOf(true)); - assertEquals(createPolicyTemplateOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateOptionsError() throws Throwable { - new CreatePolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java deleted file mode 100644 index d6919e6e1b9..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateVersionOptions model. - */ -public class CreatePolicyTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreatePolicyTemplateVersionOptions() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - assertEquals(templatePolicyModel.type(), "access"); - assertEquals(templatePolicyModel.description(), "testString"); - assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); - assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); - assertEquals(templatePolicyModel.pattern(), "testString"); - assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), templateControlModel); - - CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptionsModel = new CreatePolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .policy(templatePolicyModel) - .name("testString") - .description("testString") - .committed(true) - .build(); - assertEquals(createPolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); - assertEquals(createPolicyTemplateVersionOptionsModel.policy(), templatePolicyModel); - assertEquals(createPolicyTemplateVersionOptionsModel.name(), "testString"); - assertEquals(createPolicyTemplateVersionOptionsModel.description(), "testString"); - assertEquals(createPolicyTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateVersionOptionsError() throws Throwable { - new CreatePolicyTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java deleted file mode 100644 index 849512f2bda..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleOptions model. - */ -public class CreateRoleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateRoleOptions() throws Throwable { - CreateRoleOptions createRoleOptionsModel = new CreateRoleOptions.Builder() - .displayName("testString") - .actions(java.util.Arrays.asList("testString")) - .name("Developer") - .accountId("testString") - .serviceName("iam-groups") - .description("testString") - .acceptLanguage("default") - .build(); - assertEquals(createRoleOptionsModel.displayName(), "testString"); - assertEquals(createRoleOptionsModel.actions(), java.util.Arrays.asList("testString")); - assertEquals(createRoleOptionsModel.name(), "Developer"); - assertEquals(createRoleOptionsModel.accountId(), "testString"); - assertEquals(createRoleOptionsModel.serviceName(), "iam-groups"); - assertEquals(createRoleOptionsModel.description(), "testString"); - assertEquals(createRoleOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleOptionsError() throws Throwable { - new CreateRoleOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java deleted file mode 100644 index bff414389a5..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateAssignmentOptions model. - */ -public class CreateRoleTemplateAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateRoleTemplateAssignmentOptions() throws Throwable { - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - assertEquals(assignmentTargetDetailsModel.type(), "Account"); - assertEquals(assignmentTargetDetailsModel.id(), "testString"); - - RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(roleAssignmentTemplateModel.id(), "testString"); - assertEquals(roleAssignmentTemplateModel.version(), "testString"); - - CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptionsModel = new CreateRoleTemplateAssignmentOptions.Builder() - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(roleAssignmentTemplateModel)) - .acceptLanguage("default") - .build(); - assertEquals(createRoleTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); - assertEquals(createRoleTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(roleAssignmentTemplateModel)); - assertEquals(createRoleTemplateAssignmentOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateAssignmentOptionsError() throws Throwable { - new CreateRoleTemplateAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java deleted file mode 100644 index 799743ddbf4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateOptions model. - */ -public class CreateRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateRoleTemplateOptions() throws Throwable { - RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() - .name("testString") - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(roleTemplatePrototypeRoleModel.name(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.displayName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.serviceName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.description(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.actions(), java.util.Arrays.asList("testString")); - - CreateRoleTemplateOptions createRoleTemplateOptionsModel = new CreateRoleTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .description("testString") - .committed(true) - .role(roleTemplatePrototypeRoleModel) - .acceptLanguage("default") - .build(); - assertEquals(createRoleTemplateOptionsModel.name(), "testString"); - assertEquals(createRoleTemplateOptionsModel.accountId(), "testString"); - assertEquals(createRoleTemplateOptionsModel.description(), "testString"); - assertEquals(createRoleTemplateOptionsModel.committed(), Boolean.valueOf(true)); - assertEquals(createRoleTemplateOptionsModel.role(), roleTemplatePrototypeRoleModel); - assertEquals(createRoleTemplateOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateOptionsError() throws Throwable { - new CreateRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java deleted file mode 100644 index a7d2d312afa..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateVersionOptions model. - */ -public class CreateRoleTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateRoleTemplateVersionOptions() throws Throwable { - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateRoleModel.displayName(), "testString"); - assertEquals(templateRoleModel.serviceName(), "testString"); - assertEquals(templateRoleModel.description(), "testString"); - assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); - - CreateRoleTemplateVersionOptions createRoleTemplateVersionOptionsModel = new CreateRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .name("testString") - .description("testString") - .role(templateRoleModel) - .committed(true) - .build(); - assertEquals(createRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); - assertEquals(createRoleTemplateVersionOptionsModel.name(), "testString"); - assertEquals(createRoleTemplateVersionOptionsModel.description(), "testString"); - assertEquals(createRoleTemplateVersionOptionsModel.role(), templateRoleModel); - assertEquals(createRoleTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateVersionOptionsError() throws Throwable { - new CreateRoleTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java deleted file mode 100644 index acce8b7b537..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateV2PolicyOptions model. - */ -public class CreateV2PolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateV2PolicyOptions() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); - - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - assertEquals(controlModel.grant(), grantModel); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - CreateV2PolicyOptions createV2PolicyOptionsModel = new CreateV2PolicyOptions.Builder() - .control(controlModel) - .type("access") - .description("testString") - .subject(v2PolicySubjectModel) - .resource(v2PolicyResourceModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .acceptLanguage("default") - .build(); - assertEquals(createV2PolicyOptionsModel.control(), controlModel); - assertEquals(createV2PolicyOptionsModel.type(), "access"); - assertEquals(createV2PolicyOptionsModel.description(), "testString"); - assertEquals(createV2PolicyOptionsModel.subject(), v2PolicySubjectModel); - assertEquals(createV2PolicyOptionsModel.resource(), v2PolicyResourceModel); - assertEquals(createV2PolicyOptionsModel.pattern(), "testString"); - assertEquals(createV2PolicyOptionsModel.rule(), v2PolicyRuleModel); - assertEquals(createV2PolicyOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateV2PolicyOptionsError() throws Throwable { - new CreateV2PolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java deleted file mode 100644 index acc0dc0a3c1..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 CustomRole model. - */ -public class CustomRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCustomRole() throws Throwable { - CustomRole customRoleModel = new CustomRole(); - assertNull(customRoleModel.getDisplayName()); - assertNull(customRoleModel.getDescription()); - assertNull(customRoleModel.getActions()); - assertNull(customRoleModel.getName()); - assertNull(customRoleModel.getAccountId()); - assertNull(customRoleModel.getServiceName()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java deleted file mode 100644 index 1a38606ede5..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlAssignmentOptions model. - */ -public class DeleteActionControlAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteActionControlAssignmentOptions() throws Throwable { - DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptionsModel = new DeleteActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(deleteActionControlAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlAssignmentOptionsError() throws Throwable { - new DeleteActionControlAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java deleted file mode 100644 index 75b111e9214..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlTemplateOptions model. - */ -public class DeleteActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteActionControlTemplateOptions() throws Throwable { - DeleteActionControlTemplateOptions deleteActionControlTemplateOptionsModel = new DeleteActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .build(); - assertEquals(deleteActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlTemplateOptionsError() throws Throwable { - new DeleteActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java deleted file mode 100644 index 64fb5790244..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlTemplateVersionOptions model. - */ -public class DeleteActionControlTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteActionControlTemplateVersionOptions() throws Throwable { - DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptionsModel = new DeleteActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - assertEquals(deleteActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(deleteActionControlTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlTemplateVersionOptionsError() throws Throwable { - new DeleteActionControlTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java deleted file mode 100644 index 75aed905222..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyAssignmentOptions model. - */ -public class DeletePolicyAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeletePolicyAssignmentOptions() throws Throwable { - DeletePolicyAssignmentOptions deletePolicyAssignmentOptionsModel = new DeletePolicyAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(deletePolicyAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyAssignmentOptionsError() throws Throwable { - new DeletePolicyAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java deleted file mode 100644 index 1b130eb0f79..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyOptions model. - */ -public class DeletePolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeletePolicyOptions() throws Throwable { - DeletePolicyOptions deletePolicyOptionsModel = new DeletePolicyOptions.Builder() - .policyId("testString") - .build(); - assertEquals(deletePolicyOptionsModel.policyId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyOptionsError() throws Throwable { - new DeletePolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java deleted file mode 100644 index 288517222aa..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyTemplateOptions model. - */ -public class DeletePolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeletePolicyTemplateOptions() throws Throwable { - DeletePolicyTemplateOptions deletePolicyTemplateOptionsModel = new DeletePolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .build(); - assertEquals(deletePolicyTemplateOptionsModel.policyTemplateId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyTemplateOptionsError() throws Throwable { - new DeletePolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java deleted file mode 100644 index 7b1c6cffa1d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyTemplateVersionOptions model. - */ -public class DeletePolicyTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeletePolicyTemplateVersionOptions() throws Throwable { - DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptionsModel = new DeletePolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - assertEquals(deletePolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); - assertEquals(deletePolicyTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyTemplateVersionOptionsError() throws Throwable { - new DeletePolicyTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java deleted file mode 100644 index 7f9b614304f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleAssignmentOptions model. - */ -public class DeleteRoleAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteRoleAssignmentOptions() throws Throwable { - DeleteRoleAssignmentOptions deleteRoleAssignmentOptionsModel = new DeleteRoleAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(deleteRoleAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleAssignmentOptionsError() throws Throwable { - new DeleteRoleAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java deleted file mode 100644 index 9c6690cda7b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleOptions model. - */ -public class DeleteRoleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteRoleOptions() throws Throwable { - DeleteRoleOptions deleteRoleOptionsModel = new DeleteRoleOptions.Builder() - .roleId("testString") - .build(); - assertEquals(deleteRoleOptionsModel.roleId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleOptionsError() throws Throwable { - new DeleteRoleOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java deleted file mode 100644 index 3fc04286ed3..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleTemplateOptions model. - */ -public class DeleteRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteRoleTemplateOptions() throws Throwable { - DeleteRoleTemplateOptions deleteRoleTemplateOptionsModel = new DeleteRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .build(); - assertEquals(deleteRoleTemplateOptionsModel.roleTemplateId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleTemplateOptionsError() throws Throwable { - new DeleteRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java deleted file mode 100644 index ff652fa335c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleTemplateVersionOptions model. - */ -public class DeleteRoleTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteRoleTemplateVersionOptions() throws Throwable { - DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptionsModel = new DeleteRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - assertEquals(deleteRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); - assertEquals(deleteRoleTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleTemplateVersionOptionsError() throws Throwable { - new DeleteRoleTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java deleted file mode 100644 index 6a33aa8f116..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteV2PolicyOptions model. - */ -public class DeleteV2PolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteV2PolicyOptions() throws Throwable { - DeleteV2PolicyOptions deleteV2PolicyOptionsModel = new DeleteV2PolicyOptions.Builder() - .id("testString") - .build(); - assertEquals(deleteV2PolicyOptionsModel.id(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteV2PolicyOptionsError() throws Throwable { - new DeleteV2PolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java deleted file mode 100644 index 104a5210ed9..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.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 EnrichedRoles model. - */ -public class EnrichedRolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testEnrichedRoles() throws Throwable { - EnrichedRoles enrichedRolesModel = new EnrichedRoles(); - assertNull(enrichedRolesModel.getRoleId()); - assertNull(enrichedRolesModel.getActions()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java deleted file mode 100644 index 460b37f8105..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.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 ErrorDetails model. - */ -public class ErrorDetailsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testErrorDetails() throws Throwable { - ErrorDetails errorDetailsModel = new ErrorDetails(); - assertNull(errorDetailsModel.getConflictsWith()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java deleted file mode 100644 index e7f7f9afbfc..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.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 ErrorObject model. - */ -public class ErrorObjectTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testErrorObject() throws Throwable { - ErrorObject errorObjectModel = new ErrorObject(); - assertNull(errorObjectModel.getCode()); - assertNull(errorObjectModel.getMessage()); - assertNull(errorObjectModel.getDetails()); - assertNull(errorObjectModel.getMoreInfo()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java deleted file mode 100644 index 90c91c8fcaf..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; -import com.ibm.cloud.platform_services.iam_policy_management.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 ExternalAccountIdentityInteractionPatch model. - */ -public class ExternalAccountIdentityInteractionPatchTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testExternalAccountIdentityInteractionPatch() throws Throwable { - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - assertEquals(identityTypesBaseModel.state(), "enabled"); - assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); - - IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() - .user(identityTypesBaseModel) - .serviceId(identityTypesBaseModel) - .service(identityTypesBaseModel) - .build(); - assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); - - ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() - .identityTypes(identityTypesPatchModel) - .build(); - assertEquals(externalAccountIdentityInteractionPatchModel.identityTypes(), identityTypesPatchModel); - - String json = TestUtilities.serialize(externalAccountIdentityInteractionPatchModel); - - ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModelNew = TestUtilities.deserialize(json, ExternalAccountIdentityInteractionPatch.class); - assertTrue(externalAccountIdentityInteractionPatchModelNew instanceof ExternalAccountIdentityInteractionPatch); - assertEquals(externalAccountIdentityInteractionPatchModelNew.identityTypes().toString(), identityTypesPatchModel.toString()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java deleted file mode 100644 index 2e4aaef7e07..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.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 ExternalAccountIdentityInteraction model. - */ -public class ExternalAccountIdentityInteractionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testExternalAccountIdentityInteraction() throws Throwable { - ExternalAccountIdentityInteraction externalAccountIdentityInteractionModel = new ExternalAccountIdentityInteraction(); - assertNull(externalAccountIdentityInteractionModel.getIdentityTypes()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java deleted file mode 100644 index b4d68673091..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.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 First model. - */ -public class FirstTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testFirst() throws Throwable { - First firstModel = new First(); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java deleted file mode 100644 index 73e66a5a756..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlAssignmentOptions model. - */ -public class GetActionControlAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetActionControlAssignmentOptions() throws Throwable { - GetActionControlAssignmentOptions getActionControlAssignmentOptionsModel = new GetActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(getActionControlAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlAssignmentOptionsError() throws Throwable { - new GetActionControlAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java deleted file mode 100644 index d6e66ce6939..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlTemplateOptions model. - */ -public class GetActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetActionControlTemplateOptions() throws Throwable { - GetActionControlTemplateOptions getActionControlTemplateOptionsModel = new GetActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .build(); - assertEquals(getActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(getActionControlTemplateOptionsModel.state(), "active"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlTemplateOptionsError() throws Throwable { - new GetActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java deleted file mode 100644 index ac8e17fe083..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlTemplateVersionOptions model. - */ -public class GetActionControlTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetActionControlTemplateVersionOptions() throws Throwable { - GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptionsModel = new GetActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - assertEquals(getActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(getActionControlTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlTemplateVersionOptionsError() throws Throwable { - new GetActionControlTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java deleted file mode 100644 index 6b2a479c37d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyAssignmentOptions model. - */ -public class GetPolicyAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetPolicyAssignmentOptions() throws Throwable { - GetPolicyAssignmentOptions getPolicyAssignmentOptionsModel = new GetPolicyAssignmentOptions.Builder() - .assignmentId("testString") - .version("1.0") - .build(); - assertEquals(getPolicyAssignmentOptionsModel.assignmentId(), "testString"); - assertEquals(getPolicyAssignmentOptionsModel.version(), "1.0"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyAssignmentOptionsError() throws Throwable { - new GetPolicyAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java deleted file mode 100644 index 2a7348c2c2d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyOptions model. - */ -public class GetPolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetPolicyOptions() throws Throwable { - GetPolicyOptions getPolicyOptionsModel = new GetPolicyOptions.Builder() - .policyId("testString") - .build(); - assertEquals(getPolicyOptionsModel.policyId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyOptionsError() throws Throwable { - new GetPolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java deleted file mode 100644 index 06535ed77ed..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyTemplateOptions model. - */ -public class GetPolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetPolicyTemplateOptions() throws Throwable { - GetPolicyTemplateOptions getPolicyTemplateOptionsModel = new GetPolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .state("active") - .build(); - assertEquals(getPolicyTemplateOptionsModel.policyTemplateId(), "testString"); - assertEquals(getPolicyTemplateOptionsModel.state(), "active"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyTemplateOptionsError() throws Throwable { - new GetPolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java deleted file mode 100644 index 264b5db4912..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyTemplateVersionOptions model. - */ -public class GetPolicyTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetPolicyTemplateVersionOptions() throws Throwable { - GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptionsModel = new GetPolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - assertEquals(getPolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); - assertEquals(getPolicyTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyTemplateVersionOptionsError() throws Throwable { - new GetPolicyTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java deleted file mode 100644 index 0c1f6b2bb5a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleAssignmentOptions model. - */ -public class GetRoleAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetRoleAssignmentOptions() throws Throwable { - GetRoleAssignmentOptions getRoleAssignmentOptionsModel = new GetRoleAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(getRoleAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleAssignmentOptionsError() throws Throwable { - new GetRoleAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java deleted file mode 100644 index e589b8d1285..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleOptions model. - */ -public class GetRoleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetRoleOptions() throws Throwable { - GetRoleOptions getRoleOptionsModel = new GetRoleOptions.Builder() - .roleId("testString") - .build(); - assertEquals(getRoleOptionsModel.roleId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleOptionsError() throws Throwable { - new GetRoleOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java deleted file mode 100644 index 3c10b5207dc..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleTemplateOptions model. - */ -public class GetRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetRoleTemplateOptions() throws Throwable { - GetRoleTemplateOptions getRoleTemplateOptionsModel = new GetRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .state("active") - .build(); - assertEquals(getRoleTemplateOptionsModel.roleTemplateId(), "testString"); - assertEquals(getRoleTemplateOptionsModel.state(), "active"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleTemplateOptionsError() throws Throwable { - new GetRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java deleted file mode 100644 index 3bd5d278630..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleTemplateVersionOptions model. - */ -public class GetRoleTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetRoleTemplateVersionOptions() throws Throwable { - GetRoleTemplateVersionOptions getRoleTemplateVersionOptionsModel = new GetRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - assertEquals(getRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); - assertEquals(getRoleTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleTemplateVersionOptionsError() throws Throwable { - new GetRoleTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java deleted file mode 100644 index 00f780c4153..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetSettingsOptions model. - */ -public class GetSettingsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetSettingsOptions() throws Throwable { - GetSettingsOptions getSettingsOptionsModel = new GetSettingsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .build(); - assertEquals(getSettingsOptionsModel.accountId(), "testString"); - assertEquals(getSettingsOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetSettingsOptionsError() throws Throwable { - new GetSettingsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java deleted file mode 100644 index ebad7af7371..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetV2PolicyOptions model. - */ -public class GetV2PolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetV2PolicyOptions() throws Throwable { - GetV2PolicyOptions getV2PolicyOptionsModel = new GetV2PolicyOptions.Builder() - .id("testString") - .format("include_last_permit") - .build(); - assertEquals(getV2PolicyOptionsModel.id(), "testString"); - assertEquals(getV2PolicyOptionsModel.format(), "include_last_permit"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetV2PolicyOptionsError() throws Throwable { - new GetV2PolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java deleted file mode 100644 index f627a54ecc2..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 Grant model. - */ -public class GrantTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGrant() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); - - String json = TestUtilities.serialize(grantModel); - - Grant grantModelNew = TestUtilities.deserialize(json, Grant.class); - assertTrue(grantModelNew instanceof Grant); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGrantError() throws Throwable { - new Grant.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java deleted file mode 100644 index f86af34fab8..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.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 GrantWithEnrichedRoles model. - */ -public class GrantWithEnrichedRolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGrantWithEnrichedRoles() throws Throwable { - GrantWithEnrichedRoles grantWithEnrichedRolesModel = new GrantWithEnrichedRoles(); - assertNull(grantWithEnrichedRolesModel.getRoles()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java deleted file mode 100644 index 2a4d38de51a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypesBase model. - */ -public class IdentityTypesBaseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testIdentityTypesBase() throws Throwable { - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - assertEquals(identityTypesBaseModel.state(), "enabled"); - assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(identityTypesBaseModel); - - IdentityTypesBase identityTypesBaseModelNew = TestUtilities.deserialize(json, IdentityTypesBase.class); - assertTrue(identityTypesBaseModelNew instanceof IdentityTypesBase); - assertEquals(identityTypesBaseModelNew.state(), "enabled"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testIdentityTypesBaseError() throws Throwable { - new IdentityTypesBase.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java deleted file mode 100644 index 3e762536695..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; -import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypesPatch model. - */ -public class IdentityTypesPatchTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testIdentityTypesPatch() throws Throwable { - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - assertEquals(identityTypesBaseModel.state(), "enabled"); - assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); - - IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() - .user(identityTypesBaseModel) - .serviceId(identityTypesBaseModel) - .service(identityTypesBaseModel) - .build(); - assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); - - String json = TestUtilities.serialize(identityTypesPatchModel); - - IdentityTypesPatch identityTypesPatchModelNew = TestUtilities.deserialize(json, IdentityTypesPatch.class); - assertTrue(identityTypesPatchModelNew instanceof IdentityTypesPatch); - assertEquals(identityTypesPatchModelNew.user().toString(), identityTypesBaseModel.toString()); - assertEquals(identityTypesPatchModelNew.serviceId().toString(), identityTypesBaseModel.toString()); - assertEquals(identityTypesPatchModelNew.service().toString(), identityTypesBaseModel.toString()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java deleted file mode 100644 index e2b6c77338f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypes model. - */ -public class IdentityTypesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testIdentityTypes() throws Throwable { - IdentityTypes identityTypesModel = new IdentityTypes(); - assertNull(identityTypesModel.getUser()); - assertNull(identityTypesModel.getServiceId()); - assertNull(identityTypesModel.getService()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java deleted file mode 100644 index c3f51516e25..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; -import com.ibm.cloud.platform_services.iam_policy_management.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 LimitData model. - */ -public class LimitDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testLimitData() throws Throwable { - LimitData limitDataModel = new LimitData(); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java deleted file mode 100644 index 0d64653d829..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlAssignmentsOptions model. - */ -public class ListActionControlAssignmentsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListActionControlAssignmentsOptions() throws Throwable { - ListActionControlAssignmentsOptions listActionControlAssignmentsOptionsModel = new ListActionControlAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listActionControlAssignmentsOptionsModel.accountId(), "testString"); - assertEquals(listActionControlAssignmentsOptionsModel.acceptLanguage(), "default"); - assertEquals(listActionControlAssignmentsOptionsModel.templateId(), "testString"); - assertEquals(listActionControlAssignmentsOptionsModel.templateVersion(), "testString"); - assertEquals(listActionControlAssignmentsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listActionControlAssignmentsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlAssignmentsOptionsError() throws Throwable { - new ListActionControlAssignmentsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java deleted file mode 100644 index dfe91662d83..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlTemplateVersionsOptions model. - */ -public class ListActionControlTemplateVersionsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListActionControlTemplateVersionsOptions() throws Throwable { - ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptionsModel = new ListActionControlTemplateVersionsOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listActionControlTemplateVersionsOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(listActionControlTemplateVersionsOptionsModel.state(), "active"); - assertEquals(listActionControlTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listActionControlTemplateVersionsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlTemplateVersionsOptionsError() throws Throwable { - new ListActionControlTemplateVersionsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java deleted file mode 100644 index 9e2e6a18158..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlTemplatesOptions model. - */ -public class ListActionControlTemplatesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListActionControlTemplatesOptions() throws Throwable { - ListActionControlTemplatesOptions listActionControlTemplatesOptionsModel = new ListActionControlTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listActionControlTemplatesOptionsModel.accountId(), "testString"); - assertEquals(listActionControlTemplatesOptionsModel.acceptLanguage(), "default"); - assertEquals(listActionControlTemplatesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listActionControlTemplatesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlTemplatesOptionsError() throws Throwable { - new ListActionControlTemplatesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java deleted file mode 100644 index 8bfe5000355..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListPoliciesOptions model. - */ -public class ListPoliciesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListPoliciesOptions() throws Throwable { - ListPoliciesOptions listPoliciesOptionsModel = new ListPoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .tagName("testString") - .tagValue("testString") - .sort("id") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listPoliciesOptionsModel.accountId(), "testString"); - assertEquals(listPoliciesOptionsModel.acceptLanguage(), "default"); - assertEquals(listPoliciesOptionsModel.iamId(), "testString"); - assertEquals(listPoliciesOptionsModel.accessGroupId(), "testString"); - assertEquals(listPoliciesOptionsModel.type(), "access"); - assertEquals(listPoliciesOptionsModel.serviceType(), "service"); - assertEquals(listPoliciesOptionsModel.tagName(), "testString"); - assertEquals(listPoliciesOptionsModel.tagValue(), "testString"); - assertEquals(listPoliciesOptionsModel.sort(), "id"); - assertEquals(listPoliciesOptionsModel.format(), "include_last_permit"); - assertEquals(listPoliciesOptionsModel.state(), "active"); - assertEquals(listPoliciesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listPoliciesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPoliciesOptionsError() throws Throwable { - new ListPoliciesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java deleted file mode 100644 index 32729befeda..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyAssignmentsOptions model. - */ -public class ListPolicyAssignmentsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListPolicyAssignmentsOptions() throws Throwable { - ListPolicyAssignmentsOptions listPolicyAssignmentsOptionsModel = new ListPolicyAssignmentsOptions.Builder() - .version("1.0") - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listPolicyAssignmentsOptionsModel.version(), "1.0"); - assertEquals(listPolicyAssignmentsOptionsModel.accountId(), "testString"); - assertEquals(listPolicyAssignmentsOptionsModel.acceptLanguage(), "default"); - assertEquals(listPolicyAssignmentsOptionsModel.templateId(), "testString"); - assertEquals(listPolicyAssignmentsOptionsModel.templateVersion(), "testString"); - assertEquals(listPolicyAssignmentsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listPolicyAssignmentsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyAssignmentsOptionsError() throws Throwable { - new ListPolicyAssignmentsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java deleted file mode 100644 index 1053d41b84b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyTemplateVersionsOptions model. - */ -public class ListPolicyTemplateVersionsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListPolicyTemplateVersionsOptions() throws Throwable { - ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptionsModel = new ListPolicyTemplateVersionsOptions.Builder() - .policyTemplateId("testString") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listPolicyTemplateVersionsOptionsModel.policyTemplateId(), "testString"); - assertEquals(listPolicyTemplateVersionsOptionsModel.state(), "active"); - assertEquals(listPolicyTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listPolicyTemplateVersionsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyTemplateVersionsOptionsError() throws Throwable { - new ListPolicyTemplateVersionsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java deleted file mode 100644 index 5065a9d9495..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyTemplatesOptions model. - */ -public class ListPolicyTemplatesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListPolicyTemplatesOptions() throws Throwable { - ListPolicyTemplatesOptions listPolicyTemplatesOptionsModel = new ListPolicyTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .state("active") - .name("testString") - .policyServiceType("service") - .policyServiceName("testString") - .policyServiceGroupId("testString") - .policyType("access") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listPolicyTemplatesOptionsModel.accountId(), "testString"); - assertEquals(listPolicyTemplatesOptionsModel.acceptLanguage(), "default"); - assertEquals(listPolicyTemplatesOptionsModel.state(), "active"); - assertEquals(listPolicyTemplatesOptionsModel.name(), "testString"); - assertEquals(listPolicyTemplatesOptionsModel.policyServiceType(), "service"); - assertEquals(listPolicyTemplatesOptionsModel.policyServiceName(), "testString"); - assertEquals(listPolicyTemplatesOptionsModel.policyServiceGroupId(), "testString"); - assertEquals(listPolicyTemplatesOptionsModel.policyType(), "access"); - assertEquals(listPolicyTemplatesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listPolicyTemplatesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyTemplatesOptionsError() throws Throwable { - new ListPolicyTemplatesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java deleted file mode 100644 index bd82df9bfd5..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleAssignmentsOptions model. - */ -public class ListRoleAssignmentsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListRoleAssignmentsOptions() throws Throwable { - ListRoleAssignmentsOptions listRoleAssignmentsOptionsModel = new ListRoleAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listRoleAssignmentsOptionsModel.accountId(), "testString"); - assertEquals(listRoleAssignmentsOptionsModel.acceptLanguage(), "default"); - assertEquals(listRoleAssignmentsOptionsModel.templateId(), "testString"); - assertEquals(listRoleAssignmentsOptionsModel.templateVersion(), "testString"); - assertEquals(listRoleAssignmentsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listRoleAssignmentsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleAssignmentsOptionsError() throws Throwable { - new ListRoleAssignmentsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java deleted file mode 100644 index 2e89527b653..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleTemplateVersionsOptions model. - */ -public class ListRoleTemplateVersionsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListRoleTemplateVersionsOptions() throws Throwable { - ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptionsModel = new ListRoleTemplateVersionsOptions.Builder() - .roleTemplateId("testString") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listRoleTemplateVersionsOptionsModel.roleTemplateId(), "testString"); - assertEquals(listRoleTemplateVersionsOptionsModel.state(), "active"); - assertEquals(listRoleTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listRoleTemplateVersionsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleTemplateVersionsOptionsError() throws Throwable { - new ListRoleTemplateVersionsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java deleted file mode 100644 index 21d23a7be0f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleTemplatesOptions model. - */ -public class ListRoleTemplatesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListRoleTemplatesOptions() throws Throwable { - ListRoleTemplatesOptions listRoleTemplatesOptionsModel = new ListRoleTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .name("testString") - .roleName("testString") - .roleServiceName("testString") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listRoleTemplatesOptionsModel.accountId(), "testString"); - assertEquals(listRoleTemplatesOptionsModel.acceptLanguage(), "default"); - assertEquals(listRoleTemplatesOptionsModel.name(), "testString"); - assertEquals(listRoleTemplatesOptionsModel.roleName(), "testString"); - assertEquals(listRoleTemplatesOptionsModel.roleServiceName(), "testString"); - assertEquals(listRoleTemplatesOptionsModel.state(), "active"); - assertEquals(listRoleTemplatesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listRoleTemplatesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleTemplatesOptionsError() throws Throwable { - new ListRoleTemplatesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java deleted file mode 100644 index 4fb97c7fc9a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListRolesOptions model. - */ -public class ListRolesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListRolesOptions() throws Throwable { - ListRolesOptions listRolesOptionsModel = new ListRolesOptions.Builder() - .acceptLanguage("default") - .accountId("testString") - .serviceName("iam-groups") - .sourceServiceName("iam-groups") - .policyType("authorization") - .serviceGroupId("IAM") - .build(); - assertEquals(listRolesOptionsModel.acceptLanguage(), "default"); - assertEquals(listRolesOptionsModel.accountId(), "testString"); - assertEquals(listRolesOptionsModel.serviceName(), "iam-groups"); - assertEquals(listRolesOptionsModel.sourceServiceName(), "iam-groups"); - assertEquals(listRolesOptionsModel.policyType(), "authorization"); - assertEquals(listRolesOptionsModel.serviceGroupId(), "IAM"); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java deleted file mode 100644 index 8c72945373b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListV2PoliciesOptions model. - */ -public class ListV2PoliciesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListV2PoliciesOptions() throws Throwable { - ListV2PoliciesOptions listV2PoliciesOptionsModel = new ListV2PoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .serviceName("testString") - .serviceGroupId("testString") - .sort("testString") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listV2PoliciesOptionsModel.accountId(), "testString"); - assertEquals(listV2PoliciesOptionsModel.acceptLanguage(), "default"); - assertEquals(listV2PoliciesOptionsModel.iamId(), "testString"); - assertEquals(listV2PoliciesOptionsModel.accessGroupId(), "testString"); - assertEquals(listV2PoliciesOptionsModel.type(), "access"); - assertEquals(listV2PoliciesOptionsModel.serviceType(), "service"); - assertEquals(listV2PoliciesOptionsModel.serviceName(), "testString"); - assertEquals(listV2PoliciesOptionsModel.serviceGroupId(), "testString"); - assertEquals(listV2PoliciesOptionsModel.sort(), "testString"); - assertEquals(listV2PoliciesOptionsModel.format(), "include_last_permit"); - assertEquals(listV2PoliciesOptionsModel.state(), "active"); - assertEquals(listV2PoliciesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listV2PoliciesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListV2PoliciesOptionsError() throws Throwable { - new ListV2PoliciesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java deleted file mode 100644 index 0661d4245a2..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 NestedConditionRuleAttribute model. - */ -public class NestedConditionRuleAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNestedConditionRuleAttribute() throws Throwable { - NestedConditionRuleAttribute nestedConditionRuleAttributeModel = new NestedConditionRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(nestedConditionRuleAttributeModel.key(), "testString"); - assertEquals(nestedConditionRuleAttributeModel.operator(), "stringEquals"); - assertEquals(nestedConditionRuleAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(nestedConditionRuleAttributeModel); - - NestedConditionRuleAttribute nestedConditionRuleAttributeModelNew = TestUtilities.deserialize(json, NestedConditionRuleAttribute.class); - assertTrue(nestedConditionRuleAttributeModelNew instanceof NestedConditionRuleAttribute); - assertEquals(nestedConditionRuleAttributeModelNew.key(), "testString"); - assertEquals(nestedConditionRuleAttributeModelNew.operator(), "stringEquals"); - assertEquals(nestedConditionRuleAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testNestedConditionRuleAttributeError() throws Throwable { - new NestedConditionRuleAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java deleted file mode 100644 index 1ba394dbb7d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleWithConditions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 NestedConditionRuleWithConditions model. - */ -public class NestedConditionRuleWithConditionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNestedConditionRuleWithConditions() throws Throwable { - RuleAttribute ruleAttributeModel = new RuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(ruleAttributeModel.key(), "testString"); - assertEquals(ruleAttributeModel.operator(), "stringEquals"); - assertEquals(ruleAttributeModel.value(), "testString"); - - NestedConditionRuleWithConditions nestedConditionRuleWithConditionsModel = new NestedConditionRuleWithConditions.Builder() - .operator("and") - .conditions(java.util.Arrays.asList(ruleAttributeModel)) - .build(); - assertEquals(nestedConditionRuleWithConditionsModel.operator(), "and"); - assertEquals(nestedConditionRuleWithConditionsModel.conditions(), java.util.Arrays.asList(ruleAttributeModel)); - - String json = TestUtilities.serialize(nestedConditionRuleWithConditionsModel); - - NestedConditionRuleWithConditions nestedConditionRuleWithConditionsModelNew = TestUtilities.deserialize(json, NestedConditionRuleWithConditions.class); - assertTrue(nestedConditionRuleWithConditionsModelNew instanceof NestedConditionRuleWithConditions); - assertEquals(nestedConditionRuleWithConditionsModelNew.operator(), "and"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testNestedConditionRuleWithConditionsError() throws Throwable { - new NestedConditionRuleWithConditions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java deleted file mode 100644 index 4956eea2675..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedCondition; -import com.ibm.cloud.platform_services.iam_policy_management.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 NestedCondition model. - */ -public class NestedConditionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testNestedCondition() throws Throwable { - NestedCondition nestedConditionModel = new NestedCondition(); - assertNotNull(nestedConditionModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java deleted file mode 100644 index c5e084a44d5..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.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 Next model. - */ -public class NextTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNext() throws Throwable { - Next nextModel = new Next(); - assertNull(nextModel.getStart()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java deleted file mode 100644 index d5b05ede760..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentResourcePolicy model. - */ -public class PolicyAssignmentResourcePolicyTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentResourcePolicy() throws Throwable { - PolicyAssignmentResourcePolicy policyAssignmentResourcePolicyModel = new PolicyAssignmentResourcePolicy(); - assertNull(policyAssignmentResourcePolicyModel.getResourceCreated()); - assertNull(policyAssignmentResourcePolicyModel.getStatus()); - assertNull(policyAssignmentResourcePolicyModel.getErrorMessage()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java deleted file mode 100644 index 8b146425617..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentResources model. - */ -public class PolicyAssignmentResourcesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentResources() throws Throwable { - PolicyAssignmentResources policyAssignmentResourcesModel = new PolicyAssignmentResources(); - assertNull(policyAssignmentResourcesModel.getTarget()); - assertNull(policyAssignmentResourcesModel.getPolicy()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java deleted file mode 100644 index 8a3a6b67703..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Collection model. - */ -public class PolicyAssignmentV1CollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentV1Collection() throws Throwable { - PolicyAssignmentV1Collection policyAssignmentV1CollectionModel = new PolicyAssignmentV1Collection(); - assertNull(policyAssignmentV1CollectionModel.getLimit()); - assertNull(policyAssignmentV1CollectionModel.getFirst()); - assertNull(policyAssignmentV1CollectionModel.getNext()); - assertNull(policyAssignmentV1CollectionModel.getPrevious()); - assertNull(policyAssignmentV1CollectionModel.getAssignments()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java deleted file mode 100644 index 56c843a232e..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Resources model. - */ -public class PolicyAssignmentV1ResourcesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentV1Resources() throws Throwable { - PolicyAssignmentV1Resources policyAssignmentV1ResourcesModel = new PolicyAssignmentV1Resources(); - assertNull(policyAssignmentV1ResourcesModel.getTarget()); - assertNull(policyAssignmentV1ResourcesModel.getPolicy()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java deleted file mode 100644 index f5d14b29447..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Subject model. - */ -public class PolicyAssignmentV1SubjectTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentV1Subject() throws Throwable { - PolicyAssignmentV1Subject policyAssignmentV1SubjectModel = new PolicyAssignmentV1Subject(); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java deleted file mode 100644 index d9889483421..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1 model. - */ -public class PolicyAssignmentV1Test { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentV1() throws Throwable { - PolicyAssignmentV1 policyAssignmentV1Model = new PolicyAssignmentV1(); - assertNull(policyAssignmentV1Model.getTarget()); - assertNull(policyAssignmentV1Model.getResources()); - assertNull(policyAssignmentV1Model.getSubject()); - assertNull(policyAssignmentV1Model.getTemplate()); - assertNull(policyAssignmentV1Model.getStatus()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java deleted file mode 100644 index 3d372dfaf20..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyCollection model. - */ -public class PolicyCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyCollection() throws Throwable { - PolicyCollection policyCollectionModel = new PolicyCollection(); - assertNull(policyCollectionModel.getLimit()); - assertNull(policyCollectionModel.getFirst()); - assertNull(policyCollectionModel.getNext()); - assertNull(policyCollectionModel.getPrevious()); - assertNull(policyCollectionModel.getPolicies()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java deleted file mode 100644 index cb2f203a5c3..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyResource model. - */ -public class PolicyResourceTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyResource() throws Throwable { - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceAttributeModel.name(), "testString"); - assertEquals(resourceAttributeModel.value(), "testString"); - assertEquals(resourceAttributeModel.operator(), "testString"); - - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceTagModel.name(), "testString"); - assertEquals(resourceTagModel.value(), "testString"); - assertEquals(resourceTagModel.operator(), "testString"); - - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); - assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); - - String json = TestUtilities.serialize(policyResourceModel); - - PolicyResource policyResourceModelNew = TestUtilities.deserialize(json, PolicyResource.class); - assertTrue(policyResourceModelNew instanceof PolicyResource); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testPolicyResourceError() throws Throwable { - new PolicyResource.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java deleted file mode 100644 index 299e15b1fd4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyRole model. - */ -public class PolicyRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyRole() throws Throwable { - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - assertEquals(policyRoleModel.roleId(), "testString"); - - String json = TestUtilities.serialize(policyRoleModel); - - PolicyRole policyRoleModelNew = TestUtilities.deserialize(json, PolicyRole.class); - assertTrue(policyRoleModelNew instanceof PolicyRole); - assertEquals(policyRoleModelNew.roleId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testPolicyRoleError() throws Throwable { - new PolicyRole.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java deleted file mode 100644 index 6d0a937bd53..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicySubject model. - */ -public class PolicySubjectTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicySubject() throws Throwable { - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - assertEquals(subjectAttributeModel.name(), "testString"); - assertEquals(subjectAttributeModel.value(), "testString"); - - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); - - String json = TestUtilities.serialize(policySubjectModel); - - PolicySubject policySubjectModelNew = TestUtilities.deserialize(json, PolicySubject.class); - assertTrue(policySubjectModelNew instanceof PolicySubject); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testPolicySubjectError() throws Throwable { - new PolicySubject.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java deleted file mode 100644 index 8cb98be3d32..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentCollection model. - */ -public class PolicyTemplateAssignmentCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateAssignmentCollection() throws Throwable { - PolicyTemplateAssignmentCollection policyTemplateAssignmentCollectionModel = new PolicyTemplateAssignmentCollection(); - assertNull(policyTemplateAssignmentCollectionModel.getLimit()); - assertNull(policyTemplateAssignmentCollectionModel.getFirst()); - assertNull(policyTemplateAssignmentCollectionModel.getNext()); - assertNull(policyTemplateAssignmentCollectionModel.getPrevious()); - assertNull(policyTemplateAssignmentCollectionModel.getAssignments()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java deleted file mode 100644 index fded12633d2..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItemsPolicyAssignment model. - */ -public class PolicyTemplateAssignmentItemsPolicyAssignmentTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateAssignmentItemsPolicyAssignment() throws Throwable { - PolicyTemplateAssignmentItemsPolicyAssignment policyTemplateAssignmentItemsPolicyAssignmentModel = new PolicyTemplateAssignmentItemsPolicyAssignment(); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTemplateId()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTemplateVersion()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getAssignmentId()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTargetType()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTarget()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getResources()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getStatus()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java deleted file mode 100644 index 6b74125d238..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItemsPolicyAssignmentV1 model. - */ -public class PolicyTemplateAssignmentItemsPolicyAssignmentV1Test { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateAssignmentItemsPolicyAssignmentV1() throws Throwable { - PolicyTemplateAssignmentItemsPolicyAssignmentV1 policyTemplateAssignmentItemsPolicyAssignmentV1Model = new PolicyTemplateAssignmentItemsPolicyAssignmentV1(); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getTarget()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getResources()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getSubject()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getTemplate()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getStatus()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java deleted file mode 100644 index 05b400e91c1..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItems model. - */ -public class PolicyTemplateAssignmentItemsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testPolicyTemplateAssignmentItems() throws Throwable { - PolicyTemplateAssignmentItems policyTemplateAssignmentItemsModel = new PolicyTemplateAssignmentItems(); - assertNotNull(policyTemplateAssignmentItemsModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java deleted file mode 100644 index 52041b1a6a3..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateCollection model. - */ -public class PolicyTemplateCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateCollection() throws Throwable { - PolicyTemplateCollection policyTemplateCollectionModel = new PolicyTemplateCollection(); - assertNull(policyTemplateCollectionModel.getLimit()); - assertNull(policyTemplateCollectionModel.getFirst()); - assertNull(policyTemplateCollectionModel.getNext()); - assertNull(policyTemplateCollectionModel.getPrevious()); - assertNull(policyTemplateCollectionModel.getPolicyTemplates()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java deleted file mode 100644 index b6ee06990a2..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateLimitData model. - */ -public class PolicyTemplateLimitDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateLimitData() throws Throwable { - PolicyTemplateLimitData policyTemplateLimitDataModel = new PolicyTemplateLimitData(); - assertNull(policyTemplateLimitDataModel.getName()); - assertNull(policyTemplateLimitDataModel.getDescription()); - assertNull(policyTemplateLimitDataModel.getAccountId()); - assertNull(policyTemplateLimitDataModel.getVersion()); - assertNull(policyTemplateLimitDataModel.isCommitted()); - assertNull(policyTemplateLimitDataModel.getPolicy()); - assertNull(policyTemplateLimitDataModel.getState()); - assertNull(policyTemplateLimitDataModel.getCounts()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java deleted file mode 100644 index edeb45c4d96..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateMetaData model. - */ -public class PolicyTemplateMetaDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateMetaData() throws Throwable { - PolicyTemplateMetaData policyTemplateMetaDataModel = new PolicyTemplateMetaData(); - assertNull(policyTemplateMetaDataModel.getType()); - assertNull(policyTemplateMetaDataModel.getDescription()); - assertNull(policyTemplateMetaDataModel.getSubjects()); - assertNull(policyTemplateMetaDataModel.getRoles()); - assertNull(policyTemplateMetaDataModel.getResources()); - assertNull(policyTemplateMetaDataModel.getState()); - assertNull(policyTemplateMetaDataModel.getTemplate()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java deleted file mode 100644 index c349e4a3415..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplate model. - */ -public class PolicyTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplate() throws Throwable { - PolicyTemplate policyTemplateModel = new PolicyTemplate(); - assertNull(policyTemplateModel.getName()); - assertNull(policyTemplateModel.getDescription()); - assertNull(policyTemplateModel.getAccountId()); - assertNull(policyTemplateModel.getVersion()); - assertNull(policyTemplateModel.isCommitted()); - assertNull(policyTemplateModel.getPolicy()); - assertNull(policyTemplateModel.getState()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java deleted file mode 100644 index da651956461..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateVersionsCollection model. - */ -public class PolicyTemplateVersionsCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateVersionsCollection() throws Throwable { - PolicyTemplateVersionsCollection policyTemplateVersionsCollectionModel = new PolicyTemplateVersionsCollection(); - assertNull(policyTemplateVersionsCollectionModel.getLimit()); - assertNull(policyTemplateVersionsCollectionModel.getFirst()); - assertNull(policyTemplateVersionsCollectionModel.getNext()); - assertNull(policyTemplateVersionsCollectionModel.getPrevious()); - assertNull(policyTemplateVersionsCollectionModel.getVersions()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java deleted file mode 100644 index 28eba4f9a85..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 Policy model. - */ -public class PolicyTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicy() throws Throwable { - Policy policyModel = new Policy(); - assertNull(policyModel.getType()); - assertNull(policyModel.getDescription()); - assertNull(policyModel.getSubjects()); - assertNull(policyModel.getRoles()); - assertNull(policyModel.getResources()); - assertNull(policyModel.getState()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java deleted file mode 100644 index e3788c51212..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.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 Previous model. - */ -public class PreviousTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPrevious() throws Throwable { - Previous previousModel = new Previous(); - assertNull(previousModel.getStart()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java deleted file mode 100644 index 430f5f63764..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceActionControlTemplateOptions model. - */ -public class ReplaceActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplaceActionControlTemplateOptions() throws Throwable { - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateActionControlModel.serviceName(), "testString"); - assertEquals(templateActionControlModel.description(), "testString"); - assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); - - ReplaceActionControlTemplateOptions replaceActionControlTemplateOptionsModel = new ReplaceActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .ifMatch("testString") - .name("testString") - .description("testString") - .actionControl(templateActionControlModel) - .committed(true) - .build(); - assertEquals(replaceActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.version(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.ifMatch(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.name(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.description(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.actionControl(), templateActionControlModel); - assertEquals(replaceActionControlTemplateOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceActionControlTemplateOptionsError() throws Throwable { - new ReplaceActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java deleted file mode 100644 index 2f20b05f37c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplacePolicyOptions model. - */ -public class ReplacePolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplacePolicyOptions() throws Throwable { - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - assertEquals(subjectAttributeModel.name(), "testString"); - assertEquals(subjectAttributeModel.value(), "testString"); - - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); - - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - assertEquals(policyRoleModel.roleId(), "testString"); - - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceAttributeModel.name(), "testString"); - assertEquals(resourceAttributeModel.value(), "testString"); - assertEquals(resourceAttributeModel.operator(), "testString"); - - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceTagModel.name(), "testString"); - assertEquals(resourceTagModel.value(), "testString"); - assertEquals(resourceTagModel.operator(), "testString"); - - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); - assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); - - ReplacePolicyOptions replacePolicyOptionsModel = new ReplacePolicyOptions.Builder() - .policyId("testString") - .ifMatch("testString") - .type("testString") - .subjects(java.util.Arrays.asList(policySubjectModel)) - .roles(java.util.Arrays.asList(policyRoleModel)) - .resources(java.util.Arrays.asList(policyResourceModel)) - .description("testString") - .build(); - assertEquals(replacePolicyOptionsModel.policyId(), "testString"); - assertEquals(replacePolicyOptionsModel.ifMatch(), "testString"); - assertEquals(replacePolicyOptionsModel.type(), "testString"); - assertEquals(replacePolicyOptionsModel.subjects(), java.util.Arrays.asList(policySubjectModel)); - assertEquals(replacePolicyOptionsModel.roles(), java.util.Arrays.asList(policyRoleModel)); - assertEquals(replacePolicyOptionsModel.resources(), java.util.Arrays.asList(policyResourceModel)); - assertEquals(replacePolicyOptionsModel.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplacePolicyOptionsError() throws Throwable { - new ReplacePolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java deleted file mode 100644 index 2dc2430daca..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplacePolicyTemplateOptions model. - */ -public class ReplacePolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplacePolicyTemplateOptions() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - assertEquals(templatePolicyModel.type(), "access"); - assertEquals(templatePolicyModel.description(), "testString"); - assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); - assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); - assertEquals(templatePolicyModel.pattern(), "testString"); - assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), templateControlModel); - - ReplacePolicyTemplateOptions replacePolicyTemplateOptionsModel = new ReplacePolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .ifMatch("testString") - .policy(templatePolicyModel) - .name("testString") - .description("testString") - .committed(true) - .build(); - assertEquals(replacePolicyTemplateOptionsModel.policyTemplateId(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.version(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.ifMatch(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.policy(), templatePolicyModel); - assertEquals(replacePolicyTemplateOptionsModel.name(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.description(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplacePolicyTemplateOptionsError() throws Throwable { - new ReplacePolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java deleted file mode 100644 index 9900abb2543..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceRoleOptions model. - */ -public class ReplaceRoleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplaceRoleOptions() throws Throwable { - ReplaceRoleOptions replaceRoleOptionsModel = new ReplaceRoleOptions.Builder() - .roleId("testString") - .ifMatch("testString") - .displayName("testString") - .actions(java.util.Arrays.asList("testString")) - .description("testString") - .build(); - assertEquals(replaceRoleOptionsModel.roleId(), "testString"); - assertEquals(replaceRoleOptionsModel.ifMatch(), "testString"); - assertEquals(replaceRoleOptionsModel.displayName(), "testString"); - assertEquals(replaceRoleOptionsModel.actions(), java.util.Arrays.asList("testString")); - assertEquals(replaceRoleOptionsModel.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceRoleOptionsError() throws Throwable { - new ReplaceRoleOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java deleted file mode 100644 index 2f731aea7d4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceRoleTemplateOptions model. - */ -public class ReplaceRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplaceRoleTemplateOptions() throws Throwable { - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateRoleModel.displayName(), "testString"); - assertEquals(templateRoleModel.serviceName(), "testString"); - assertEquals(templateRoleModel.description(), "testString"); - assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); - - ReplaceRoleTemplateOptions replaceRoleTemplateOptionsModel = new ReplaceRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .ifMatch("testString") - .name("testString") - .description("testString") - .role(templateRoleModel) - .committed(true) - .build(); - assertEquals(replaceRoleTemplateOptionsModel.roleTemplateId(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.version(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.ifMatch(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.name(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.description(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.role(), templateRoleModel); - assertEquals(replaceRoleTemplateOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceRoleTemplateOptionsError() throws Throwable { - new ReplaceRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java deleted file mode 100644 index 23690eda780..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceV2PolicyOptions model. - */ -public class ReplaceV2PolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplaceV2PolicyOptions() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); - - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - assertEquals(controlModel.grant(), grantModel); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - ReplaceV2PolicyOptions replaceV2PolicyOptionsModel = new ReplaceV2PolicyOptions.Builder() - .id("testString") - .ifMatch("testString") - .control(controlModel) - .type("access") - .description("testString") - .subject(v2PolicySubjectModel) - .resource(v2PolicyResourceModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .build(); - assertEquals(replaceV2PolicyOptionsModel.id(), "testString"); - assertEquals(replaceV2PolicyOptionsModel.ifMatch(), "testString"); - assertEquals(replaceV2PolicyOptionsModel.control(), controlModel); - assertEquals(replaceV2PolicyOptionsModel.type(), "access"); - assertEquals(replaceV2PolicyOptionsModel.description(), "testString"); - assertEquals(replaceV2PolicyOptionsModel.subject(), v2PolicySubjectModel); - assertEquals(replaceV2PolicyOptionsModel.resource(), v2PolicyResourceModel); - assertEquals(replaceV2PolicyOptionsModel.pattern(), "testString"); - assertEquals(replaceV2PolicyOptionsModel.rule(), v2PolicyRuleModel); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceV2PolicyOptionsError() throws Throwable { - new ReplaceV2PolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java deleted file mode 100644 index bd50b514f43..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 ResourceAttribute model. - */ -public class ResourceAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testResourceAttribute() throws Throwable { - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceAttributeModel.name(), "testString"); - assertEquals(resourceAttributeModel.value(), "testString"); - assertEquals(resourceAttributeModel.operator(), "testString"); - - String json = TestUtilities.serialize(resourceAttributeModel); - - ResourceAttribute resourceAttributeModelNew = TestUtilities.deserialize(json, ResourceAttribute.class); - assertTrue(resourceAttributeModelNew instanceof ResourceAttribute); - assertEquals(resourceAttributeModelNew.name(), "testString"); - assertEquals(resourceAttributeModelNew.value(), "testString"); - assertEquals(resourceAttributeModelNew.operator(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testResourceAttributeError() throws Throwable { - new ResourceAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java deleted file mode 100644 index 88a1eb5d5b6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.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 ResourceTag model. - */ -public class ResourceTagTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testResourceTag() throws Throwable { - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceTagModel.name(), "testString"); - assertEquals(resourceTagModel.value(), "testString"); - assertEquals(resourceTagModel.operator(), "testString"); - - String json = TestUtilities.serialize(resourceTagModel); - - ResourceTag resourceTagModelNew = TestUtilities.deserialize(json, ResourceTag.class); - assertTrue(resourceTagModelNew instanceof ResourceTag); - assertEquals(resourceTagModelNew.name(), "testString"); - assertEquals(resourceTagModelNew.value(), "testString"); - assertEquals(resourceTagModelNew.operator(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testResourceTagError() throws Throwable { - new ResourceTag.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java deleted file mode 100644 index e4c0bcc6f92..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAction model. - */ -public class RoleActionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAction() throws Throwable { - RoleAction roleActionModel = new RoleAction(); - assertNull(roleActionModel.getId()); - assertNull(roleActionModel.getDisplayName()); - assertNull(roleActionModel.getDescription()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java deleted file mode 100644 index 42801bc7771..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentCollection model. - */ -public class RoleAssignmentCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentCollection() throws Throwable { - RoleAssignmentCollection roleAssignmentCollectionModel = new RoleAssignmentCollection(); - assertNull(roleAssignmentCollectionModel.getLimit()); - assertNull(roleAssignmentCollectionModel.getFirst()); - assertNull(roleAssignmentCollectionModel.getNext()); - assertNull(roleAssignmentCollectionModel.getPrevious()); - assertNull(roleAssignmentCollectionModel.getAssignments()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java deleted file mode 100644 index bef8b71b0fa..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResourceCreated model. - */ -public class RoleAssignmentResourceCreatedTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentResourceCreated() throws Throwable { - RoleAssignmentResourceCreated roleAssignmentResourceCreatedModel = new RoleAssignmentResourceCreated(); - assertNull(roleAssignmentResourceCreatedModel.getId()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java deleted file mode 100644 index c346ca0f48f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResourceRole model. - */ -public class RoleAssignmentResourceRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentResourceRole() throws Throwable { - RoleAssignmentResourceRole roleAssignmentResourceRoleModel = new RoleAssignmentResourceRole(); - assertNull(roleAssignmentResourceRoleModel.getResourceCreated()); - assertNull(roleAssignmentResourceRoleModel.getErrorMessage()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java deleted file mode 100644 index 4fca1b25b5b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResource model. - */ -public class RoleAssignmentResourceTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentResource() throws Throwable { - RoleAssignmentResource roleAssignmentResourceModel = new RoleAssignmentResource(); - assertNull(roleAssignmentResourceModel.getTarget()); - assertNull(roleAssignmentResourceModel.getRole()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java deleted file mode 100644 index 4f2e3a37200..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentTemplate model. - */ -public class RoleAssignmentTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentTemplate() throws Throwable { - RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(roleAssignmentTemplateModel.id(), "testString"); - assertEquals(roleAssignmentTemplateModel.version(), "testString"); - - String json = TestUtilities.serialize(roleAssignmentTemplateModel); - - RoleAssignmentTemplate roleAssignmentTemplateModelNew = TestUtilities.deserialize(json, RoleAssignmentTemplate.class); - assertTrue(roleAssignmentTemplateModelNew instanceof RoleAssignmentTemplate); - assertEquals(roleAssignmentTemplateModelNew.id(), "testString"); - assertEquals(roleAssignmentTemplateModelNew.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRoleAssignmentTemplateError() throws Throwable { - new RoleAssignmentTemplate.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java deleted file mode 100644 index bd3bda7ce24..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignment model. - */ -public class RoleAssignmentTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignment() throws Throwable { - RoleAssignment roleAssignmentModel = new RoleAssignment(); - assertNull(roleAssignmentModel.getTemplate()); - assertNull(roleAssignmentModel.getTarget()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java deleted file mode 100644 index 812c2dcb131..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleCollection model. - */ -public class RoleCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleCollection() throws Throwable { - RoleCollection roleCollectionModel = new RoleCollection(); - assertNull(roleCollectionModel.getCustomRoles()); - assertNull(roleCollectionModel.getServiceRoles()); - assertNull(roleCollectionModel.getSystemRoles()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java deleted file mode 100644 index fde4d11ff4c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateCollection model. - */ -public class RoleTemplateCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplateCollection() throws Throwable { - RoleTemplateCollection roleTemplateCollectionModel = new RoleTemplateCollection(); - assertNull(roleTemplateCollectionModel.getLimit()); - assertNull(roleTemplateCollectionModel.getFirst()); - assertNull(roleTemplateCollectionModel.getNext()); - assertNull(roleTemplateCollectionModel.getPrevious()); - assertNull(roleTemplateCollectionModel.getRoleTemplates()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java deleted file mode 100644 index 6c208e1c38f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplatePrototypeRole model. - */ -public class RoleTemplatePrototypeRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplatePrototypeRole() throws Throwable { - RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() - .name("testString") - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(roleTemplatePrototypeRoleModel.name(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.displayName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.serviceName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.description(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.actions(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(roleTemplatePrototypeRoleModel); - - RoleTemplatePrototypeRole roleTemplatePrototypeRoleModelNew = TestUtilities.deserialize(json, RoleTemplatePrototypeRole.class); - assertTrue(roleTemplatePrototypeRoleModelNew instanceof RoleTemplatePrototypeRole); - assertEquals(roleTemplatePrototypeRoleModelNew.name(), "testString"); - assertEquals(roleTemplatePrototypeRoleModelNew.displayName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModelNew.serviceName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModelNew.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRoleTemplatePrototypeRoleError() throws Throwable { - new RoleTemplatePrototypeRole.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java deleted file mode 100644 index af9de718e23..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateReferencesItem model. - */ -public class RoleTemplateReferencesItemTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplateReferencesItem() throws Throwable { - RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(roleTemplateReferencesItemModel.id(), "testString"); - assertEquals(roleTemplateReferencesItemModel.version(), "testString"); - - String json = TestUtilities.serialize(roleTemplateReferencesItemModel); - - RoleTemplateReferencesItem roleTemplateReferencesItemModelNew = TestUtilities.deserialize(json, RoleTemplateReferencesItem.class); - assertTrue(roleTemplateReferencesItemModelNew instanceof RoleTemplateReferencesItem); - assertEquals(roleTemplateReferencesItemModelNew.id(), "testString"); - assertEquals(roleTemplateReferencesItemModelNew.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRoleTemplateReferencesItemError() throws Throwable { - new RoleTemplateReferencesItem.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java deleted file mode 100644 index 8bb27d8dd62..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplate model. - */ -public class RoleTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplate() throws Throwable { - RoleTemplate roleTemplateModel = new RoleTemplate(); - assertNull(roleTemplateModel.getName()); - assertNull(roleTemplateModel.getDescription()); - assertNull(roleTemplateModel.getAccountId()); - assertNull(roleTemplateModel.isCommitted()); - assertNull(roleTemplateModel.getRole()); - assertNull(roleTemplateModel.getVersion()); - assertNull(roleTemplateModel.getState()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java deleted file mode 100644 index 068cf309bd6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateVersionsCollection model. - */ -public class RoleTemplateVersionsCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplateVersionsCollection() throws Throwable { - RoleTemplateVersionsCollection roleTemplateVersionsCollectionModel = new RoleTemplateVersionsCollection(); - assertNull(roleTemplateVersionsCollectionModel.getLimit()); - assertNull(roleTemplateVersionsCollectionModel.getFirst()); - assertNull(roleTemplateVersionsCollectionModel.getNext()); - assertNull(roleTemplateVersionsCollectionModel.getPrevious()); - assertNull(roleTemplateVersionsCollectionModel.getVersions()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java deleted file mode 100644 index a632e63587f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; -import com.ibm.cloud.platform_services.iam_policy_management.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 Role model. - */ -public class RoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRole() throws Throwable { - Role roleModel = new Role.Builder() - .displayName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(roleModel.displayName(), "testString"); - assertEquals(roleModel.description(), "testString"); - assertEquals(roleModel.actions(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(roleModel); - - Role roleModelNew = TestUtilities.deserialize(json, Role.class); - assertTrue(roleModelNew instanceof Role); - assertEquals(roleModelNew.displayName(), "testString"); - assertEquals(roleModelNew.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRoleError() throws Throwable { - new Role.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java deleted file mode 100644 index 8383ef794a9..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 Roles model. - */ -public class RolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoles() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - String json = TestUtilities.serialize(rolesModel); - - Roles rolesModelNew = TestUtilities.deserialize(json, Roles.class); - assertTrue(rolesModelNew instanceof Roles); - assertEquals(rolesModelNew.roleId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRolesError() throws Throwable { - new Roles.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java deleted file mode 100644 index a05e5ee8704..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 RuleAttribute model. - */ -public class RuleAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRuleAttribute() throws Throwable { - RuleAttribute ruleAttributeModel = new RuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(ruleAttributeModel.key(), "testString"); - assertEquals(ruleAttributeModel.operator(), "stringEquals"); - assertEquals(ruleAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(ruleAttributeModel); - - RuleAttribute ruleAttributeModelNew = TestUtilities.deserialize(json, RuleAttribute.class); - assertTrue(ruleAttributeModelNew instanceof RuleAttribute); - assertEquals(ruleAttributeModelNew.key(), "testString"); - assertEquals(ruleAttributeModelNew.operator(), "stringEquals"); - assertEquals(ruleAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRuleAttributeError() throws Throwable { - new RuleAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java deleted file mode 100644 index 7bae03a42e0..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 SubjectAttribute model. - */ -public class SubjectAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testSubjectAttribute() throws Throwable { - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - assertEquals(subjectAttributeModel.name(), "testString"); - assertEquals(subjectAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(subjectAttributeModel); - - SubjectAttribute subjectAttributeModelNew = TestUtilities.deserialize(json, SubjectAttribute.class); - assertTrue(subjectAttributeModelNew instanceof SubjectAttribute); - assertEquals(subjectAttributeModelNew.name(), "testString"); - assertEquals(subjectAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testSubjectAttributeError() throws Throwable { - new SubjectAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java deleted file mode 100644 index d3a6d4ef53a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateActionControl model. - */ -public class TemplateActionControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateActionControl() throws Throwable { - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateActionControlModel.serviceName(), "testString"); - assertEquals(templateActionControlModel.description(), "testString"); - assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(templateActionControlModel); - - TemplateActionControl templateActionControlModelNew = TestUtilities.deserialize(json, TemplateActionControl.class); - assertTrue(templateActionControlModelNew instanceof TemplateActionControl); - assertEquals(templateActionControlModelNew.serviceName(), "testString"); - assertEquals(templateActionControlModelNew.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateActionControlError() throws Throwable { - new TemplateActionControl.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java deleted file mode 100644 index fba96e64cef..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateControl model. - */ -public class TemplateControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateControl() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - String json = TestUtilities.serialize(templateControlModel); - - TemplateControl templateControlModelNew = TestUtilities.deserialize(json, TemplateControl.class); - assertTrue(templateControlModelNew instanceof TemplateControl); - assertEquals(templateControlModelNew.grant().toString(), templateGrantModel.toString()); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateControlError() throws Throwable { - new TemplateControl.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java deleted file mode 100644 index b440cf19100..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateCountData model. - */ -public class TemplateCountDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateCountData() throws Throwable { - TemplateCountData templateCountDataModel = new TemplateCountData(); - assertNull(templateCountDataModel.getTemplate()); - assertNull(templateCountDataModel.getVersion()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java deleted file mode 100644 index e7759eacc21..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoleReferences; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrantRoleReferences model. - */ -public class TemplateGrantRoleReferencesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateGrantRoleReferences() throws Throwable { - RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(roleTemplateReferencesItemModel.id(), "testString"); - assertEquals(roleTemplateReferencesItemModel.version(), "testString"); - - TemplateGrantRoleReferences templateGrantRoleReferencesModel = new TemplateGrantRoleReferences.Builder() - .roleTemplateReferences(java.util.Arrays.asList(roleTemplateReferencesItemModel)) - .build(); - assertEquals(templateGrantRoleReferencesModel.roleTemplateReferences(), java.util.Arrays.asList(roleTemplateReferencesItemModel)); - - String json = TestUtilities.serialize(templateGrantRoleReferencesModel); - - TemplateGrantRoleReferences templateGrantRoleReferencesModelNew = TestUtilities.deserialize(json, TemplateGrantRoleReferences.class); - assertTrue(templateGrantRoleReferencesModelNew instanceof TemplateGrantRoleReferences); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateGrantRoleReferencesError() throws Throwable { - new TemplateGrantRoleReferences.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java deleted file mode 100644 index 8cddc6f9a19..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrantRoles model. - */ -public class TemplateGrantRolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateGrantRoles() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantRolesModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantRolesModel.roles(), java.util.Arrays.asList(rolesModel)); - - String json = TestUtilities.serialize(templateGrantRolesModel); - - TemplateGrantRoles templateGrantRolesModelNew = TestUtilities.deserialize(json, TemplateGrantRoles.class); - assertTrue(templateGrantRolesModelNew instanceof TemplateGrantRoles); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateGrantRolesError() throws Throwable { - new TemplateGrantRoles.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java deleted file mode 100644 index 90e6fdc2b9f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrant model. - */ -public class TemplateGrantTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testTemplateGrant() throws Throwable { - TemplateGrant templateGrantModel = new TemplateGrant(); - assertNotNull(templateGrantModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java deleted file mode 100644 index c2688232e2b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateMetadata model. - */ -public class TemplateMetadataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateMetadata() throws Throwable { - TemplateMetadata templateMetadataModel = new TemplateMetadata(); - assertNull(templateMetadataModel.getId()); - assertNull(templateMetadataModel.getVersion()); - assertNull(templateMetadataModel.getAssignmentId()); - assertNull(templateMetadataModel.getRootId()); - assertNull(templateMetadataModel.getRootVersion()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java deleted file mode 100644 index 0e256ffd599..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplatePolicy model. - */ -public class TemplatePolicyTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplatePolicy() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - assertEquals(templatePolicyModel.type(), "access"); - assertEquals(templatePolicyModel.description(), "testString"); - assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); - assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); - assertEquals(templatePolicyModel.pattern(), "testString"); - assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), templateControlModel); - - String json = TestUtilities.serialize(templatePolicyModel); - - TemplatePolicy templatePolicyModelNew = TestUtilities.deserialize(json, TemplatePolicy.class); - assertTrue(templatePolicyModelNew instanceof TemplatePolicy); - assertEquals(templatePolicyModelNew.type(), "access"); - assertEquals(templatePolicyModelNew.description(), "testString"); - assertEquals(templatePolicyModelNew.resource().toString(), v2PolicyResourceModel.toString()); - assertEquals(templatePolicyModelNew.subject().toString(), v2PolicySubjectModel.toString()); - assertEquals(templatePolicyModelNew.pattern(), "testString"); - assertEquals(templatePolicyModelNew.rule().toString(), v2PolicyRuleModel.toString()); - assertEquals(templatePolicyModelNew.control().toString(), templateControlModel.toString()); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplatePolicyError() throws Throwable { - new TemplatePolicy.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java deleted file mode 100644 index 1735364bc85..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateRole model. - */ -public class TemplateRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateRole() throws Throwable { - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateRoleModel.displayName(), "testString"); - assertEquals(templateRoleModel.serviceName(), "testString"); - assertEquals(templateRoleModel.description(), "testString"); - assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(templateRoleModel); - - TemplateRole templateRoleModelNew = TestUtilities.deserialize(json, TemplateRole.class); - assertTrue(templateRoleModelNew instanceof TemplateRole); - assertEquals(templateRoleModelNew.displayName(), "testString"); - assertEquals(templateRoleModelNew.serviceName(), "testString"); - assertEquals(templateRoleModelNew.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateRoleError() throws Throwable { - new TemplateRole.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java deleted file mode 100644 index df7a09c2829..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateActionControlAssignmentOptions model. - */ -public class UpdateActionControlAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdateActionControlAssignmentOptions() throws Throwable { - UpdateActionControlAssignmentOptions updateActionControlAssignmentOptionsModel = new UpdateActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .ifMatch("testString") - .templateVersion("testString") - .build(); - assertEquals(updateActionControlAssignmentOptionsModel.assignmentId(), "testString"); - assertEquals(updateActionControlAssignmentOptionsModel.ifMatch(), "testString"); - assertEquals(updateActionControlAssignmentOptionsModel.templateVersion(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateActionControlAssignmentOptionsError() throws Throwable { - new UpdateActionControlAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java deleted file mode 100644 index 0008325ffcf..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdatePolicyAssignmentOptions model. - */ -public class UpdatePolicyAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdatePolicyAssignmentOptions() throws Throwable { - UpdatePolicyAssignmentOptions updatePolicyAssignmentOptionsModel = new UpdatePolicyAssignmentOptions.Builder() - .assignmentId("testString") - .version("1.0") - .ifMatch("testString") - .templateVersion("testString") - .build(); - assertEquals(updatePolicyAssignmentOptionsModel.assignmentId(), "testString"); - assertEquals(updatePolicyAssignmentOptionsModel.version(), "1.0"); - assertEquals(updatePolicyAssignmentOptionsModel.ifMatch(), "testString"); - assertEquals(updatePolicyAssignmentOptionsModel.templateVersion(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdatePolicyAssignmentOptionsError() throws Throwable { - new UpdatePolicyAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java deleted file mode 100644 index de000e8c745..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdatePolicyStateOptions model. - */ -public class UpdatePolicyStateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdatePolicyStateOptions() throws Throwable { - UpdatePolicyStateOptions updatePolicyStateOptionsModel = new UpdatePolicyStateOptions.Builder() - .policyId("testString") - .ifMatch("testString") - .state("active") - .build(); - assertEquals(updatePolicyStateOptionsModel.policyId(), "testString"); - assertEquals(updatePolicyStateOptionsModel.ifMatch(), "testString"); - assertEquals(updatePolicyStateOptionsModel.state(), "active"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdatePolicyStateOptionsError() throws Throwable { - new UpdatePolicyStateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java deleted file mode 100644 index 879c3d5f456..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateRoleAssignmentOptions model. - */ -public class UpdateRoleAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdateRoleAssignmentOptions() throws Throwable { - UpdateRoleAssignmentOptions updateRoleAssignmentOptionsModel = new UpdateRoleAssignmentOptions.Builder() - .assignmentId("testString") - .ifMatch("testString") - .templateVersion("testString") - .build(); - assertEquals(updateRoleAssignmentOptionsModel.assignmentId(), "testString"); - assertEquals(updateRoleAssignmentOptionsModel.ifMatch(), "testString"); - assertEquals(updateRoleAssignmentOptionsModel.templateVersion(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateRoleAssignmentOptionsError() throws Throwable { - new UpdateRoleAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java deleted file mode 100644 index 1d69d016781..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateSettingsOptions model. - */ -public class UpdateSettingsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdateSettingsOptions() throws Throwable { - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - assertEquals(identityTypesBaseModel.state(), "enabled"); - assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); - - IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() - .user(identityTypesBaseModel) - .serviceId(identityTypesBaseModel) - .service(identityTypesBaseModel) - .build(); - assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); - - ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() - .identityTypes(identityTypesPatchModel) - .build(); - assertEquals(externalAccountIdentityInteractionPatchModel.identityTypes(), identityTypesPatchModel); - - UpdateSettingsOptions updateSettingsOptionsModel = new UpdateSettingsOptions.Builder() - .accountId("testString") - .ifMatch("testString") - .externalAccountIdentityInteraction(externalAccountIdentityInteractionPatchModel) - .acceptLanguage("default") - .build(); - assertEquals(updateSettingsOptionsModel.accountId(), "testString"); - assertEquals(updateSettingsOptionsModel.ifMatch(), "testString"); - assertEquals(updateSettingsOptionsModel.externalAccountIdentityInteraction(), externalAccountIdentityInteractionPatchModel); - assertEquals(updateSettingsOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateSettingsOptionsError() throws Throwable { - new UpdateSettingsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java deleted file mode 100644 index aff020c8985..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyCollection model. - */ -public class V2PolicyCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyCollection() throws Throwable { - V2PolicyCollection v2PolicyCollectionModel = new V2PolicyCollection(); - assertNull(v2PolicyCollectionModel.getLimit()); - assertNull(v2PolicyCollectionModel.getFirst()); - assertNull(v2PolicyCollectionModel.getNext()); - assertNull(v2PolicyCollectionModel.getPrevious()); - assertNull(v2PolicyCollectionModel.getPolicies()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java deleted file mode 100644 index 407eaadb155..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResourceAttribute model. - */ -public class V2PolicyResourceAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyResourceAttribute() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(v2PolicyResourceAttributeModel); - - V2PolicyResourceAttribute v2PolicyResourceAttributeModelNew = TestUtilities.deserialize(json, V2PolicyResourceAttribute.class); - assertTrue(v2PolicyResourceAttributeModelNew instanceof V2PolicyResourceAttribute); - assertEquals(v2PolicyResourceAttributeModelNew.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModelNew.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyResourceAttributeError() throws Throwable { - new V2PolicyResourceAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java deleted file mode 100644 index 97c9c813216..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResourceTag model. - */ -public class V2PolicyResourceTagTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyResourceTag() throws Throwable { - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - String json = TestUtilities.serialize(v2PolicyResourceTagModel); - - V2PolicyResourceTag v2PolicyResourceTagModelNew = TestUtilities.deserialize(json, V2PolicyResourceTag.class); - assertTrue(v2PolicyResourceTagModelNew instanceof V2PolicyResourceTag); - assertEquals(v2PolicyResourceTagModelNew.key(), "testString"); - assertEquals(v2PolicyResourceTagModelNew.value(), "testString"); - assertEquals(v2PolicyResourceTagModelNew.operator(), "stringEquals"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyResourceTagError() throws Throwable { - new V2PolicyResourceTag.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java deleted file mode 100644 index d153fd97be6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResource model. - */ -public class V2PolicyResourceTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyResource() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - String json = TestUtilities.serialize(v2PolicyResourceModel); - - V2PolicyResource v2PolicyResourceModelNew = TestUtilities.deserialize(json, V2PolicyResource.class); - assertTrue(v2PolicyResourceModelNew instanceof V2PolicyResource); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyResourceError() throws Throwable { - new V2PolicyResource.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java deleted file mode 100644 index 6d6da85f2b4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRuleRuleAttribute model. - */ -public class V2PolicyRuleRuleAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyRuleRuleAttribute() throws Throwable { - V2PolicyRuleRuleAttribute v2PolicyRuleRuleAttributeModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleRuleAttributeModel.key(), "testString"); - assertEquals(v2PolicyRuleRuleAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleRuleAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(v2PolicyRuleRuleAttributeModel); - - V2PolicyRuleRuleAttribute v2PolicyRuleRuleAttributeModelNew = TestUtilities.deserialize(json, V2PolicyRuleRuleAttribute.class); - assertTrue(v2PolicyRuleRuleAttributeModelNew instanceof V2PolicyRuleRuleAttribute); - assertEquals(v2PolicyRuleRuleAttributeModelNew.key(), "testString"); - assertEquals(v2PolicyRuleRuleAttributeModelNew.operator(), "stringEquals"); - assertEquals(v2PolicyRuleRuleAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyRuleRuleAttributeError() throws Throwable { - new V2PolicyRuleRuleAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java deleted file mode 100644 index fdf25669ef7..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleWithNestedConditions; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRuleRuleWithNestedConditions model. - */ -public class V2PolicyRuleRuleWithNestedConditionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyRuleRuleWithNestedConditions() throws Throwable { - NestedConditionRuleAttribute nestedConditionModel = new NestedConditionRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(nestedConditionModel.key(), "testString"); - assertEquals(nestedConditionModel.operator(), "stringEquals"); - assertEquals(nestedConditionModel.value(), "testString"); - - V2PolicyRuleRuleWithNestedConditions v2PolicyRuleRuleWithNestedConditionsModel = new V2PolicyRuleRuleWithNestedConditions.Builder() - .operator("and") - .conditions(java.util.Arrays.asList(nestedConditionModel)) - .build(); - assertEquals(v2PolicyRuleRuleWithNestedConditionsModel.operator(), "and"); - assertEquals(v2PolicyRuleRuleWithNestedConditionsModel.conditions(), java.util.Arrays.asList(nestedConditionModel)); - - String json = TestUtilities.serialize(v2PolicyRuleRuleWithNestedConditionsModel); - - V2PolicyRuleRuleWithNestedConditions v2PolicyRuleRuleWithNestedConditionsModelNew = TestUtilities.deserialize(json, V2PolicyRuleRuleWithNestedConditions.class); - assertTrue(v2PolicyRuleRuleWithNestedConditionsModelNew instanceof V2PolicyRuleRuleWithNestedConditions); - assertEquals(v2PolicyRuleRuleWithNestedConditionsModelNew.operator(), "and"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyRuleRuleWithNestedConditionsError() throws Throwable { - new V2PolicyRuleRuleWithNestedConditions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java deleted file mode 100644 index e0af599840c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRule; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRule model. - */ -public class V2PolicyRuleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testV2PolicyRule() throws Throwable { - V2PolicyRule v2PolicyRuleModel = new V2PolicyRule(); - assertNotNull(v2PolicyRuleModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java deleted file mode 100644 index a6e8f9d8922..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicySubjectAttribute model. - */ -public class V2PolicySubjectAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicySubjectAttribute() throws Throwable { - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(v2PolicySubjectAttributeModel); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModelNew = TestUtilities.deserialize(json, V2PolicySubjectAttribute.class); - assertTrue(v2PolicySubjectAttributeModelNew instanceof V2PolicySubjectAttribute); - assertEquals(v2PolicySubjectAttributeModelNew.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModelNew.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicySubjectAttributeError() throws Throwable { - new V2PolicySubjectAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java deleted file mode 100644 index 37adbaff5df..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicySubject model. - */ -public class V2PolicySubjectTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicySubject() throws Throwable { - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - String json = TestUtilities.serialize(v2PolicySubjectModel); - - V2PolicySubject v2PolicySubjectModelNew = TestUtilities.deserialize(json, V2PolicySubject.class); - assertTrue(v2PolicySubjectModelNew instanceof V2PolicySubject); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicySubjectError() throws Throwable { - new V2PolicySubject.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java deleted file mode 100644 index 2ffbe45575b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyTemplateMetaData model. - */ -public class V2PolicyTemplateMetaDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyTemplateMetaData() throws Throwable { - V2PolicyTemplateMetaData v2PolicyTemplateMetaDataModel = new V2PolicyTemplateMetaData(); - assertNull(v2PolicyTemplateMetaDataModel.getType()); - assertNull(v2PolicyTemplateMetaDataModel.getDescription()); - assertNull(v2PolicyTemplateMetaDataModel.getSubject()); - assertNull(v2PolicyTemplateMetaDataModel.getResource()); - assertNull(v2PolicyTemplateMetaDataModel.getPattern()); - assertNull(v2PolicyTemplateMetaDataModel.getRule()); - assertNull(v2PolicyTemplateMetaDataModel.getControl()); - assertNull(v2PolicyTemplateMetaDataModel.getState()); - assertNull(v2PolicyTemplateMetaDataModel.getLastPermitAt()); - assertNull(v2PolicyTemplateMetaDataModel.getLastPermitFrequency()); - assertNull(v2PolicyTemplateMetaDataModel.getTemplate()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java deleted file mode 100644 index 1630201062c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2Policy model. - */ -public class V2PolicyTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2Policy() throws Throwable { - V2Policy v2PolicyModel = new V2Policy(); - assertNull(v2PolicyModel.getType()); - assertNull(v2PolicyModel.getDescription()); - assertNull(v2PolicyModel.getSubject()); - assertNull(v2PolicyModel.getResource()); - assertNull(v2PolicyModel.getPattern()); - assertNull(v2PolicyModel.getRule()); - assertNull(v2PolicyModel.getControl()); - assertNull(v2PolicyModel.getState()); - assertNull(v2PolicyModel.getLastPermitAt()); - assertNull(v2PolicyModel.getLastPermitFrequency()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java deleted file mode 100644 index 04aaecc16ae..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * (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_policy_management.v1.utils; - -import java.util.Base64; -import java.util.Map; -import java.util.Set; -import java.util.List; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.io.InputStream; -import java.io.ByteArrayInputStream; - -import okhttp3.mockwebserver.RecordedRequest; -import okhttp3.HttpUrl; -import com.ibm.cloud.sdk.core.util.DateUtils; -import com.ibm.cloud.sdk.core.util.GsonSingleton; -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; - -/** - * A class used by the unit tests containing utility functions. - */ -public class TestUtilities { - public static Map createMockMap() { - Map mockMap = new HashMap<>(); - mockMap.put("foo", "bar"); - return mockMap; - } - - public static HashMap createMockStreamMap() { - return new HashMap() { - { put("key1", createMockStream("This is a mock file.")); } - }; - } - - public static Map parseQueryString(RecordedRequest req) { - Map queryMap = new HashMap<>(); - - try { - HttpUrl requestUrl = req.getRequestUrl(); - - if (requestUrl != null) { - Set queryParamsNames = requestUrl.queryParameterNames(); - // map the parameter name to its corresponding value - for (String p : queryParamsNames) { - // get the corresponding value for the parameter (p) - List val = requestUrl.queryParameterValues(p); - if (val != null && !val.isEmpty()) { - String joinedQuery = String.join(",", val); - queryMap.put(p, joinedQuery); - } - } - } - if (queryMap.isEmpty()) { - return null; - } - } catch (Exception e) { - return null; - } - - return queryMap; - } - - public static String parseReqPath(RecordedRequest req) { - String parsedPath = null; - - try { - String fullPath = req.getPath(); - if (fullPath != null && !fullPath.isEmpty()) { - // retrieve the path segment before the query parameter - parsedPath = fullPath.split("\\?", 2)[0]; - } - if (parsedPath.isEmpty() || parsedPath == null) { - return null; - } - - } catch (Exception e) { - return null; - } - - return parsedPath; - } - - public static String serialize(Object obj) { - return GsonSingleton.getGson().toJson(obj); - } - - public static T deserialize(String json, Class clazz) { - return GsonSingleton.getGson().fromJson(json, clazz); - } - - public static InputStream createMockStream(String s) { - return new ByteArrayInputStream(s.getBytes()); - } - - public static List creatMockListFileWithMetadata() { - List list = new ArrayList(); - byte[] fileBytes = {(byte) 0xde, (byte) 0xad, (byte) 0xbe, (byte) 0xef}; - InputStream inputStream = new ByteArrayInputStream(fileBytes); - FileWithMetadata.Builder builder = new FileWithMetadata.Builder(); - builder.data(inputStream); - FileWithMetadata fileWithMetadata = builder.build(); - list.add(fileWithMetadata); - - return list; - } - - public static byte[] createMockByteArray(String encodedString) throws Exception { - return Base64.getDecoder().decode(encodedString); - } - - public static Date createMockDate(String date) throws Exception { - return DateUtils.parseAsDate(date); - } - - public static Date createMockDateTime(String date) throws Exception { - return DateUtils.parseAsDateTime(date); - } -} \ No newline at end of file From bb2fea8a1e7bd2b1c149f0a064f0178266280b2d Mon Sep 17 00:00:00 2001 From: Bhavana Bellamgari Date: Wed, 10 Dec 2025 15:31:44 +0530 Subject: [PATCH 08/13] Updated template grant schema Signed-off-by: Bhavana Bellamgari Signed-off-by: Bhavana Bellamgari --- .../v1/IamPolicyManagement.java | 2566 +++++++++ .../AccountSettingsAccessManagement.java | 40 + .../v1/model/ActionControlAssignment.java | 207 + .../ActionControlAssignmentCollection.java | 88 + .../ActionControlAssignmentResource.java | 52 + ...ontrolAssignmentResourceActionControl.java | 53 + ...ctionControlAssignmentResourceCreated.java | 38 + .../ActionControlAssignmentTemplate.java | 134 + .../model/ActionControlAssignmentsPager.java | 108 + .../v1/model/ActionControlTemplate.java | 203 + .../ActionControlTemplateCollection.java | 90 + ...tionControlTemplateVersionsCollection.java | 88 + .../ActionControlTemplateVersionsPager.java | 108 + .../v1/model/ActionControlTemplatesPager.java | 108 + .../v1/model/AssignmentResourceCreated.java | 38 + .../v1/model/AssignmentResourceError.java | 88 + .../v1/model/AssignmentTargetDetails.java | 142 + .../v1/model/AssignmentTemplateDetails.java | 119 + .../CommitActionControlTemplateOptions.java | 134 + .../v1/model/CommitPolicyTemplateOptions.java | 134 + .../v1/model/CommitRoleTemplateOptions.java | 134 + .../v1/model/ConflictsWith.java | 62 + .../v1/model/Control.java | 104 + .../v1/model/ControlResponse.java | 42 + .../v1/model/ControlResponseControl.java | 24 + ...ntrolResponseControlWithEnrichedRoles.java | 24 + ...ctionControlTemplateAssignmentOptions.java | 191 + .../CreateActionControlTemplateOptions.java | 251 + ...teActionControlTemplateVersionOptions.java | 211 + .../v1/model/CreatePolicyOptions.java | 311 + ...CreatePolicyTemplateAssignmentOptions.java | 221 + .../v1/model/CreatePolicyTemplateOptions.java | 255 + .../CreatePolicyTemplateVersionOptions.java | 214 + .../v1/model/CreateRoleOptions.java | 308 + .../CreateRoleTemplateAssignmentOptions.java | 191 + .../v1/model/CreateRoleTemplateOptions.java | 251 + .../CreateRoleTemplateVersionOptions.java | 211 + .../v1/model/CreateV2PolicyOptions.java | 312 + .../v1/model/CustomRole.java | 195 + .../DeleteActionControlAssignmentOptions.java | 104 + .../DeleteActionControlTemplateOptions.java | 104 + ...teActionControlTemplateVersionOptions.java | 134 + .../model/DeletePolicyAssignmentOptions.java | 104 + .../v1/model/DeletePolicyOptions.java | 104 + .../v1/model/DeletePolicyTemplateOptions.java | 104 + .../DeletePolicyTemplateVersionOptions.java | 134 + .../v1/model/DeleteRoleAssignmentOptions.java | 104 + .../v1/model/DeleteRoleOptions.java | 104 + .../v1/model/DeleteRoleTemplateOptions.java | 104 + .../DeleteRoleTemplateVersionOptions.java | 134 + .../v1/model/DeleteV2PolicyOptions.java | 104 + .../v1/model/EnrichedRoles.java | 81 + .../v1/model/ErrorDetails.java | 40 + .../v1/model/ErrorObject.java | 128 + .../ExternalAccountIdentityInteraction.java | 40 + ...ternalAccountIdentityInteractionPatch.java | 95 + .../iam_policy_management/v1/model/First.java | 38 + .../GetActionControlAssignmentOptions.java | 104 + .../GetActionControlTemplateOptions.java | 140 + ...etActionControlTemplateVersionOptions.java | 134 + .../v1/model/GetPolicyAssignmentOptions.java | 134 + .../v1/model/GetPolicyOptions.java | 104 + .../v1/model/GetPolicyTemplateOptions.java | 140 + .../GetPolicyTemplateVersionOptions.java | 134 + .../v1/model/GetRoleAssignmentOptions.java | 104 + .../v1/model/GetRoleOptions.java | 104 + .../v1/model/GetRoleTemplateOptions.java | 140 + .../model/GetRoleTemplateVersionOptions.java | 134 + .../v1/model/GetSettingsOptions.java | 141 + .../v1/model/GetV2PolicyOptions.java | 148 + .../iam_policy_management/v1/model/Grant.java | 124 + .../v1/model/GrantWithEnrichedRoles.java | 40 + .../v1/model/IdentityTypes.java | 64 + .../v1/model/IdentityTypesBase.java | 168 + .../v1/model/IdentityTypesPatch.java | 147 + .../v1/model/LimitData.java | 50 + .../ListActionControlAssignmentsOptions.java | 245 + ...tActionControlTemplateVersionsOptions.java | 192 + .../ListActionControlTemplatesOptions.java | 193 + .../v1/model/ListPoliciesOptions.java | 501 ++ .../model/ListPolicyAssignmentsOptions.java | 275 + .../ListPolicyTemplateVersionsOptions.java | 192 + .../v1/model/ListPolicyTemplatesOptions.java | 379 ++ .../v1/model/ListRoleAssignmentsOptions.java | 245 + .../ListRoleTemplateVersionsOptions.java | 192 + .../v1/model/ListRoleTemplatesOptions.java | 307 + .../v1/model/ListRolesOptions.java | 234 + .../v1/model/ListV2PoliciesOptions.java | 492 ++ .../v1/model/NestedCondition.java | 126 + .../model/NestedConditionRuleAttribute.java | 170 + .../NestedConditionRuleWithConditions.java | 139 + .../iam_policy_management/v1/model/Next.java | 50 + .../v1/model/PoliciesPager.java | 108 + .../v1/model/Policy.java | 188 + .../model/PolicyAssignmentResourcePolicy.java | 65 + .../v1/model/PolicyAssignmentResources.java | 50 + .../v1/model/PolicyAssignmentV1.java | 193 + .../model/PolicyAssignmentV1Collection.java | 88 + .../v1/model/PolicyAssignmentV1Resources.java | 50 + .../v1/model/PolicyAssignmentV1Subject.java | 60 + .../v1/model/PolicyAssignmentsPager.java | 108 + .../v1/model/PolicyCollection.java | 88 + .../v1/model/PolicyResource.java | 167 + .../v1/model/PolicyRole.java | 131 + .../v1/model/PolicySubject.java | 124 + .../v1/model/PolicyTemplate.java | 202 + .../PolicyTemplateAssignmentCollection.java | 88 + .../model/PolicyTemplateAssignmentItems.java | 261 + ...mplateAssignmentItemsPolicyAssignment.java | 50 + ...lateAssignmentItemsPolicyAssignmentV1.java | 38 + .../v1/model/PolicyTemplateCollection.java | 90 + .../v1/model/PolicyTemplateLimitData.java | 214 + .../v1/model/PolicyTemplateMetaData.java | 201 + .../PolicyTemplateVersionsCollection.java | 88 + .../v1/model/PolicyTemplateVersionsPager.java | 108 + .../v1/model/PolicyTemplatesPager.java | 108 + .../v1/model/Previous.java | 50 + .../ReplaceActionControlTemplateOptions.java | 273 + .../v1/model/ReplacePolicyOptions.java | 335 ++ .../model/ReplacePolicyTemplateOptions.java | 276 + .../v1/model/ReplaceRoleOptions.java | 255 + .../v1/model/ReplaceRoleTemplateOptions.java | 273 + .../v1/model/ReplaceV2PolicyOptions.java | 336 ++ .../v1/model/ResourceAttribute.java | 160 + .../v1/model/ResourceTag.java | 160 + .../iam_policy_management/v1/model/Role.java | 196 + .../v1/model/RoleAction.java | 64 + .../v1/model/RoleAssignment.java | 207 + .../v1/model/RoleAssignmentCollection.java | 88 + .../v1/model/RoleAssignmentResource.java | 50 + .../model/RoleAssignmentResourceCreated.java | 38 + .../v1/model/RoleAssignmentResourceRole.java | 53 + .../v1/model/RoleAssignmentTemplate.java | 134 + .../v1/model/RoleAssignmentsPager.java | 108 + .../v1/model/RoleCollection.java | 68 + .../v1/model/RoleTemplate.java | 202 + .../v1/model/RoleTemplateCollection.java | 90 + .../v1/model/RoleTemplatePrototypeRole.java | 239 + .../v1/model/RoleTemplateReferencesItem.java | 134 + .../model/RoleTemplateVersionsCollection.java | 88 + .../v1/model/RoleTemplateVersionsPager.java | 108 + .../v1/model/RoleTemplatesPager.java | 108 + .../iam_policy_management/v1/model/Roles.java | 106 + .../v1/model/RuleAttribute.java | 209 + .../v1/model/SubjectAttribute.java | 134 + .../v1/model/TemplateActionControl.java | 182 + .../v1/model/TemplateControl.java | 104 + .../v1/model/TemplateCountData.java | 50 + .../v1/model/TemplateGrant.java | 58 + .../v1/model/TemplateGrantRoleReferences.java | 110 + .../v1/model/TemplateGrantRoles.java | 110 + .../v1/model/TemplateMetadata.java | 91 + .../v1/model/TemplatePolicy.java | 272 + .../v1/model/TemplateRole.java | 209 + .../UpdateActionControlAssignmentOptions.java | 166 + .../model/UpdatePolicyAssignmentOptions.java | 196 + .../v1/model/UpdatePolicyStateOptions.java | 171 + .../v1/model/UpdateRoleAssignmentOptions.java | 166 + .../v1/model/UpdateSettingsOptions.java | 199 + .../v1/model/V2PoliciesPager.java | 108 + .../v1/model/V2Policy.java | 247 + .../v1/model/V2PolicyCollection.java | 88 + .../v1/model/V2PolicyResource.java | 167 + .../v1/model/V2PolicyResourceAttribute.java | 181 + .../v1/model/V2PolicyResourceTag.java | 174 + .../v1/model/V2PolicyRule.java | 126 + .../v1/model/V2PolicyRuleRuleAttribute.java | 170 + .../V2PolicyRuleRuleWithNestedConditions.java | 139 + .../v1/model/V2PolicySubject.java | 124 + .../v1/model/V2PolicySubjectAttribute.java | 175 + .../v1/model/V2PolicyTemplateMetaData.java | 260 + .../v1/package-info.java | 17 + .../v1/IamPolicyManagementTest.java | 5007 +++++++++++++++++ .../AccountSettingsAccessManagementTest.java | 40 + ...ActionControlAssignmentCollectionTest.java | 47 + ...olAssignmentResourceActionControlTest.java | 43 + ...nControlAssignmentResourceCreatedTest.java | 37 + .../ActionControlAssignmentResourceTest.java | 45 + .../ActionControlAssignmentTemplateTest.java | 54 + .../v1/model/ActionControlAssignmentTest.java | 40 + .../ActionControlTemplateCollectionTest.java | 46 + .../v1/model/ActionControlTemplateTest.java | 44 + ...ControlTemplateVersionsCollectionTest.java | 46 + .../model/AssignmentResourceCreatedTest.java | 37 + .../v1/model/AssignmentResourceErrorTest.java | 44 + .../v1/model/AssignmentTargetDetailsTest.java | 54 + .../model/AssignmentTemplateDetailsTest.java | 48 + ...ommitActionControlTemplateOptionsTest.java | 47 + .../CommitPolicyTemplateOptionsTest.java | 47 + .../model/CommitRoleTemplateOptionsTest.java | 47 + .../v1/model/ConflictsWithTest.java | 39 + .../v1/model/ControlResponseControlTest.java | 39 + ...lResponseControlWithEnrichedRolesTest.java | 40 + .../v1/model/ControlResponseTest.java | 40 + .../v1/model/ControlTest.java | 63 + ...nControlTemplateAssignmentOptionsTest.java | 65 + ...reateActionControlTemplateOptionsTest.java | 65 + ...tionControlTemplateVersionOptionsTest.java | 63 + .../v1/model/CreatePolicyOptionsTest.java | 103 + ...tePolicyTemplateAssignmentOptionsTest.java | 67 + .../CreatePolicyTemplateOptionsTest.java | 145 + ...reatePolicyTemplateVersionOptionsTest.java | 143 + .../v1/model/CreateRoleOptionsTest.java | 57 + ...eateRoleTemplateAssignmentOptionsTest.java | 65 + .../model/CreateRoleTemplateOptionsTest.java | 69 + .../CreateRoleTemplateVersionOptionsTest.java | 65 + .../v1/model/CreateV2PolicyOptionsTest.java | 131 + .../v1/model/CustomRoleTest.java | 42 + ...eteActionControlAssignmentOptionsTest.java | 45 + ...eleteActionControlTemplateOptionsTest.java | 45 + ...tionControlTemplateVersionOptionsTest.java | 47 + .../DeletePolicyAssignmentOptionsTest.java | 45 + .../v1/model/DeletePolicyOptionsTest.java | 45 + .../DeletePolicyTemplateOptionsTest.java | 45 + ...eletePolicyTemplateVersionOptionsTest.java | 47 + .../DeleteRoleAssignmentOptionsTest.java | 45 + .../v1/model/DeleteRoleOptionsTest.java | 45 + .../model/DeleteRoleTemplateOptionsTest.java | 45 + .../DeleteRoleTemplateVersionOptionsTest.java | 47 + .../v1/model/DeleteV2PolicyOptionsTest.java | 45 + .../v1/model/EnrichedRolesTest.java | 39 + .../v1/model/ErrorDetailsTest.java | 38 + .../v1/model/ErrorObjectTest.java | 42 + ...alAccountIdentityInteractionPatchTest.java | 63 + ...xternalAccountIdentityInteractionTest.java | 39 + .../v1/model/FirstTest.java | 36 + ...GetActionControlAssignmentOptionsTest.java | 45 + .../GetActionControlTemplateOptionsTest.java | 47 + ...tionControlTemplateVersionOptionsTest.java | 47 + .../model/GetPolicyAssignmentOptionsTest.java | 47 + .../v1/model/GetPolicyOptionsTest.java | 45 + .../model/GetPolicyTemplateOptionsTest.java | 47 + .../GetPolicyTemplateVersionOptionsTest.java | 47 + .../model/GetRoleAssignmentOptionsTest.java | 45 + .../v1/model/GetRoleOptionsTest.java | 45 + .../v1/model/GetRoleTemplateOptionsTest.java | 47 + .../GetRoleTemplateVersionOptionsTest.java | 47 + .../v1/model/GetSettingsOptionsTest.java | 47 + .../v1/model/GetV2PolicyOptionsTest.java | 47 + .../v1/model/GrantTest.java | 56 + .../v1/model/GrantWithEnrichedRolesTest.java | 39 + .../v1/model/IdentityTypesBaseTest.java | 53 + .../v1/model/IdentityTypesPatchTest.java | 59 + .../v1/model/IdentityTypesTest.java | 40 + .../v1/model/LimitDataTest.java | 36 + ...stActionControlAssignmentsOptionsTest.java | 55 + ...ionControlTemplateVersionsOptionsTest.java | 51 + ...ListActionControlTemplatesOptionsTest.java | 51 + .../v1/model/ListPoliciesOptionsTest.java | 69 + .../ListPolicyAssignmentsOptionsTest.java | 57 + ...ListPolicyTemplateVersionsOptionsTest.java | 51 + .../model/ListPolicyTemplatesOptionsTest.java | 63 + .../model/ListRoleAssignmentsOptionsTest.java | 55 + .../ListRoleTemplateVersionsOptionsTest.java | 51 + .../model/ListRoleTemplatesOptionsTest.java | 59 + .../v1/model/ListRolesOptionsTest.java | 49 + .../v1/model/ListV2PoliciesOptionsTest.java | 69 + .../NestedConditionRuleAttributeTest.java | 57 + ...NestedConditionRuleWithConditionsTest.java | 63 + .../v1/model/NestedConditionTest.java | 38 + .../v1/model/NextTest.java | 37 + .../PolicyAssignmentResourcePolicyTest.java | 44 + .../model/PolicyAssignmentResourcesTest.java | 44 + .../PolicyAssignmentV1CollectionTest.java | 55 + .../PolicyAssignmentV1ResourcesTest.java | 45 + .../model/PolicyAssignmentV1SubjectTest.java | 36 + .../v1/model/PolicyAssignmentV1Test.java | 51 + .../v1/model/PolicyCollectionTest.java | 52 + .../v1/model/PolicyResourceTest.java | 72 + .../v1/model/PolicyRoleTest.java | 51 + .../v1/model/PolicySubjectTest.java | 58 + ...olicyTemplateAssignmentCollectionTest.java | 55 + ...teAssignmentItemsPolicyAssignmentTest.java | 50 + ...AssignmentItemsPolicyAssignmentV1Test.java | 51 + .../PolicyTemplateAssignmentItemsTest.java | 48 + .../model/PolicyTemplateCollectionTest.java | 55 + .../v1/model/PolicyTemplateLimitDataTest.java | 56 + .../v1/model/PolicyTemplateMetaDataTest.java | 50 + .../v1/model/PolicyTemplateTest.java | 53 + .../PolicyTemplateVersionsCollectionTest.java | 55 + .../v1/model/PolicyTest.java | 48 + .../v1/model/PreviousTest.java | 37 + ...placeActionControlTemplateOptionsTest.java | 67 + .../v1/model/ReplacePolicyOptionsTest.java | 105 + .../ReplacePolicyTemplateOptionsTest.java | 147 + .../v1/model/ReplaceRoleOptionsTest.java | 53 + .../model/ReplaceRoleTemplateOptionsTest.java | 69 + .../v1/model/ReplaceV2PolicyOptionsTest.java | 133 + .../v1/model/ResourceAttributeTest.java | 57 + .../v1/model/ResourceTagTest.java | 57 + .../v1/model/RoleActionTest.java | 39 + .../model/RoleAssignmentCollectionTest.java | 47 + .../RoleAssignmentResourceCreatedTest.java | 37 + .../model/RoleAssignmentResourceRoleTest.java | 43 + .../v1/model/RoleAssignmentResourceTest.java | 45 + .../v1/model/RoleAssignmentTemplateTest.java | 54 + .../v1/model/RoleAssignmentTest.java | 40 + .../v1/model/RoleCollectionTest.java | 41 + .../v1/model/RoleTemplateCollectionTest.java | 46 + .../model/RoleTemplatePrototypeRoleTest.java | 62 + .../model/RoleTemplateReferencesItemTest.java | 54 + .../v1/model/RoleTemplateTest.java | 44 + .../RoleTemplateVersionsCollectionTest.java | 46 + .../v1/model/RoleTest.java | 56 + .../v1/model/RolesTest.java | 51 + .../v1/model/RuleAttributeTest.java | 57 + .../v1/model/SubjectAttributeTest.java | 54 + .../v1/model/TemplateActionControlTest.java | 56 + .../v1/model/TemplateControlTest.java | 63 + .../v1/model/TemplateCountDataTest.java | 39 + .../TemplateGrantRoleReferencesTest.java | 58 + .../v1/model/TemplateGrantRolesTest.java | 56 + .../v1/model/TemplateGrantTest.java | 39 + .../v1/model/TemplateMetadataTest.java | 41 + .../v1/model/TemplatePolicyTest.java | 141 + .../v1/model/TemplateRoleTest.java | 59 + ...ateActionControlAssignmentOptionsTest.java | 49 + .../UpdatePolicyAssignmentOptionsTest.java | 51 + .../model/UpdatePolicyStateOptionsTest.java | 49 + .../UpdateRoleAssignmentOptionsTest.java | 49 + .../v1/model/UpdateSettingsOptionsTest.java | 75 + .../v1/model/V2PolicyCollectionTest.java | 55 + .../model/V2PolicyResourceAttributeTest.java | 57 + .../v1/model/V2PolicyResourceTagTest.java | 57 + .../v1/model/V2PolicyResourceTest.java | 72 + .../model/V2PolicyRuleRuleAttributeTest.java | 57 + ...olicyRuleRuleWithNestedConditionsTest.java | 63 + .../v1/model/V2PolicyRuleTest.java | 38 + .../model/V2PolicySubjectAttributeTest.java | 57 + .../v1/model/V2PolicySubjectTest.java | 60 + .../model/V2PolicyTemplateMetaDataTest.java | 57 + .../v1/model/V2PolicyTest.java | 55 + .../v1/utils/TestUtilities.java | 131 + 333 files changed, 41258 insertions(+) create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java new file mode 100644 index 00000000000..2abe3baea4e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java @@ -0,0 +1,2566 @@ +/* + * (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. + */ + +/* + * IBM OpenAPI SDK Code Generator Version: 3.107.1-41b0fbd0-20250825-080732 + */ + +package com.ibm.cloud.platform_services.iam_policy_management.v1; + +import com.google.gson.JsonObject; +import com.ibm.cloud.platform_services.common.SdkCommon; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; +import com.ibm.cloud.sdk.core.http.RequestBuilder; +import com.ibm.cloud.sdk.core.http.ResponseConverter; +import com.ibm.cloud.sdk.core.http.ServiceCall; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.ConfigBasedAuthenticatorFactory; +import com.ibm.cloud.sdk.core.service.BaseService; +import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; + +/** + * IAM Policy Management API. + * + * API Version: 1.0.1 + */ +public class IamPolicyManagement extends BaseService { + + /** + * Default service name used when configuring the `IamPolicyManagement` client. + */ + public static final String DEFAULT_SERVICE_NAME = "iam_policy_management"; + + /** + * Default service endpoint URL. + */ + public static final String DEFAULT_SERVICE_URL = "https://iam.cloud.ibm.com"; + + /** + * Class method which constructs an instance of the `IamPolicyManagement` client. + * The default service name is used to configure the client instance. + * + * @return an instance of the `IamPolicyManagement` client using external configuration + */ + public static IamPolicyManagement newInstance() { + return newInstance(DEFAULT_SERVICE_NAME); + } + + /** + * Class method which constructs an instance of the `IamPolicyManagement` client. + * The specified service name is used to configure the client instance. + * + * @param serviceName the service name to be used when configuring the client instance + * @return an instance of the `IamPolicyManagement` client using external configuration + */ + public static IamPolicyManagement newInstance(String serviceName) { + Authenticator authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(serviceName); + IamPolicyManagement service = new IamPolicyManagement(serviceName, authenticator); + service.configureService(serviceName); + return service; + } + + /** + * Constructs an instance of the `IamPolicyManagement` client. + * The specified service name and authenticator are used to configure the client instance. + * + * @param serviceName the service name to be used when configuring the client instance + * @param authenticator the {@link Authenticator} instance to be configured for this client + */ + public IamPolicyManagement(String serviceName, Authenticator authenticator) { + super(serviceName, authenticator); + setServiceUrl(DEFAULT_SERVICE_URL); + } + + /** + * Get policies by attributes. + * + * Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account + * and filter by attribute values. This can be done through query parameters. The following attributes are supported: + * account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query + * parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If + * the caller does not have read access to any policies an empty array is returned. + * + * @param listPoliciesOptions the {@link ListPoliciesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyCollection} + */ + public ServiceCall listPolicies(ListPoliciesOptions listPoliciesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listPoliciesOptions, + "listPoliciesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicies"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listPoliciesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listPoliciesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listPoliciesOptions.accountId())); + if (listPoliciesOptions.iamId() != null) { + builder.query("iam_id", String.valueOf(listPoliciesOptions.iamId())); + } + if (listPoliciesOptions.accessGroupId() != null) { + builder.query("access_group_id", String.valueOf(listPoliciesOptions.accessGroupId())); + } + if (listPoliciesOptions.type() != null) { + builder.query("type", String.valueOf(listPoliciesOptions.type())); + } + if (listPoliciesOptions.serviceType() != null) { + builder.query("service_type", String.valueOf(listPoliciesOptions.serviceType())); + } + if (listPoliciesOptions.tagName() != null) { + builder.query("tag_name", String.valueOf(listPoliciesOptions.tagName())); + } + if (listPoliciesOptions.tagValue() != null) { + builder.query("tag_value", String.valueOf(listPoliciesOptions.tagValue())); + } + if (listPoliciesOptions.sort() != null) { + builder.query("sort", String.valueOf(listPoliciesOptions.sort())); + } + if (listPoliciesOptions.format() != null) { + builder.query("format", String.valueOf(listPoliciesOptions.format())); + } + if (listPoliciesOptions.state() != null) { + builder.query("state", String.valueOf(listPoliciesOptions.state())); + } + if (listPoliciesOptions.limit() != null) { + builder.query("limit", String.valueOf(listPoliciesOptions.limit())); + } + if (listPoliciesOptions.start() != null) { + builder.query("start", String.valueOf(listPoliciesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a policy. + * + * Creates a policy to grant access between a subject and a resource. There are two types of policies: **access** and + * **authorization**. A policy administrator might want to create an access policy which grants access to a user, + * service-id, or an access group. They might also want to create an authorization policy and setup access between + * services. + * + * ### Access + * + * To create an access policy, use **`"type": "access"`** in the body. The possible subject attributes are + * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or + * service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. Assign roles + * that are supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or + * **`service_group_id`** attribute and the **`accountId`** attribute. The IAM Services group (`IAM`) is a subset of + * account management services that includes the IAM platform services IAM Identity, IAM Access Management, IAM Users + * Management, IAM Groups, and future IAM services. If the subject is a locked service-id, the request will fail. + * + * ### Authorization + * + * Authorization policies are supported by services on a case by case basis. Refer to service documentation to verify + * their support of authorization policies. To create an authorization policy, use **`"type": "authorization"`** in + * the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject + * attributes might be provided. The following attributes are supported: + * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are + * supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access + * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject + * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. + * + * ### Attribute Operators + * + * Currently, only the `stringEquals` and the `stringMatch` operators are available. Resource attributes may support + * one or both operators. For more information, see [Assigning access by using wildcard + * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). + * + * ### Attribute Validations + * + * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like + * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated + * against Global Catalog locations. + * + * @param createPolicyOptions the {@link CreatePolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Policy} + */ + public ServiceCall createPolicy(CreatePolicyOptions createPolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyOptions, + "createPolicyOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createPolicyOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createPolicyOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("type", createPolicyOptions.type()); + contentJson.add("subjects", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.subjects())); + contentJson.add("roles", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.roles())); + contentJson.add("resources", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.resources())); + if (createPolicyOptions.description() != null) { + contentJson.addProperty("description", createPolicyOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a policy. + * + * Update a policy to grant access between a subject and a resource. A policy administrator might want to update an + * existing policy. The policy type cannot be changed (You cannot change an access policy to an authorization policy). + * + * ### Access + * + * To update an access policy, use **`"type": "access"`** in the body. The possible subject attributes are + * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or + * service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. Assign roles + * that are supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * The policy resource must include either the **`serviceType`**, **`serviceName`**, or **`resourceGroupId`** + * attribute and the **`accountId`** attribute.` If the subject is a locked service-id, the request will fail. + * + * ### Authorization + * + * To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match + * the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following + * attributes are supported: + * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are + * supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access + * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject + * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. + * + * ### Attribute Operators + * + * Currently, only the `stringEquals` and the `stringMatch` operators are available. Resource attributes might support + * one or both operators. For more information, see [Assigning access by using wildcard + * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). + * + * ### Attribute Validations + * + * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like + * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated + * against Global Catalog locations. + * + * @param replacePolicyOptions the {@link ReplacePolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Policy} + */ + public ServiceCall replacePolicy(ReplacePolicyOptions replacePolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replacePolicyOptions, + "replacePolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_id", replacePolicyOptions.policyId()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replacePolicy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replacePolicyOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("type", replacePolicyOptions.type()); + contentJson.add("subjects", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.subjects())); + contentJson.add("roles", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.roles())); + contentJson.add("resources", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.resources())); + if (replacePolicyOptions.description() != null) { + contentJson.addProperty("description", replacePolicyOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a policy by ID. + * + * Retrieve a policy by providing a policy ID. + * + * @param getPolicyOptions the {@link GetPolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateMetaData} + */ + public ServiceCall getPolicy(GetPolicyOptions getPolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyOptions, + "getPolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_id", getPolicyOptions.policyId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicy"); + 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); + } + + /** + * Delete a policy by ID. + * + * Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service + * ID. If the subject of the policy is a locked service-id, the request will fail. + * + * @param deletePolicyOptions the {@link DeletePolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deletePolicy(DeletePolicyOptions deletePolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyOptions, + "deletePolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_id", deletePolicyOptions.policyId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Restore a deleted policy by ID. + * + * Restore a policy that has recently been deleted. A policy administrator might want to restore a deleted policy. To + * restore a policy, use **`"state": "active"`** in the body. + * + * @param updatePolicyStateOptions the {@link UpdatePolicyStateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Policy} + */ + public ServiceCall updatePolicyState(UpdatePolicyStateOptions updatePolicyStateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updatePolicyStateOptions, + "updatePolicyStateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_id", updatePolicyStateOptions.policyId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updatePolicyState"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updatePolicyStateOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + if (updatePolicyStateOptions.state() != null) { + contentJson.addProperty("state", updatePolicyStateOptions.state()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get roles by filters. + * + * Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can + * be done through query parameters. Currently, we only support the following attributes: account_id, service_name, + * service_group_id, source_service_name and policy_type. Both service_name and service_group_id attributes are + * mutually exclusive. Only roles that match the filter and that the caller has read access to are returned. If the + * caller does not have read access to any roles an empty array is returned. + * + * @param listRolesOptions the {@link ListRolesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleCollection} + */ + public ServiceCall listRoles(ListRolesOptions listRolesOptions) { + if (listRolesOptions == null) { + listRolesOptions = new ListRolesOptions.Builder().build(); + } + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoles"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listRolesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listRolesOptions.acceptLanguage()); + } + if (listRolesOptions.accountId() != null) { + builder.query("account_id", String.valueOf(listRolesOptions.accountId())); + } + if (listRolesOptions.serviceName() != null) { + builder.query("service_name", String.valueOf(listRolesOptions.serviceName())); + } + if (listRolesOptions.sourceServiceName() != null) { + builder.query("source_service_name", String.valueOf(listRolesOptions.sourceServiceName())); + } + if (listRolesOptions.policyType() != null) { + builder.query("policy_type", String.valueOf(listRolesOptions.policyType())); + } + if (listRolesOptions.serviceGroupId() != null) { + builder.query("service_group_id", String.valueOf(listRolesOptions.serviceGroupId())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get roles by filters. + * + * Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can + * be done through query parameters. Currently, we only support the following attributes: account_id, service_name, + * service_group_id, source_service_name and policy_type. Both service_name and service_group_id attributes are + * mutually exclusive. Only roles that match the filter and that the caller has read access to are returned. If the + * caller does not have read access to any roles an empty array is returned. + * + * @return a {@link ServiceCall} with a result of type {@link RoleCollection} + */ + public ServiceCall listRoles() { + return listRoles(null); + } + + /** + * Create a role. + * + * Creates a custom role for a specific service within the account. An account owner or a user assigned the + * Administrator role on the Role management service can create a custom role. Any number of actions for a single + * service can be mapped to the new role, but there must be at least one service-defined action to successfully create + * the new role. + * + * @param createRoleOptions the {@link CreateRoleOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link CustomRole} + */ + public ServiceCall createRole(CreateRoleOptions createRoleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleOptions, + "createRoleOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRole"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createRoleOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createRoleOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("display_name", createRoleOptions.displayName()); + contentJson.add("actions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleOptions.actions())); + contentJson.addProperty("name", createRoleOptions.name()); + contentJson.addProperty("account_id", createRoleOptions.accountId()); + contentJson.addProperty("service_name", createRoleOptions.serviceName()); + if (createRoleOptions.description() != null) { + contentJson.addProperty("description", createRoleOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a role. + * + * Update a custom role. A role administrator might want to update an existing role by updating the display name, + * description, or the actions that are mapped to the role. The name, account_id, and service_name can't be changed. + * + * @param replaceRoleOptions the {@link ReplaceRoleOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link CustomRole} + */ + public ServiceCall replaceRole(ReplaceRoleOptions replaceRoleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceRoleOptions, + "replaceRoleOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_id", replaceRoleOptions.roleId()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceRole"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replaceRoleOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("display_name", replaceRoleOptions.displayName()); + contentJson.add("actions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRoleOptions.actions())); + if (replaceRoleOptions.description() != null) { + contentJson.addProperty("description", replaceRoleOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a role by ID. + * + * Retrieve a role by providing a role ID. + * + * @param getRoleOptions the {@link GetRoleOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link CustomRole} + */ + public ServiceCall getRole(GetRoleOptions getRoleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleOptions, + "getRoleOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_id", getRoleOptions.roleId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRole"); + 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); + } + + /** + * Delete a role by ID. + * + * Delete a role by providing a role ID. + * + * @param deleteRoleOptions the {@link DeleteRoleOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteRole(DeleteRoleOptions deleteRoleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleOptions, + "deleteRoleOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_id", deleteRoleOptions.roleId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRole"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get policies by attributes. + * + * Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account + * and filter by attribute values. This can be done through query parameters. The following attributes are supported: + * account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query + * parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If + * the caller does not have read access to any policies an empty array is returned. + * + * @param listV2PoliciesOptions the {@link ListV2PoliciesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link V2PolicyCollection} + */ + public ServiceCall listV2Policies(ListV2PoliciesOptions listV2PoliciesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listV2PoliciesOptions, + "listV2PoliciesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listV2Policies"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listV2PoliciesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listV2PoliciesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listV2PoliciesOptions.accountId())); + if (listV2PoliciesOptions.iamId() != null) { + builder.query("iam_id", String.valueOf(listV2PoliciesOptions.iamId())); + } + if (listV2PoliciesOptions.accessGroupId() != null) { + builder.query("access_group_id", String.valueOf(listV2PoliciesOptions.accessGroupId())); + } + if (listV2PoliciesOptions.type() != null) { + builder.query("type", String.valueOf(listV2PoliciesOptions.type())); + } + if (listV2PoliciesOptions.serviceType() != null) { + builder.query("service_type", String.valueOf(listV2PoliciesOptions.serviceType())); + } + if (listV2PoliciesOptions.serviceName() != null) { + builder.query("service_name", String.valueOf(listV2PoliciesOptions.serviceName())); + } + if (listV2PoliciesOptions.serviceGroupId() != null) { + builder.query("service_group_id", String.valueOf(listV2PoliciesOptions.serviceGroupId())); + } + if (listV2PoliciesOptions.sort() != null) { + builder.query("sort", String.valueOf(listV2PoliciesOptions.sort())); + } + if (listV2PoliciesOptions.format() != null) { + builder.query("format", String.valueOf(listV2PoliciesOptions.format())); + } + if (listV2PoliciesOptions.state() != null) { + builder.query("state", String.valueOf(listV2PoliciesOptions.state())); + } + if (listV2PoliciesOptions.limit() != null) { + builder.query("limit", String.valueOf(listV2PoliciesOptions.limit())); + } + if (listV2PoliciesOptions.start() != null) { + builder.query("start", String.valueOf(listV2PoliciesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a policy. + * + * Creates a policy to grant access between a subject and a resource. Currently, there is one type of a v2/policy: + * **access**. A policy administrator might want to create an access policy that grants access to a user, service-id, + * or an access group. + * + * ### Access + * + * To create an access policy, use **`"type": "access"`** in the body. The supported subject attributes are + * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute to assign access to a user or + * service-id. Use the **`access_group_id`** subject attribute to assign access to an access group. Assign roles that + * are supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or + * **`service_group_id`** attribute and the **`accountId`** attribute. In the rule field, you can specify a single + * condition by using **`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`** with a + * combination **`operator`**. The possible combination operators are **`and`** and **`or`**. + * + * Currently, we support two types of patterns: + * + * 1. `time-based`: Used to specify a time-based restriction + * + * Combine conditions to specify a time-based restriction (e.g., access only during business hours, during the + * Monday-Friday work week). For example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following + * rule: + * ```json + * "rule": { + * "operator": "and", + * "conditions": [{ + * "key": "{{environment.attributes.day_of_week}}", + * "operator": "dayOfWeekAnyOf", + * "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] + * }, + * "key": "{{environment.attributes.current_time}}", + * "operator": "timeGreaterThanOrEquals", + * "value": "09:00:00+00:00" + * }, + * "key": "{{environment.attributes.current_time}}", + * "operator": "timeLessThanOrEquals", + * "value": "17:00:00+00:00" + * }] + * } + * ``` You can use the following operators in the **`key`** and **`value`** pair: + * ``` + * 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', + * 'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan', 'dateGreaterThanOrEquals', + * 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', + * 'dayOfWeekEquals', 'dayOfWeekAnyOf' + * ``` + * + * The pattern field that matches the rule is required when rule is provided. For the business hour rule example + * above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions + * operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) and + * [Limiting access with time-based conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the + * subject is a locked service-id, the request will fail. + * + * 2. `attribute-based`: Used to specify a combination of OR/AND based conditions applied on resource attributes. + * + * Combine conditions to specify an attribute-based condition using AND/OR-based operators. + * + * For example, a policy can grant access based on multiple conditions applied on the resource attributes below: + * ```json + * "pattern": "attribute-based-condition:resource:literal-and-wildcard" + * "rule": { + * "operator": "or", + * "conditions": [ + * { + * "operator": "and", + * "conditions": [ + * { + * "key": "{{resource.attributes.prefix}}", + * "operator": "stringEquals", + * "value": "home/test" + * }, + * { + * "key": "{{environment.attributes.delimiter}}", + * "operator": "stringEquals", + * "value": "/" + * } + * ] + * }, + * { + * "key": "{{resource.attributes.path}}", + * "operator": "stringMatch", + * "value": "home/David/_*" + * } + * ] + * } + * ``` + * + * In addition to satisfying the `resources` section, the policy grants permission only if either the `path` begins + * with `home/David/` **OR** the `prefix` is `home/test` and the `delimiter` is `/`. This mechanism helps you + * consolidate multiple policies in to a single policy, making policies easier to administer and stay within the + * policy limit for an account. View the list of operators that can be used in the condition + * [here](/docs/account?topic=account-wildcard#string-comparisons). + * + * ### Authorization + * + * Authorization policies are supported by services on a case by case basis. Refer to service documentation to verify + * their support of authorization policies. To create an authorization policy, use **`"type": "authorization"`** in + * the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject + * attributes might be provided. The following attributes are supported: + * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are + * supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access + * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject + * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. + * + * ### Attribute Operators + * + * Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators are available. For more + * information, see [Assigning access by using wildcard + * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). + * + * ### Attribute Validations + * + * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like + * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated + * against Global Catalog locations. + * + * @param createV2PolicyOptions the {@link CreateV2PolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link V2Policy} + */ + public ServiceCall createV2Policy(CreateV2PolicyOptions createV2PolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createV2PolicyOptions, + "createV2PolicyOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createV2Policy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createV2PolicyOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createV2PolicyOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.add("control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.control())); + contentJson.addProperty("type", createV2PolicyOptions.type()); + if (createV2PolicyOptions.description() != null) { + contentJson.addProperty("description", createV2PolicyOptions.description()); + } + if (createV2PolicyOptions.subject() != null) { + contentJson.add("subject", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.subject())); + } + if (createV2PolicyOptions.resource() != null) { + contentJson.add("resource", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.resource())); + } + if (createV2PolicyOptions.pattern() != null) { + contentJson.addProperty("pattern", createV2PolicyOptions.pattern()); + } + if (createV2PolicyOptions.rule() != null) { + contentJson.add("rule", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.rule())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a policy. + * + * Update a policy to grant access between a subject and a resource. A policy administrator might want to update an + * existing policy. + * + * ### Access + * + * To update an access policy, use **`"type": "access"`** in the body. The supported subject attributes are + * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute to assign access to a user or + * service-id. Use the **`access_group_id`** subject attribute to assign access to an access group. Assign roles that + * are supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or + * **`service_group_id`** attribute and the **`accountId`** attribute. In the rule field, you can specify a single + * condition by using **`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`** with a + * combination **`operator`**. The possible combination operators are **`and`** and **`or`**. + * + * Currently, we support two types of patterns: + * + * 1. `time-based`: Used to specify a time-based restriction + * + * Combine conditions to specify a time-based restriction (e.g., access only during business hours, during the + * Monday-Friday work week). For example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following + * rule: + * ```json + * "rule": { + * "operator": "and", + * "conditions": [{ + * "key": "{{environment.attributes.day_of_week}}", + * "operator": "dayOfWeekAnyOf", + * "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] + * }, + * "key": "{{environment.attributes.current_time}}", + * "operator": "timeGreaterThanOrEquals", + * "value": "09:00:00+00:00" + * }, + * "key": "{{environment.attributes.current_time}}", + * "operator": "timeLessThanOrEquals", + * "value": "17:00:00+00:00" + * }] + * } + * ``` You can use the following operators in the **`key`** and **`value`** pair: + * ``` + * 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', + * 'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan', 'dateGreaterThanOrEquals', + * 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', + * 'dayOfWeekEquals', 'dayOfWeekAnyOf' + * ``` The pattern field that matches the rule is required when rule is provided. For the business hour rule example + * above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions + * operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) and + * [Limiting access with time-based conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the + * subject is a locked service-id, the request will fail. + * + * 2. `attribute-based`: Used to specify a combination of OR/AND based conditions applied on resource attributes. + * + * Combine conditions to specify an attribute-based condition using AND/OR-based operators. + * + * For example, a policy can grant access based on multiple conditions applied on the resource attributes below: + * ```json + * "pattern": "attribute-based-condition:resource:literal-and-wildcard" + * "rule": { + * "operator": "or", + * "conditions": [ + * { + * "operator": "and", + * "conditions": [ + * { + * "key": "{{resource.attributes.prefix}}", + * "operator": "stringEquals", + * "value": "home/test" + * }, + * { + * "key": "{{environment.attributes.delimiter}}", + * "operator": "stringEquals", + * "value": "/" + * } + * ] + * }, + * { + * "key": "{{resource.attributes.path}}", + * "operator": "stringMatch", + * "value": "home/David/_*" + * } + * ] + * } + * ``` + * + * In addition to satisfying the `resources` section, the policy grants permission only if either the `path` begins + * with `home/David/` **OR** the `prefix` is `home/test` and the `delimiter` is `/`. This mechanism helps you + * consolidate multiple policies in to a single policy, making policies easier to administer and stay within the + * policy limit for an account. View the list of operators that can be used in the condition + * [here](/docs/account?topic=account-wildcard#string-comparisons). + * + * ### Authorization + * + * To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match + * the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following + * attributes are supported: + * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are + * supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access + * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject + * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. + * + * ### Attribute Operators + * + * Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators are available. For more + * information, see [Assigning access by using wildcard + * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). + * + * ### Attribute Validations + * + * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like + * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated + * against Global Catalog locations. + * + * @param replaceV2PolicyOptions the {@link ReplaceV2PolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link V2Policy} + */ + public ServiceCall replaceV2Policy(ReplaceV2PolicyOptions replaceV2PolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceV2PolicyOptions, + "replaceV2PolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("id", replaceV2PolicyOptions.id()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceV2Policy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replaceV2PolicyOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.add("control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.control())); + contentJson.addProperty("type", replaceV2PolicyOptions.type()); + if (replaceV2PolicyOptions.description() != null) { + contentJson.addProperty("description", replaceV2PolicyOptions.description()); + } + if (replaceV2PolicyOptions.subject() != null) { + contentJson.add("subject", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.subject())); + } + if (replaceV2PolicyOptions.resource() != null) { + contentJson.add("resource", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.resource())); + } + if (replaceV2PolicyOptions.pattern() != null) { + contentJson.addProperty("pattern", replaceV2PolicyOptions.pattern()); + } + if (replaceV2PolicyOptions.rule() != null) { + contentJson.add("rule", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.rule())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a policy by ID. + * + * Retrieve a policy by providing a policy ID. + * + * @param getV2PolicyOptions the {@link GetV2PolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link V2PolicyTemplateMetaData} + */ + public ServiceCall getV2Policy(GetV2PolicyOptions getV2PolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getV2PolicyOptions, + "getV2PolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("id", getV2PolicyOptions.id()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getV2Policy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getV2PolicyOptions.format() != null) { + builder.query("format", String.valueOf(getV2PolicyOptions.format())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a policy by ID. + * + * Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service + * ID. If the subject of the policy is a locked service-id, the request will fail. + * + * @param deleteV2PolicyOptions the {@link DeleteV2PolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteV2Policy(DeleteV2PolicyOptions deleteV2PolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteV2PolicyOptions, + "deleteV2PolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("id", deleteV2PolicyOptions.id()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteV2Policy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * List policy templates by attributes. + * + * List policy templates and filter by attributes by using query parameters. The following attributes are supported: + * `account_id`, `policy_service_name`, `policy_service_type`, `policy_service_group_id` and `policy_type`. + * `account_id` is a required query parameter. These attributes `policy_service_name`, `policy_service_type` and + * `policy_service_group_id` are mutually exclusive. Only policy templates that have the specified attributes and that + * the caller has read access to are returned. If the caller does not have read access to any policy templates an + * empty array is returned. + * + * @param listPolicyTemplatesOptions the {@link ListPolicyTemplatesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateCollection} + */ + public ServiceCall listPolicyTemplates(ListPolicyTemplatesOptions listPolicyTemplatesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyTemplatesOptions, + "listPolicyTemplatesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyTemplates"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listPolicyTemplatesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listPolicyTemplatesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listPolicyTemplatesOptions.accountId())); + if (listPolicyTemplatesOptions.state() != null) { + builder.query("state", String.valueOf(listPolicyTemplatesOptions.state())); + } + if (listPolicyTemplatesOptions.name() != null) { + builder.query("name", String.valueOf(listPolicyTemplatesOptions.name())); + } + if (listPolicyTemplatesOptions.policyServiceType() != null) { + builder.query("policy_service_type", String.valueOf(listPolicyTemplatesOptions.policyServiceType())); + } + if (listPolicyTemplatesOptions.policyServiceName() != null) { + builder.query("policy_service_name", String.valueOf(listPolicyTemplatesOptions.policyServiceName())); + } + if (listPolicyTemplatesOptions.policyServiceGroupId() != null) { + builder.query("policy_service_group_id", String.valueOf(listPolicyTemplatesOptions.policyServiceGroupId())); + } + if (listPolicyTemplatesOptions.policyType() != null) { + builder.query("policy_type", String.valueOf(listPolicyTemplatesOptions.policyType())); + } + if (listPolicyTemplatesOptions.limit() != null) { + builder.query("limit", String.valueOf(listPolicyTemplatesOptions.limit())); + } + if (listPolicyTemplatesOptions.start() != null) { + builder.query("start", String.valueOf(listPolicyTemplatesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a policy template. + * + * Create a policy template. Policy templates define a policy without requiring a subject, and you can use them to + * grant access to multiple subjects. + * + * @param createPolicyTemplateOptions the {@link CreatePolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateLimitData} + */ + public ServiceCall createPolicyTemplate(CreatePolicyTemplateOptions createPolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateOptions, + "createPolicyTemplateOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createPolicyTemplateOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createPolicyTemplateOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("name", createPolicyTemplateOptions.name()); + contentJson.addProperty("account_id", createPolicyTemplateOptions.accountId()); + contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateOptions.policy())); + if (createPolicyTemplateOptions.description() != null) { + contentJson.addProperty("description", createPolicyTemplateOptions.description()); + } + if (createPolicyTemplateOptions.committed() != null) { + contentJson.addProperty("committed", createPolicyTemplateOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve latest version of a policy template. + * + * Retrieve the latest version of a policy template by providing a policy template ID. + * + * @param getPolicyTemplateOptions the {@link GetPolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} + */ + public ServiceCall getPolicyTemplate(GetPolicyTemplateOptions getPolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyTemplateOptions, + "getPolicyTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", getPolicyTemplateOptions.policyTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getPolicyTemplateOptions.state() != null) { + builder.query("state", String.valueOf(getPolicyTemplateOptions.state())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a policy template. + * + * Delete a policy template by providing the policy template ID. This deletes all versions of this template. A policy + * template can't be deleted if any version of the template is assigned to one or more child accounts. You must remove + * the policy assignments first. + * + * @param deletePolicyTemplateOptions the {@link DeletePolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deletePolicyTemplate(DeletePolicyTemplateOptions deletePolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyTemplateOptions, + "deletePolicyTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", deletePolicyTemplateOptions.policyTemplateId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a new policy template version. + * + * Create a new version of a policy template. Use this if you need to make updates to a policy template that is + * committed. + * + * @param createPolicyTemplateVersionOptions the {@link CreatePolicyTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateLimitData} + */ + public ServiceCall createPolicyTemplateVersion(CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateVersionOptions, + "createPolicyTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", createPolicyTemplateVersionOptions.policyTemplateId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateVersionOptions.policy())); + if (createPolicyTemplateVersionOptions.name() != null) { + contentJson.addProperty("name", createPolicyTemplateVersionOptions.name()); + } + if (createPolicyTemplateVersionOptions.description() != null) { + contentJson.addProperty("description", createPolicyTemplateVersionOptions.description()); + } + if (createPolicyTemplateVersionOptions.committed() != null) { + contentJson.addProperty("committed", createPolicyTemplateVersionOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve policy template versions. + * + * Retrieve the versions of a policy template by providing a policy template ID. + * + * @param listPolicyTemplateVersionsOptions the {@link ListPolicyTemplateVersionsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateVersionsCollection} + */ + public ServiceCall listPolicyTemplateVersions(ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyTemplateVersionsOptions, + "listPolicyTemplateVersionsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", listPolicyTemplateVersionsOptions.policyTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyTemplateVersions"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listPolicyTemplateVersionsOptions.state() != null) { + builder.query("state", String.valueOf(listPolicyTemplateVersionsOptions.state())); + } + if (listPolicyTemplateVersionsOptions.limit() != null) { + builder.query("limit", String.valueOf(listPolicyTemplateVersionsOptions.limit())); + } + if (listPolicyTemplateVersionsOptions.start() != null) { + builder.query("start", String.valueOf(listPolicyTemplateVersionsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a policy template version. + * + * Update a specific version of a policy template. You can use this only if the version isn't committed. + * + * @param replacePolicyTemplateOptions the {@link ReplacePolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} + */ + public ServiceCall replacePolicyTemplate(ReplacePolicyTemplateOptions replacePolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replacePolicyTemplateOptions, + "replacePolicyTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", replacePolicyTemplateOptions.policyTemplateId()); + pathParamsMap.put("version", replacePolicyTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replacePolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replacePolicyTemplateOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyTemplateOptions.policy())); + if (replacePolicyTemplateOptions.name() != null) { + contentJson.addProperty("name", replacePolicyTemplateOptions.name()); + } + if (replacePolicyTemplateOptions.description() != null) { + contentJson.addProperty("description", replacePolicyTemplateOptions.description()); + } + if (replacePolicyTemplateOptions.committed() != null) { + contentJson.addProperty("committed", replacePolicyTemplateOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a policy template version. + * + * Delete a specific version of a policy template by providing a policy template ID and version number. You can't + * delete a policy template version that is assigned to one or more child accounts. You must remove the policy + * assignments first. + * + * @param deletePolicyTemplateVersionOptions the {@link DeletePolicyTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deletePolicyTemplateVersion(DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyTemplateVersionOptions, + "deletePolicyTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", deletePolicyTemplateVersionOptions.policyTemplateId()); + pathParamsMap.put("version", deletePolicyTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a policy template version. + * + * Retrieve a policy template by providing a policy template ID and version number. + * + * @param getPolicyTemplateVersionOptions the {@link GetPolicyTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} + */ + public ServiceCall getPolicyTemplateVersion(GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyTemplateVersionOptions, + "getPolicyTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", getPolicyTemplateVersionOptions.policyTemplateId()); + pathParamsMap.put("version", getPolicyTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyTemplateVersion"); + 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); + } + + /** + * Commit a policy template version. + * + * Commit a policy template version. You can make no further changes to the policy template once it's committed. If + * you need to make updates after committing a version, create a new version. + * + * @param commitPolicyTemplateOptions the {@link CommitPolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall commitPolicyTemplate(CommitPolicyTemplateOptions commitPolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(commitPolicyTemplateOptions, + "commitPolicyTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", commitPolicyTemplateOptions.policyTemplateId()); + pathParamsMap.put("version", commitPolicyTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}/commit", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitPolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get policy template assignments. + * + * Get policy template assignments by attributes. The following attributes are supported: + * `account_id`, `template_id`, `template_version`, `sort`. + * `account_id` is a required query parameter. Only policy template assignments that have the specified attributes and + * that the caller has read access to are returned. If the caller does not have read access to any policy template + * assignments an empty array is returned. + * + * @param listPolicyAssignmentsOptions the {@link ListPolicyAssignmentsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateAssignmentCollection} + */ + public ServiceCall listPolicyAssignments(ListPolicyAssignmentsOptions listPolicyAssignmentsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyAssignmentsOptions, + "listPolicyAssignmentsOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyAssignments"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listPolicyAssignmentsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listPolicyAssignmentsOptions.acceptLanguage()); + } + builder.query("version", String.valueOf(listPolicyAssignmentsOptions.version())); + builder.query("account_id", String.valueOf(listPolicyAssignmentsOptions.accountId())); + if (listPolicyAssignmentsOptions.templateId() != null) { + builder.query("template_id", String.valueOf(listPolicyAssignmentsOptions.templateId())); + } + if (listPolicyAssignmentsOptions.templateVersion() != null) { + builder.query("template_version", String.valueOf(listPolicyAssignmentsOptions.templateVersion())); + } + if (listPolicyAssignmentsOptions.limit() != null) { + builder.query("limit", String.valueOf(listPolicyAssignmentsOptions.limit())); + } + if (listPolicyAssignmentsOptions.start() != null) { + builder.query("start", String.valueOf(listPolicyAssignmentsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a policy authorization template assignment. + * + * Assign a policy template to child accounts and account groups. This creates the policy in the accounts and account + * groups that you specify. + * + * @param createPolicyTemplateAssignmentOptions the {@link CreatePolicyTemplateAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyAssignmentV1Collection} + */ + public ServiceCall createPolicyTemplateAssignment(CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateAssignmentOptions, + "createPolicyTemplateAssignmentOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplateAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createPolicyTemplateAssignmentOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createPolicyTemplateAssignmentOptions.acceptLanguage()); + } + builder.query("version", String.valueOf(createPolicyTemplateAssignmentOptions.version())); + final JsonObject contentJson = new JsonObject(); + contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateAssignmentOptions.target())); + contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateAssignmentOptions.templates())); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a policy assignment. + * + * Retrieve a policy template assignment by providing a policy assignment ID. + * + * @param getPolicyAssignmentOptions the {@link GetPolicyAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateAssignmentItems} + */ + public ServiceCall getPolicyAssignment(GetPolicyAssignmentOptions getPolicyAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyAssignmentOptions, + "getPolicyAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", getPolicyAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.query("version", String.valueOf(getPolicyAssignmentOptions.version())); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a policy authorization type assignment. + * + * Update a policy assignment by providing a policy assignment ID. + * + * @param updatePolicyAssignmentOptions the {@link UpdatePolicyAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyAssignmentV1} + */ + public ServiceCall updatePolicyAssignment(UpdatePolicyAssignmentOptions updatePolicyAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updatePolicyAssignmentOptions, + "updatePolicyAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", updatePolicyAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updatePolicyAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updatePolicyAssignmentOptions.ifMatch()); + builder.query("version", String.valueOf(updatePolicyAssignmentOptions.version())); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("template_version", updatePolicyAssignmentOptions.templateVersion()); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Remove a policy assignment. + * + * Remove a policy template assignment by providing a policy assignment ID. You can't delete a policy assignment if + * the status is "in_progress". + * + * @param deletePolicyAssignmentOptions the {@link DeletePolicyAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deletePolicyAssignment(DeletePolicyAssignmentOptions deletePolicyAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyAssignmentOptions, + "deletePolicyAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", deletePolicyAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve Access Management account settings by account ID. + * + * Retrieve Access Management settings for an account by providing the account ID. + * + * @param getSettingsOptions the {@link GetSettingsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccountSettingsAccessManagement} + */ + public ServiceCall getSettings(GetSettingsOptions getSettingsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getSettingsOptions, + "getSettingsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("account_id", getSettingsOptions.accountId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/settings/access_management", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getSettings"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getSettingsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", getSettingsOptions.acceptLanguage()); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update Access Management account settings by account ID. + * + * Update access management settings for an account. + * + * ### External Account Identity Interaction + * + * Update the way identities within an external account are allowed to interact with the requested account by + * providing: + * * the `account_id` as a parameter + * * one or more external account ID(s) and state for the specific identity in the request body + * + * External account identity interaction includes the following `identity_types`: `user` (user identities that are + * defined as [IBMid's](https://cloud.ibm.com/docs/account?topic=account-identity-overview#users-bestpract)), + * `service_id` (defined as [IAM + * ServiceIds](https://cloud.ibm.com/docs/account?topic=account-identity-overview#serviceid-bestpract)), `service` + * (defined by a service’s [CRN](https://cloud.ibm.com/docs/account?topic=account-crn)). To update an Identity’s + * setting, the `state` and `external_allowed_accounts` fields are required. + * + * Different identity states are: + * * "enabled": An identity type is allowed to access resources in the account provided it has access policies on + * those resources. + * * "limited": An identity type is allowed to access resources in the account provided it has access policies on + * those resources AND it is associated with either the account the resources are in or one of the allowed accounts. + * This setting uses the "external_allowed_accounts" list. + * * "monitor": It has no direct impact on an Identity’s access. Instead, it creates AT events for access decisions as + * if the account were in a limited “state”. + * + * **Note**: The state "enabled" is a special case. In this case, access is given to all accounts and there is no need + * to specify a particular list. Therefore, when updating "state" to "enabled" for an identity type + * "external_allowed_accounts" should be left empty. + * + * @param updateSettingsOptions the {@link UpdateSettingsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccountSettingsAccessManagement} + */ + public ServiceCall updateSettings(UpdateSettingsOptions updateSettingsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateSettingsOptions, + "updateSettingsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("account_id", updateSettingsOptions.accountId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/settings/access_management", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateSettings"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updateSettingsOptions.ifMatch()); + if (updateSettingsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", updateSettingsOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + if (updateSettingsOptions.externalAccountIdentityInteraction() != null) { + contentJson.add("external_account_identity_interaction", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateSettingsOptions.externalAccountIdentityInteraction())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * List action control templates by attributes. + * + * List action control templates and filter by attributes by using query parameters. The following attributes are + * supported: + * `account_id` + * `account_id` is a required query parameter. Only action control templates that have the specified attributes and + * that the caller has read access to are returned. If the caller does not have read access to any action control + * templates an empty array is returned. + * + * @param listActionControlTemplatesOptions the {@link ListActionControlTemplatesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplateCollection} + */ + public ServiceCall listActionControlTemplates(ListActionControlTemplatesOptions listActionControlTemplatesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlTemplatesOptions, + "listActionControlTemplatesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlTemplates"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listActionControlTemplatesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listActionControlTemplatesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listActionControlTemplatesOptions.accountId())); + if (listActionControlTemplatesOptions.limit() != null) { + builder.query("limit", String.valueOf(listActionControlTemplatesOptions.limit())); + } + if (listActionControlTemplatesOptions.start() != null) { + builder.query("start", String.valueOf(listActionControlTemplatesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create an action control template. + * + * Create an action control template. Action control templates define a service action control. + * + * @param createActionControlTemplateOptions the {@link CreateActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall createActionControlTemplate(CreateActionControlTemplateOptions createActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateOptions, + "createActionControlTemplateOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createActionControlTemplateOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createActionControlTemplateOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("name", createActionControlTemplateOptions.name()); + contentJson.addProperty("account_id", createActionControlTemplateOptions.accountId()); + if (createActionControlTemplateOptions.description() != null) { + contentJson.addProperty("description", createActionControlTemplateOptions.description()); + } + if (createActionControlTemplateOptions.committed() != null) { + contentJson.addProperty("committed", createActionControlTemplateOptions.committed()); + } + if (createActionControlTemplateOptions.actionControl() != null) { + contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateOptions.actionControl())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve the latest version of an action control template. + * + * Retrieve the latest version of an action control template by providing an action control template ID. + * + * @param getActionControlTemplateOptions the {@link GetActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall getActionControlTemplate(GetActionControlTemplateOptions getActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlTemplateOptions, + "getActionControlTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", getActionControlTemplateOptions.actionControlTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getActionControlTemplateOptions.state() != null) { + builder.query("state", String.valueOf(getActionControlTemplateOptions.state())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete an action control template. + * + * Delete an action control template by providing the action control template ID. This deletes all versions of this + * template. An action control template can't be deleted if any version of the template is assigned to one or more + * child accounts. You must remove the action control assignments first. + * + * @param deleteActionControlTemplateOptions the {@link DeleteActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteActionControlTemplate(DeleteActionControlTemplateOptions deleteActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlTemplateOptions, + "deleteActionControlTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", deleteActionControlTemplateOptions.actionControlTemplateId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a new action control template version. + * + * Create a new version of an action control template. Use this if you need to make updates to an action control + * template that is committed. + * + * @param createActionControlTemplateVersionOptions the {@link CreateActionControlTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall createActionControlTemplateVersion(CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateVersionOptions, + "createActionControlTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", createActionControlTemplateVersionOptions.actionControlTemplateId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + if (createActionControlTemplateVersionOptions.name() != null) { + contentJson.addProperty("name", createActionControlTemplateVersionOptions.name()); + } + if (createActionControlTemplateVersionOptions.description() != null) { + contentJson.addProperty("description", createActionControlTemplateVersionOptions.description()); + } + if (createActionControlTemplateVersionOptions.actionControl() != null) { + contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateVersionOptions.actionControl())); + } + if (createActionControlTemplateVersionOptions.committed() != null) { + contentJson.addProperty("committed", createActionControlTemplateVersionOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve action control template versions. + * + * Retrieve the versions of an action control template by providing an action control template ID. + * + * @param listActionControlTemplateVersionsOptions the {@link ListActionControlTemplateVersionsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplateVersionsCollection} + */ + public ServiceCall listActionControlTemplateVersions(ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlTemplateVersionsOptions, + "listActionControlTemplateVersionsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", listActionControlTemplateVersionsOptions.actionControlTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlTemplateVersions"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listActionControlTemplateVersionsOptions.state() != null) { + builder.query("state", String.valueOf(listActionControlTemplateVersionsOptions.state())); + } + if (listActionControlTemplateVersionsOptions.limit() != null) { + builder.query("limit", String.valueOf(listActionControlTemplateVersionsOptions.limit())); + } + if (listActionControlTemplateVersionsOptions.start() != null) { + builder.query("start", String.valueOf(listActionControlTemplateVersionsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update an action control template version. + * + * Update a specific version of an action control template. You can use this only if the version isn't committed. + * + * @param replaceActionControlTemplateOptions the {@link ReplaceActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall replaceActionControlTemplate(ReplaceActionControlTemplateOptions replaceActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceActionControlTemplateOptions, + "replaceActionControlTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", replaceActionControlTemplateOptions.actionControlTemplateId()); + pathParamsMap.put("version", replaceActionControlTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replaceActionControlTemplateOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + if (replaceActionControlTemplateOptions.name() != null) { + contentJson.addProperty("name", replaceActionControlTemplateOptions.name()); + } + if (replaceActionControlTemplateOptions.description() != null) { + contentJson.addProperty("description", replaceActionControlTemplateOptions.description()); + } + if (replaceActionControlTemplateOptions.actionControl() != null) { + contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceActionControlTemplateOptions.actionControl())); + } + if (replaceActionControlTemplateOptions.committed() != null) { + contentJson.addProperty("committed", replaceActionControlTemplateOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete an action control template version. + * + * Delete a specific version of an action control template by providing an action control template ID and version + * number. You can't delete an action control template version that is assigned to one or more child accounts. You + * must remove the action control assignments first. + * + * @param deleteActionControlTemplateVersionOptions the {@link DeleteActionControlTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteActionControlTemplateVersion(DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlTemplateVersionOptions, + "deleteActionControlTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", deleteActionControlTemplateVersionOptions.actionControlTemplateId()); + pathParamsMap.put("version", deleteActionControlTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve an action control template version. + * + * Retrieve an action control template by providing an action control template ID and version number. + * + * @param getActionControlTemplateVersionOptions the {@link GetActionControlTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall getActionControlTemplateVersion(GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlTemplateVersionOptions, + "getActionControlTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", getActionControlTemplateVersionOptions.actionControlTemplateId()); + pathParamsMap.put("version", getActionControlTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlTemplateVersion"); + 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); + } + + /** + * Commit an action control template version. + * + * Commit an action control template version. You cannot make any further changes to the action control template once + * it's committed. If you have to make updates after committing a version, create a new version. + * + * @param commitActionControlTemplateOptions the {@link CommitActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall commitActionControlTemplate(CommitActionControlTemplateOptions commitActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(commitActionControlTemplateOptions, + "commitActionControlTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", commitActionControlTemplateOptions.actionControlTemplateId()); + pathParamsMap.put("version", commitActionControlTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}/commit", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get action control template assignments. + * + * Get action control template assignments by attributes. The following attributes are supported: + * `account_id`, `template_id`, `template_version`, `sort`. + * `account_id` is a required query parameter. Only action control template assignments with the specified attributes + * and accessible by the caller are returned. If the caller does not have read access to any action control template + * assignments, an empty array is returned. + * + * @param listActionControlAssignmentsOptions the {@link ListActionControlAssignmentsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignmentCollection} + */ + public ServiceCall listActionControlAssignments(ListActionControlAssignmentsOptions listActionControlAssignmentsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlAssignmentsOptions, + "listActionControlAssignmentsOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlAssignments"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listActionControlAssignmentsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listActionControlAssignmentsOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listActionControlAssignmentsOptions.accountId())); + if (listActionControlAssignmentsOptions.templateId() != null) { + builder.query("template_id", String.valueOf(listActionControlAssignmentsOptions.templateId())); + } + if (listActionControlAssignmentsOptions.templateVersion() != null) { + builder.query("template_version", String.valueOf(listActionControlAssignmentsOptions.templateVersion())); + } + if (listActionControlAssignmentsOptions.limit() != null) { + builder.query("limit", String.valueOf(listActionControlAssignmentsOptions.limit())); + } + if (listActionControlAssignmentsOptions.start() != null) { + builder.query("start", String.valueOf(listActionControlAssignmentsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create an action control template assignment. + * + * Assign an action control template to child accounts and account groups. This creates the action control in the + * accounts and account groups that you specify. + * + * @param createActionControlTemplateAssignmentOptions the {@link CreateActionControlTemplateAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignmentCollection} + */ + public ServiceCall createActionControlTemplateAssignment(CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateAssignmentOptions, + "createActionControlTemplateAssignmentOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplateAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createActionControlTemplateAssignmentOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createActionControlTemplateAssignmentOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateAssignmentOptions.target())); + contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateAssignmentOptions.templates())); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve an action control assignment. + * + * Retrieve an action control template assignment by providing an action control assignment ID. + * + * @param getActionControlAssignmentOptions the {@link GetActionControlAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignment} + */ + public ServiceCall getActionControlAssignment(GetActionControlAssignmentOptions getActionControlAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlAssignmentOptions, + "getActionControlAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", getActionControlAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlAssignment"); + 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 an action control assignment. + * + * Update an action control assignment by providing an action control assignment ID. + * + * @param updateActionControlAssignmentOptions the {@link UpdateActionControlAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignment} + */ + public ServiceCall updateActionControlAssignment(UpdateActionControlAssignmentOptions updateActionControlAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateActionControlAssignmentOptions, + "updateActionControlAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", updateActionControlAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateActionControlAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updateActionControlAssignmentOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("template_version", updateActionControlAssignmentOptions.templateVersion()); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Remove an action control assignment. + * + * Remove an action control template assignment by providing an action control assignment ID. You can't delete an + * action control assignment if the status is "in_progress". + * + * @param deleteActionControlAssignmentOptions the {@link DeleteActionControlAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteActionControlAssignment(DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlAssignmentOptions, + "deleteActionControlAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", deleteActionControlAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * List role templates by attributes. + * + * List role templates and filter by attributes by using query parameters. The following attributes are supported: + * `account_id`, `name`, `role_name`, `role_service_name`, `state`, `limit`, `start`. + * `account_id` is a required query parameter. Only role templates that have the specified attributes and that the + * caller has read access to are returned. If the caller does not have read access to any role templates an empty + * array is returned. + * + * @param listRoleTemplatesOptions the {@link ListRoleTemplatesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplateCollection} + */ + public ServiceCall listRoleTemplates(ListRoleTemplatesOptions listRoleTemplatesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleTemplatesOptions, + "listRoleTemplatesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleTemplates"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listRoleTemplatesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listRoleTemplatesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listRoleTemplatesOptions.accountId())); + if (listRoleTemplatesOptions.name() != null) { + builder.query("name", String.valueOf(listRoleTemplatesOptions.name())); + } + if (listRoleTemplatesOptions.roleName() != null) { + builder.query("role_name", String.valueOf(listRoleTemplatesOptions.roleName())); + } + if (listRoleTemplatesOptions.roleServiceName() != null) { + builder.query("role_service_name", String.valueOf(listRoleTemplatesOptions.roleServiceName())); + } + if (listRoleTemplatesOptions.state() != null) { + builder.query("state", String.valueOf(listRoleTemplatesOptions.state())); + } + if (listRoleTemplatesOptions.limit() != null) { + builder.query("limit", String.valueOf(listRoleTemplatesOptions.limit())); + } + if (listRoleTemplatesOptions.start() != null) { + builder.query("start", String.valueOf(listRoleTemplatesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create role template. + * + * Create a role template. Role templates define roles from an existing system or service defined role. + * + * @param createRoleTemplateOptions the {@link CreateRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall createRoleTemplate(CreateRoleTemplateOptions createRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateOptions, + "createRoleTemplateOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createRoleTemplateOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createRoleTemplateOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("name", createRoleTemplateOptions.name()); + contentJson.addProperty("account_id", createRoleTemplateOptions.accountId()); + if (createRoleTemplateOptions.description() != null) { + contentJson.addProperty("description", createRoleTemplateOptions.description()); + } + if (createRoleTemplateOptions.committed() != null) { + contentJson.addProperty("committed", createRoleTemplateOptions.committed()); + } + if (createRoleTemplateOptions.role() != null) { + contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateOptions.role())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve the latest version of a role template. + * + * Retrieve the latest version of a role template by providing a role template ID. + * + * @param getRoleTemplateOptions the {@link GetRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall getRoleTemplate(GetRoleTemplateOptions getRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleTemplateOptions, + "getRoleTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", getRoleTemplateOptions.roleTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getRoleTemplateOptions.state() != null) { + builder.query("state", String.valueOf(getRoleTemplateOptions.state())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a Role template. + * + * Delete a role template by providing the role template ID. This deletes all versions of this template. A role + * template can't be deleted if any version of the template is assigned to one or more child accounts. You must remove + * the role assignments first. + * + * @param deleteRoleTemplateOptions the {@link DeleteRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteRoleTemplate(DeleteRoleTemplateOptions deleteRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleTemplateOptions, + "deleteRoleTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", deleteRoleTemplateOptions.roleTemplateId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a new role template version. + * + * Create a new version of a role template. Use this if you need to make updates to a role template that is committed. + * + * @param createRoleTemplateVersionOptions the {@link CreateRoleTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall createRoleTemplateVersion(CreateRoleTemplateVersionOptions createRoleTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateVersionOptions, + "createRoleTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", createRoleTemplateVersionOptions.roleTemplateId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + if (createRoleTemplateVersionOptions.name() != null) { + contentJson.addProperty("name", createRoleTemplateVersionOptions.name()); + } + if (createRoleTemplateVersionOptions.description() != null) { + contentJson.addProperty("description", createRoleTemplateVersionOptions.description()); + } + if (createRoleTemplateVersionOptions.role() != null) { + contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateVersionOptions.role())); + } + if (createRoleTemplateVersionOptions.committed() != null) { + contentJson.addProperty("committed", createRoleTemplateVersionOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve role template versions. + * + * Retrieve the versions of a role template by providing a role template ID. + * + * @param listRoleTemplateVersionsOptions the {@link ListRoleTemplateVersionsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplateVersionsCollection} + */ + public ServiceCall listRoleTemplateVersions(ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleTemplateVersionsOptions, + "listRoleTemplateVersionsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", listRoleTemplateVersionsOptions.roleTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleTemplateVersions"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listRoleTemplateVersionsOptions.state() != null) { + builder.query("state", String.valueOf(listRoleTemplateVersionsOptions.state())); + } + if (listRoleTemplateVersionsOptions.limit() != null) { + builder.query("limit", String.valueOf(listRoleTemplateVersionsOptions.limit())); + } + if (listRoleTemplateVersionsOptions.start() != null) { + builder.query("start", String.valueOf(listRoleTemplateVersionsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a role template version. + * + * Update a specific version of a role template. You can use this only if the version isn't committed. + * + * @param replaceRoleTemplateOptions the {@link ReplaceRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall replaceRoleTemplate(ReplaceRoleTemplateOptions replaceRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceRoleTemplateOptions, + "replaceRoleTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", replaceRoleTemplateOptions.roleTemplateId()); + pathParamsMap.put("version", replaceRoleTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replaceRoleTemplateOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + if (replaceRoleTemplateOptions.name() != null) { + contentJson.addProperty("name", replaceRoleTemplateOptions.name()); + } + if (replaceRoleTemplateOptions.description() != null) { + contentJson.addProperty("description", replaceRoleTemplateOptions.description()); + } + if (replaceRoleTemplateOptions.role() != null) { + contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRoleTemplateOptions.role())); + } + if (replaceRoleTemplateOptions.committed() != null) { + contentJson.addProperty("committed", replaceRoleTemplateOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a role template version. + * + * Delete a specific version of a role template by providing a role template ID and version number. You can't delete a + * role template version that is assigned to one or more child accounts. You must remove the role assignments first. + * + * @param deleteRoleTemplateVersionOptions the {@link DeleteRoleTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteRoleTemplateVersion(DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleTemplateVersionOptions, + "deleteRoleTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", deleteRoleTemplateVersionOptions.roleTemplateId()); + pathParamsMap.put("version", deleteRoleTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a role template version. + * + * Retrieve a role template by providing a role template ID and version number. + * + * @param getRoleTemplateVersionOptions the {@link GetRoleTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall getRoleTemplateVersion(GetRoleTemplateVersionOptions getRoleTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleTemplateVersionOptions, + "getRoleTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", getRoleTemplateVersionOptions.roleTemplateId()); + pathParamsMap.put("version", getRoleTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleTemplateVersion"); + 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); + } + + /** + * Commit a role template version. + * + * Commit a role template version. You cannot make any further changes to the role template once it's committed. If + * you have to make updates after committing a version, create a new version. + * + * @param commitRoleTemplateOptions the {@link CommitRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall commitRoleTemplate(CommitRoleTemplateOptions commitRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(commitRoleTemplateOptions, + "commitRoleTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", commitRoleTemplateOptions.roleTemplateId()); + pathParamsMap.put("version", commitRoleTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}/commit", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get role template assignments. + * + * Get role template assignments by attributes. The following attributes are supported: + * `account_id`, `template_id`, `template_version`, `target`, `target_type`, `limit`, `start`. + * `account_id` is a required query parameter. Only role template assignments with the specified attributes and + * accessible by the caller are returned. If the caller does not have read access to any role template assignments, an + * empty array is returned. + * + * @param listRoleAssignmentsOptions the {@link ListRoleAssignmentsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleAssignmentCollection} + */ + public ServiceCall listRoleAssignments(ListRoleAssignmentsOptions listRoleAssignmentsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleAssignmentsOptions, + "listRoleAssignmentsOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleAssignments"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listRoleAssignmentsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listRoleAssignmentsOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listRoleAssignmentsOptions.accountId())); + if (listRoleAssignmentsOptions.templateId() != null) { + builder.query("template_id", String.valueOf(listRoleAssignmentsOptions.templateId())); + } + if (listRoleAssignmentsOptions.templateVersion() != null) { + builder.query("template_version", String.valueOf(listRoleAssignmentsOptions.templateVersion())); + } + if (listRoleAssignmentsOptions.limit() != null) { + builder.query("limit", String.valueOf(listRoleAssignmentsOptions.limit())); + } + if (listRoleAssignmentsOptions.start() != null) { + builder.query("start", String.valueOf(listRoleAssignmentsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a role template assignment. + * + * Assign a role template to child accounts and account groups. This creates the role in the accounts and account + * groups that you specify. + * + * @param createRoleTemplateAssignmentOptions the {@link CreateRoleTemplateAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleAssignmentCollection} + */ + public ServiceCall createRoleTemplateAssignment(CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateAssignmentOptions, + "createRoleTemplateAssignmentOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplateAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createRoleTemplateAssignmentOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createRoleTemplateAssignmentOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateAssignmentOptions.target())); + contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateAssignmentOptions.templates())); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a role assignment. + * + * Retrieve a role template assignment by providing a role assignment ID. + * + * @param getRoleAssignmentOptions the {@link GetRoleAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleAssignment} + */ + public ServiceCall getRoleAssignment(GetRoleAssignmentOptions getRoleAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleAssignmentOptions, + "getRoleAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", getRoleAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleAssignment"); + 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 a role assignment. + * + * Update a role assignment by providing a role assignment ID. + * + * @param updateRoleAssignmentOptions the {@link UpdateRoleAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleAssignment} + */ + public ServiceCall updateRoleAssignment(UpdateRoleAssignmentOptions updateRoleAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateRoleAssignmentOptions, + "updateRoleAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", updateRoleAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateRoleAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updateRoleAssignmentOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("template_version", updateRoleAssignmentOptions.templateVersion()); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Remove a role assignment. + * + * Remove a role template assignment by providing a role assignment ID. You can't delete a role assignment if the + * status is "in_progress". + * + * @param deleteRoleAssignmentOptions the {@link DeleteRoleAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteRoleAssignment(DeleteRoleAssignmentOptions deleteRoleAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleAssignmentOptions, + "deleteRoleAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", deleteRoleAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java new file mode 100644 index 00000000000..af82ea2abe8 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The Access Management Account Settings that are currently set for the requested account. + */ +public class AccountSettingsAccessManagement extends GenericModel { + + @SerializedName("external_account_identity_interaction") + protected ExternalAccountIdentityInteraction externalAccountIdentityInteraction; + + protected AccountSettingsAccessManagement() { } + + /** + * Gets the externalAccountIdentityInteraction. + * + * How external accounts can interact in relation to the requested account. + * + * @return the externalAccountIdentityInteraction + */ + public ExternalAccountIdentityInteraction getExternalAccountIdentityInteraction() { + return externalAccountIdentityInteraction; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java new file mode 100644 index 00000000000..ea230f57263 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java @@ -0,0 +1,207 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the assigned action control template. + */ +public class ActionControlAssignment extends GenericModel { + + /** + * The current operation of the action control assignment. + */ + public interface Operation { + /** create. */ + String CREATE = "create"; + /** apply. */ + String APPLY = "apply"; + /** update. */ + String UPDATE = "update"; + /** remove. */ + String REMOVE = "remove"; + } + + /** + * The action control assignment status. + */ + public interface Status { + /** accepted. */ + String ACCEPTED = "accepted"; + /** failure. */ + String FAILURE = "failure"; + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** superseded. */ + String SUPERSEDED = "superseded"; + } + + protected String id; + @SerializedName("account_id") + protected String accountId; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String operation; + protected List resources; + protected ActionControlAssignmentTemplate template; + protected AssignmentTargetDetails target; + protected String status; + + protected ActionControlAssignment() { } + + /** + * Gets the id. + * + * Action control assignment ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the accountId. + * + * The account GUID that the action control assignments belong to. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the href. + * + * The href URL that links to the action control assignments API by action control assignment ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the action control assignment was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the action control assignment. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the action control assignment was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the action control assignment. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the operation. + * + * The current operation of the action control assignment. + * + * @return the operation + */ + public String getOperation() { + return operation; + } + + /** + * Gets the resources. + * + * Resources created when action control template is assigned. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the template. + * + * The action control template id and version that will be assigned. + * + * @return the template + */ + public ActionControlAssignmentTemplate getTemplate() { + return template; + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the status. + * + * The action control assignment status. + * + * @return the status + */ + public String getStatus() { + return status; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java new file mode 100644 index 00000000000..a9d6b28ce39 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of action control assignments. + */ +public class ActionControlAssignmentCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List assignments; + + protected ActionControlAssignmentCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the assignments. + * + * List of action control assignments. + * + * @return the assignments + */ + public List getAssignments() { + return assignments; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java new file mode 100644 index 00000000000..122d3c8277b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java @@ -0,0 +1,52 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The action control assignment resources and target where the template is assigned. + */ +public class ActionControlAssignmentResource extends GenericModel { + + protected AssignmentTargetDetails target; + @SerializedName("action_control") + protected ActionControlAssignmentResourceActionControl actionControl; + + protected ActionControlAssignmentResource() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the actionControl. + * + * Set of properties of the assigned resource or error message if assignment failed. + * + * @return the actionControl + */ + public ActionControlAssignmentResourceActionControl getActionControl() { + return actionControl; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java new file mode 100644 index 00000000000..0e5550eb4da --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Set of properties of the assigned resource or error message if assignment failed. + */ +public class ActionControlAssignmentResourceActionControl extends GenericModel { + + @SerializedName("resource_created") + protected ActionControlAssignmentResourceCreated resourceCreated; + @SerializedName("error_message") + protected AssignmentResourceError errorMessage; + + protected ActionControlAssignmentResourceActionControl() { } + + /** + * Gets the resourceCreated. + * + * On success, it includes the action control assigned. + * + * @return the resourceCreated + */ + public ActionControlAssignmentResourceCreated getResourceCreated() { + return resourceCreated; + } + + /** + * Gets the errorMessage. + * + * Body parameters for assignment error. + * + * @return the errorMessage + */ + public AssignmentResourceError getErrorMessage() { + return errorMessage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java new file mode 100644 index 00000000000..6ecbd23392a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * On success, it includes the action control assigned. + */ +public class ActionControlAssignmentResourceCreated extends GenericModel { + + protected String id; + + protected ActionControlAssignmentResourceCreated() { } + + /** + * Gets the id. + * + * action control id. + * + * @return the id + */ + public String getId() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java new file mode 100644 index 00000000000..4e6d2543e18 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The action control template id and version that will be assigned. + */ +public class ActionControlAssignmentTemplate extends GenericModel { + + protected String id; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String version; + + /** + * Instantiates a new Builder from an existing ActionControlAssignmentTemplate instance. + * + * @param actionControlAssignmentTemplate the instance to initialize the Builder with + */ + private Builder(ActionControlAssignmentTemplate actionControlAssignmentTemplate) { + this.id = actionControlAssignmentTemplate.id; + this.version = actionControlAssignmentTemplate.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + * @param version the version + */ + public Builder(String id, String version) { + this.id = id; + this.version = version; + } + + /** + * Builds a ActionControlAssignmentTemplate. + * + * @return the new ActionControlAssignmentTemplate instance + */ + public ActionControlAssignmentTemplate build() { + return new ActionControlAssignmentTemplate(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the ActionControlAssignmentTemplate builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the ActionControlAssignmentTemplate builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected ActionControlAssignmentTemplate() { } + + protected ActionControlAssignmentTemplate(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, + "id cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + id = builder.id; + version = builder.version; + } + + /** + * New builder. + * + * @return a ActionControlAssignmentTemplate builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * Action control template ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java new file mode 100644 index 00000000000..78b6d56be6d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * ActionControlAssignmentsPager can be used to simplify the use of the "listActionControlAssignments" method. + */ +public class ActionControlAssignmentsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListActionControlAssignmentsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected ActionControlAssignmentsPager() { } + + /** + * Constructs a new ActionControlAssignmentsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlAssignments" method + * @param options the ListActionControlAssignmentsOptions instance to be used to invoke the "listActionControlAssignments" method + */ + public ActionControlAssignmentsPager(IamPolicyManagement client, ListActionControlAssignmentsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<ActionControlAssignment> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListActionControlAssignmentsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + ActionControlAssignmentCollection result = client.listActionControlAssignments(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getAssignments(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<ActionControlAssignment> containing all results returned by the "listActionControlAssignments" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java new file mode 100644 index 00000000000..157c9f6a390 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java @@ -0,0 +1,203 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the action control template. + */ +public class ActionControlTemplate extends GenericModel { + + /** + * State of action control template. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String name; + protected String description; + @SerializedName("account_id") + protected String accountId; + protected Boolean committed; + @SerializedName("action_control") + protected TemplateActionControl actionControl; + protected String id; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String version; + protected String state; + + protected ActionControlTemplate() { } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Description of the action control template. This is shown to users in the enterprise account. Use this to describe + * the purpose or context of the action control for enterprise users managing IAM templates. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the committed. + * + * Committed status of the template. If committed is set to true, then the template version can no longer be updated. + * + * @return the committed + */ + public Boolean isCommitted() { + return committed; + } + + /** + * Gets the actionControl. + * + * The action control properties that are created in an action resource when the template is assigned. + * + * @return the actionControl + */ + public TemplateActionControl getActionControl() { + return actionControl; + } + + /** + * Gets the id. + * + * The action control template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the action control templates API by action control template ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the action control template was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the action control template. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the action control template was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the action control template. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the version. + * + * The version number of the template used to identify different versions of same template. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the state. + * + * State of action control template. + * + * @return the state + */ + public String getState() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java new file mode 100644 index 00000000000..e7536d2c9ae --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java @@ -0,0 +1,90 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of action control templates. + */ +public class ActionControlTemplateCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + @SerializedName("action_control_templates") + protected List actionControlTemplates; + + protected ActionControlTemplateCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the actionControlTemplates. + * + * List of action control templates. + * + * @return the actionControlTemplates + */ + public List getActionControlTemplates() { + return actionControlTemplates; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java new file mode 100644 index 00000000000..5e26f45cf46 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of versions for a specific action control template. + */ +public class ActionControlTemplateVersionsCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List versions; + + protected ActionControlTemplateVersionsCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the versions. + * + * List of action control templates versions. + * + * @return the versions + */ + public List getVersions() { + return versions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java new file mode 100644 index 00000000000..660aefe11ba --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * ActionControlTemplateVersionsPager can be used to simplify the use of the "listActionControlTemplateVersions" method. + */ +public class ActionControlTemplateVersionsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListActionControlTemplateVersionsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected ActionControlTemplateVersionsPager() { } + + /** + * Constructs a new ActionControlTemplateVersionsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlTemplateVersions" method + * @param options the ListActionControlTemplateVersionsOptions instance to be used to invoke the "listActionControlTemplateVersions" method + */ + public ActionControlTemplateVersionsPager(IamPolicyManagement client, ListActionControlTemplateVersionsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<ActionControlTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListActionControlTemplateVersionsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + ActionControlTemplateVersionsCollection result = client.listActionControlTemplateVersions(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getVersions(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<ActionControlTemplate> containing all results returned by the "listActionControlTemplateVersions" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java new file mode 100644 index 00000000000..bd326c8d7ec --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * ActionControlTemplatesPager can be used to simplify the use of the "listActionControlTemplates" method. + */ +public class ActionControlTemplatesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListActionControlTemplatesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected ActionControlTemplatesPager() { } + + /** + * Constructs a new ActionControlTemplatesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlTemplates" method + * @param options the ListActionControlTemplatesOptions instance to be used to invoke the "listActionControlTemplates" method + */ + public ActionControlTemplatesPager(IamPolicyManagement client, ListActionControlTemplatesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<ActionControlTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListActionControlTemplatesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + ActionControlTemplateCollection result = client.listActionControlTemplates(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getActionControlTemplates(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<ActionControlTemplate> containing all results returned by the "listActionControlTemplates" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java new file mode 100644 index 00000000000..c454c7a3ef5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * On success, includes the policy that is assigned. + */ +public class AssignmentResourceCreated extends GenericModel { + + protected String id; + + protected AssignmentResourceCreated() { } + + /** + * Gets the id. + * + * Policy id. + * + * @return the id + */ + public String getId() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java new file mode 100644 index 00000000000..e74dbe58b3a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Body parameters for assignment error. + */ +public class AssignmentResourceError extends GenericModel { + + protected String name; + protected String errorCode; + protected String message; + protected String code; + protected List errors; + + protected AssignmentResourceError() { } + + /** + * Gets the name. + * + * Name of the error. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the errorCode. + * + * error code. + * + * @return the errorCode + */ + public String getErrorCode() { + return errorCode; + } + + /** + * Gets the message. + * + * Error message detailing the nature of the error. + * + * @return the message + */ + public String getMessage() { + return message; + } + + /** + * Gets the code. + * + * Internal status code for the error. + * + * @return the code + */ + public String getCode() { + return code; + } + + /** + * Gets the errors. + * + * The errors encountered during the response. + * + * @return the errors + */ + public List getErrors() { + return errors; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java new file mode 100644 index 00000000000..893d528604c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java @@ -0,0 +1,142 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * assignment target account and type. + */ +public class AssignmentTargetDetails extends GenericModel { + + /** + * Assignment target type. + */ + public interface Type { + /** Account. */ + String ACCOUNT = "Account"; + } + + protected String type; + protected String id; + + /** + * Builder. + */ + public static class Builder { + private String type; + private String id; + + /** + * Instantiates a new Builder from an existing AssignmentTargetDetails instance. + * + * @param assignmentTargetDetails the instance to initialize the Builder with + */ + private Builder(AssignmentTargetDetails assignmentTargetDetails) { + this.type = assignmentTargetDetails.type; + this.id = assignmentTargetDetails.id; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param type the type + * @param id the id + */ + public Builder(String type, String id) { + this.type = type; + this.id = id; + } + + /** + * Builds a AssignmentTargetDetails. + * + * @return the new AssignmentTargetDetails instance + */ + public AssignmentTargetDetails build() { + return new AssignmentTargetDetails(this); + } + + /** + * Set the type. + * + * @param type the type + * @return the AssignmentTargetDetails builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the id. + * + * @param id the id + * @return the AssignmentTargetDetails builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + } + + protected AssignmentTargetDetails() { } + + protected AssignmentTargetDetails(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, + "id cannot be null"); + type = builder.type; + id = builder.id; + } + + /** + * New builder. + * + * @return a AssignmentTargetDetails builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the type. + * + * Assignment target type. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the id. + * + * ID of the target account. + * + * @return the id + */ + public String id() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java new file mode 100644 index 00000000000..b8025e305a9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java @@ -0,0 +1,119 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * policy template details. + */ +public class AssignmentTemplateDetails extends GenericModel { + + protected String id; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String version; + + /** + * Instantiates a new Builder from an existing AssignmentTemplateDetails instance. + * + * @param assignmentTemplateDetails the instance to initialize the Builder with + */ + private Builder(AssignmentTemplateDetails assignmentTemplateDetails) { + this.id = assignmentTemplateDetails.id; + this.version = assignmentTemplateDetails.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a AssignmentTemplateDetails. + * + * @return the new AssignmentTemplateDetails instance + */ + public AssignmentTemplateDetails build() { + return new AssignmentTemplateDetails(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the AssignmentTemplateDetails builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the AssignmentTemplateDetails builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected AssignmentTemplateDetails() { } + + protected AssignmentTemplateDetails(Builder builder) { + id = builder.id; + version = builder.version; + } + + /** + * New builder. + * + * @return a AssignmentTemplateDetails builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * Policy template ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the version. + * + * Policy template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java new file mode 100644 index 00000000000..78291e6c2c5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The commitActionControlTemplate options. + */ +public class CommitActionControlTemplateOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing CommitActionControlTemplateOptions instance. + * + * @param commitActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(CommitActionControlTemplateOptions commitActionControlTemplateOptions) { + this.actionControlTemplateId = commitActionControlTemplateOptions.actionControlTemplateId; + this.version = commitActionControlTemplateOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + * @param version the version + */ + public Builder(String actionControlTemplateId, String version) { + this.actionControlTemplateId = actionControlTemplateId; + this.version = version; + } + + /** + * Builds a CommitActionControlTemplateOptions. + * + * @return the new CommitActionControlTemplateOptions instance + */ + public CommitActionControlTemplateOptions build() { + return new CommitActionControlTemplateOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the CommitActionControlTemplateOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the CommitActionControlTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected CommitActionControlTemplateOptions() { } + + protected CommitActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a CommitActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the version. + * + * The action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java new file mode 100644 index 00000000000..61283194c44 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The commitPolicyTemplate options. + */ +public class CommitPolicyTemplateOptions extends GenericModel { + + protected String policyTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing CommitPolicyTemplateOptions instance. + * + * @param commitPolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(CommitPolicyTemplateOptions commitPolicyTemplateOptions) { + this.policyTemplateId = commitPolicyTemplateOptions.policyTemplateId; + this.version = commitPolicyTemplateOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param version the version + */ + public Builder(String policyTemplateId, String version) { + this.policyTemplateId = policyTemplateId; + this.version = version; + } + + /** + * Builds a CommitPolicyTemplateOptions. + * + * @return the new CommitPolicyTemplateOptions instance + */ + public CommitPolicyTemplateOptions build() { + return new CommitPolicyTemplateOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the CommitPolicyTemplateOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the CommitPolicyTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected CommitPolicyTemplateOptions() { } + + protected CommitPolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + policyTemplateId = builder.policyTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a CommitPolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the version. + * + * The policy template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java new file mode 100644 index 00000000000..7e93c92fb0b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The commitRoleTemplate options. + */ +public class CommitRoleTemplateOptions extends GenericModel { + + protected String roleTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing CommitRoleTemplateOptions instance. + * + * @param commitRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(CommitRoleTemplateOptions commitRoleTemplateOptions) { + this.roleTemplateId = commitRoleTemplateOptions.roleTemplateId; + this.version = commitRoleTemplateOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + * @param version the version + */ + public Builder(String roleTemplateId, String version) { + this.roleTemplateId = roleTemplateId; + this.version = version; + } + + /** + * Builds a CommitRoleTemplateOptions. + * + * @return the new CommitRoleTemplateOptions instance + */ + public CommitRoleTemplateOptions build() { + return new CommitRoleTemplateOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the CommitRoleTemplateOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the CommitRoleTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected CommitRoleTemplateOptions() { } + + protected CommitRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + roleTemplateId = builder.roleTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a CommitRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the version. + * + * The role template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java new file mode 100644 index 00000000000..be0c3d0aa98 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java @@ -0,0 +1,62 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Details of conflicting resource. + */ +public class ConflictsWith extends GenericModel { + + protected String etag; + protected String role; + protected String policy; + + protected ConflictsWith() { } + + /** + * Gets the etag. + * + * The revision number of the resource. + * + * @return the etag + */ + public String getEtag() { + return etag; + } + + /** + * Gets the role. + * + * The conflicting role of ID. + * + * @return the role + */ + public String getRole() { + return role; + } + + /** + * Gets the policy. + * + * The conflicting policy ID. + * + * @return the policy + */ + public String getPolicy() { + return policy; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java new file mode 100644 index 00000000000..15e502ac214 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Specifies the type of access that is granted by the policy. + */ +public class Control extends GenericModel { + + protected Grant grant; + + /** + * Builder. + */ + public static class Builder { + private Grant grant; + + /** + * Instantiates a new Builder from an existing Control instance. + * + * @param control the instance to initialize the Builder with + */ + private Builder(Control control) { + this.grant = control.grant; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param grant the grant + */ + public Builder(Grant grant) { + this.grant = grant; + } + + /** + * Builds a Control. + * + * @return the new Control instance + */ + public Control build() { + return new Control(this); + } + + /** + * Set the grant. + * + * @param grant the grant + * @return the Control builder + */ + public Builder grant(Grant grant) { + this.grant = grant; + return this; + } + } + + protected Control() { } + + protected Control(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.grant, + "grant cannot be null"); + grant = builder.grant; + } + + /** + * New builder. + * + * @return a Control builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the grant. + * + * Permission is granted by the policy. + * + * @return the grant + */ + public Grant grant() { + return grant; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java new file mode 100644 index 00000000000..5055d290c80 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * ControlResponse. + * + * Classes which extend this class: + * - ControlResponseControl + * - ControlResponseControlWithEnrichedRoles + */ +public class ControlResponse extends GenericModel { + + protected Grant grant; + + protected ControlResponse() { } + + /** + * Gets the grant. + * + * Permission is granted by the policy. + * + * @return the grant + */ + public Grant getGrant() { + return grant; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java new file mode 100644 index 00000000000..5934ebf7c76 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java @@ -0,0 +1,24 @@ +/* + * (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_policy_management.v1.model; + +/** + * Specifies the type of access that is granted by the policy. + */ +public class ControlResponseControl extends ControlResponse { + + + protected ControlResponseControl() { } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java new file mode 100644 index 00000000000..8b3c73d73c0 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java @@ -0,0 +1,24 @@ +/* + * (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_policy_management.v1.model; + +/** + * Specifies the type of access that is granted by the policy with additional role information. + */ +public class ControlResponseControlWithEnrichedRoles extends ControlResponse { + + + protected ControlResponseControlWithEnrichedRoles() { } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java new file mode 100644 index 00000000000..1ccd3f8b4dd --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java @@ -0,0 +1,191 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createActionControlTemplateAssignment options. + */ +public class CreateActionControlTemplateAssignmentOptions extends GenericModel { + + protected AssignmentTargetDetails target; + protected List templates; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private AssignmentTargetDetails target; + private List templates; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateActionControlTemplateAssignmentOptions instance. + * + * @param createActionControlTemplateAssignmentOptions the instance to initialize the Builder with + */ + private Builder(CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptions) { + this.target = createActionControlTemplateAssignmentOptions.target; + this.templates = createActionControlTemplateAssignmentOptions.templates; + this.acceptLanguage = createActionControlTemplateAssignmentOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param target the target + * @param templates the templates + */ + public Builder(AssignmentTargetDetails target, List templates) { + this.target = target; + this.templates = templates; + } + + /** + * Builds a CreateActionControlTemplateAssignmentOptions. + * + * @return the new CreateActionControlTemplateAssignmentOptions instance + */ + public CreateActionControlTemplateAssignmentOptions build() { + return new CreateActionControlTemplateAssignmentOptions(this); + } + + /** + * Adds a new element to templates. + * + * @param templates the new element to be added + * @return the CreateActionControlTemplateAssignmentOptions builder + */ + public Builder addTemplates(ActionControlAssignmentTemplate templates) { + com.ibm.cloud.sdk.core.util.Validator.notNull(templates, + "templates cannot be null"); + if (this.templates == null) { + this.templates = new ArrayList(); + } + this.templates.add(templates); + return this; + } + + /** + * Set the target. + * + * @param target the target + * @return the CreateActionControlTemplateAssignmentOptions builder + */ + public Builder target(AssignmentTargetDetails target) { + this.target = target; + return this; + } + + /** + * Set the templates. + * Existing templates will be replaced. + * + * @param templates the templates + * @return the CreateActionControlTemplateAssignmentOptions builder + */ + public Builder templates(List templates) { + this.templates = templates; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateActionControlTemplateAssignmentOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateActionControlTemplateAssignmentOptions() { } + + protected CreateActionControlTemplateAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, + "target cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, + "templates cannot be null"); + target = builder.target; + templates = builder.templates; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateActionControlTemplateAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails target() { + return target; + } + + /** + * Gets the templates. + * + * List of action control template details for action control assignment. + * + * @return the templates + */ + public List templates() { + return templates; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java new file mode 100644 index 00000000000..37594a7a440 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java @@ -0,0 +1,251 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createActionControlTemplate options. + */ +public class CreateActionControlTemplateOptions extends GenericModel { + + protected String name; + protected String accountId; + protected String description; + protected Boolean committed; + protected TemplateActionControl actionControl; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String accountId; + private String description; + private Boolean committed; + private TemplateActionControl actionControl; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateActionControlTemplateOptions instance. + * + * @param createActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(CreateActionControlTemplateOptions createActionControlTemplateOptions) { + this.name = createActionControlTemplateOptions.name; + this.accountId = createActionControlTemplateOptions.accountId; + this.description = createActionControlTemplateOptions.description; + this.committed = createActionControlTemplateOptions.committed; + this.actionControl = createActionControlTemplateOptions.actionControl; + this.acceptLanguage = createActionControlTemplateOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param accountId the accountId + */ + public Builder(String name, String accountId) { + this.name = name; + this.accountId = accountId; + } + + /** + * Builds a CreateActionControlTemplateOptions. + * + * @return the new CreateActionControlTemplateOptions instance + */ + public CreateActionControlTemplateOptions build() { + return new CreateActionControlTemplateOptions(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateActionControlTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreateActionControlTemplateOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateActionControlTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreateActionControlTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + + /** + * Set the actionControl. + * + * @param actionControl the actionControl + * @return the CreateActionControlTemplateOptions builder + */ + public Builder actionControl(TemplateActionControl actionControl) { + this.actionControl = actionControl; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateActionControlTemplateOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateActionControlTemplateOptions() { } + + protected CreateActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + name = builder.name; + accountId = builder.accountId; + description = builder.description; + committed = builder.committed; + actionControl = builder.actionControl; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the description. + * + * Description of the action control template. This is shown to users in the enterprise account. Use this to describe + * the purpose or context of the action control for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template. If committed is set to true, then the template version can no longer be updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } + + /** + * Gets the actionControl. + * + * The action control properties that are created in an action resource when the template is assigned. + * + * @return the actionControl + */ + public TemplateActionControl actionControl() { + return actionControl; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java new file mode 100644 index 00000000000..13ce1a8e60f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java @@ -0,0 +1,211 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createActionControlTemplateVersion options. + */ +public class CreateActionControlTemplateVersionOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String name; + protected String description; + protected TemplateActionControl actionControl; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String name; + private String description; + private TemplateActionControl actionControl; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing CreateActionControlTemplateVersionOptions instance. + * + * @param createActionControlTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptions) { + this.actionControlTemplateId = createActionControlTemplateVersionOptions.actionControlTemplateId; + this.name = createActionControlTemplateVersionOptions.name; + this.description = createActionControlTemplateVersionOptions.description; + this.actionControl = createActionControlTemplateVersionOptions.actionControl; + this.committed = createActionControlTemplateVersionOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + */ + public Builder(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + } + + /** + * Builds a CreateActionControlTemplateVersionOptions. + * + * @return the new CreateActionControlTemplateVersionOptions instance + */ + public CreateActionControlTemplateVersionOptions build() { + return new CreateActionControlTemplateVersionOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actionControl. + * + * @param actionControl the actionControl + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder actionControl(TemplateActionControl actionControl) { + this.actionControl = actionControl; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected CreateActionControlTemplateVersionOptions() { } + + protected CreateActionControlTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + name = builder.name; + description = builder.description; + actionControl = builder.actionControl; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a CreateActionControlTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * The action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will + * change the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the action control template. This is shown to users in the enterprise account. Use this to describe + * the purpose or context of the action control for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actionControl. + * + * The action control properties that are created in an action resource when the template is assigned. + * + * @return the actionControl + */ + public TemplateActionControl actionControl() { + return actionControl; + } + + /** + * Gets the committed. + * + * Committed status of the template version. If committed is set to true, then the template version can no longer be + * updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java new file mode 100644 index 00000000000..b6ec9f78c02 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java @@ -0,0 +1,311 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createPolicy options. + */ +public class CreatePolicyOptions extends GenericModel { + + protected String type; + protected List subjects; + protected List roles; + protected List resources; + protected String description; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String type; + private List subjects; + private List roles; + private List resources; + private String description; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreatePolicyOptions instance. + * + * @param createPolicyOptions the instance to initialize the Builder with + */ + private Builder(CreatePolicyOptions createPolicyOptions) { + this.type = createPolicyOptions.type; + this.subjects = createPolicyOptions.subjects; + this.roles = createPolicyOptions.roles; + this.resources = createPolicyOptions.resources; + this.description = createPolicyOptions.description; + this.acceptLanguage = createPolicyOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param type the type + * @param subjects the subjects + * @param roles the roles + * @param resources the resources + */ + public Builder(String type, List subjects, List roles, List resources) { + this.type = type; + this.subjects = subjects; + this.roles = roles; + this.resources = resources; + } + + /** + * Builds a CreatePolicyOptions. + * + * @return the new CreatePolicyOptions instance + */ + public CreatePolicyOptions build() { + return new CreatePolicyOptions(this); + } + + /** + * Adds a new element to subjects. + * + * @param subjects the new element to be added + * @return the CreatePolicyOptions builder + */ + public Builder addSubjects(PolicySubject subjects) { + com.ibm.cloud.sdk.core.util.Validator.notNull(subjects, + "subjects cannot be null"); + if (this.subjects == null) { + this.subjects = new ArrayList(); + } + this.subjects.add(subjects); + return this; + } + + /** + * Adds a new element to roles. + * + * @param roles the new element to be added + * @return the CreatePolicyOptions builder + */ + public Builder addRoles(PolicyRole roles) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roles, + "roles cannot be null"); + if (this.roles == null) { + this.roles = new ArrayList(); + } + this.roles.add(roles); + return this; + } + + /** + * Adds a new element to resources. + * + * @param resources the new element to be added + * @return the CreatePolicyOptions builder + */ + public Builder addResources(PolicyResource resources) { + com.ibm.cloud.sdk.core.util.Validator.notNull(resources, + "resources cannot be null"); + if (this.resources == null) { + this.resources = new ArrayList(); + } + this.resources.add(resources); + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the CreatePolicyOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the subjects. + * Existing subjects will be replaced. + * + * @param subjects the subjects + * @return the CreatePolicyOptions builder + */ + public Builder subjects(List subjects) { + this.subjects = subjects; + return this; + } + + /** + * Set the roles. + * Existing roles will be replaced. + * + * @param roles the roles + * @return the CreatePolicyOptions builder + */ + public Builder roles(List roles) { + this.roles = roles; + return this; + } + + /** + * Set the resources. + * Existing resources will be replaced. + * + * @param resources the resources + * @return the CreatePolicyOptions builder + */ + public Builder resources(List resources) { + this.resources = resources; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreatePolicyOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreatePolicyOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreatePolicyOptions() { } + + protected CreatePolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subjects, + "subjects cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, + "roles cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resources, + "resources cannot be null"); + type = builder.type; + subjects = builder.subjects; + roles = builder.roles; + resources = builder.resources; + description = builder.description; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreatePolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the subjects. + * + * The subjects associated with a policy. + * + * @return the subjects + */ + public List subjects() { + return subjects; + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List roles() { + return roles; + } + + /** + * Gets the resources. + * + * The resources associated with a policy. + * + * @return the resources + */ + public List resources() { + return resources; + } + + /** + * Gets the description. + * + * Customer-defined description. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java new file mode 100644 index 00000000000..b71ca393f11 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java @@ -0,0 +1,221 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createPolicyTemplateAssignment options. + */ +public class CreatePolicyTemplateAssignmentOptions extends GenericModel { + + protected String version; + protected AssignmentTargetDetails target; + protected List templates; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String version; + private AssignmentTargetDetails target; + private List templates; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreatePolicyTemplateAssignmentOptions instance. + * + * @param createPolicyTemplateAssignmentOptions the instance to initialize the Builder with + */ + private Builder(CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptions) { + this.version = createPolicyTemplateAssignmentOptions.version; + this.target = createPolicyTemplateAssignmentOptions.target; + this.templates = createPolicyTemplateAssignmentOptions.templates; + this.acceptLanguage = createPolicyTemplateAssignmentOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param version the version + * @param target the target + * @param templates the templates + */ + public Builder(String version, AssignmentTargetDetails target, List templates) { + this.version = version; + this.target = target; + this.templates = templates; + } + + /** + * Builds a CreatePolicyTemplateAssignmentOptions. + * + * @return the new CreatePolicyTemplateAssignmentOptions instance + */ + public CreatePolicyTemplateAssignmentOptions build() { + return new CreatePolicyTemplateAssignmentOptions(this); + } + + /** + * Adds a new element to templates. + * + * @param templates the new element to be added + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder addTemplates(AssignmentTemplateDetails templates) { + com.ibm.cloud.sdk.core.util.Validator.notNull(templates, + "templates cannot be null"); + if (this.templates == null) { + this.templates = new ArrayList(); + } + this.templates.add(templates); + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the target. + * + * @param target the target + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder target(AssignmentTargetDetails target) { + this.target = target; + return this; + } + + /** + * Set the templates. + * Existing templates will be replaced. + * + * @param templates the templates + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder templates(List templates) { + this.templates = templates; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreatePolicyTemplateAssignmentOptions() { } + + protected CreatePolicyTemplateAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, + "target cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, + "templates cannot be null"); + version = builder.version; + target = builder.target; + templates = builder.templates; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreatePolicyTemplateAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the version. + * + * specify version of response body format. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails target() { + return target; + } + + /** + * Gets the templates. + * + * List of template details for policy assignment. + * + * @return the templates + */ + public List templates() { + return templates; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java new file mode 100644 index 00000000000..72944308428 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java @@ -0,0 +1,255 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createPolicyTemplate options. + */ +public class CreatePolicyTemplateOptions extends GenericModel { + + protected String name; + protected String accountId; + protected TemplatePolicy policy; + protected String description; + protected Boolean committed; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String accountId; + private TemplatePolicy policy; + private String description; + private Boolean committed; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreatePolicyTemplateOptions instance. + * + * @param createPolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(CreatePolicyTemplateOptions createPolicyTemplateOptions) { + this.name = createPolicyTemplateOptions.name; + this.accountId = createPolicyTemplateOptions.accountId; + this.policy = createPolicyTemplateOptions.policy; + this.description = createPolicyTemplateOptions.description; + this.committed = createPolicyTemplateOptions.committed; + this.acceptLanguage = createPolicyTemplateOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param accountId the accountId + * @param policy the policy + */ + public Builder(String name, String accountId, TemplatePolicy policy) { + this.name = name; + this.accountId = accountId; + this.policy = policy; + } + + /** + * Builds a CreatePolicyTemplateOptions. + * + * @return the new CreatePolicyTemplateOptions instance + */ + public CreatePolicyTemplateOptions build() { + return new CreatePolicyTemplateOptions(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the CreatePolicyTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreatePolicyTemplateOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the policy. + * + * @param policy the policy + * @return the CreatePolicyTemplateOptions builder + */ + public Builder policy(TemplatePolicy policy) { + this.policy = policy; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreatePolicyTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreatePolicyTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreatePolicyTemplateOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreatePolicyTemplateOptions() { } + + protected CreatePolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.policy, + "policy cannot be null"); + name = builder.name; + accountId = builder.accountId; + policy = builder.policy; + description = builder.description; + committed = builder.committed; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreatePolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy policy() { + return policy; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java new file mode 100644 index 00000000000..6903774c335 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java @@ -0,0 +1,214 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createPolicyTemplateVersion options. + */ +public class CreatePolicyTemplateVersionOptions extends GenericModel { + + protected String policyTemplateId; + protected TemplatePolicy policy; + protected String name; + protected String description; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private TemplatePolicy policy; + private String name; + private String description; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing CreatePolicyTemplateVersionOptions instance. + * + * @param createPolicyTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptions) { + this.policyTemplateId = createPolicyTemplateVersionOptions.policyTemplateId; + this.policy = createPolicyTemplateVersionOptions.policy; + this.name = createPolicyTemplateVersionOptions.name; + this.description = createPolicyTemplateVersionOptions.description; + this.committed = createPolicyTemplateVersionOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param policy the policy + */ + public Builder(String policyTemplateId, TemplatePolicy policy) { + this.policyTemplateId = policyTemplateId; + this.policy = policy; + } + + /** + * Builds a CreatePolicyTemplateVersionOptions. + * + * @return the new CreatePolicyTemplateVersionOptions instance + */ + public CreatePolicyTemplateVersionOptions build() { + return new CreatePolicyTemplateVersionOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the policy. + * + * @param policy the policy + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder policy(TemplatePolicy policy) { + this.policy = policy; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected CreatePolicyTemplateVersionOptions() { } + + protected CreatePolicyTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.policy, + "policy cannot be null"); + policyTemplateId = builder.policyTemplateId; + policy = builder.policy; + name = builder.name; + description = builder.description; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a CreatePolicyTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy policy() { + return policy; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template version. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java new file mode 100644 index 00000000000..725ec5d8a53 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java @@ -0,0 +1,308 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createRole options. + */ +public class CreateRoleOptions extends GenericModel { + + protected String displayName; + protected List actions; + protected String name; + protected String accountId; + protected String serviceName; + protected String description; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String displayName; + private List actions; + private String name; + private String accountId; + private String serviceName; + private String description; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateRoleOptions instance. + * + * @param createRoleOptions the instance to initialize the Builder with + */ + private Builder(CreateRoleOptions createRoleOptions) { + this.displayName = createRoleOptions.displayName; + this.actions = createRoleOptions.actions; + this.name = createRoleOptions.name; + this.accountId = createRoleOptions.accountId; + this.serviceName = createRoleOptions.serviceName; + this.description = createRoleOptions.description; + this.acceptLanguage = createRoleOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param displayName the displayName + * @param actions the actions + * @param name the name + * @param accountId the accountId + * @param serviceName the serviceName + */ + public Builder(String displayName, List actions, String name, String accountId, String serviceName) { + this.displayName = displayName; + this.actions = actions; + this.name = name; + this.accountId = accountId; + this.serviceName = serviceName; + } + + /** + * Builds a CreateRoleOptions. + * + * @return the new CreateRoleOptions instance + */ + public CreateRoleOptions build() { + return new CreateRoleOptions(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the CreateRoleOptions builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the CreateRoleOptions builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the CreateRoleOptions builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateRoleOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreateRoleOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the CreateRoleOptions builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateRoleOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateRoleOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateRoleOptions() { } + + protected CreateRoleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, + "serviceName cannot be null"); + displayName = builder.displayName; + actions = builder.actions; + name = builder.name; + accountId = builder.accountId; + serviceName = builder.serviceName; + description = builder.description; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateRoleOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List actions() { + return actions; + } + + /** + * Gets the name. + * + * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the accountId. + * + * The account GUID. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the serviceName. + * + * The service name. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java new file mode 100644 index 00000000000..c9bef88e703 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java @@ -0,0 +1,191 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createRoleTemplateAssignment options. + */ +public class CreateRoleTemplateAssignmentOptions extends GenericModel { + + protected AssignmentTargetDetails target; + protected List templates; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private AssignmentTargetDetails target; + private List templates; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateRoleTemplateAssignmentOptions instance. + * + * @param createRoleTemplateAssignmentOptions the instance to initialize the Builder with + */ + private Builder(CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptions) { + this.target = createRoleTemplateAssignmentOptions.target; + this.templates = createRoleTemplateAssignmentOptions.templates; + this.acceptLanguage = createRoleTemplateAssignmentOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param target the target + * @param templates the templates + */ + public Builder(AssignmentTargetDetails target, List templates) { + this.target = target; + this.templates = templates; + } + + /** + * Builds a CreateRoleTemplateAssignmentOptions. + * + * @return the new CreateRoleTemplateAssignmentOptions instance + */ + public CreateRoleTemplateAssignmentOptions build() { + return new CreateRoleTemplateAssignmentOptions(this); + } + + /** + * Adds a new element to templates. + * + * @param templates the new element to be added + * @return the CreateRoleTemplateAssignmentOptions builder + */ + public Builder addTemplates(RoleAssignmentTemplate templates) { + com.ibm.cloud.sdk.core.util.Validator.notNull(templates, + "templates cannot be null"); + if (this.templates == null) { + this.templates = new ArrayList(); + } + this.templates.add(templates); + return this; + } + + /** + * Set the target. + * + * @param target the target + * @return the CreateRoleTemplateAssignmentOptions builder + */ + public Builder target(AssignmentTargetDetails target) { + this.target = target; + return this; + } + + /** + * Set the templates. + * Existing templates will be replaced. + * + * @param templates the templates + * @return the CreateRoleTemplateAssignmentOptions builder + */ + public Builder templates(List templates) { + this.templates = templates; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateRoleTemplateAssignmentOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateRoleTemplateAssignmentOptions() { } + + protected CreateRoleTemplateAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, + "target cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, + "templates cannot be null"); + target = builder.target; + templates = builder.templates; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateRoleTemplateAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails target() { + return target; + } + + /** + * Gets the templates. + * + * List of role template details for role assignment. + * + * @return the templates + */ + public List templates() { + return templates; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java new file mode 100644 index 00000000000..baf82e17961 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java @@ -0,0 +1,251 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createRoleTemplate options. + */ +public class CreateRoleTemplateOptions extends GenericModel { + + protected String name; + protected String accountId; + protected String description; + protected Boolean committed; + protected RoleTemplatePrototypeRole role; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String accountId; + private String description; + private Boolean committed; + private RoleTemplatePrototypeRole role; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateRoleTemplateOptions instance. + * + * @param createRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(CreateRoleTemplateOptions createRoleTemplateOptions) { + this.name = createRoleTemplateOptions.name; + this.accountId = createRoleTemplateOptions.accountId; + this.description = createRoleTemplateOptions.description; + this.committed = createRoleTemplateOptions.committed; + this.role = createRoleTemplateOptions.role; + this.acceptLanguage = createRoleTemplateOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param accountId the accountId + */ + public Builder(String name, String accountId) { + this.name = name; + this.accountId = accountId; + } + + /** + * Builds a CreateRoleTemplateOptions. + * + * @return the new CreateRoleTemplateOptions instance + */ + public CreateRoleTemplateOptions build() { + return new CreateRoleTemplateOptions(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateRoleTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreateRoleTemplateOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateRoleTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreateRoleTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + + /** + * Set the role. + * + * @param role the role + * @return the CreateRoleTemplateOptions builder + */ + public Builder role(RoleTemplatePrototypeRole role) { + this.role = role; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateRoleTemplateOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateRoleTemplateOptions() { } + + protected CreateRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + name = builder.name; + accountId = builder.accountId; + description = builder.description; + committed = builder.committed; + role = builder.role; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the description. + * + * Description of the role template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the role for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template. If committed is set to true, then the template version can no longer be updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } + + /** + * Gets the role. + * + * The role properties that are created in an action resource when the template is assigned. + * + * @return the role + */ + public RoleTemplatePrototypeRole role() { + return role; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java new file mode 100644 index 00000000000..c322c5a332d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java @@ -0,0 +1,211 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createRoleTemplateVersion options. + */ +public class CreateRoleTemplateVersionOptions extends GenericModel { + + protected String roleTemplateId; + protected String name; + protected String description; + protected TemplateRole role; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String name; + private String description; + private TemplateRole role; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing CreateRoleTemplateVersionOptions instance. + * + * @param createRoleTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(CreateRoleTemplateVersionOptions createRoleTemplateVersionOptions) { + this.roleTemplateId = createRoleTemplateVersionOptions.roleTemplateId; + this.name = createRoleTemplateVersionOptions.name; + this.description = createRoleTemplateVersionOptions.description; + this.role = createRoleTemplateVersionOptions.role; + this.committed = createRoleTemplateVersionOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + */ + public Builder(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + } + + /** + * Builds a CreateRoleTemplateVersionOptions. + * + * @return the new CreateRoleTemplateVersionOptions instance + */ + public CreateRoleTemplateVersionOptions build() { + return new CreateRoleTemplateVersionOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the role. + * + * @param role the role + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder role(TemplateRole role) { + this.role = role; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected CreateRoleTemplateVersionOptions() { } + + protected CreateRoleTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + roleTemplateId = builder.roleTemplateId; + name = builder.name; + description = builder.description; + role = builder.role; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a CreateRoleTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * The role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will + * change the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the role template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the role for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the role. + * + * The role properties that are created in an action resource when the template is assigned. + * + * @return the role + */ + public TemplateRole role() { + return role; + } + + /** + * Gets the committed. + * + * Committed status of the template version. If committed is set to true, then the template version can no longer be + * updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java new file mode 100644 index 00000000000..59ccb4b908a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java @@ -0,0 +1,312 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createV2Policy options. + */ +public class CreateV2PolicyOptions extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + protected Control control; + protected String type; + protected String description; + protected V2PolicySubject subject; + protected V2PolicyResource resource; + protected String pattern; + protected V2PolicyRule rule; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private Control control; + private String type; + private String description; + private V2PolicySubject subject; + private V2PolicyResource resource; + private String pattern; + private V2PolicyRule rule; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateV2PolicyOptions instance. + * + * @param createV2PolicyOptions the instance to initialize the Builder with + */ + private Builder(CreateV2PolicyOptions createV2PolicyOptions) { + this.control = createV2PolicyOptions.control; + this.type = createV2PolicyOptions.type; + this.description = createV2PolicyOptions.description; + this.subject = createV2PolicyOptions.subject; + this.resource = createV2PolicyOptions.resource; + this.pattern = createV2PolicyOptions.pattern; + this.rule = createV2PolicyOptions.rule; + this.acceptLanguage = createV2PolicyOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param control the control + * @param type the type + */ + public Builder(Control control, String type) { + this.control = control; + this.type = type; + } + + /** + * Builds a CreateV2PolicyOptions. + * + * @return the new CreateV2PolicyOptions instance + */ + public CreateV2PolicyOptions build() { + return new CreateV2PolicyOptions(this); + } + + /** + * Set the control. + * + * @param control the control + * @return the CreateV2PolicyOptions builder + */ + public Builder control(Control control) { + this.control = control; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the CreateV2PolicyOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateV2PolicyOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the subject. + * + * @param subject the subject + * @return the CreateV2PolicyOptions builder + */ + public Builder subject(V2PolicySubject subject) { + this.subject = subject; + return this; + } + + /** + * Set the resource. + * + * @param resource the resource + * @return the CreateV2PolicyOptions builder + */ + public Builder resource(V2PolicyResource resource) { + this.resource = resource; + return this; + } + + /** + * Set the pattern. + * + * @param pattern the pattern + * @return the CreateV2PolicyOptions builder + */ + public Builder pattern(String pattern) { + this.pattern = pattern; + return this; + } + + /** + * Set the rule. + * + * @param rule the rule + * @return the CreateV2PolicyOptions builder + */ + public Builder rule(V2PolicyRule rule) { + this.rule = rule; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateV2PolicyOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateV2PolicyOptions() { } + + protected CreateV2PolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.control, + "control cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + control = builder.control; + type = builder.type; + description = builder.description; + subject = builder.subject; + resource = builder.resource; + pattern = builder.pattern; + rule = builder.rule; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateV2PolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the control. + * + * Specifies the type of access that is granted by the policy. + * + * @return the control + */ + public Control control() { + return control; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject subject() { + return subject; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource resource() { + return resource; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String pattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule rule() { + return rule; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java new file mode 100644 index 00000000000..f5e35c13d9f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java @@ -0,0 +1,195 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * An additional set of properties associated with a role. + */ +public class CustomRole extends GenericModel { + + protected String id; + @SerializedName("display_name") + protected String displayName; + protected String description; + protected List actions; + protected String crn; + protected String name; + @SerializedName("account_id") + protected String accountId; + @SerializedName("service_name") + protected String serviceName; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String href; + + protected CustomRole() { } + + /** + * Gets the id. + * + * The role ID. Composed of hexadecimal characters. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String getDisplayName() { + return displayName; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List getActions() { + return actions; + } + + /** + * Gets the crn. + * + * The role Cloud Resource Name (CRN). Example CRN: + * 'crn:v1:ibmcloud:public:iam-access-management::a/exampleAccountId::customRole:ExampleRoleName'. + * + * @return the crn + */ + public String getCrn() { + return crn; + } + + /** + * Gets the name. + * + * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the accountId. + * + * The account GUID. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the serviceName. + * + * The service name. + * + * @return the serviceName + */ + public String getServiceName() { + return serviceName; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the role was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the role. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the role was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the href. + * + * The href links back to the role. + * + * @return the href + */ + public String getHref() { + return href; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java new file mode 100644 index 00000000000..f71d2c2ab9d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteActionControlAssignment options. + */ +public class DeleteActionControlAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing DeleteActionControlAssignmentOptions instance. + * + * @param deleteActionControlAssignmentOptions the instance to initialize the Builder with + */ + private Builder(DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptions) { + this.assignmentId = deleteActionControlAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a DeleteActionControlAssignmentOptions. + * + * @return the new DeleteActionControlAssignmentOptions instance + */ + public DeleteActionControlAssignmentOptions build() { + return new DeleteActionControlAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the DeleteActionControlAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected DeleteActionControlAssignmentOptions() { } + + protected DeleteActionControlAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a DeleteActionControlAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Action control template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java new file mode 100644 index 00000000000..6ff35d83603 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteActionControlTemplate options. + */ +public class DeleteActionControlTemplateOptions extends GenericModel { + + protected String actionControlTemplateId; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + + /** + * Instantiates a new Builder from an existing DeleteActionControlTemplateOptions instance. + * + * @param deleteActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(DeleteActionControlTemplateOptions deleteActionControlTemplateOptions) { + this.actionControlTemplateId = deleteActionControlTemplateOptions.actionControlTemplateId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + */ + public Builder(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + } + + /** + * Builds a DeleteActionControlTemplateOptions. + * + * @return the new DeleteActionControlTemplateOptions instance + */ + public DeleteActionControlTemplateOptions build() { + return new DeleteActionControlTemplateOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the DeleteActionControlTemplateOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + } + + protected DeleteActionControlTemplateOptions() { } + + protected DeleteActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + } + + /** + * New builder. + * + * @return a DeleteActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java new file mode 100644 index 00000000000..69aca0555a1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteActionControlTemplateVersion options. + */ +public class DeleteActionControlTemplateVersionOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing DeleteActionControlTemplateVersionOptions instance. + * + * @param deleteActionControlTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptions) { + this.actionControlTemplateId = deleteActionControlTemplateVersionOptions.actionControlTemplateId; + this.version = deleteActionControlTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + * @param version the version + */ + public Builder(String actionControlTemplateId, String version) { + this.actionControlTemplateId = actionControlTemplateId; + this.version = version; + } + + /** + * Builds a DeleteActionControlTemplateVersionOptions. + * + * @return the new DeleteActionControlTemplateVersionOptions instance + */ + public DeleteActionControlTemplateVersionOptions build() { + return new DeleteActionControlTemplateVersionOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the DeleteActionControlTemplateVersionOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the DeleteActionControlTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected DeleteActionControlTemplateVersionOptions() { } + + protected DeleteActionControlTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a DeleteActionControlTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java new file mode 100644 index 00000000000..3ab2cf17469 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deletePolicyAssignment options. + */ +public class DeletePolicyAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing DeletePolicyAssignmentOptions instance. + * + * @param deletePolicyAssignmentOptions the instance to initialize the Builder with + */ + private Builder(DeletePolicyAssignmentOptions deletePolicyAssignmentOptions) { + this.assignmentId = deletePolicyAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a DeletePolicyAssignmentOptions. + * + * @return the new DeletePolicyAssignmentOptions instance + */ + public DeletePolicyAssignmentOptions build() { + return new DeletePolicyAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the DeletePolicyAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected DeletePolicyAssignmentOptions() { } + + protected DeletePolicyAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a DeletePolicyAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * The policy template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java new file mode 100644 index 00000000000..fe070b2064a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deletePolicy options. + */ +public class DeletePolicyOptions extends GenericModel { + + protected String policyId; + + /** + * Builder. + */ + public static class Builder { + private String policyId; + + /** + * Instantiates a new Builder from an existing DeletePolicyOptions instance. + * + * @param deletePolicyOptions the instance to initialize the Builder with + */ + private Builder(DeletePolicyOptions deletePolicyOptions) { + this.policyId = deletePolicyOptions.policyId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyId the policyId + */ + public Builder(String policyId) { + this.policyId = policyId; + } + + /** + * Builds a DeletePolicyOptions. + * + * @return the new DeletePolicyOptions instance + */ + public DeletePolicyOptions build() { + return new DeletePolicyOptions(this); + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the DeletePolicyOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + } + + protected DeletePolicyOptions() { } + + protected DeletePolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId cannot be empty"); + policyId = builder.policyId; + } + + /** + * New builder. + * + * @return a DeletePolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyId. + * + * The policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java new file mode 100644 index 00000000000..bb70b0d6727 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deletePolicyTemplate options. + */ +public class DeletePolicyTemplateOptions extends GenericModel { + + protected String policyTemplateId; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + + /** + * Instantiates a new Builder from an existing DeletePolicyTemplateOptions instance. + * + * @param deletePolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(DeletePolicyTemplateOptions deletePolicyTemplateOptions) { + this.policyTemplateId = deletePolicyTemplateOptions.policyTemplateId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + */ + public Builder(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + } + + /** + * Builds a DeletePolicyTemplateOptions. + * + * @return the new DeletePolicyTemplateOptions instance + */ + public DeletePolicyTemplateOptions build() { + return new DeletePolicyTemplateOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the DeletePolicyTemplateOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + } + + protected DeletePolicyTemplateOptions() { } + + protected DeletePolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + policyTemplateId = builder.policyTemplateId; + } + + /** + * New builder. + * + * @return a DeletePolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java new file mode 100644 index 00000000000..9a04a5157b6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deletePolicyTemplateVersion options. + */ +public class DeletePolicyTemplateVersionOptions extends GenericModel { + + protected String policyTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing DeletePolicyTemplateVersionOptions instance. + * + * @param deletePolicyTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptions) { + this.policyTemplateId = deletePolicyTemplateVersionOptions.policyTemplateId; + this.version = deletePolicyTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param version the version + */ + public Builder(String policyTemplateId, String version) { + this.policyTemplateId = policyTemplateId; + this.version = version; + } + + /** + * Builds a DeletePolicyTemplateVersionOptions. + * + * @return the new DeletePolicyTemplateVersionOptions instance + */ + public DeletePolicyTemplateVersionOptions build() { + return new DeletePolicyTemplateVersionOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the DeletePolicyTemplateVersionOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the DeletePolicyTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected DeletePolicyTemplateVersionOptions() { } + + protected DeletePolicyTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + policyTemplateId = builder.policyTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a DeletePolicyTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the version. + * + * The policy template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java new file mode 100644 index 00000000000..b9341a9f414 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteRoleAssignment options. + */ +public class DeleteRoleAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing DeleteRoleAssignmentOptions instance. + * + * @param deleteRoleAssignmentOptions the instance to initialize the Builder with + */ + private Builder(DeleteRoleAssignmentOptions deleteRoleAssignmentOptions) { + this.assignmentId = deleteRoleAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a DeleteRoleAssignmentOptions. + * + * @return the new DeleteRoleAssignmentOptions instance + */ + public DeleteRoleAssignmentOptions build() { + return new DeleteRoleAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the DeleteRoleAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected DeleteRoleAssignmentOptions() { } + + protected DeleteRoleAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a DeleteRoleAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Role template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java new file mode 100644 index 00000000000..8675777719e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteRole options. + */ +public class DeleteRoleOptions extends GenericModel { + + protected String roleId; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + + /** + * Instantiates a new Builder from an existing DeleteRoleOptions instance. + * + * @param deleteRoleOptions the instance to initialize the Builder with + */ + private Builder(DeleteRoleOptions deleteRoleOptions) { + this.roleId = deleteRoleOptions.roleId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + */ + public Builder(String roleId) { + this.roleId = roleId; + } + + /** + * Builds a DeleteRoleOptions. + * + * @return the new DeleteRoleOptions instance + */ + public DeleteRoleOptions build() { + return new DeleteRoleOptions(this); + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the DeleteRoleOptions builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + } + + protected DeleteRoleOptions() { } + + protected DeleteRoleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, + "roleId cannot be empty"); + roleId = builder.roleId; + } + + /** + * New builder. + * + * @return a DeleteRoleOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role ID. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java new file mode 100644 index 00000000000..c76bf3bfda4 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteRoleTemplate options. + */ +public class DeleteRoleTemplateOptions extends GenericModel { + + protected String roleTemplateId; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + + /** + * Instantiates a new Builder from an existing DeleteRoleTemplateOptions instance. + * + * @param deleteRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(DeleteRoleTemplateOptions deleteRoleTemplateOptions) { + this.roleTemplateId = deleteRoleTemplateOptions.roleTemplateId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + */ + public Builder(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + } + + /** + * Builds a DeleteRoleTemplateOptions. + * + * @return the new DeleteRoleTemplateOptions instance + */ + public DeleteRoleTemplateOptions build() { + return new DeleteRoleTemplateOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the DeleteRoleTemplateOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + } + + protected DeleteRoleTemplateOptions() { } + + protected DeleteRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + roleTemplateId = builder.roleTemplateId; + } + + /** + * New builder. + * + * @return a DeleteRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java new file mode 100644 index 00000000000..9f974213165 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteRoleTemplateVersion options. + */ +public class DeleteRoleTemplateVersionOptions extends GenericModel { + + protected String roleTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing DeleteRoleTemplateVersionOptions instance. + * + * @param deleteRoleTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptions) { + this.roleTemplateId = deleteRoleTemplateVersionOptions.roleTemplateId; + this.version = deleteRoleTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + * @param version the version + */ + public Builder(String roleTemplateId, String version) { + this.roleTemplateId = roleTemplateId; + this.version = version; + } + + /** + * Builds a DeleteRoleTemplateVersionOptions. + * + * @return the new DeleteRoleTemplateVersionOptions instance + */ + public DeleteRoleTemplateVersionOptions build() { + return new DeleteRoleTemplateVersionOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the DeleteRoleTemplateVersionOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the DeleteRoleTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected DeleteRoleTemplateVersionOptions() { } + + protected DeleteRoleTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + roleTemplateId = builder.roleTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a DeleteRoleTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the version. + * + * Role template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java new file mode 100644 index 00000000000..92c1caaa34c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteV2Policy options. + */ +public class DeleteV2PolicyOptions extends GenericModel { + + protected String id; + + /** + * Builder. + */ + public static class Builder { + private String id; + + /** + * Instantiates a new Builder from an existing DeleteV2PolicyOptions instance. + * + * @param deleteV2PolicyOptions the instance to initialize the Builder with + */ + private Builder(DeleteV2PolicyOptions deleteV2PolicyOptions) { + this.id = deleteV2PolicyOptions.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 DeleteV2PolicyOptions. + * + * @return the new DeleteV2PolicyOptions instance + */ + public DeleteV2PolicyOptions build() { + return new DeleteV2PolicyOptions(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the DeleteV2PolicyOptions builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + } + + protected DeleteV2PolicyOptions() { } + + protected DeleteV2PolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, + "id cannot be empty"); + id = builder.id; + } + + /** + * New builder. + * + * @return a DeleteV2PolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String id() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java new file mode 100644 index 00000000000..0978eb1040b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java @@ -0,0 +1,81 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role associated with a policy with additional information (display_name, description, actions) when + * `format=display`. + */ +public class EnrichedRoles extends GenericModel { + + @SerializedName("role_id") + protected String roleId; + @SerializedName("display_name") + protected String displayName; + protected String description; + protected List actions; + + protected EnrichedRoles() { } + + /** + * Gets the roleId. + * + * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. + * + * @return the roleId + */ + public String getRoleId() { + return roleId; + } + + /** + * Gets the displayName. + * + * The display name of the role, either service-defined or user-defined for custom roles. + * + * @return the displayName + */ + public String getDisplayName() { + return displayName; + } + + /** + * Gets the description. + * + * The role description, either service-defined or user-defined for custom roles. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List getActions() { + return actions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java new file mode 100644 index 00000000000..e99ea48f5f6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Additional error details. + */ +public class ErrorDetails extends GenericModel { + + @SerializedName("conflicts_with") + protected ConflictsWith conflictsWith; + + protected ErrorDetails() { } + + /** + * Gets the conflictsWith. + * + * Details of conflicting resource. + * + * @return the conflictsWith + */ + public ConflictsWith getConflictsWith() { + return conflictsWith; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java new file mode 100644 index 00000000000..b5411a7bb36 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java @@ -0,0 +1,128 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * ErrorObject. + */ +public class ErrorObject extends GenericModel { + + /** + * The API error code for the error. + */ + public interface Code { + /** insufficent_permissions. */ + String INSUFFICENT_PERMISSIONS = "insufficent_permissions"; + /** invalid_body. */ + String INVALID_BODY = "invalid_body"; + /** invalid_token. */ + String INVALID_TOKEN = "invalid_token"; + /** missing_required_query_parameter. */ + String MISSING_REQUIRED_QUERY_PARAMETER = "missing_required_query_parameter"; + /** not_found. */ + String NOT_FOUND = "not_found"; + /** policy_conflict_error. */ + String POLICY_CONFLICT_ERROR = "policy_conflict_error"; + /** policy_not_found. */ + String POLICY_NOT_FOUND = "policy_not_found"; + /** request_not_processed. */ + String REQUEST_NOT_PROCESSED = "request_not_processed"; + /** role_conflict_error. */ + String ROLE_CONFLICT_ERROR = "role_conflict_error"; + /** role_not_found. */ + String ROLE_NOT_FOUND = "role_not_found"; + /** too_many_requests. */ + String TOO_MANY_REQUESTS = "too_many_requests"; + /** unable_to_process. */ + String UNABLE_TO_PROCESS = "unable_to_process"; + /** unsupported_content_type. */ + String UNSUPPORTED_CONTENT_TYPE = "unsupported_content_type"; + /** policy_template_conflict_error. */ + String POLICY_TEMPLATE_CONFLICT_ERROR = "policy_template_conflict_error"; + /** policy_template_not_found. */ + String POLICY_TEMPLATE_NOT_FOUND = "policy_template_not_found"; + /** policy_assignment_not_found. */ + String POLICY_ASSIGNMENT_NOT_FOUND = "policy_assignment_not_found"; + /** policy_assignment_conflict_error. */ + String POLICY_ASSIGNMENT_CONFLICT_ERROR = "policy_assignment_conflict_error"; + /** resource_not_found. */ + String RESOURCE_NOT_FOUND = "resource_not_found"; + /** action_control_template_not_found. */ + String ACTION_CONTROL_TEMPLATE_NOT_FOUND = "action_control_template_not_found"; + /** action_control_assignment_not_found. */ + String ACTION_CONTROL_ASSIGNMENT_NOT_FOUND = "action_control_assignment_not_found"; + /** role_template_conflict_error. */ + String ROLE_TEMPLATE_CONFLICT_ERROR = "role_template_conflict_error"; + /** role_template_not_found. */ + String ROLE_TEMPLATE_NOT_FOUND = "role_template_not_found"; + /** role_assignment_not_found. */ + String ROLE_ASSIGNMENT_NOT_FOUND = "role_assignment_not_found"; + } + + protected String code; + protected String message; + protected ErrorDetails details; + @SerializedName("more_info") + protected String moreInfo; + + protected ErrorObject() { } + + /** + * Gets the code. + * + * The API error code for the error. + * + * @return the code + */ + public String getCode() { + return code; + } + + /** + * Gets the message. + * + * The error message returned by the API. + * + * @return the message + */ + public String getMessage() { + return message; + } + + /** + * Gets the details. + * + * Additional error details. + * + * @return the details + */ + public ErrorDetails getDetails() { + return details; + } + + /** + * Gets the moreInfo. + * + * Additional info for error. + * + * @return the moreInfo + */ + public String getMoreInfo() { + return moreInfo; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java new file mode 100644 index 00000000000..5c1c9a9fad6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * How external accounts can interact in relation to the requested account. + */ +public class ExternalAccountIdentityInteraction extends GenericModel { + + @SerializedName("identity_types") + protected IdentityTypes identityTypes; + + protected ExternalAccountIdentityInteraction() { } + + /** + * Gets the identityTypes. + * + * The settings for each identity type. + * + * @return the identityTypes + */ + public IdentityTypes getIdentityTypes() { + return identityTypes; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java new file mode 100644 index 00000000000..1efd0673e9d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java @@ -0,0 +1,95 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Update to how external accounts can interact in relation to the requested account. + */ +public class ExternalAccountIdentityInteractionPatch extends GenericModel { + + @SerializedName("identity_types") + protected IdentityTypesPatch identityTypes; + + /** + * Builder. + */ + public static class Builder { + private IdentityTypesPatch identityTypes; + + /** + * Instantiates a new Builder from an existing ExternalAccountIdentityInteractionPatch instance. + * + * @param externalAccountIdentityInteractionPatch the instance to initialize the Builder with + */ + private Builder(ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatch) { + this.identityTypes = externalAccountIdentityInteractionPatch.identityTypes; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ExternalAccountIdentityInteractionPatch. + * + * @return the new ExternalAccountIdentityInteractionPatch instance + */ + public ExternalAccountIdentityInteractionPatch build() { + return new ExternalAccountIdentityInteractionPatch(this); + } + + /** + * Set the identityTypes. + * + * @param identityTypes the identityTypes + * @return the ExternalAccountIdentityInteractionPatch builder + */ + public Builder identityTypes(IdentityTypesPatch identityTypes) { + this.identityTypes = identityTypes; + return this; + } + } + + protected ExternalAccountIdentityInteractionPatch() { } + + protected ExternalAccountIdentityInteractionPatch(Builder builder) { + identityTypes = builder.identityTypes; + } + + /** + * New builder. + * + * @return a ExternalAccountIdentityInteractionPatch builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the identityTypes. + * + * The settings to apply for each identity type for a request. + * + * @return the identityTypes + */ + public IdentityTypesPatch identityTypes() { + return identityTypes; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java new file mode 100644 index 00000000000..83cd67d33c9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Details with linking href to first page of requested collection. + */ +public class First extends GenericModel { + + protected String href; + + protected First() { } + + /** + * Gets the href. + * + * The href linking to the page of requested collection. + * + * @return the href + */ + public String getHref() { + return href; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java new file mode 100644 index 00000000000..f87e7d741a4 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getActionControlAssignment options. + */ +public class GetActionControlAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing GetActionControlAssignmentOptions instance. + * + * @param getActionControlAssignmentOptions the instance to initialize the Builder with + */ + private Builder(GetActionControlAssignmentOptions getActionControlAssignmentOptions) { + this.assignmentId = getActionControlAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a GetActionControlAssignmentOptions. + * + * @return the new GetActionControlAssignmentOptions instance + */ + public GetActionControlAssignmentOptions build() { + return new GetActionControlAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the GetActionControlAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected GetActionControlAssignmentOptions() { } + + protected GetActionControlAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a GetActionControlAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Action control template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java new file mode 100644 index 00000000000..963c68e8876 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java @@ -0,0 +1,140 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getActionControlTemplate options. + */ +public class GetActionControlTemplateOptions extends GenericModel { + + /** + * The action control template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String actionControlTemplateId; + protected String state; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String state; + + /** + * Instantiates a new Builder from an existing GetActionControlTemplateOptions instance. + * + * @param getActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(GetActionControlTemplateOptions getActionControlTemplateOptions) { + this.actionControlTemplateId = getActionControlTemplateOptions.actionControlTemplateId; + this.state = getActionControlTemplateOptions.state; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + */ + public Builder(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + } + + /** + * Builds a GetActionControlTemplateOptions. + * + * @return the new GetActionControlTemplateOptions instance + */ + public GetActionControlTemplateOptions build() { + return new GetActionControlTemplateOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the GetActionControlTemplateOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the GetActionControlTemplateOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + } + + protected GetActionControlTemplateOptions() { } + + protected GetActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + state = builder.state; + } + + /** + * New builder. + * + * @return a GetActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the state. + * + * The action control template state. + * + * @return the state + */ + public String state() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java new file mode 100644 index 00000000000..95bc94950bb --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getActionControlTemplateVersion options. + */ +public class GetActionControlTemplateVersionOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing GetActionControlTemplateVersionOptions instance. + * + * @param getActionControlTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptions) { + this.actionControlTemplateId = getActionControlTemplateVersionOptions.actionControlTemplateId; + this.version = getActionControlTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + * @param version the version + */ + public Builder(String actionControlTemplateId, String version) { + this.actionControlTemplateId = actionControlTemplateId; + this.version = version; + } + + /** + * Builds a GetActionControlTemplateVersionOptions. + * + * @return the new GetActionControlTemplateVersionOptions instance + */ + public GetActionControlTemplateVersionOptions build() { + return new GetActionControlTemplateVersionOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the GetActionControlTemplateVersionOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the GetActionControlTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected GetActionControlTemplateVersionOptions() { } + + protected GetActionControlTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a GetActionControlTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java new file mode 100644 index 00000000000..d1c7c359003 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getPolicyAssignment options. + */ +public class GetPolicyAssignmentOptions extends GenericModel { + + protected String assignmentId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + private String version; + + /** + * Instantiates a new Builder from an existing GetPolicyAssignmentOptions instance. + * + * @param getPolicyAssignmentOptions the instance to initialize the Builder with + */ + private Builder(GetPolicyAssignmentOptions getPolicyAssignmentOptions) { + this.assignmentId = getPolicyAssignmentOptions.assignmentId; + this.version = getPolicyAssignmentOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + * @param version the version + */ + public Builder(String assignmentId, String version) { + this.assignmentId = assignmentId; + this.version = version; + } + + /** + * Builds a GetPolicyAssignmentOptions. + * + * @return the new GetPolicyAssignmentOptions instance + */ + public GetPolicyAssignmentOptions build() { + return new GetPolicyAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the GetPolicyAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the GetPolicyAssignmentOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected GetPolicyAssignmentOptions() { } + + protected GetPolicyAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + assignmentId = builder.assignmentId; + version = builder.version; + } + + /** + * New builder. + * + * @return a GetPolicyAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * The policy template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } + + /** + * Gets the version. + * + * specify version of response body format. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java new file mode 100644 index 00000000000..e780ac06896 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getPolicy options. + */ +public class GetPolicyOptions extends GenericModel { + + protected String policyId; + + /** + * Builder. + */ + public static class Builder { + private String policyId; + + /** + * Instantiates a new Builder from an existing GetPolicyOptions instance. + * + * @param getPolicyOptions the instance to initialize the Builder with + */ + private Builder(GetPolicyOptions getPolicyOptions) { + this.policyId = getPolicyOptions.policyId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyId the policyId + */ + public Builder(String policyId) { + this.policyId = policyId; + } + + /** + * Builds a GetPolicyOptions. + * + * @return the new GetPolicyOptions instance + */ + public GetPolicyOptions build() { + return new GetPolicyOptions(this); + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the GetPolicyOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + } + + protected GetPolicyOptions() { } + + protected GetPolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId cannot be empty"); + policyId = builder.policyId; + } + + /** + * New builder. + * + * @return a GetPolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyId. + * + * The policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java new file mode 100644 index 00000000000..ee604554a85 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java @@ -0,0 +1,140 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getPolicyTemplate options. + */ +public class GetPolicyTemplateOptions extends GenericModel { + + /** + * The policy template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String policyTemplateId; + protected String state; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String state; + + /** + * Instantiates a new Builder from an existing GetPolicyTemplateOptions instance. + * + * @param getPolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(GetPolicyTemplateOptions getPolicyTemplateOptions) { + this.policyTemplateId = getPolicyTemplateOptions.policyTemplateId; + this.state = getPolicyTemplateOptions.state; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + */ + public Builder(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + } + + /** + * Builds a GetPolicyTemplateOptions. + * + * @return the new GetPolicyTemplateOptions instance + */ + public GetPolicyTemplateOptions build() { + return new GetPolicyTemplateOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the GetPolicyTemplateOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the GetPolicyTemplateOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + } + + protected GetPolicyTemplateOptions() { } + + protected GetPolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + policyTemplateId = builder.policyTemplateId; + state = builder.state; + } + + /** + * New builder. + * + * @return a GetPolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the state. + * + * The policy template state. + * + * @return the state + */ + public String state() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java new file mode 100644 index 00000000000..8741f83357d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getPolicyTemplateVersion options. + */ +public class GetPolicyTemplateVersionOptions extends GenericModel { + + protected String policyTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing GetPolicyTemplateVersionOptions instance. + * + * @param getPolicyTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptions) { + this.policyTemplateId = getPolicyTemplateVersionOptions.policyTemplateId; + this.version = getPolicyTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param version the version + */ + public Builder(String policyTemplateId, String version) { + this.policyTemplateId = policyTemplateId; + this.version = version; + } + + /** + * Builds a GetPolicyTemplateVersionOptions. + * + * @return the new GetPolicyTemplateVersionOptions instance + */ + public GetPolicyTemplateVersionOptions build() { + return new GetPolicyTemplateVersionOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the GetPolicyTemplateVersionOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the GetPolicyTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected GetPolicyTemplateVersionOptions() { } + + protected GetPolicyTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + policyTemplateId = builder.policyTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a GetPolicyTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the version. + * + * The policy template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java new file mode 100644 index 00000000000..35313b9b746 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getRoleAssignment options. + */ +public class GetRoleAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing GetRoleAssignmentOptions instance. + * + * @param getRoleAssignmentOptions the instance to initialize the Builder with + */ + private Builder(GetRoleAssignmentOptions getRoleAssignmentOptions) { + this.assignmentId = getRoleAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a GetRoleAssignmentOptions. + * + * @return the new GetRoleAssignmentOptions instance + */ + public GetRoleAssignmentOptions build() { + return new GetRoleAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the GetRoleAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected GetRoleAssignmentOptions() { } + + protected GetRoleAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a GetRoleAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Role template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java new file mode 100644 index 00000000000..8c56ac7f58a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getRole options. + */ +public class GetRoleOptions extends GenericModel { + + protected String roleId; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + + /** + * Instantiates a new Builder from an existing GetRoleOptions instance. + * + * @param getRoleOptions the instance to initialize the Builder with + */ + private Builder(GetRoleOptions getRoleOptions) { + this.roleId = getRoleOptions.roleId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + */ + public Builder(String roleId) { + this.roleId = roleId; + } + + /** + * Builds a GetRoleOptions. + * + * @return the new GetRoleOptions instance + */ + public GetRoleOptions build() { + return new GetRoleOptions(this); + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the GetRoleOptions builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + } + + protected GetRoleOptions() { } + + protected GetRoleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, + "roleId cannot be empty"); + roleId = builder.roleId; + } + + /** + * New builder. + * + * @return a GetRoleOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role ID. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java new file mode 100644 index 00000000000..e33fcf29b32 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java @@ -0,0 +1,140 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getRoleTemplate options. + */ +public class GetRoleTemplateOptions extends GenericModel { + + /** + * The role template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String roleTemplateId; + protected String state; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String state; + + /** + * Instantiates a new Builder from an existing GetRoleTemplateOptions instance. + * + * @param getRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(GetRoleTemplateOptions getRoleTemplateOptions) { + this.roleTemplateId = getRoleTemplateOptions.roleTemplateId; + this.state = getRoleTemplateOptions.state; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + */ + public Builder(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + } + + /** + * Builds a GetRoleTemplateOptions. + * + * @return the new GetRoleTemplateOptions instance + */ + public GetRoleTemplateOptions build() { + return new GetRoleTemplateOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the GetRoleTemplateOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the GetRoleTemplateOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + } + + protected GetRoleTemplateOptions() { } + + protected GetRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + roleTemplateId = builder.roleTemplateId; + state = builder.state; + } + + /** + * New builder. + * + * @return a GetRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the state. + * + * The role template state. + * + * @return the state + */ + public String state() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java new file mode 100644 index 00000000000..4757484f969 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getRoleTemplateVersion options. + */ +public class GetRoleTemplateVersionOptions extends GenericModel { + + protected String roleTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing GetRoleTemplateVersionOptions instance. + * + * @param getRoleTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(GetRoleTemplateVersionOptions getRoleTemplateVersionOptions) { + this.roleTemplateId = getRoleTemplateVersionOptions.roleTemplateId; + this.version = getRoleTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + * @param version the version + */ + public Builder(String roleTemplateId, String version) { + this.roleTemplateId = roleTemplateId; + this.version = version; + } + + /** + * Builds a GetRoleTemplateVersionOptions. + * + * @return the new GetRoleTemplateVersionOptions instance + */ + public GetRoleTemplateVersionOptions build() { + return new GetRoleTemplateVersionOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the GetRoleTemplateVersionOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the GetRoleTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected GetRoleTemplateVersionOptions() { } + + protected GetRoleTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + roleTemplateId = builder.roleTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a GetRoleTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the version. + * + * Role template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java new file mode 100644 index 00000000000..ebc88bbf45c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getSettings options. + */ +public class GetSettingsOptions extends GenericModel { + + protected String accountId; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing GetSettingsOptions instance. + * + * @param getSettingsOptions the instance to initialize the Builder with + */ + private Builder(GetSettingsOptions getSettingsOptions) { + this.accountId = getSettingsOptions.accountId; + this.acceptLanguage = getSettingsOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a GetSettingsOptions. + * + * @return the new GetSettingsOptions instance + */ + public GetSettingsOptions build() { + return new GetSettingsOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the GetSettingsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the GetSettingsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected GetSettingsOptions() { } + + protected GetSettingsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.accountId, + "accountId cannot be empty"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a GetSettingsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the settings belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java new file mode 100644 index 00000000000..23a950cc815 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java @@ -0,0 +1,148 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getV2Policy options. + */ +public class GetV2PolicyOptions extends GenericModel { + + /** + * Include additional data for policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles and translations for all + * relevant fields. + */ + public interface Format { + /** include_last_permit. */ + String INCLUDE_LAST_PERMIT = "include_last_permit"; + /** display. */ + String DISPLAY = "display"; + } + + protected String id; + protected String format; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String format; + + /** + * Instantiates a new Builder from an existing GetV2PolicyOptions instance. + * + * @param getV2PolicyOptions the instance to initialize the Builder with + */ + private Builder(GetV2PolicyOptions getV2PolicyOptions) { + this.id = getV2PolicyOptions.id; + this.format = getV2PolicyOptions.format; + } + + /** + * 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 GetV2PolicyOptions. + * + * @return the new GetV2PolicyOptions instance + */ + public GetV2PolicyOptions build() { + return new GetV2PolicyOptions(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the GetV2PolicyOptions builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the format. + * + * @param format the format + * @return the GetV2PolicyOptions builder + */ + public Builder format(String format) { + this.format = format; + return this; + } + } + + protected GetV2PolicyOptions() { } + + protected GetV2PolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, + "id cannot be empty"); + id = builder.id; + format = builder.format; + } + + /** + * New builder. + * + * @return a GetV2PolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the format. + * + * Include additional data for policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles and translations for all + * relevant fields. + * + * @return the format + */ + public String format() { + return format; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java new file mode 100644 index 00000000000..d8439c9d6f7 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java @@ -0,0 +1,124 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Permission is granted by the policy. + */ +public class Grant extends GenericModel { + + protected List roles; + + /** + * Builder. + */ + public static class Builder { + private List roles; + + /** + * Instantiates a new Builder from an existing Grant instance. + * + * @param grant the instance to initialize the Builder with + */ + private Builder(Grant grant) { + this.roles = grant.roles; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roles the roles + */ + public Builder(List roles) { + this.roles = roles; + } + + /** + * Builds a Grant. + * + * @return the new Grant instance + */ + public Grant build() { + return new Grant(this); + } + + /** + * Adds a new element to roles. + * + * @param roles the new element to be added + * @return the Grant builder + */ + public Builder addRoles(Roles roles) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roles, + "roles cannot be null"); + if (this.roles == null) { + this.roles = new ArrayList(); + } + this.roles.add(roles); + return this; + } + + /** + * Set the roles. + * Existing roles will be replaced. + * + * @param roles the roles + * @return the Grant builder + */ + public Builder roles(List roles) { + this.roles = roles; + return this; + } + } + + protected Grant() { } + + protected Grant(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, + "roles cannot be null"); + roles = builder.roles; + } + + /** + * New builder. + * + * @return a Grant builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List roles() { + return roles; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java new file mode 100644 index 00000000000..1dbc53fefb6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Permission granted by the policy with translated roles and additional role information. + */ +public class GrantWithEnrichedRoles extends GenericModel { + + protected List roles; + + protected GrantWithEnrichedRoles() { } + + /** + * Gets the roles. + * + * A set of roles granted by the policy. + * + * @return the roles + */ + public List getRoles() { + return roles; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java new file mode 100644 index 00000000000..0ac71d8192b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java @@ -0,0 +1,64 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The settings for each identity type. + */ +public class IdentityTypes extends GenericModel { + + protected IdentityTypesBase user; + @SerializedName("service_id") + protected IdentityTypesBase serviceId; + protected IdentityTypesBase service; + + protected IdentityTypes() { } + + /** + * Gets the user. + * + * The core set of properties associated with an identity type. + * + * @return the user + */ + public IdentityTypesBase getUser() { + return user; + } + + /** + * Gets the serviceId. + * + * The core set of properties associated with an identity type. + * + * @return the serviceId + */ + public IdentityTypesBase getServiceId() { + return serviceId; + } + + /** + * Gets the service. + * + * The core set of properties associated with an identity type. + * + * @return the service + */ + public IdentityTypesBase getService() { + return service; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java new file mode 100644 index 00000000000..e8df91a1e5d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java @@ -0,0 +1,168 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with an identity type. + */ +public class IdentityTypesBase extends GenericModel { + + /** + * The state of the identity type. + */ + public interface State { + /** enabled. */ + String ENABLED = "enabled"; + /** monitor. */ + String MONITOR = "monitor"; + /** limited. */ + String LIMITED = "limited"; + } + + protected String state; + @SerializedName("external_allowed_accounts") + protected List externalAllowedAccounts; + + /** + * Builder. + */ + public static class Builder { + private String state; + private List externalAllowedAccounts; + + /** + * Instantiates a new Builder from an existing IdentityTypesBase instance. + * + * @param identityTypesBase the instance to initialize the Builder with + */ + private Builder(IdentityTypesBase identityTypesBase) { + this.state = identityTypesBase.state; + this.externalAllowedAccounts = identityTypesBase.externalAllowedAccounts; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param state the state + * @param externalAllowedAccounts the externalAllowedAccounts + */ + public Builder(String state, List externalAllowedAccounts) { + this.state = state; + this.externalAllowedAccounts = externalAllowedAccounts; + } + + /** + * Builds a IdentityTypesBase. + * + * @return the new IdentityTypesBase instance + */ + public IdentityTypesBase build() { + return new IdentityTypesBase(this); + } + + /** + * Adds a new element to externalAllowedAccounts. + * + * @param externalAllowedAccounts the new element to be added + * @return the IdentityTypesBase builder + */ + public Builder addExternalAllowedAccounts(String externalAllowedAccounts) { + com.ibm.cloud.sdk.core.util.Validator.notNull(externalAllowedAccounts, + "externalAllowedAccounts cannot be null"); + if (this.externalAllowedAccounts == null) { + this.externalAllowedAccounts = new ArrayList(); + } + this.externalAllowedAccounts.add(externalAllowedAccounts); + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the IdentityTypesBase builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the externalAllowedAccounts. + * Existing externalAllowedAccounts will be replaced. + * + * @param externalAllowedAccounts the externalAllowedAccounts + * @return the IdentityTypesBase builder + */ + public Builder externalAllowedAccounts(List externalAllowedAccounts) { + this.externalAllowedAccounts = externalAllowedAccounts; + return this; + } + } + + protected IdentityTypesBase() { } + + protected IdentityTypesBase(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.state, + "state cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.externalAllowedAccounts, + "externalAllowedAccounts cannot be null"); + state = builder.state; + externalAllowedAccounts = builder.externalAllowedAccounts; + } + + /** + * New builder. + * + * @return a IdentityTypesBase builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the state. + * + * The state of the identity type. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the externalAllowedAccounts. + * + * List of accounts that the state applies to for a given identity. + * + * @return the externalAllowedAccounts + */ + public List externalAllowedAccounts() { + return externalAllowedAccounts; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java new file mode 100644 index 00000000000..77aa5a26366 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java @@ -0,0 +1,147 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The settings to apply for each identity type for a request. + */ +public class IdentityTypesPatch extends GenericModel { + + protected IdentityTypesBase user; + @SerializedName("service_id") + protected IdentityTypesBase serviceId; + protected IdentityTypesBase service; + + /** + * Builder. + */ + public static class Builder { + private IdentityTypesBase user; + private IdentityTypesBase serviceId; + private IdentityTypesBase service; + + /** + * Instantiates a new Builder from an existing IdentityTypesPatch instance. + * + * @param identityTypesPatch the instance to initialize the Builder with + */ + private Builder(IdentityTypesPatch identityTypesPatch) { + this.user = identityTypesPatch.user; + this.serviceId = identityTypesPatch.serviceId; + this.service = identityTypesPatch.service; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a IdentityTypesPatch. + * + * @return the new IdentityTypesPatch instance + */ + public IdentityTypesPatch build() { + return new IdentityTypesPatch(this); + } + + /** + * Set the user. + * + * @param user the user + * @return the IdentityTypesPatch builder + */ + public Builder user(IdentityTypesBase user) { + this.user = user; + return this; + } + + /** + * Set the serviceId. + * + * @param serviceId the serviceId + * @return the IdentityTypesPatch builder + */ + public Builder serviceId(IdentityTypesBase serviceId) { + this.serviceId = serviceId; + return this; + } + + /** + * Set the service. + * + * @param service the service + * @return the IdentityTypesPatch builder + */ + public Builder service(IdentityTypesBase service) { + this.service = service; + return this; + } + } + + protected IdentityTypesPatch() { } + + protected IdentityTypesPatch(Builder builder) { + user = builder.user; + serviceId = builder.serviceId; + service = builder.service; + } + + /** + * New builder. + * + * @return a IdentityTypesPatch builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the user. + * + * The core set of properties associated with an identity type. + * + * @return the user + */ + public IdentityTypesBase user() { + return user; + } + + /** + * Gets the serviceId. + * + * The core set of properties associated with an identity type. + * + * @return the serviceId + */ + public IdentityTypesBase serviceId() { + return serviceId; + } + + /** + * Gets the service. + * + * The core set of properties associated with an identity type. + * + * @return the service + */ + public IdentityTypesBase service() { + return service; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java new file mode 100644 index 00000000000..5aa0b39573b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * policy template current and limit details with in an account. + */ +public class LimitData extends GenericModel { + + protected Long current; + protected Long limit; + + protected LimitData() { } + + /** + * Gets the current. + * + * policy template current count. + * + * @return the current + */ + public Long getCurrent() { + return current; + } + + /** + * Gets the limit. + * + * policy template limit count. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java new file mode 100644 index 00000000000..6835f5afccc --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java @@ -0,0 +1,245 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listActionControlAssignments options. + */ +public class ListActionControlAssignmentsOptions extends GenericModel { + + protected String accountId; + protected String acceptLanguage; + protected String templateId; + protected String templateVersion; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String templateId; + private String templateVersion; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListActionControlAssignmentsOptions instance. + * + * @param listActionControlAssignmentsOptions the instance to initialize the Builder with + */ + private Builder(ListActionControlAssignmentsOptions listActionControlAssignmentsOptions) { + this.accountId = listActionControlAssignmentsOptions.accountId; + this.acceptLanguage = listActionControlAssignmentsOptions.acceptLanguage; + this.templateId = listActionControlAssignmentsOptions.templateId; + this.templateVersion = listActionControlAssignmentsOptions.templateVersion; + this.limit = listActionControlAssignmentsOptions.limit; + this.start = listActionControlAssignmentsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListActionControlAssignmentsOptions. + * + * @return the new ListActionControlAssignmentsOptions instance + */ + public ListActionControlAssignmentsOptions build() { + return new ListActionControlAssignmentsOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the templateId. + * + * @param templateId the templateId + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder templateId(String templateId) { + this.templateId = templateId; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListActionControlAssignmentsOptions() { } + + protected ListActionControlAssignmentsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + templateId = builder.templateId; + templateVersion = builder.templateVersion; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListActionControlAssignmentsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID in which the action control assignment belongs to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the templateId. + * + * Optional template ID. + * + * @return the templateId + */ + public String templateId() { + return templateId; + } + + /** + * Gets the templateVersion. + * + * Optional action control template version. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java new file mode 100644 index 00000000000..984d1060c83 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listActionControlTemplateVersions options. + */ +public class ListActionControlTemplateVersionsOptions extends GenericModel { + + /** + * Action control template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String actionControlTemplateId; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListActionControlTemplateVersionsOptions instance. + * + * @param listActionControlTemplateVersionsOptions the instance to initialize the Builder with + */ + private Builder(ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions) { + this.actionControlTemplateId = listActionControlTemplateVersionsOptions.actionControlTemplateId; + this.state = listActionControlTemplateVersionsOptions.state; + this.limit = listActionControlTemplateVersionsOptions.limit; + this.start = listActionControlTemplateVersionsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + */ + public Builder(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + } + + /** + * Builds a ListActionControlTemplateVersionsOptions. + * + * @return the new ListActionControlTemplateVersionsOptions instance + */ + public ListActionControlTemplateVersionsOptions build() { + return new ListActionControlTemplateVersionsOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the ListActionControlTemplateVersionsOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListActionControlTemplateVersionsOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListActionControlTemplateVersionsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListActionControlTemplateVersionsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListActionControlTemplateVersionsOptions() { } + + protected ListActionControlTemplateVersionsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListActionControlTemplateVersionsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * The action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the state. + * + * Action control template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java new file mode 100644 index 00000000000..d019db6119f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java @@ -0,0 +1,193 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listActionControlTemplates options. + */ +public class ListActionControlTemplatesOptions extends GenericModel { + + protected String accountId; + protected String acceptLanguage; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListActionControlTemplatesOptions instance. + * + * @param listActionControlTemplatesOptions the instance to initialize the Builder with + */ + private Builder(ListActionControlTemplatesOptions listActionControlTemplatesOptions) { + this.accountId = listActionControlTemplatesOptions.accountId; + this.acceptLanguage = listActionControlTemplatesOptions.acceptLanguage; + this.limit = listActionControlTemplatesOptions.limit; + this.start = listActionControlTemplatesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListActionControlTemplatesOptions. + * + * @return the new ListActionControlTemplatesOptions instance + */ + public ListActionControlTemplatesOptions build() { + return new ListActionControlTemplatesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListActionControlTemplatesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListActionControlTemplatesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListActionControlTemplatesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListActionControlTemplatesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListActionControlTemplatesOptions() { } + + protected ListActionControlTemplatesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListActionControlTemplatesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the action control templates belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java new file mode 100644 index 00000000000..90ecb352c37 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java @@ -0,0 +1,501 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listPolicies options. + */ +public class ListPoliciesOptions extends GenericModel { + + /** + * Optional type of policy. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + /** + * Optional type of service. + */ + public interface ServiceType { + /** service. */ + String SERVICE = "service"; + /** platform_service. */ + String PLATFORM_SERVICE = "platform_service"; + } + + /** + * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending + * '-' to field. Example '-last_modified_at'. + */ + public interface Sort { + /** id. */ + String ID = "id"; + /** type. */ + String TYPE = "type"; + /** href. */ + String HREF = "href"; + /** created_at. */ + String CREATED_AT = "created_at"; + /** created_by_id. */ + String CREATED_BY_ID = "created_by_id"; + /** last_modified_at. */ + String LAST_MODIFIED_AT = "last_modified_at"; + /** last_modified_by_id. */ + String LAST_MODIFIED_BY_ID = "last_modified_by_id"; + /** state. */ + String STATE = "state"; + } + + /** + * Include additional data per policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles. + */ + public interface Format { + /** include_last_permit. */ + String INCLUDE_LAST_PERMIT = "include_last_permit"; + /** display. */ + String DISPLAY = "display"; + } + + /** + * The state of the policy. + * * `active` - returns active policies + * * `deleted` - returns non-active policies. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String accountId; + protected String acceptLanguage; + protected String iamId; + protected String accessGroupId; + protected String type; + protected String serviceType; + protected String tagName; + protected String tagValue; + protected String sort; + protected String format; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String iamId; + private String accessGroupId; + private String type; + private String serviceType; + private String tagName; + private String tagValue; + private String sort; + private String format; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListPoliciesOptions instance. + * + * @param listPoliciesOptions the instance to initialize the Builder with + */ + private Builder(ListPoliciesOptions listPoliciesOptions) { + this.accountId = listPoliciesOptions.accountId; + this.acceptLanguage = listPoliciesOptions.acceptLanguage; + this.iamId = listPoliciesOptions.iamId; + this.accessGroupId = listPoliciesOptions.accessGroupId; + this.type = listPoliciesOptions.type; + this.serviceType = listPoliciesOptions.serviceType; + this.tagName = listPoliciesOptions.tagName; + this.tagValue = listPoliciesOptions.tagValue; + this.sort = listPoliciesOptions.sort; + this.format = listPoliciesOptions.format; + this.state = listPoliciesOptions.state; + this.limit = listPoliciesOptions.limit; + this.start = listPoliciesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListPoliciesOptions. + * + * @return the new ListPoliciesOptions instance + */ + public ListPoliciesOptions build() { + return new ListPoliciesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListPoliciesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListPoliciesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the iamId. + * + * @param iamId the iamId + * @return the ListPoliciesOptions builder + */ + public Builder iamId(String iamId) { + this.iamId = iamId; + return this; + } + + /** + * Set the accessGroupId. + * + * @param accessGroupId the accessGroupId + * @return the ListPoliciesOptions builder + */ + public Builder accessGroupId(String accessGroupId) { + this.accessGroupId = accessGroupId; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the ListPoliciesOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the serviceType. + * + * @param serviceType the serviceType + * @return the ListPoliciesOptions builder + */ + public Builder serviceType(String serviceType) { + this.serviceType = serviceType; + return this; + } + + /** + * Set the tagName. + * + * @param tagName the tagName + * @return the ListPoliciesOptions builder + */ + public Builder tagName(String tagName) { + this.tagName = tagName; + return this; + } + + /** + * Set the tagValue. + * + * @param tagValue the tagValue + * @return the ListPoliciesOptions builder + */ + public Builder tagValue(String tagValue) { + this.tagValue = tagValue; + return this; + } + + /** + * Set the sort. + * + * @param sort the sort + * @return the ListPoliciesOptions builder + */ + public Builder sort(String sort) { + this.sort = sort; + return this; + } + + /** + * Set the format. + * + * @param format the format + * @return the ListPoliciesOptions builder + */ + public Builder format(String format) { + this.format = format; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListPoliciesOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListPoliciesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListPoliciesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListPoliciesOptions() { } + + protected ListPoliciesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + iamId = builder.iamId; + accessGroupId = builder.accessGroupId; + type = builder.type; + serviceType = builder.serviceType; + tagName = builder.tagName; + tagValue = builder.tagValue; + sort = builder.sort; + format = builder.format; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListPoliciesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the policies belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the iamId. + * + * Optional IAM ID used to identify the subject. + * + * @return the iamId + */ + public String iamId() { + return iamId; + } + + /** + * Gets the accessGroupId. + * + * Optional access group id. + * + * @return the accessGroupId + */ + public String accessGroupId() { + return accessGroupId; + } + + /** + * Gets the type. + * + * Optional type of policy. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the serviceType. + * + * Optional type of service. + * + * @return the serviceType + */ + public String serviceType() { + return serviceType; + } + + /** + * Gets the tagName. + * + * Optional name of the access tag in the policy. + * + * @return the tagName + */ + public String tagName() { + return tagName; + } + + /** + * Gets the tagValue. + * + * Optional value of the access tag in the policy. + * + * @return the tagValue + */ + public String tagValue() { + return tagValue; + } + + /** + * Gets the sort. + * + * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending + * '-' to field. Example '-last_modified_at'. + * + * @return the sort + */ + public String sort() { + return sort; + } + + /** + * Gets the format. + * + * Include additional data per policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles. + * + * @return the format + */ + public String format() { + return format; + } + + /** + * Gets the state. + * + * The state of the policy. + * * `active` - returns active policies + * * `deleted` - returns non-active policies. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java new file mode 100644 index 00000000000..9362749c670 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java @@ -0,0 +1,275 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listPolicyAssignments options. + */ +public class ListPolicyAssignmentsOptions extends GenericModel { + + protected String version; + protected String accountId; + protected String acceptLanguage; + protected String templateId; + protected String templateVersion; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String version; + private String accountId; + private String acceptLanguage; + private String templateId; + private String templateVersion; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListPolicyAssignmentsOptions instance. + * + * @param listPolicyAssignmentsOptions the instance to initialize the Builder with + */ + private Builder(ListPolicyAssignmentsOptions listPolicyAssignmentsOptions) { + this.version = listPolicyAssignmentsOptions.version; + this.accountId = listPolicyAssignmentsOptions.accountId; + this.acceptLanguage = listPolicyAssignmentsOptions.acceptLanguage; + this.templateId = listPolicyAssignmentsOptions.templateId; + this.templateVersion = listPolicyAssignmentsOptions.templateVersion; + this.limit = listPolicyAssignmentsOptions.limit; + this.start = listPolicyAssignmentsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param version the version + * @param accountId the accountId + */ + public Builder(String version, String accountId) { + this.version = version; + this.accountId = accountId; + } + + /** + * Builds a ListPolicyAssignmentsOptions. + * + * @return the new ListPolicyAssignmentsOptions instance + */ + public ListPolicyAssignmentsOptions build() { + return new ListPolicyAssignmentsOptions(this); + } + + /** + * Set the version. + * + * @param version the version + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the templateId. + * + * @param templateId the templateId + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder templateId(String templateId) { + this.templateId = templateId; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListPolicyAssignmentsOptions() { } + + protected ListPolicyAssignmentsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + version = builder.version; + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + templateId = builder.templateId; + templateVersion = builder.templateVersion; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListPolicyAssignmentsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the version. + * + * specify version of response body format. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the accountId. + * + * The account GUID in which the policies belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the templateId. + * + * Optional template id. + * + * @return the templateId + */ + public String templateId() { + return templateId; + } + + /** + * Gets the templateVersion. + * + * Optional policy template version. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java new file mode 100644 index 00000000000..c7965ba6c31 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listPolicyTemplateVersions options. + */ +public class ListPolicyTemplateVersionsOptions extends GenericModel { + + /** + * The policy template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String policyTemplateId; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListPolicyTemplateVersionsOptions instance. + * + * @param listPolicyTemplateVersionsOptions the instance to initialize the Builder with + */ + private Builder(ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions) { + this.policyTemplateId = listPolicyTemplateVersionsOptions.policyTemplateId; + this.state = listPolicyTemplateVersionsOptions.state; + this.limit = listPolicyTemplateVersionsOptions.limit; + this.start = listPolicyTemplateVersionsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + */ + public Builder(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + } + + /** + * Builds a ListPolicyTemplateVersionsOptions. + * + * @return the new ListPolicyTemplateVersionsOptions instance + */ + public ListPolicyTemplateVersionsOptions build() { + return new ListPolicyTemplateVersionsOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the ListPolicyTemplateVersionsOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListPolicyTemplateVersionsOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListPolicyTemplateVersionsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListPolicyTemplateVersionsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListPolicyTemplateVersionsOptions() { } + + protected ListPolicyTemplateVersionsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + policyTemplateId = builder.policyTemplateId; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListPolicyTemplateVersionsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the state. + * + * The policy template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java new file mode 100644 index 00000000000..f230c9bd549 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java @@ -0,0 +1,379 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listPolicyTemplates options. + */ +public class ListPolicyTemplatesOptions extends GenericModel { + + /** + * The policy template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + /** + * Service type, Optional. + */ + public interface PolicyServiceType { + /** service. */ + String SERVICE = "service"; + /** platform_service. */ + String PLATFORM_SERVICE = "platform_service"; + } + + /** + * Policy type, Optional. + */ + public interface PolicyType { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + protected String accountId; + protected String acceptLanguage; + protected String state; + protected String name; + protected String policyServiceType; + protected String policyServiceName; + protected String policyServiceGroupId; + protected String policyType; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String state; + private String name; + private String policyServiceType; + private String policyServiceName; + private String policyServiceGroupId; + private String policyType; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListPolicyTemplatesOptions instance. + * + * @param listPolicyTemplatesOptions the instance to initialize the Builder with + */ + private Builder(ListPolicyTemplatesOptions listPolicyTemplatesOptions) { + this.accountId = listPolicyTemplatesOptions.accountId; + this.acceptLanguage = listPolicyTemplatesOptions.acceptLanguage; + this.state = listPolicyTemplatesOptions.state; + this.name = listPolicyTemplatesOptions.name; + this.policyServiceType = listPolicyTemplatesOptions.policyServiceType; + this.policyServiceName = listPolicyTemplatesOptions.policyServiceName; + this.policyServiceGroupId = listPolicyTemplatesOptions.policyServiceGroupId; + this.policyType = listPolicyTemplatesOptions.policyType; + this.limit = listPolicyTemplatesOptions.limit; + this.start = listPolicyTemplatesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListPolicyTemplatesOptions. + * + * @return the new ListPolicyTemplatesOptions instance + */ + public ListPolicyTemplatesOptions build() { + return new ListPolicyTemplatesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListPolicyTemplatesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListPolicyTemplatesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListPolicyTemplatesOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ListPolicyTemplatesOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the policyServiceType. + * + * @param policyServiceType the policyServiceType + * @return the ListPolicyTemplatesOptions builder + */ + public Builder policyServiceType(String policyServiceType) { + this.policyServiceType = policyServiceType; + return this; + } + + /** + * Set the policyServiceName. + * + * @param policyServiceName the policyServiceName + * @return the ListPolicyTemplatesOptions builder + */ + public Builder policyServiceName(String policyServiceName) { + this.policyServiceName = policyServiceName; + return this; + } + + /** + * Set the policyServiceGroupId. + * + * @param policyServiceGroupId the policyServiceGroupId + * @return the ListPolicyTemplatesOptions builder + */ + public Builder policyServiceGroupId(String policyServiceGroupId) { + this.policyServiceGroupId = policyServiceGroupId; + return this; + } + + /** + * Set the policyType. + * + * @param policyType the policyType + * @return the ListPolicyTemplatesOptions builder + */ + public Builder policyType(String policyType) { + this.policyType = policyType; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListPolicyTemplatesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListPolicyTemplatesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListPolicyTemplatesOptions() { } + + protected ListPolicyTemplatesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + state = builder.state; + name = builder.name; + policyServiceType = builder.policyServiceType; + policyServiceName = builder.policyServiceName; + policyServiceGroupId = builder.policyServiceGroupId; + policyType = builder.policyType; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListPolicyTemplatesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the policy templates belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the state. + * + * The policy template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the name. + * + * The policy template name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the policyServiceType. + * + * Service type, Optional. + * + * @return the policyServiceType + */ + public String policyServiceType() { + return policyServiceType; + } + + /** + * Gets the policyServiceName. + * + * Service name, Optional. + * + * @return the policyServiceName + */ + public String policyServiceName() { + return policyServiceName; + } + + /** + * Gets the policyServiceGroupId. + * + * Service group id, Optional. + * + * @return the policyServiceGroupId + */ + public String policyServiceGroupId() { + return policyServiceGroupId; + } + + /** + * Gets the policyType. + * + * Policy type, Optional. + * + * @return the policyType + */ + public String policyType() { + return policyType; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java new file mode 100644 index 00000000000..adcb3f0cc90 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java @@ -0,0 +1,245 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listRoleAssignments options. + */ +public class ListRoleAssignmentsOptions extends GenericModel { + + protected String accountId; + protected String acceptLanguage; + protected String templateId; + protected String templateVersion; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String templateId; + private String templateVersion; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListRoleAssignmentsOptions instance. + * + * @param listRoleAssignmentsOptions the instance to initialize the Builder with + */ + private Builder(ListRoleAssignmentsOptions listRoleAssignmentsOptions) { + this.accountId = listRoleAssignmentsOptions.accountId; + this.acceptLanguage = listRoleAssignmentsOptions.acceptLanguage; + this.templateId = listRoleAssignmentsOptions.templateId; + this.templateVersion = listRoleAssignmentsOptions.templateVersion; + this.limit = listRoleAssignmentsOptions.limit; + this.start = listRoleAssignmentsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListRoleAssignmentsOptions. + * + * @return the new ListRoleAssignmentsOptions instance + */ + public ListRoleAssignmentsOptions build() { + return new ListRoleAssignmentsOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListRoleAssignmentsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListRoleAssignmentsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the templateId. + * + * @param templateId the templateId + * @return the ListRoleAssignmentsOptions builder + */ + public Builder templateId(String templateId) { + this.templateId = templateId; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the ListRoleAssignmentsOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListRoleAssignmentsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListRoleAssignmentsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListRoleAssignmentsOptions() { } + + protected ListRoleAssignmentsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + templateId = builder.templateId; + templateVersion = builder.templateVersion; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListRoleAssignmentsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID in which the role assignment belongs to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the templateId. + * + * Optional template ID. + * + * @return the templateId + */ + public String templateId() { + return templateId; + } + + /** + * Gets the templateVersion. + * + * Optional role template version. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java new file mode 100644 index 00000000000..e22751433e5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listRoleTemplateVersions options. + */ +public class ListRoleTemplateVersionsOptions extends GenericModel { + + /** + * Role template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String roleTemplateId; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListRoleTemplateVersionsOptions instance. + * + * @param listRoleTemplateVersionsOptions the instance to initialize the Builder with + */ + private Builder(ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions) { + this.roleTemplateId = listRoleTemplateVersionsOptions.roleTemplateId; + this.state = listRoleTemplateVersionsOptions.state; + this.limit = listRoleTemplateVersionsOptions.limit; + this.start = listRoleTemplateVersionsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + */ + public Builder(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + } + + /** + * Builds a ListRoleTemplateVersionsOptions. + * + * @return the new ListRoleTemplateVersionsOptions instance + */ + public ListRoleTemplateVersionsOptions build() { + return new ListRoleTemplateVersionsOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the ListRoleTemplateVersionsOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListRoleTemplateVersionsOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListRoleTemplateVersionsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListRoleTemplateVersionsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListRoleTemplateVersionsOptions() { } + + protected ListRoleTemplateVersionsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + roleTemplateId = builder.roleTemplateId; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListRoleTemplateVersionsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * The role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the state. + * + * Role template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java new file mode 100644 index 00000000000..8f889bdce96 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java @@ -0,0 +1,307 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listRoleTemplates options. + */ +public class ListRoleTemplatesOptions extends GenericModel { + + /** + * The role template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String accountId; + protected String acceptLanguage; + protected String name; + protected String roleName; + protected String roleServiceName; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String name; + private String roleName; + private String roleServiceName; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListRoleTemplatesOptions instance. + * + * @param listRoleTemplatesOptions the instance to initialize the Builder with + */ + private Builder(ListRoleTemplatesOptions listRoleTemplatesOptions) { + this.accountId = listRoleTemplatesOptions.accountId; + this.acceptLanguage = listRoleTemplatesOptions.acceptLanguage; + this.name = listRoleTemplatesOptions.name; + this.roleName = listRoleTemplatesOptions.roleName; + this.roleServiceName = listRoleTemplatesOptions.roleServiceName; + this.state = listRoleTemplatesOptions.state; + this.limit = listRoleTemplatesOptions.limit; + this.start = listRoleTemplatesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListRoleTemplatesOptions. + * + * @return the new ListRoleTemplatesOptions instance + */ + public ListRoleTemplatesOptions build() { + return new ListRoleTemplatesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListRoleTemplatesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListRoleTemplatesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ListRoleTemplatesOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the roleName. + * + * @param roleName the roleName + * @return the ListRoleTemplatesOptions builder + */ + public Builder roleName(String roleName) { + this.roleName = roleName; + return this; + } + + /** + * Set the roleServiceName. + * + * @param roleServiceName the roleServiceName + * @return the ListRoleTemplatesOptions builder + */ + public Builder roleServiceName(String roleServiceName) { + this.roleServiceName = roleServiceName; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListRoleTemplatesOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListRoleTemplatesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListRoleTemplatesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListRoleTemplatesOptions() { } + + protected ListRoleTemplatesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + name = builder.name; + roleName = builder.roleName; + roleServiceName = builder.roleServiceName; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListRoleTemplatesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the role templates belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the name. + * + * The role template name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the roleName. + * + * The template role name. + * + * @return the roleName + */ + public String roleName() { + return roleName; + } + + /** + * Gets the roleServiceName. + * + * The template role service name. + * + * @return the roleServiceName + */ + public String roleServiceName() { + return roleServiceName; + } + + /** + * Gets the state. + * + * The role template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java new file mode 100644 index 00000000000..2ca364c53a3 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java @@ -0,0 +1,234 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listRoles options. + */ +public class ListRolesOptions extends GenericModel { + + protected String acceptLanguage; + protected String accountId; + protected String serviceName; + protected String sourceServiceName; + protected String policyType; + protected String serviceGroupId; + + /** + * Builder. + */ + public static class Builder { + private String acceptLanguage; + private String accountId; + private String serviceName; + private String sourceServiceName; + private String policyType; + private String serviceGroupId; + + /** + * Instantiates a new Builder from an existing ListRolesOptions instance. + * + * @param listRolesOptions the instance to initialize the Builder with + */ + private Builder(ListRolesOptions listRolesOptions) { + this.acceptLanguage = listRolesOptions.acceptLanguage; + this.accountId = listRolesOptions.accountId; + this.serviceName = listRolesOptions.serviceName; + this.sourceServiceName = listRolesOptions.sourceServiceName; + this.policyType = listRolesOptions.policyType; + this.serviceGroupId = listRolesOptions.serviceGroupId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ListRolesOptions. + * + * @return the new ListRolesOptions instance + */ + public ListRolesOptions build() { + return new ListRolesOptions(this); + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListRolesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListRolesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the ListRolesOptions builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the sourceServiceName. + * + * @param sourceServiceName the sourceServiceName + * @return the ListRolesOptions builder + */ + public Builder sourceServiceName(String sourceServiceName) { + this.sourceServiceName = sourceServiceName; + return this; + } + + /** + * Set the policyType. + * + * @param policyType the policyType + * @return the ListRolesOptions builder + */ + public Builder policyType(String policyType) { + this.policyType = policyType; + return this; + } + + /** + * Set the serviceGroupId. + * + * @param serviceGroupId the serviceGroupId + * @return the ListRolesOptions builder + */ + public Builder serviceGroupId(String serviceGroupId) { + this.serviceGroupId = serviceGroupId; + return this; + } + } + + protected ListRolesOptions() { } + + protected ListRolesOptions(Builder builder) { + acceptLanguage = builder.acceptLanguage; + accountId = builder.accountId; + serviceName = builder.serviceName; + sourceServiceName = builder.sourceServiceName; + policyType = builder.policyType; + serviceGroupId = builder.serviceGroupId; + } + + /** + * New builder. + * + * @return a ListRolesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the accountId. + * + * Optional account GUID in which the roles belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the serviceName. + * + * Optional name of IAM enabled service. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the sourceServiceName. + * + * Optional name of source IAM enabled service. + * + * @return the sourceServiceName + */ + public String sourceServiceName() { + return sourceServiceName; + } + + /** + * Gets the policyType. + * + * Optional Policy Type. + * + * @return the policyType + */ + public String policyType() { + return policyType; + } + + /** + * Gets the serviceGroupId. + * + * Optional id of service group. + * + * @return the serviceGroupId + */ + public String serviceGroupId() { + return serviceGroupId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java new file mode 100644 index 00000000000..65849c3d9a6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java @@ -0,0 +1,492 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listV2Policies options. + */ +public class ListV2PoliciesOptions extends GenericModel { + + /** + * Optional type of policy. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + /** + * Optional type of service. + */ + public interface ServiceType { + /** service. */ + String SERVICE = "service"; + /** platform_service. */ + String PLATFORM_SERVICE = "platform_service"; + } + + /** + * Include additional data per policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles and translations for all + * relevant fields. + */ + public interface Format { + /** include_last_permit. */ + String INCLUDE_LAST_PERMIT = "include_last_permit"; + /** display. */ + String DISPLAY = "display"; + } + + /** + * The state of the policy. + * * `active` - returns active policies + * * `deleted` - returns non-active policies. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String accountId; + protected String acceptLanguage; + protected String iamId; + protected String accessGroupId; + protected String type; + protected String serviceType; + protected String serviceName; + protected String serviceGroupId; + protected String sort; + protected String format; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String iamId; + private String accessGroupId; + private String type; + private String serviceType; + private String serviceName; + private String serviceGroupId; + private String sort; + private String format; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListV2PoliciesOptions instance. + * + * @param listV2PoliciesOptions the instance to initialize the Builder with + */ + private Builder(ListV2PoliciesOptions listV2PoliciesOptions) { + this.accountId = listV2PoliciesOptions.accountId; + this.acceptLanguage = listV2PoliciesOptions.acceptLanguage; + this.iamId = listV2PoliciesOptions.iamId; + this.accessGroupId = listV2PoliciesOptions.accessGroupId; + this.type = listV2PoliciesOptions.type; + this.serviceType = listV2PoliciesOptions.serviceType; + this.serviceName = listV2PoliciesOptions.serviceName; + this.serviceGroupId = listV2PoliciesOptions.serviceGroupId; + this.sort = listV2PoliciesOptions.sort; + this.format = listV2PoliciesOptions.format; + this.state = listV2PoliciesOptions.state; + this.limit = listV2PoliciesOptions.limit; + this.start = listV2PoliciesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListV2PoliciesOptions. + * + * @return the new ListV2PoliciesOptions instance + */ + public ListV2PoliciesOptions build() { + return new ListV2PoliciesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListV2PoliciesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListV2PoliciesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the iamId. + * + * @param iamId the iamId + * @return the ListV2PoliciesOptions builder + */ + public Builder iamId(String iamId) { + this.iamId = iamId; + return this; + } + + /** + * Set the accessGroupId. + * + * @param accessGroupId the accessGroupId + * @return the ListV2PoliciesOptions builder + */ + public Builder accessGroupId(String accessGroupId) { + this.accessGroupId = accessGroupId; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the ListV2PoliciesOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the serviceType. + * + * @param serviceType the serviceType + * @return the ListV2PoliciesOptions builder + */ + public Builder serviceType(String serviceType) { + this.serviceType = serviceType; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the ListV2PoliciesOptions builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the serviceGroupId. + * + * @param serviceGroupId the serviceGroupId + * @return the ListV2PoliciesOptions builder + */ + public Builder serviceGroupId(String serviceGroupId) { + this.serviceGroupId = serviceGroupId; + return this; + } + + /** + * Set the sort. + * + * @param sort the sort + * @return the ListV2PoliciesOptions builder + */ + public Builder sort(String sort) { + this.sort = sort; + return this; + } + + /** + * Set the format. + * + * @param format the format + * @return the ListV2PoliciesOptions builder + */ + public Builder format(String format) { + this.format = format; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListV2PoliciesOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListV2PoliciesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListV2PoliciesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListV2PoliciesOptions() { } + + protected ListV2PoliciesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + iamId = builder.iamId; + accessGroupId = builder.accessGroupId; + type = builder.type; + serviceType = builder.serviceType; + serviceName = builder.serviceName; + serviceGroupId = builder.serviceGroupId; + sort = builder.sort; + format = builder.format; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListV2PoliciesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID in which the policies belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the iamId. + * + * Optional IAM ID used to identify the subject. + * + * @return the iamId + */ + public String iamId() { + return iamId; + } + + /** + * Gets the accessGroupId. + * + * Optional access group id. + * + * @return the accessGroupId + */ + public String accessGroupId() { + return accessGroupId; + } + + /** + * Gets the type. + * + * Optional type of policy. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the serviceType. + * + * Optional type of service. + * + * @return the serviceType + */ + public String serviceType() { + return serviceType; + } + + /** + * Gets the serviceName. + * + * Optional name of service. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the serviceGroupId. + * + * Optional ID of service group. + * + * @return the serviceGroupId + */ + public String serviceGroupId() { + return serviceGroupId; + } + + /** + * Gets the sort. + * + * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending + * '-' to field, for example, '-last_modified_at'. Note that last permit information is only included when + * 'format=include_last_permit', for example, "format=include_last_permit&sort=last_permit_at" Example fields that + * can be sorted on: + * - 'id' + * - 'type' + * - 'href' + * - 'created_at' + * - 'created_by_id' + * - 'last_modified_at' + * - 'last_modified_by_id' + * - 'state' + * - 'last_permit_at' + * - 'last_permit_frequency'. + * + * @return the sort + */ + public String sort() { + return sort; + } + + /** + * Gets the format. + * + * Include additional data per policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles and translations for all + * relevant fields. + * + * @return the format + */ + public String format() { + return format; + } + + /** + * Gets the state. + * + * The state of the policy. + * * `active` - returns active policies + * * `deleted` - returns non-active policies. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java new file mode 100644 index 00000000000..4d43d84dbba --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java @@ -0,0 +1,126 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Condition that specifies additional conditions or RuleAttribute to grant access. + * + * Classes which extend this class: + * - NestedConditionRuleAttribute + * - NestedConditionRuleWithConditions + */ +public class NestedCondition extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + protected String key; + protected String operator; + protected Object value; + protected List conditions; + + protected NestedCondition() { } + + /** + * Gets the key. + * + * The name of an attribute. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } + + /** + * Gets the conditions. + * + * List of conditions associated with a policy. For example, time-based conditions that grant access over a certain + * time period. + * + * @return the conditions + */ + public List conditions() { + return conditions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java new file mode 100644 index 00000000000..b1d44da3f6b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java @@ -0,0 +1,170 @@ +/* + * (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_policy_management.v1.model; + +/** + * Rule that specifies additional access that is granted (For example, time-based condition). + */ +public class NestedConditionRuleAttribute extends NestedCondition { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing NestedConditionRuleAttribute instance. + * + * @param nestedConditionRuleAttribute the instance to initialize the Builder with + */ + public Builder(NestedCondition nestedConditionRuleAttribute) { + this.key = nestedConditionRuleAttribute.key; + this.operator = nestedConditionRuleAttribute.operator; + this.value = nestedConditionRuleAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a NestedConditionRuleAttribute. + * + * @return the new NestedConditionRuleAttribute instance + */ + public NestedConditionRuleAttribute build() { + return new NestedConditionRuleAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the NestedConditionRuleAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the NestedConditionRuleAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the NestedConditionRuleAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected NestedConditionRuleAttribute() { } + + protected NestedConditionRuleAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a NestedConditionRuleAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java new file mode 100644 index 00000000000..20d0faac795 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java @@ -0,0 +1,139 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * Rule that specifies additional access that is granted (for example, time-based condition) accross multiple + * conditions. + */ +public class NestedConditionRuleWithConditions extends NestedCondition { + + /** + * Operator to evaluate conditions. + */ + public interface Operator { + /** and. */ + String AND = "and"; + /** or. */ + String OR = "or"; + } + + + /** + * Builder. + */ + public static class Builder { + private String operator; + private List conditions; + + /** + * Instantiates a new Builder from an existing NestedConditionRuleWithConditions instance. + * + * @param nestedConditionRuleWithConditions the instance to initialize the Builder with + */ + public Builder(NestedCondition nestedConditionRuleWithConditions) { + this.operator = nestedConditionRuleWithConditions.operator; + this.conditions = nestedConditionRuleWithConditions.conditions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param operator the operator + * @param conditions the conditions + */ + public Builder(String operator, List conditions) { + this.operator = operator; + this.conditions = conditions; + } + + /** + * Builds a NestedConditionRuleWithConditions. + * + * @return the new NestedConditionRuleWithConditions instance + */ + public NestedConditionRuleWithConditions build() { + return new NestedConditionRuleWithConditions(this); + } + + /** + * Adds a new element to conditions. + * + * @param conditions the new element to be added + * @return the NestedConditionRuleWithConditions builder + */ + public Builder addConditions(RuleAttribute conditions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(conditions, + "conditions cannot be null"); + if (this.conditions == null) { + this.conditions = new ArrayList(); + } + this.conditions.add(conditions); + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the NestedConditionRuleWithConditions builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the conditions. + * Existing conditions will be replaced. + * + * @param conditions the conditions + * @return the NestedConditionRuleWithConditions builder + */ + public Builder conditions(List conditions) { + this.conditions = conditions; + return this; + } + } + + protected NestedConditionRuleWithConditions() { } + + protected NestedConditionRuleWithConditions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.conditions, + "conditions cannot be null"); + operator = builder.operator; + conditions = builder.conditions; + } + + /** + * New builder. + * + * @return a NestedConditionRuleWithConditions builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java new file mode 100644 index 00000000000..b0442f902bc --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Details with href linking to the following page of requested collection. + */ +public class Next extends GenericModel { + + protected String href; + protected String start; + + protected Next() { } + + /** + * Gets the href. + * + * The href linking to the page of requested collection. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection. + * + * @return the start + */ + public String getStart() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java new file mode 100644 index 00000000000..8f12053c72e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * PoliciesPager can be used to simplify the use of the "listPolicies" method. + */ +public class PoliciesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListPoliciesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected PoliciesPager() { } + + /** + * Constructs a new PoliciesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listPolicies" method + * @param options the ListPoliciesOptions instance to be used to invoke the "listPolicies" method + */ + public PoliciesPager(IamPolicyManagement client, ListPoliciesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<PolicyTemplateMetaData> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListPoliciesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + PolicyCollection result = client.listPolicies(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getPolicies(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<PolicyTemplateMetaData> containing all results returned by the "listPolicies" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java new file mode 100644 index 00000000000..af852b7cd74 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java @@ -0,0 +1,188 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with a policy. + */ +public class Policy extends GenericModel { + + /** + * The policy state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String id; + protected String type; + protected String description; + protected List subjects; + protected List roles; + protected List resources; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String state; + + protected Policy() { } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the description. + * + * Customer-defined description. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the subjects. + * + * The subjects associated with a policy. + * + * @return the subjects + */ + public List getSubjects() { + return subjects; + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List getRoles() { + return roles; + } + + /** + * Gets the resources. + * + * The resources associated with a policy. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the href. + * + * The href links back to the policy. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the state. + * + * The policy state. + * + * @return the state + */ + public String getState() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java new file mode 100644 index 00000000000..3e566ce7bdf --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Set of properties for the assigned resource. + */ +public class PolicyAssignmentResourcePolicy extends GenericModel { + + @SerializedName("resource_created") + protected AssignmentResourceCreated resourceCreated; + protected String status; + @SerializedName("error_message") + protected AssignmentResourceError errorMessage; + + protected PolicyAssignmentResourcePolicy() { } + + /** + * Gets the resourceCreated. + * + * On success, includes the policy that is assigned. + * + * @return the resourceCreated + */ + public AssignmentResourceCreated getResourceCreated() { + return resourceCreated; + } + + /** + * Gets the status. + * + * policy status. + * + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * Gets the errorMessage. + * + * Body parameters for assignment error. + * + * @return the errorMessage + */ + public AssignmentResourceError getErrorMessage() { + return errorMessage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java new file mode 100644 index 00000000000..ad944536b0d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The policy assignment resources. + */ +public class PolicyAssignmentResources extends GenericModel { + + protected String target; + protected PolicyAssignmentResourcePolicy policy; + + protected PolicyAssignmentResources() { } + + /** + * Gets the target. + * + * Account ID where resources are assigned. + * + * @return the target + */ + public String getTarget() { + return target; + } + + /** + * Gets the policy. + * + * Set of properties for the assigned resource. + * + * @return the policy + */ + public PolicyAssignmentResourcePolicy getPolicy() { + return policy; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java new file mode 100644 index 00000000000..f1ea295713c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java @@ -0,0 +1,193 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the policy template assignment. + */ +public class PolicyAssignmentV1 extends GenericModel { + + /** + * The policy assignment status. + */ + public interface Status { + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** succeeded. */ + String SUCCEEDED = "succeeded"; + /** succeed_with_errors. */ + String SUCCEED_WITH_ERRORS = "succeed_with_errors"; + /** failed. */ + String FAILED = "failed"; + } + + protected AssignmentTargetDetails target; + protected String id; + @SerializedName("account_id") + protected String accountId; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected List resources; + protected PolicyAssignmentV1Subject subject; + protected AssignmentTemplateDetails template; + protected String status; + + protected PolicyAssignmentV1() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the id. + * + * Policy assignment ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the accountId. + * + * The account GUID that the policies assignments belong to. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the href. + * + * The href URL that links to the policies assignments API by policy assignment ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy assignment was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy assignment. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy assignment was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy assignment. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the resources. + * + * Object for each account assigned. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the subject. + * + * Subject details of access type assignment. + * + * @return the subject + */ + public PolicyAssignmentV1Subject getSubject() { + return subject; + } + + /** + * Gets the template. + * + * policy template details. + * + * @return the template + */ + public AssignmentTemplateDetails getTemplate() { + return template; + } + + /** + * Gets the status. + * + * The policy assignment status. + * + * @return the status + */ + public String getStatus() { + return status; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java new file mode 100644 index 00000000000..7331ee5a854 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Policy assignment response. + */ +public class PolicyAssignmentV1Collection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List assignments; + + protected PolicyAssignmentV1Collection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the assignments. + * + * Response of policy assignments. + * + * @return the assignments + */ + public List getAssignments() { + return assignments; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java new file mode 100644 index 00000000000..c05eb90816b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The policy assignment resources. + */ +public class PolicyAssignmentV1Resources extends GenericModel { + + protected AssignmentTargetDetails target; + protected PolicyAssignmentResourcePolicy policy; + + protected PolicyAssignmentV1Resources() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the policy. + * + * Set of properties for the assigned resource. + * + * @return the policy + */ + public PolicyAssignmentResourcePolicy getPolicy() { + return policy; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java new file mode 100644 index 00000000000..58b2cd240ba --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java @@ -0,0 +1,60 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Subject details of access type assignment. + */ +public class PolicyAssignmentV1Subject extends GenericModel { + + /** + * The identity type of the subject of the assignment. + */ + public interface Type { + /** iam_id. */ + String IAM_ID = "iam_id"; + /** access_group_id. */ + String ACCESS_GROUP_ID = "access_group_id"; + } + + protected String id; + protected String type; + + protected PolicyAssignmentV1Subject() { } + + /** + * Gets the id. + * + * The unique identifier of the subject of the assignment. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the type. + * + * The identity type of the subject of the assignment. + * + * @return the type + */ + public String getType() { + return type; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java new file mode 100644 index 00000000000..931769daed5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * PolicyAssignmentsPager can be used to simplify the use of the "listPolicyAssignments" method. + */ +public class PolicyAssignmentsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListPolicyAssignmentsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected PolicyAssignmentsPager() { } + + /** + * Constructs a new PolicyAssignmentsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyAssignments" method + * @param options the ListPolicyAssignmentsOptions instance to be used to invoke the "listPolicyAssignments" method + */ + public PolicyAssignmentsPager(IamPolicyManagement client, ListPolicyAssignmentsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<PolicyTemplateAssignmentItems> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListPolicyAssignmentsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + PolicyTemplateAssignmentCollection result = client.listPolicyAssignments(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getAssignments(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<PolicyTemplateAssignmentItems> containing all results returned by the "listPolicyAssignments" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java new file mode 100644 index 00000000000..25062dd0a52 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of policies. + */ +public class PolicyCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List policies; + + protected PolicyCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the policies. + * + * List of policies. + * + * @return the policies + */ + public List getPolicies() { + return policies; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java new file mode 100644 index 00000000000..4033f2dbc9d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java @@ -0,0 +1,167 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The attributes of the resource. Note that only one resource is allowed in a policy. + */ +public class PolicyResource extends GenericModel { + + protected List attributes; + protected List tags; + + /** + * Builder. + */ + public static class Builder { + private List attributes; + private List tags; + + /** + * Instantiates a new Builder from an existing PolicyResource instance. + * + * @param policyResource the instance to initialize the Builder with + */ + private Builder(PolicyResource policyResource) { + this.attributes = policyResource.attributes; + this.tags = policyResource.tags; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param attributes the attributes + */ + public Builder(List attributes) { + this.attributes = attributes; + } + + /** + * Builds a PolicyResource. + * + * @return the new PolicyResource instance + */ + public PolicyResource build() { + return new PolicyResource(this); + } + + /** + * Adds a new element to attributes. + * + * @param attributes the new element to be added + * @return the PolicyResource builder + */ + public Builder addAttributes(ResourceAttribute attributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, + "attributes cannot be null"); + if (this.attributes == null) { + this.attributes = new ArrayList(); + } + this.attributes.add(attributes); + return this; + } + + /** + * Adds a new element to tags. + * + * @param tags the new element to be added + * @return the PolicyResource builder + */ + public Builder addTags(ResourceTag tags) { + com.ibm.cloud.sdk.core.util.Validator.notNull(tags, + "tags cannot be null"); + if (this.tags == null) { + this.tags = new ArrayList(); + } + this.tags.add(tags); + return this; + } + + /** + * Set the attributes. + * Existing attributes will be replaced. + * + * @param attributes the attributes + * @return the PolicyResource builder + */ + public Builder attributes(List attributes) { + this.attributes = attributes; + return this; + } + + /** + * Set the tags. + * Existing tags will be replaced. + * + * @param tags the tags + * @return the PolicyResource builder + */ + public Builder tags(List tags) { + this.tags = tags; + return this; + } + } + + protected PolicyResource() { } + + protected PolicyResource(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, + "attributes cannot be null"); + attributes = builder.attributes; + tags = builder.tags; + } + + /** + * New builder. + * + * @return a PolicyResource builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the attributes. + * + * List of resource attributes. + * + * @return the attributes + */ + public List attributes() { + return attributes; + } + + /** + * Gets the tags. + * + * List of access management tags. + * + * @return the tags + */ + public List tags() { + return tags; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java new file mode 100644 index 00000000000..7319eabce7b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java @@ -0,0 +1,131 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role associated with a policy. + */ +public class PolicyRole extends GenericModel { + + @SerializedName("role_id") + protected String roleId; + @SerializedName("display_name") + protected String displayName; + protected String description; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + + /** + * Instantiates a new Builder from an existing PolicyRole instance. + * + * @param policyRole the instance to initialize the Builder with + */ + private Builder(PolicyRole policyRole) { + this.roleId = policyRole.roleId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + */ + public Builder(String roleId) { + this.roleId = roleId; + } + + /** + * Builds a PolicyRole. + * + * @return the new PolicyRole instance + */ + public PolicyRole build() { + return new PolicyRole(this); + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the PolicyRole builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + } + + protected PolicyRole() { } + + protected PolicyRole(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleId, + "roleId cannot be null"); + roleId = builder.roleId; + } + + /** + * New builder. + * + * @return a PolicyRole builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } + + /** + * Gets the displayName. + * + * The display name of the role. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String description() { + return description; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java new file mode 100644 index 00000000000..bf1b035a6b7 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java @@ -0,0 +1,124 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The subject attribute values that must match in order for this policy to apply in a permission decision. + */ +public class PolicySubject extends GenericModel { + + protected List attributes; + + /** + * Builder. + */ + public static class Builder { + private List attributes; + + /** + * Instantiates a new Builder from an existing PolicySubject instance. + * + * @param policySubject the instance to initialize the Builder with + */ + private Builder(PolicySubject policySubject) { + this.attributes = policySubject.attributes; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param attributes the attributes + */ + public Builder(List attributes) { + this.attributes = attributes; + } + + /** + * Builds a PolicySubject. + * + * @return the new PolicySubject instance + */ + public PolicySubject build() { + return new PolicySubject(this); + } + + /** + * Adds a new element to attributes. + * + * @param attributes the new element to be added + * @return the PolicySubject builder + */ + public Builder addAttributes(SubjectAttribute attributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, + "attributes cannot be null"); + if (this.attributes == null) { + this.attributes = new ArrayList(); + } + this.attributes.add(attributes); + return this; + } + + /** + * Set the attributes. + * Existing attributes will be replaced. + * + * @param attributes the attributes + * @return the PolicySubject builder + */ + public Builder attributes(List attributes) { + this.attributes = attributes; + return this; + } + } + + protected PolicySubject() { } + + protected PolicySubject(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, + "attributes cannot be null"); + attributes = builder.attributes; + } + + /** + * New builder. + * + * @return a PolicySubject builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the attributes. + * + * List of subject attributes. + * + * @return the attributes + */ + public List attributes() { + return attributes; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java new file mode 100644 index 00000000000..bdffbe98c10 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java @@ -0,0 +1,202 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the policy template. + */ +public class PolicyTemplate extends GenericModel { + + /** + * State of policy template. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String name; + protected String description; + @SerializedName("account_id") + protected String accountId; + protected String version; + protected Boolean committed; + protected TemplatePolicy policy; + protected String state; + protected String id; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + + protected PolicyTemplate() { } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the version. + * + * Template version. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the committed. + * + * Committed status of the template version. + * + * @return the committed + */ + public Boolean isCommitted() { + return committed; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy getPolicy() { + return policy; + } + + /** + * Gets the state. + * + * State of policy template. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the id. + * + * The policy template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the policy templates API by policy template ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy template was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy template. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy template was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy template. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java new file mode 100644 index 00000000000..54727eadf4d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of policies assignments. + */ +public class PolicyTemplateAssignmentCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List assignments; + + protected PolicyTemplateAssignmentCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the assignments. + * + * List of policy assignments. + * + * @return the assignments + */ + public List getAssignments() { + return assignments; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java new file mode 100644 index 00000000000..2c8e82df441 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java @@ -0,0 +1,261 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * PolicyTemplateAssignmentItems. + * + * Classes which extend this class: + * - PolicyTemplateAssignmentItemsPolicyAssignmentV1 + * - PolicyTemplateAssignmentItemsPolicyAssignment + */ +public class PolicyTemplateAssignmentItems extends GenericModel { + + /** + * The policy assignment status. + */ + public interface Status { + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** succeeded. */ + String SUCCEEDED = "succeeded"; + /** succeed_with_errors. */ + String SUCCEED_WITH_ERRORS = "succeed_with_errors"; + /** failed. */ + String FAILED = "failed"; + } + + /** + * Assignment target type. + */ + public interface TargetType { + /** Account. */ + String ACCOUNT = "Account"; + /** AccountGroup. */ + String ACCOUNTGROUP = "AccountGroup"; + /** Enterprise. */ + String ENTERPRISE = "Enterprise"; + } + + protected AssignmentTargetDetails target; + protected String id; + @SerializedName("account_id") + protected String accountId; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected List resources; + protected PolicyAssignmentV1Subject subject; + protected AssignmentTemplateDetails template; + protected String status; + @SerializedName("template_id") + protected String templateId; + @SerializedName("template_version") + protected String templateVersion; + @SerializedName("assignment_id") + protected String assignmentId; + @SerializedName("target_type") + protected String targetType; + + protected PolicyTemplateAssignmentItems() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the id. + * + * Policy assignment ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the accountId. + * + * The account GUID that the policies assignments belong to. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the href. + * + * The href URL that links to the policies assignments API by policy assignment ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy assignment was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy assignment. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy assignment was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy assignment. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the resources. + * + * Object for each account assigned. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the subject. + * + * Subject details of access type assignment. + * + * @return the subject + */ + public PolicyAssignmentV1Subject getSubject() { + return subject; + } + + /** + * Gets the template. + * + * policy template details. + * + * @return the template + */ + public AssignmentTemplateDetails getTemplate() { + return template; + } + + /** + * Gets the status. + * + * The policy assignment status. + * + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * Gets the templateId. + * + * policy template ID. + * + * @return the templateId + */ + public String getTemplateId() { + return templateId; + } + + /** + * Gets the templateVersion. + * + * policy template version. + * + * @return the templateVersion + */ + public String getTemplateVersion() { + return templateVersion; + } + + /** + * Gets the assignmentId. + * + * Passed in value to correlate with other assignments. + * + * @return the assignmentId + */ + public String getAssignmentId() { + return assignmentId; + } + + /** + * Gets the targetType. + * + * Assignment target type. + * + * @return the targetType + */ + public String getTargetType() { + return targetType; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java new file mode 100644 index 00000000000..ec9c32e5bdd --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +/** + * The set of properties associated with the policy template assignment. + */ +public class PolicyTemplateAssignmentItemsPolicyAssignment extends PolicyTemplateAssignmentItems { + + /** + * Assignment target type. + */ + public interface TargetType { + /** Account. */ + String ACCOUNT = "Account"; + /** AccountGroup. */ + String ACCOUNTGROUP = "AccountGroup"; + /** Enterprise. */ + String ENTERPRISE = "Enterprise"; + } + + /** + * The policy assignment status. + */ + public interface Status { + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** succeeded. */ + String SUCCEEDED = "succeeded"; + /** succeed_with_errors. */ + String SUCCEED_WITH_ERRORS = "succeed_with_errors"; + /** failed. */ + String FAILED = "failed"; + } + + + protected PolicyTemplateAssignmentItemsPolicyAssignment() { } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java new file mode 100644 index 00000000000..4cebdbb17b1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.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_policy_management.v1.model; + +/** + * The set of properties associated with the policy template assignment. + */ +public class PolicyTemplateAssignmentItemsPolicyAssignmentV1 extends PolicyTemplateAssignmentItems { + + /** + * The policy assignment status. + */ + public interface Status { + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** succeeded. */ + String SUCCEEDED = "succeeded"; + /** succeed_with_errors. */ + String SUCCEED_WITH_ERRORS = "succeed_with_errors"; + /** failed. */ + String FAILED = "failed"; + } + + + protected PolicyTemplateAssignmentItemsPolicyAssignmentV1() { } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java new file mode 100644 index 00000000000..2a262c584b5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java @@ -0,0 +1,90 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of policy Templates. + */ +public class PolicyTemplateCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + @SerializedName("policy_templates") + protected List policyTemplates; + + protected PolicyTemplateCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the policyTemplates. + * + * List of policy templates. + * + * @return the policyTemplates + */ + public List getPolicyTemplates() { + return policyTemplates; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java new file mode 100644 index 00000000000..5a2876dfe28 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java @@ -0,0 +1,214 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the policy template. + */ +public class PolicyTemplateLimitData extends GenericModel { + + /** + * State of policy template. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String name; + protected String description; + @SerializedName("account_id") + protected String accountId; + protected String version; + protected Boolean committed; + protected TemplatePolicy policy; + protected String state; + protected String id; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected TemplateCountData counts; + + protected PolicyTemplateLimitData() { } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the version. + * + * Template version. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the committed. + * + * Committed status of the template version. + * + * @return the committed + */ + public Boolean isCommitted() { + return committed; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy getPolicy() { + return policy; + } + + /** + * Gets the state. + * + * State of policy template. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the id. + * + * The policy template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the policy templates API by policy template ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy template was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy template. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy template was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy template. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the counts. + * + * policy template count details. + * + * @return the counts + */ + public TemplateCountData getCounts() { + return counts; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java new file mode 100644 index 00000000000..07effc5b3ad --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java @@ -0,0 +1,201 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with a policy. + */ +public class PolicyTemplateMetaData extends GenericModel { + + /** + * The policy state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String id; + protected String type; + protected String description; + protected List subjects; + protected List roles; + protected List resources; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String state; + protected TemplateMetadata template; + + protected PolicyTemplateMetaData() { } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the description. + * + * Customer-defined description. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the subjects. + * + * The subjects associated with a policy. + * + * @return the subjects + */ + public List getSubjects() { + return subjects; + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List getRoles() { + return roles; + } + + /** + * Gets the resources. + * + * The resources associated with a policy. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the href. + * + * The href links back to the policy. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the state. + * + * The policy state. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the template. + * + * The details of the IAM template that was used to create an enterprise-managed policy in your account. When + * returned, this indicates that the policy is created from and managed by a template in the root enterprise account. + * + * @return the template + */ + public TemplateMetadata getTemplate() { + return template; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java new file mode 100644 index 00000000000..a4f95bc6562 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of versions for a specific policy template. + */ +public class PolicyTemplateVersionsCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List versions; + + protected PolicyTemplateVersionsCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the versions. + * + * List of policy templates versions. + * + * @return the versions + */ + public List getVersions() { + return versions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java new file mode 100644 index 00000000000..f6a2496cf91 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * PolicyTemplateVersionsPager can be used to simplify the use of the "listPolicyTemplateVersions" method. + */ +public class PolicyTemplateVersionsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListPolicyTemplateVersionsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected PolicyTemplateVersionsPager() { } + + /** + * Constructs a new PolicyTemplateVersionsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyTemplateVersions" method + * @param options the ListPolicyTemplateVersionsOptions instance to be used to invoke the "listPolicyTemplateVersions" method + */ + public PolicyTemplateVersionsPager(IamPolicyManagement client, ListPolicyTemplateVersionsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<PolicyTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListPolicyTemplateVersionsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + PolicyTemplateVersionsCollection result = client.listPolicyTemplateVersions(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getVersions(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<PolicyTemplate> containing all results returned by the "listPolicyTemplateVersions" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java new file mode 100644 index 00000000000..eba6e6c8fad --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * PolicyTemplatesPager can be used to simplify the use of the "listPolicyTemplates" method. + */ +public class PolicyTemplatesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListPolicyTemplatesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected PolicyTemplatesPager() { } + + /** + * Constructs a new PolicyTemplatesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyTemplates" method + * @param options the ListPolicyTemplatesOptions instance to be used to invoke the "listPolicyTemplates" method + */ + public PolicyTemplatesPager(IamPolicyManagement client, ListPolicyTemplatesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<PolicyTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListPolicyTemplatesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + PolicyTemplateCollection result = client.listPolicyTemplates(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getPolicyTemplates(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<PolicyTemplate> containing all results returned by the "listPolicyTemplates" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java new file mode 100644 index 00000000000..2656f3fb790 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Details with linking href to previous page of requested collection. + */ +public class Previous extends GenericModel { + + protected String href; + protected String start; + + protected Previous() { } + + /** + * Gets the href. + * + * The href linking to the page of requested collection. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection. + * + * @return the start + */ + public String getStart() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java new file mode 100644 index 00000000000..151a77e8cb9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java @@ -0,0 +1,273 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replaceActionControlTemplate options. + */ +public class ReplaceActionControlTemplateOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String version; + protected String ifMatch; + protected String name; + protected String description; + protected TemplateActionControl actionControl; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String version; + private String ifMatch; + private String name; + private String description; + private TemplateActionControl actionControl; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing ReplaceActionControlTemplateOptions instance. + * + * @param replaceActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(ReplaceActionControlTemplateOptions replaceActionControlTemplateOptions) { + this.actionControlTemplateId = replaceActionControlTemplateOptions.actionControlTemplateId; + this.version = replaceActionControlTemplateOptions.version; + this.ifMatch = replaceActionControlTemplateOptions.ifMatch; + this.name = replaceActionControlTemplateOptions.name; + this.description = replaceActionControlTemplateOptions.description; + this.actionControl = replaceActionControlTemplateOptions.actionControl; + this.committed = replaceActionControlTemplateOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + * @param version the version + * @param ifMatch the ifMatch + */ + public Builder(String actionControlTemplateId, String version, String ifMatch) { + this.actionControlTemplateId = actionControlTemplateId; + this.version = version; + this.ifMatch = ifMatch; + } + + /** + * Builds a ReplaceActionControlTemplateOptions. + * + * @return the new ReplaceActionControlTemplateOptions instance + */ + public ReplaceActionControlTemplateOptions build() { + return new ReplaceActionControlTemplateOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actionControl. + * + * @param actionControl the actionControl + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder actionControl(TemplateActionControl actionControl) { + this.actionControl = actionControl; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected ReplaceActionControlTemplateOptions() { } + + protected ReplaceActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + actionControlTemplateId = builder.actionControlTemplateId; + version = builder.version; + ifMatch = builder.ifMatch; + name = builder.name; + description = builder.description; + actionControl = builder.actionControl; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a ReplaceActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating an action control template version must match the Etag value of the existing + * action control template version. The Etag can be retrieved using the GET + * /v1/action_control_templates/{template_id}/versions/{version} API and looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will + * change the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the action control template. This is shown to users in the enterprise account. Use this to describe + * the purpose or context of the action control for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actionControl. + * + * The action control properties that are created in an action resource when the template is assigned. + * + * @return the actionControl + */ + public TemplateActionControl actionControl() { + return actionControl; + } + + /** + * Gets the committed. + * + * Committed status of the template version. If committed is set to true, then the template version can no longer be + * updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java new file mode 100644 index 00000000000..80cbe9e4c79 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java @@ -0,0 +1,335 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replacePolicy options. + */ +public class ReplacePolicyOptions extends GenericModel { + + protected String policyId; + protected String ifMatch; + protected String type; + protected List subjects; + protected List roles; + protected List resources; + protected String description; + + /** + * Builder. + */ + public static class Builder { + private String policyId; + private String ifMatch; + private String type; + private List subjects; + private List roles; + private List resources; + private String description; + + /** + * Instantiates a new Builder from an existing ReplacePolicyOptions instance. + * + * @param replacePolicyOptions the instance to initialize the Builder with + */ + private Builder(ReplacePolicyOptions replacePolicyOptions) { + this.policyId = replacePolicyOptions.policyId; + this.ifMatch = replacePolicyOptions.ifMatch; + this.type = replacePolicyOptions.type; + this.subjects = replacePolicyOptions.subjects; + this.roles = replacePolicyOptions.roles; + this.resources = replacePolicyOptions.resources; + this.description = replacePolicyOptions.description; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyId the policyId + * @param ifMatch the ifMatch + * @param type the type + * @param subjects the subjects + * @param roles the roles + * @param resources the resources + */ + public Builder(String policyId, String ifMatch, String type, List subjects, List roles, List resources) { + this.policyId = policyId; + this.ifMatch = ifMatch; + this.type = type; + this.subjects = subjects; + this.roles = roles; + this.resources = resources; + } + + /** + * Builds a ReplacePolicyOptions. + * + * @return the new ReplacePolicyOptions instance + */ + public ReplacePolicyOptions build() { + return new ReplacePolicyOptions(this); + } + + /** + * Adds a new element to subjects. + * + * @param subjects the new element to be added + * @return the ReplacePolicyOptions builder + */ + public Builder addSubjects(PolicySubject subjects) { + com.ibm.cloud.sdk.core.util.Validator.notNull(subjects, + "subjects cannot be null"); + if (this.subjects == null) { + this.subjects = new ArrayList(); + } + this.subjects.add(subjects); + return this; + } + + /** + * Adds a new element to roles. + * + * @param roles the new element to be added + * @return the ReplacePolicyOptions builder + */ + public Builder addRoles(PolicyRole roles) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roles, + "roles cannot be null"); + if (this.roles == null) { + this.roles = new ArrayList(); + } + this.roles.add(roles); + return this; + } + + /** + * Adds a new element to resources. + * + * @param resources the new element to be added + * @return the ReplacePolicyOptions builder + */ + public Builder addResources(PolicyResource resources) { + com.ibm.cloud.sdk.core.util.Validator.notNull(resources, + "resources cannot be null"); + if (this.resources == null) { + this.resources = new ArrayList(); + } + this.resources.add(resources); + return this; + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the ReplacePolicyOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplacePolicyOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the ReplacePolicyOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the subjects. + * Existing subjects will be replaced. + * + * @param subjects the subjects + * @return the ReplacePolicyOptions builder + */ + public Builder subjects(List subjects) { + this.subjects = subjects; + return this; + } + + /** + * Set the roles. + * Existing roles will be replaced. + * + * @param roles the roles + * @return the ReplacePolicyOptions builder + */ + public Builder roles(List roles) { + this.roles = roles; + return this; + } + + /** + * Set the resources. + * Existing resources will be replaced. + * + * @param resources the resources + * @return the ReplacePolicyOptions builder + */ + public Builder resources(List resources) { + this.resources = resources; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplacePolicyOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + } + + protected ReplacePolicyOptions() { } + + protected ReplacePolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId 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.type, + "type cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subjects, + "subjects cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, + "roles cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resources, + "resources cannot be null"); + policyId = builder.policyId; + ifMatch = builder.ifMatch; + type = builder.type; + subjects = builder.subjects; + roles = builder.roles; + resources = builder.resources; + description = builder.description; + } + + /** + * New builder. + * + * @return a ReplacePolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyId. + * + * The policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be + * retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the subjects. + * + * The subjects associated with a policy. + * + * @return the subjects + */ + public List subjects() { + return subjects; + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List roles() { + return roles; + } + + /** + * Gets the resources. + * + * The resources associated with a policy. + * + * @return the resources + */ + public List resources() { + return resources; + } + + /** + * Gets the description. + * + * Customer-defined description. + * + * @return the description + */ + public String description() { + return description; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java new file mode 100644 index 00000000000..5a55c4898e5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java @@ -0,0 +1,276 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replacePolicyTemplate options. + */ +public class ReplacePolicyTemplateOptions extends GenericModel { + + protected String policyTemplateId; + protected String version; + protected String ifMatch; + protected TemplatePolicy policy; + protected String name; + protected String description; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String version; + private String ifMatch; + private TemplatePolicy policy; + private String name; + private String description; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing ReplacePolicyTemplateOptions instance. + * + * @param replacePolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(ReplacePolicyTemplateOptions replacePolicyTemplateOptions) { + this.policyTemplateId = replacePolicyTemplateOptions.policyTemplateId; + this.version = replacePolicyTemplateOptions.version; + this.ifMatch = replacePolicyTemplateOptions.ifMatch; + this.policy = replacePolicyTemplateOptions.policy; + this.name = replacePolicyTemplateOptions.name; + this.description = replacePolicyTemplateOptions.description; + this.committed = replacePolicyTemplateOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param version the version + * @param ifMatch the ifMatch + * @param policy the policy + */ + public Builder(String policyTemplateId, String version, String ifMatch, TemplatePolicy policy) { + this.policyTemplateId = policyTemplateId; + this.version = version; + this.ifMatch = ifMatch; + this.policy = policy; + } + + /** + * Builds a ReplacePolicyTemplateOptions. + * + * @return the new ReplacePolicyTemplateOptions instance + */ + public ReplacePolicyTemplateOptions build() { + return new ReplacePolicyTemplateOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the policy. + * + * @param policy the policy + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder policy(TemplatePolicy policy) { + this.policy = policy; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected ReplacePolicyTemplateOptions() { } + + protected ReplacePolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version 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.policy, + "policy cannot be null"); + policyTemplateId = builder.policyTemplateId; + version = builder.version; + ifMatch = builder.ifMatch; + policy = builder.policy; + name = builder.name; + description = builder.description; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a ReplacePolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the version. + * + * The policy template version. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy template version and must match the Etag value of the existing policy + * template version. The Etag can be retrieved using the GET + * /v1/policy_templates/{policy_template_id}/versions/{version} API and looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy policy() { + return policy; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template version. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java new file mode 100644 index 00000000000..fc4b536103d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java @@ -0,0 +1,255 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replaceRole options. + */ +public class ReplaceRoleOptions extends GenericModel { + + protected String roleId; + protected String ifMatch; + protected String displayName; + protected List actions; + protected String description; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + private String ifMatch; + private String displayName; + private List actions; + private String description; + + /** + * Instantiates a new Builder from an existing ReplaceRoleOptions instance. + * + * @param replaceRoleOptions the instance to initialize the Builder with + */ + private Builder(ReplaceRoleOptions replaceRoleOptions) { + this.roleId = replaceRoleOptions.roleId; + this.ifMatch = replaceRoleOptions.ifMatch; + this.displayName = replaceRoleOptions.displayName; + this.actions = replaceRoleOptions.actions; + this.description = replaceRoleOptions.description; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + * @param ifMatch the ifMatch + * @param displayName the displayName + * @param actions the actions + */ + public Builder(String roleId, String ifMatch, String displayName, List actions) { + this.roleId = roleId; + this.ifMatch = ifMatch; + this.displayName = displayName; + this.actions = actions; + } + + /** + * Builds a ReplaceRoleOptions. + * + * @return the new ReplaceRoleOptions instance + */ + public ReplaceRoleOptions build() { + return new ReplaceRoleOptions(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the ReplaceRoleOptions builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the ReplaceRoleOptions builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplaceRoleOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the ReplaceRoleOptions builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the ReplaceRoleOptions builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplaceRoleOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the role. + * + * @param role the role + * @return the ReplaceRoleOptions builder + */ + public Builder role(Role role) { + this.displayName = role.displayName(); + this.actions = role.actions(); + this.description = role.description(); + return this; + } + } + + protected ReplaceRoleOptions() { } + + protected ReplaceRoleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, + "roleId 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.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + roleId = builder.roleId; + ifMatch = builder.ifMatch; + displayName = builder.displayName; + actions = builder.actions; + description = builder.description; + } + + /** + * New builder. + * + * @return a ReplaceRoleOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role ID. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a role and must match the ETag value of the existing role. The Etag can be + * retrieved using the GET /v2/roles/{role_id} API and looking at the ETag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List actions() { + return actions; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String description() { + return description; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java new file mode 100644 index 00000000000..9a69b13326c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java @@ -0,0 +1,273 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replaceRoleTemplate options. + */ +public class ReplaceRoleTemplateOptions extends GenericModel { + + protected String roleTemplateId; + protected String version; + protected String ifMatch; + protected String name; + protected String description; + protected TemplateRole role; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String version; + private String ifMatch; + private String name; + private String description; + private TemplateRole role; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing ReplaceRoleTemplateOptions instance. + * + * @param replaceRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(ReplaceRoleTemplateOptions replaceRoleTemplateOptions) { + this.roleTemplateId = replaceRoleTemplateOptions.roleTemplateId; + this.version = replaceRoleTemplateOptions.version; + this.ifMatch = replaceRoleTemplateOptions.ifMatch; + this.name = replaceRoleTemplateOptions.name; + this.description = replaceRoleTemplateOptions.description; + this.role = replaceRoleTemplateOptions.role; + this.committed = replaceRoleTemplateOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + * @param version the version + * @param ifMatch the ifMatch + */ + public Builder(String roleTemplateId, String version, String ifMatch) { + this.roleTemplateId = roleTemplateId; + this.version = version; + this.ifMatch = ifMatch; + } + + /** + * Builds a ReplaceRoleTemplateOptions. + * + * @return the new ReplaceRoleTemplateOptions instance + */ + public ReplaceRoleTemplateOptions build() { + return new ReplaceRoleTemplateOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the role. + * + * @param role the role + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder role(TemplateRole role) { + this.role = role; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected ReplaceRoleTemplateOptions() { } + + protected ReplaceRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + roleTemplateId = builder.roleTemplateId; + version = builder.version; + ifMatch = builder.ifMatch; + name = builder.name; + description = builder.description; + role = builder.role; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a ReplaceRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the version. + * + * Role template version. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a role template version must match the Etag value of the existing role template + * version. The Etag can be retrieved using the GET /v1/role_templates/{template_id}/versions/{version} API and + * looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will + * change the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the role template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the role for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the role. + * + * The role properties that are created in an action resource when the template is assigned. + * + * @return the role + */ + public TemplateRole role() { + return role; + } + + /** + * Gets the committed. + * + * Committed status of the template version. If committed is set to true, then the template version can no longer be + * updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java new file mode 100644 index 00000000000..960f4782635 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java @@ -0,0 +1,336 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replaceV2Policy options. + */ +public class ReplaceV2PolicyOptions extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + protected String id; + protected String ifMatch; + protected Control control; + protected String type; + protected String description; + protected V2PolicySubject subject; + protected V2PolicyResource resource; + protected String pattern; + protected V2PolicyRule rule; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String ifMatch; + private Control control; + private String type; + private String description; + private V2PolicySubject subject; + private V2PolicyResource resource; + private String pattern; + private V2PolicyRule rule; + + /** + * Instantiates a new Builder from an existing ReplaceV2PolicyOptions instance. + * + * @param replaceV2PolicyOptions the instance to initialize the Builder with + */ + private Builder(ReplaceV2PolicyOptions replaceV2PolicyOptions) { + this.id = replaceV2PolicyOptions.id; + this.ifMatch = replaceV2PolicyOptions.ifMatch; + this.control = replaceV2PolicyOptions.control; + this.type = replaceV2PolicyOptions.type; + this.description = replaceV2PolicyOptions.description; + this.subject = replaceV2PolicyOptions.subject; + this.resource = replaceV2PolicyOptions.resource; + this.pattern = replaceV2PolicyOptions.pattern; + this.rule = replaceV2PolicyOptions.rule; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + * @param ifMatch the ifMatch + * @param control the control + * @param type the type + */ + public Builder(String id, String ifMatch, Control control, String type) { + this.id = id; + this.ifMatch = ifMatch; + this.control = control; + this.type = type; + } + + /** + * Builds a ReplaceV2PolicyOptions. + * + * @return the new ReplaceV2PolicyOptions instance + */ + public ReplaceV2PolicyOptions build() { + return new ReplaceV2PolicyOptions(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the ReplaceV2PolicyOptions builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplaceV2PolicyOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the control. + * + * @param control the control + * @return the ReplaceV2PolicyOptions builder + */ + public Builder control(Control control) { + this.control = control; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the ReplaceV2PolicyOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplaceV2PolicyOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the subject. + * + * @param subject the subject + * @return the ReplaceV2PolicyOptions builder + */ + public Builder subject(V2PolicySubject subject) { + this.subject = subject; + return this; + } + + /** + * Set the resource. + * + * @param resource the resource + * @return the ReplaceV2PolicyOptions builder + */ + public Builder resource(V2PolicyResource resource) { + this.resource = resource; + return this; + } + + /** + * Set the pattern. + * + * @param pattern the pattern + * @return the ReplaceV2PolicyOptions builder + */ + public Builder pattern(String pattern) { + this.pattern = pattern; + return this; + } + + /** + * Set the rule. + * + * @param rule the rule + * @return the ReplaceV2PolicyOptions builder + */ + public Builder rule(V2PolicyRule rule) { + this.rule = rule; + return this; + } + } + + protected ReplaceV2PolicyOptions() { } + + protected ReplaceV2PolicyOptions(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.control, + "control cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + id = builder.id; + ifMatch = builder.ifMatch; + control = builder.control; + type = builder.type; + description = builder.description; + subject = builder.subject; + resource = builder.resource; + pattern = builder.pattern; + rule = builder.rule; + } + + /** + * New builder. + * + * @return a ReplaceV2PolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be + * retrieved using the GET /v2/policies/{id} API and looking at the ETag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the control. + * + * Specifies the type of access that is granted by the policy. + * + * @return the control + */ + public Control control() { + return control; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject subject() { + return subject; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource resource() { + return resource; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String pattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule rule() { + return rule; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java new file mode 100644 index 00000000000..3a8b7e87b9e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * An attribute associated with a resource. + */ +public class ResourceAttribute extends GenericModel { + + protected String name; + protected String value; + protected String operator; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String value; + private String operator; + + /** + * Instantiates a new Builder from an existing ResourceAttribute instance. + * + * @param resourceAttribute the instance to initialize the Builder with + */ + private Builder(ResourceAttribute resourceAttribute) { + this.name = resourceAttribute.name; + this.value = resourceAttribute.value; + this.operator = resourceAttribute.operator; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param value the value + */ + public Builder(String name, String value) { + this.name = name; + this.value = value; + } + + /** + * Builds a ResourceAttribute. + * + * @return the new ResourceAttribute instance + */ + public ResourceAttribute build() { + return new ResourceAttribute(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the ResourceAttribute builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the ResourceAttribute builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the ResourceAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + } + + protected ResourceAttribute() { } + + protected ResourceAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + name = builder.name; + value = builder.value; + operator = builder.operator; + } + + /** + * New builder. + * + * @return a ResourceAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The name of an attribute. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the value. + * + * The value of an attribute. + * + * @return the value + */ + public String value() { + return value; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java new file mode 100644 index 00000000000..7da4cffee56 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A tag associated with a resource. + */ +public class ResourceTag extends GenericModel { + + protected String name; + protected String value; + protected String operator; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String value; + private String operator; + + /** + * Instantiates a new Builder from an existing ResourceTag instance. + * + * @param resourceTag the instance to initialize the Builder with + */ + private Builder(ResourceTag resourceTag) { + this.name = resourceTag.name; + this.value = resourceTag.value; + this.operator = resourceTag.operator; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param value the value + */ + public Builder(String name, String value) { + this.name = name; + this.value = value; + } + + /** + * Builds a ResourceTag. + * + * @return the new ResourceTag instance + */ + public ResourceTag build() { + return new ResourceTag(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the ResourceTag builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the ResourceTag builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the ResourceTag builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + } + + protected ResourceTag() { } + + protected ResourceTag(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + name = builder.name; + value = builder.value; + operator = builder.operator; + } + + /** + * New builder. + * + * @return a ResourceTag builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The name of an access management tag. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the value. + * + * The value of an access management tag. + * + * @return the value + */ + public String value() { + return value; + } + + /** + * Gets the operator. + * + * The operator of an access management tag. + * + * @return the operator + */ + public String operator() { + return operator; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java new file mode 100644 index 00000000000..24b99c9bd08 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java @@ -0,0 +1,196 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role resource. + */ +public class Role extends GenericModel { + + @SerializedName("display_name") + protected String displayName; + protected String description; + protected List actions; + protected String crn; + + /** + * Builder. + */ + public static class Builder { + private String displayName; + private String description; + private List actions; + + /** + * Instantiates a new Builder from an existing Role instance. + * + * @param role the instance to initialize the Builder with + */ + private Builder(Role role) { + this.displayName = role.displayName; + this.description = role.description; + this.actions = role.actions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param displayName the displayName + * @param actions the actions + */ + public Builder(String displayName, List actions) { + this.displayName = displayName; + this.actions = actions; + } + + /** + * Builds a Role. + * + * @return the new Role instance + */ + public Role build() { + return new Role(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the Role builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the Role builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the Role builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the Role builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + } + + protected Role() { } + + protected Role(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + displayName = builder.displayName; + description = builder.description; + actions = builder.actions; + } + + /** + * New builder. + * + * @return a Role builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List actions() { + return actions; + } + + /** + * Gets the crn. + * + * The role Cloud Resource Name (CRN). Example CRN: + * 'crn:v1:ibmcloud:public:iam-access-management::a/exampleAccountId::customRole:ExampleRoleName'. + * + * @return the crn + */ + public String crn() { + return crn; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java new file mode 100644 index 00000000000..9169fc88572 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java @@ -0,0 +1,64 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * An action that can be performed by the policy subject when assigned a role. + */ +public class RoleAction extends GenericModel { + + protected String id; + @SerializedName("display_name") + protected String displayName; + protected String description; + + protected RoleAction() { } + + /** + * Gets the id. + * + * Unique identifier for action with structure service.resource.action. For example, cbr.rule.read. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the displayName. + * + * Services defined display name for action. + * + * @return the displayName + */ + public String getDisplayName() { + return displayName; + } + + /** + * Gets the description. + * + * Service defined description for action. + * + * @return the description + */ + public String getDescription() { + return description; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java new file mode 100644 index 00000000000..23bb4b65c6f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java @@ -0,0 +1,207 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the assigned role template. + */ +public class RoleAssignment extends GenericModel { + + /** + * The current operation of the role assignment. + */ + public interface Operation { + /** create. */ + String CREATE = "create"; + /** apply. */ + String APPLY = "apply"; + /** update. */ + String UPDATE = "update"; + /** remove. */ + String REMOVE = "remove"; + } + + /** + * The role assignment status. + */ + public interface Status { + /** accepted. */ + String ACCEPTED = "accepted"; + /** failure. */ + String FAILURE = "failure"; + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** superseded. */ + String SUPERSEDED = "superseded"; + } + + protected String id; + @SerializedName("account_id") + protected String accountId; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String operation; + protected List resources; + protected RoleAssignmentTemplate template; + protected AssignmentTargetDetails target; + protected String status; + + protected RoleAssignment() { } + + /** + * Gets the id. + * + * Action control assignment ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the accountId. + * + * The account GUID that the role assignments belong to. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the href. + * + * The href URL that links to the role assignments API by role assignment ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the role assignment was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the role assignment. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the role assignment was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the role assignment. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the operation. + * + * The current operation of the role assignment. + * + * @return the operation + */ + public String getOperation() { + return operation; + } + + /** + * Gets the resources. + * + * Resources created when role template is assigned. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the template. + * + * The role template id and version that will be assigned. + * + * @return the template + */ + public RoleAssignmentTemplate getTemplate() { + return template; + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the status. + * + * The role assignment status. + * + * @return the status + */ + public String getStatus() { + return status; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java new file mode 100644 index 00000000000..658ac5b8c99 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of role assignments. + */ +public class RoleAssignmentCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List assignments; + + protected RoleAssignmentCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the assignments. + * + * List of role assignments. + * + * @return the assignments + */ + public List getAssignments() { + return assignments; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java new file mode 100644 index 00000000000..60d7a02d604 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The role assignment resources and target where the template is assigned. + */ +public class RoleAssignmentResource extends GenericModel { + + protected AssignmentTargetDetails target; + protected RoleAssignmentResourceRole role; + + protected RoleAssignmentResource() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the role. + * + * Set of properties of the assigned resource or error message if assignment failed. + * + * @return the role + */ + public RoleAssignmentResourceRole getRole() { + return role; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java new file mode 100644 index 00000000000..9ea359d63fb --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * On success, it includes the role assigned. + */ +public class RoleAssignmentResourceCreated extends GenericModel { + + protected String id; + + protected RoleAssignmentResourceCreated() { } + + /** + * Gets the id. + * + * role id. + * + * @return the id + */ + public String getId() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java new file mode 100644 index 00000000000..22d40bdaef4 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Set of properties of the assigned resource or error message if assignment failed. + */ +public class RoleAssignmentResourceRole extends GenericModel { + + @SerializedName("resource_created") + protected RoleAssignmentResourceCreated resourceCreated; + @SerializedName("error_message") + protected AssignmentResourceError errorMessage; + + protected RoleAssignmentResourceRole() { } + + /** + * Gets the resourceCreated. + * + * On success, it includes the role assigned. + * + * @return the resourceCreated + */ + public RoleAssignmentResourceCreated getResourceCreated() { + return resourceCreated; + } + + /** + * Gets the errorMessage. + * + * Body parameters for assignment error. + * + * @return the errorMessage + */ + public AssignmentResourceError getErrorMessage() { + return errorMessage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java new file mode 100644 index 00000000000..3524b91f4d5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The role template id and version that will be assigned. + */ +public class RoleAssignmentTemplate extends GenericModel { + + protected String id; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String version; + + /** + * Instantiates a new Builder from an existing RoleAssignmentTemplate instance. + * + * @param roleAssignmentTemplate the instance to initialize the Builder with + */ + private Builder(RoleAssignmentTemplate roleAssignmentTemplate) { + this.id = roleAssignmentTemplate.id; + this.version = roleAssignmentTemplate.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + * @param version the version + */ + public Builder(String id, String version) { + this.id = id; + this.version = version; + } + + /** + * Builds a RoleAssignmentTemplate. + * + * @return the new RoleAssignmentTemplate instance + */ + public RoleAssignmentTemplate build() { + return new RoleAssignmentTemplate(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the RoleAssignmentTemplate builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the RoleAssignmentTemplate builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected RoleAssignmentTemplate() { } + + protected RoleAssignmentTemplate(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, + "id cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + id = builder.id; + version = builder.version; + } + + /** + * New builder. + * + * @return a RoleAssignmentTemplate builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * Action control template ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java new file mode 100644 index 00000000000..16296a82e40 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * RoleAssignmentsPager can be used to simplify the use of the "listRoleAssignments" method. + */ +public class RoleAssignmentsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListRoleAssignmentsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected RoleAssignmentsPager() { } + + /** + * Constructs a new RoleAssignmentsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listRoleAssignments" method + * @param options the ListRoleAssignmentsOptions instance to be used to invoke the "listRoleAssignments" method + */ + public RoleAssignmentsPager(IamPolicyManagement client, ListRoleAssignmentsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<RoleAssignment> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListRoleAssignmentsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + RoleAssignmentCollection result = client.listRoleAssignments(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getAssignments(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<RoleAssignment> containing all results returned by the "listRoleAssignments" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java new file mode 100644 index 00000000000..282730a2dfc --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java @@ -0,0 +1,68 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of roles returned by the 'list roles' operation. + */ +public class RoleCollection extends GenericModel { + + @SerializedName("custom_roles") + protected List customRoles; + @SerializedName("service_roles") + protected List serviceRoles; + @SerializedName("system_roles") + protected List systemRoles; + + protected RoleCollection() { } + + /** + * Gets the customRoles. + * + * List of custom roles. + * + * @return the customRoles + */ + public List getCustomRoles() { + return customRoles; + } + + /** + * Gets the serviceRoles. + * + * List of service roles. + * + * @return the serviceRoles + */ + public List getServiceRoles() { + return serviceRoles; + } + + /** + * Gets the systemRoles. + * + * List of system roles. + * + * @return the systemRoles + */ + public List getSystemRoles() { + return systemRoles; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java new file mode 100644 index 00000000000..663d0f7f1d0 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java @@ -0,0 +1,202 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the role template. + */ +public class RoleTemplate extends GenericModel { + + /** + * State of role template. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String name; + protected String description; + @SerializedName("account_id") + protected String accountId; + protected Boolean committed; + protected RoleTemplatePrototypeRole role; + protected String id; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String version; + protected String state; + + protected RoleTemplate() { } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Description of the role template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the role for enterprise users managing IAM templates. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the committed. + * + * Committed status of the template. If committed is set to true, then the template version can no longer be updated. + * + * @return the committed + */ + public Boolean isCommitted() { + return committed; + } + + /** + * Gets the role. + * + * The role properties that are created in an action resource when the template is assigned. + * + * @return the role + */ + public RoleTemplatePrototypeRole getRole() { + return role; + } + + /** + * Gets the id. + * + * The role template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the role templates API by role template ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the role template was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the role template. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the role template was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the role template. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the version. + * + * The version number of the template used to identify different versions of same template. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the state. + * + * State of role template. + * + * @return the state + */ + public String getState() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java new file mode 100644 index 00000000000..22a739b4a58 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java @@ -0,0 +1,90 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of role templates. + */ +public class RoleTemplateCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + @SerializedName("role_templates") + protected List roleTemplates; + + protected RoleTemplateCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the roleTemplates. + * + * List of role templates. + * + * @return the roleTemplates + */ + public List getRoleTemplates() { + return roleTemplates; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java new file mode 100644 index 00000000000..43197620689 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java @@ -0,0 +1,239 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The role properties that are created in an action resource when the template is assigned. + */ +public class RoleTemplatePrototypeRole extends GenericModel { + + protected String name; + @SerializedName("display_name") + protected String displayName; + @SerializedName("service_name") + protected String serviceName; + protected String description; + protected List actions; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String displayName; + private String serviceName; + private String description; + private List actions; + + /** + * Instantiates a new Builder from an existing RoleTemplatePrototypeRole instance. + * + * @param roleTemplatePrototypeRole the instance to initialize the Builder with + */ + private Builder(RoleTemplatePrototypeRole roleTemplatePrototypeRole) { + this.name = roleTemplatePrototypeRole.name; + this.displayName = roleTemplatePrototypeRole.displayName; + this.serviceName = roleTemplatePrototypeRole.serviceName; + this.description = roleTemplatePrototypeRole.description; + this.actions = roleTemplatePrototypeRole.actions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param displayName the displayName + * @param actions the actions + */ + public Builder(String name, String displayName, List actions) { + this.name = name; + this.displayName = displayName; + this.actions = actions; + } + + /** + * Builds a RoleTemplatePrototypeRole. + * + * @return the new RoleTemplatePrototypeRole instance + */ + public RoleTemplatePrototypeRole build() { + return new RoleTemplatePrototypeRole(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the RoleTemplatePrototypeRole builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the RoleTemplatePrototypeRole builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the RoleTemplatePrototypeRole builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the RoleTemplatePrototypeRole builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the RoleTemplatePrototypeRole builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the RoleTemplatePrototypeRole builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + } + + protected RoleTemplatePrototypeRole() { } + + protected RoleTemplatePrototypeRole(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + name = builder.name; + displayName = builder.displayName; + serviceName = builder.serviceName; + description = builder.description; + actions = builder.actions; + } + + /** + * New builder. + * + * @return a RoleTemplatePrototypeRole builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the serviceName. + * + * The service name that the role refers. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the description. + * + * Description of the role. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. + * + * @return the actions + */ + public List actions() { + return actions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java new file mode 100644 index 00000000000..673ff7f9750 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role template reference associated with a policy template. + */ +public class RoleTemplateReferencesItem extends GenericModel { + + protected String id; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String version; + + /** + * Instantiates a new Builder from an existing RoleTemplateReferencesItem instance. + * + * @param roleTemplateReferencesItem the instance to initialize the Builder with + */ + private Builder(RoleTemplateReferencesItem roleTemplateReferencesItem) { + this.id = roleTemplateReferencesItem.id; + this.version = roleTemplateReferencesItem.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + * @param version the version + */ + public Builder(String id, String version) { + this.id = id; + this.version = version; + } + + /** + * Builds a RoleTemplateReferencesItem. + * + * @return the new RoleTemplateReferencesItem instance + */ + public RoleTemplateReferencesItem build() { + return new RoleTemplateReferencesItem(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the RoleTemplateReferencesItem builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the RoleTemplateReferencesItem builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected RoleTemplateReferencesItem() { } + + protected RoleTemplateReferencesItem(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, + "id cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + id = builder.id; + version = builder.version; + } + + /** + * New builder. + * + * @return a RoleTemplateReferencesItem builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The role template ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the version. + * + * Role template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java new file mode 100644 index 00000000000..a983208afe3 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of versions for a specific role template. + */ +public class RoleTemplateVersionsCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List versions; + + protected RoleTemplateVersionsCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the versions. + * + * List of role templates versions. + * + * @return the versions + */ + public List getVersions() { + return versions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java new file mode 100644 index 00000000000..7af200cd72f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * RoleTemplateVersionsPager can be used to simplify the use of the "listRoleTemplateVersions" method. + */ +public class RoleTemplateVersionsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListRoleTemplateVersionsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected RoleTemplateVersionsPager() { } + + /** + * Constructs a new RoleTemplateVersionsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listRoleTemplateVersions" method + * @param options the ListRoleTemplateVersionsOptions instance to be used to invoke the "listRoleTemplateVersions" method + */ + public RoleTemplateVersionsPager(IamPolicyManagement client, ListRoleTemplateVersionsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<RoleTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListRoleTemplateVersionsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + RoleTemplateVersionsCollection result = client.listRoleTemplateVersions(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getVersions(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<RoleTemplate> containing all results returned by the "listRoleTemplateVersions" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java new file mode 100644 index 00000000000..3654e0757ba --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * RoleTemplatesPager can be used to simplify the use of the "listRoleTemplates" method. + */ +public class RoleTemplatesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListRoleTemplatesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected RoleTemplatesPager() { } + + /** + * Constructs a new RoleTemplatesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listRoleTemplates" method + * @param options the ListRoleTemplatesOptions instance to be used to invoke the "listRoleTemplates" method + */ + public RoleTemplatesPager(IamPolicyManagement client, ListRoleTemplatesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<RoleTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListRoleTemplatesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + RoleTemplateCollection result = client.listRoleTemplates(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getRoleTemplates(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<RoleTemplate> containing all results returned by the "listRoleTemplates" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java new file mode 100644 index 00000000000..03b6ff75eb1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java @@ -0,0 +1,106 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role associated with a policy. + */ +public class Roles extends GenericModel { + + @SerializedName("role_id") + protected String roleId; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + + /** + * Instantiates a new Builder from an existing Roles instance. + * + * @param roles the instance to initialize the Builder with + */ + private Builder(Roles roles) { + this.roleId = roles.roleId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + */ + public Builder(String roleId) { + this.roleId = roleId; + } + + /** + * Builds a Roles. + * + * @return the new Roles instance + */ + public Roles build() { + return new Roles(this); + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the Roles builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + } + + protected Roles() { } + + protected Roles(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleId, + "roleId cannot be null"); + roleId = builder.roleId; + } + + /** + * New builder. + * + * @return a Roles builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java new file mode 100644 index 00000000000..fbf66d53ae1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java @@ -0,0 +1,209 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Rule that specifies additional access that is granted (For example, time-based condition). + */ +public class RuleAttribute extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + protected String key; + protected String operator; + protected Object value; + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing RuleAttribute instance. + * + * @param ruleAttribute the instance to initialize the Builder with + */ + private Builder(RuleAttribute ruleAttribute) { + this.key = ruleAttribute.key; + this.operator = ruleAttribute.operator; + this.value = ruleAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a RuleAttribute. + * + * @return the new RuleAttribute instance + */ + public RuleAttribute build() { + return new RuleAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the RuleAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the RuleAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the RuleAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected RuleAttribute() { } + + protected RuleAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a RuleAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the key. + * + * The name of an attribute. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java new file mode 100644 index 00000000000..d7e54e112c5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * An attribute associated with a subject. + */ +public class SubjectAttribute extends GenericModel { + + protected String name; + protected String value; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String value; + + /** + * Instantiates a new Builder from an existing SubjectAttribute instance. + * + * @param subjectAttribute the instance to initialize the Builder with + */ + private Builder(SubjectAttribute subjectAttribute) { + this.name = subjectAttribute.name; + this.value = subjectAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param value the value + */ + public Builder(String name, String value) { + this.name = name; + this.value = value; + } + + /** + * Builds a SubjectAttribute. + * + * @return the new SubjectAttribute instance + */ + public SubjectAttribute build() { + return new SubjectAttribute(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the SubjectAttribute builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the SubjectAttribute builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + } + + protected SubjectAttribute() { } + + protected SubjectAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + name = builder.name; + value = builder.value; + } + + /** + * New builder. + * + * @return a SubjectAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The name of an attribute. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the value. + * + * The value of an attribute. + * + * @return the value + */ + public String value() { + return value; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java new file mode 100644 index 00000000000..62f4bd77f87 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java @@ -0,0 +1,182 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The action control properties that are created in an action resource when the template is assigned. + */ +public class TemplateActionControl extends GenericModel { + + @SerializedName("service_name") + protected String serviceName; + protected String description; + protected List actions; + + /** + * Builder. + */ + public static class Builder { + private String serviceName; + private String description; + private List actions; + + /** + * Instantiates a new Builder from an existing TemplateActionControl instance. + * + * @param templateActionControl the instance to initialize the Builder with + */ + private Builder(TemplateActionControl templateActionControl) { + this.serviceName = templateActionControl.serviceName; + this.description = templateActionControl.description; + this.actions = templateActionControl.actions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param serviceName the serviceName + * @param actions the actions + */ + public Builder(String serviceName, List actions) { + this.serviceName = serviceName; + this.actions = actions; + } + + /** + * Builds a TemplateActionControl. + * + * @return the new TemplateActionControl instance + */ + public TemplateActionControl build() { + return new TemplateActionControl(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the TemplateActionControl builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the TemplateActionControl builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the TemplateActionControl builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the TemplateActionControl builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + } + + protected TemplateActionControl() { } + + protected TemplateActionControl(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, + "serviceName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + serviceName = builder.serviceName; + description = builder.description; + actions = builder.actions; + } + + /** + * New builder. + * + * @return a TemplateActionControl builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the serviceName. + * + * The service name that the action control refers. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the description. + * + * Description of the action control. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actions. + * + * List of actions to control access. + * + * @return the actions + */ + public List actions() { + return actions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java new file mode 100644 index 00000000000..c74a77d9b6d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Specifies the type of access that is granted by the policy. + */ +public class TemplateControl extends GenericModel { + + protected TemplateGrant grant; + + /** + * Builder. + */ + public static class Builder { + private TemplateGrant grant; + + /** + * Instantiates a new Builder from an existing TemplateControl instance. + * + * @param templateControl the instance to initialize the Builder with + */ + private Builder(TemplateControl templateControl) { + this.grant = templateControl.grant; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param grant the grant + */ + public Builder(TemplateGrant grant) { + this.grant = grant; + } + + /** + * Builds a TemplateControl. + * + * @return the new TemplateControl instance + */ + public TemplateControl build() { + return new TemplateControl(this); + } + + /** + * Set the grant. + * + * @param grant the grant + * @return the TemplateControl builder + */ + public Builder grant(TemplateGrant grant) { + this.grant = grant; + return this; + } + } + + protected TemplateControl() { } + + protected TemplateControl(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.grant, + "grant cannot be null"); + grant = builder.grant; + } + + /** + * New builder. + * + * @return a TemplateControl builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the grant. + * + * Permission is granted by the policy. + * + * @return the grant + */ + public TemplateGrant grant() { + return grant; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java new file mode 100644 index 00000000000..edb134e1270 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * policy template count details. + */ +public class TemplateCountData extends GenericModel { + + protected LimitData template; + protected LimitData version; + + protected TemplateCountData() { } + + /** + * Gets the template. + * + * policy template current and limit details with in an account. + * + * @return the template + */ + public LimitData getTemplate() { + return template; + } + + /** + * Gets the version. + * + * policy template current and limit details with in an account. + * + * @return the version + */ + public LimitData getVersion() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java new file mode 100644 index 00000000000..fd0daff9665 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java @@ -0,0 +1,58 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Permission is granted by the policy. + * + * Classes which extend this class: + * - TemplateGrantRoles + * - TemplateGrantRoleReferences + */ +public class TemplateGrant extends GenericModel { + + protected List roles; + @SerializedName("role_template_references") + protected List roleTemplateReferences; + + protected TemplateGrant() { } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List roles() { + return roles; + } + + /** + * Gets the roleTemplateReferences. + * + * A set of role template reference IDs granted by the policy. + * + * @return the roleTemplateReferences + */ + public List roleTemplateReferences() { + return roleTemplateReferences; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java new file mode 100644 index 00000000000..248eb121b72 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java @@ -0,0 +1,110 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * TemplateGrantRoleReferences. + */ +public class TemplateGrantRoleReferences extends TemplateGrant { + + + /** + * Builder. + */ + public static class Builder { + private List roleTemplateReferences; + + /** + * Instantiates a new Builder from an existing TemplateGrantRoleReferences instance. + * + * @param templateGrantRoleReferences the instance to initialize the Builder with + */ + public Builder(TemplateGrant templateGrantRoleReferences) { + this.roleTemplateReferences = templateGrantRoleReferences.roleTemplateReferences; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateReferences the roleTemplateReferences + */ + public Builder(List roleTemplateReferences) { + this.roleTemplateReferences = roleTemplateReferences; + } + + /** + * Builds a TemplateGrantRoleReferences. + * + * @return the new TemplateGrantRoleReferences instance + */ + public TemplateGrantRoleReferences build() { + return new TemplateGrantRoleReferences(this); + } + + /** + * Adds a new element to roleTemplateReferences. + * + * @param roleTemplateReferences the new element to be added + * @return the TemplateGrantRoleReferences builder + */ + public Builder addRoleTemplateReferences(RoleTemplateReferencesItem roleTemplateReferences) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roleTemplateReferences, + "roleTemplateReferences cannot be null"); + if (this.roleTemplateReferences == null) { + this.roleTemplateReferences = new ArrayList(); + } + this.roleTemplateReferences.add(roleTemplateReferences); + return this; + } + + /** + * Set the roleTemplateReferences. + * Existing roleTemplateReferences will be replaced. + * + * @param roleTemplateReferences the roleTemplateReferences + * @return the TemplateGrantRoleReferences builder + */ + public Builder roleTemplateReferences(List roleTemplateReferences) { + this.roleTemplateReferences = roleTemplateReferences; + return this; + } + } + + protected TemplateGrantRoleReferences() { } + + protected TemplateGrantRoleReferences(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleTemplateReferences, + "roleTemplateReferences cannot be null"); + roleTemplateReferences = builder.roleTemplateReferences; + } + + /** + * New builder. + * + * @return a TemplateGrantRoleReferences builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java new file mode 100644 index 00000000000..6524b3645eb --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java @@ -0,0 +1,110 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * TemplateGrantRoles. + */ +public class TemplateGrantRoles extends TemplateGrant { + + + /** + * Builder. + */ + public static class Builder { + private List roles; + + /** + * Instantiates a new Builder from an existing TemplateGrantRoles instance. + * + * @param templateGrantRoles the instance to initialize the Builder with + */ + public Builder(TemplateGrant templateGrantRoles) { + this.roles = templateGrantRoles.roles; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roles the roles + */ + public Builder(List roles) { + this.roles = roles; + } + + /** + * Builds a TemplateGrantRoles. + * + * @return the new TemplateGrantRoles instance + */ + public TemplateGrantRoles build() { + return new TemplateGrantRoles(this); + } + + /** + * Adds a new element to roles. + * + * @param roles the new element to be added + * @return the TemplateGrantRoles builder + */ + public Builder addRoles(Roles roles) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roles, + "roles cannot be null"); + if (this.roles == null) { + this.roles = new ArrayList(); + } + this.roles.add(roles); + return this; + } + + /** + * Set the roles. + * Existing roles will be replaced. + * + * @param roles the roles + * @return the TemplateGrantRoles builder + */ + public Builder roles(List roles) { + this.roles = roles; + return this; + } + } + + protected TemplateGrantRoles() { } + + protected TemplateGrantRoles(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, + "roles cannot be null"); + roles = builder.roles; + } + + /** + * New builder. + * + * @return a TemplateGrantRoles builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java new file mode 100644 index 00000000000..41f112312cd --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java @@ -0,0 +1,91 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The details of the IAM template that was used to create an enterprise-managed policy in your account. When returned, + * this indicates that the policy is created from and managed by a template in the root enterprise account. + */ +public class TemplateMetadata extends GenericModel { + + protected String id; + protected String version; + @SerializedName("assignment_id") + protected String assignmentId; + @SerializedName("root_id") + protected String rootId; + @SerializedName("root_version") + protected String rootVersion; + + protected TemplateMetadata() { } + + /** + * Gets the id. + * + * The policy template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the version. + * + * Template version. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the assignmentId. + * + * Policy assignment ID. + * + * @return the assignmentId + */ + public String getAssignmentId() { + return assignmentId; + } + + /** + * Gets the rootId. + * + * Orchestrator template ID. + * + * @return the rootId + */ + public String getRootId() { + return rootId; + } + + /** + * Gets the rootVersion. + * + * Orchestrator template version. + * + * @return the rootVersion + */ + public String getRootVersion() { + return rootVersion; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java new file mode 100644 index 00000000000..496b2e70e40 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java @@ -0,0 +1,272 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the template's policy object. + */ +public class TemplatePolicy extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + protected String type; + protected String description; + protected V2PolicyResource resource; + protected V2PolicySubject subject; + protected String pattern; + protected V2PolicyRule rule; + protected TemplateControl control; + + /** + * Builder. + */ + public static class Builder { + private String type; + private String description; + private V2PolicyResource resource; + private V2PolicySubject subject; + private String pattern; + private V2PolicyRule rule; + private TemplateControl control; + + /** + * Instantiates a new Builder from an existing TemplatePolicy instance. + * + * @param templatePolicy the instance to initialize the Builder with + */ + private Builder(TemplatePolicy templatePolicy) { + this.type = templatePolicy.type; + this.description = templatePolicy.description; + this.resource = templatePolicy.resource; + this.subject = templatePolicy.subject; + this.pattern = templatePolicy.pattern; + this.rule = templatePolicy.rule; + this.control = templatePolicy.control; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param type the type + */ + public Builder(String type) { + this.type = type; + } + + /** + * Builds a TemplatePolicy. + * + * @return the new TemplatePolicy instance + */ + public TemplatePolicy build() { + return new TemplatePolicy(this); + } + + /** + * Set the type. + * + * @param type the type + * @return the TemplatePolicy builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the TemplatePolicy builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the resource. + * + * @param resource the resource + * @return the TemplatePolicy builder + */ + public Builder resource(V2PolicyResource resource) { + this.resource = resource; + return this; + } + + /** + * Set the subject. + * + * @param subject the subject + * @return the TemplatePolicy builder + */ + public Builder subject(V2PolicySubject subject) { + this.subject = subject; + return this; + } + + /** + * Set the pattern. + * + * @param pattern the pattern + * @return the TemplatePolicy builder + */ + public Builder pattern(String pattern) { + this.pattern = pattern; + return this; + } + + /** + * Set the rule. + * + * @param rule the rule + * @return the TemplatePolicy builder + */ + public Builder rule(V2PolicyRule rule) { + this.rule = rule; + return this; + } + + /** + * Set the control. + * + * @param control the control + * @return the TemplatePolicy builder + */ + public Builder control(TemplateControl control) { + this.control = control; + return this; + } + } + + protected TemplatePolicy() { } + + protected TemplatePolicy(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + type = builder.type; + description = builder.description; + resource = builder.resource; + subject = builder.subject; + pattern = builder.pattern; + rule = builder.rule; + control = builder.control; + } + + /** + * New builder. + * + * @return a TemplatePolicy builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. This is shown in child accounts when an access group or trusted profile template uses + * the policy template to assign access. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource resource() { + return resource; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject subject() { + return subject; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String pattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule rule() { + return rule; + } + + /** + * Gets the control. + * + * Specifies the type of access that is granted by the policy. + * + * @return the control + */ + public TemplateControl control() { + return control; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java new file mode 100644 index 00000000000..b76beb3bddb --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java @@ -0,0 +1,209 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The role properties that are created in an action resource when the template is assigned. + */ +public class TemplateRole extends GenericModel { + + @SerializedName("display_name") + protected String displayName; + @SerializedName("service_name") + protected String serviceName; + protected String description; + protected List actions; + + /** + * Builder. + */ + public static class Builder { + private String displayName; + private String serviceName; + private String description; + private List actions; + + /** + * Instantiates a new Builder from an existing TemplateRole instance. + * + * @param templateRole the instance to initialize the Builder with + */ + private Builder(TemplateRole templateRole) { + this.displayName = templateRole.displayName; + this.serviceName = templateRole.serviceName; + this.description = templateRole.description; + this.actions = templateRole.actions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param displayName the displayName + * @param actions the actions + */ + public Builder(String displayName, List actions) { + this.displayName = displayName; + this.actions = actions; + } + + /** + * Builds a TemplateRole. + * + * @return the new TemplateRole instance + */ + public TemplateRole build() { + return new TemplateRole(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the TemplateRole builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the TemplateRole builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the TemplateRole builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the TemplateRole builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the TemplateRole builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + } + + protected TemplateRole() { } + + protected TemplateRole(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + displayName = builder.displayName; + serviceName = builder.serviceName; + description = builder.description; + actions = builder.actions; + } + + /** + * New builder. + * + * @return a TemplateRole builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the serviceName. + * + * The service name that the role refers. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the description. + * + * Description of the role. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. + * + * @return the actions + */ + public List actions() { + return actions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java new file mode 100644 index 00000000000..caf2f737b55 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java @@ -0,0 +1,166 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updateActionControlAssignment options. + */ +public class UpdateActionControlAssignmentOptions extends GenericModel { + + protected String assignmentId; + protected String ifMatch; + protected String templateVersion; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + private String ifMatch; + private String templateVersion; + + /** + * Instantiates a new Builder from an existing UpdateActionControlAssignmentOptions instance. + * + * @param updateActionControlAssignmentOptions the instance to initialize the Builder with + */ + private Builder(UpdateActionControlAssignmentOptions updateActionControlAssignmentOptions) { + this.assignmentId = updateActionControlAssignmentOptions.assignmentId; + this.ifMatch = updateActionControlAssignmentOptions.ifMatch; + this.templateVersion = updateActionControlAssignmentOptions.templateVersion; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + * @param ifMatch the ifMatch + * @param templateVersion the templateVersion + */ + public Builder(String assignmentId, String ifMatch, String templateVersion) { + this.assignmentId = assignmentId; + this.ifMatch = ifMatch; + this.templateVersion = templateVersion; + } + + /** + * Builds a UpdateActionControlAssignmentOptions. + * + * @return the new UpdateActionControlAssignmentOptions instance + */ + public UpdateActionControlAssignmentOptions build() { + return new UpdateActionControlAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the UpdateActionControlAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdateActionControlAssignmentOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the UpdateActionControlAssignmentOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + } + + protected UpdateActionControlAssignmentOptions() { } + + protected UpdateActionControlAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId 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.templateVersion, + "templateVersion cannot be null"); + assignmentId = builder.assignmentId; + ifMatch = builder.ifMatch; + templateVersion = builder.templateVersion; + } + + /** + * New builder. + * + * @return a UpdateActionControlAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Action control template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating an action control assignment and must match the Etag value of the existing action + * control assignment. The Etag can be retrieved using the GET /v1/action_control_assignments/{assignment_id} API and + * looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the templateVersion. + * + * The version number of the template used to identify different versions of same template. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java new file mode 100644 index 00000000000..869eb357802 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java @@ -0,0 +1,196 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updatePolicyAssignment options. + */ +public class UpdatePolicyAssignmentOptions extends GenericModel { + + protected String assignmentId; + protected String version; + protected String ifMatch; + protected String templateVersion; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + private String version; + private String ifMatch; + private String templateVersion; + + /** + * Instantiates a new Builder from an existing UpdatePolicyAssignmentOptions instance. + * + * @param updatePolicyAssignmentOptions the instance to initialize the Builder with + */ + private Builder(UpdatePolicyAssignmentOptions updatePolicyAssignmentOptions) { + this.assignmentId = updatePolicyAssignmentOptions.assignmentId; + this.version = updatePolicyAssignmentOptions.version; + this.ifMatch = updatePolicyAssignmentOptions.ifMatch; + this.templateVersion = updatePolicyAssignmentOptions.templateVersion; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + * @param version the version + * @param ifMatch the ifMatch + * @param templateVersion the templateVersion + */ + public Builder(String assignmentId, String version, String ifMatch, String templateVersion) { + this.assignmentId = assignmentId; + this.version = version; + this.ifMatch = ifMatch; + this.templateVersion = templateVersion; + } + + /** + * Builds a UpdatePolicyAssignmentOptions. + * + * @return the new UpdatePolicyAssignmentOptions instance + */ + public UpdatePolicyAssignmentOptions build() { + return new UpdatePolicyAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the UpdatePolicyAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the UpdatePolicyAssignmentOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdatePolicyAssignmentOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the UpdatePolicyAssignmentOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + } + + protected UpdatePolicyAssignmentOptions() { } + + protected UpdatePolicyAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templateVersion, + "templateVersion cannot be null"); + assignmentId = builder.assignmentId; + version = builder.version; + ifMatch = builder.ifMatch; + templateVersion = builder.templateVersion; + } + + /** + * New builder. + * + * @return a UpdatePolicyAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * The policy template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } + + /** + * Gets the version. + * + * specify version of response body format. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy assignment and must match the Etag value of the existing policy + * assignment. The Etag can be retrieved using the GET /v1/policy_assignments/{assignment_id} API and looking at the + * Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the templateVersion. + * + * The policy template version to update to. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java new file mode 100644 index 00000000000..a28b357641f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java @@ -0,0 +1,171 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updatePolicyState options. + */ +public class UpdatePolicyStateOptions extends GenericModel { + + /** + * The policy state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String policyId; + protected String ifMatch; + protected String state; + + /** + * Builder. + */ + public static class Builder { + private String policyId; + private String ifMatch; + private String state; + + /** + * Instantiates a new Builder from an existing UpdatePolicyStateOptions instance. + * + * @param updatePolicyStateOptions the instance to initialize the Builder with + */ + private Builder(UpdatePolicyStateOptions updatePolicyStateOptions) { + this.policyId = updatePolicyStateOptions.policyId; + this.ifMatch = updatePolicyStateOptions.ifMatch; + this.state = updatePolicyStateOptions.state; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyId the policyId + * @param ifMatch the ifMatch + */ + public Builder(String policyId, String ifMatch) { + this.policyId = policyId; + this.ifMatch = ifMatch; + } + + /** + * Builds a UpdatePolicyStateOptions. + * + * @return the new UpdatePolicyStateOptions instance + */ + public UpdatePolicyStateOptions build() { + return new UpdatePolicyStateOptions(this); + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the UpdatePolicyStateOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdatePolicyStateOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the UpdatePolicyStateOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + } + + protected UpdatePolicyStateOptions() { } + + protected UpdatePolicyStateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + policyId = builder.policyId; + ifMatch = builder.ifMatch; + state = builder.state; + } + + /** + * New builder. + * + * @return a UpdatePolicyStateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyId. + * + * The policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be + * retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the state. + * + * The policy state. + * + * @return the state + */ + public String state() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java new file mode 100644 index 00000000000..f10cba5fe93 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java @@ -0,0 +1,166 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updateRoleAssignment options. + */ +public class UpdateRoleAssignmentOptions extends GenericModel { + + protected String assignmentId; + protected String ifMatch; + protected String templateVersion; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + private String ifMatch; + private String templateVersion; + + /** + * Instantiates a new Builder from an existing UpdateRoleAssignmentOptions instance. + * + * @param updateRoleAssignmentOptions the instance to initialize the Builder with + */ + private Builder(UpdateRoleAssignmentOptions updateRoleAssignmentOptions) { + this.assignmentId = updateRoleAssignmentOptions.assignmentId; + this.ifMatch = updateRoleAssignmentOptions.ifMatch; + this.templateVersion = updateRoleAssignmentOptions.templateVersion; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + * @param ifMatch the ifMatch + * @param templateVersion the templateVersion + */ + public Builder(String assignmentId, String ifMatch, String templateVersion) { + this.assignmentId = assignmentId; + this.ifMatch = ifMatch; + this.templateVersion = templateVersion; + } + + /** + * Builds a UpdateRoleAssignmentOptions. + * + * @return the new UpdateRoleAssignmentOptions instance + */ + public UpdateRoleAssignmentOptions build() { + return new UpdateRoleAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the UpdateRoleAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdateRoleAssignmentOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the UpdateRoleAssignmentOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + } + + protected UpdateRoleAssignmentOptions() { } + + protected UpdateRoleAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId 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.templateVersion, + "templateVersion cannot be null"); + assignmentId = builder.assignmentId; + ifMatch = builder.ifMatch; + templateVersion = builder.templateVersion; + } + + /** + * New builder. + * + * @return a UpdateRoleAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Role template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a role assignment and must match the Etag value of the existing role assignment. + * The Etag can be retrieved using the GET /v1/role_assignments/{assignment_id} API and looking at the Etag response + * header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the templateVersion. + * + * The version number of the template used to identify different versions of same template. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java new file mode 100644 index 00000000000..3d9dbb43fb3 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java @@ -0,0 +1,199 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updateSettings options. + */ +public class UpdateSettingsOptions extends GenericModel { + + protected String accountId; + protected String ifMatch; + protected ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String ifMatch; + private ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing UpdateSettingsOptions instance. + * + * @param updateSettingsOptions the instance to initialize the Builder with + */ + private Builder(UpdateSettingsOptions updateSettingsOptions) { + this.accountId = updateSettingsOptions.accountId; + this.ifMatch = updateSettingsOptions.ifMatch; + this.externalAccountIdentityInteraction = updateSettingsOptions.externalAccountIdentityInteraction; + this.acceptLanguage = updateSettingsOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + * @param ifMatch the ifMatch + */ + public Builder(String accountId, String ifMatch) { + this.accountId = accountId; + this.ifMatch = ifMatch; + } + + /** + * Builds a UpdateSettingsOptions. + * + * @return the new UpdateSettingsOptions instance + */ + public UpdateSettingsOptions build() { + return new UpdateSettingsOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the UpdateSettingsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdateSettingsOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the externalAccountIdentityInteraction. + * + * @param externalAccountIdentityInteraction the externalAccountIdentityInteraction + * @return the UpdateSettingsOptions builder + */ + public Builder externalAccountIdentityInteraction(ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction) { + this.externalAccountIdentityInteraction = externalAccountIdentityInteraction; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the UpdateSettingsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected UpdateSettingsOptions() { } + + protected UpdateSettingsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.accountId, + "accountId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + accountId = builder.accountId; + ifMatch = builder.ifMatch; + externalAccountIdentityInteraction = builder.externalAccountIdentityInteraction; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a UpdateSettingsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the settings belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating Access Management Account Settings and must match the Etag value of the existing + * Access Management Account Settings. The Etag can be retrieved using the GET + * /v1/accounts/{account_id}/settings/access_management API and looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the externalAccountIdentityInteraction. + * + * Update to how external accounts can interact in relation to the requested account. + * + * @return the externalAccountIdentityInteraction + */ + public ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction() { + return externalAccountIdentityInteraction; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java new file mode 100644 index 00000000000..fdae9e28c12 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * V2PoliciesPager can be used to simplify the use of the "listV2Policies" method. + */ +public class V2PoliciesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListV2PoliciesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected V2PoliciesPager() { } + + /** + * Constructs a new V2PoliciesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listV2Policies" method + * @param options the ListV2PoliciesOptions instance to be used to invoke the "listV2Policies" method + */ + public V2PoliciesPager(IamPolicyManagement client, ListV2PoliciesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<V2PolicyTemplateMetaData> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListV2PoliciesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + V2PolicyCollection result = client.listV2Policies(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getPolicies(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<V2PolicyTemplateMetaData> containing all results returned by the "listV2Policies" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java new file mode 100644 index 00000000000..842a354b7b1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java @@ -0,0 +1,247 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the policy. + */ +public class V2Policy extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + /** + * The policy state, either 'deleted' or 'active'. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String type; + protected String description; + protected V2PolicySubject subject; + protected V2PolicyResource resource; + protected String pattern; + protected V2PolicyRule rule; + protected String id; + protected String href; + protected ControlResponse control; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String state; + @SerializedName("last_permit_at") + protected String lastPermitAt; + @SerializedName("last_permit_frequency") + protected Long lastPermitFrequency; + + protected V2Policy() { } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject getSubject() { + return subject; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource getResource() { + return resource; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String getPattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule getRule() { + return rule; + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the policies API by policy ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the control. + * + * @return the control + */ + public ControlResponse getControl() { + return control; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the state. + * + * The policy state, either 'deleted' or 'active'. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the lastPermitAt. + * + * The optional last permit time of policy, when passing query parameter format=include_last_permit. + * + * @return the lastPermitAt + */ + public String getLastPermitAt() { + return lastPermitAt; + } + + /** + * Gets the lastPermitFrequency. + * + * The optional count of times that policy has provided a permit, when passing query parameter + * format=include_last_permit. + * + * @return the lastPermitFrequency + */ + public Long getLastPermitFrequency() { + return lastPermitFrequency; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java new file mode 100644 index 00000000000..d392025f8d8 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of policies. + */ +public class V2PolicyCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List policies; + + protected V2PolicyCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the policies. + * + * List of policies. + * + * @return the policies + */ + public List getPolicies() { + return policies; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java new file mode 100644 index 00000000000..caf8dd522a9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java @@ -0,0 +1,167 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The resource attributes to which the policy grants access. + */ +public class V2PolicyResource extends GenericModel { + + protected List attributes; + protected List tags; + + /** + * Builder. + */ + public static class Builder { + private List attributes; + private List tags; + + /** + * Instantiates a new Builder from an existing V2PolicyResource instance. + * + * @param v2PolicyResource the instance to initialize the Builder with + */ + private Builder(V2PolicyResource v2PolicyResource) { + this.attributes = v2PolicyResource.attributes; + this.tags = v2PolicyResource.tags; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param attributes the attributes + */ + public Builder(List attributes) { + this.attributes = attributes; + } + + /** + * Builds a V2PolicyResource. + * + * @return the new V2PolicyResource instance + */ + public V2PolicyResource build() { + return new V2PolicyResource(this); + } + + /** + * Adds a new element to attributes. + * + * @param attributes the new element to be added + * @return the V2PolicyResource builder + */ + public Builder addAttributes(V2PolicyResourceAttribute attributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, + "attributes cannot be null"); + if (this.attributes == null) { + this.attributes = new ArrayList(); + } + this.attributes.add(attributes); + return this; + } + + /** + * Adds a new element to tags. + * + * @param tags the new element to be added + * @return the V2PolicyResource builder + */ + public Builder addTags(V2PolicyResourceTag tags) { + com.ibm.cloud.sdk.core.util.Validator.notNull(tags, + "tags cannot be null"); + if (this.tags == null) { + this.tags = new ArrayList(); + } + this.tags.add(tags); + return this; + } + + /** + * Set the attributes. + * Existing attributes will be replaced. + * + * @param attributes the attributes + * @return the V2PolicyResource builder + */ + public Builder attributes(List attributes) { + this.attributes = attributes; + return this; + } + + /** + * Set the tags. + * Existing tags will be replaced. + * + * @param tags the tags + * @return the V2PolicyResource builder + */ + public Builder tags(List tags) { + this.tags = tags; + return this; + } + } + + protected V2PolicyResource() { } + + protected V2PolicyResource(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, + "attributes cannot be null"); + attributes = builder.attributes; + tags = builder.tags; + } + + /** + * New builder. + * + * @return a V2PolicyResource builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the attributes. + * + * List of resource attributes to which the policy grants access. + * + * @return the attributes + */ + public List attributes() { + return attributes; + } + + /** + * Gets the tags. + * + * Optional list of resource tags to which the policy grants access. + * + * @return the tags + */ + public List tags() { + return tags; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java new file mode 100644 index 00000000000..73e7cedd55e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java @@ -0,0 +1,181 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Resource attribute to which the policy grants access. + */ +public class V2PolicyResourceAttribute extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + } + + protected String key; + protected String operator; + protected Object value; + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing V2PolicyResourceAttribute instance. + * + * @param v2PolicyResourceAttribute the instance to initialize the Builder with + */ + private Builder(V2PolicyResourceAttribute v2PolicyResourceAttribute) { + this.key = v2PolicyResourceAttribute.key; + this.operator = v2PolicyResourceAttribute.operator; + this.value = v2PolicyResourceAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a V2PolicyResourceAttribute. + * + * @return the new V2PolicyResourceAttribute instance + */ + public V2PolicyResourceAttribute build() { + return new V2PolicyResourceAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the V2PolicyResourceAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicyResourceAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the V2PolicyResourceAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected V2PolicyResourceAttribute() { } + + protected V2PolicyResourceAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a V2PolicyResourceAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the key. + * + * The name of a resource attribute. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java new file mode 100644 index 00000000000..bb32772b8dc --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java @@ -0,0 +1,174 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A tag associated with a resource. + */ +public class V2PolicyResourceTag extends GenericModel { + + /** + * The operator of an access management tag. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + } + + protected String key; + protected String value; + protected String operator; + + /** + * Builder. + */ + public static class Builder { + private String key; + private String value; + private String operator; + + /** + * Instantiates a new Builder from an existing V2PolicyResourceTag instance. + * + * @param v2PolicyResourceTag the instance to initialize the Builder with + */ + private Builder(V2PolicyResourceTag v2PolicyResourceTag) { + this.key = v2PolicyResourceTag.key; + this.value = v2PolicyResourceTag.value; + this.operator = v2PolicyResourceTag.operator; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param value the value + * @param operator the operator + */ + public Builder(String key, String value, String operator) { + this.key = key; + this.value = value; + this.operator = operator; + } + + /** + * Builds a V2PolicyResourceTag. + * + * @return the new V2PolicyResourceTag instance + */ + public V2PolicyResourceTag build() { + return new V2PolicyResourceTag(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the V2PolicyResourceTag builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the V2PolicyResourceTag builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicyResourceTag builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + } + + protected V2PolicyResourceTag() { } + + protected V2PolicyResourceTag(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + key = builder.key; + value = builder.value; + operator = builder.operator; + } + + /** + * New builder. + * + * @return a V2PolicyResourceTag builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the key. + * + * The name of an access management tag. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the value. + * + * The value of an access management tag. + * + * @return the value + */ + public String value() { + return value; + } + + /** + * Gets the operator. + * + * The operator of an access management tag. + * + * @return the operator + */ + public String operator() { + return operator; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java new file mode 100644 index 00000000000..13a9f5fbd94 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java @@ -0,0 +1,126 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Additional access conditions associated with the policy. + * + * Classes which extend this class: + * - V2PolicyRuleRuleAttribute + * - V2PolicyRuleRuleWithNestedConditions + */ +public class V2PolicyRule extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + protected String key; + protected String operator; + protected Object value; + protected List conditions; + + protected V2PolicyRule() { } + + /** + * Gets the key. + * + * The name of an attribute. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } + + /** + * Gets the conditions. + * + * List of conditions associated with a policy. For example, time-based conditions that grant access over a certain + * time period. + * + * @return the conditions + */ + public List conditions() { + return conditions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java new file mode 100644 index 00000000000..c20b3a8cb0c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java @@ -0,0 +1,170 @@ +/* + * (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_policy_management.v1.model; + +/** + * Rule that specifies additional access that is granted (For example, time-based condition). + */ +public class V2PolicyRuleRuleAttribute extends V2PolicyRule { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing V2PolicyRuleRuleAttribute instance. + * + * @param v2PolicyRuleRuleAttribute the instance to initialize the Builder with + */ + public Builder(V2PolicyRule v2PolicyRuleRuleAttribute) { + this.key = v2PolicyRuleRuleAttribute.key; + this.operator = v2PolicyRuleRuleAttribute.operator; + this.value = v2PolicyRuleRuleAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a V2PolicyRuleRuleAttribute. + * + * @return the new V2PolicyRuleRuleAttribute instance + */ + public V2PolicyRuleRuleAttribute build() { + return new V2PolicyRuleRuleAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the V2PolicyRuleRuleAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicyRuleRuleAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the V2PolicyRuleRuleAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected V2PolicyRuleRuleAttribute() { } + + protected V2PolicyRuleRuleAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a V2PolicyRuleRuleAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java new file mode 100644 index 00000000000..8d6e57920f9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java @@ -0,0 +1,139 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * Rule that specifies additional access that is granted (for example, time-based condition) accross multiple + * conditions. + */ +public class V2PolicyRuleRuleWithNestedConditions extends V2PolicyRule { + + /** + * Operator to evaluate conditions. + */ + public interface Operator { + /** and. */ + String AND = "and"; + /** or. */ + String OR = "or"; + } + + + /** + * Builder. + */ + public static class Builder { + private String operator; + private List conditions; + + /** + * Instantiates a new Builder from an existing V2PolicyRuleRuleWithNestedConditions instance. + * + * @param v2PolicyRuleRuleWithNestedConditions the instance to initialize the Builder with + */ + public Builder(V2PolicyRule v2PolicyRuleRuleWithNestedConditions) { + this.operator = v2PolicyRuleRuleWithNestedConditions.operator; + this.conditions = v2PolicyRuleRuleWithNestedConditions.conditions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param operator the operator + * @param conditions the conditions + */ + public Builder(String operator, List conditions) { + this.operator = operator; + this.conditions = conditions; + } + + /** + * Builds a V2PolicyRuleRuleWithNestedConditions. + * + * @return the new V2PolicyRuleRuleWithNestedConditions instance + */ + public V2PolicyRuleRuleWithNestedConditions build() { + return new V2PolicyRuleRuleWithNestedConditions(this); + } + + /** + * Adds a new element to conditions. + * + * @param conditions the new element to be added + * @return the V2PolicyRuleRuleWithNestedConditions builder + */ + public Builder addConditions(NestedCondition conditions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(conditions, + "conditions cannot be null"); + if (this.conditions == null) { + this.conditions = new ArrayList(); + } + this.conditions.add(conditions); + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicyRuleRuleWithNestedConditions builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the conditions. + * Existing conditions will be replaced. + * + * @param conditions the conditions + * @return the V2PolicyRuleRuleWithNestedConditions builder + */ + public Builder conditions(List conditions) { + this.conditions = conditions; + return this; + } + } + + protected V2PolicyRuleRuleWithNestedConditions() { } + + protected V2PolicyRuleRuleWithNestedConditions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.conditions, + "conditions cannot be null"); + operator = builder.operator; + conditions = builder.conditions; + } + + /** + * New builder. + * + * @return a V2PolicyRuleRuleWithNestedConditions builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java new file mode 100644 index 00000000000..891513fd45a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java @@ -0,0 +1,124 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The subject attributes for whom the policy grants access. + */ +public class V2PolicySubject extends GenericModel { + + protected List attributes; + + /** + * Builder. + */ + public static class Builder { + private List attributes; + + /** + * Instantiates a new Builder from an existing V2PolicySubject instance. + * + * @param v2PolicySubject the instance to initialize the Builder with + */ + private Builder(V2PolicySubject v2PolicySubject) { + this.attributes = v2PolicySubject.attributes; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param attributes the attributes + */ + public Builder(List attributes) { + this.attributes = attributes; + } + + /** + * Builds a V2PolicySubject. + * + * @return the new V2PolicySubject instance + */ + public V2PolicySubject build() { + return new V2PolicySubject(this); + } + + /** + * Adds a new element to attributes. + * + * @param attributes the new element to be added + * @return the V2PolicySubject builder + */ + public Builder addAttributes(V2PolicySubjectAttribute attributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, + "attributes cannot be null"); + if (this.attributes == null) { + this.attributes = new ArrayList(); + } + this.attributes.add(attributes); + return this; + } + + /** + * Set the attributes. + * Existing attributes will be replaced. + * + * @param attributes the attributes + * @return the V2PolicySubject builder + */ + public Builder attributes(List attributes) { + this.attributes = attributes; + return this; + } + } + + protected V2PolicySubject() { } + + protected V2PolicySubject(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, + "attributes cannot be null"); + attributes = builder.attributes; + } + + /** + * New builder. + * + * @return a V2PolicySubject builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the attributes. + * + * List of subject attributes associated with policy. + * + * @return the attributes + */ + public List attributes() { + return attributes; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java new file mode 100644 index 00000000000..c90606429df --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java @@ -0,0 +1,175 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Subject attribute for whom the policy grants access. + */ +public class V2PolicySubjectAttribute extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + } + + protected String key; + protected String operator; + protected Object value; + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing V2PolicySubjectAttribute instance. + * + * @param v2PolicySubjectAttribute the instance to initialize the Builder with + */ + private Builder(V2PolicySubjectAttribute v2PolicySubjectAttribute) { + this.key = v2PolicySubjectAttribute.key; + this.operator = v2PolicySubjectAttribute.operator; + this.value = v2PolicySubjectAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a V2PolicySubjectAttribute. + * + * @return the new V2PolicySubjectAttribute instance + */ + public V2PolicySubjectAttribute build() { + return new V2PolicySubjectAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the V2PolicySubjectAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicySubjectAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the V2PolicySubjectAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected V2PolicySubjectAttribute() { } + + protected V2PolicySubjectAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a V2PolicySubjectAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the key. + * + * The name of a subject attribute. For example, iam_id, access_group_id. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java new file mode 100644 index 00000000000..720f7b57d4e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java @@ -0,0 +1,260 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the policy. + */ +public class V2PolicyTemplateMetaData extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + /** + * The policy state, either 'deleted' or 'active'. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String type; + protected String description; + protected V2PolicySubject subject; + protected V2PolicyResource resource; + protected String pattern; + protected V2PolicyRule rule; + protected String id; + protected String href; + protected ControlResponse control; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String state; + @SerializedName("last_permit_at") + protected String lastPermitAt; + @SerializedName("last_permit_frequency") + protected Long lastPermitFrequency; + protected TemplateMetadata template; + + protected V2PolicyTemplateMetaData() { } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject getSubject() { + return subject; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource getResource() { + return resource; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String getPattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule getRule() { + return rule; + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the policies API by policy ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the control. + * + * @return the control + */ + public ControlResponse getControl() { + return control; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the state. + * + * The policy state, either 'deleted' or 'active'. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the lastPermitAt. + * + * The optional last permit time of policy, when passing query parameter format=include_last_permit. + * + * @return the lastPermitAt + */ + public String getLastPermitAt() { + return lastPermitAt; + } + + /** + * Gets the lastPermitFrequency. + * + * The optional count of times that policy has provided a permit, when passing query parameter + * format=include_last_permit. + * + * @return the lastPermitFrequency + */ + public Long getLastPermitFrequency() { + return lastPermitFrequency; + } + + /** + * Gets the template. + * + * The details of the IAM template that was used to create an enterprise-managed policy in your account. When + * returned, this indicates that the policy is created from and managed by a template in the root enterprise account. + * + * @return the template + */ + public TemplateMetadata getTemplate() { + return template; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java new file mode 100644 index 00000000000..63a87389391 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java @@ -0,0 +1,17 @@ +/* + * (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. + */ + +/** + * IAM Policy Management v1. + */ +package com.ibm.cloud.platform_services.iam_policy_management.v1; diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java new file mode 100644 index 00000000000..b38933306a6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java @@ -0,0 +1,5007 @@ +/* + * (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_policy_management.v1; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplatesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponse; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControlWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedCondition; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleWithConditions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PoliciesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplatesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoleReferences; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PoliciesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRule; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleWithNestedConditions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.http.Response; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import okhttp3.mockwebserver.RecordedRequest; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the IamPolicyManagement service. + */ +public class IamPolicyManagementTest { + + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + protected MockWebServer server; + protected IamPolicyManagement iamPolicyManagementService; + + // Construct the service with a null authenticator (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testConstructorWithNullAuthenticator() throws Throwable { + final String serviceName = "testService"; + new IamPolicyManagement(serviceName, null); + } + + // Test the listPolicies operation with a valid options model parameter + @Test + public void testListPoliciesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policies\": [{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}]}"; + String listPoliciesPath = "/v1/policies"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListPoliciesOptions model + ListPoliciesOptions listPoliciesOptionsModel = new ListPoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .tagName("testString") + .tagValue("testString") + .sort("id") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listPolicies() with a valid options model and verify the result + Response response = iamPolicyManagementService.listPolicies(listPoliciesOptionsModel).execute(); + assertNotNull(response); + PolicyCollection 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, listPoliciesPath); + // 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("access_group_id"), "testString"); + assertEquals(query.get("type"), "access"); + assertEquals(query.get("service_type"), "service"); + assertEquals(query.get("tag_name"), "testString"); + assertEquals(query.get("tag_value"), "testString"); + assertEquals(query.get("sort"), "id"); + assertEquals(query.get("format"), "include_last_permit"); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listPolicies operation with and without retries enabled + @Test + public void testListPoliciesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListPoliciesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListPoliciesWOptions(); + } + + // Test the listPolicies operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPoliciesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listPolicies(null).execute(); + } + + // Test the listPolicies operation using the PoliciesPager.getNext() method + @Test + public void testListPoliciesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPoliciesOptions listPoliciesOptions = new ListPoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .tagName("testString") + .tagValue("testString") + .sort("id") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + PoliciesPager pager = new PoliciesPager(iamPolicyManagementService, listPoliciesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listPolicies operation using the PoliciesPager.getAll() method + @Test + public void testListPoliciesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPoliciesOptions listPoliciesOptions = new ListPoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .tagName("testString") + .tagValue("testString") + .sort("id") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + PoliciesPager pager = new PoliciesPager(iamPolicyManagementService, listPoliciesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createPolicy operation with a valid options model parameter + @Test + public void testCreatePolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; + String createPolicyPath = "/v1/policies"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the SubjectAttribute model + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + + // Construct an instance of the PolicySubject model + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + + // Construct an instance of the PolicyRole model + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the ResourceAttribute model + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + + // Construct an instance of the ResourceTag model + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + + // Construct an instance of the PolicyResource model + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + + // Construct an instance of the CreatePolicyOptions model + CreatePolicyOptions createPolicyOptionsModel = new CreatePolicyOptions.Builder() + .type("testString") + .subjects(java.util.Arrays.asList(policySubjectModel)) + .roles(java.util.Arrays.asList(policyRoleModel)) + .resources(java.util.Arrays.asList(policyResourceModel)) + .description("testString") + .acceptLanguage("default") + .build(); + + // Invoke createPolicy() with a valid options model and verify the result + Response response = iamPolicyManagementService.createPolicy(createPolicyOptionsModel).execute(); + assertNotNull(response); + Policy 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createPolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createPolicy operation with and without retries enabled + @Test + public void testCreatePolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreatePolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreatePolicyWOptions(); + } + + // Test the createPolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createPolicy(null).execute(); + } + + // Test the replacePolicy operation with a valid options model parameter + @Test + public void testReplacePolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; + String replacePolicyPath = "/v1/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the SubjectAttribute model + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + + // Construct an instance of the PolicySubject model + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + + // Construct an instance of the PolicyRole model + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the ResourceAttribute model + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + + // Construct an instance of the ResourceTag model + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + + // Construct an instance of the PolicyResource model + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + + // Construct an instance of the ReplacePolicyOptions model + ReplacePolicyOptions replacePolicyOptionsModel = new ReplacePolicyOptions.Builder() + .policyId("testString") + .ifMatch("testString") + .type("testString") + .subjects(java.util.Arrays.asList(policySubjectModel)) + .roles(java.util.Arrays.asList(policyRoleModel)) + .resources(java.util.Arrays.asList(policyResourceModel)) + .description("testString") + .build(); + + // Invoke replacePolicy() with a valid options model and verify the result + Response response = iamPolicyManagementService.replacePolicy(replacePolicyOptionsModel).execute(); + assertNotNull(response); + Policy 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, replacePolicyPath); + // 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 replacePolicy operation with and without retries enabled + @Test + public void testReplacePolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplacePolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplacePolicyWOptions(); + } + + // Test the replacePolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplacePolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replacePolicy(null).execute(); + } + + // Test the getPolicy operation with a valid options model parameter + @Test + public void testGetPolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}"; + String getPolicyPath = "/v1/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetPolicyOptions model + GetPolicyOptions getPolicyOptionsModel = new GetPolicyOptions.Builder() + .policyId("testString") + .build(); + + // Invoke getPolicy() with a valid options model and verify the result + Response response = iamPolicyManagementService.getPolicy(getPolicyOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateMetaData 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, getPolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getPolicy operation with and without retries enabled + @Test + public void testGetPolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetPolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetPolicyWOptions(); + } + + // Test the getPolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getPolicy(null).execute(); + } + + // Test the deletePolicy operation with a valid options model parameter + @Test + public void testDeletePolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deletePolicyPath = "/v1/policies/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeletePolicyOptions model + DeletePolicyOptions deletePolicyOptionsModel = new DeletePolicyOptions.Builder() + .policyId("testString") + .build(); + + // Invoke deletePolicy() with a valid options model and verify the result + Response response = iamPolicyManagementService.deletePolicy(deletePolicyOptionsModel).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, deletePolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deletePolicy operation with and without retries enabled + @Test + public void testDeletePolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeletePolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeletePolicyWOptions(); + } + + // Test the deletePolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deletePolicy(null).execute(); + } + + // Test the updatePolicyState operation with a valid options model parameter + @Test + public void testUpdatePolicyStateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; + String updatePolicyStatePath = "/v1/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdatePolicyStateOptions model + UpdatePolicyStateOptions updatePolicyStateOptionsModel = new UpdatePolicyStateOptions.Builder() + .policyId("testString") + .ifMatch("testString") + .state("active") + .build(); + + // Invoke updatePolicyState() with a valid options model and verify the result + Response response = iamPolicyManagementService.updatePolicyState(updatePolicyStateOptionsModel).execute(); + assertNotNull(response); + Policy 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updatePolicyStatePath); + // 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 updatePolicyState operation with and without retries enabled + @Test + public void testUpdatePolicyStateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdatePolicyStateWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdatePolicyStateWOptions(); + } + + // Test the updatePolicyState operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdatePolicyStateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updatePolicyState(null).execute(); + } + + // Test the listRoles operation with a valid options model parameter + @Test + public void testListRolesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"custom_roles\": [{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}], \"service_roles\": [{\"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\"}], \"system_roles\": [{\"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\"}]}"; + String listRolesPath = "/v2/roles"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListRolesOptions model + ListRolesOptions listRolesOptionsModel = new ListRolesOptions.Builder() + .acceptLanguage("default") + .accountId("testString") + .serviceName("iam-groups") + .sourceServiceName("iam-groups") + .policyType("authorization") + .serviceGroupId("IAM") + .build(); + + // Invoke listRoles() with a valid options model and verify the result + Response response = iamPolicyManagementService.listRoles(listRolesOptionsModel).execute(); + assertNotNull(response); + RoleCollection 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, listRolesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("service_name"), "iam-groups"); + assertEquals(query.get("source_service_name"), "iam-groups"); + assertEquals(query.get("policy_type"), "authorization"); + assertEquals(query.get("service_group_id"), "IAM"); + } + + // Test the listRoles operation with and without retries enabled + @Test + public void testListRolesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListRolesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListRolesWOptions(); + } + + // Test the createRole operation with a valid options model parameter + @Test + public void testCreateRoleWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; + String createRolePath = "/v2/roles"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the CreateRoleOptions model + CreateRoleOptions createRoleOptionsModel = new CreateRoleOptions.Builder() + .displayName("testString") + .actions(java.util.Arrays.asList("testString")) + .name("Developer") + .accountId("testString") + .serviceName("iam-groups") + .description("testString") + .acceptLanguage("default") + .build(); + + // Invoke createRole() with a valid options model and verify the result + Response response = iamPolicyManagementService.createRole(createRoleOptionsModel).execute(); + assertNotNull(response); + CustomRole 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createRolePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createRole operation with and without retries enabled + @Test + public void testCreateRoleWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateRoleWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateRoleWOptions(); + } + + // Test the createRole operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createRole(null).execute(); + } + + // Test the replaceRole operation with a valid options model parameter + @Test + public void testReplaceRoleWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; + String replaceRolePath = "/v2/roles/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ReplaceRoleOptions model + ReplaceRoleOptions replaceRoleOptionsModel = new ReplaceRoleOptions.Builder() + .roleId("testString") + .ifMatch("testString") + .displayName("testString") + .actions(java.util.Arrays.asList("testString")) + .description("testString") + .build(); + + // Invoke replaceRole() with a valid options model and verify the result + Response response = iamPolicyManagementService.replaceRole(replaceRoleOptionsModel).execute(); + assertNotNull(response); + CustomRole 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, replaceRolePath); + // 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 replaceRole operation with and without retries enabled + @Test + public void testReplaceRoleWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplaceRoleWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplaceRoleWOptions(); + } + + // Test the replaceRole operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceRoleNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replaceRole(null).execute(); + } + + // Test the getRole operation with a valid options model parameter + @Test + public void testGetRoleWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; + String getRolePath = "/v2/roles/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetRoleOptions model + GetRoleOptions getRoleOptionsModel = new GetRoleOptions.Builder() + .roleId("testString") + .build(); + + // Invoke getRole() with a valid options model and verify the result + Response response = iamPolicyManagementService.getRole(getRoleOptionsModel).execute(); + assertNotNull(response); + CustomRole 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, getRolePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getRole operation with and without retries enabled + @Test + public void testGetRoleWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetRoleWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetRoleWOptions(); + } + + // Test the getRole operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getRole(null).execute(); + } + + // Test the deleteRole operation with a valid options model parameter + @Test + public void testDeleteRoleWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteRolePath = "/v2/roles/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteRoleOptions model + DeleteRoleOptions deleteRoleOptionsModel = new DeleteRoleOptions.Builder() + .roleId("testString") + .build(); + + // Invoke deleteRole() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteRole(deleteRoleOptionsModel).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, deleteRolePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteRole operation with and without retries enabled + @Test + public void testDeleteRoleWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteRoleWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteRoleWOptions(); + } + + // Test the deleteRole operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteRole(null).execute(); + } + + // Test the listV2Policies operation with a valid options model parameter + @Test + public void testListV2PoliciesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policies\": [{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19, \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}]}"; + String listV2PoliciesPath = "/v2/policies"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListV2PoliciesOptions model + ListV2PoliciesOptions listV2PoliciesOptionsModel = new ListV2PoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .serviceName("testString") + .serviceGroupId("testString") + .sort("testString") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listV2Policies() with a valid options model and verify the result + Response response = iamPolicyManagementService.listV2Policies(listV2PoliciesOptionsModel).execute(); + assertNotNull(response); + V2PolicyCollection 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, listV2PoliciesPath); + // 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("access_group_id"), "testString"); + assertEquals(query.get("type"), "access"); + assertEquals(query.get("service_type"), "service"); + assertEquals(query.get("service_name"), "testString"); + assertEquals(query.get("service_group_id"), "testString"); + assertEquals(query.get("sort"), "testString"); + assertEquals(query.get("format"), "include_last_permit"); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listV2Policies operation with and without retries enabled + @Test + public void testListV2PoliciesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListV2PoliciesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListV2PoliciesWOptions(); + } + + // Test the listV2Policies operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListV2PoliciesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listV2Policies(null).execute(); + } + + // Test the listV2Policies operation using the V2PoliciesPager.getNext() method + @Test + public void testListV2PoliciesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListV2PoliciesOptions listV2PoliciesOptions = new ListV2PoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .serviceName("testString") + .serviceGroupId("testString") + .sort("testString") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + V2PoliciesPager pager = new V2PoliciesPager(iamPolicyManagementService, listV2PoliciesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listV2Policies operation using the V2PoliciesPager.getAll() method + @Test + public void testListV2PoliciesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListV2PoliciesOptions listV2PoliciesOptions = new ListV2PoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .serviceName("testString") + .serviceGroupId("testString") + .sort("testString") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + V2PoliciesPager pager = new V2PoliciesPager(iamPolicyManagementService, listV2PoliciesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createV2Policy operation with a valid options model parameter + @Test + public void testCreateV2PolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19}"; + String createV2PolicyPath = "/v2/policies"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the Grant model + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the Control model + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the CreateV2PolicyOptions model + CreateV2PolicyOptions createV2PolicyOptionsModel = new CreateV2PolicyOptions.Builder() + .control(controlModel) + .type("access") + .description("testString") + .subject(v2PolicySubjectModel) + .resource(v2PolicyResourceModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .acceptLanguage("default") + .build(); + + // Invoke createV2Policy() with a valid options model and verify the result + Response response = iamPolicyManagementService.createV2Policy(createV2PolicyOptionsModel).execute(); + assertNotNull(response); + V2Policy 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createV2PolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createV2Policy operation with and without retries enabled + @Test + public void testCreateV2PolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateV2PolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateV2PolicyWOptions(); + } + + // Test the createV2Policy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateV2PolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createV2Policy(null).execute(); + } + + // Test the replaceV2Policy operation with a valid options model parameter + @Test + public void testReplaceV2PolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19}"; + String replaceV2PolicyPath = "/v2/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the Grant model + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the Control model + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the ReplaceV2PolicyOptions model + ReplaceV2PolicyOptions replaceV2PolicyOptionsModel = new ReplaceV2PolicyOptions.Builder() + .id("testString") + .ifMatch("testString") + .control(controlModel) + .type("access") + .description("testString") + .subject(v2PolicySubjectModel) + .resource(v2PolicyResourceModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .build(); + + // Invoke replaceV2Policy() with a valid options model and verify the result + Response response = iamPolicyManagementService.replaceV2Policy(replaceV2PolicyOptionsModel).execute(); + assertNotNull(response); + V2Policy 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, replaceV2PolicyPath); + // 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 replaceV2Policy operation with and without retries enabled + @Test + public void testReplaceV2PolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplaceV2PolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplaceV2PolicyWOptions(); + } + + // Test the replaceV2Policy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceV2PolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replaceV2Policy(null).execute(); + } + + // Test the getV2Policy operation with a valid options model parameter + @Test + public void testGetV2PolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19, \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}"; + String getV2PolicyPath = "/v2/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetV2PolicyOptions model + GetV2PolicyOptions getV2PolicyOptionsModel = new GetV2PolicyOptions.Builder() + .id("testString") + .format("include_last_permit") + .build(); + + // Invoke getV2Policy() with a valid options model and verify the result + Response response = iamPolicyManagementService.getV2Policy(getV2PolicyOptionsModel).execute(); + assertNotNull(response); + V2PolicyTemplateMetaData 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, getV2PolicyPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("format"), "include_last_permit"); + } + + // Test the getV2Policy operation with and without retries enabled + @Test + public void testGetV2PolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetV2PolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetV2PolicyWOptions(); + } + + // Test the getV2Policy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetV2PolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getV2Policy(null).execute(); + } + + // Test the deleteV2Policy operation with a valid options model parameter + @Test + public void testDeleteV2PolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteV2PolicyPath = "/v2/policies/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteV2PolicyOptions model + DeleteV2PolicyOptions deleteV2PolicyOptionsModel = new DeleteV2PolicyOptions.Builder() + .id("testString") + .build(); + + // Invoke deleteV2Policy() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteV2Policy(deleteV2PolicyOptionsModel).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, deleteV2PolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteV2Policy operation with and without retries enabled + @Test + public void testDeleteV2PolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteV2PolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteV2PolicyWOptions(); + } + + // Test the deleteV2Policy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteV2PolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteV2Policy(null).execute(); + } + + // Test the listPolicyTemplates operation with a valid options model parameter + @Test + public void testListPolicyTemplatesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policy_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; + String listPolicyTemplatesPath = "/v1/policy_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListPolicyTemplatesOptions model + ListPolicyTemplatesOptions listPolicyTemplatesOptionsModel = new ListPolicyTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .state("active") + .name("testString") + .policyServiceType("service") + .policyServiceName("testString") + .policyServiceGroupId("testString") + .policyType("access") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listPolicyTemplates() with a valid options model and verify the result + Response response = iamPolicyManagementService.listPolicyTemplates(listPolicyTemplatesOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateCollection 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, listPolicyTemplatesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("state"), "active"); + assertEquals(query.get("name"), "testString"); + assertEquals(query.get("policy_service_type"), "service"); + assertEquals(query.get("policy_service_name"), "testString"); + assertEquals(query.get("policy_service_group_id"), "testString"); + assertEquals(query.get("policy_type"), "access"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listPolicyTemplates operation with and without retries enabled + @Test + public void testListPolicyTemplatesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListPolicyTemplatesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListPolicyTemplatesWOptions(); + } + + // Test the listPolicyTemplates operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyTemplatesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listPolicyTemplates(null).execute(); + } + + // Test the listPolicyTemplates operation using the PolicyTemplatesPager.getNext() method + @Test + public void testListPolicyTemplatesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyTemplatesOptions listPolicyTemplatesOptions = new ListPolicyTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .state("active") + .name("testString") + .policyServiceType("service") + .policyServiceName("testString") + .policyServiceGroupId("testString") + .policyType("access") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + PolicyTemplatesPager pager = new PolicyTemplatesPager(iamPolicyManagementService, listPolicyTemplatesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listPolicyTemplates operation using the PolicyTemplatesPager.getAll() method + @Test + public void testListPolicyTemplatesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyTemplatesOptions listPolicyTemplatesOptions = new ListPolicyTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .state("active") + .name("testString") + .policyServiceType("service") + .policyServiceName("testString") + .policyServiceGroupId("testString") + .policyType("access") + .limit(Long.valueOf("10")) + .build(); + + PolicyTemplatesPager pager = new PolicyTemplatesPager(iamPolicyManagementService, listPolicyTemplatesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createPolicyTemplate operation with a valid options model parameter + @Test + public void testCreatePolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; + String createPolicyTemplatePath = "/v1/policy_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the TemplateGrantRoles model + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the TemplateControl model + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + + // Construct an instance of the TemplatePolicy model + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + + // Construct an instance of the CreatePolicyTemplateOptions model + CreatePolicyTemplateOptions createPolicyTemplateOptionsModel = new CreatePolicyTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .policy(templatePolicyModel) + .description("testString") + .committed(true) + .acceptLanguage("default") + .build(); + + // Invoke createPolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.createPolicyTemplate(createPolicyTemplateOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateLimitData 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createPolicyTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createPolicyTemplate operation with and without retries enabled + @Test + public void testCreatePolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreatePolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreatePolicyTemplateWOptions(); + } + + // Test the createPolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createPolicyTemplate(null).execute(); + } + + // Test the getPolicyTemplate operation with a valid options model parameter + @Test + public void testGetPolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String getPolicyTemplatePath = "/v1/policy_templates/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetPolicyTemplateOptions model + GetPolicyTemplateOptions getPolicyTemplateOptionsModel = new GetPolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .state("active") + .build(); + + // Invoke getPolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.getPolicyTemplate(getPolicyTemplateOptionsModel).execute(); + assertNotNull(response); + PolicyTemplate 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, getPolicyTemplatePath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + } + + // Test the getPolicyTemplate operation with and without retries enabled + @Test + public void testGetPolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetPolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetPolicyTemplateWOptions(); + } + + // Test the getPolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getPolicyTemplate(null).execute(); + } + + // Test the deletePolicyTemplate operation with a valid options model parameter + @Test + public void testDeletePolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deletePolicyTemplatePath = "/v1/policy_templates/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeletePolicyTemplateOptions model + DeletePolicyTemplateOptions deletePolicyTemplateOptionsModel = new DeletePolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .build(); + + // Invoke deletePolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.deletePolicyTemplate(deletePolicyTemplateOptionsModel).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, deletePolicyTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deletePolicyTemplate operation with and without retries enabled + @Test + public void testDeletePolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeletePolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeletePolicyTemplateWOptions(); + } + + // Test the deletePolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deletePolicyTemplate(null).execute(); + } + + // Test the createPolicyTemplateVersion operation with a valid options model parameter + @Test + public void testCreatePolicyTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; + String createPolicyTemplateVersionPath = "/v1/policy_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the TemplateGrantRoles model + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the TemplateControl model + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + + // Construct an instance of the TemplatePolicy model + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + + // Construct an instance of the CreatePolicyTemplateVersionOptions model + CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptionsModel = new CreatePolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .policy(templatePolicyModel) + .name("testString") + .description("testString") + .committed(true) + .build(); + + // Invoke createPolicyTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.createPolicyTemplateVersion(createPolicyTemplateVersionOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateLimitData 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createPolicyTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createPolicyTemplateVersion operation with and without retries enabled + @Test + public void testCreatePolicyTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreatePolicyTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreatePolicyTemplateVersionWOptions(); + } + + // Test the createPolicyTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createPolicyTemplateVersion(null).execute(); + } + + // Test the listPolicyTemplateVersions operation with a valid options model parameter + @Test + public void testListPolicyTemplateVersionsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; + String listPolicyTemplateVersionsPath = "/v1/policy_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListPolicyTemplateVersionsOptions model + ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptionsModel = new ListPolicyTemplateVersionsOptions.Builder() + .policyTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listPolicyTemplateVersions() with a valid options model and verify the result + Response response = iamPolicyManagementService.listPolicyTemplateVersions(listPolicyTemplateVersionsOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateVersionsCollection 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, listPolicyTemplateVersionsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listPolicyTemplateVersions operation with and without retries enabled + @Test + public void testListPolicyTemplateVersionsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListPolicyTemplateVersionsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListPolicyTemplateVersionsWOptions(); + } + + // Test the listPolicyTemplateVersions operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyTemplateVersionsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listPolicyTemplateVersions(null).execute(); + } + + // Test the listPolicyTemplateVersions operation using the PolicyTemplateVersionsPager.getNext() method + @Test + public void testListPolicyTemplateVersionsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions = new ListPolicyTemplateVersionsOptions.Builder() + .policyTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + PolicyTemplateVersionsPager pager = new PolicyTemplateVersionsPager(iamPolicyManagementService, listPolicyTemplateVersionsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listPolicyTemplateVersions operation using the PolicyTemplateVersionsPager.getAll() method + @Test + public void testListPolicyTemplateVersionsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions = new ListPolicyTemplateVersionsOptions.Builder() + .policyTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + PolicyTemplateVersionsPager pager = new PolicyTemplateVersionsPager(iamPolicyManagementService, listPolicyTemplateVersionsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the replacePolicyTemplate operation with a valid options model parameter + @Test + public void testReplacePolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String replacePolicyTemplatePath = "/v1/policy_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the TemplateGrantRoles model + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the TemplateControl model + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + + // Construct an instance of the TemplatePolicy model + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + + // Construct an instance of the ReplacePolicyTemplateOptions model + ReplacePolicyTemplateOptions replacePolicyTemplateOptionsModel = new ReplacePolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .ifMatch("testString") + .policy(templatePolicyModel) + .name("testString") + .description("testString") + .committed(true) + .build(); + + // Invoke replacePolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.replacePolicyTemplate(replacePolicyTemplateOptionsModel).execute(); + assertNotNull(response); + PolicyTemplate 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, replacePolicyTemplatePath); + // 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 replacePolicyTemplate operation with and without retries enabled + @Test + public void testReplacePolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplacePolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplacePolicyTemplateWOptions(); + } + + // Test the replacePolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplacePolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replacePolicyTemplate(null).execute(); + } + + // Test the deletePolicyTemplateVersion operation with a valid options model parameter + @Test + public void testDeletePolicyTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deletePolicyTemplateVersionPath = "/v1/policy_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeletePolicyTemplateVersionOptions model + DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptionsModel = new DeletePolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + + // Invoke deletePolicyTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.deletePolicyTemplateVersion(deletePolicyTemplateVersionOptionsModel).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, deletePolicyTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deletePolicyTemplateVersion operation with and without retries enabled + @Test + public void testDeletePolicyTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeletePolicyTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeletePolicyTemplateVersionWOptions(); + } + + // Test the deletePolicyTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deletePolicyTemplateVersion(null).execute(); + } + + // Test the getPolicyTemplateVersion operation with a valid options model parameter + @Test + public void testGetPolicyTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String getPolicyTemplateVersionPath = "/v1/policy_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetPolicyTemplateVersionOptions model + GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptionsModel = new GetPolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + + // Invoke getPolicyTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.getPolicyTemplateVersion(getPolicyTemplateVersionOptionsModel).execute(); + assertNotNull(response); + PolicyTemplate 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, getPolicyTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getPolicyTemplateVersion operation with and without retries enabled + @Test + public void testGetPolicyTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetPolicyTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetPolicyTemplateVersionWOptions(); + } + + // Test the getPolicyTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getPolicyTemplateVersion(null).execute(); + } + + // Test the commitPolicyTemplate operation with a valid options model parameter + @Test + public void testCommitPolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String commitPolicyTemplatePath = "/v1/policy_templates/testString/versions/testString/commit"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the CommitPolicyTemplateOptions model + CommitPolicyTemplateOptions commitPolicyTemplateOptionsModel = new CommitPolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + + // Invoke commitPolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.commitPolicyTemplate(commitPolicyTemplateOptionsModel).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, commitPolicyTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the commitPolicyTemplate operation with and without retries enabled + @Test + public void testCommitPolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCommitPolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCommitPolicyTemplateWOptions(); + } + + // Test the commitPolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitPolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.commitPolicyTemplate(null).execute(); + } + + // Test the listPolicyAssignments operation with a valid options model parameter + @Test + public void testListPolicyAssignmentsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}]}"; + String listPolicyAssignmentsPath = "/v1/policy_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListPolicyAssignmentsOptions model + ListPolicyAssignmentsOptions listPolicyAssignmentsOptionsModel = new ListPolicyAssignmentsOptions.Builder() + .version("1.0") + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listPolicyAssignments() with a valid options model and verify the result + Response response = iamPolicyManagementService.listPolicyAssignments(listPolicyAssignmentsOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateAssignmentCollection 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, listPolicyAssignmentsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "1.0"); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("template_id"), "testString"); + assertEquals(query.get("template_version"), "testString"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listPolicyAssignments operation with and without retries enabled + @Test + public void testListPolicyAssignmentsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListPolicyAssignmentsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListPolicyAssignmentsWOptions(); + } + + // Test the listPolicyAssignments operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyAssignmentsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listPolicyAssignments(null).execute(); + } + + // Test the listPolicyAssignments operation using the PolicyAssignmentsPager.getNext() method + @Test + public void testListPolicyAssignmentsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyAssignmentsOptions listPolicyAssignmentsOptions = new ListPolicyAssignmentsOptions.Builder() + .version("1.0") + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + PolicyAssignmentsPager pager = new PolicyAssignmentsPager(iamPolicyManagementService, listPolicyAssignmentsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listPolicyAssignments operation using the PolicyAssignmentsPager.getAll() method + @Test + public void testListPolicyAssignmentsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyAssignmentsOptions listPolicyAssignmentsOptions = new ListPolicyAssignmentsOptions.Builder() + .version("1.0") + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + PolicyAssignmentsPager pager = new PolicyAssignmentsPager(iamPolicyManagementService, listPolicyAssignmentsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createPolicyTemplateAssignment operation with a valid options model parameter + @Test + public void testCreatePolicyTemplateAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}]}"; + String createPolicyTemplateAssignmentPath = "/v1/policy_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the AssignmentTargetDetails model + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + + // Construct an instance of the AssignmentTemplateDetails model + AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() + .id("testString") + .version("testString") + .build(); + + // Construct an instance of the CreatePolicyTemplateAssignmentOptions model + CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptionsModel = new CreatePolicyTemplateAssignmentOptions.Builder() + .version("1.0") + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(assignmentTemplateDetailsModel)) + .acceptLanguage("default") + .build(); + + // Invoke createPolicyTemplateAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.createPolicyTemplateAssignment(createPolicyTemplateAssignmentOptionsModel).execute(); + assertNotNull(response); + PolicyAssignmentV1Collection 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createPolicyTemplateAssignmentPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "1.0"); + } + + // Test the createPolicyTemplateAssignment operation with and without retries enabled + @Test + public void testCreatePolicyTemplateAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreatePolicyTemplateAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreatePolicyTemplateAssignmentWOptions(); + } + + // Test the createPolicyTemplateAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createPolicyTemplateAssignment(null).execute(); + } + + // Test the getPolicyAssignment operation with a valid options model parameter + @Test + public void testGetPolicyAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}"; + String getPolicyAssignmentPath = "/v1/policy_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetPolicyAssignmentOptions model + GetPolicyAssignmentOptions getPolicyAssignmentOptionsModel = new GetPolicyAssignmentOptions.Builder() + .assignmentId("testString") + .version("1.0") + .build(); + + // Invoke getPolicyAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.getPolicyAssignment(getPolicyAssignmentOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateAssignmentItems 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, getPolicyAssignmentPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "1.0"); + } + + // Test the getPolicyAssignment operation with and without retries enabled + @Test + public void testGetPolicyAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetPolicyAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetPolicyAssignmentWOptions(); + } + + // Test the getPolicyAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getPolicyAssignment(null).execute(); + } + + // Test the updatePolicyAssignment operation with a valid options model parameter + @Test + public void testUpdatePolicyAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}"; + String updatePolicyAssignmentPath = "/v1/policy_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdatePolicyAssignmentOptions model + UpdatePolicyAssignmentOptions updatePolicyAssignmentOptionsModel = new UpdatePolicyAssignmentOptions.Builder() + .assignmentId("testString") + .version("1.0") + .ifMatch("testString") + .templateVersion("testString") + .build(); + + // Invoke updatePolicyAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.updatePolicyAssignment(updatePolicyAssignmentOptionsModel).execute(); + assertNotNull(response); + PolicyAssignmentV1 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updatePolicyAssignmentPath); + // Verify header parameters + assertEquals(request.getHeader("If-Match"), "testString"); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "1.0"); + } + + // Test the updatePolicyAssignment operation with and without retries enabled + @Test + public void testUpdatePolicyAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdatePolicyAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdatePolicyAssignmentWOptions(); + } + + // Test the updatePolicyAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdatePolicyAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updatePolicyAssignment(null).execute(); + } + + // Test the deletePolicyAssignment operation with a valid options model parameter + @Test + public void testDeletePolicyAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deletePolicyAssignmentPath = "/v1/policy_assignments/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeletePolicyAssignmentOptions model + DeletePolicyAssignmentOptions deletePolicyAssignmentOptionsModel = new DeletePolicyAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke deletePolicyAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.deletePolicyAssignment(deletePolicyAssignmentOptionsModel).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, deletePolicyAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deletePolicyAssignment operation with and without retries enabled + @Test + public void testDeletePolicyAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeletePolicyAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeletePolicyAssignmentWOptions(); + } + + // Test the deletePolicyAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deletePolicyAssignment(null).execute(); + } + + // Test the getSettings operation with a valid options model parameter + @Test + public void testGetSettingsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"external_account_identity_interaction\": {\"identity_types\": {\"user\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service_id\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}}}}"; + String getSettingsPath = "/v1/accounts/testString/settings/access_management"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetSettingsOptions model + GetSettingsOptions getSettingsOptionsModel = new GetSettingsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .build(); + + // Invoke getSettings() with a valid options model and verify the result + Response response = iamPolicyManagementService.getSettings(getSettingsOptionsModel).execute(); + assertNotNull(response); + AccountSettingsAccessManagement 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, getSettingsPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getSettings operation with and without retries enabled + @Test + public void testGetSettingsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetSettingsWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetSettingsWOptions(); + } + + // Test the getSettings operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetSettingsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getSettings(null).execute(); + } + + // Test the updateSettings operation with a valid options model parameter + @Test + public void testUpdateSettingsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"external_account_identity_interaction\": {\"identity_types\": {\"user\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service_id\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}}}}"; + String updateSettingsPath = "/v1/accounts/testString/settings/access_management"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the IdentityTypesBase model + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the IdentityTypesPatch model + IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() + .user(identityTypesBaseModel) + .serviceId(identityTypesBaseModel) + .service(identityTypesBaseModel) + .build(); + + // Construct an instance of the ExternalAccountIdentityInteractionPatch model + ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() + .identityTypes(identityTypesPatchModel) + .build(); + + // Construct an instance of the UpdateSettingsOptions model + UpdateSettingsOptions updateSettingsOptionsModel = new UpdateSettingsOptions.Builder() + .accountId("testString") + .ifMatch("testString") + .externalAccountIdentityInteraction(externalAccountIdentityInteractionPatchModel) + .acceptLanguage("default") + .build(); + + // Invoke updateSettings() with a valid options model and verify the result + Response response = iamPolicyManagementService.updateSettings(updateSettingsOptionsModel).execute(); + assertNotNull(response); + AccountSettingsAccessManagement 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updateSettingsPath); + // 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 updateSettings operation with and without retries enabled + @Test + public void testUpdateSettingsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdateSettingsWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdateSettingsWOptions(); + } + + // Test the updateSettings operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateSettingsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updateSettings(null).execute(); + } + + // Test the listActionControlTemplates operation with a valid options model parameter + @Test + public void testListActionControlTemplatesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"action_control_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; + String listActionControlTemplatesPath = "/v1/action_control_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListActionControlTemplatesOptions model + ListActionControlTemplatesOptions listActionControlTemplatesOptionsModel = new ListActionControlTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listActionControlTemplates() with a valid options model and verify the result + Response response = iamPolicyManagementService.listActionControlTemplates(listActionControlTemplatesOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplateCollection 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, listActionControlTemplatesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listActionControlTemplates operation with and without retries enabled + @Test + public void testListActionControlTemplatesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListActionControlTemplatesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListActionControlTemplatesWOptions(); + } + + // Test the listActionControlTemplates operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlTemplatesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listActionControlTemplates(null).execute(); + } + + // Test the listActionControlTemplates operation using the ActionControlTemplatesPager.getNext() method + @Test + public void testListActionControlTemplatesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlTemplatesOptions listActionControlTemplatesOptions = new ListActionControlTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + ActionControlTemplatesPager pager = new ActionControlTemplatesPager(iamPolicyManagementService, listActionControlTemplatesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listActionControlTemplates operation using the ActionControlTemplatesPager.getAll() method + @Test + public void testListActionControlTemplatesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlTemplatesOptions listActionControlTemplatesOptions = new ListActionControlTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .limit(Long.valueOf("10")) + .build(); + + ActionControlTemplatesPager pager = new ActionControlTemplatesPager(iamPolicyManagementService, listActionControlTemplatesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createActionControlTemplate operation with a valid options model parameter + @Test + public void testCreateActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String createActionControlTemplatePath = "/v1/action_control_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateActionControl model + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the CreateActionControlTemplateOptions model + CreateActionControlTemplateOptions createActionControlTemplateOptionsModel = new CreateActionControlTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .description("testString") + .committed(true) + .actionControl(templateActionControlModel) + .acceptLanguage("default") + .build(); + + // Invoke createActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.createActionControlTemplate(createActionControlTemplateOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createActionControlTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createActionControlTemplate operation with and without retries enabled + @Test + public void testCreateActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateActionControlTemplateWOptions(); + } + + // Test the createActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createActionControlTemplate(null).execute(); + } + + // Test the getActionControlTemplate operation with a valid options model parameter + @Test + public void testGetActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String getActionControlTemplatePath = "/v1/action_control_templates/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetActionControlTemplateOptions model + GetActionControlTemplateOptions getActionControlTemplateOptionsModel = new GetActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .build(); + + // Invoke getActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.getActionControlTemplate(getActionControlTemplateOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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, getActionControlTemplatePath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + } + + // Test the getActionControlTemplate operation with and without retries enabled + @Test + public void testGetActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetActionControlTemplateWOptions(); + } + + // Test the getActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getActionControlTemplate(null).execute(); + } + + // Test the deleteActionControlTemplate operation with a valid options model parameter + @Test + public void testDeleteActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteActionControlTemplatePath = "/v1/action_control_templates/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteActionControlTemplateOptions model + DeleteActionControlTemplateOptions deleteActionControlTemplateOptionsModel = new DeleteActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .build(); + + // Invoke deleteActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteActionControlTemplate(deleteActionControlTemplateOptionsModel).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, deleteActionControlTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteActionControlTemplate operation with and without retries enabled + @Test + public void testDeleteActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteActionControlTemplateWOptions(); + } + + // Test the deleteActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteActionControlTemplate(null).execute(); + } + + // Test the createActionControlTemplateVersion operation with a valid options model parameter + @Test + public void testCreateActionControlTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String createActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateActionControl model + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the CreateActionControlTemplateVersionOptions model + CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptionsModel = new CreateActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .name("testString") + .description("testString") + .actionControl(templateActionControlModel) + .committed(true) + .build(); + + // Invoke createActionControlTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.createActionControlTemplateVersion(createActionControlTemplateVersionOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createActionControlTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createActionControlTemplateVersion operation with and without retries enabled + @Test + public void testCreateActionControlTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateActionControlTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateActionControlTemplateVersionWOptions(); + } + + // Test the createActionControlTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createActionControlTemplateVersion(null).execute(); + } + + // Test the listActionControlTemplateVersions operation with a valid options model parameter + @Test + public void testListActionControlTemplateVersionsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; + String listActionControlTemplateVersionsPath = "/v1/action_control_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListActionControlTemplateVersionsOptions model + ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptionsModel = new ListActionControlTemplateVersionsOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listActionControlTemplateVersions() with a valid options model and verify the result + Response response = iamPolicyManagementService.listActionControlTemplateVersions(listActionControlTemplateVersionsOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplateVersionsCollection 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, listActionControlTemplateVersionsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listActionControlTemplateVersions operation with and without retries enabled + @Test + public void testListActionControlTemplateVersionsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListActionControlTemplateVersionsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListActionControlTemplateVersionsWOptions(); + } + + // Test the listActionControlTemplateVersions operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlTemplateVersionsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listActionControlTemplateVersions(null).execute(); + } + + // Test the listActionControlTemplateVersions operation using the ActionControlTemplateVersionsPager.getNext() method + @Test + public void testListActionControlTemplateVersionsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions = new ListActionControlTemplateVersionsOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + ActionControlTemplateVersionsPager pager = new ActionControlTemplateVersionsPager(iamPolicyManagementService, listActionControlTemplateVersionsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listActionControlTemplateVersions operation using the ActionControlTemplateVersionsPager.getAll() method + @Test + public void testListActionControlTemplateVersionsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions = new ListActionControlTemplateVersionsOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + ActionControlTemplateVersionsPager pager = new ActionControlTemplateVersionsPager(iamPolicyManagementService, listActionControlTemplateVersionsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the replaceActionControlTemplate operation with a valid options model parameter + @Test + public void testReplaceActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String replaceActionControlTemplatePath = "/v1/action_control_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateActionControl model + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the ReplaceActionControlTemplateOptions model + ReplaceActionControlTemplateOptions replaceActionControlTemplateOptionsModel = new ReplaceActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .actionControl(templateActionControlModel) + .committed(true) + .build(); + + // Invoke replaceActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.replaceActionControlTemplate(replaceActionControlTemplateOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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, replaceActionControlTemplatePath); + // 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 replaceActionControlTemplate operation with and without retries enabled + @Test + public void testReplaceActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplaceActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplaceActionControlTemplateWOptions(); + } + + // Test the replaceActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replaceActionControlTemplate(null).execute(); + } + + // Test the deleteActionControlTemplateVersion operation with a valid options model parameter + @Test + public void testDeleteActionControlTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteActionControlTemplateVersionOptions model + DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptionsModel = new DeleteActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + + // Invoke deleteActionControlTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteActionControlTemplateVersion(deleteActionControlTemplateVersionOptionsModel).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, deleteActionControlTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteActionControlTemplateVersion operation with and without retries enabled + @Test + public void testDeleteActionControlTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteActionControlTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteActionControlTemplateVersionWOptions(); + } + + // Test the deleteActionControlTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteActionControlTemplateVersion(null).execute(); + } + + // Test the getActionControlTemplateVersion operation with a valid options model parameter + @Test + public void testGetActionControlTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String getActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetActionControlTemplateVersionOptions model + GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptionsModel = new GetActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + + // Invoke getActionControlTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.getActionControlTemplateVersion(getActionControlTemplateVersionOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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, getActionControlTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getActionControlTemplateVersion operation with and without retries enabled + @Test + public void testGetActionControlTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetActionControlTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetActionControlTemplateVersionWOptions(); + } + + // Test the getActionControlTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getActionControlTemplateVersion(null).execute(); + } + + // Test the commitActionControlTemplate operation with a valid options model parameter + @Test + public void testCommitActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String commitActionControlTemplatePath = "/v1/action_control_templates/testString/versions/testString/commit"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the CommitActionControlTemplateOptions model + CommitActionControlTemplateOptions commitActionControlTemplateOptionsModel = new CommitActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + + // Invoke commitActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.commitActionControlTemplate(commitActionControlTemplateOptionsModel).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, commitActionControlTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the commitActionControlTemplate operation with and without retries enabled + @Test + public void testCommitActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCommitActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCommitActionControlTemplateWOptions(); + } + + // Test the commitActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.commitActionControlTemplate(null).execute(); + } + + // Test the listActionControlAssignments operation with a valid options model parameter + @Test + public void testListActionControlAssignmentsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; + String listActionControlAssignmentsPath = "/v1/action_control_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListActionControlAssignmentsOptions model + ListActionControlAssignmentsOptions listActionControlAssignmentsOptionsModel = new ListActionControlAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listActionControlAssignments() with a valid options model and verify the result + Response response = iamPolicyManagementService.listActionControlAssignments(listActionControlAssignmentsOptionsModel).execute(); + assertNotNull(response); + ActionControlAssignmentCollection 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, listActionControlAssignmentsPath); + // 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(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listActionControlAssignments operation with and without retries enabled + @Test + public void testListActionControlAssignmentsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListActionControlAssignmentsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListActionControlAssignmentsWOptions(); + } + + // Test the listActionControlAssignments operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlAssignmentsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listActionControlAssignments(null).execute(); + } + + // Test the listActionControlAssignments operation using the ActionControlAssignmentsPager.getNext() method + @Test + public void testListActionControlAssignmentsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlAssignmentsOptions listActionControlAssignmentsOptions = new ListActionControlAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + ActionControlAssignmentsPager pager = new ActionControlAssignmentsPager(iamPolicyManagementService, listActionControlAssignmentsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listActionControlAssignments operation using the ActionControlAssignmentsPager.getAll() method + @Test + public void testListActionControlAssignmentsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlAssignmentsOptions listActionControlAssignmentsOptions = new ListActionControlAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + ActionControlAssignmentsPager pager = new ActionControlAssignmentsPager(iamPolicyManagementService, listActionControlAssignmentsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createActionControlTemplateAssignment operation with a valid options model parameter + @Test + public void testCreateActionControlTemplateAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; + String createActionControlTemplateAssignmentPath = "/v1/action_control_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the AssignmentTargetDetails model + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + + // Construct an instance of the ActionControlAssignmentTemplate model + ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + + // Construct an instance of the CreateActionControlTemplateAssignmentOptions model + CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptionsModel = new CreateActionControlTemplateAssignmentOptions.Builder() + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(actionControlAssignmentTemplateModel)) + .acceptLanguage("default") + .build(); + + // Invoke createActionControlTemplateAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.createActionControlTemplateAssignment(createActionControlTemplateAssignmentOptionsModel).execute(); + assertNotNull(response); + ActionControlAssignmentCollection 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createActionControlTemplateAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createActionControlTemplateAssignment operation with and without retries enabled + @Test + public void testCreateActionControlTemplateAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateActionControlTemplateAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateActionControlTemplateAssignmentWOptions(); + } + + // Test the createActionControlTemplateAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createActionControlTemplateAssignment(null).execute(); + } + + // Test the getActionControlAssignment operation with a valid options model parameter + @Test + public void testGetActionControlAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; + String getActionControlAssignmentPath = "/v1/action_control_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetActionControlAssignmentOptions model + GetActionControlAssignmentOptions getActionControlAssignmentOptionsModel = new GetActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke getActionControlAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.getActionControlAssignment(getActionControlAssignmentOptionsModel).execute(); + assertNotNull(response); + ActionControlAssignment 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, getActionControlAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getActionControlAssignment operation with and without retries enabled + @Test + public void testGetActionControlAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetActionControlAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetActionControlAssignmentWOptions(); + } + + // Test the getActionControlAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getActionControlAssignment(null).execute(); + } + + // Test the updateActionControlAssignment operation with a valid options model parameter + @Test + public void testUpdateActionControlAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; + String updateActionControlAssignmentPath = "/v1/action_control_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdateActionControlAssignmentOptions model + UpdateActionControlAssignmentOptions updateActionControlAssignmentOptionsModel = new UpdateActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .ifMatch("testString") + .templateVersion("testString") + .build(); + + // Invoke updateActionControlAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.updateActionControlAssignment(updateActionControlAssignmentOptionsModel).execute(); + assertNotNull(response); + ActionControlAssignment 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updateActionControlAssignmentPath); + // 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 updateActionControlAssignment operation with and without retries enabled + @Test + public void testUpdateActionControlAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdateActionControlAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdateActionControlAssignmentWOptions(); + } + + // Test the updateActionControlAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateActionControlAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updateActionControlAssignment(null).execute(); + } + + // Test the deleteActionControlAssignment operation with a valid options model parameter + @Test + public void testDeleteActionControlAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteActionControlAssignmentPath = "/v1/action_control_assignments/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteActionControlAssignmentOptions model + DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptionsModel = new DeleteActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke deleteActionControlAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteActionControlAssignment(deleteActionControlAssignmentOptionsModel).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, deleteActionControlAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteActionControlAssignment operation with and without retries enabled + @Test + public void testDeleteActionControlAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteActionControlAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteActionControlAssignmentWOptions(); + } + + // Test the deleteActionControlAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteActionControlAssignment(null).execute(); + } + + // Test the listRoleTemplates operation with a valid options model parameter + @Test + public void testListRoleTemplatesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"role_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; + String listRoleTemplatesPath = "/v1/role_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListRoleTemplatesOptions model + ListRoleTemplatesOptions listRoleTemplatesOptionsModel = new ListRoleTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .name("testString") + .roleName("testString") + .roleServiceName("testString") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listRoleTemplates() with a valid options model and verify the result + Response response = iamPolicyManagementService.listRoleTemplates(listRoleTemplatesOptionsModel).execute(); + assertNotNull(response); + RoleTemplateCollection 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, listRoleTemplatesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("name"), "testString"); + assertEquals(query.get("role_name"), "testString"); + assertEquals(query.get("role_service_name"), "testString"); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listRoleTemplates operation with and without retries enabled + @Test + public void testListRoleTemplatesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListRoleTemplatesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListRoleTemplatesWOptions(); + } + + // Test the listRoleTemplates operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleTemplatesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listRoleTemplates(null).execute(); + } + + // Test the listRoleTemplates operation using the RoleTemplatesPager.getNext() method + @Test + public void testListRoleTemplatesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleTemplatesOptions listRoleTemplatesOptions = new ListRoleTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .name("testString") + .roleName("testString") + .roleServiceName("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + RoleTemplatesPager pager = new RoleTemplatesPager(iamPolicyManagementService, listRoleTemplatesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listRoleTemplates operation using the RoleTemplatesPager.getAll() method + @Test + public void testListRoleTemplatesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleTemplatesOptions listRoleTemplatesOptions = new ListRoleTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .name("testString") + .roleName("testString") + .roleServiceName("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + RoleTemplatesPager pager = new RoleTemplatesPager(iamPolicyManagementService, listRoleTemplatesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createRoleTemplate operation with a valid options model parameter + @Test + public void testCreateRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String createRoleTemplatePath = "/v1/role_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the RoleTemplatePrototypeRole model + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() + .name("testString") + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the CreateRoleTemplateOptions model + CreateRoleTemplateOptions createRoleTemplateOptionsModel = new CreateRoleTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .description("testString") + .committed(true) + .role(roleTemplatePrototypeRoleModel) + .acceptLanguage("default") + .build(); + + // Invoke createRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.createRoleTemplate(createRoleTemplateOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createRoleTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createRoleTemplate operation with and without retries enabled + @Test + public void testCreateRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateRoleTemplateWOptions(); + } + + // Test the createRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createRoleTemplate(null).execute(); + } + + // Test the getRoleTemplate operation with a valid options model parameter + @Test + public void testGetRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String getRoleTemplatePath = "/v1/role_templates/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetRoleTemplateOptions model + GetRoleTemplateOptions getRoleTemplateOptionsModel = new GetRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .state("active") + .build(); + + // Invoke getRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.getRoleTemplate(getRoleTemplateOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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, getRoleTemplatePath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + } + + // Test the getRoleTemplate operation with and without retries enabled + @Test + public void testGetRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetRoleTemplateWOptions(); + } + + // Test the getRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getRoleTemplate(null).execute(); + } + + // Test the deleteRoleTemplate operation with a valid options model parameter + @Test + public void testDeleteRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteRoleTemplatePath = "/v1/role_templates/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteRoleTemplateOptions model + DeleteRoleTemplateOptions deleteRoleTemplateOptionsModel = new DeleteRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .build(); + + // Invoke deleteRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteRoleTemplate(deleteRoleTemplateOptionsModel).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, deleteRoleTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteRoleTemplate operation with and without retries enabled + @Test + public void testDeleteRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteRoleTemplateWOptions(); + } + + // Test the deleteRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteRoleTemplate(null).execute(); + } + + // Test the createRoleTemplateVersion operation with a valid options model parameter + @Test + public void testCreateRoleTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String createRoleTemplateVersionPath = "/v1/role_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateRole model + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the CreateRoleTemplateVersionOptions model + CreateRoleTemplateVersionOptions createRoleTemplateVersionOptionsModel = new CreateRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .name("testString") + .description("testString") + .role(templateRoleModel) + .committed(true) + .build(); + + // Invoke createRoleTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.createRoleTemplateVersion(createRoleTemplateVersionOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createRoleTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createRoleTemplateVersion operation with and without retries enabled + @Test + public void testCreateRoleTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateRoleTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateRoleTemplateVersionWOptions(); + } + + // Test the createRoleTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createRoleTemplateVersion(null).execute(); + } + + // Test the listRoleTemplateVersions operation with a valid options model parameter + @Test + public void testListRoleTemplateVersionsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; + String listRoleTemplateVersionsPath = "/v1/role_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListRoleTemplateVersionsOptions model + ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptionsModel = new ListRoleTemplateVersionsOptions.Builder() + .roleTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listRoleTemplateVersions() with a valid options model and verify the result + Response response = iamPolicyManagementService.listRoleTemplateVersions(listRoleTemplateVersionsOptionsModel).execute(); + assertNotNull(response); + RoleTemplateVersionsCollection 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, listRoleTemplateVersionsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listRoleTemplateVersions operation with and without retries enabled + @Test + public void testListRoleTemplateVersionsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListRoleTemplateVersionsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListRoleTemplateVersionsWOptions(); + } + + // Test the listRoleTemplateVersions operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleTemplateVersionsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listRoleTemplateVersions(null).execute(); + } + + // Test the listRoleTemplateVersions operation using the RoleTemplateVersionsPager.getNext() method + @Test + public void testListRoleTemplateVersionsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions = new ListRoleTemplateVersionsOptions.Builder() + .roleTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + RoleTemplateVersionsPager pager = new RoleTemplateVersionsPager(iamPolicyManagementService, listRoleTemplateVersionsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listRoleTemplateVersions operation using the RoleTemplateVersionsPager.getAll() method + @Test + public void testListRoleTemplateVersionsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions = new ListRoleTemplateVersionsOptions.Builder() + .roleTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + RoleTemplateVersionsPager pager = new RoleTemplateVersionsPager(iamPolicyManagementService, listRoleTemplateVersionsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the replaceRoleTemplate operation with a valid options model parameter + @Test + public void testReplaceRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String replaceRoleTemplatePath = "/v1/role_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateRole model + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the ReplaceRoleTemplateOptions model + ReplaceRoleTemplateOptions replaceRoleTemplateOptionsModel = new ReplaceRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .role(templateRoleModel) + .committed(true) + .build(); + + // Invoke replaceRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.replaceRoleTemplate(replaceRoleTemplateOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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, replaceRoleTemplatePath); + // 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 replaceRoleTemplate operation with and without retries enabled + @Test + public void testReplaceRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplaceRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplaceRoleTemplateWOptions(); + } + + // Test the replaceRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replaceRoleTemplate(null).execute(); + } + + // Test the deleteRoleTemplateVersion operation with a valid options model parameter + @Test + public void testDeleteRoleTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteRoleTemplateVersionPath = "/v1/role_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteRoleTemplateVersionOptions model + DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptionsModel = new DeleteRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + + // Invoke deleteRoleTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteRoleTemplateVersion(deleteRoleTemplateVersionOptionsModel).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, deleteRoleTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteRoleTemplateVersion operation with and without retries enabled + @Test + public void testDeleteRoleTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteRoleTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteRoleTemplateVersionWOptions(); + } + + // Test the deleteRoleTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteRoleTemplateVersion(null).execute(); + } + + // Test the getRoleTemplateVersion operation with a valid options model parameter + @Test + public void testGetRoleTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String getRoleTemplateVersionPath = "/v1/role_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetRoleTemplateVersionOptions model + GetRoleTemplateVersionOptions getRoleTemplateVersionOptionsModel = new GetRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + + // Invoke getRoleTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.getRoleTemplateVersion(getRoleTemplateVersionOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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, getRoleTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getRoleTemplateVersion operation with and without retries enabled + @Test + public void testGetRoleTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetRoleTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetRoleTemplateVersionWOptions(); + } + + // Test the getRoleTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getRoleTemplateVersion(null).execute(); + } + + // Test the commitRoleTemplate operation with a valid options model parameter + @Test + public void testCommitRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String commitRoleTemplatePath = "/v1/role_templates/testString/versions/testString/commit"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the CommitRoleTemplateOptions model + CommitRoleTemplateOptions commitRoleTemplateOptionsModel = new CommitRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + + // Invoke commitRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.commitRoleTemplate(commitRoleTemplateOptionsModel).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, commitRoleTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the commitRoleTemplate operation with and without retries enabled + @Test + public void testCommitRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCommitRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCommitRoleTemplateWOptions(); + } + + // Test the commitRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.commitRoleTemplate(null).execute(); + } + + // Test the listRoleAssignments operation with a valid options model parameter + @Test + public void testListRoleAssignmentsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; + String listRoleAssignmentsPath = "/v1/role_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListRoleAssignmentsOptions model + ListRoleAssignmentsOptions listRoleAssignmentsOptionsModel = new ListRoleAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listRoleAssignments() with a valid options model and verify the result + Response response = iamPolicyManagementService.listRoleAssignments(listRoleAssignmentsOptionsModel).execute(); + assertNotNull(response); + RoleAssignmentCollection 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, listRoleAssignmentsPath); + // 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(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listRoleAssignments operation with and without retries enabled + @Test + public void testListRoleAssignmentsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListRoleAssignmentsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListRoleAssignmentsWOptions(); + } + + // Test the listRoleAssignments operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleAssignmentsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listRoleAssignments(null).execute(); + } + + // Test the listRoleAssignments operation using the RoleAssignmentsPager.getNext() method + @Test + public void testListRoleAssignmentsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleAssignmentsOptions listRoleAssignmentsOptions = new ListRoleAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + RoleAssignmentsPager pager = new RoleAssignmentsPager(iamPolicyManagementService, listRoleAssignmentsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listRoleAssignments operation using the RoleAssignmentsPager.getAll() method + @Test + public void testListRoleAssignmentsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleAssignmentsOptions listRoleAssignmentsOptions = new ListRoleAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + RoleAssignmentsPager pager = new RoleAssignmentsPager(iamPolicyManagementService, listRoleAssignmentsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createRoleTemplateAssignment operation with a valid options model parameter + @Test + public void testCreateRoleTemplateAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; + String createRoleTemplateAssignmentPath = "/v1/role_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the AssignmentTargetDetails model + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + + // Construct an instance of the RoleAssignmentTemplate model + RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + + // Construct an instance of the CreateRoleTemplateAssignmentOptions model + CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptionsModel = new CreateRoleTemplateAssignmentOptions.Builder() + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(roleAssignmentTemplateModel)) + .acceptLanguage("default") + .build(); + + // Invoke createRoleTemplateAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.createRoleTemplateAssignment(createRoleTemplateAssignmentOptionsModel).execute(); + assertNotNull(response); + RoleAssignmentCollection 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createRoleTemplateAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createRoleTemplateAssignment operation with and without retries enabled + @Test + public void testCreateRoleTemplateAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateRoleTemplateAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateRoleTemplateAssignmentWOptions(); + } + + // Test the createRoleTemplateAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createRoleTemplateAssignment(null).execute(); + } + + // Test the getRoleAssignment operation with a valid options model parameter + @Test + public void testGetRoleAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; + String getRoleAssignmentPath = "/v1/role_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetRoleAssignmentOptions model + GetRoleAssignmentOptions getRoleAssignmentOptionsModel = new GetRoleAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke getRoleAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.getRoleAssignment(getRoleAssignmentOptionsModel).execute(); + assertNotNull(response); + RoleAssignment 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, getRoleAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getRoleAssignment operation with and without retries enabled + @Test + public void testGetRoleAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetRoleAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetRoleAssignmentWOptions(); + } + + // Test the getRoleAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getRoleAssignment(null).execute(); + } + + // Test the updateRoleAssignment operation with a valid options model parameter + @Test + public void testUpdateRoleAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; + String updateRoleAssignmentPath = "/v1/role_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdateRoleAssignmentOptions model + UpdateRoleAssignmentOptions updateRoleAssignmentOptionsModel = new UpdateRoleAssignmentOptions.Builder() + .assignmentId("testString") + .ifMatch("testString") + .templateVersion("testString") + .build(); + + // Invoke updateRoleAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.updateRoleAssignment(updateRoleAssignmentOptionsModel).execute(); + assertNotNull(response); + RoleAssignment 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updateRoleAssignmentPath); + // 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 updateRoleAssignment operation with and without retries enabled + @Test + public void testUpdateRoleAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdateRoleAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdateRoleAssignmentWOptions(); + } + + // Test the updateRoleAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateRoleAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updateRoleAssignment(null).execute(); + } + + // Test the deleteRoleAssignment operation with a valid options model parameter + @Test + public void testDeleteRoleAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteRoleAssignmentPath = "/v1/role_assignments/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteRoleAssignmentOptions model + DeleteRoleAssignmentOptions deleteRoleAssignmentOptionsModel = new DeleteRoleAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke deleteRoleAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteRoleAssignment(deleteRoleAssignmentOptionsModel).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, deleteRoleAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteRoleAssignment operation with and without retries enabled + @Test + public void testDeleteRoleAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteRoleAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteRoleAssignmentWOptions(); + } + + // Test the deleteRoleAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteRoleAssignment(null).execute(); + } + + // Perform setup needed before each test method + @BeforeMethod + public void beforeEachTest() { + // Start the mock server. + try { + server = new MockWebServer(); + server.start(); + } catch (IOException err) { + fail("Failed to instantiate mock web server"); + } + + // Construct an instance of the service + constructClientService(); + } + + // Perform tear down after each test method + @AfterMethod + public void afterEachTest() throws IOException { + server.shutdown(); + iamPolicyManagementService = null; + } + + // Constructs an instance of the service to be used by the tests + public void constructClientService() { + System.setProperty("TESTSERVICE_AUTH_TYPE", "noAuth"); + final String serviceName = "testService"; + + iamPolicyManagementService = IamPolicyManagement.newInstance(serviceName); + String url = server.url("/").toString(); + iamPolicyManagementService.setServiceUrl(url); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java new file mode 100644 index 00000000000..5630ccb0c03 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.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 AccountSettingsAccessManagement model. + */ +public class AccountSettingsAccessManagementTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAccountSettingsAccessManagement() throws Throwable { + AccountSettingsAccessManagement accountSettingsAccessManagementModel = new AccountSettingsAccessManagement(); + assertNull(accountSettingsAccessManagementModel.getExternalAccountIdentityInteraction()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java new file mode 100644 index 00000000000..d4dfc8863c6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentCollection model. + */ +public class ActionControlAssignmentCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentCollection() throws Throwable { + ActionControlAssignmentCollection actionControlAssignmentCollectionModel = new ActionControlAssignmentCollection(); + assertNull(actionControlAssignmentCollectionModel.getLimit()); + assertNull(actionControlAssignmentCollectionModel.getFirst()); + assertNull(actionControlAssignmentCollectionModel.getNext()); + assertNull(actionControlAssignmentCollectionModel.getPrevious()); + assertNull(actionControlAssignmentCollectionModel.getAssignments()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java new file mode 100644 index 00000000000..cb53bc44d1c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java @@ -0,0 +1,43 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResourceActionControl model. + */ +public class ActionControlAssignmentResourceActionControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentResourceActionControl() throws Throwable { + ActionControlAssignmentResourceActionControl actionControlAssignmentResourceActionControlModel = new ActionControlAssignmentResourceActionControl(); + assertNull(actionControlAssignmentResourceActionControlModel.getResourceCreated()); + assertNull(actionControlAssignmentResourceActionControlModel.getErrorMessage()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java new file mode 100644 index 00000000000..284ec17a0f0 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResourceCreated model. + */ +public class ActionControlAssignmentResourceCreatedTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentResourceCreated() throws Throwable { + ActionControlAssignmentResourceCreated actionControlAssignmentResourceCreatedModel = new ActionControlAssignmentResourceCreated(); + assertNull(actionControlAssignmentResourceCreatedModel.getId()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java new file mode 100644 index 00000000000..eaa560dce78 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResource model. + */ +public class ActionControlAssignmentResourceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentResource() throws Throwable { + ActionControlAssignmentResource actionControlAssignmentResourceModel = new ActionControlAssignmentResource(); + assertNull(actionControlAssignmentResourceModel.getTarget()); + assertNull(actionControlAssignmentResourceModel.getActionControl()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java new file mode 100644 index 00000000000..262a74bea45 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentTemplate model. + */ +public class ActionControlAssignmentTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentTemplate() throws Throwable { + ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(actionControlAssignmentTemplateModel.id(), "testString"); + assertEquals(actionControlAssignmentTemplateModel.version(), "testString"); + + String json = TestUtilities.serialize(actionControlAssignmentTemplateModel); + + ActionControlAssignmentTemplate actionControlAssignmentTemplateModelNew = TestUtilities.deserialize(json, ActionControlAssignmentTemplate.class); + assertTrue(actionControlAssignmentTemplateModelNew instanceof ActionControlAssignmentTemplate); + assertEquals(actionControlAssignmentTemplateModelNew.id(), "testString"); + assertEquals(actionControlAssignmentTemplateModelNew.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testActionControlAssignmentTemplateError() throws Throwable { + new ActionControlAssignmentTemplate.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java new file mode 100644 index 00000000000..c5173f940c4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignment model. + */ +public class ActionControlAssignmentTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignment() throws Throwable { + ActionControlAssignment actionControlAssignmentModel = new ActionControlAssignment(); + assertNull(actionControlAssignmentModel.getTemplate()); + assertNull(actionControlAssignmentModel.getTarget()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java new file mode 100644 index 00000000000..58155ee1e7e --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java @@ -0,0 +1,46 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplateCollection model. + */ +public class ActionControlTemplateCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlTemplateCollection() throws Throwable { + ActionControlTemplateCollection actionControlTemplateCollectionModel = new ActionControlTemplateCollection(); + assertNull(actionControlTemplateCollectionModel.getLimit()); + assertNull(actionControlTemplateCollectionModel.getFirst()); + assertNull(actionControlTemplateCollectionModel.getNext()); + assertNull(actionControlTemplateCollectionModel.getPrevious()); + assertNull(actionControlTemplateCollectionModel.getActionControlTemplates()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java new file mode 100644 index 00000000000..a086106a57e --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplate model. + */ +public class ActionControlTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlTemplate() throws Throwable { + ActionControlTemplate actionControlTemplateModel = new ActionControlTemplate(); + assertNull(actionControlTemplateModel.getName()); + assertNull(actionControlTemplateModel.getDescription()); + assertNull(actionControlTemplateModel.getAccountId()); + assertNull(actionControlTemplateModel.isCommitted()); + assertNull(actionControlTemplateModel.getActionControl()); + assertNull(actionControlTemplateModel.getVersion()); + assertNull(actionControlTemplateModel.getState()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java new file mode 100644 index 00000000000..7b6bf014357 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java @@ -0,0 +1,46 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplateVersionsCollection model. + */ +public class ActionControlTemplateVersionsCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlTemplateVersionsCollection() throws Throwable { + ActionControlTemplateVersionsCollection actionControlTemplateVersionsCollectionModel = new ActionControlTemplateVersionsCollection(); + assertNull(actionControlTemplateVersionsCollectionModel.getLimit()); + assertNull(actionControlTemplateVersionsCollectionModel.getFirst()); + assertNull(actionControlTemplateVersionsCollectionModel.getNext()); + assertNull(actionControlTemplateVersionsCollectionModel.getPrevious()); + assertNull(actionControlTemplateVersionsCollectionModel.getVersions()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java new file mode 100644 index 00000000000..4038d52606c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentResourceCreated model. + */ +public class AssignmentResourceCreatedTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAssignmentResourceCreated() throws Throwable { + AssignmentResourceCreated assignmentResourceCreatedModel = new AssignmentResourceCreated(); + assertNull(assignmentResourceCreatedModel.getId()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java new file mode 100644 index 00000000000..81e3799a42c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentResourceError model. + */ +public class AssignmentResourceErrorTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAssignmentResourceError() throws Throwable { + AssignmentResourceError assignmentResourceErrorModel = new AssignmentResourceError(); + assertNull(assignmentResourceErrorModel.getName()); + assertNull(assignmentResourceErrorModel.getErrorCode()); + assertNull(assignmentResourceErrorModel.getMessage()); + assertNull(assignmentResourceErrorModel.getCode()); + assertNull(assignmentResourceErrorModel.getErrors()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java new file mode 100644 index 00000000000..48e4a605cbb --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentTargetDetails model. + */ +public class AssignmentTargetDetailsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAssignmentTargetDetails() throws Throwable { + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + assertEquals(assignmentTargetDetailsModel.type(), "Account"); + assertEquals(assignmentTargetDetailsModel.id(), "testString"); + + String json = TestUtilities.serialize(assignmentTargetDetailsModel); + + AssignmentTargetDetails assignmentTargetDetailsModelNew = TestUtilities.deserialize(json, AssignmentTargetDetails.class); + assertTrue(assignmentTargetDetailsModelNew instanceof AssignmentTargetDetails); + assertEquals(assignmentTargetDetailsModelNew.type(), "Account"); + assertEquals(assignmentTargetDetailsModelNew.id(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testAssignmentTargetDetailsError() throws Throwable { + new AssignmentTargetDetails.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java new file mode 100644 index 00000000000..bcecf27ed27 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java @@ -0,0 +1,48 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentTemplateDetails model. + */ +public class AssignmentTemplateDetailsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAssignmentTemplateDetails() throws Throwable { + AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(assignmentTemplateDetailsModel.id(), "testString"); + assertEquals(assignmentTemplateDetailsModel.version(), "testString"); + + String json = TestUtilities.serialize(assignmentTemplateDetailsModel); + + AssignmentTemplateDetails assignmentTemplateDetailsModelNew = TestUtilities.deserialize(json, AssignmentTemplateDetails.class); + assertTrue(assignmentTemplateDetailsModelNew instanceof AssignmentTemplateDetails); + assertEquals(assignmentTemplateDetailsModelNew.id(), "testString"); + assertEquals(assignmentTemplateDetailsModelNew.version(), "testString"); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..2b5ed42c76a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CommitActionControlTemplateOptions model. + */ +public class CommitActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCommitActionControlTemplateOptions() throws Throwable { + CommitActionControlTemplateOptions commitActionControlTemplateOptionsModel = new CommitActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + assertEquals(commitActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(commitActionControlTemplateOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitActionControlTemplateOptionsError() throws Throwable { + new CommitActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..66cdca59588 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CommitPolicyTemplateOptions model. + */ +public class CommitPolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCommitPolicyTemplateOptions() throws Throwable { + CommitPolicyTemplateOptions commitPolicyTemplateOptionsModel = new CommitPolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + assertEquals(commitPolicyTemplateOptionsModel.policyTemplateId(), "testString"); + assertEquals(commitPolicyTemplateOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitPolicyTemplateOptionsError() throws Throwable { + new CommitPolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..09c48b8e80e --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CommitRoleTemplateOptions model. + */ +public class CommitRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCommitRoleTemplateOptions() throws Throwable { + CommitRoleTemplateOptions commitRoleTemplateOptionsModel = new CommitRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + assertEquals(commitRoleTemplateOptionsModel.roleTemplateId(), "testString"); + assertEquals(commitRoleTemplateOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitRoleTemplateOptionsError() throws Throwable { + new CommitRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java new file mode 100644 index 00000000000..94ef6ce21e8 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.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 ConflictsWith model. + */ +public class ConflictsWithTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testConflictsWith() throws Throwable { + ConflictsWith conflictsWithModel = new ConflictsWith(); + assertNull(conflictsWithModel.getEtag()); + assertNull(conflictsWithModel.getRole()); + assertNull(conflictsWithModel.getPolicy()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java new file mode 100644 index 00000000000..bbe19a7b9b1 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponseControl model. + */ +public class ControlResponseControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testControlResponseControl() throws Throwable { + ControlResponseControl controlResponseControlModel = new ControlResponseControl(); + assertNull(controlResponseControlModel.getGrant()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java new file mode 100644 index 00000000000..7b2fbfae90d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControlWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponseControlWithEnrichedRoles model. + */ +public class ControlResponseControlWithEnrichedRolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testControlResponseControlWithEnrichedRoles() throws Throwable { + ControlResponseControlWithEnrichedRoles controlResponseControlWithEnrichedRolesModel = new ControlResponseControlWithEnrichedRoles(); + assertNull(controlResponseControlWithEnrichedRolesModel.getGrant()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java new file mode 100644 index 00000000000..f42cbc0a2d8 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponse; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponse model. + */ +public class ControlResponseTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testControlResponse() throws Throwable { + ControlResponse controlResponseModel = new ControlResponse(); + assertNotNull(controlResponseModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java new file mode 100644 index 00000000000..c8b1e3000f9 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 Control model. + */ +public class ControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testControl() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + assertEquals(controlModel.grant(), grantModel); + + String json = TestUtilities.serialize(controlModel); + + Control controlModelNew = TestUtilities.deserialize(json, Control.class); + assertTrue(controlModelNew instanceof Control); + assertEquals(controlModelNew.grant().toString(), grantModel.toString()); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testControlError() throws Throwable { + new Control.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java new file mode 100644 index 00000000000..f2557c8f64f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateAssignmentOptions model. + */ +public class CreateActionControlTemplateAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateActionControlTemplateAssignmentOptions() throws Throwable { + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + assertEquals(assignmentTargetDetailsModel.type(), "Account"); + assertEquals(assignmentTargetDetailsModel.id(), "testString"); + + ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(actionControlAssignmentTemplateModel.id(), "testString"); + assertEquals(actionControlAssignmentTemplateModel.version(), "testString"); + + CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptionsModel = new CreateActionControlTemplateAssignmentOptions.Builder() + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(actionControlAssignmentTemplateModel)) + .acceptLanguage("default") + .build(); + assertEquals(createActionControlTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); + assertEquals(createActionControlTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(actionControlAssignmentTemplateModel)); + assertEquals(createActionControlTemplateAssignmentOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateAssignmentOptionsError() throws Throwable { + new CreateActionControlTemplateAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..2508072a03c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateOptions model. + */ +public class CreateActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateActionControlTemplateOptions() throws Throwable { + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateActionControlModel.serviceName(), "testString"); + assertEquals(templateActionControlModel.description(), "testString"); + assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); + + CreateActionControlTemplateOptions createActionControlTemplateOptionsModel = new CreateActionControlTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .description("testString") + .committed(true) + .actionControl(templateActionControlModel) + .acceptLanguage("default") + .build(); + assertEquals(createActionControlTemplateOptionsModel.name(), "testString"); + assertEquals(createActionControlTemplateOptionsModel.accountId(), "testString"); + assertEquals(createActionControlTemplateOptionsModel.description(), "testString"); + assertEquals(createActionControlTemplateOptionsModel.committed(), Boolean.valueOf(true)); + assertEquals(createActionControlTemplateOptionsModel.actionControl(), templateActionControlModel); + assertEquals(createActionControlTemplateOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateOptionsError() throws Throwable { + new CreateActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..d5070249115 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateVersionOptions model. + */ +public class CreateActionControlTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateActionControlTemplateVersionOptions() throws Throwable { + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateActionControlModel.serviceName(), "testString"); + assertEquals(templateActionControlModel.description(), "testString"); + assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); + + CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptionsModel = new CreateActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .name("testString") + .description("testString") + .actionControl(templateActionControlModel) + .committed(true) + .build(); + assertEquals(createActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(createActionControlTemplateVersionOptionsModel.name(), "testString"); + assertEquals(createActionControlTemplateVersionOptionsModel.description(), "testString"); + assertEquals(createActionControlTemplateVersionOptionsModel.actionControl(), templateActionControlModel); + assertEquals(createActionControlTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateVersionOptionsError() throws Throwable { + new CreateActionControlTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java new file mode 100644 index 00000000000..c2dd24fd213 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java @@ -0,0 +1,103 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyOptions model. + */ +public class CreatePolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreatePolicyOptions() throws Throwable { + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(subjectAttributeModel.name(), "testString"); + assertEquals(subjectAttributeModel.value(), "testString"); + + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); + + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + assertEquals(policyRoleModel.roleId(), "testString"); + + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceAttributeModel.name(), "testString"); + assertEquals(resourceAttributeModel.value(), "testString"); + assertEquals(resourceAttributeModel.operator(), "testString"); + + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceTagModel.name(), "testString"); + assertEquals(resourceTagModel.value(), "testString"); + assertEquals(resourceTagModel.operator(), "testString"); + + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); + assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); + + CreatePolicyOptions createPolicyOptionsModel = new CreatePolicyOptions.Builder() + .type("testString") + .subjects(java.util.Arrays.asList(policySubjectModel)) + .roles(java.util.Arrays.asList(policyRoleModel)) + .resources(java.util.Arrays.asList(policyResourceModel)) + .description("testString") + .acceptLanguage("default") + .build(); + assertEquals(createPolicyOptionsModel.type(), "testString"); + assertEquals(createPolicyOptionsModel.subjects(), java.util.Arrays.asList(policySubjectModel)); + assertEquals(createPolicyOptionsModel.roles(), java.util.Arrays.asList(policyRoleModel)); + assertEquals(createPolicyOptionsModel.resources(), java.util.Arrays.asList(policyResourceModel)); + assertEquals(createPolicyOptionsModel.description(), "testString"); + assertEquals(createPolicyOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyOptionsError() throws Throwable { + new CreatePolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java new file mode 100644 index 00000000000..5b08b4b398a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java @@ -0,0 +1,67 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateAssignmentOptions model. + */ +public class CreatePolicyTemplateAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreatePolicyTemplateAssignmentOptions() throws Throwable { + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + assertEquals(assignmentTargetDetailsModel.type(), "Account"); + assertEquals(assignmentTargetDetailsModel.id(), "testString"); + + AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(assignmentTemplateDetailsModel.id(), "testString"); + assertEquals(assignmentTemplateDetailsModel.version(), "testString"); + + CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptionsModel = new CreatePolicyTemplateAssignmentOptions.Builder() + .version("1.0") + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(assignmentTemplateDetailsModel)) + .acceptLanguage("default") + .build(); + assertEquals(createPolicyTemplateAssignmentOptionsModel.version(), "1.0"); + assertEquals(createPolicyTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); + assertEquals(createPolicyTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(assignmentTemplateDetailsModel)); + assertEquals(createPolicyTemplateAssignmentOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateAssignmentOptionsError() throws Throwable { + new CreatePolicyTemplateAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..68617451831 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java @@ -0,0 +1,145 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateOptions model. + */ +public class CreatePolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreatePolicyTemplateOptions() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + assertEquals(templatePolicyModel.type(), "access"); + assertEquals(templatePolicyModel.description(), "testString"); + assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); + assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); + assertEquals(templatePolicyModel.pattern(), "testString"); + assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); + assertEquals(templatePolicyModel.control(), templateControlModel); + + CreatePolicyTemplateOptions createPolicyTemplateOptionsModel = new CreatePolicyTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .policy(templatePolicyModel) + .description("testString") + .committed(true) + .acceptLanguage("default") + .build(); + assertEquals(createPolicyTemplateOptionsModel.name(), "testString"); + assertEquals(createPolicyTemplateOptionsModel.accountId(), "testString"); + assertEquals(createPolicyTemplateOptionsModel.policy(), templatePolicyModel); + assertEquals(createPolicyTemplateOptionsModel.description(), "testString"); + assertEquals(createPolicyTemplateOptionsModel.committed(), Boolean.valueOf(true)); + assertEquals(createPolicyTemplateOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateOptionsError() throws Throwable { + new CreatePolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..d6919e6e1b9 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java @@ -0,0 +1,143 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateVersionOptions model. + */ +public class CreatePolicyTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreatePolicyTemplateVersionOptions() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + assertEquals(templatePolicyModel.type(), "access"); + assertEquals(templatePolicyModel.description(), "testString"); + assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); + assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); + assertEquals(templatePolicyModel.pattern(), "testString"); + assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); + assertEquals(templatePolicyModel.control(), templateControlModel); + + CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptionsModel = new CreatePolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .policy(templatePolicyModel) + .name("testString") + .description("testString") + .committed(true) + .build(); + assertEquals(createPolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); + assertEquals(createPolicyTemplateVersionOptionsModel.policy(), templatePolicyModel); + assertEquals(createPolicyTemplateVersionOptionsModel.name(), "testString"); + assertEquals(createPolicyTemplateVersionOptionsModel.description(), "testString"); + assertEquals(createPolicyTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateVersionOptionsError() throws Throwable { + new CreatePolicyTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java new file mode 100644 index 00000000000..849512f2bda --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleOptions model. + */ +public class CreateRoleOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateRoleOptions() throws Throwable { + CreateRoleOptions createRoleOptionsModel = new CreateRoleOptions.Builder() + .displayName("testString") + .actions(java.util.Arrays.asList("testString")) + .name("Developer") + .accountId("testString") + .serviceName("iam-groups") + .description("testString") + .acceptLanguage("default") + .build(); + assertEquals(createRoleOptionsModel.displayName(), "testString"); + assertEquals(createRoleOptionsModel.actions(), java.util.Arrays.asList("testString")); + assertEquals(createRoleOptionsModel.name(), "Developer"); + assertEquals(createRoleOptionsModel.accountId(), "testString"); + assertEquals(createRoleOptionsModel.serviceName(), "iam-groups"); + assertEquals(createRoleOptionsModel.description(), "testString"); + assertEquals(createRoleOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleOptionsError() throws Throwable { + new CreateRoleOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java new file mode 100644 index 00000000000..bff414389a5 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateAssignmentOptions model. + */ +public class CreateRoleTemplateAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateRoleTemplateAssignmentOptions() throws Throwable { + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + assertEquals(assignmentTargetDetailsModel.type(), "Account"); + assertEquals(assignmentTargetDetailsModel.id(), "testString"); + + RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleAssignmentTemplateModel.id(), "testString"); + assertEquals(roleAssignmentTemplateModel.version(), "testString"); + + CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptionsModel = new CreateRoleTemplateAssignmentOptions.Builder() + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(roleAssignmentTemplateModel)) + .acceptLanguage("default") + .build(); + assertEquals(createRoleTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); + assertEquals(createRoleTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(roleAssignmentTemplateModel)); + assertEquals(createRoleTemplateAssignmentOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateAssignmentOptionsError() throws Throwable { + new CreateRoleTemplateAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..799743ddbf4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateOptions model. + */ +public class CreateRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateRoleTemplateOptions() throws Throwable { + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() + .name("testString") + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(roleTemplatePrototypeRoleModel.name(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.displayName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.serviceName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.description(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.actions(), java.util.Arrays.asList("testString")); + + CreateRoleTemplateOptions createRoleTemplateOptionsModel = new CreateRoleTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .description("testString") + .committed(true) + .role(roleTemplatePrototypeRoleModel) + .acceptLanguage("default") + .build(); + assertEquals(createRoleTemplateOptionsModel.name(), "testString"); + assertEquals(createRoleTemplateOptionsModel.accountId(), "testString"); + assertEquals(createRoleTemplateOptionsModel.description(), "testString"); + assertEquals(createRoleTemplateOptionsModel.committed(), Boolean.valueOf(true)); + assertEquals(createRoleTemplateOptionsModel.role(), roleTemplatePrototypeRoleModel); + assertEquals(createRoleTemplateOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateOptionsError() throws Throwable { + new CreateRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..a7d2d312afa --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateVersionOptions model. + */ +public class CreateRoleTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateRoleTemplateVersionOptions() throws Throwable { + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateRoleModel.displayName(), "testString"); + assertEquals(templateRoleModel.serviceName(), "testString"); + assertEquals(templateRoleModel.description(), "testString"); + assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); + + CreateRoleTemplateVersionOptions createRoleTemplateVersionOptionsModel = new CreateRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .name("testString") + .description("testString") + .role(templateRoleModel) + .committed(true) + .build(); + assertEquals(createRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); + assertEquals(createRoleTemplateVersionOptionsModel.name(), "testString"); + assertEquals(createRoleTemplateVersionOptionsModel.description(), "testString"); + assertEquals(createRoleTemplateVersionOptionsModel.role(), templateRoleModel); + assertEquals(createRoleTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateVersionOptionsError() throws Throwable { + new CreateRoleTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java new file mode 100644 index 00000000000..acce8b7b537 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java @@ -0,0 +1,131 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateV2PolicyOptions model. + */ +public class CreateV2PolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateV2PolicyOptions() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + assertEquals(controlModel.grant(), grantModel); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + CreateV2PolicyOptions createV2PolicyOptionsModel = new CreateV2PolicyOptions.Builder() + .control(controlModel) + .type("access") + .description("testString") + .subject(v2PolicySubjectModel) + .resource(v2PolicyResourceModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .acceptLanguage("default") + .build(); + assertEquals(createV2PolicyOptionsModel.control(), controlModel); + assertEquals(createV2PolicyOptionsModel.type(), "access"); + assertEquals(createV2PolicyOptionsModel.description(), "testString"); + assertEquals(createV2PolicyOptionsModel.subject(), v2PolicySubjectModel); + assertEquals(createV2PolicyOptionsModel.resource(), v2PolicyResourceModel); + assertEquals(createV2PolicyOptionsModel.pattern(), "testString"); + assertEquals(createV2PolicyOptionsModel.rule(), v2PolicyRuleModel); + assertEquals(createV2PolicyOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateV2PolicyOptionsError() throws Throwable { + new CreateV2PolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java new file mode 100644 index 00000000000..acc0dc0a3c1 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 CustomRole model. + */ +public class CustomRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCustomRole() throws Throwable { + CustomRole customRoleModel = new CustomRole(); + assertNull(customRoleModel.getDisplayName()); + assertNull(customRoleModel.getDescription()); + assertNull(customRoleModel.getActions()); + assertNull(customRoleModel.getName()); + assertNull(customRoleModel.getAccountId()); + assertNull(customRoleModel.getServiceName()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java new file mode 100644 index 00000000000..1a38606ede5 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlAssignmentOptions model. + */ +public class DeleteActionControlAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteActionControlAssignmentOptions() throws Throwable { + DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptionsModel = new DeleteActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(deleteActionControlAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlAssignmentOptionsError() throws Throwable { + new DeleteActionControlAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..75b111e9214 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlTemplateOptions model. + */ +public class DeleteActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteActionControlTemplateOptions() throws Throwable { + DeleteActionControlTemplateOptions deleteActionControlTemplateOptionsModel = new DeleteActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .build(); + assertEquals(deleteActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlTemplateOptionsError() throws Throwable { + new DeleteActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..64fb5790244 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlTemplateVersionOptions model. + */ +public class DeleteActionControlTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteActionControlTemplateVersionOptions() throws Throwable { + DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptionsModel = new DeleteActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + assertEquals(deleteActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(deleteActionControlTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlTemplateVersionOptionsError() throws Throwable { + new DeleteActionControlTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java new file mode 100644 index 00000000000..75aed905222 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyAssignmentOptions model. + */ +public class DeletePolicyAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeletePolicyAssignmentOptions() throws Throwable { + DeletePolicyAssignmentOptions deletePolicyAssignmentOptionsModel = new DeletePolicyAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(deletePolicyAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyAssignmentOptionsError() throws Throwable { + new DeletePolicyAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java new file mode 100644 index 00000000000..1b130eb0f79 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyOptions model. + */ +public class DeletePolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeletePolicyOptions() throws Throwable { + DeletePolicyOptions deletePolicyOptionsModel = new DeletePolicyOptions.Builder() + .policyId("testString") + .build(); + assertEquals(deletePolicyOptionsModel.policyId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyOptionsError() throws Throwable { + new DeletePolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..288517222aa --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyTemplateOptions model. + */ +public class DeletePolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeletePolicyTemplateOptions() throws Throwable { + DeletePolicyTemplateOptions deletePolicyTemplateOptionsModel = new DeletePolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .build(); + assertEquals(deletePolicyTemplateOptionsModel.policyTemplateId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyTemplateOptionsError() throws Throwable { + new DeletePolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..7b1c6cffa1d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyTemplateVersionOptions model. + */ +public class DeletePolicyTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeletePolicyTemplateVersionOptions() throws Throwable { + DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptionsModel = new DeletePolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + assertEquals(deletePolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); + assertEquals(deletePolicyTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyTemplateVersionOptionsError() throws Throwable { + new DeletePolicyTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java new file mode 100644 index 00000000000..7f9b614304f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleAssignmentOptions model. + */ +public class DeleteRoleAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteRoleAssignmentOptions() throws Throwable { + DeleteRoleAssignmentOptions deleteRoleAssignmentOptionsModel = new DeleteRoleAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(deleteRoleAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleAssignmentOptionsError() throws Throwable { + new DeleteRoleAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java new file mode 100644 index 00000000000..9c6690cda7b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleOptions model. + */ +public class DeleteRoleOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteRoleOptions() throws Throwable { + DeleteRoleOptions deleteRoleOptionsModel = new DeleteRoleOptions.Builder() + .roleId("testString") + .build(); + assertEquals(deleteRoleOptionsModel.roleId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleOptionsError() throws Throwable { + new DeleteRoleOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..3fc04286ed3 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleTemplateOptions model. + */ +public class DeleteRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteRoleTemplateOptions() throws Throwable { + DeleteRoleTemplateOptions deleteRoleTemplateOptionsModel = new DeleteRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .build(); + assertEquals(deleteRoleTemplateOptionsModel.roleTemplateId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleTemplateOptionsError() throws Throwable { + new DeleteRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..ff652fa335c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleTemplateVersionOptions model. + */ +public class DeleteRoleTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteRoleTemplateVersionOptions() throws Throwable { + DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptionsModel = new DeleteRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + assertEquals(deleteRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); + assertEquals(deleteRoleTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleTemplateVersionOptionsError() throws Throwable { + new DeleteRoleTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java new file mode 100644 index 00000000000..6a33aa8f116 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteV2PolicyOptions model. + */ +public class DeleteV2PolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteV2PolicyOptions() throws Throwable { + DeleteV2PolicyOptions deleteV2PolicyOptionsModel = new DeleteV2PolicyOptions.Builder() + .id("testString") + .build(); + assertEquals(deleteV2PolicyOptionsModel.id(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteV2PolicyOptionsError() throws Throwable { + new DeleteV2PolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java new file mode 100644 index 00000000000..104a5210ed9 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.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 EnrichedRoles model. + */ +public class EnrichedRolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testEnrichedRoles() throws Throwable { + EnrichedRoles enrichedRolesModel = new EnrichedRoles(); + assertNull(enrichedRolesModel.getRoleId()); + assertNull(enrichedRolesModel.getActions()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java new file mode 100644 index 00000000000..460b37f8105 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.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 ErrorDetails model. + */ +public class ErrorDetailsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testErrorDetails() throws Throwable { + ErrorDetails errorDetailsModel = new ErrorDetails(); + assertNull(errorDetailsModel.getConflictsWith()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java new file mode 100644 index 00000000000..e7f7f9afbfc --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.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 ErrorObject model. + */ +public class ErrorObjectTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testErrorObject() throws Throwable { + ErrorObject errorObjectModel = new ErrorObject(); + assertNull(errorObjectModel.getCode()); + assertNull(errorObjectModel.getMessage()); + assertNull(errorObjectModel.getDetails()); + assertNull(errorObjectModel.getMoreInfo()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java new file mode 100644 index 00000000000..90c91c8fcaf --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; +import com.ibm.cloud.platform_services.iam_policy_management.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 ExternalAccountIdentityInteractionPatch model. + */ +public class ExternalAccountIdentityInteractionPatchTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testExternalAccountIdentityInteractionPatch() throws Throwable { + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + assertEquals(identityTypesBaseModel.state(), "enabled"); + assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); + + IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() + .user(identityTypesBaseModel) + .serviceId(identityTypesBaseModel) + .service(identityTypesBaseModel) + .build(); + assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); + + ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() + .identityTypes(identityTypesPatchModel) + .build(); + assertEquals(externalAccountIdentityInteractionPatchModel.identityTypes(), identityTypesPatchModel); + + String json = TestUtilities.serialize(externalAccountIdentityInteractionPatchModel); + + ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModelNew = TestUtilities.deserialize(json, ExternalAccountIdentityInteractionPatch.class); + assertTrue(externalAccountIdentityInteractionPatchModelNew instanceof ExternalAccountIdentityInteractionPatch); + assertEquals(externalAccountIdentityInteractionPatchModelNew.identityTypes().toString(), identityTypesPatchModel.toString()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java new file mode 100644 index 00000000000..2e4aaef7e07 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.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 ExternalAccountIdentityInteraction model. + */ +public class ExternalAccountIdentityInteractionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testExternalAccountIdentityInteraction() throws Throwable { + ExternalAccountIdentityInteraction externalAccountIdentityInteractionModel = new ExternalAccountIdentityInteraction(); + assertNull(externalAccountIdentityInteractionModel.getIdentityTypes()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java new file mode 100644 index 00000000000..b4d68673091 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java @@ -0,0 +1,36 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.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 First model. + */ +public class FirstTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testFirst() throws Throwable { + First firstModel = new First(); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java new file mode 100644 index 00000000000..73e66a5a756 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlAssignmentOptions model. + */ +public class GetActionControlAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetActionControlAssignmentOptions() throws Throwable { + GetActionControlAssignmentOptions getActionControlAssignmentOptionsModel = new GetActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(getActionControlAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlAssignmentOptionsError() throws Throwable { + new GetActionControlAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..d6e66ce6939 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlTemplateOptions model. + */ +public class GetActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetActionControlTemplateOptions() throws Throwable { + GetActionControlTemplateOptions getActionControlTemplateOptionsModel = new GetActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .build(); + assertEquals(getActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(getActionControlTemplateOptionsModel.state(), "active"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlTemplateOptionsError() throws Throwable { + new GetActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..ac8e17fe083 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlTemplateVersionOptions model. + */ +public class GetActionControlTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetActionControlTemplateVersionOptions() throws Throwable { + GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptionsModel = new GetActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + assertEquals(getActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(getActionControlTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlTemplateVersionOptionsError() throws Throwable { + new GetActionControlTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java new file mode 100644 index 00000000000..6b2a479c37d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyAssignmentOptions model. + */ +public class GetPolicyAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetPolicyAssignmentOptions() throws Throwable { + GetPolicyAssignmentOptions getPolicyAssignmentOptionsModel = new GetPolicyAssignmentOptions.Builder() + .assignmentId("testString") + .version("1.0") + .build(); + assertEquals(getPolicyAssignmentOptionsModel.assignmentId(), "testString"); + assertEquals(getPolicyAssignmentOptionsModel.version(), "1.0"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyAssignmentOptionsError() throws Throwable { + new GetPolicyAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java new file mode 100644 index 00000000000..2a7348c2c2d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyOptions model. + */ +public class GetPolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetPolicyOptions() throws Throwable { + GetPolicyOptions getPolicyOptionsModel = new GetPolicyOptions.Builder() + .policyId("testString") + .build(); + assertEquals(getPolicyOptionsModel.policyId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyOptionsError() throws Throwable { + new GetPolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..06535ed77ed --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyTemplateOptions model. + */ +public class GetPolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetPolicyTemplateOptions() throws Throwable { + GetPolicyTemplateOptions getPolicyTemplateOptionsModel = new GetPolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .state("active") + .build(); + assertEquals(getPolicyTemplateOptionsModel.policyTemplateId(), "testString"); + assertEquals(getPolicyTemplateOptionsModel.state(), "active"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyTemplateOptionsError() throws Throwable { + new GetPolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..264b5db4912 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyTemplateVersionOptions model. + */ +public class GetPolicyTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetPolicyTemplateVersionOptions() throws Throwable { + GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptionsModel = new GetPolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + assertEquals(getPolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); + assertEquals(getPolicyTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyTemplateVersionOptionsError() throws Throwable { + new GetPolicyTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java new file mode 100644 index 00000000000..0c1f6b2bb5a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleAssignmentOptions model. + */ +public class GetRoleAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetRoleAssignmentOptions() throws Throwable { + GetRoleAssignmentOptions getRoleAssignmentOptionsModel = new GetRoleAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(getRoleAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleAssignmentOptionsError() throws Throwable { + new GetRoleAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java new file mode 100644 index 00000000000..e589b8d1285 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleOptions model. + */ +public class GetRoleOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetRoleOptions() throws Throwable { + GetRoleOptions getRoleOptionsModel = new GetRoleOptions.Builder() + .roleId("testString") + .build(); + assertEquals(getRoleOptionsModel.roleId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleOptionsError() throws Throwable { + new GetRoleOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..3c10b5207dc --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleTemplateOptions model. + */ +public class GetRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetRoleTemplateOptions() throws Throwable { + GetRoleTemplateOptions getRoleTemplateOptionsModel = new GetRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .state("active") + .build(); + assertEquals(getRoleTemplateOptionsModel.roleTemplateId(), "testString"); + assertEquals(getRoleTemplateOptionsModel.state(), "active"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleTemplateOptionsError() throws Throwable { + new GetRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..3bd5d278630 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleTemplateVersionOptions model. + */ +public class GetRoleTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetRoleTemplateVersionOptions() throws Throwable { + GetRoleTemplateVersionOptions getRoleTemplateVersionOptionsModel = new GetRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + assertEquals(getRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); + assertEquals(getRoleTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleTemplateVersionOptionsError() throws Throwable { + new GetRoleTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java new file mode 100644 index 00000000000..00f780c4153 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetSettingsOptions model. + */ +public class GetSettingsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetSettingsOptions() throws Throwable { + GetSettingsOptions getSettingsOptionsModel = new GetSettingsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .build(); + assertEquals(getSettingsOptionsModel.accountId(), "testString"); + assertEquals(getSettingsOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetSettingsOptionsError() throws Throwable { + new GetSettingsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java new file mode 100644 index 00000000000..ebad7af7371 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetV2PolicyOptions model. + */ +public class GetV2PolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetV2PolicyOptions() throws Throwable { + GetV2PolicyOptions getV2PolicyOptionsModel = new GetV2PolicyOptions.Builder() + .id("testString") + .format("include_last_permit") + .build(); + assertEquals(getV2PolicyOptionsModel.id(), "testString"); + assertEquals(getV2PolicyOptionsModel.format(), "include_last_permit"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetV2PolicyOptionsError() throws Throwable { + new GetV2PolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java new file mode 100644 index 00000000000..f627a54ecc2 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 Grant model. + */ +public class GrantTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGrant() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + + String json = TestUtilities.serialize(grantModel); + + Grant grantModelNew = TestUtilities.deserialize(json, Grant.class); + assertTrue(grantModelNew instanceof Grant); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGrantError() throws Throwable { + new Grant.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java new file mode 100644 index 00000000000..f86af34fab8 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.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 GrantWithEnrichedRoles model. + */ +public class GrantWithEnrichedRolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGrantWithEnrichedRoles() throws Throwable { + GrantWithEnrichedRoles grantWithEnrichedRolesModel = new GrantWithEnrichedRoles(); + assertNull(grantWithEnrichedRolesModel.getRoles()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java new file mode 100644 index 00000000000..2a4d38de51a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypesBase model. + */ +public class IdentityTypesBaseTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testIdentityTypesBase() throws Throwable { + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + assertEquals(identityTypesBaseModel.state(), "enabled"); + assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(identityTypesBaseModel); + + IdentityTypesBase identityTypesBaseModelNew = TestUtilities.deserialize(json, IdentityTypesBase.class); + assertTrue(identityTypesBaseModelNew instanceof IdentityTypesBase); + assertEquals(identityTypesBaseModelNew.state(), "enabled"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testIdentityTypesBaseError() throws Throwable { + new IdentityTypesBase.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java new file mode 100644 index 00000000000..3e762536695 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java @@ -0,0 +1,59 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; +import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypesPatch model. + */ +public class IdentityTypesPatchTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testIdentityTypesPatch() throws Throwable { + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + assertEquals(identityTypesBaseModel.state(), "enabled"); + assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); + + IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() + .user(identityTypesBaseModel) + .serviceId(identityTypesBaseModel) + .service(identityTypesBaseModel) + .build(); + assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); + + String json = TestUtilities.serialize(identityTypesPatchModel); + + IdentityTypesPatch identityTypesPatchModelNew = TestUtilities.deserialize(json, IdentityTypesPatch.class); + assertTrue(identityTypesPatchModelNew instanceof IdentityTypesPatch); + assertEquals(identityTypesPatchModelNew.user().toString(), identityTypesBaseModel.toString()); + assertEquals(identityTypesPatchModelNew.serviceId().toString(), identityTypesBaseModel.toString()); + assertEquals(identityTypesPatchModelNew.service().toString(), identityTypesBaseModel.toString()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java new file mode 100644 index 00000000000..e2b6c77338f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypes model. + */ +public class IdentityTypesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testIdentityTypes() throws Throwable { + IdentityTypes identityTypesModel = new IdentityTypes(); + assertNull(identityTypesModel.getUser()); + assertNull(identityTypesModel.getServiceId()); + assertNull(identityTypesModel.getService()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java new file mode 100644 index 00000000000..c3f51516e25 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java @@ -0,0 +1,36 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; +import com.ibm.cloud.platform_services.iam_policy_management.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 LimitData model. + */ +public class LimitDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testLimitData() throws Throwable { + LimitData limitDataModel = new LimitData(); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java new file mode 100644 index 00000000000..0d64653d829 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlAssignmentsOptions model. + */ +public class ListActionControlAssignmentsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListActionControlAssignmentsOptions() throws Throwable { + ListActionControlAssignmentsOptions listActionControlAssignmentsOptionsModel = new ListActionControlAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listActionControlAssignmentsOptionsModel.accountId(), "testString"); + assertEquals(listActionControlAssignmentsOptionsModel.acceptLanguage(), "default"); + assertEquals(listActionControlAssignmentsOptionsModel.templateId(), "testString"); + assertEquals(listActionControlAssignmentsOptionsModel.templateVersion(), "testString"); + assertEquals(listActionControlAssignmentsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listActionControlAssignmentsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlAssignmentsOptionsError() throws Throwable { + new ListActionControlAssignmentsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java new file mode 100644 index 00000000000..dfe91662d83 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlTemplateVersionsOptions model. + */ +public class ListActionControlTemplateVersionsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListActionControlTemplateVersionsOptions() throws Throwable { + ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptionsModel = new ListActionControlTemplateVersionsOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listActionControlTemplateVersionsOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(listActionControlTemplateVersionsOptionsModel.state(), "active"); + assertEquals(listActionControlTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listActionControlTemplateVersionsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlTemplateVersionsOptionsError() throws Throwable { + new ListActionControlTemplateVersionsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java new file mode 100644 index 00000000000..9e2e6a18158 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlTemplatesOptions model. + */ +public class ListActionControlTemplatesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListActionControlTemplatesOptions() throws Throwable { + ListActionControlTemplatesOptions listActionControlTemplatesOptionsModel = new ListActionControlTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listActionControlTemplatesOptionsModel.accountId(), "testString"); + assertEquals(listActionControlTemplatesOptionsModel.acceptLanguage(), "default"); + assertEquals(listActionControlTemplatesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listActionControlTemplatesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlTemplatesOptionsError() throws Throwable { + new ListActionControlTemplatesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java new file mode 100644 index 00000000000..8bfe5000355 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListPoliciesOptions model. + */ +public class ListPoliciesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListPoliciesOptions() throws Throwable { + ListPoliciesOptions listPoliciesOptionsModel = new ListPoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .tagName("testString") + .tagValue("testString") + .sort("id") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listPoliciesOptionsModel.accountId(), "testString"); + assertEquals(listPoliciesOptionsModel.acceptLanguage(), "default"); + assertEquals(listPoliciesOptionsModel.iamId(), "testString"); + assertEquals(listPoliciesOptionsModel.accessGroupId(), "testString"); + assertEquals(listPoliciesOptionsModel.type(), "access"); + assertEquals(listPoliciesOptionsModel.serviceType(), "service"); + assertEquals(listPoliciesOptionsModel.tagName(), "testString"); + assertEquals(listPoliciesOptionsModel.tagValue(), "testString"); + assertEquals(listPoliciesOptionsModel.sort(), "id"); + assertEquals(listPoliciesOptionsModel.format(), "include_last_permit"); + assertEquals(listPoliciesOptionsModel.state(), "active"); + assertEquals(listPoliciesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listPoliciesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPoliciesOptionsError() throws Throwable { + new ListPoliciesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java new file mode 100644 index 00000000000..32729befeda --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyAssignmentsOptions model. + */ +public class ListPolicyAssignmentsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListPolicyAssignmentsOptions() throws Throwable { + ListPolicyAssignmentsOptions listPolicyAssignmentsOptionsModel = new ListPolicyAssignmentsOptions.Builder() + .version("1.0") + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listPolicyAssignmentsOptionsModel.version(), "1.0"); + assertEquals(listPolicyAssignmentsOptionsModel.accountId(), "testString"); + assertEquals(listPolicyAssignmentsOptionsModel.acceptLanguage(), "default"); + assertEquals(listPolicyAssignmentsOptionsModel.templateId(), "testString"); + assertEquals(listPolicyAssignmentsOptionsModel.templateVersion(), "testString"); + assertEquals(listPolicyAssignmentsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listPolicyAssignmentsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyAssignmentsOptionsError() throws Throwable { + new ListPolicyAssignmentsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java new file mode 100644 index 00000000000..1053d41b84b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyTemplateVersionsOptions model. + */ +public class ListPolicyTemplateVersionsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListPolicyTemplateVersionsOptions() throws Throwable { + ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptionsModel = new ListPolicyTemplateVersionsOptions.Builder() + .policyTemplateId("testString") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listPolicyTemplateVersionsOptionsModel.policyTemplateId(), "testString"); + assertEquals(listPolicyTemplateVersionsOptionsModel.state(), "active"); + assertEquals(listPolicyTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listPolicyTemplateVersionsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyTemplateVersionsOptionsError() throws Throwable { + new ListPolicyTemplateVersionsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java new file mode 100644 index 00000000000..5065a9d9495 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyTemplatesOptions model. + */ +public class ListPolicyTemplatesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListPolicyTemplatesOptions() throws Throwable { + ListPolicyTemplatesOptions listPolicyTemplatesOptionsModel = new ListPolicyTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .state("active") + .name("testString") + .policyServiceType("service") + .policyServiceName("testString") + .policyServiceGroupId("testString") + .policyType("access") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listPolicyTemplatesOptionsModel.accountId(), "testString"); + assertEquals(listPolicyTemplatesOptionsModel.acceptLanguage(), "default"); + assertEquals(listPolicyTemplatesOptionsModel.state(), "active"); + assertEquals(listPolicyTemplatesOptionsModel.name(), "testString"); + assertEquals(listPolicyTemplatesOptionsModel.policyServiceType(), "service"); + assertEquals(listPolicyTemplatesOptionsModel.policyServiceName(), "testString"); + assertEquals(listPolicyTemplatesOptionsModel.policyServiceGroupId(), "testString"); + assertEquals(listPolicyTemplatesOptionsModel.policyType(), "access"); + assertEquals(listPolicyTemplatesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listPolicyTemplatesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyTemplatesOptionsError() throws Throwable { + new ListPolicyTemplatesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java new file mode 100644 index 00000000000..bd82df9bfd5 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleAssignmentsOptions model. + */ +public class ListRoleAssignmentsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListRoleAssignmentsOptions() throws Throwable { + ListRoleAssignmentsOptions listRoleAssignmentsOptionsModel = new ListRoleAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listRoleAssignmentsOptionsModel.accountId(), "testString"); + assertEquals(listRoleAssignmentsOptionsModel.acceptLanguage(), "default"); + assertEquals(listRoleAssignmentsOptionsModel.templateId(), "testString"); + assertEquals(listRoleAssignmentsOptionsModel.templateVersion(), "testString"); + assertEquals(listRoleAssignmentsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listRoleAssignmentsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleAssignmentsOptionsError() throws Throwable { + new ListRoleAssignmentsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java new file mode 100644 index 00000000000..2e89527b653 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleTemplateVersionsOptions model. + */ +public class ListRoleTemplateVersionsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListRoleTemplateVersionsOptions() throws Throwable { + ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptionsModel = new ListRoleTemplateVersionsOptions.Builder() + .roleTemplateId("testString") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listRoleTemplateVersionsOptionsModel.roleTemplateId(), "testString"); + assertEquals(listRoleTemplateVersionsOptionsModel.state(), "active"); + assertEquals(listRoleTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listRoleTemplateVersionsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleTemplateVersionsOptionsError() throws Throwable { + new ListRoleTemplateVersionsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java new file mode 100644 index 00000000000..21d23a7be0f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java @@ -0,0 +1,59 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleTemplatesOptions model. + */ +public class ListRoleTemplatesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListRoleTemplatesOptions() throws Throwable { + ListRoleTemplatesOptions listRoleTemplatesOptionsModel = new ListRoleTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .name("testString") + .roleName("testString") + .roleServiceName("testString") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listRoleTemplatesOptionsModel.accountId(), "testString"); + assertEquals(listRoleTemplatesOptionsModel.acceptLanguage(), "default"); + assertEquals(listRoleTemplatesOptionsModel.name(), "testString"); + assertEquals(listRoleTemplatesOptionsModel.roleName(), "testString"); + assertEquals(listRoleTemplatesOptionsModel.roleServiceName(), "testString"); + assertEquals(listRoleTemplatesOptionsModel.state(), "active"); + assertEquals(listRoleTemplatesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listRoleTemplatesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleTemplatesOptionsError() throws Throwable { + new ListRoleTemplatesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java new file mode 100644 index 00000000000..4fb97c7fc9a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListRolesOptions model. + */ +public class ListRolesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListRolesOptions() throws Throwable { + ListRolesOptions listRolesOptionsModel = new ListRolesOptions.Builder() + .acceptLanguage("default") + .accountId("testString") + .serviceName("iam-groups") + .sourceServiceName("iam-groups") + .policyType("authorization") + .serviceGroupId("IAM") + .build(); + assertEquals(listRolesOptionsModel.acceptLanguage(), "default"); + assertEquals(listRolesOptionsModel.accountId(), "testString"); + assertEquals(listRolesOptionsModel.serviceName(), "iam-groups"); + assertEquals(listRolesOptionsModel.sourceServiceName(), "iam-groups"); + assertEquals(listRolesOptionsModel.policyType(), "authorization"); + assertEquals(listRolesOptionsModel.serviceGroupId(), "IAM"); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java new file mode 100644 index 00000000000..8c72945373b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListV2PoliciesOptions model. + */ +public class ListV2PoliciesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListV2PoliciesOptions() throws Throwable { + ListV2PoliciesOptions listV2PoliciesOptionsModel = new ListV2PoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .serviceName("testString") + .serviceGroupId("testString") + .sort("testString") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listV2PoliciesOptionsModel.accountId(), "testString"); + assertEquals(listV2PoliciesOptionsModel.acceptLanguage(), "default"); + assertEquals(listV2PoliciesOptionsModel.iamId(), "testString"); + assertEquals(listV2PoliciesOptionsModel.accessGroupId(), "testString"); + assertEquals(listV2PoliciesOptionsModel.type(), "access"); + assertEquals(listV2PoliciesOptionsModel.serviceType(), "service"); + assertEquals(listV2PoliciesOptionsModel.serviceName(), "testString"); + assertEquals(listV2PoliciesOptionsModel.serviceGroupId(), "testString"); + assertEquals(listV2PoliciesOptionsModel.sort(), "testString"); + assertEquals(listV2PoliciesOptionsModel.format(), "include_last_permit"); + assertEquals(listV2PoliciesOptionsModel.state(), "active"); + assertEquals(listV2PoliciesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listV2PoliciesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListV2PoliciesOptionsError() throws Throwable { + new ListV2PoliciesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java new file mode 100644 index 00000000000..0661d4245a2 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 NestedConditionRuleAttribute model. + */ +public class NestedConditionRuleAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testNestedConditionRuleAttribute() throws Throwable { + NestedConditionRuleAttribute nestedConditionRuleAttributeModel = new NestedConditionRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(nestedConditionRuleAttributeModel.key(), "testString"); + assertEquals(nestedConditionRuleAttributeModel.operator(), "stringEquals"); + assertEquals(nestedConditionRuleAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(nestedConditionRuleAttributeModel); + + NestedConditionRuleAttribute nestedConditionRuleAttributeModelNew = TestUtilities.deserialize(json, NestedConditionRuleAttribute.class); + assertTrue(nestedConditionRuleAttributeModelNew instanceof NestedConditionRuleAttribute); + assertEquals(nestedConditionRuleAttributeModelNew.key(), "testString"); + assertEquals(nestedConditionRuleAttributeModelNew.operator(), "stringEquals"); + assertEquals(nestedConditionRuleAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testNestedConditionRuleAttributeError() throws Throwable { + new NestedConditionRuleAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java new file mode 100644 index 00000000000..1ba394dbb7d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleWithConditions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 NestedConditionRuleWithConditions model. + */ +public class NestedConditionRuleWithConditionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testNestedConditionRuleWithConditions() throws Throwable { + RuleAttribute ruleAttributeModel = new RuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(ruleAttributeModel.key(), "testString"); + assertEquals(ruleAttributeModel.operator(), "stringEquals"); + assertEquals(ruleAttributeModel.value(), "testString"); + + NestedConditionRuleWithConditions nestedConditionRuleWithConditionsModel = new NestedConditionRuleWithConditions.Builder() + .operator("and") + .conditions(java.util.Arrays.asList(ruleAttributeModel)) + .build(); + assertEquals(nestedConditionRuleWithConditionsModel.operator(), "and"); + assertEquals(nestedConditionRuleWithConditionsModel.conditions(), java.util.Arrays.asList(ruleAttributeModel)); + + String json = TestUtilities.serialize(nestedConditionRuleWithConditionsModel); + + NestedConditionRuleWithConditions nestedConditionRuleWithConditionsModelNew = TestUtilities.deserialize(json, NestedConditionRuleWithConditions.class); + assertTrue(nestedConditionRuleWithConditionsModelNew instanceof NestedConditionRuleWithConditions); + assertEquals(nestedConditionRuleWithConditionsModelNew.operator(), "and"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testNestedConditionRuleWithConditionsError() throws Throwable { + new NestedConditionRuleWithConditions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java new file mode 100644 index 00000000000..4956eea2675 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedCondition; +import com.ibm.cloud.platform_services.iam_policy_management.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 NestedCondition model. + */ +public class NestedConditionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testNestedCondition() throws Throwable { + NestedCondition nestedConditionModel = new NestedCondition(); + assertNotNull(nestedConditionModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java new file mode 100644 index 00000000000..c5e084a44d5 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.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 Next model. + */ +public class NextTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testNext() throws Throwable { + Next nextModel = new Next(); + assertNull(nextModel.getStart()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java new file mode 100644 index 00000000000..d5b05ede760 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentResourcePolicy model. + */ +public class PolicyAssignmentResourcePolicyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentResourcePolicy() throws Throwable { + PolicyAssignmentResourcePolicy policyAssignmentResourcePolicyModel = new PolicyAssignmentResourcePolicy(); + assertNull(policyAssignmentResourcePolicyModel.getResourceCreated()); + assertNull(policyAssignmentResourcePolicyModel.getStatus()); + assertNull(policyAssignmentResourcePolicyModel.getErrorMessage()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java new file mode 100644 index 00000000000..8b146425617 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentResources model. + */ +public class PolicyAssignmentResourcesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentResources() throws Throwable { + PolicyAssignmentResources policyAssignmentResourcesModel = new PolicyAssignmentResources(); + assertNull(policyAssignmentResourcesModel.getTarget()); + assertNull(policyAssignmentResourcesModel.getPolicy()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java new file mode 100644 index 00000000000..8a3a6b67703 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Collection model. + */ +public class PolicyAssignmentV1CollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentV1Collection() throws Throwable { + PolicyAssignmentV1Collection policyAssignmentV1CollectionModel = new PolicyAssignmentV1Collection(); + assertNull(policyAssignmentV1CollectionModel.getLimit()); + assertNull(policyAssignmentV1CollectionModel.getFirst()); + assertNull(policyAssignmentV1CollectionModel.getNext()); + assertNull(policyAssignmentV1CollectionModel.getPrevious()); + assertNull(policyAssignmentV1CollectionModel.getAssignments()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java new file mode 100644 index 00000000000..56c843a232e --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Resources model. + */ +public class PolicyAssignmentV1ResourcesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentV1Resources() throws Throwable { + PolicyAssignmentV1Resources policyAssignmentV1ResourcesModel = new PolicyAssignmentV1Resources(); + assertNull(policyAssignmentV1ResourcesModel.getTarget()); + assertNull(policyAssignmentV1ResourcesModel.getPolicy()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java new file mode 100644 index 00000000000..f5d14b29447 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java @@ -0,0 +1,36 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Subject model. + */ +public class PolicyAssignmentV1SubjectTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentV1Subject() throws Throwable { + PolicyAssignmentV1Subject policyAssignmentV1SubjectModel = new PolicyAssignmentV1Subject(); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java new file mode 100644 index 00000000000..d9889483421 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1 model. + */ +public class PolicyAssignmentV1Test { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentV1() throws Throwable { + PolicyAssignmentV1 policyAssignmentV1Model = new PolicyAssignmentV1(); + assertNull(policyAssignmentV1Model.getTarget()); + assertNull(policyAssignmentV1Model.getResources()); + assertNull(policyAssignmentV1Model.getSubject()); + assertNull(policyAssignmentV1Model.getTemplate()); + assertNull(policyAssignmentV1Model.getStatus()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java new file mode 100644 index 00000000000..3d372dfaf20 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java @@ -0,0 +1,52 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyCollection model. + */ +public class PolicyCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyCollection() throws Throwable { + PolicyCollection policyCollectionModel = new PolicyCollection(); + assertNull(policyCollectionModel.getLimit()); + assertNull(policyCollectionModel.getFirst()); + assertNull(policyCollectionModel.getNext()); + assertNull(policyCollectionModel.getPrevious()); + assertNull(policyCollectionModel.getPolicies()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java new file mode 100644 index 00000000000..cb2f203a5c3 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java @@ -0,0 +1,72 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyResource model. + */ +public class PolicyResourceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyResource() throws Throwable { + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceAttributeModel.name(), "testString"); + assertEquals(resourceAttributeModel.value(), "testString"); + assertEquals(resourceAttributeModel.operator(), "testString"); + + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceTagModel.name(), "testString"); + assertEquals(resourceTagModel.value(), "testString"); + assertEquals(resourceTagModel.operator(), "testString"); + + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); + assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); + + String json = TestUtilities.serialize(policyResourceModel); + + PolicyResource policyResourceModelNew = TestUtilities.deserialize(json, PolicyResource.class); + assertTrue(policyResourceModelNew instanceof PolicyResource); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPolicyResourceError() throws Throwable { + new PolicyResource.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java new file mode 100644 index 00000000000..299e15b1fd4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyRole model. + */ +public class PolicyRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyRole() throws Throwable { + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + assertEquals(policyRoleModel.roleId(), "testString"); + + String json = TestUtilities.serialize(policyRoleModel); + + PolicyRole policyRoleModelNew = TestUtilities.deserialize(json, PolicyRole.class); + assertTrue(policyRoleModelNew instanceof PolicyRole); + assertEquals(policyRoleModelNew.roleId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPolicyRoleError() throws Throwable { + new PolicyRole.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java new file mode 100644 index 00000000000..6d0a937bd53 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java @@ -0,0 +1,58 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicySubject model. + */ +public class PolicySubjectTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicySubject() throws Throwable { + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(subjectAttributeModel.name(), "testString"); + assertEquals(subjectAttributeModel.value(), "testString"); + + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); + + String json = TestUtilities.serialize(policySubjectModel); + + PolicySubject policySubjectModelNew = TestUtilities.deserialize(json, PolicySubject.class); + assertTrue(policySubjectModelNew instanceof PolicySubject); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPolicySubjectError() throws Throwable { + new PolicySubject.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java new file mode 100644 index 00000000000..8cb98be3d32 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentCollection model. + */ +public class PolicyTemplateAssignmentCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateAssignmentCollection() throws Throwable { + PolicyTemplateAssignmentCollection policyTemplateAssignmentCollectionModel = new PolicyTemplateAssignmentCollection(); + assertNull(policyTemplateAssignmentCollectionModel.getLimit()); + assertNull(policyTemplateAssignmentCollectionModel.getFirst()); + assertNull(policyTemplateAssignmentCollectionModel.getNext()); + assertNull(policyTemplateAssignmentCollectionModel.getPrevious()); + assertNull(policyTemplateAssignmentCollectionModel.getAssignments()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java new file mode 100644 index 00000000000..fded12633d2 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItemsPolicyAssignment model. + */ +public class PolicyTemplateAssignmentItemsPolicyAssignmentTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateAssignmentItemsPolicyAssignment() throws Throwable { + PolicyTemplateAssignmentItemsPolicyAssignment policyTemplateAssignmentItemsPolicyAssignmentModel = new PolicyTemplateAssignmentItemsPolicyAssignment(); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTemplateId()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTemplateVersion()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getAssignmentId()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTargetType()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTarget()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getResources()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getStatus()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java new file mode 100644 index 00000000000..6b74125d238 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItemsPolicyAssignmentV1 model. + */ +public class PolicyTemplateAssignmentItemsPolicyAssignmentV1Test { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateAssignmentItemsPolicyAssignmentV1() throws Throwable { + PolicyTemplateAssignmentItemsPolicyAssignmentV1 policyTemplateAssignmentItemsPolicyAssignmentV1Model = new PolicyTemplateAssignmentItemsPolicyAssignmentV1(); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getTarget()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getResources()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getSubject()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getTemplate()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getStatus()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java new file mode 100644 index 00000000000..05b400e91c1 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java @@ -0,0 +1,48 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItems model. + */ +public class PolicyTemplateAssignmentItemsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testPolicyTemplateAssignmentItems() throws Throwable { + PolicyTemplateAssignmentItems policyTemplateAssignmentItemsModel = new PolicyTemplateAssignmentItems(); + assertNotNull(policyTemplateAssignmentItemsModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java new file mode 100644 index 00000000000..52041b1a6a3 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateCollection model. + */ +public class PolicyTemplateCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateCollection() throws Throwable { + PolicyTemplateCollection policyTemplateCollectionModel = new PolicyTemplateCollection(); + assertNull(policyTemplateCollectionModel.getLimit()); + assertNull(policyTemplateCollectionModel.getFirst()); + assertNull(policyTemplateCollectionModel.getNext()); + assertNull(policyTemplateCollectionModel.getPrevious()); + assertNull(policyTemplateCollectionModel.getPolicyTemplates()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java new file mode 100644 index 00000000000..b6ee06990a2 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateLimitData model. + */ +public class PolicyTemplateLimitDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateLimitData() throws Throwable { + PolicyTemplateLimitData policyTemplateLimitDataModel = new PolicyTemplateLimitData(); + assertNull(policyTemplateLimitDataModel.getName()); + assertNull(policyTemplateLimitDataModel.getDescription()); + assertNull(policyTemplateLimitDataModel.getAccountId()); + assertNull(policyTemplateLimitDataModel.getVersion()); + assertNull(policyTemplateLimitDataModel.isCommitted()); + assertNull(policyTemplateLimitDataModel.getPolicy()); + assertNull(policyTemplateLimitDataModel.getState()); + assertNull(policyTemplateLimitDataModel.getCounts()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java new file mode 100644 index 00000000000..edeb45c4d96 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateMetaData model. + */ +public class PolicyTemplateMetaDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateMetaData() throws Throwable { + PolicyTemplateMetaData policyTemplateMetaDataModel = new PolicyTemplateMetaData(); + assertNull(policyTemplateMetaDataModel.getType()); + assertNull(policyTemplateMetaDataModel.getDescription()); + assertNull(policyTemplateMetaDataModel.getSubjects()); + assertNull(policyTemplateMetaDataModel.getRoles()); + assertNull(policyTemplateMetaDataModel.getResources()); + assertNull(policyTemplateMetaDataModel.getState()); + assertNull(policyTemplateMetaDataModel.getTemplate()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java new file mode 100644 index 00000000000..c349e4a3415 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplate model. + */ +public class PolicyTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplate() throws Throwable { + PolicyTemplate policyTemplateModel = new PolicyTemplate(); + assertNull(policyTemplateModel.getName()); + assertNull(policyTemplateModel.getDescription()); + assertNull(policyTemplateModel.getAccountId()); + assertNull(policyTemplateModel.getVersion()); + assertNull(policyTemplateModel.isCommitted()); + assertNull(policyTemplateModel.getPolicy()); + assertNull(policyTemplateModel.getState()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java new file mode 100644 index 00000000000..da651956461 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateVersionsCollection model. + */ +public class PolicyTemplateVersionsCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateVersionsCollection() throws Throwable { + PolicyTemplateVersionsCollection policyTemplateVersionsCollectionModel = new PolicyTemplateVersionsCollection(); + assertNull(policyTemplateVersionsCollectionModel.getLimit()); + assertNull(policyTemplateVersionsCollectionModel.getFirst()); + assertNull(policyTemplateVersionsCollectionModel.getNext()); + assertNull(policyTemplateVersionsCollectionModel.getPrevious()); + assertNull(policyTemplateVersionsCollectionModel.getVersions()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java new file mode 100644 index 00000000000..28eba4f9a85 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java @@ -0,0 +1,48 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 Policy model. + */ +public class PolicyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicy() throws Throwable { + Policy policyModel = new Policy(); + assertNull(policyModel.getType()); + assertNull(policyModel.getDescription()); + assertNull(policyModel.getSubjects()); + assertNull(policyModel.getRoles()); + assertNull(policyModel.getResources()); + assertNull(policyModel.getState()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java new file mode 100644 index 00000000000..e3788c51212 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.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 Previous model. + */ +public class PreviousTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPrevious() throws Throwable { + Previous previousModel = new Previous(); + assertNull(previousModel.getStart()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..430f5f63764 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java @@ -0,0 +1,67 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceActionControlTemplateOptions model. + */ +public class ReplaceActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplaceActionControlTemplateOptions() throws Throwable { + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateActionControlModel.serviceName(), "testString"); + assertEquals(templateActionControlModel.description(), "testString"); + assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); + + ReplaceActionControlTemplateOptions replaceActionControlTemplateOptionsModel = new ReplaceActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .actionControl(templateActionControlModel) + .committed(true) + .build(); + assertEquals(replaceActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.version(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.ifMatch(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.name(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.description(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.actionControl(), templateActionControlModel); + assertEquals(replaceActionControlTemplateOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceActionControlTemplateOptionsError() throws Throwable { + new ReplaceActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java new file mode 100644 index 00000000000..2f20b05f37c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java @@ -0,0 +1,105 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplacePolicyOptions model. + */ +public class ReplacePolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplacePolicyOptions() throws Throwable { + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(subjectAttributeModel.name(), "testString"); + assertEquals(subjectAttributeModel.value(), "testString"); + + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); + + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + assertEquals(policyRoleModel.roleId(), "testString"); + + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceAttributeModel.name(), "testString"); + assertEquals(resourceAttributeModel.value(), "testString"); + assertEquals(resourceAttributeModel.operator(), "testString"); + + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceTagModel.name(), "testString"); + assertEquals(resourceTagModel.value(), "testString"); + assertEquals(resourceTagModel.operator(), "testString"); + + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); + assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); + + ReplacePolicyOptions replacePolicyOptionsModel = new ReplacePolicyOptions.Builder() + .policyId("testString") + .ifMatch("testString") + .type("testString") + .subjects(java.util.Arrays.asList(policySubjectModel)) + .roles(java.util.Arrays.asList(policyRoleModel)) + .resources(java.util.Arrays.asList(policyResourceModel)) + .description("testString") + .build(); + assertEquals(replacePolicyOptionsModel.policyId(), "testString"); + assertEquals(replacePolicyOptionsModel.ifMatch(), "testString"); + assertEquals(replacePolicyOptionsModel.type(), "testString"); + assertEquals(replacePolicyOptionsModel.subjects(), java.util.Arrays.asList(policySubjectModel)); + assertEquals(replacePolicyOptionsModel.roles(), java.util.Arrays.asList(policyRoleModel)); + assertEquals(replacePolicyOptionsModel.resources(), java.util.Arrays.asList(policyResourceModel)); + assertEquals(replacePolicyOptionsModel.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplacePolicyOptionsError() throws Throwable { + new ReplacePolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..2dc2430daca --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java @@ -0,0 +1,147 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplacePolicyTemplateOptions model. + */ +public class ReplacePolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplacePolicyTemplateOptions() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + assertEquals(templatePolicyModel.type(), "access"); + assertEquals(templatePolicyModel.description(), "testString"); + assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); + assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); + assertEquals(templatePolicyModel.pattern(), "testString"); + assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); + assertEquals(templatePolicyModel.control(), templateControlModel); + + ReplacePolicyTemplateOptions replacePolicyTemplateOptionsModel = new ReplacePolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .ifMatch("testString") + .policy(templatePolicyModel) + .name("testString") + .description("testString") + .committed(true) + .build(); + assertEquals(replacePolicyTemplateOptionsModel.policyTemplateId(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.version(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.ifMatch(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.policy(), templatePolicyModel); + assertEquals(replacePolicyTemplateOptionsModel.name(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.description(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplacePolicyTemplateOptionsError() throws Throwable { + new ReplacePolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java new file mode 100644 index 00000000000..9900abb2543 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceRoleOptions model. + */ +public class ReplaceRoleOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplaceRoleOptions() throws Throwable { + ReplaceRoleOptions replaceRoleOptionsModel = new ReplaceRoleOptions.Builder() + .roleId("testString") + .ifMatch("testString") + .displayName("testString") + .actions(java.util.Arrays.asList("testString")) + .description("testString") + .build(); + assertEquals(replaceRoleOptionsModel.roleId(), "testString"); + assertEquals(replaceRoleOptionsModel.ifMatch(), "testString"); + assertEquals(replaceRoleOptionsModel.displayName(), "testString"); + assertEquals(replaceRoleOptionsModel.actions(), java.util.Arrays.asList("testString")); + assertEquals(replaceRoleOptionsModel.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceRoleOptionsError() throws Throwable { + new ReplaceRoleOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..2f731aea7d4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceRoleTemplateOptions model. + */ +public class ReplaceRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplaceRoleTemplateOptions() throws Throwable { + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateRoleModel.displayName(), "testString"); + assertEquals(templateRoleModel.serviceName(), "testString"); + assertEquals(templateRoleModel.description(), "testString"); + assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); + + ReplaceRoleTemplateOptions replaceRoleTemplateOptionsModel = new ReplaceRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .role(templateRoleModel) + .committed(true) + .build(); + assertEquals(replaceRoleTemplateOptionsModel.roleTemplateId(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.version(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.ifMatch(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.name(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.description(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.role(), templateRoleModel); + assertEquals(replaceRoleTemplateOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceRoleTemplateOptionsError() throws Throwable { + new ReplaceRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java new file mode 100644 index 00000000000..23690eda780 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java @@ -0,0 +1,133 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceV2PolicyOptions model. + */ +public class ReplaceV2PolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplaceV2PolicyOptions() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + assertEquals(controlModel.grant(), grantModel); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + ReplaceV2PolicyOptions replaceV2PolicyOptionsModel = new ReplaceV2PolicyOptions.Builder() + .id("testString") + .ifMatch("testString") + .control(controlModel) + .type("access") + .description("testString") + .subject(v2PolicySubjectModel) + .resource(v2PolicyResourceModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .build(); + assertEquals(replaceV2PolicyOptionsModel.id(), "testString"); + assertEquals(replaceV2PolicyOptionsModel.ifMatch(), "testString"); + assertEquals(replaceV2PolicyOptionsModel.control(), controlModel); + assertEquals(replaceV2PolicyOptionsModel.type(), "access"); + assertEquals(replaceV2PolicyOptionsModel.description(), "testString"); + assertEquals(replaceV2PolicyOptionsModel.subject(), v2PolicySubjectModel); + assertEquals(replaceV2PolicyOptionsModel.resource(), v2PolicyResourceModel); + assertEquals(replaceV2PolicyOptionsModel.pattern(), "testString"); + assertEquals(replaceV2PolicyOptionsModel.rule(), v2PolicyRuleModel); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceV2PolicyOptionsError() throws Throwable { + new ReplaceV2PolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java new file mode 100644 index 00000000000..bd50b514f43 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 ResourceAttribute model. + */ +public class ResourceAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testResourceAttribute() throws Throwable { + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceAttributeModel.name(), "testString"); + assertEquals(resourceAttributeModel.value(), "testString"); + assertEquals(resourceAttributeModel.operator(), "testString"); + + String json = TestUtilities.serialize(resourceAttributeModel); + + ResourceAttribute resourceAttributeModelNew = TestUtilities.deserialize(json, ResourceAttribute.class); + assertTrue(resourceAttributeModelNew instanceof ResourceAttribute); + assertEquals(resourceAttributeModelNew.name(), "testString"); + assertEquals(resourceAttributeModelNew.value(), "testString"); + assertEquals(resourceAttributeModelNew.operator(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testResourceAttributeError() throws Throwable { + new ResourceAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java new file mode 100644 index 00000000000..88a1eb5d5b6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.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 ResourceTag model. + */ +public class ResourceTagTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testResourceTag() throws Throwable { + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceTagModel.name(), "testString"); + assertEquals(resourceTagModel.value(), "testString"); + assertEquals(resourceTagModel.operator(), "testString"); + + String json = TestUtilities.serialize(resourceTagModel); + + ResourceTag resourceTagModelNew = TestUtilities.deserialize(json, ResourceTag.class); + assertTrue(resourceTagModelNew instanceof ResourceTag); + assertEquals(resourceTagModelNew.name(), "testString"); + assertEquals(resourceTagModelNew.value(), "testString"); + assertEquals(resourceTagModelNew.operator(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testResourceTagError() throws Throwable { + new ResourceTag.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java new file mode 100644 index 00000000000..e4c0bcc6f92 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAction model. + */ +public class RoleActionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAction() throws Throwable { + RoleAction roleActionModel = new RoleAction(); + assertNull(roleActionModel.getId()); + assertNull(roleActionModel.getDisplayName()); + assertNull(roleActionModel.getDescription()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java new file mode 100644 index 00000000000..42801bc7771 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentCollection model. + */ +public class RoleAssignmentCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentCollection() throws Throwable { + RoleAssignmentCollection roleAssignmentCollectionModel = new RoleAssignmentCollection(); + assertNull(roleAssignmentCollectionModel.getLimit()); + assertNull(roleAssignmentCollectionModel.getFirst()); + assertNull(roleAssignmentCollectionModel.getNext()); + assertNull(roleAssignmentCollectionModel.getPrevious()); + assertNull(roleAssignmentCollectionModel.getAssignments()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java new file mode 100644 index 00000000000..bef8b71b0fa --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResourceCreated model. + */ +public class RoleAssignmentResourceCreatedTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentResourceCreated() throws Throwable { + RoleAssignmentResourceCreated roleAssignmentResourceCreatedModel = new RoleAssignmentResourceCreated(); + assertNull(roleAssignmentResourceCreatedModel.getId()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java new file mode 100644 index 00000000000..c346ca0f48f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java @@ -0,0 +1,43 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResourceRole model. + */ +public class RoleAssignmentResourceRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentResourceRole() throws Throwable { + RoleAssignmentResourceRole roleAssignmentResourceRoleModel = new RoleAssignmentResourceRole(); + assertNull(roleAssignmentResourceRoleModel.getResourceCreated()); + assertNull(roleAssignmentResourceRoleModel.getErrorMessage()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java new file mode 100644 index 00000000000..4fca1b25b5b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResource model. + */ +public class RoleAssignmentResourceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentResource() throws Throwable { + RoleAssignmentResource roleAssignmentResourceModel = new RoleAssignmentResource(); + assertNull(roleAssignmentResourceModel.getTarget()); + assertNull(roleAssignmentResourceModel.getRole()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java new file mode 100644 index 00000000000..4f2e3a37200 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentTemplate model. + */ +public class RoleAssignmentTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentTemplate() throws Throwable { + RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleAssignmentTemplateModel.id(), "testString"); + assertEquals(roleAssignmentTemplateModel.version(), "testString"); + + String json = TestUtilities.serialize(roleAssignmentTemplateModel); + + RoleAssignmentTemplate roleAssignmentTemplateModelNew = TestUtilities.deserialize(json, RoleAssignmentTemplate.class); + assertTrue(roleAssignmentTemplateModelNew instanceof RoleAssignmentTemplate); + assertEquals(roleAssignmentTemplateModelNew.id(), "testString"); + assertEquals(roleAssignmentTemplateModelNew.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRoleAssignmentTemplateError() throws Throwable { + new RoleAssignmentTemplate.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java new file mode 100644 index 00000000000..bd3bda7ce24 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignment model. + */ +public class RoleAssignmentTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignment() throws Throwable { + RoleAssignment roleAssignmentModel = new RoleAssignment(); + assertNull(roleAssignmentModel.getTemplate()); + assertNull(roleAssignmentModel.getTarget()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java new file mode 100644 index 00000000000..812c2dcb131 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java @@ -0,0 +1,41 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleCollection model. + */ +public class RoleCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleCollection() throws Throwable { + RoleCollection roleCollectionModel = new RoleCollection(); + assertNull(roleCollectionModel.getCustomRoles()); + assertNull(roleCollectionModel.getServiceRoles()); + assertNull(roleCollectionModel.getSystemRoles()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java new file mode 100644 index 00000000000..fde4d11ff4c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java @@ -0,0 +1,46 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateCollection model. + */ +public class RoleTemplateCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplateCollection() throws Throwable { + RoleTemplateCollection roleTemplateCollectionModel = new RoleTemplateCollection(); + assertNull(roleTemplateCollectionModel.getLimit()); + assertNull(roleTemplateCollectionModel.getFirst()); + assertNull(roleTemplateCollectionModel.getNext()); + assertNull(roleTemplateCollectionModel.getPrevious()); + assertNull(roleTemplateCollectionModel.getRoleTemplates()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java new file mode 100644 index 00000000000..6c208e1c38f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java @@ -0,0 +1,62 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplatePrototypeRole model. + */ +public class RoleTemplatePrototypeRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplatePrototypeRole() throws Throwable { + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() + .name("testString") + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(roleTemplatePrototypeRoleModel.name(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.displayName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.serviceName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.description(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.actions(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(roleTemplatePrototypeRoleModel); + + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModelNew = TestUtilities.deserialize(json, RoleTemplatePrototypeRole.class); + assertTrue(roleTemplatePrototypeRoleModelNew instanceof RoleTemplatePrototypeRole); + assertEquals(roleTemplatePrototypeRoleModelNew.name(), "testString"); + assertEquals(roleTemplatePrototypeRoleModelNew.displayName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModelNew.serviceName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModelNew.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRoleTemplatePrototypeRoleError() throws Throwable { + new RoleTemplatePrototypeRole.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java new file mode 100644 index 00000000000..af9de718e23 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateReferencesItem model. + */ +public class RoleTemplateReferencesItemTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplateReferencesItem() throws Throwable { + RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleTemplateReferencesItemModel.id(), "testString"); + assertEquals(roleTemplateReferencesItemModel.version(), "testString"); + + String json = TestUtilities.serialize(roleTemplateReferencesItemModel); + + RoleTemplateReferencesItem roleTemplateReferencesItemModelNew = TestUtilities.deserialize(json, RoleTemplateReferencesItem.class); + assertTrue(roleTemplateReferencesItemModelNew instanceof RoleTemplateReferencesItem); + assertEquals(roleTemplateReferencesItemModelNew.id(), "testString"); + assertEquals(roleTemplateReferencesItemModelNew.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRoleTemplateReferencesItemError() throws Throwable { + new RoleTemplateReferencesItem.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java new file mode 100644 index 00000000000..8bb27d8dd62 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplate model. + */ +public class RoleTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplate() throws Throwable { + RoleTemplate roleTemplateModel = new RoleTemplate(); + assertNull(roleTemplateModel.getName()); + assertNull(roleTemplateModel.getDescription()); + assertNull(roleTemplateModel.getAccountId()); + assertNull(roleTemplateModel.isCommitted()); + assertNull(roleTemplateModel.getRole()); + assertNull(roleTemplateModel.getVersion()); + assertNull(roleTemplateModel.getState()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java new file mode 100644 index 00000000000..068cf309bd6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java @@ -0,0 +1,46 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateVersionsCollection model. + */ +public class RoleTemplateVersionsCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplateVersionsCollection() throws Throwable { + RoleTemplateVersionsCollection roleTemplateVersionsCollectionModel = new RoleTemplateVersionsCollection(); + assertNull(roleTemplateVersionsCollectionModel.getLimit()); + assertNull(roleTemplateVersionsCollectionModel.getFirst()); + assertNull(roleTemplateVersionsCollectionModel.getNext()); + assertNull(roleTemplateVersionsCollectionModel.getPrevious()); + assertNull(roleTemplateVersionsCollectionModel.getVersions()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java new file mode 100644 index 00000000000..a632e63587f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; +import com.ibm.cloud.platform_services.iam_policy_management.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 Role model. + */ +public class RoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRole() throws Throwable { + Role roleModel = new Role.Builder() + .displayName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(roleModel.displayName(), "testString"); + assertEquals(roleModel.description(), "testString"); + assertEquals(roleModel.actions(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(roleModel); + + Role roleModelNew = TestUtilities.deserialize(json, Role.class); + assertTrue(roleModelNew instanceof Role); + assertEquals(roleModelNew.displayName(), "testString"); + assertEquals(roleModelNew.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRoleError() throws Throwable { + new Role.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java new file mode 100644 index 00000000000..8383ef794a9 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 Roles model. + */ +public class RolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoles() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + String json = TestUtilities.serialize(rolesModel); + + Roles rolesModelNew = TestUtilities.deserialize(json, Roles.class); + assertTrue(rolesModelNew instanceof Roles); + assertEquals(rolesModelNew.roleId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRolesError() throws Throwable { + new Roles.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java new file mode 100644 index 00000000000..a05e5ee8704 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 RuleAttribute model. + */ +public class RuleAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRuleAttribute() throws Throwable { + RuleAttribute ruleAttributeModel = new RuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(ruleAttributeModel.key(), "testString"); + assertEquals(ruleAttributeModel.operator(), "stringEquals"); + assertEquals(ruleAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(ruleAttributeModel); + + RuleAttribute ruleAttributeModelNew = TestUtilities.deserialize(json, RuleAttribute.class); + assertTrue(ruleAttributeModelNew instanceof RuleAttribute); + assertEquals(ruleAttributeModelNew.key(), "testString"); + assertEquals(ruleAttributeModelNew.operator(), "stringEquals"); + assertEquals(ruleAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRuleAttributeError() throws Throwable { + new RuleAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java new file mode 100644 index 00000000000..7bae03a42e0 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 SubjectAttribute model. + */ +public class SubjectAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testSubjectAttribute() throws Throwable { + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(subjectAttributeModel.name(), "testString"); + assertEquals(subjectAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(subjectAttributeModel); + + SubjectAttribute subjectAttributeModelNew = TestUtilities.deserialize(json, SubjectAttribute.class); + assertTrue(subjectAttributeModelNew instanceof SubjectAttribute); + assertEquals(subjectAttributeModelNew.name(), "testString"); + assertEquals(subjectAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testSubjectAttributeError() throws Throwable { + new SubjectAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java new file mode 100644 index 00000000000..d3a6d4ef53a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateActionControl model. + */ +public class TemplateActionControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateActionControl() throws Throwable { + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateActionControlModel.serviceName(), "testString"); + assertEquals(templateActionControlModel.description(), "testString"); + assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(templateActionControlModel); + + TemplateActionControl templateActionControlModelNew = TestUtilities.deserialize(json, TemplateActionControl.class); + assertTrue(templateActionControlModelNew instanceof TemplateActionControl); + assertEquals(templateActionControlModelNew.serviceName(), "testString"); + assertEquals(templateActionControlModelNew.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateActionControlError() throws Throwable { + new TemplateActionControl.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java new file mode 100644 index 00000000000..fba96e64cef --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateControl model. + */ +public class TemplateControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateControl() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + String json = TestUtilities.serialize(templateControlModel); + + TemplateControl templateControlModelNew = TestUtilities.deserialize(json, TemplateControl.class); + assertTrue(templateControlModelNew instanceof TemplateControl); + assertEquals(templateControlModelNew.grant().toString(), templateGrantModel.toString()); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateControlError() throws Throwable { + new TemplateControl.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java new file mode 100644 index 00000000000..b440cf19100 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateCountData model. + */ +public class TemplateCountDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateCountData() throws Throwable { + TemplateCountData templateCountDataModel = new TemplateCountData(); + assertNull(templateCountDataModel.getTemplate()); + assertNull(templateCountDataModel.getVersion()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java new file mode 100644 index 00000000000..e7759eacc21 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java @@ -0,0 +1,58 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoleReferences; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrantRoleReferences model. + */ +public class TemplateGrantRoleReferencesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateGrantRoleReferences() throws Throwable { + RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleTemplateReferencesItemModel.id(), "testString"); + assertEquals(roleTemplateReferencesItemModel.version(), "testString"); + + TemplateGrantRoleReferences templateGrantRoleReferencesModel = new TemplateGrantRoleReferences.Builder() + .roleTemplateReferences(java.util.Arrays.asList(roleTemplateReferencesItemModel)) + .build(); + assertEquals(templateGrantRoleReferencesModel.roleTemplateReferences(), java.util.Arrays.asList(roleTemplateReferencesItemModel)); + + String json = TestUtilities.serialize(templateGrantRoleReferencesModel); + + TemplateGrantRoleReferences templateGrantRoleReferencesModelNew = TestUtilities.deserialize(json, TemplateGrantRoleReferences.class); + assertTrue(templateGrantRoleReferencesModelNew instanceof TemplateGrantRoleReferences); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateGrantRoleReferencesError() throws Throwable { + new TemplateGrantRoleReferences.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java new file mode 100644 index 00000000000..8cddc6f9a19 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrantRoles model. + */ +public class TemplateGrantRolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateGrantRoles() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantRolesModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantRolesModel.roles(), java.util.Arrays.asList(rolesModel)); + + String json = TestUtilities.serialize(templateGrantRolesModel); + + TemplateGrantRoles templateGrantRolesModelNew = TestUtilities.deserialize(json, TemplateGrantRoles.class); + assertTrue(templateGrantRolesModelNew instanceof TemplateGrantRoles); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateGrantRolesError() throws Throwable { + new TemplateGrantRoles.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java new file mode 100644 index 00000000000..90e6fdc2b9f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrant model. + */ +public class TemplateGrantTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testTemplateGrant() throws Throwable { + TemplateGrant templateGrantModel = new TemplateGrant(); + assertNotNull(templateGrantModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java new file mode 100644 index 00000000000..c2688232e2b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java @@ -0,0 +1,41 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateMetadata model. + */ +public class TemplateMetadataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateMetadata() throws Throwable { + TemplateMetadata templateMetadataModel = new TemplateMetadata(); + assertNull(templateMetadataModel.getId()); + assertNull(templateMetadataModel.getVersion()); + assertNull(templateMetadataModel.getAssignmentId()); + assertNull(templateMetadataModel.getRootId()); + assertNull(templateMetadataModel.getRootVersion()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java new file mode 100644 index 00000000000..0e256ffd599 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplatePolicy model. + */ +public class TemplatePolicyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplatePolicy() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + assertEquals(templatePolicyModel.type(), "access"); + assertEquals(templatePolicyModel.description(), "testString"); + assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); + assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); + assertEquals(templatePolicyModel.pattern(), "testString"); + assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); + assertEquals(templatePolicyModel.control(), templateControlModel); + + String json = TestUtilities.serialize(templatePolicyModel); + + TemplatePolicy templatePolicyModelNew = TestUtilities.deserialize(json, TemplatePolicy.class); + assertTrue(templatePolicyModelNew instanceof TemplatePolicy); + assertEquals(templatePolicyModelNew.type(), "access"); + assertEquals(templatePolicyModelNew.description(), "testString"); + assertEquals(templatePolicyModelNew.resource().toString(), v2PolicyResourceModel.toString()); + assertEquals(templatePolicyModelNew.subject().toString(), v2PolicySubjectModel.toString()); + assertEquals(templatePolicyModelNew.pattern(), "testString"); + assertEquals(templatePolicyModelNew.rule().toString(), v2PolicyRuleModel.toString()); + assertEquals(templatePolicyModelNew.control().toString(), templateControlModel.toString()); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplatePolicyError() throws Throwable { + new TemplatePolicy.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java new file mode 100644 index 00000000000..1735364bc85 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java @@ -0,0 +1,59 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateRole model. + */ +public class TemplateRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateRole() throws Throwable { + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateRoleModel.displayName(), "testString"); + assertEquals(templateRoleModel.serviceName(), "testString"); + assertEquals(templateRoleModel.description(), "testString"); + assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(templateRoleModel); + + TemplateRole templateRoleModelNew = TestUtilities.deserialize(json, TemplateRole.class); + assertTrue(templateRoleModelNew instanceof TemplateRole); + assertEquals(templateRoleModelNew.displayName(), "testString"); + assertEquals(templateRoleModelNew.serviceName(), "testString"); + assertEquals(templateRoleModelNew.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateRoleError() throws Throwable { + new TemplateRole.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java new file mode 100644 index 00000000000..df7a09c2829 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateActionControlAssignmentOptions model. + */ +public class UpdateActionControlAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateActionControlAssignmentOptions() throws Throwable { + UpdateActionControlAssignmentOptions updateActionControlAssignmentOptionsModel = new UpdateActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .ifMatch("testString") + .templateVersion("testString") + .build(); + assertEquals(updateActionControlAssignmentOptionsModel.assignmentId(), "testString"); + assertEquals(updateActionControlAssignmentOptionsModel.ifMatch(), "testString"); + assertEquals(updateActionControlAssignmentOptionsModel.templateVersion(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateActionControlAssignmentOptionsError() throws Throwable { + new UpdateActionControlAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java new file mode 100644 index 00000000000..0008325ffcf --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdatePolicyAssignmentOptions model. + */ +public class UpdatePolicyAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdatePolicyAssignmentOptions() throws Throwable { + UpdatePolicyAssignmentOptions updatePolicyAssignmentOptionsModel = new UpdatePolicyAssignmentOptions.Builder() + .assignmentId("testString") + .version("1.0") + .ifMatch("testString") + .templateVersion("testString") + .build(); + assertEquals(updatePolicyAssignmentOptionsModel.assignmentId(), "testString"); + assertEquals(updatePolicyAssignmentOptionsModel.version(), "1.0"); + assertEquals(updatePolicyAssignmentOptionsModel.ifMatch(), "testString"); + assertEquals(updatePolicyAssignmentOptionsModel.templateVersion(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdatePolicyAssignmentOptionsError() throws Throwable { + new UpdatePolicyAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java new file mode 100644 index 00000000000..de000e8c745 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdatePolicyStateOptions model. + */ +public class UpdatePolicyStateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdatePolicyStateOptions() throws Throwable { + UpdatePolicyStateOptions updatePolicyStateOptionsModel = new UpdatePolicyStateOptions.Builder() + .policyId("testString") + .ifMatch("testString") + .state("active") + .build(); + assertEquals(updatePolicyStateOptionsModel.policyId(), "testString"); + assertEquals(updatePolicyStateOptionsModel.ifMatch(), "testString"); + assertEquals(updatePolicyStateOptionsModel.state(), "active"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdatePolicyStateOptionsError() throws Throwable { + new UpdatePolicyStateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java new file mode 100644 index 00000000000..879c3d5f456 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateRoleAssignmentOptions model. + */ +public class UpdateRoleAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateRoleAssignmentOptions() throws Throwable { + UpdateRoleAssignmentOptions updateRoleAssignmentOptionsModel = new UpdateRoleAssignmentOptions.Builder() + .assignmentId("testString") + .ifMatch("testString") + .templateVersion("testString") + .build(); + assertEquals(updateRoleAssignmentOptionsModel.assignmentId(), "testString"); + assertEquals(updateRoleAssignmentOptionsModel.ifMatch(), "testString"); + assertEquals(updateRoleAssignmentOptionsModel.templateVersion(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateRoleAssignmentOptionsError() throws Throwable { + new UpdateRoleAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java new file mode 100644 index 00000000000..1d69d016781 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java @@ -0,0 +1,75 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateSettingsOptions model. + */ +public class UpdateSettingsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateSettingsOptions() throws Throwable { + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + assertEquals(identityTypesBaseModel.state(), "enabled"); + assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); + + IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() + .user(identityTypesBaseModel) + .serviceId(identityTypesBaseModel) + .service(identityTypesBaseModel) + .build(); + assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); + + ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() + .identityTypes(identityTypesPatchModel) + .build(); + assertEquals(externalAccountIdentityInteractionPatchModel.identityTypes(), identityTypesPatchModel); + + UpdateSettingsOptions updateSettingsOptionsModel = new UpdateSettingsOptions.Builder() + .accountId("testString") + .ifMatch("testString") + .externalAccountIdentityInteraction(externalAccountIdentityInteractionPatchModel) + .acceptLanguage("default") + .build(); + assertEquals(updateSettingsOptionsModel.accountId(), "testString"); + assertEquals(updateSettingsOptionsModel.ifMatch(), "testString"); + assertEquals(updateSettingsOptionsModel.externalAccountIdentityInteraction(), externalAccountIdentityInteractionPatchModel); + assertEquals(updateSettingsOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateSettingsOptionsError() throws Throwable { + new UpdateSettingsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java new file mode 100644 index 00000000000..aff020c8985 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyCollection model. + */ +public class V2PolicyCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyCollection() throws Throwable { + V2PolicyCollection v2PolicyCollectionModel = new V2PolicyCollection(); + assertNull(v2PolicyCollectionModel.getLimit()); + assertNull(v2PolicyCollectionModel.getFirst()); + assertNull(v2PolicyCollectionModel.getNext()); + assertNull(v2PolicyCollectionModel.getPrevious()); + assertNull(v2PolicyCollectionModel.getPolicies()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java new file mode 100644 index 00000000000..407eaadb155 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResourceAttribute model. + */ +public class V2PolicyResourceAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyResourceAttribute() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(v2PolicyResourceAttributeModel); + + V2PolicyResourceAttribute v2PolicyResourceAttributeModelNew = TestUtilities.deserialize(json, V2PolicyResourceAttribute.class); + assertTrue(v2PolicyResourceAttributeModelNew instanceof V2PolicyResourceAttribute); + assertEquals(v2PolicyResourceAttributeModelNew.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModelNew.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyResourceAttributeError() throws Throwable { + new V2PolicyResourceAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java new file mode 100644 index 00000000000..97c9c813216 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResourceTag model. + */ +public class V2PolicyResourceTagTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyResourceTag() throws Throwable { + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + String json = TestUtilities.serialize(v2PolicyResourceTagModel); + + V2PolicyResourceTag v2PolicyResourceTagModelNew = TestUtilities.deserialize(json, V2PolicyResourceTag.class); + assertTrue(v2PolicyResourceTagModelNew instanceof V2PolicyResourceTag); + assertEquals(v2PolicyResourceTagModelNew.key(), "testString"); + assertEquals(v2PolicyResourceTagModelNew.value(), "testString"); + assertEquals(v2PolicyResourceTagModelNew.operator(), "stringEquals"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyResourceTagError() throws Throwable { + new V2PolicyResourceTag.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java new file mode 100644 index 00000000000..d153fd97be6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java @@ -0,0 +1,72 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResource model. + */ +public class V2PolicyResourceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyResource() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + String json = TestUtilities.serialize(v2PolicyResourceModel); + + V2PolicyResource v2PolicyResourceModelNew = TestUtilities.deserialize(json, V2PolicyResource.class); + assertTrue(v2PolicyResourceModelNew instanceof V2PolicyResource); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyResourceError() throws Throwable { + new V2PolicyResource.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java new file mode 100644 index 00000000000..6d6da85f2b4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRuleRuleAttribute model. + */ +public class V2PolicyRuleRuleAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyRuleRuleAttribute() throws Throwable { + V2PolicyRuleRuleAttribute v2PolicyRuleRuleAttributeModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleRuleAttributeModel.key(), "testString"); + assertEquals(v2PolicyRuleRuleAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleRuleAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(v2PolicyRuleRuleAttributeModel); + + V2PolicyRuleRuleAttribute v2PolicyRuleRuleAttributeModelNew = TestUtilities.deserialize(json, V2PolicyRuleRuleAttribute.class); + assertTrue(v2PolicyRuleRuleAttributeModelNew instanceof V2PolicyRuleRuleAttribute); + assertEquals(v2PolicyRuleRuleAttributeModelNew.key(), "testString"); + assertEquals(v2PolicyRuleRuleAttributeModelNew.operator(), "stringEquals"); + assertEquals(v2PolicyRuleRuleAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyRuleRuleAttributeError() throws Throwable { + new V2PolicyRuleRuleAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java new file mode 100644 index 00000000000..fdf25669ef7 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleWithNestedConditions; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRuleRuleWithNestedConditions model. + */ +public class V2PolicyRuleRuleWithNestedConditionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyRuleRuleWithNestedConditions() throws Throwable { + NestedConditionRuleAttribute nestedConditionModel = new NestedConditionRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(nestedConditionModel.key(), "testString"); + assertEquals(nestedConditionModel.operator(), "stringEquals"); + assertEquals(nestedConditionModel.value(), "testString"); + + V2PolicyRuleRuleWithNestedConditions v2PolicyRuleRuleWithNestedConditionsModel = new V2PolicyRuleRuleWithNestedConditions.Builder() + .operator("and") + .conditions(java.util.Arrays.asList(nestedConditionModel)) + .build(); + assertEquals(v2PolicyRuleRuleWithNestedConditionsModel.operator(), "and"); + assertEquals(v2PolicyRuleRuleWithNestedConditionsModel.conditions(), java.util.Arrays.asList(nestedConditionModel)); + + String json = TestUtilities.serialize(v2PolicyRuleRuleWithNestedConditionsModel); + + V2PolicyRuleRuleWithNestedConditions v2PolicyRuleRuleWithNestedConditionsModelNew = TestUtilities.deserialize(json, V2PolicyRuleRuleWithNestedConditions.class); + assertTrue(v2PolicyRuleRuleWithNestedConditionsModelNew instanceof V2PolicyRuleRuleWithNestedConditions); + assertEquals(v2PolicyRuleRuleWithNestedConditionsModelNew.operator(), "and"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyRuleRuleWithNestedConditionsError() throws Throwable { + new V2PolicyRuleRuleWithNestedConditions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java new file mode 100644 index 00000000000..e0af599840c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRule; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRule model. + */ +public class V2PolicyRuleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testV2PolicyRule() throws Throwable { + V2PolicyRule v2PolicyRuleModel = new V2PolicyRule(); + assertNotNull(v2PolicyRuleModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java new file mode 100644 index 00000000000..a6e8f9d8922 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicySubjectAttribute model. + */ +public class V2PolicySubjectAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicySubjectAttribute() throws Throwable { + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(v2PolicySubjectAttributeModel); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModelNew = TestUtilities.deserialize(json, V2PolicySubjectAttribute.class); + assertTrue(v2PolicySubjectAttributeModelNew instanceof V2PolicySubjectAttribute); + assertEquals(v2PolicySubjectAttributeModelNew.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModelNew.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicySubjectAttributeError() throws Throwable { + new V2PolicySubjectAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java new file mode 100644 index 00000000000..37adbaff5df --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java @@ -0,0 +1,60 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicySubject model. + */ +public class V2PolicySubjectTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicySubject() throws Throwable { + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + String json = TestUtilities.serialize(v2PolicySubjectModel); + + V2PolicySubject v2PolicySubjectModelNew = TestUtilities.deserialize(json, V2PolicySubject.class); + assertTrue(v2PolicySubjectModelNew instanceof V2PolicySubject); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicySubjectError() throws Throwable { + new V2PolicySubject.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java new file mode 100644 index 00000000000..2ffbe45575b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyTemplateMetaData model. + */ +public class V2PolicyTemplateMetaDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyTemplateMetaData() throws Throwable { + V2PolicyTemplateMetaData v2PolicyTemplateMetaDataModel = new V2PolicyTemplateMetaData(); + assertNull(v2PolicyTemplateMetaDataModel.getType()); + assertNull(v2PolicyTemplateMetaDataModel.getDescription()); + assertNull(v2PolicyTemplateMetaDataModel.getSubject()); + assertNull(v2PolicyTemplateMetaDataModel.getResource()); + assertNull(v2PolicyTemplateMetaDataModel.getPattern()); + assertNull(v2PolicyTemplateMetaDataModel.getRule()); + assertNull(v2PolicyTemplateMetaDataModel.getControl()); + assertNull(v2PolicyTemplateMetaDataModel.getState()); + assertNull(v2PolicyTemplateMetaDataModel.getLastPermitAt()); + assertNull(v2PolicyTemplateMetaDataModel.getLastPermitFrequency()); + assertNull(v2PolicyTemplateMetaDataModel.getTemplate()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java new file mode 100644 index 00000000000..1630201062c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2Policy model. + */ +public class V2PolicyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2Policy() throws Throwable { + V2Policy v2PolicyModel = new V2Policy(); + assertNull(v2PolicyModel.getType()); + assertNull(v2PolicyModel.getDescription()); + assertNull(v2PolicyModel.getSubject()); + assertNull(v2PolicyModel.getResource()); + assertNull(v2PolicyModel.getPattern()); + assertNull(v2PolicyModel.getRule()); + assertNull(v2PolicyModel.getControl()); + assertNull(v2PolicyModel.getState()); + assertNull(v2PolicyModel.getLastPermitAt()); + assertNull(v2PolicyModel.getLastPermitFrequency()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java new file mode 100644 index 00000000000..04aaecc16ae --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java @@ -0,0 +1,131 @@ +/* + * (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_policy_management.v1.utils; + +import java.util.Base64; +import java.util.Map; +import java.util.Set; +import java.util.List; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.io.InputStream; +import java.io.ByteArrayInputStream; + +import okhttp3.mockwebserver.RecordedRequest; +import okhttp3.HttpUrl; +import com.ibm.cloud.sdk.core.util.DateUtils; +import com.ibm.cloud.sdk.core.util.GsonSingleton; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; + +/** + * A class used by the unit tests containing utility functions. + */ +public class TestUtilities { + public static Map createMockMap() { + Map mockMap = new HashMap<>(); + mockMap.put("foo", "bar"); + return mockMap; + } + + public static HashMap createMockStreamMap() { + return new HashMap() { + { put("key1", createMockStream("This is a mock file.")); } + }; + } + + public static Map parseQueryString(RecordedRequest req) { + Map queryMap = new HashMap<>(); + + try { + HttpUrl requestUrl = req.getRequestUrl(); + + if (requestUrl != null) { + Set queryParamsNames = requestUrl.queryParameterNames(); + // map the parameter name to its corresponding value + for (String p : queryParamsNames) { + // get the corresponding value for the parameter (p) + List val = requestUrl.queryParameterValues(p); + if (val != null && !val.isEmpty()) { + String joinedQuery = String.join(",", val); + queryMap.put(p, joinedQuery); + } + } + } + if (queryMap.isEmpty()) { + return null; + } + } catch (Exception e) { + return null; + } + + return queryMap; + } + + public static String parseReqPath(RecordedRequest req) { + String parsedPath = null; + + try { + String fullPath = req.getPath(); + if (fullPath != null && !fullPath.isEmpty()) { + // retrieve the path segment before the query parameter + parsedPath = fullPath.split("\\?", 2)[0]; + } + if (parsedPath.isEmpty() || parsedPath == null) { + return null; + } + + } catch (Exception e) { + return null; + } + + return parsedPath; + } + + public static String serialize(Object obj) { + return GsonSingleton.getGson().toJson(obj); + } + + public static T deserialize(String json, Class clazz) { + return GsonSingleton.getGson().fromJson(json, clazz); + } + + public static InputStream createMockStream(String s) { + return new ByteArrayInputStream(s.getBytes()); + } + + public static List creatMockListFileWithMetadata() { + List list = new ArrayList(); + byte[] fileBytes = {(byte) 0xde, (byte) 0xad, (byte) 0xbe, (byte) 0xef}; + InputStream inputStream = new ByteArrayInputStream(fileBytes); + FileWithMetadata.Builder builder = new FileWithMetadata.Builder(); + builder.data(inputStream); + FileWithMetadata fileWithMetadata = builder.build(); + list.add(fileWithMetadata); + + return list; + } + + public static byte[] createMockByteArray(String encodedString) throws Exception { + return Base64.getDecoder().decode(encodedString); + } + + public static Date createMockDate(String date) throws Exception { + return DateUtils.parseAsDate(date); + } + + public static Date createMockDateTime(String date) throws Exception { + return DateUtils.parseAsDateTime(date); + } +} \ No newline at end of file From a8b043fd12eecbf55e52554a4425076b4c778344 Mon Sep 17 00:00:00 2001 From: Bhavana Bellamgari Date: Wed, 10 Dec 2025 15:31:47 +0530 Subject: [PATCH 09/13] Removed the wrongly generated code Signed-off-by: Bhavana Bellamgari Signed-off-by: Bhavana Bellamgari --- .../v1/IamPolicyManagement.java | 2566 --------- .../AccountSettingsAccessManagement.java | 40 - .../v1/model/ActionControlAssignment.java | 207 - .../ActionControlAssignmentCollection.java | 88 - .../ActionControlAssignmentResource.java | 52 - ...ontrolAssignmentResourceActionControl.java | 53 - ...ctionControlAssignmentResourceCreated.java | 38 - .../ActionControlAssignmentTemplate.java | 134 - .../model/ActionControlAssignmentsPager.java | 108 - .../v1/model/ActionControlTemplate.java | 203 - .../ActionControlTemplateCollection.java | 90 - ...tionControlTemplateVersionsCollection.java | 88 - .../ActionControlTemplateVersionsPager.java | 108 - .../v1/model/ActionControlTemplatesPager.java | 108 - .../v1/model/AssignmentResourceCreated.java | 38 - .../v1/model/AssignmentResourceError.java | 88 - .../v1/model/AssignmentTargetDetails.java | 142 - .../v1/model/AssignmentTemplateDetails.java | 119 - .../CommitActionControlTemplateOptions.java | 134 - .../v1/model/CommitPolicyTemplateOptions.java | 134 - .../v1/model/CommitRoleTemplateOptions.java | 134 - .../v1/model/ConflictsWith.java | 62 - .../v1/model/Control.java | 104 - .../v1/model/ControlResponse.java | 42 - .../v1/model/ControlResponseControl.java | 24 - ...ntrolResponseControlWithEnrichedRoles.java | 24 - ...ctionControlTemplateAssignmentOptions.java | 191 - .../CreateActionControlTemplateOptions.java | 251 - ...teActionControlTemplateVersionOptions.java | 211 - .../v1/model/CreatePolicyOptions.java | 311 - ...CreatePolicyTemplateAssignmentOptions.java | 221 - .../v1/model/CreatePolicyTemplateOptions.java | 255 - .../CreatePolicyTemplateVersionOptions.java | 214 - .../v1/model/CreateRoleOptions.java | 308 - .../CreateRoleTemplateAssignmentOptions.java | 191 - .../v1/model/CreateRoleTemplateOptions.java | 251 - .../CreateRoleTemplateVersionOptions.java | 211 - .../v1/model/CreateV2PolicyOptions.java | 312 - .../v1/model/CustomRole.java | 195 - .../DeleteActionControlAssignmentOptions.java | 104 - .../DeleteActionControlTemplateOptions.java | 104 - ...teActionControlTemplateVersionOptions.java | 134 - .../model/DeletePolicyAssignmentOptions.java | 104 - .../v1/model/DeletePolicyOptions.java | 104 - .../v1/model/DeletePolicyTemplateOptions.java | 104 - .../DeletePolicyTemplateVersionOptions.java | 134 - .../v1/model/DeleteRoleAssignmentOptions.java | 104 - .../v1/model/DeleteRoleOptions.java | 104 - .../v1/model/DeleteRoleTemplateOptions.java | 104 - .../DeleteRoleTemplateVersionOptions.java | 134 - .../v1/model/DeleteV2PolicyOptions.java | 104 - .../v1/model/EnrichedRoles.java | 81 - .../v1/model/ErrorDetails.java | 40 - .../v1/model/ErrorObject.java | 128 - .../ExternalAccountIdentityInteraction.java | 40 - ...ternalAccountIdentityInteractionPatch.java | 95 - .../iam_policy_management/v1/model/First.java | 38 - .../GetActionControlAssignmentOptions.java | 104 - .../GetActionControlTemplateOptions.java | 140 - ...etActionControlTemplateVersionOptions.java | 134 - .../v1/model/GetPolicyAssignmentOptions.java | 134 - .../v1/model/GetPolicyOptions.java | 104 - .../v1/model/GetPolicyTemplateOptions.java | 140 - .../GetPolicyTemplateVersionOptions.java | 134 - .../v1/model/GetRoleAssignmentOptions.java | 104 - .../v1/model/GetRoleOptions.java | 104 - .../v1/model/GetRoleTemplateOptions.java | 140 - .../model/GetRoleTemplateVersionOptions.java | 134 - .../v1/model/GetSettingsOptions.java | 141 - .../v1/model/GetV2PolicyOptions.java | 148 - .../iam_policy_management/v1/model/Grant.java | 124 - .../v1/model/GrantWithEnrichedRoles.java | 40 - .../v1/model/IdentityTypes.java | 64 - .../v1/model/IdentityTypesBase.java | 168 - .../v1/model/IdentityTypesPatch.java | 147 - .../v1/model/LimitData.java | 50 - .../ListActionControlAssignmentsOptions.java | 245 - ...tActionControlTemplateVersionsOptions.java | 192 - .../ListActionControlTemplatesOptions.java | 193 - .../v1/model/ListPoliciesOptions.java | 501 -- .../model/ListPolicyAssignmentsOptions.java | 275 - .../ListPolicyTemplateVersionsOptions.java | 192 - .../v1/model/ListPolicyTemplatesOptions.java | 379 -- .../v1/model/ListRoleAssignmentsOptions.java | 245 - .../ListRoleTemplateVersionsOptions.java | 192 - .../v1/model/ListRoleTemplatesOptions.java | 307 - .../v1/model/ListRolesOptions.java | 234 - .../v1/model/ListV2PoliciesOptions.java | 492 -- .../v1/model/NestedCondition.java | 126 - .../model/NestedConditionRuleAttribute.java | 170 - .../NestedConditionRuleWithConditions.java | 139 - .../iam_policy_management/v1/model/Next.java | 50 - .../v1/model/PoliciesPager.java | 108 - .../v1/model/Policy.java | 188 - .../model/PolicyAssignmentResourcePolicy.java | 65 - .../v1/model/PolicyAssignmentResources.java | 50 - .../v1/model/PolicyAssignmentV1.java | 193 - .../model/PolicyAssignmentV1Collection.java | 88 - .../v1/model/PolicyAssignmentV1Resources.java | 50 - .../v1/model/PolicyAssignmentV1Subject.java | 60 - .../v1/model/PolicyAssignmentsPager.java | 108 - .../v1/model/PolicyCollection.java | 88 - .../v1/model/PolicyResource.java | 167 - .../v1/model/PolicyRole.java | 131 - .../v1/model/PolicySubject.java | 124 - .../v1/model/PolicyTemplate.java | 202 - .../PolicyTemplateAssignmentCollection.java | 88 - .../model/PolicyTemplateAssignmentItems.java | 261 - ...mplateAssignmentItemsPolicyAssignment.java | 50 - ...lateAssignmentItemsPolicyAssignmentV1.java | 38 - .../v1/model/PolicyTemplateCollection.java | 90 - .../v1/model/PolicyTemplateLimitData.java | 214 - .../v1/model/PolicyTemplateMetaData.java | 201 - .../PolicyTemplateVersionsCollection.java | 88 - .../v1/model/PolicyTemplateVersionsPager.java | 108 - .../v1/model/PolicyTemplatesPager.java | 108 - .../v1/model/Previous.java | 50 - .../ReplaceActionControlTemplateOptions.java | 273 - .../v1/model/ReplacePolicyOptions.java | 335 -- .../model/ReplacePolicyTemplateOptions.java | 276 - .../v1/model/ReplaceRoleOptions.java | 255 - .../v1/model/ReplaceRoleTemplateOptions.java | 273 - .../v1/model/ReplaceV2PolicyOptions.java | 336 -- .../v1/model/ResourceAttribute.java | 160 - .../v1/model/ResourceTag.java | 160 - .../iam_policy_management/v1/model/Role.java | 196 - .../v1/model/RoleAction.java | 64 - .../v1/model/RoleAssignment.java | 207 - .../v1/model/RoleAssignmentCollection.java | 88 - .../v1/model/RoleAssignmentResource.java | 50 - .../model/RoleAssignmentResourceCreated.java | 38 - .../v1/model/RoleAssignmentResourceRole.java | 53 - .../v1/model/RoleAssignmentTemplate.java | 134 - .../v1/model/RoleAssignmentsPager.java | 108 - .../v1/model/RoleCollection.java | 68 - .../v1/model/RoleTemplate.java | 202 - .../v1/model/RoleTemplateCollection.java | 90 - .../v1/model/RoleTemplatePrototypeRole.java | 239 - .../v1/model/RoleTemplateReferencesItem.java | 134 - .../model/RoleTemplateVersionsCollection.java | 88 - .../v1/model/RoleTemplateVersionsPager.java | 108 - .../v1/model/RoleTemplatesPager.java | 108 - .../iam_policy_management/v1/model/Roles.java | 106 - .../v1/model/RuleAttribute.java | 209 - .../v1/model/SubjectAttribute.java | 134 - .../v1/model/TemplateActionControl.java | 182 - .../v1/model/TemplateControl.java | 104 - .../v1/model/TemplateCountData.java | 50 - .../v1/model/TemplateGrant.java | 58 - .../v1/model/TemplateGrantRoleReferences.java | 110 - .../v1/model/TemplateGrantRoles.java | 110 - .../v1/model/TemplateMetadata.java | 91 - .../v1/model/TemplatePolicy.java | 272 - .../v1/model/TemplateRole.java | 209 - .../UpdateActionControlAssignmentOptions.java | 166 - .../model/UpdatePolicyAssignmentOptions.java | 196 - .../v1/model/UpdatePolicyStateOptions.java | 171 - .../v1/model/UpdateRoleAssignmentOptions.java | 166 - .../v1/model/UpdateSettingsOptions.java | 199 - .../v1/model/V2PoliciesPager.java | 108 - .../v1/model/V2Policy.java | 247 - .../v1/model/V2PolicyCollection.java | 88 - .../v1/model/V2PolicyResource.java | 167 - .../v1/model/V2PolicyResourceAttribute.java | 181 - .../v1/model/V2PolicyResourceTag.java | 174 - .../v1/model/V2PolicyRule.java | 126 - .../v1/model/V2PolicyRuleRuleAttribute.java | 170 - .../V2PolicyRuleRuleWithNestedConditions.java | 139 - .../v1/model/V2PolicySubject.java | 124 - .../v1/model/V2PolicySubjectAttribute.java | 175 - .../v1/model/V2PolicyTemplateMetaData.java | 260 - .../v1/package-info.java | 17 - .../v1/IamPolicyManagementTest.java | 5007 ----------------- .../AccountSettingsAccessManagementTest.java | 40 - ...ActionControlAssignmentCollectionTest.java | 47 - ...olAssignmentResourceActionControlTest.java | 43 - ...nControlAssignmentResourceCreatedTest.java | 37 - .../ActionControlAssignmentResourceTest.java | 45 - .../ActionControlAssignmentTemplateTest.java | 54 - .../v1/model/ActionControlAssignmentTest.java | 40 - .../ActionControlTemplateCollectionTest.java | 46 - .../v1/model/ActionControlTemplateTest.java | 44 - ...ControlTemplateVersionsCollectionTest.java | 46 - .../model/AssignmentResourceCreatedTest.java | 37 - .../v1/model/AssignmentResourceErrorTest.java | 44 - .../v1/model/AssignmentTargetDetailsTest.java | 54 - .../model/AssignmentTemplateDetailsTest.java | 48 - ...ommitActionControlTemplateOptionsTest.java | 47 - .../CommitPolicyTemplateOptionsTest.java | 47 - .../model/CommitRoleTemplateOptionsTest.java | 47 - .../v1/model/ConflictsWithTest.java | 39 - .../v1/model/ControlResponseControlTest.java | 39 - ...lResponseControlWithEnrichedRolesTest.java | 40 - .../v1/model/ControlResponseTest.java | 40 - .../v1/model/ControlTest.java | 63 - ...nControlTemplateAssignmentOptionsTest.java | 65 - ...reateActionControlTemplateOptionsTest.java | 65 - ...tionControlTemplateVersionOptionsTest.java | 63 - .../v1/model/CreatePolicyOptionsTest.java | 103 - ...tePolicyTemplateAssignmentOptionsTest.java | 67 - .../CreatePolicyTemplateOptionsTest.java | 145 - ...reatePolicyTemplateVersionOptionsTest.java | 143 - .../v1/model/CreateRoleOptionsTest.java | 57 - ...eateRoleTemplateAssignmentOptionsTest.java | 65 - .../model/CreateRoleTemplateOptionsTest.java | 69 - .../CreateRoleTemplateVersionOptionsTest.java | 65 - .../v1/model/CreateV2PolicyOptionsTest.java | 131 - .../v1/model/CustomRoleTest.java | 42 - ...eteActionControlAssignmentOptionsTest.java | 45 - ...eleteActionControlTemplateOptionsTest.java | 45 - ...tionControlTemplateVersionOptionsTest.java | 47 - .../DeletePolicyAssignmentOptionsTest.java | 45 - .../v1/model/DeletePolicyOptionsTest.java | 45 - .../DeletePolicyTemplateOptionsTest.java | 45 - ...eletePolicyTemplateVersionOptionsTest.java | 47 - .../DeleteRoleAssignmentOptionsTest.java | 45 - .../v1/model/DeleteRoleOptionsTest.java | 45 - .../model/DeleteRoleTemplateOptionsTest.java | 45 - .../DeleteRoleTemplateVersionOptionsTest.java | 47 - .../v1/model/DeleteV2PolicyOptionsTest.java | 45 - .../v1/model/EnrichedRolesTest.java | 39 - .../v1/model/ErrorDetailsTest.java | 38 - .../v1/model/ErrorObjectTest.java | 42 - ...alAccountIdentityInteractionPatchTest.java | 63 - ...xternalAccountIdentityInteractionTest.java | 39 - .../v1/model/FirstTest.java | 36 - ...GetActionControlAssignmentOptionsTest.java | 45 - .../GetActionControlTemplateOptionsTest.java | 47 - ...tionControlTemplateVersionOptionsTest.java | 47 - .../model/GetPolicyAssignmentOptionsTest.java | 47 - .../v1/model/GetPolicyOptionsTest.java | 45 - .../model/GetPolicyTemplateOptionsTest.java | 47 - .../GetPolicyTemplateVersionOptionsTest.java | 47 - .../model/GetRoleAssignmentOptionsTest.java | 45 - .../v1/model/GetRoleOptionsTest.java | 45 - .../v1/model/GetRoleTemplateOptionsTest.java | 47 - .../GetRoleTemplateVersionOptionsTest.java | 47 - .../v1/model/GetSettingsOptionsTest.java | 47 - .../v1/model/GetV2PolicyOptionsTest.java | 47 - .../v1/model/GrantTest.java | 56 - .../v1/model/GrantWithEnrichedRolesTest.java | 39 - .../v1/model/IdentityTypesBaseTest.java | 53 - .../v1/model/IdentityTypesPatchTest.java | 59 - .../v1/model/IdentityTypesTest.java | 40 - .../v1/model/LimitDataTest.java | 36 - ...stActionControlAssignmentsOptionsTest.java | 55 - ...ionControlTemplateVersionsOptionsTest.java | 51 - ...ListActionControlTemplatesOptionsTest.java | 51 - .../v1/model/ListPoliciesOptionsTest.java | 69 - .../ListPolicyAssignmentsOptionsTest.java | 57 - ...ListPolicyTemplateVersionsOptionsTest.java | 51 - .../model/ListPolicyTemplatesOptionsTest.java | 63 - .../model/ListRoleAssignmentsOptionsTest.java | 55 - .../ListRoleTemplateVersionsOptionsTest.java | 51 - .../model/ListRoleTemplatesOptionsTest.java | 59 - .../v1/model/ListRolesOptionsTest.java | 49 - .../v1/model/ListV2PoliciesOptionsTest.java | 69 - .../NestedConditionRuleAttributeTest.java | 57 - ...NestedConditionRuleWithConditionsTest.java | 63 - .../v1/model/NestedConditionTest.java | 38 - .../v1/model/NextTest.java | 37 - .../PolicyAssignmentResourcePolicyTest.java | 44 - .../model/PolicyAssignmentResourcesTest.java | 44 - .../PolicyAssignmentV1CollectionTest.java | 55 - .../PolicyAssignmentV1ResourcesTest.java | 45 - .../model/PolicyAssignmentV1SubjectTest.java | 36 - .../v1/model/PolicyAssignmentV1Test.java | 51 - .../v1/model/PolicyCollectionTest.java | 52 - .../v1/model/PolicyResourceTest.java | 72 - .../v1/model/PolicyRoleTest.java | 51 - .../v1/model/PolicySubjectTest.java | 58 - ...olicyTemplateAssignmentCollectionTest.java | 55 - ...teAssignmentItemsPolicyAssignmentTest.java | 50 - ...AssignmentItemsPolicyAssignmentV1Test.java | 51 - .../PolicyTemplateAssignmentItemsTest.java | 48 - .../model/PolicyTemplateCollectionTest.java | 55 - .../v1/model/PolicyTemplateLimitDataTest.java | 56 - .../v1/model/PolicyTemplateMetaDataTest.java | 50 - .../v1/model/PolicyTemplateTest.java | 53 - .../PolicyTemplateVersionsCollectionTest.java | 55 - .../v1/model/PolicyTest.java | 48 - .../v1/model/PreviousTest.java | 37 - ...placeActionControlTemplateOptionsTest.java | 67 - .../v1/model/ReplacePolicyOptionsTest.java | 105 - .../ReplacePolicyTemplateOptionsTest.java | 147 - .../v1/model/ReplaceRoleOptionsTest.java | 53 - .../model/ReplaceRoleTemplateOptionsTest.java | 69 - .../v1/model/ReplaceV2PolicyOptionsTest.java | 133 - .../v1/model/ResourceAttributeTest.java | 57 - .../v1/model/ResourceTagTest.java | 57 - .../v1/model/RoleActionTest.java | 39 - .../model/RoleAssignmentCollectionTest.java | 47 - .../RoleAssignmentResourceCreatedTest.java | 37 - .../model/RoleAssignmentResourceRoleTest.java | 43 - .../v1/model/RoleAssignmentResourceTest.java | 45 - .../v1/model/RoleAssignmentTemplateTest.java | 54 - .../v1/model/RoleAssignmentTest.java | 40 - .../v1/model/RoleCollectionTest.java | 41 - .../v1/model/RoleTemplateCollectionTest.java | 46 - .../model/RoleTemplatePrototypeRoleTest.java | 62 - .../model/RoleTemplateReferencesItemTest.java | 54 - .../v1/model/RoleTemplateTest.java | 44 - .../RoleTemplateVersionsCollectionTest.java | 46 - .../v1/model/RoleTest.java | 56 - .../v1/model/RolesTest.java | 51 - .../v1/model/RuleAttributeTest.java | 57 - .../v1/model/SubjectAttributeTest.java | 54 - .../v1/model/TemplateActionControlTest.java | 56 - .../v1/model/TemplateControlTest.java | 63 - .../v1/model/TemplateCountDataTest.java | 39 - .../TemplateGrantRoleReferencesTest.java | 58 - .../v1/model/TemplateGrantRolesTest.java | 56 - .../v1/model/TemplateGrantTest.java | 39 - .../v1/model/TemplateMetadataTest.java | 41 - .../v1/model/TemplatePolicyTest.java | 141 - .../v1/model/TemplateRoleTest.java | 59 - ...ateActionControlAssignmentOptionsTest.java | 49 - .../UpdatePolicyAssignmentOptionsTest.java | 51 - .../model/UpdatePolicyStateOptionsTest.java | 49 - .../UpdateRoleAssignmentOptionsTest.java | 49 - .../v1/model/UpdateSettingsOptionsTest.java | 75 - .../v1/model/V2PolicyCollectionTest.java | 55 - .../model/V2PolicyResourceAttributeTest.java | 57 - .../v1/model/V2PolicyResourceTagTest.java | 57 - .../v1/model/V2PolicyResourceTest.java | 72 - .../model/V2PolicyRuleRuleAttributeTest.java | 57 - ...olicyRuleRuleWithNestedConditionsTest.java | 63 - .../v1/model/V2PolicyRuleTest.java | 38 - .../model/V2PolicySubjectAttributeTest.java | 57 - .../v1/model/V2PolicySubjectTest.java | 60 - .../model/V2PolicyTemplateMetaDataTest.java | 57 - .../v1/model/V2PolicyTest.java | 55 - .../v1/utils/TestUtilities.java | 131 - 333 files changed, 41258 deletions(-) delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java deleted file mode 100644 index 2abe3baea4e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java +++ /dev/null @@ -1,2566 +0,0 @@ -/* - * (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. - */ - -/* - * IBM OpenAPI SDK Code Generator Version: 3.107.1-41b0fbd0-20250825-080732 - */ - -package com.ibm.cloud.platform_services.iam_policy_management.v1; - -import com.google.gson.JsonObject; -import com.ibm.cloud.platform_services.common.SdkCommon; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; -import com.ibm.cloud.sdk.core.http.RequestBuilder; -import com.ibm.cloud.sdk.core.http.ResponseConverter; -import com.ibm.cloud.sdk.core.http.ServiceCall; -import com.ibm.cloud.sdk.core.security.Authenticator; -import com.ibm.cloud.sdk.core.security.ConfigBasedAuthenticatorFactory; -import com.ibm.cloud.sdk.core.service.BaseService; -import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -/** - * IAM Policy Management API. - * - * API Version: 1.0.1 - */ -public class IamPolicyManagement extends BaseService { - - /** - * Default service name used when configuring the `IamPolicyManagement` client. - */ - public static final String DEFAULT_SERVICE_NAME = "iam_policy_management"; - - /** - * Default service endpoint URL. - */ - public static final String DEFAULT_SERVICE_URL = "https://iam.cloud.ibm.com"; - - /** - * Class method which constructs an instance of the `IamPolicyManagement` client. - * The default service name is used to configure the client instance. - * - * @return an instance of the `IamPolicyManagement` client using external configuration - */ - public static IamPolicyManagement newInstance() { - return newInstance(DEFAULT_SERVICE_NAME); - } - - /** - * Class method which constructs an instance of the `IamPolicyManagement` client. - * The specified service name is used to configure the client instance. - * - * @param serviceName the service name to be used when configuring the client instance - * @return an instance of the `IamPolicyManagement` client using external configuration - */ - public static IamPolicyManagement newInstance(String serviceName) { - Authenticator authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(serviceName); - IamPolicyManagement service = new IamPolicyManagement(serviceName, authenticator); - service.configureService(serviceName); - return service; - } - - /** - * Constructs an instance of the `IamPolicyManagement` client. - * The specified service name and authenticator are used to configure the client instance. - * - * @param serviceName the service name to be used when configuring the client instance - * @param authenticator the {@link Authenticator} instance to be configured for this client - */ - public IamPolicyManagement(String serviceName, Authenticator authenticator) { - super(serviceName, authenticator); - setServiceUrl(DEFAULT_SERVICE_URL); - } - - /** - * Get policies by attributes. - * - * Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account - * and filter by attribute values. This can be done through query parameters. The following attributes are supported: - * account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query - * parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If - * the caller does not have read access to any policies an empty array is returned. - * - * @param listPoliciesOptions the {@link ListPoliciesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyCollection} - */ - public ServiceCall listPolicies(ListPoliciesOptions listPoliciesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listPoliciesOptions, - "listPoliciesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicies"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listPoliciesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listPoliciesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listPoliciesOptions.accountId())); - if (listPoliciesOptions.iamId() != null) { - builder.query("iam_id", String.valueOf(listPoliciesOptions.iamId())); - } - if (listPoliciesOptions.accessGroupId() != null) { - builder.query("access_group_id", String.valueOf(listPoliciesOptions.accessGroupId())); - } - if (listPoliciesOptions.type() != null) { - builder.query("type", String.valueOf(listPoliciesOptions.type())); - } - if (listPoliciesOptions.serviceType() != null) { - builder.query("service_type", String.valueOf(listPoliciesOptions.serviceType())); - } - if (listPoliciesOptions.tagName() != null) { - builder.query("tag_name", String.valueOf(listPoliciesOptions.tagName())); - } - if (listPoliciesOptions.tagValue() != null) { - builder.query("tag_value", String.valueOf(listPoliciesOptions.tagValue())); - } - if (listPoliciesOptions.sort() != null) { - builder.query("sort", String.valueOf(listPoliciesOptions.sort())); - } - if (listPoliciesOptions.format() != null) { - builder.query("format", String.valueOf(listPoliciesOptions.format())); - } - if (listPoliciesOptions.state() != null) { - builder.query("state", String.valueOf(listPoliciesOptions.state())); - } - if (listPoliciesOptions.limit() != null) { - builder.query("limit", String.valueOf(listPoliciesOptions.limit())); - } - if (listPoliciesOptions.start() != null) { - builder.query("start", String.valueOf(listPoliciesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a policy. - * - * Creates a policy to grant access between a subject and a resource. There are two types of policies: **access** and - * **authorization**. A policy administrator might want to create an access policy which grants access to a user, - * service-id, or an access group. They might also want to create an authorization policy and setup access between - * services. - * - * ### Access - * - * To create an access policy, use **`"type": "access"`** in the body. The possible subject attributes are - * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or - * service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. Assign roles - * that are supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or - * **`service_group_id`** attribute and the **`accountId`** attribute. The IAM Services group (`IAM`) is a subset of - * account management services that includes the IAM platform services IAM Identity, IAM Access Management, IAM Users - * Management, IAM Groups, and future IAM services. If the subject is a locked service-id, the request will fail. - * - * ### Authorization - * - * Authorization policies are supported by services on a case by case basis. Refer to service documentation to verify - * their support of authorization policies. To create an authorization policy, use **`"type": "authorization"`** in - * the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject - * attributes might be provided. The following attributes are supported: - * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are - * supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access - * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject - * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. - * - * ### Attribute Operators - * - * Currently, only the `stringEquals` and the `stringMatch` operators are available. Resource attributes may support - * one or both operators. For more information, see [Assigning access by using wildcard - * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). - * - * ### Attribute Validations - * - * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like - * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated - * against Global Catalog locations. - * - * @param createPolicyOptions the {@link CreatePolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Policy} - */ - public ServiceCall createPolicy(CreatePolicyOptions createPolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyOptions, - "createPolicyOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createPolicyOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createPolicyOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("type", createPolicyOptions.type()); - contentJson.add("subjects", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.subjects())); - contentJson.add("roles", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.roles())); - contentJson.add("resources", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.resources())); - if (createPolicyOptions.description() != null) { - contentJson.addProperty("description", createPolicyOptions.description()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a policy. - * - * Update a policy to grant access between a subject and a resource. A policy administrator might want to update an - * existing policy. The policy type cannot be changed (You cannot change an access policy to an authorization policy). - * - * ### Access - * - * To update an access policy, use **`"type": "access"`** in the body. The possible subject attributes are - * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or - * service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. Assign roles - * that are supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * The policy resource must include either the **`serviceType`**, **`serviceName`**, or **`resourceGroupId`** - * attribute and the **`accountId`** attribute.` If the subject is a locked service-id, the request will fail. - * - * ### Authorization - * - * To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match - * the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following - * attributes are supported: - * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are - * supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access - * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject - * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. - * - * ### Attribute Operators - * - * Currently, only the `stringEquals` and the `stringMatch` operators are available. Resource attributes might support - * one or both operators. For more information, see [Assigning access by using wildcard - * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). - * - * ### Attribute Validations - * - * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like - * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated - * against Global Catalog locations. - * - * @param replacePolicyOptions the {@link ReplacePolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Policy} - */ - public ServiceCall replacePolicy(ReplacePolicyOptions replacePolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replacePolicyOptions, - "replacePolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_id", replacePolicyOptions.policyId()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replacePolicy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replacePolicyOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("type", replacePolicyOptions.type()); - contentJson.add("subjects", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.subjects())); - contentJson.add("roles", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.roles())); - contentJson.add("resources", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.resources())); - if (replacePolicyOptions.description() != null) { - contentJson.addProperty("description", replacePolicyOptions.description()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a policy by ID. - * - * Retrieve a policy by providing a policy ID. - * - * @param getPolicyOptions the {@link GetPolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateMetaData} - */ - public ServiceCall getPolicy(GetPolicyOptions getPolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyOptions, - "getPolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_id", getPolicyOptions.policyId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicy"); - 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); - } - - /** - * Delete a policy by ID. - * - * Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service - * ID. If the subject of the policy is a locked service-id, the request will fail. - * - * @param deletePolicyOptions the {@link DeletePolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deletePolicy(DeletePolicyOptions deletePolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyOptions, - "deletePolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_id", deletePolicyOptions.policyId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Restore a deleted policy by ID. - * - * Restore a policy that has recently been deleted. A policy administrator might want to restore a deleted policy. To - * restore a policy, use **`"state": "active"`** in the body. - * - * @param updatePolicyStateOptions the {@link UpdatePolicyStateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Policy} - */ - public ServiceCall updatePolicyState(UpdatePolicyStateOptions updatePolicyStateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updatePolicyStateOptions, - "updatePolicyStateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_id", updatePolicyStateOptions.policyId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updatePolicyState"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updatePolicyStateOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - if (updatePolicyStateOptions.state() != null) { - contentJson.addProperty("state", updatePolicyStateOptions.state()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get roles by filters. - * - * Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can - * be done through query parameters. Currently, we only support the following attributes: account_id, service_name, - * service_group_id, source_service_name and policy_type. Both service_name and service_group_id attributes are - * mutually exclusive. Only roles that match the filter and that the caller has read access to are returned. If the - * caller does not have read access to any roles an empty array is returned. - * - * @param listRolesOptions the {@link ListRolesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleCollection} - */ - public ServiceCall listRoles(ListRolesOptions listRolesOptions) { - if (listRolesOptions == null) { - listRolesOptions = new ListRolesOptions.Builder().build(); - } - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoles"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listRolesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listRolesOptions.acceptLanguage()); - } - if (listRolesOptions.accountId() != null) { - builder.query("account_id", String.valueOf(listRolesOptions.accountId())); - } - if (listRolesOptions.serviceName() != null) { - builder.query("service_name", String.valueOf(listRolesOptions.serviceName())); - } - if (listRolesOptions.sourceServiceName() != null) { - builder.query("source_service_name", String.valueOf(listRolesOptions.sourceServiceName())); - } - if (listRolesOptions.policyType() != null) { - builder.query("policy_type", String.valueOf(listRolesOptions.policyType())); - } - if (listRolesOptions.serviceGroupId() != null) { - builder.query("service_group_id", String.valueOf(listRolesOptions.serviceGroupId())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get roles by filters. - * - * Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can - * be done through query parameters. Currently, we only support the following attributes: account_id, service_name, - * service_group_id, source_service_name and policy_type. Both service_name and service_group_id attributes are - * mutually exclusive. Only roles that match the filter and that the caller has read access to are returned. If the - * caller does not have read access to any roles an empty array is returned. - * - * @return a {@link ServiceCall} with a result of type {@link RoleCollection} - */ - public ServiceCall listRoles() { - return listRoles(null); - } - - /** - * Create a role. - * - * Creates a custom role for a specific service within the account. An account owner or a user assigned the - * Administrator role on the Role management service can create a custom role. Any number of actions for a single - * service can be mapped to the new role, but there must be at least one service-defined action to successfully create - * the new role. - * - * @param createRoleOptions the {@link CreateRoleOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link CustomRole} - */ - public ServiceCall createRole(CreateRoleOptions createRoleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleOptions, - "createRoleOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRole"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createRoleOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createRoleOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("display_name", createRoleOptions.displayName()); - contentJson.add("actions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleOptions.actions())); - contentJson.addProperty("name", createRoleOptions.name()); - contentJson.addProperty("account_id", createRoleOptions.accountId()); - contentJson.addProperty("service_name", createRoleOptions.serviceName()); - if (createRoleOptions.description() != null) { - contentJson.addProperty("description", createRoleOptions.description()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a role. - * - * Update a custom role. A role administrator might want to update an existing role by updating the display name, - * description, or the actions that are mapped to the role. The name, account_id, and service_name can't be changed. - * - * @param replaceRoleOptions the {@link ReplaceRoleOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link CustomRole} - */ - public ServiceCall replaceRole(ReplaceRoleOptions replaceRoleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceRoleOptions, - "replaceRoleOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_id", replaceRoleOptions.roleId()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceRole"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replaceRoleOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("display_name", replaceRoleOptions.displayName()); - contentJson.add("actions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRoleOptions.actions())); - if (replaceRoleOptions.description() != null) { - contentJson.addProperty("description", replaceRoleOptions.description()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a role by ID. - * - * Retrieve a role by providing a role ID. - * - * @param getRoleOptions the {@link GetRoleOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link CustomRole} - */ - public ServiceCall getRole(GetRoleOptions getRoleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleOptions, - "getRoleOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_id", getRoleOptions.roleId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRole"); - 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); - } - - /** - * Delete a role by ID. - * - * Delete a role by providing a role ID. - * - * @param deleteRoleOptions the {@link DeleteRoleOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteRole(DeleteRoleOptions deleteRoleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleOptions, - "deleteRoleOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_id", deleteRoleOptions.roleId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRole"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get policies by attributes. - * - * Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account - * and filter by attribute values. This can be done through query parameters. The following attributes are supported: - * account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query - * parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If - * the caller does not have read access to any policies an empty array is returned. - * - * @param listV2PoliciesOptions the {@link ListV2PoliciesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link V2PolicyCollection} - */ - public ServiceCall listV2Policies(ListV2PoliciesOptions listV2PoliciesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listV2PoliciesOptions, - "listV2PoliciesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listV2Policies"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listV2PoliciesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listV2PoliciesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listV2PoliciesOptions.accountId())); - if (listV2PoliciesOptions.iamId() != null) { - builder.query("iam_id", String.valueOf(listV2PoliciesOptions.iamId())); - } - if (listV2PoliciesOptions.accessGroupId() != null) { - builder.query("access_group_id", String.valueOf(listV2PoliciesOptions.accessGroupId())); - } - if (listV2PoliciesOptions.type() != null) { - builder.query("type", String.valueOf(listV2PoliciesOptions.type())); - } - if (listV2PoliciesOptions.serviceType() != null) { - builder.query("service_type", String.valueOf(listV2PoliciesOptions.serviceType())); - } - if (listV2PoliciesOptions.serviceName() != null) { - builder.query("service_name", String.valueOf(listV2PoliciesOptions.serviceName())); - } - if (listV2PoliciesOptions.serviceGroupId() != null) { - builder.query("service_group_id", String.valueOf(listV2PoliciesOptions.serviceGroupId())); - } - if (listV2PoliciesOptions.sort() != null) { - builder.query("sort", String.valueOf(listV2PoliciesOptions.sort())); - } - if (listV2PoliciesOptions.format() != null) { - builder.query("format", String.valueOf(listV2PoliciesOptions.format())); - } - if (listV2PoliciesOptions.state() != null) { - builder.query("state", String.valueOf(listV2PoliciesOptions.state())); - } - if (listV2PoliciesOptions.limit() != null) { - builder.query("limit", String.valueOf(listV2PoliciesOptions.limit())); - } - if (listV2PoliciesOptions.start() != null) { - builder.query("start", String.valueOf(listV2PoliciesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a policy. - * - * Creates a policy to grant access between a subject and a resource. Currently, there is one type of a v2/policy: - * **access**. A policy administrator might want to create an access policy that grants access to a user, service-id, - * or an access group. - * - * ### Access - * - * To create an access policy, use **`"type": "access"`** in the body. The supported subject attributes are - * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute to assign access to a user or - * service-id. Use the **`access_group_id`** subject attribute to assign access to an access group. Assign roles that - * are supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or - * **`service_group_id`** attribute and the **`accountId`** attribute. In the rule field, you can specify a single - * condition by using **`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`** with a - * combination **`operator`**. The possible combination operators are **`and`** and **`or`**. - * - * Currently, we support two types of patterns: - * - * 1. `time-based`: Used to specify a time-based restriction - * - * Combine conditions to specify a time-based restriction (e.g., access only during business hours, during the - * Monday-Friday work week). For example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following - * rule: - * ```json - * "rule": { - * "operator": "and", - * "conditions": [{ - * "key": "{{environment.attributes.day_of_week}}", - * "operator": "dayOfWeekAnyOf", - * "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] - * }, - * "key": "{{environment.attributes.current_time}}", - * "operator": "timeGreaterThanOrEquals", - * "value": "09:00:00+00:00" - * }, - * "key": "{{environment.attributes.current_time}}", - * "operator": "timeLessThanOrEquals", - * "value": "17:00:00+00:00" - * }] - * } - * ``` You can use the following operators in the **`key`** and **`value`** pair: - * ``` - * 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', - * 'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan', 'dateGreaterThanOrEquals', - * 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', - * 'dayOfWeekEquals', 'dayOfWeekAnyOf' - * ``` - * - * The pattern field that matches the rule is required when rule is provided. For the business hour rule example - * above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions - * operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) and - * [Limiting access with time-based conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the - * subject is a locked service-id, the request will fail. - * - * 2. `attribute-based`: Used to specify a combination of OR/AND based conditions applied on resource attributes. - * - * Combine conditions to specify an attribute-based condition using AND/OR-based operators. - * - * For example, a policy can grant access based on multiple conditions applied on the resource attributes below: - * ```json - * "pattern": "attribute-based-condition:resource:literal-and-wildcard" - * "rule": { - * "operator": "or", - * "conditions": [ - * { - * "operator": "and", - * "conditions": [ - * { - * "key": "{{resource.attributes.prefix}}", - * "operator": "stringEquals", - * "value": "home/test" - * }, - * { - * "key": "{{environment.attributes.delimiter}}", - * "operator": "stringEquals", - * "value": "/" - * } - * ] - * }, - * { - * "key": "{{resource.attributes.path}}", - * "operator": "stringMatch", - * "value": "home/David/_*" - * } - * ] - * } - * ``` - * - * In addition to satisfying the `resources` section, the policy grants permission only if either the `path` begins - * with `home/David/` **OR** the `prefix` is `home/test` and the `delimiter` is `/`. This mechanism helps you - * consolidate multiple policies in to a single policy, making policies easier to administer and stay within the - * policy limit for an account. View the list of operators that can be used in the condition - * [here](/docs/account?topic=account-wildcard#string-comparisons). - * - * ### Authorization - * - * Authorization policies are supported by services on a case by case basis. Refer to service documentation to verify - * their support of authorization policies. To create an authorization policy, use **`"type": "authorization"`** in - * the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject - * attributes might be provided. The following attributes are supported: - * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are - * supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access - * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject - * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. - * - * ### Attribute Operators - * - * Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators are available. For more - * information, see [Assigning access by using wildcard - * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). - * - * ### Attribute Validations - * - * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like - * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated - * against Global Catalog locations. - * - * @param createV2PolicyOptions the {@link CreateV2PolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link V2Policy} - */ - public ServiceCall createV2Policy(CreateV2PolicyOptions createV2PolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createV2PolicyOptions, - "createV2PolicyOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createV2Policy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createV2PolicyOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createV2PolicyOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.add("control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.control())); - contentJson.addProperty("type", createV2PolicyOptions.type()); - if (createV2PolicyOptions.description() != null) { - contentJson.addProperty("description", createV2PolicyOptions.description()); - } - if (createV2PolicyOptions.subject() != null) { - contentJson.add("subject", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.subject())); - } - if (createV2PolicyOptions.resource() != null) { - contentJson.add("resource", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.resource())); - } - if (createV2PolicyOptions.pattern() != null) { - contentJson.addProperty("pattern", createV2PolicyOptions.pattern()); - } - if (createV2PolicyOptions.rule() != null) { - contentJson.add("rule", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.rule())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a policy. - * - * Update a policy to grant access between a subject and a resource. A policy administrator might want to update an - * existing policy. - * - * ### Access - * - * To update an access policy, use **`"type": "access"`** in the body. The supported subject attributes are - * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute to assign access to a user or - * service-id. Use the **`access_group_id`** subject attribute to assign access to an access group. Assign roles that - * are supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or - * **`service_group_id`** attribute and the **`accountId`** attribute. In the rule field, you can specify a single - * condition by using **`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`** with a - * combination **`operator`**. The possible combination operators are **`and`** and **`or`**. - * - * Currently, we support two types of patterns: - * - * 1. `time-based`: Used to specify a time-based restriction - * - * Combine conditions to specify a time-based restriction (e.g., access only during business hours, during the - * Monday-Friday work week). For example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following - * rule: - * ```json - * "rule": { - * "operator": "and", - * "conditions": [{ - * "key": "{{environment.attributes.day_of_week}}", - * "operator": "dayOfWeekAnyOf", - * "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] - * }, - * "key": "{{environment.attributes.current_time}}", - * "operator": "timeGreaterThanOrEquals", - * "value": "09:00:00+00:00" - * }, - * "key": "{{environment.attributes.current_time}}", - * "operator": "timeLessThanOrEquals", - * "value": "17:00:00+00:00" - * }] - * } - * ``` You can use the following operators in the **`key`** and **`value`** pair: - * ``` - * 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', - * 'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan', 'dateGreaterThanOrEquals', - * 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', - * 'dayOfWeekEquals', 'dayOfWeekAnyOf' - * ``` The pattern field that matches the rule is required when rule is provided. For the business hour rule example - * above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions - * operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) and - * [Limiting access with time-based conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the - * subject is a locked service-id, the request will fail. - * - * 2. `attribute-based`: Used to specify a combination of OR/AND based conditions applied on resource attributes. - * - * Combine conditions to specify an attribute-based condition using AND/OR-based operators. - * - * For example, a policy can grant access based on multiple conditions applied on the resource attributes below: - * ```json - * "pattern": "attribute-based-condition:resource:literal-and-wildcard" - * "rule": { - * "operator": "or", - * "conditions": [ - * { - * "operator": "and", - * "conditions": [ - * { - * "key": "{{resource.attributes.prefix}}", - * "operator": "stringEquals", - * "value": "home/test" - * }, - * { - * "key": "{{environment.attributes.delimiter}}", - * "operator": "stringEquals", - * "value": "/" - * } - * ] - * }, - * { - * "key": "{{resource.attributes.path}}", - * "operator": "stringMatch", - * "value": "home/David/_*" - * } - * ] - * } - * ``` - * - * In addition to satisfying the `resources` section, the policy grants permission only if either the `path` begins - * with `home/David/` **OR** the `prefix` is `home/test` and the `delimiter` is `/`. This mechanism helps you - * consolidate multiple policies in to a single policy, making policies easier to administer and stay within the - * policy limit for an account. View the list of operators that can be used in the condition - * [here](/docs/account?topic=account-wildcard#string-comparisons). - * - * ### Authorization - * - * To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match - * the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following - * attributes are supported: - * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are - * supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access - * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject - * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. - * - * ### Attribute Operators - * - * Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators are available. For more - * information, see [Assigning access by using wildcard - * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). - * - * ### Attribute Validations - * - * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like - * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated - * against Global Catalog locations. - * - * @param replaceV2PolicyOptions the {@link ReplaceV2PolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link V2Policy} - */ - public ServiceCall replaceV2Policy(ReplaceV2PolicyOptions replaceV2PolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceV2PolicyOptions, - "replaceV2PolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", replaceV2PolicyOptions.id()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceV2Policy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replaceV2PolicyOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.add("control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.control())); - contentJson.addProperty("type", replaceV2PolicyOptions.type()); - if (replaceV2PolicyOptions.description() != null) { - contentJson.addProperty("description", replaceV2PolicyOptions.description()); - } - if (replaceV2PolicyOptions.subject() != null) { - contentJson.add("subject", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.subject())); - } - if (replaceV2PolicyOptions.resource() != null) { - contentJson.add("resource", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.resource())); - } - if (replaceV2PolicyOptions.pattern() != null) { - contentJson.addProperty("pattern", replaceV2PolicyOptions.pattern()); - } - if (replaceV2PolicyOptions.rule() != null) { - contentJson.add("rule", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.rule())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a policy by ID. - * - * Retrieve a policy by providing a policy ID. - * - * @param getV2PolicyOptions the {@link GetV2PolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link V2PolicyTemplateMetaData} - */ - public ServiceCall getV2Policy(GetV2PolicyOptions getV2PolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getV2PolicyOptions, - "getV2PolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", getV2PolicyOptions.id()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getV2Policy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getV2PolicyOptions.format() != null) { - builder.query("format", String.valueOf(getV2PolicyOptions.format())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a policy by ID. - * - * Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service - * ID. If the subject of the policy is a locked service-id, the request will fail. - * - * @param deleteV2PolicyOptions the {@link DeleteV2PolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteV2Policy(DeleteV2PolicyOptions deleteV2PolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteV2PolicyOptions, - "deleteV2PolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", deleteV2PolicyOptions.id()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteV2Policy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List policy templates by attributes. - * - * List policy templates and filter by attributes by using query parameters. The following attributes are supported: - * `account_id`, `policy_service_name`, `policy_service_type`, `policy_service_group_id` and `policy_type`. - * `account_id` is a required query parameter. These attributes `policy_service_name`, `policy_service_type` and - * `policy_service_group_id` are mutually exclusive. Only policy templates that have the specified attributes and that - * the caller has read access to are returned. If the caller does not have read access to any policy templates an - * empty array is returned. - * - * @param listPolicyTemplatesOptions the {@link ListPolicyTemplatesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateCollection} - */ - public ServiceCall listPolicyTemplates(ListPolicyTemplatesOptions listPolicyTemplatesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyTemplatesOptions, - "listPolicyTemplatesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyTemplates"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listPolicyTemplatesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listPolicyTemplatesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listPolicyTemplatesOptions.accountId())); - if (listPolicyTemplatesOptions.state() != null) { - builder.query("state", String.valueOf(listPolicyTemplatesOptions.state())); - } - if (listPolicyTemplatesOptions.name() != null) { - builder.query("name", String.valueOf(listPolicyTemplatesOptions.name())); - } - if (listPolicyTemplatesOptions.policyServiceType() != null) { - builder.query("policy_service_type", String.valueOf(listPolicyTemplatesOptions.policyServiceType())); - } - if (listPolicyTemplatesOptions.policyServiceName() != null) { - builder.query("policy_service_name", String.valueOf(listPolicyTemplatesOptions.policyServiceName())); - } - if (listPolicyTemplatesOptions.policyServiceGroupId() != null) { - builder.query("policy_service_group_id", String.valueOf(listPolicyTemplatesOptions.policyServiceGroupId())); - } - if (listPolicyTemplatesOptions.policyType() != null) { - builder.query("policy_type", String.valueOf(listPolicyTemplatesOptions.policyType())); - } - if (listPolicyTemplatesOptions.limit() != null) { - builder.query("limit", String.valueOf(listPolicyTemplatesOptions.limit())); - } - if (listPolicyTemplatesOptions.start() != null) { - builder.query("start", String.valueOf(listPolicyTemplatesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a policy template. - * - * Create a policy template. Policy templates define a policy without requiring a subject, and you can use them to - * grant access to multiple subjects. - * - * @param createPolicyTemplateOptions the {@link CreatePolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateLimitData} - */ - public ServiceCall createPolicyTemplate(CreatePolicyTemplateOptions createPolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateOptions, - "createPolicyTemplateOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createPolicyTemplateOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createPolicyTemplateOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("name", createPolicyTemplateOptions.name()); - contentJson.addProperty("account_id", createPolicyTemplateOptions.accountId()); - contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateOptions.policy())); - if (createPolicyTemplateOptions.description() != null) { - contentJson.addProperty("description", createPolicyTemplateOptions.description()); - } - if (createPolicyTemplateOptions.committed() != null) { - contentJson.addProperty("committed", createPolicyTemplateOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve latest version of a policy template. - * - * Retrieve the latest version of a policy template by providing a policy template ID. - * - * @param getPolicyTemplateOptions the {@link GetPolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} - */ - public ServiceCall getPolicyTemplate(GetPolicyTemplateOptions getPolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyTemplateOptions, - "getPolicyTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", getPolicyTemplateOptions.policyTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getPolicyTemplateOptions.state() != null) { - builder.query("state", String.valueOf(getPolicyTemplateOptions.state())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a policy template. - * - * Delete a policy template by providing the policy template ID. This deletes all versions of this template. A policy - * template can't be deleted if any version of the template is assigned to one or more child accounts. You must remove - * the policy assignments first. - * - * @param deletePolicyTemplateOptions the {@link DeletePolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deletePolicyTemplate(DeletePolicyTemplateOptions deletePolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyTemplateOptions, - "deletePolicyTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", deletePolicyTemplateOptions.policyTemplateId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a new policy template version. - * - * Create a new version of a policy template. Use this if you need to make updates to a policy template that is - * committed. - * - * @param createPolicyTemplateVersionOptions the {@link CreatePolicyTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateLimitData} - */ - public ServiceCall createPolicyTemplateVersion(CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateVersionOptions, - "createPolicyTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", createPolicyTemplateVersionOptions.policyTemplateId()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - final JsonObject contentJson = new JsonObject(); - contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateVersionOptions.policy())); - if (createPolicyTemplateVersionOptions.name() != null) { - contentJson.addProperty("name", createPolicyTemplateVersionOptions.name()); - } - if (createPolicyTemplateVersionOptions.description() != null) { - contentJson.addProperty("description", createPolicyTemplateVersionOptions.description()); - } - if (createPolicyTemplateVersionOptions.committed() != null) { - contentJson.addProperty("committed", createPolicyTemplateVersionOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve policy template versions. - * - * Retrieve the versions of a policy template by providing a policy template ID. - * - * @param listPolicyTemplateVersionsOptions the {@link ListPolicyTemplateVersionsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateVersionsCollection} - */ - public ServiceCall listPolicyTemplateVersions(ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyTemplateVersionsOptions, - "listPolicyTemplateVersionsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", listPolicyTemplateVersionsOptions.policyTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyTemplateVersions"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listPolicyTemplateVersionsOptions.state() != null) { - builder.query("state", String.valueOf(listPolicyTemplateVersionsOptions.state())); - } - if (listPolicyTemplateVersionsOptions.limit() != null) { - builder.query("limit", String.valueOf(listPolicyTemplateVersionsOptions.limit())); - } - if (listPolicyTemplateVersionsOptions.start() != null) { - builder.query("start", String.valueOf(listPolicyTemplateVersionsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a policy template version. - * - * Update a specific version of a policy template. You can use this only if the version isn't committed. - * - * @param replacePolicyTemplateOptions the {@link ReplacePolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} - */ - public ServiceCall replacePolicyTemplate(ReplacePolicyTemplateOptions replacePolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replacePolicyTemplateOptions, - "replacePolicyTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", replacePolicyTemplateOptions.policyTemplateId()); - pathParamsMap.put("version", replacePolicyTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replacePolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replacePolicyTemplateOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyTemplateOptions.policy())); - if (replacePolicyTemplateOptions.name() != null) { - contentJson.addProperty("name", replacePolicyTemplateOptions.name()); - } - if (replacePolicyTemplateOptions.description() != null) { - contentJson.addProperty("description", replacePolicyTemplateOptions.description()); - } - if (replacePolicyTemplateOptions.committed() != null) { - contentJson.addProperty("committed", replacePolicyTemplateOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a policy template version. - * - * Delete a specific version of a policy template by providing a policy template ID and version number. You can't - * delete a policy template version that is assigned to one or more child accounts. You must remove the policy - * assignments first. - * - * @param deletePolicyTemplateVersionOptions the {@link DeletePolicyTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deletePolicyTemplateVersion(DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyTemplateVersionOptions, - "deletePolicyTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", deletePolicyTemplateVersionOptions.policyTemplateId()); - pathParamsMap.put("version", deletePolicyTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a policy template version. - * - * Retrieve a policy template by providing a policy template ID and version number. - * - * @param getPolicyTemplateVersionOptions the {@link GetPolicyTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} - */ - public ServiceCall getPolicyTemplateVersion(GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyTemplateVersionOptions, - "getPolicyTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", getPolicyTemplateVersionOptions.policyTemplateId()); - pathParamsMap.put("version", getPolicyTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyTemplateVersion"); - 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); - } - - /** - * Commit a policy template version. - * - * Commit a policy template version. You can make no further changes to the policy template once it's committed. If - * you need to make updates after committing a version, create a new version. - * - * @param commitPolicyTemplateOptions the {@link CommitPolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall commitPolicyTemplate(CommitPolicyTemplateOptions commitPolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(commitPolicyTemplateOptions, - "commitPolicyTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", commitPolicyTemplateOptions.policyTemplateId()); - pathParamsMap.put("version", commitPolicyTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}/commit", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitPolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get policy template assignments. - * - * Get policy template assignments by attributes. The following attributes are supported: - * `account_id`, `template_id`, `template_version`, `sort`. - * `account_id` is a required query parameter. Only policy template assignments that have the specified attributes and - * that the caller has read access to are returned. If the caller does not have read access to any policy template - * assignments an empty array is returned. - * - * @param listPolicyAssignmentsOptions the {@link ListPolicyAssignmentsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateAssignmentCollection} - */ - public ServiceCall listPolicyAssignments(ListPolicyAssignmentsOptions listPolicyAssignmentsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyAssignmentsOptions, - "listPolicyAssignmentsOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyAssignments"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listPolicyAssignmentsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listPolicyAssignmentsOptions.acceptLanguage()); - } - builder.query("version", String.valueOf(listPolicyAssignmentsOptions.version())); - builder.query("account_id", String.valueOf(listPolicyAssignmentsOptions.accountId())); - if (listPolicyAssignmentsOptions.templateId() != null) { - builder.query("template_id", String.valueOf(listPolicyAssignmentsOptions.templateId())); - } - if (listPolicyAssignmentsOptions.templateVersion() != null) { - builder.query("template_version", String.valueOf(listPolicyAssignmentsOptions.templateVersion())); - } - if (listPolicyAssignmentsOptions.limit() != null) { - builder.query("limit", String.valueOf(listPolicyAssignmentsOptions.limit())); - } - if (listPolicyAssignmentsOptions.start() != null) { - builder.query("start", String.valueOf(listPolicyAssignmentsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a policy authorization template assignment. - * - * Assign a policy template to child accounts and account groups. This creates the policy in the accounts and account - * groups that you specify. - * - * @param createPolicyTemplateAssignmentOptions the {@link CreatePolicyTemplateAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyAssignmentV1Collection} - */ - public ServiceCall createPolicyTemplateAssignment(CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateAssignmentOptions, - "createPolicyTemplateAssignmentOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplateAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createPolicyTemplateAssignmentOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createPolicyTemplateAssignmentOptions.acceptLanguage()); - } - builder.query("version", String.valueOf(createPolicyTemplateAssignmentOptions.version())); - final JsonObject contentJson = new JsonObject(); - contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateAssignmentOptions.target())); - contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateAssignmentOptions.templates())); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a policy assignment. - * - * Retrieve a policy template assignment by providing a policy assignment ID. - * - * @param getPolicyAssignmentOptions the {@link GetPolicyAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateAssignmentItems} - */ - public ServiceCall getPolicyAssignment(GetPolicyAssignmentOptions getPolicyAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyAssignmentOptions, - "getPolicyAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", getPolicyAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(getPolicyAssignmentOptions.version())); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a policy authorization type assignment. - * - * Update a policy assignment by providing a policy assignment ID. - * - * @param updatePolicyAssignmentOptions the {@link UpdatePolicyAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyAssignmentV1} - */ - public ServiceCall updatePolicyAssignment(UpdatePolicyAssignmentOptions updatePolicyAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updatePolicyAssignmentOptions, - "updatePolicyAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", updatePolicyAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updatePolicyAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updatePolicyAssignmentOptions.ifMatch()); - builder.query("version", String.valueOf(updatePolicyAssignmentOptions.version())); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("template_version", updatePolicyAssignmentOptions.templateVersion()); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Remove a policy assignment. - * - * Remove a policy template assignment by providing a policy assignment ID. You can't delete a policy assignment if - * the status is "in_progress". - * - * @param deletePolicyAssignmentOptions the {@link DeletePolicyAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deletePolicyAssignment(DeletePolicyAssignmentOptions deletePolicyAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyAssignmentOptions, - "deletePolicyAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", deletePolicyAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve Access Management account settings by account ID. - * - * Retrieve Access Management settings for an account by providing the account ID. - * - * @param getSettingsOptions the {@link GetSettingsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AccountSettingsAccessManagement} - */ - public ServiceCall getSettings(GetSettingsOptions getSettingsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getSettingsOptions, - "getSettingsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", getSettingsOptions.accountId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/settings/access_management", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getSettings"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getSettingsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", getSettingsOptions.acceptLanguage()); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update Access Management account settings by account ID. - * - * Update access management settings for an account. - * - * ### External Account Identity Interaction - * - * Update the way identities within an external account are allowed to interact with the requested account by - * providing: - * * the `account_id` as a parameter - * * one or more external account ID(s) and state for the specific identity in the request body - * - * External account identity interaction includes the following `identity_types`: `user` (user identities that are - * defined as [IBMid's](https://cloud.ibm.com/docs/account?topic=account-identity-overview#users-bestpract)), - * `service_id` (defined as [IAM - * ServiceIds](https://cloud.ibm.com/docs/account?topic=account-identity-overview#serviceid-bestpract)), `service` - * (defined by a service’s [CRN](https://cloud.ibm.com/docs/account?topic=account-crn)). To update an Identity’s - * setting, the `state` and `external_allowed_accounts` fields are required. - * - * Different identity states are: - * * "enabled": An identity type is allowed to access resources in the account provided it has access policies on - * those resources. - * * "limited": An identity type is allowed to access resources in the account provided it has access policies on - * those resources AND it is associated with either the account the resources are in or one of the allowed accounts. - * This setting uses the "external_allowed_accounts" list. - * * "monitor": It has no direct impact on an Identity’s access. Instead, it creates AT events for access decisions as - * if the account were in a limited “state”. - * - * **Note**: The state "enabled" is a special case. In this case, access is given to all accounts and there is no need - * to specify a particular list. Therefore, when updating "state" to "enabled" for an identity type - * "external_allowed_accounts" should be left empty. - * - * @param updateSettingsOptions the {@link UpdateSettingsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AccountSettingsAccessManagement} - */ - public ServiceCall updateSettings(UpdateSettingsOptions updateSettingsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateSettingsOptions, - "updateSettingsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", updateSettingsOptions.accountId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/settings/access_management", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateSettings"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updateSettingsOptions.ifMatch()); - if (updateSettingsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", updateSettingsOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - if (updateSettingsOptions.externalAccountIdentityInteraction() != null) { - contentJson.add("external_account_identity_interaction", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateSettingsOptions.externalAccountIdentityInteraction())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List action control templates by attributes. - * - * List action control templates and filter by attributes by using query parameters. The following attributes are - * supported: - * `account_id` - * `account_id` is a required query parameter. Only action control templates that have the specified attributes and - * that the caller has read access to are returned. If the caller does not have read access to any action control - * templates an empty array is returned. - * - * @param listActionControlTemplatesOptions the {@link ListActionControlTemplatesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplateCollection} - */ - public ServiceCall listActionControlTemplates(ListActionControlTemplatesOptions listActionControlTemplatesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlTemplatesOptions, - "listActionControlTemplatesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlTemplates"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listActionControlTemplatesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listActionControlTemplatesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listActionControlTemplatesOptions.accountId())); - if (listActionControlTemplatesOptions.limit() != null) { - builder.query("limit", String.valueOf(listActionControlTemplatesOptions.limit())); - } - if (listActionControlTemplatesOptions.start() != null) { - builder.query("start", String.valueOf(listActionControlTemplatesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create an action control template. - * - * Create an action control template. Action control templates define a service action control. - * - * @param createActionControlTemplateOptions the {@link CreateActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall createActionControlTemplate(CreateActionControlTemplateOptions createActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateOptions, - "createActionControlTemplateOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createActionControlTemplateOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createActionControlTemplateOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("name", createActionControlTemplateOptions.name()); - contentJson.addProperty("account_id", createActionControlTemplateOptions.accountId()); - if (createActionControlTemplateOptions.description() != null) { - contentJson.addProperty("description", createActionControlTemplateOptions.description()); - } - if (createActionControlTemplateOptions.committed() != null) { - contentJson.addProperty("committed", createActionControlTemplateOptions.committed()); - } - if (createActionControlTemplateOptions.actionControl() != null) { - contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateOptions.actionControl())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve the latest version of an action control template. - * - * Retrieve the latest version of an action control template by providing an action control template ID. - * - * @param getActionControlTemplateOptions the {@link GetActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall getActionControlTemplate(GetActionControlTemplateOptions getActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlTemplateOptions, - "getActionControlTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", getActionControlTemplateOptions.actionControlTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getActionControlTemplateOptions.state() != null) { - builder.query("state", String.valueOf(getActionControlTemplateOptions.state())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete an action control template. - * - * Delete an action control template by providing the action control template ID. This deletes all versions of this - * template. An action control template can't be deleted if any version of the template is assigned to one or more - * child accounts. You must remove the action control assignments first. - * - * @param deleteActionControlTemplateOptions the {@link DeleteActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteActionControlTemplate(DeleteActionControlTemplateOptions deleteActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlTemplateOptions, - "deleteActionControlTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", deleteActionControlTemplateOptions.actionControlTemplateId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a new action control template version. - * - * Create a new version of an action control template. Use this if you need to make updates to an action control - * template that is committed. - * - * @param createActionControlTemplateVersionOptions the {@link CreateActionControlTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall createActionControlTemplateVersion(CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateVersionOptions, - "createActionControlTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", createActionControlTemplateVersionOptions.actionControlTemplateId()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - final JsonObject contentJson = new JsonObject(); - if (createActionControlTemplateVersionOptions.name() != null) { - contentJson.addProperty("name", createActionControlTemplateVersionOptions.name()); - } - if (createActionControlTemplateVersionOptions.description() != null) { - contentJson.addProperty("description", createActionControlTemplateVersionOptions.description()); - } - if (createActionControlTemplateVersionOptions.actionControl() != null) { - contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateVersionOptions.actionControl())); - } - if (createActionControlTemplateVersionOptions.committed() != null) { - contentJson.addProperty("committed", createActionControlTemplateVersionOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve action control template versions. - * - * Retrieve the versions of an action control template by providing an action control template ID. - * - * @param listActionControlTemplateVersionsOptions the {@link ListActionControlTemplateVersionsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplateVersionsCollection} - */ - public ServiceCall listActionControlTemplateVersions(ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlTemplateVersionsOptions, - "listActionControlTemplateVersionsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", listActionControlTemplateVersionsOptions.actionControlTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlTemplateVersions"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listActionControlTemplateVersionsOptions.state() != null) { - builder.query("state", String.valueOf(listActionControlTemplateVersionsOptions.state())); - } - if (listActionControlTemplateVersionsOptions.limit() != null) { - builder.query("limit", String.valueOf(listActionControlTemplateVersionsOptions.limit())); - } - if (listActionControlTemplateVersionsOptions.start() != null) { - builder.query("start", String.valueOf(listActionControlTemplateVersionsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update an action control template version. - * - * Update a specific version of an action control template. You can use this only if the version isn't committed. - * - * @param replaceActionControlTemplateOptions the {@link ReplaceActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall replaceActionControlTemplate(ReplaceActionControlTemplateOptions replaceActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceActionControlTemplateOptions, - "replaceActionControlTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", replaceActionControlTemplateOptions.actionControlTemplateId()); - pathParamsMap.put("version", replaceActionControlTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replaceActionControlTemplateOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - if (replaceActionControlTemplateOptions.name() != null) { - contentJson.addProperty("name", replaceActionControlTemplateOptions.name()); - } - if (replaceActionControlTemplateOptions.description() != null) { - contentJson.addProperty("description", replaceActionControlTemplateOptions.description()); - } - if (replaceActionControlTemplateOptions.actionControl() != null) { - contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceActionControlTemplateOptions.actionControl())); - } - if (replaceActionControlTemplateOptions.committed() != null) { - contentJson.addProperty("committed", replaceActionControlTemplateOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete an action control template version. - * - * Delete a specific version of an action control template by providing an action control template ID and version - * number. You can't delete an action control template version that is assigned to one or more child accounts. You - * must remove the action control assignments first. - * - * @param deleteActionControlTemplateVersionOptions the {@link DeleteActionControlTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteActionControlTemplateVersion(DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlTemplateVersionOptions, - "deleteActionControlTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", deleteActionControlTemplateVersionOptions.actionControlTemplateId()); - pathParamsMap.put("version", deleteActionControlTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve an action control template version. - * - * Retrieve an action control template by providing an action control template ID and version number. - * - * @param getActionControlTemplateVersionOptions the {@link GetActionControlTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall getActionControlTemplateVersion(GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlTemplateVersionOptions, - "getActionControlTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", getActionControlTemplateVersionOptions.actionControlTemplateId()); - pathParamsMap.put("version", getActionControlTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlTemplateVersion"); - 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); - } - - /** - * Commit an action control template version. - * - * Commit an action control template version. You cannot make any further changes to the action control template once - * it's committed. If you have to make updates after committing a version, create a new version. - * - * @param commitActionControlTemplateOptions the {@link CommitActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall commitActionControlTemplate(CommitActionControlTemplateOptions commitActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(commitActionControlTemplateOptions, - "commitActionControlTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", commitActionControlTemplateOptions.actionControlTemplateId()); - pathParamsMap.put("version", commitActionControlTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}/commit", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get action control template assignments. - * - * Get action control template assignments by attributes. The following attributes are supported: - * `account_id`, `template_id`, `template_version`, `sort`. - * `account_id` is a required query parameter. Only action control template assignments with the specified attributes - * and accessible by the caller are returned. If the caller does not have read access to any action control template - * assignments, an empty array is returned. - * - * @param listActionControlAssignmentsOptions the {@link ListActionControlAssignmentsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignmentCollection} - */ - public ServiceCall listActionControlAssignments(ListActionControlAssignmentsOptions listActionControlAssignmentsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlAssignmentsOptions, - "listActionControlAssignmentsOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlAssignments"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listActionControlAssignmentsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listActionControlAssignmentsOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listActionControlAssignmentsOptions.accountId())); - if (listActionControlAssignmentsOptions.templateId() != null) { - builder.query("template_id", String.valueOf(listActionControlAssignmentsOptions.templateId())); - } - if (listActionControlAssignmentsOptions.templateVersion() != null) { - builder.query("template_version", String.valueOf(listActionControlAssignmentsOptions.templateVersion())); - } - if (listActionControlAssignmentsOptions.limit() != null) { - builder.query("limit", String.valueOf(listActionControlAssignmentsOptions.limit())); - } - if (listActionControlAssignmentsOptions.start() != null) { - builder.query("start", String.valueOf(listActionControlAssignmentsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create an action control template assignment. - * - * Assign an action control template to child accounts and account groups. This creates the action control in the - * accounts and account groups that you specify. - * - * @param createActionControlTemplateAssignmentOptions the {@link CreateActionControlTemplateAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignmentCollection} - */ - public ServiceCall createActionControlTemplateAssignment(CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateAssignmentOptions, - "createActionControlTemplateAssignmentOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplateAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createActionControlTemplateAssignmentOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createActionControlTemplateAssignmentOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateAssignmentOptions.target())); - contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateAssignmentOptions.templates())); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve an action control assignment. - * - * Retrieve an action control template assignment by providing an action control assignment ID. - * - * @param getActionControlAssignmentOptions the {@link GetActionControlAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignment} - */ - public ServiceCall getActionControlAssignment(GetActionControlAssignmentOptions getActionControlAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlAssignmentOptions, - "getActionControlAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", getActionControlAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlAssignment"); - 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 an action control assignment. - * - * Update an action control assignment by providing an action control assignment ID. - * - * @param updateActionControlAssignmentOptions the {@link UpdateActionControlAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignment} - */ - public ServiceCall updateActionControlAssignment(UpdateActionControlAssignmentOptions updateActionControlAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateActionControlAssignmentOptions, - "updateActionControlAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", updateActionControlAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateActionControlAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updateActionControlAssignmentOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("template_version", updateActionControlAssignmentOptions.templateVersion()); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Remove an action control assignment. - * - * Remove an action control template assignment by providing an action control assignment ID. You can't delete an - * action control assignment if the status is "in_progress". - * - * @param deleteActionControlAssignmentOptions the {@link DeleteActionControlAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteActionControlAssignment(DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlAssignmentOptions, - "deleteActionControlAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", deleteActionControlAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List role templates by attributes. - * - * List role templates and filter by attributes by using query parameters. The following attributes are supported: - * `account_id`, `name`, `role_name`, `role_service_name`, `state`, `limit`, `start`. - * `account_id` is a required query parameter. Only role templates that have the specified attributes and that the - * caller has read access to are returned. If the caller does not have read access to any role templates an empty - * array is returned. - * - * @param listRoleTemplatesOptions the {@link ListRoleTemplatesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplateCollection} - */ - public ServiceCall listRoleTemplates(ListRoleTemplatesOptions listRoleTemplatesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleTemplatesOptions, - "listRoleTemplatesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleTemplates"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listRoleTemplatesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listRoleTemplatesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listRoleTemplatesOptions.accountId())); - if (listRoleTemplatesOptions.name() != null) { - builder.query("name", String.valueOf(listRoleTemplatesOptions.name())); - } - if (listRoleTemplatesOptions.roleName() != null) { - builder.query("role_name", String.valueOf(listRoleTemplatesOptions.roleName())); - } - if (listRoleTemplatesOptions.roleServiceName() != null) { - builder.query("role_service_name", String.valueOf(listRoleTemplatesOptions.roleServiceName())); - } - if (listRoleTemplatesOptions.state() != null) { - builder.query("state", String.valueOf(listRoleTemplatesOptions.state())); - } - if (listRoleTemplatesOptions.limit() != null) { - builder.query("limit", String.valueOf(listRoleTemplatesOptions.limit())); - } - if (listRoleTemplatesOptions.start() != null) { - builder.query("start", String.valueOf(listRoleTemplatesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create role template. - * - * Create a role template. Role templates define roles from an existing system or service defined role. - * - * @param createRoleTemplateOptions the {@link CreateRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall createRoleTemplate(CreateRoleTemplateOptions createRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateOptions, - "createRoleTemplateOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createRoleTemplateOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createRoleTemplateOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("name", createRoleTemplateOptions.name()); - contentJson.addProperty("account_id", createRoleTemplateOptions.accountId()); - if (createRoleTemplateOptions.description() != null) { - contentJson.addProperty("description", createRoleTemplateOptions.description()); - } - if (createRoleTemplateOptions.committed() != null) { - contentJson.addProperty("committed", createRoleTemplateOptions.committed()); - } - if (createRoleTemplateOptions.role() != null) { - contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateOptions.role())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve the latest version of a role template. - * - * Retrieve the latest version of a role template by providing a role template ID. - * - * @param getRoleTemplateOptions the {@link GetRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall getRoleTemplate(GetRoleTemplateOptions getRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleTemplateOptions, - "getRoleTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", getRoleTemplateOptions.roleTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getRoleTemplateOptions.state() != null) { - builder.query("state", String.valueOf(getRoleTemplateOptions.state())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a Role template. - * - * Delete a role template by providing the role template ID. This deletes all versions of this template. A role - * template can't be deleted if any version of the template is assigned to one or more child accounts. You must remove - * the role assignments first. - * - * @param deleteRoleTemplateOptions the {@link DeleteRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteRoleTemplate(DeleteRoleTemplateOptions deleteRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleTemplateOptions, - "deleteRoleTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", deleteRoleTemplateOptions.roleTemplateId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a new role template version. - * - * Create a new version of a role template. Use this if you need to make updates to a role template that is committed. - * - * @param createRoleTemplateVersionOptions the {@link CreateRoleTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall createRoleTemplateVersion(CreateRoleTemplateVersionOptions createRoleTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateVersionOptions, - "createRoleTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", createRoleTemplateVersionOptions.roleTemplateId()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - final JsonObject contentJson = new JsonObject(); - if (createRoleTemplateVersionOptions.name() != null) { - contentJson.addProperty("name", createRoleTemplateVersionOptions.name()); - } - if (createRoleTemplateVersionOptions.description() != null) { - contentJson.addProperty("description", createRoleTemplateVersionOptions.description()); - } - if (createRoleTemplateVersionOptions.role() != null) { - contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateVersionOptions.role())); - } - if (createRoleTemplateVersionOptions.committed() != null) { - contentJson.addProperty("committed", createRoleTemplateVersionOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve role template versions. - * - * Retrieve the versions of a role template by providing a role template ID. - * - * @param listRoleTemplateVersionsOptions the {@link ListRoleTemplateVersionsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplateVersionsCollection} - */ - public ServiceCall listRoleTemplateVersions(ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleTemplateVersionsOptions, - "listRoleTemplateVersionsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", listRoleTemplateVersionsOptions.roleTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleTemplateVersions"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listRoleTemplateVersionsOptions.state() != null) { - builder.query("state", String.valueOf(listRoleTemplateVersionsOptions.state())); - } - if (listRoleTemplateVersionsOptions.limit() != null) { - builder.query("limit", String.valueOf(listRoleTemplateVersionsOptions.limit())); - } - if (listRoleTemplateVersionsOptions.start() != null) { - builder.query("start", String.valueOf(listRoleTemplateVersionsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a role template version. - * - * Update a specific version of a role template. You can use this only if the version isn't committed. - * - * @param replaceRoleTemplateOptions the {@link ReplaceRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall replaceRoleTemplate(ReplaceRoleTemplateOptions replaceRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceRoleTemplateOptions, - "replaceRoleTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", replaceRoleTemplateOptions.roleTemplateId()); - pathParamsMap.put("version", replaceRoleTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replaceRoleTemplateOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - if (replaceRoleTemplateOptions.name() != null) { - contentJson.addProperty("name", replaceRoleTemplateOptions.name()); - } - if (replaceRoleTemplateOptions.description() != null) { - contentJson.addProperty("description", replaceRoleTemplateOptions.description()); - } - if (replaceRoleTemplateOptions.role() != null) { - contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRoleTemplateOptions.role())); - } - if (replaceRoleTemplateOptions.committed() != null) { - contentJson.addProperty("committed", replaceRoleTemplateOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a role template version. - * - * Delete a specific version of a role template by providing a role template ID and version number. You can't delete a - * role template version that is assigned to one or more child accounts. You must remove the role assignments first. - * - * @param deleteRoleTemplateVersionOptions the {@link DeleteRoleTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteRoleTemplateVersion(DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleTemplateVersionOptions, - "deleteRoleTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", deleteRoleTemplateVersionOptions.roleTemplateId()); - pathParamsMap.put("version", deleteRoleTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a role template version. - * - * Retrieve a role template by providing a role template ID and version number. - * - * @param getRoleTemplateVersionOptions the {@link GetRoleTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall getRoleTemplateVersion(GetRoleTemplateVersionOptions getRoleTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleTemplateVersionOptions, - "getRoleTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", getRoleTemplateVersionOptions.roleTemplateId()); - pathParamsMap.put("version", getRoleTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleTemplateVersion"); - 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); - } - - /** - * Commit a role template version. - * - * Commit a role template version. You cannot make any further changes to the role template once it's committed. If - * you have to make updates after committing a version, create a new version. - * - * @param commitRoleTemplateOptions the {@link CommitRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall commitRoleTemplate(CommitRoleTemplateOptions commitRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(commitRoleTemplateOptions, - "commitRoleTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", commitRoleTemplateOptions.roleTemplateId()); - pathParamsMap.put("version", commitRoleTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}/commit", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get role template assignments. - * - * Get role template assignments by attributes. The following attributes are supported: - * `account_id`, `template_id`, `template_version`, `target`, `target_type`, `limit`, `start`. - * `account_id` is a required query parameter. Only role template assignments with the specified attributes and - * accessible by the caller are returned. If the caller does not have read access to any role template assignments, an - * empty array is returned. - * - * @param listRoleAssignmentsOptions the {@link ListRoleAssignmentsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleAssignmentCollection} - */ - public ServiceCall listRoleAssignments(ListRoleAssignmentsOptions listRoleAssignmentsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleAssignmentsOptions, - "listRoleAssignmentsOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleAssignments"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listRoleAssignmentsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listRoleAssignmentsOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listRoleAssignmentsOptions.accountId())); - if (listRoleAssignmentsOptions.templateId() != null) { - builder.query("template_id", String.valueOf(listRoleAssignmentsOptions.templateId())); - } - if (listRoleAssignmentsOptions.templateVersion() != null) { - builder.query("template_version", String.valueOf(listRoleAssignmentsOptions.templateVersion())); - } - if (listRoleAssignmentsOptions.limit() != null) { - builder.query("limit", String.valueOf(listRoleAssignmentsOptions.limit())); - } - if (listRoleAssignmentsOptions.start() != null) { - builder.query("start", String.valueOf(listRoleAssignmentsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a role template assignment. - * - * Assign a role template to child accounts and account groups. This creates the role in the accounts and account - * groups that you specify. - * - * @param createRoleTemplateAssignmentOptions the {@link CreateRoleTemplateAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleAssignmentCollection} - */ - public ServiceCall createRoleTemplateAssignment(CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateAssignmentOptions, - "createRoleTemplateAssignmentOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplateAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createRoleTemplateAssignmentOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createRoleTemplateAssignmentOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateAssignmentOptions.target())); - contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateAssignmentOptions.templates())); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a role assignment. - * - * Retrieve a role template assignment by providing a role assignment ID. - * - * @param getRoleAssignmentOptions the {@link GetRoleAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleAssignment} - */ - public ServiceCall getRoleAssignment(GetRoleAssignmentOptions getRoleAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleAssignmentOptions, - "getRoleAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", getRoleAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleAssignment"); - 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 a role assignment. - * - * Update a role assignment by providing a role assignment ID. - * - * @param updateRoleAssignmentOptions the {@link UpdateRoleAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleAssignment} - */ - public ServiceCall updateRoleAssignment(UpdateRoleAssignmentOptions updateRoleAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateRoleAssignmentOptions, - "updateRoleAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", updateRoleAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateRoleAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updateRoleAssignmentOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("template_version", updateRoleAssignmentOptions.templateVersion()); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Remove a role assignment. - * - * Remove a role template assignment by providing a role assignment ID. You can't delete a role assignment if the - * status is "in_progress". - * - * @param deleteRoleAssignmentOptions the {@link DeleteRoleAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteRoleAssignment(DeleteRoleAssignmentOptions deleteRoleAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleAssignmentOptions, - "deleteRoleAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", deleteRoleAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java deleted file mode 100644 index af82ea2abe8..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The Access Management Account Settings that are currently set for the requested account. - */ -public class AccountSettingsAccessManagement extends GenericModel { - - @SerializedName("external_account_identity_interaction") - protected ExternalAccountIdentityInteraction externalAccountIdentityInteraction; - - protected AccountSettingsAccessManagement() { } - - /** - * Gets the externalAccountIdentityInteraction. - * - * How external accounts can interact in relation to the requested account. - * - * @return the externalAccountIdentityInteraction - */ - public ExternalAccountIdentityInteraction getExternalAccountIdentityInteraction() { - return externalAccountIdentityInteraction; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java deleted file mode 100644 index ea230f57263..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the assigned action control template. - */ -public class ActionControlAssignment extends GenericModel { - - /** - * The current operation of the action control assignment. - */ - public interface Operation { - /** create. */ - String CREATE = "create"; - /** apply. */ - String APPLY = "apply"; - /** update. */ - String UPDATE = "update"; - /** remove. */ - String REMOVE = "remove"; - } - - /** - * The action control assignment status. - */ - public interface Status { - /** accepted. */ - String ACCEPTED = "accepted"; - /** failure. */ - String FAILURE = "failure"; - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** superseded. */ - String SUPERSEDED = "superseded"; - } - - protected String id; - @SerializedName("account_id") - protected String accountId; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String operation; - protected List resources; - protected ActionControlAssignmentTemplate template; - protected AssignmentTargetDetails target; - protected String status; - - protected ActionControlAssignment() { } - - /** - * Gets the id. - * - * Action control assignment ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the accountId. - * - * The account GUID that the action control assignments belong to. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the href. - * - * The href URL that links to the action control assignments API by action control assignment ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the action control assignment was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the action control assignment. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the action control assignment was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the action control assignment. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the operation. - * - * The current operation of the action control assignment. - * - * @return the operation - */ - public String getOperation() { - return operation; - } - - /** - * Gets the resources. - * - * Resources created when action control template is assigned. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the template. - * - * The action control template id and version that will be assigned. - * - * @return the template - */ - public ActionControlAssignmentTemplate getTemplate() { - return template; - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the status. - * - * The action control assignment status. - * - * @return the status - */ - public String getStatus() { - return status; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java deleted file mode 100644 index a9d6b28ce39..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of action control assignments. - */ -public class ActionControlAssignmentCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List assignments; - - protected ActionControlAssignmentCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the assignments. - * - * List of action control assignments. - * - * @return the assignments - */ - public List getAssignments() { - return assignments; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java deleted file mode 100644 index 122d3c8277b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The action control assignment resources and target where the template is assigned. - */ -public class ActionControlAssignmentResource extends GenericModel { - - protected AssignmentTargetDetails target; - @SerializedName("action_control") - protected ActionControlAssignmentResourceActionControl actionControl; - - protected ActionControlAssignmentResource() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the actionControl. - * - * Set of properties of the assigned resource or error message if assignment failed. - * - * @return the actionControl - */ - public ActionControlAssignmentResourceActionControl getActionControl() { - return actionControl; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java deleted file mode 100644 index 0e5550eb4da..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Set of properties of the assigned resource or error message if assignment failed. - */ -public class ActionControlAssignmentResourceActionControl extends GenericModel { - - @SerializedName("resource_created") - protected ActionControlAssignmentResourceCreated resourceCreated; - @SerializedName("error_message") - protected AssignmentResourceError errorMessage; - - protected ActionControlAssignmentResourceActionControl() { } - - /** - * Gets the resourceCreated. - * - * On success, it includes the action control assigned. - * - * @return the resourceCreated - */ - public ActionControlAssignmentResourceCreated getResourceCreated() { - return resourceCreated; - } - - /** - * Gets the errorMessage. - * - * Body parameters for assignment error. - * - * @return the errorMessage - */ - public AssignmentResourceError getErrorMessage() { - return errorMessage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java deleted file mode 100644 index 6ecbd23392a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * On success, it includes the action control assigned. - */ -public class ActionControlAssignmentResourceCreated extends GenericModel { - - protected String id; - - protected ActionControlAssignmentResourceCreated() { } - - /** - * Gets the id. - * - * action control id. - * - * @return the id - */ - public String getId() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java deleted file mode 100644 index 4e6d2543e18..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The action control template id and version that will be assigned. - */ -public class ActionControlAssignmentTemplate extends GenericModel { - - protected String id; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String version; - - /** - * Instantiates a new Builder from an existing ActionControlAssignmentTemplate instance. - * - * @param actionControlAssignmentTemplate the instance to initialize the Builder with - */ - private Builder(ActionControlAssignmentTemplate actionControlAssignmentTemplate) { - this.id = actionControlAssignmentTemplate.id; - this.version = actionControlAssignmentTemplate.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param id the id - * @param version the version - */ - public Builder(String id, String version) { - this.id = id; - this.version = version; - } - - /** - * Builds a ActionControlAssignmentTemplate. - * - * @return the new ActionControlAssignmentTemplate instance - */ - public ActionControlAssignmentTemplate build() { - return new ActionControlAssignmentTemplate(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the ActionControlAssignmentTemplate builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the ActionControlAssignmentTemplate builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected ActionControlAssignmentTemplate() { } - - protected ActionControlAssignmentTemplate(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - id = builder.id; - version = builder.version; - } - - /** - * New builder. - * - * @return a ActionControlAssignmentTemplate builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * Action control template ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java deleted file mode 100644 index 78b6d56be6d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * ActionControlAssignmentsPager can be used to simplify the use of the "listActionControlAssignments" method. - */ -public class ActionControlAssignmentsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListActionControlAssignmentsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected ActionControlAssignmentsPager() { } - - /** - * Constructs a new ActionControlAssignmentsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlAssignments" method - * @param options the ListActionControlAssignmentsOptions instance to be used to invoke the "listActionControlAssignments" method - */ - public ActionControlAssignmentsPager(IamPolicyManagement client, ListActionControlAssignmentsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<ActionControlAssignment> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListActionControlAssignmentsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - ActionControlAssignmentCollection result = client.listActionControlAssignments(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getAssignments(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<ActionControlAssignment> containing all results returned by the "listActionControlAssignments" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java deleted file mode 100644 index 157c9f6a390..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the action control template. - */ -public class ActionControlTemplate extends GenericModel { - - /** - * State of action control template. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String name; - protected String description; - @SerializedName("account_id") - protected String accountId; - protected Boolean committed; - @SerializedName("action_control") - protected TemplateActionControl actionControl; - protected String id; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String version; - protected String state; - - protected ActionControlTemplate() { } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the description. - * - * Description of the action control template. This is shown to users in the enterprise account. Use this to describe - * the purpose or context of the action control for enterprise users managing IAM templates. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the committed. - * - * Committed status of the template. If committed is set to true, then the template version can no longer be updated. - * - * @return the committed - */ - public Boolean isCommitted() { - return committed; - } - - /** - * Gets the actionControl. - * - * The action control properties that are created in an action resource when the template is assigned. - * - * @return the actionControl - */ - public TemplateActionControl getActionControl() { - return actionControl; - } - - /** - * Gets the id. - * - * The action control template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the action control templates API by action control template ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the action control template was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the action control template. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the action control template was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the action control template. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the version. - * - * The version number of the template used to identify different versions of same template. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the state. - * - * State of action control template. - * - * @return the state - */ - public String getState() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java deleted file mode 100644 index e7536d2c9ae..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of action control templates. - */ -public class ActionControlTemplateCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - @SerializedName("action_control_templates") - protected List actionControlTemplates; - - protected ActionControlTemplateCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the actionControlTemplates. - * - * List of action control templates. - * - * @return the actionControlTemplates - */ - public List getActionControlTemplates() { - return actionControlTemplates; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java deleted file mode 100644 index 5e26f45cf46..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of versions for a specific action control template. - */ -public class ActionControlTemplateVersionsCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List versions; - - protected ActionControlTemplateVersionsCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the versions. - * - * List of action control templates versions. - * - * @return the versions - */ - public List getVersions() { - return versions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java deleted file mode 100644 index 660aefe11ba..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * ActionControlTemplateVersionsPager can be used to simplify the use of the "listActionControlTemplateVersions" method. - */ -public class ActionControlTemplateVersionsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListActionControlTemplateVersionsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected ActionControlTemplateVersionsPager() { } - - /** - * Constructs a new ActionControlTemplateVersionsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlTemplateVersions" method - * @param options the ListActionControlTemplateVersionsOptions instance to be used to invoke the "listActionControlTemplateVersions" method - */ - public ActionControlTemplateVersionsPager(IamPolicyManagement client, ListActionControlTemplateVersionsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<ActionControlTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListActionControlTemplateVersionsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - ActionControlTemplateVersionsCollection result = client.listActionControlTemplateVersions(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getVersions(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<ActionControlTemplate> containing all results returned by the "listActionControlTemplateVersions" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java deleted file mode 100644 index bd326c8d7ec..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * ActionControlTemplatesPager can be used to simplify the use of the "listActionControlTemplates" method. - */ -public class ActionControlTemplatesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListActionControlTemplatesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected ActionControlTemplatesPager() { } - - /** - * Constructs a new ActionControlTemplatesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlTemplates" method - * @param options the ListActionControlTemplatesOptions instance to be used to invoke the "listActionControlTemplates" method - */ - public ActionControlTemplatesPager(IamPolicyManagement client, ListActionControlTemplatesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<ActionControlTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListActionControlTemplatesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - ActionControlTemplateCollection result = client.listActionControlTemplates(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getActionControlTemplates(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<ActionControlTemplate> containing all results returned by the "listActionControlTemplates" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java deleted file mode 100644 index c454c7a3ef5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * On success, includes the policy that is assigned. - */ -public class AssignmentResourceCreated extends GenericModel { - - protected String id; - - protected AssignmentResourceCreated() { } - - /** - * Gets the id. - * - * Policy id. - * - * @return the id - */ - public String getId() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java deleted file mode 100644 index e74dbe58b3a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Body parameters for assignment error. - */ -public class AssignmentResourceError extends GenericModel { - - protected String name; - protected String errorCode; - protected String message; - protected String code; - protected List errors; - - protected AssignmentResourceError() { } - - /** - * Gets the name. - * - * Name of the error. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the errorCode. - * - * error code. - * - * @return the errorCode - */ - public String getErrorCode() { - return errorCode; - } - - /** - * Gets the message. - * - * Error message detailing the nature of the error. - * - * @return the message - */ - public String getMessage() { - return message; - } - - /** - * Gets the code. - * - * Internal status code for the error. - * - * @return the code - */ - public String getCode() { - return code; - } - - /** - * Gets the errors. - * - * The errors encountered during the response. - * - * @return the errors - */ - public List getErrors() { - return errors; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java deleted file mode 100644 index 893d528604c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * assignment target account and type. - */ -public class AssignmentTargetDetails extends GenericModel { - - /** - * Assignment target type. - */ - public interface Type { - /** Account. */ - String ACCOUNT = "Account"; - } - - protected String type; - protected String id; - - /** - * Builder. - */ - public static class Builder { - private String type; - private String id; - - /** - * Instantiates a new Builder from an existing AssignmentTargetDetails instance. - * - * @param assignmentTargetDetails the instance to initialize the Builder with - */ - private Builder(AssignmentTargetDetails assignmentTargetDetails) { - this.type = assignmentTargetDetails.type; - this.id = assignmentTargetDetails.id; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param type the type - * @param id the id - */ - public Builder(String type, String id) { - this.type = type; - this.id = id; - } - - /** - * Builds a AssignmentTargetDetails. - * - * @return the new AssignmentTargetDetails instance - */ - public AssignmentTargetDetails build() { - return new AssignmentTargetDetails(this); - } - - /** - * Set the type. - * - * @param type the type - * @return the AssignmentTargetDetails builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the id. - * - * @param id the id - * @return the AssignmentTargetDetails builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - } - - protected AssignmentTargetDetails() { } - - protected AssignmentTargetDetails(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - type = builder.type; - id = builder.id; - } - - /** - * New builder. - * - * @return a AssignmentTargetDetails builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the type. - * - * Assignment target type. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the id. - * - * ID of the target account. - * - * @return the id - */ - public String id() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java deleted file mode 100644 index b8025e305a9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * policy template details. - */ -public class AssignmentTemplateDetails extends GenericModel { - - protected String id; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String version; - - /** - * Instantiates a new Builder from an existing AssignmentTemplateDetails instance. - * - * @param assignmentTemplateDetails the instance to initialize the Builder with - */ - private Builder(AssignmentTemplateDetails assignmentTemplateDetails) { - this.id = assignmentTemplateDetails.id; - this.version = assignmentTemplateDetails.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a AssignmentTemplateDetails. - * - * @return the new AssignmentTemplateDetails instance - */ - public AssignmentTemplateDetails build() { - return new AssignmentTemplateDetails(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the AssignmentTemplateDetails builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the AssignmentTemplateDetails builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected AssignmentTemplateDetails() { } - - protected AssignmentTemplateDetails(Builder builder) { - id = builder.id; - version = builder.version; - } - - /** - * New builder. - * - * @return a AssignmentTemplateDetails builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * Policy template ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the version. - * - * Policy template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java deleted file mode 100644 index 78291e6c2c5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The commitActionControlTemplate options. - */ -public class CommitActionControlTemplateOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing CommitActionControlTemplateOptions instance. - * - * @param commitActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(CommitActionControlTemplateOptions commitActionControlTemplateOptions) { - this.actionControlTemplateId = commitActionControlTemplateOptions.actionControlTemplateId; - this.version = commitActionControlTemplateOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - * @param version the version - */ - public Builder(String actionControlTemplateId, String version) { - this.actionControlTemplateId = actionControlTemplateId; - this.version = version; - } - - /** - * Builds a CommitActionControlTemplateOptions. - * - * @return the new CommitActionControlTemplateOptions instance - */ - public CommitActionControlTemplateOptions build() { - return new CommitActionControlTemplateOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the CommitActionControlTemplateOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the CommitActionControlTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected CommitActionControlTemplateOptions() { } - - protected CommitActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a CommitActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the version. - * - * The action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java deleted file mode 100644 index 61283194c44..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The commitPolicyTemplate options. - */ -public class CommitPolicyTemplateOptions extends GenericModel { - - protected String policyTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing CommitPolicyTemplateOptions instance. - * - * @param commitPolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(CommitPolicyTemplateOptions commitPolicyTemplateOptions) { - this.policyTemplateId = commitPolicyTemplateOptions.policyTemplateId; - this.version = commitPolicyTemplateOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param version the version - */ - public Builder(String policyTemplateId, String version) { - this.policyTemplateId = policyTemplateId; - this.version = version; - } - - /** - * Builds a CommitPolicyTemplateOptions. - * - * @return the new CommitPolicyTemplateOptions instance - */ - public CommitPolicyTemplateOptions build() { - return new CommitPolicyTemplateOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the CommitPolicyTemplateOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the CommitPolicyTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected CommitPolicyTemplateOptions() { } - - protected CommitPolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - policyTemplateId = builder.policyTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a CommitPolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the version. - * - * The policy template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java deleted file mode 100644 index 7e93c92fb0b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The commitRoleTemplate options. - */ -public class CommitRoleTemplateOptions extends GenericModel { - - protected String roleTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing CommitRoleTemplateOptions instance. - * - * @param commitRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(CommitRoleTemplateOptions commitRoleTemplateOptions) { - this.roleTemplateId = commitRoleTemplateOptions.roleTemplateId; - this.version = commitRoleTemplateOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - * @param version the version - */ - public Builder(String roleTemplateId, String version) { - this.roleTemplateId = roleTemplateId; - this.version = version; - } - - /** - * Builds a CommitRoleTemplateOptions. - * - * @return the new CommitRoleTemplateOptions instance - */ - public CommitRoleTemplateOptions build() { - return new CommitRoleTemplateOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the CommitRoleTemplateOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the CommitRoleTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected CommitRoleTemplateOptions() { } - - protected CommitRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - roleTemplateId = builder.roleTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a CommitRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the version. - * - * The role template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java deleted file mode 100644 index be0c3d0aa98..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Details of conflicting resource. - */ -public class ConflictsWith extends GenericModel { - - protected String etag; - protected String role; - protected String policy; - - protected ConflictsWith() { } - - /** - * Gets the etag. - * - * The revision number of the resource. - * - * @return the etag - */ - public String getEtag() { - return etag; - } - - /** - * Gets the role. - * - * The conflicting role of ID. - * - * @return the role - */ - public String getRole() { - return role; - } - - /** - * Gets the policy. - * - * The conflicting policy ID. - * - * @return the policy - */ - public String getPolicy() { - return policy; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java deleted file mode 100644 index 15e502ac214..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Specifies the type of access that is granted by the policy. - */ -public class Control extends GenericModel { - - protected Grant grant; - - /** - * Builder. - */ - public static class Builder { - private Grant grant; - - /** - * Instantiates a new Builder from an existing Control instance. - * - * @param control the instance to initialize the Builder with - */ - private Builder(Control control) { - this.grant = control.grant; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param grant the grant - */ - public Builder(Grant grant) { - this.grant = grant; - } - - /** - * Builds a Control. - * - * @return the new Control instance - */ - public Control build() { - return new Control(this); - } - - /** - * Set the grant. - * - * @param grant the grant - * @return the Control builder - */ - public Builder grant(Grant grant) { - this.grant = grant; - return this; - } - } - - protected Control() { } - - protected Control(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.grant, - "grant cannot be null"); - grant = builder.grant; - } - - /** - * New builder. - * - * @return a Control builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the grant. - * - * Permission is granted by the policy. - * - * @return the grant - */ - public Grant grant() { - return grant; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java deleted file mode 100644 index 5055d290c80..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * ControlResponse. - * - * Classes which extend this class: - * - ControlResponseControl - * - ControlResponseControlWithEnrichedRoles - */ -public class ControlResponse extends GenericModel { - - protected Grant grant; - - protected ControlResponse() { } - - /** - * Gets the grant. - * - * Permission is granted by the policy. - * - * @return the grant - */ - public Grant getGrant() { - return grant; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java deleted file mode 100644 index 5934ebf7c76..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * Specifies the type of access that is granted by the policy. - */ -public class ControlResponseControl extends ControlResponse { - - - protected ControlResponseControl() { } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java deleted file mode 100644 index 8b3c73d73c0..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * Specifies the type of access that is granted by the policy with additional role information. - */ -public class ControlResponseControlWithEnrichedRoles extends ControlResponse { - - - protected ControlResponseControlWithEnrichedRoles() { } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java deleted file mode 100644 index 1ccd3f8b4dd..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createActionControlTemplateAssignment options. - */ -public class CreateActionControlTemplateAssignmentOptions extends GenericModel { - - protected AssignmentTargetDetails target; - protected List templates; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private AssignmentTargetDetails target; - private List templates; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateActionControlTemplateAssignmentOptions instance. - * - * @param createActionControlTemplateAssignmentOptions the instance to initialize the Builder with - */ - private Builder(CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptions) { - this.target = createActionControlTemplateAssignmentOptions.target; - this.templates = createActionControlTemplateAssignmentOptions.templates; - this.acceptLanguage = createActionControlTemplateAssignmentOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param target the target - * @param templates the templates - */ - public Builder(AssignmentTargetDetails target, List templates) { - this.target = target; - this.templates = templates; - } - - /** - * Builds a CreateActionControlTemplateAssignmentOptions. - * - * @return the new CreateActionControlTemplateAssignmentOptions instance - */ - public CreateActionControlTemplateAssignmentOptions build() { - return new CreateActionControlTemplateAssignmentOptions(this); - } - - /** - * Adds a new element to templates. - * - * @param templates the new element to be added - * @return the CreateActionControlTemplateAssignmentOptions builder - */ - public Builder addTemplates(ActionControlAssignmentTemplate templates) { - com.ibm.cloud.sdk.core.util.Validator.notNull(templates, - "templates cannot be null"); - if (this.templates == null) { - this.templates = new ArrayList(); - } - this.templates.add(templates); - return this; - } - - /** - * Set the target. - * - * @param target the target - * @return the CreateActionControlTemplateAssignmentOptions builder - */ - public Builder target(AssignmentTargetDetails target) { - this.target = target; - return this; - } - - /** - * Set the templates. - * Existing templates will be replaced. - * - * @param templates the templates - * @return the CreateActionControlTemplateAssignmentOptions builder - */ - public Builder templates(List templates) { - this.templates = templates; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateActionControlTemplateAssignmentOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateActionControlTemplateAssignmentOptions() { } - - protected CreateActionControlTemplateAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, - "target cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, - "templates cannot be null"); - target = builder.target; - templates = builder.templates; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateActionControlTemplateAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails target() { - return target; - } - - /** - * Gets the templates. - * - * List of action control template details for action control assignment. - * - * @return the templates - */ - public List templates() { - return templates; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java deleted file mode 100644 index 37594a7a440..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createActionControlTemplate options. - */ -public class CreateActionControlTemplateOptions extends GenericModel { - - protected String name; - protected String accountId; - protected String description; - protected Boolean committed; - protected TemplateActionControl actionControl; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String accountId; - private String description; - private Boolean committed; - private TemplateActionControl actionControl; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateActionControlTemplateOptions instance. - * - * @param createActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(CreateActionControlTemplateOptions createActionControlTemplateOptions) { - this.name = createActionControlTemplateOptions.name; - this.accountId = createActionControlTemplateOptions.accountId; - this.description = createActionControlTemplateOptions.description; - this.committed = createActionControlTemplateOptions.committed; - this.actionControl = createActionControlTemplateOptions.actionControl; - this.acceptLanguage = createActionControlTemplateOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param accountId the accountId - */ - public Builder(String name, String accountId) { - this.name = name; - this.accountId = accountId; - } - - /** - * Builds a CreateActionControlTemplateOptions. - * - * @return the new CreateActionControlTemplateOptions instance - */ - public CreateActionControlTemplateOptions build() { - return new CreateActionControlTemplateOptions(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateActionControlTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the CreateActionControlTemplateOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateActionControlTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreateActionControlTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - - /** - * Set the actionControl. - * - * @param actionControl the actionControl - * @return the CreateActionControlTemplateOptions builder - */ - public Builder actionControl(TemplateActionControl actionControl) { - this.actionControl = actionControl; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateActionControlTemplateOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateActionControlTemplateOptions() { } - - protected CreateActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - name = builder.name; - accountId = builder.accountId; - description = builder.description; - committed = builder.committed; - actionControl = builder.actionControl; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the description. - * - * Description of the action control template. This is shown to users in the enterprise account. Use this to describe - * the purpose or context of the action control for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template. If committed is set to true, then the template version can no longer be updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } - - /** - * Gets the actionControl. - * - * The action control properties that are created in an action resource when the template is assigned. - * - * @return the actionControl - */ - public TemplateActionControl actionControl() { - return actionControl; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java deleted file mode 100644 index 13ce1a8e60f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createActionControlTemplateVersion options. - */ -public class CreateActionControlTemplateVersionOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String name; - protected String description; - protected TemplateActionControl actionControl; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String name; - private String description; - private TemplateActionControl actionControl; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing CreateActionControlTemplateVersionOptions instance. - * - * @param createActionControlTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptions) { - this.actionControlTemplateId = createActionControlTemplateVersionOptions.actionControlTemplateId; - this.name = createActionControlTemplateVersionOptions.name; - this.description = createActionControlTemplateVersionOptions.description; - this.actionControl = createActionControlTemplateVersionOptions.actionControl; - this.committed = createActionControlTemplateVersionOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - */ - public Builder(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - } - - /** - * Builds a CreateActionControlTemplateVersionOptions. - * - * @return the new CreateActionControlTemplateVersionOptions instance - */ - public CreateActionControlTemplateVersionOptions build() { - return new CreateActionControlTemplateVersionOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actionControl. - * - * @param actionControl the actionControl - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder actionControl(TemplateActionControl actionControl) { - this.actionControl = actionControl; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected CreateActionControlTemplateVersionOptions() { } - - protected CreateActionControlTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - name = builder.name; - description = builder.description; - actionControl = builder.actionControl; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a CreateActionControlTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * The action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will - * change the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the action control template. This is shown to users in the enterprise account. Use this to describe - * the purpose or context of the action control for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actionControl. - * - * The action control properties that are created in an action resource when the template is assigned. - * - * @return the actionControl - */ - public TemplateActionControl actionControl() { - return actionControl; - } - - /** - * Gets the committed. - * - * Committed status of the template version. If committed is set to true, then the template version can no longer be - * updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java deleted file mode 100644 index b6ec9f78c02..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java +++ /dev/null @@ -1,311 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createPolicy options. - */ -public class CreatePolicyOptions extends GenericModel { - - protected String type; - protected List subjects; - protected List roles; - protected List resources; - protected String description; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String type; - private List subjects; - private List roles; - private List resources; - private String description; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreatePolicyOptions instance. - * - * @param createPolicyOptions the instance to initialize the Builder with - */ - private Builder(CreatePolicyOptions createPolicyOptions) { - this.type = createPolicyOptions.type; - this.subjects = createPolicyOptions.subjects; - this.roles = createPolicyOptions.roles; - this.resources = createPolicyOptions.resources; - this.description = createPolicyOptions.description; - this.acceptLanguage = createPolicyOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param type the type - * @param subjects the subjects - * @param roles the roles - * @param resources the resources - */ - public Builder(String type, List subjects, List roles, List resources) { - this.type = type; - this.subjects = subjects; - this.roles = roles; - this.resources = resources; - } - - /** - * Builds a CreatePolicyOptions. - * - * @return the new CreatePolicyOptions instance - */ - public CreatePolicyOptions build() { - return new CreatePolicyOptions(this); - } - - /** - * Adds a new element to subjects. - * - * @param subjects the new element to be added - * @return the CreatePolicyOptions builder - */ - public Builder addSubjects(PolicySubject subjects) { - com.ibm.cloud.sdk.core.util.Validator.notNull(subjects, - "subjects cannot be null"); - if (this.subjects == null) { - this.subjects = new ArrayList(); - } - this.subjects.add(subjects); - return this; - } - - /** - * Adds a new element to roles. - * - * @param roles the new element to be added - * @return the CreatePolicyOptions builder - */ - public Builder addRoles(PolicyRole roles) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roles, - "roles cannot be null"); - if (this.roles == null) { - this.roles = new ArrayList(); - } - this.roles.add(roles); - return this; - } - - /** - * Adds a new element to resources. - * - * @param resources the new element to be added - * @return the CreatePolicyOptions builder - */ - public Builder addResources(PolicyResource resources) { - com.ibm.cloud.sdk.core.util.Validator.notNull(resources, - "resources cannot be null"); - if (this.resources == null) { - this.resources = new ArrayList(); - } - this.resources.add(resources); - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the CreatePolicyOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the subjects. - * Existing subjects will be replaced. - * - * @param subjects the subjects - * @return the CreatePolicyOptions builder - */ - public Builder subjects(List subjects) { - this.subjects = subjects; - return this; - } - - /** - * Set the roles. - * Existing roles will be replaced. - * - * @param roles the roles - * @return the CreatePolicyOptions builder - */ - public Builder roles(List roles) { - this.roles = roles; - return this; - } - - /** - * Set the resources. - * Existing resources will be replaced. - * - * @param resources the resources - * @return the CreatePolicyOptions builder - */ - public Builder resources(List resources) { - this.resources = resources; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreatePolicyOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreatePolicyOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreatePolicyOptions() { } - - protected CreatePolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subjects, - "subjects cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, - "roles cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resources, - "resources cannot be null"); - type = builder.type; - subjects = builder.subjects; - roles = builder.roles; - resources = builder.resources; - description = builder.description; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreatePolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the subjects. - * - * The subjects associated with a policy. - * - * @return the subjects - */ - public List subjects() { - return subjects; - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List roles() { - return roles; - } - - /** - * Gets the resources. - * - * The resources associated with a policy. - * - * @return the resources - */ - public List resources() { - return resources; - } - - /** - * Gets the description. - * - * Customer-defined description. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java deleted file mode 100644 index b71ca393f11..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createPolicyTemplateAssignment options. - */ -public class CreatePolicyTemplateAssignmentOptions extends GenericModel { - - protected String version; - protected AssignmentTargetDetails target; - protected List templates; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String version; - private AssignmentTargetDetails target; - private List templates; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreatePolicyTemplateAssignmentOptions instance. - * - * @param createPolicyTemplateAssignmentOptions the instance to initialize the Builder with - */ - private Builder(CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptions) { - this.version = createPolicyTemplateAssignmentOptions.version; - this.target = createPolicyTemplateAssignmentOptions.target; - this.templates = createPolicyTemplateAssignmentOptions.templates; - this.acceptLanguage = createPolicyTemplateAssignmentOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param version the version - * @param target the target - * @param templates the templates - */ - public Builder(String version, AssignmentTargetDetails target, List templates) { - this.version = version; - this.target = target; - this.templates = templates; - } - - /** - * Builds a CreatePolicyTemplateAssignmentOptions. - * - * @return the new CreatePolicyTemplateAssignmentOptions instance - */ - public CreatePolicyTemplateAssignmentOptions build() { - return new CreatePolicyTemplateAssignmentOptions(this); - } - - /** - * Adds a new element to templates. - * - * @param templates the new element to be added - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder addTemplates(AssignmentTemplateDetails templates) { - com.ibm.cloud.sdk.core.util.Validator.notNull(templates, - "templates cannot be null"); - if (this.templates == null) { - this.templates = new ArrayList(); - } - this.templates.add(templates); - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the target. - * - * @param target the target - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder target(AssignmentTargetDetails target) { - this.target = target; - return this; - } - - /** - * Set the templates. - * Existing templates will be replaced. - * - * @param templates the templates - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder templates(List templates) { - this.templates = templates; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreatePolicyTemplateAssignmentOptions() { } - - protected CreatePolicyTemplateAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, - "target cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, - "templates cannot be null"); - version = builder.version; - target = builder.target; - templates = builder.templates; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreatePolicyTemplateAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the version. - * - * specify version of response body format. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails target() { - return target; - } - - /** - * Gets the templates. - * - * List of template details for policy assignment. - * - * @return the templates - */ - public List templates() { - return templates; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java deleted file mode 100644 index 72944308428..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java +++ /dev/null @@ -1,255 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createPolicyTemplate options. - */ -public class CreatePolicyTemplateOptions extends GenericModel { - - protected String name; - protected String accountId; - protected TemplatePolicy policy; - protected String description; - protected Boolean committed; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String accountId; - private TemplatePolicy policy; - private String description; - private Boolean committed; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreatePolicyTemplateOptions instance. - * - * @param createPolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(CreatePolicyTemplateOptions createPolicyTemplateOptions) { - this.name = createPolicyTemplateOptions.name; - this.accountId = createPolicyTemplateOptions.accountId; - this.policy = createPolicyTemplateOptions.policy; - this.description = createPolicyTemplateOptions.description; - this.committed = createPolicyTemplateOptions.committed; - this.acceptLanguage = createPolicyTemplateOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param accountId the accountId - * @param policy the policy - */ - public Builder(String name, String accountId, TemplatePolicy policy) { - this.name = name; - this.accountId = accountId; - this.policy = policy; - } - - /** - * Builds a CreatePolicyTemplateOptions. - * - * @return the new CreatePolicyTemplateOptions instance - */ - public CreatePolicyTemplateOptions build() { - return new CreatePolicyTemplateOptions(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the CreatePolicyTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the CreatePolicyTemplateOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the policy. - * - * @param policy the policy - * @return the CreatePolicyTemplateOptions builder - */ - public Builder policy(TemplatePolicy policy) { - this.policy = policy; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreatePolicyTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreatePolicyTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreatePolicyTemplateOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreatePolicyTemplateOptions() { } - - protected CreatePolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.policy, - "policy cannot be null"); - name = builder.name; - accountId = builder.accountId; - policy = builder.policy; - description = builder.description; - committed = builder.committed; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreatePolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy policy() { - return policy; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java deleted file mode 100644 index 6903774c335..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createPolicyTemplateVersion options. - */ -public class CreatePolicyTemplateVersionOptions extends GenericModel { - - protected String policyTemplateId; - protected TemplatePolicy policy; - protected String name; - protected String description; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private TemplatePolicy policy; - private String name; - private String description; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing CreatePolicyTemplateVersionOptions instance. - * - * @param createPolicyTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptions) { - this.policyTemplateId = createPolicyTemplateVersionOptions.policyTemplateId; - this.policy = createPolicyTemplateVersionOptions.policy; - this.name = createPolicyTemplateVersionOptions.name; - this.description = createPolicyTemplateVersionOptions.description; - this.committed = createPolicyTemplateVersionOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param policy the policy - */ - public Builder(String policyTemplateId, TemplatePolicy policy) { - this.policyTemplateId = policyTemplateId; - this.policy = policy; - } - - /** - * Builds a CreatePolicyTemplateVersionOptions. - * - * @return the new CreatePolicyTemplateVersionOptions instance - */ - public CreatePolicyTemplateVersionOptions build() { - return new CreatePolicyTemplateVersionOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the policy. - * - * @param policy the policy - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder policy(TemplatePolicy policy) { - this.policy = policy; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected CreatePolicyTemplateVersionOptions() { } - - protected CreatePolicyTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.policy, - "policy cannot be null"); - policyTemplateId = builder.policyTemplateId; - policy = builder.policy; - name = builder.name; - description = builder.description; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a CreatePolicyTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy policy() { - return policy; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template version. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java deleted file mode 100644 index 725ec5d8a53..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java +++ /dev/null @@ -1,308 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createRole options. - */ -public class CreateRoleOptions extends GenericModel { - - protected String displayName; - protected List actions; - protected String name; - protected String accountId; - protected String serviceName; - protected String description; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String displayName; - private List actions; - private String name; - private String accountId; - private String serviceName; - private String description; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateRoleOptions instance. - * - * @param createRoleOptions the instance to initialize the Builder with - */ - private Builder(CreateRoleOptions createRoleOptions) { - this.displayName = createRoleOptions.displayName; - this.actions = createRoleOptions.actions; - this.name = createRoleOptions.name; - this.accountId = createRoleOptions.accountId; - this.serviceName = createRoleOptions.serviceName; - this.description = createRoleOptions.description; - this.acceptLanguage = createRoleOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param displayName the displayName - * @param actions the actions - * @param name the name - * @param accountId the accountId - * @param serviceName the serviceName - */ - public Builder(String displayName, List actions, String name, String accountId, String serviceName) { - this.displayName = displayName; - this.actions = actions; - this.name = name; - this.accountId = accountId; - this.serviceName = serviceName; - } - - /** - * Builds a CreateRoleOptions. - * - * @return the new CreateRoleOptions instance - */ - public CreateRoleOptions build() { - return new CreateRoleOptions(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the CreateRoleOptions builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the CreateRoleOptions builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the CreateRoleOptions builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateRoleOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the CreateRoleOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the CreateRoleOptions builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateRoleOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateRoleOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateRoleOptions() { } - - protected CreateRoleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, - "serviceName cannot be null"); - displayName = builder.displayName; - actions = builder.actions; - name = builder.name; - accountId = builder.accountId; - serviceName = builder.serviceName; - description = builder.description; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateRoleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List actions() { - return actions; - } - - /** - * Gets the name. - * - * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the accountId. - * - * The account GUID. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the serviceName. - * - * The service name. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java deleted file mode 100644 index c9bef88e703..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createRoleTemplateAssignment options. - */ -public class CreateRoleTemplateAssignmentOptions extends GenericModel { - - protected AssignmentTargetDetails target; - protected List templates; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private AssignmentTargetDetails target; - private List templates; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateRoleTemplateAssignmentOptions instance. - * - * @param createRoleTemplateAssignmentOptions the instance to initialize the Builder with - */ - private Builder(CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptions) { - this.target = createRoleTemplateAssignmentOptions.target; - this.templates = createRoleTemplateAssignmentOptions.templates; - this.acceptLanguage = createRoleTemplateAssignmentOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param target the target - * @param templates the templates - */ - public Builder(AssignmentTargetDetails target, List templates) { - this.target = target; - this.templates = templates; - } - - /** - * Builds a CreateRoleTemplateAssignmentOptions. - * - * @return the new CreateRoleTemplateAssignmentOptions instance - */ - public CreateRoleTemplateAssignmentOptions build() { - return new CreateRoleTemplateAssignmentOptions(this); - } - - /** - * Adds a new element to templates. - * - * @param templates the new element to be added - * @return the CreateRoleTemplateAssignmentOptions builder - */ - public Builder addTemplates(RoleAssignmentTemplate templates) { - com.ibm.cloud.sdk.core.util.Validator.notNull(templates, - "templates cannot be null"); - if (this.templates == null) { - this.templates = new ArrayList(); - } - this.templates.add(templates); - return this; - } - - /** - * Set the target. - * - * @param target the target - * @return the CreateRoleTemplateAssignmentOptions builder - */ - public Builder target(AssignmentTargetDetails target) { - this.target = target; - return this; - } - - /** - * Set the templates. - * Existing templates will be replaced. - * - * @param templates the templates - * @return the CreateRoleTemplateAssignmentOptions builder - */ - public Builder templates(List templates) { - this.templates = templates; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateRoleTemplateAssignmentOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateRoleTemplateAssignmentOptions() { } - - protected CreateRoleTemplateAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, - "target cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, - "templates cannot be null"); - target = builder.target; - templates = builder.templates; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateRoleTemplateAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails target() { - return target; - } - - /** - * Gets the templates. - * - * List of role template details for role assignment. - * - * @return the templates - */ - public List templates() { - return templates; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java deleted file mode 100644 index baf82e17961..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createRoleTemplate options. - */ -public class CreateRoleTemplateOptions extends GenericModel { - - protected String name; - protected String accountId; - protected String description; - protected Boolean committed; - protected RoleTemplatePrototypeRole role; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String accountId; - private String description; - private Boolean committed; - private RoleTemplatePrototypeRole role; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateRoleTemplateOptions instance. - * - * @param createRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(CreateRoleTemplateOptions createRoleTemplateOptions) { - this.name = createRoleTemplateOptions.name; - this.accountId = createRoleTemplateOptions.accountId; - this.description = createRoleTemplateOptions.description; - this.committed = createRoleTemplateOptions.committed; - this.role = createRoleTemplateOptions.role; - this.acceptLanguage = createRoleTemplateOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param accountId the accountId - */ - public Builder(String name, String accountId) { - this.name = name; - this.accountId = accountId; - } - - /** - * Builds a CreateRoleTemplateOptions. - * - * @return the new CreateRoleTemplateOptions instance - */ - public CreateRoleTemplateOptions build() { - return new CreateRoleTemplateOptions(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateRoleTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the CreateRoleTemplateOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateRoleTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreateRoleTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - - /** - * Set the role. - * - * @param role the role - * @return the CreateRoleTemplateOptions builder - */ - public Builder role(RoleTemplatePrototypeRole role) { - this.role = role; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateRoleTemplateOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateRoleTemplateOptions() { } - - protected CreateRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - name = builder.name; - accountId = builder.accountId; - description = builder.description; - committed = builder.committed; - role = builder.role; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the description. - * - * Description of the role template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the role for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template. If committed is set to true, then the template version can no longer be updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } - - /** - * Gets the role. - * - * The role properties that are created in an action resource when the template is assigned. - * - * @return the role - */ - public RoleTemplatePrototypeRole role() { - return role; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java deleted file mode 100644 index c322c5a332d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createRoleTemplateVersion options. - */ -public class CreateRoleTemplateVersionOptions extends GenericModel { - - protected String roleTemplateId; - protected String name; - protected String description; - protected TemplateRole role; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String name; - private String description; - private TemplateRole role; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing CreateRoleTemplateVersionOptions instance. - * - * @param createRoleTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(CreateRoleTemplateVersionOptions createRoleTemplateVersionOptions) { - this.roleTemplateId = createRoleTemplateVersionOptions.roleTemplateId; - this.name = createRoleTemplateVersionOptions.name; - this.description = createRoleTemplateVersionOptions.description; - this.role = createRoleTemplateVersionOptions.role; - this.committed = createRoleTemplateVersionOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - */ - public Builder(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - } - - /** - * Builds a CreateRoleTemplateVersionOptions. - * - * @return the new CreateRoleTemplateVersionOptions instance - */ - public CreateRoleTemplateVersionOptions build() { - return new CreateRoleTemplateVersionOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the role. - * - * @param role the role - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder role(TemplateRole role) { - this.role = role; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected CreateRoleTemplateVersionOptions() { } - - protected CreateRoleTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - roleTemplateId = builder.roleTemplateId; - name = builder.name; - description = builder.description; - role = builder.role; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a CreateRoleTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * The role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will - * change the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the role template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the role for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the role. - * - * The role properties that are created in an action resource when the template is assigned. - * - * @return the role - */ - public TemplateRole role() { - return role; - } - - /** - * Gets the committed. - * - * Committed status of the template version. If committed is set to true, then the template version can no longer be - * updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java deleted file mode 100644 index 59ccb4b908a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java +++ /dev/null @@ -1,312 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createV2Policy options. - */ -public class CreateV2PolicyOptions extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - protected Control control; - protected String type; - protected String description; - protected V2PolicySubject subject; - protected V2PolicyResource resource; - protected String pattern; - protected V2PolicyRule rule; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private Control control; - private String type; - private String description; - private V2PolicySubject subject; - private V2PolicyResource resource; - private String pattern; - private V2PolicyRule rule; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateV2PolicyOptions instance. - * - * @param createV2PolicyOptions the instance to initialize the Builder with - */ - private Builder(CreateV2PolicyOptions createV2PolicyOptions) { - this.control = createV2PolicyOptions.control; - this.type = createV2PolicyOptions.type; - this.description = createV2PolicyOptions.description; - this.subject = createV2PolicyOptions.subject; - this.resource = createV2PolicyOptions.resource; - this.pattern = createV2PolicyOptions.pattern; - this.rule = createV2PolicyOptions.rule; - this.acceptLanguage = createV2PolicyOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param control the control - * @param type the type - */ - public Builder(Control control, String type) { - this.control = control; - this.type = type; - } - - /** - * Builds a CreateV2PolicyOptions. - * - * @return the new CreateV2PolicyOptions instance - */ - public CreateV2PolicyOptions build() { - return new CreateV2PolicyOptions(this); - } - - /** - * Set the control. - * - * @param control the control - * @return the CreateV2PolicyOptions builder - */ - public Builder control(Control control) { - this.control = control; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the CreateV2PolicyOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateV2PolicyOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the subject. - * - * @param subject the subject - * @return the CreateV2PolicyOptions builder - */ - public Builder subject(V2PolicySubject subject) { - this.subject = subject; - return this; - } - - /** - * Set the resource. - * - * @param resource the resource - * @return the CreateV2PolicyOptions builder - */ - public Builder resource(V2PolicyResource resource) { - this.resource = resource; - return this; - } - - /** - * Set the pattern. - * - * @param pattern the pattern - * @return the CreateV2PolicyOptions builder - */ - public Builder pattern(String pattern) { - this.pattern = pattern; - return this; - } - - /** - * Set the rule. - * - * @param rule the rule - * @return the CreateV2PolicyOptions builder - */ - public Builder rule(V2PolicyRule rule) { - this.rule = rule; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateV2PolicyOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateV2PolicyOptions() { } - - protected CreateV2PolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.control, - "control cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - control = builder.control; - type = builder.type; - description = builder.description; - subject = builder.subject; - resource = builder.resource; - pattern = builder.pattern; - rule = builder.rule; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateV2PolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the control. - * - * Specifies the type of access that is granted by the policy. - * - * @return the control - */ - public Control control() { - return control; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject subject() { - return subject; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource resource() { - return resource; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String pattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule rule() { - return rule; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java deleted file mode 100644 index f5e35c13d9f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * An additional set of properties associated with a role. - */ -public class CustomRole extends GenericModel { - - protected String id; - @SerializedName("display_name") - protected String displayName; - protected String description; - protected List actions; - protected String crn; - protected String name; - @SerializedName("account_id") - protected String accountId; - @SerializedName("service_name") - protected String serviceName; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String href; - - protected CustomRole() { } - - /** - * Gets the id. - * - * The role ID. Composed of hexadecimal characters. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String getDisplayName() { - return displayName; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List getActions() { - return actions; - } - - /** - * Gets the crn. - * - * The role Cloud Resource Name (CRN). Example CRN: - * 'crn:v1:ibmcloud:public:iam-access-management::a/exampleAccountId::customRole:ExampleRoleName'. - * - * @return the crn - */ - public String getCrn() { - return crn; - } - - /** - * Gets the name. - * - * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the accountId. - * - * The account GUID. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the serviceName. - * - * The service name. - * - * @return the serviceName - */ - public String getServiceName() { - return serviceName; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the role was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the role. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the role was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the href. - * - * The href links back to the role. - * - * @return the href - */ - public String getHref() { - return href; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java deleted file mode 100644 index f71d2c2ab9d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteActionControlAssignment options. - */ -public class DeleteActionControlAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing DeleteActionControlAssignmentOptions instance. - * - * @param deleteActionControlAssignmentOptions the instance to initialize the Builder with - */ - private Builder(DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptions) { - this.assignmentId = deleteActionControlAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a DeleteActionControlAssignmentOptions. - * - * @return the new DeleteActionControlAssignmentOptions instance - */ - public DeleteActionControlAssignmentOptions build() { - return new DeleteActionControlAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the DeleteActionControlAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected DeleteActionControlAssignmentOptions() { } - - protected DeleteActionControlAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a DeleteActionControlAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Action control template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java deleted file mode 100644 index 6ff35d83603..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteActionControlTemplate options. - */ -public class DeleteActionControlTemplateOptions extends GenericModel { - - protected String actionControlTemplateId; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - - /** - * Instantiates a new Builder from an existing DeleteActionControlTemplateOptions instance. - * - * @param deleteActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(DeleteActionControlTemplateOptions deleteActionControlTemplateOptions) { - this.actionControlTemplateId = deleteActionControlTemplateOptions.actionControlTemplateId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - */ - public Builder(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - } - - /** - * Builds a DeleteActionControlTemplateOptions. - * - * @return the new DeleteActionControlTemplateOptions instance - */ - public DeleteActionControlTemplateOptions build() { - return new DeleteActionControlTemplateOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the DeleteActionControlTemplateOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - } - - protected DeleteActionControlTemplateOptions() { } - - protected DeleteActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - } - - /** - * New builder. - * - * @return a DeleteActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java deleted file mode 100644 index 69aca0555a1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteActionControlTemplateVersion options. - */ -public class DeleteActionControlTemplateVersionOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing DeleteActionControlTemplateVersionOptions instance. - * - * @param deleteActionControlTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptions) { - this.actionControlTemplateId = deleteActionControlTemplateVersionOptions.actionControlTemplateId; - this.version = deleteActionControlTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - * @param version the version - */ - public Builder(String actionControlTemplateId, String version) { - this.actionControlTemplateId = actionControlTemplateId; - this.version = version; - } - - /** - * Builds a DeleteActionControlTemplateVersionOptions. - * - * @return the new DeleteActionControlTemplateVersionOptions instance - */ - public DeleteActionControlTemplateVersionOptions build() { - return new DeleteActionControlTemplateVersionOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the DeleteActionControlTemplateVersionOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the DeleteActionControlTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected DeleteActionControlTemplateVersionOptions() { } - - protected DeleteActionControlTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a DeleteActionControlTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java deleted file mode 100644 index 3ab2cf17469..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deletePolicyAssignment options. - */ -public class DeletePolicyAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing DeletePolicyAssignmentOptions instance. - * - * @param deletePolicyAssignmentOptions the instance to initialize the Builder with - */ - private Builder(DeletePolicyAssignmentOptions deletePolicyAssignmentOptions) { - this.assignmentId = deletePolicyAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a DeletePolicyAssignmentOptions. - * - * @return the new DeletePolicyAssignmentOptions instance - */ - public DeletePolicyAssignmentOptions build() { - return new DeletePolicyAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the DeletePolicyAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected DeletePolicyAssignmentOptions() { } - - protected DeletePolicyAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a DeletePolicyAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * The policy template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java deleted file mode 100644 index fe070b2064a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deletePolicy options. - */ -public class DeletePolicyOptions extends GenericModel { - - protected String policyId; - - /** - * Builder. - */ - public static class Builder { - private String policyId; - - /** - * Instantiates a new Builder from an existing DeletePolicyOptions instance. - * - * @param deletePolicyOptions the instance to initialize the Builder with - */ - private Builder(DeletePolicyOptions deletePolicyOptions) { - this.policyId = deletePolicyOptions.policyId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyId the policyId - */ - public Builder(String policyId) { - this.policyId = policyId; - } - - /** - * Builds a DeletePolicyOptions. - * - * @return the new DeletePolicyOptions instance - */ - public DeletePolicyOptions build() { - return new DeletePolicyOptions(this); - } - - /** - * Set the policyId. - * - * @param policyId the policyId - * @return the DeletePolicyOptions builder - */ - public Builder policyId(String policyId) { - this.policyId = policyId; - return this; - } - } - - protected DeletePolicyOptions() { } - - protected DeletePolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, - "policyId cannot be empty"); - policyId = builder.policyId; - } - - /** - * New builder. - * - * @return a DeletePolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyId. - * - * The policy ID. - * - * @return the policyId - */ - public String policyId() { - return policyId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java deleted file mode 100644 index bb70b0d6727..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deletePolicyTemplate options. - */ -public class DeletePolicyTemplateOptions extends GenericModel { - - protected String policyTemplateId; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - - /** - * Instantiates a new Builder from an existing DeletePolicyTemplateOptions instance. - * - * @param deletePolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(DeletePolicyTemplateOptions deletePolicyTemplateOptions) { - this.policyTemplateId = deletePolicyTemplateOptions.policyTemplateId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - */ - public Builder(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - } - - /** - * Builds a DeletePolicyTemplateOptions. - * - * @return the new DeletePolicyTemplateOptions instance - */ - public DeletePolicyTemplateOptions build() { - return new DeletePolicyTemplateOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the DeletePolicyTemplateOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - } - - protected DeletePolicyTemplateOptions() { } - - protected DeletePolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - policyTemplateId = builder.policyTemplateId; - } - - /** - * New builder. - * - * @return a DeletePolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java deleted file mode 100644 index 9a04a5157b6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deletePolicyTemplateVersion options. - */ -public class DeletePolicyTemplateVersionOptions extends GenericModel { - - protected String policyTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing DeletePolicyTemplateVersionOptions instance. - * - * @param deletePolicyTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptions) { - this.policyTemplateId = deletePolicyTemplateVersionOptions.policyTemplateId; - this.version = deletePolicyTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param version the version - */ - public Builder(String policyTemplateId, String version) { - this.policyTemplateId = policyTemplateId; - this.version = version; - } - - /** - * Builds a DeletePolicyTemplateVersionOptions. - * - * @return the new DeletePolicyTemplateVersionOptions instance - */ - public DeletePolicyTemplateVersionOptions build() { - return new DeletePolicyTemplateVersionOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the DeletePolicyTemplateVersionOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the DeletePolicyTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected DeletePolicyTemplateVersionOptions() { } - - protected DeletePolicyTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - policyTemplateId = builder.policyTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a DeletePolicyTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the version. - * - * The policy template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java deleted file mode 100644 index b9341a9f414..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteRoleAssignment options. - */ -public class DeleteRoleAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing DeleteRoleAssignmentOptions instance. - * - * @param deleteRoleAssignmentOptions the instance to initialize the Builder with - */ - private Builder(DeleteRoleAssignmentOptions deleteRoleAssignmentOptions) { - this.assignmentId = deleteRoleAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a DeleteRoleAssignmentOptions. - * - * @return the new DeleteRoleAssignmentOptions instance - */ - public DeleteRoleAssignmentOptions build() { - return new DeleteRoleAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the DeleteRoleAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected DeleteRoleAssignmentOptions() { } - - protected DeleteRoleAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a DeleteRoleAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Role template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java deleted file mode 100644 index 8675777719e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteRole options. - */ -public class DeleteRoleOptions extends GenericModel { - - protected String roleId; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - - /** - * Instantiates a new Builder from an existing DeleteRoleOptions instance. - * - * @param deleteRoleOptions the instance to initialize the Builder with - */ - private Builder(DeleteRoleOptions deleteRoleOptions) { - this.roleId = deleteRoleOptions.roleId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - */ - public Builder(String roleId) { - this.roleId = roleId; - } - - /** - * Builds a DeleteRoleOptions. - * - * @return the new DeleteRoleOptions instance - */ - public DeleteRoleOptions build() { - return new DeleteRoleOptions(this); - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the DeleteRoleOptions builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - } - - protected DeleteRoleOptions() { } - - protected DeleteRoleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, - "roleId cannot be empty"); - roleId = builder.roleId; - } - - /** - * New builder. - * - * @return a DeleteRoleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role ID. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java deleted file mode 100644 index c76bf3bfda4..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteRoleTemplate options. - */ -public class DeleteRoleTemplateOptions extends GenericModel { - - protected String roleTemplateId; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - - /** - * Instantiates a new Builder from an existing DeleteRoleTemplateOptions instance. - * - * @param deleteRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(DeleteRoleTemplateOptions deleteRoleTemplateOptions) { - this.roleTemplateId = deleteRoleTemplateOptions.roleTemplateId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - */ - public Builder(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - } - - /** - * Builds a DeleteRoleTemplateOptions. - * - * @return the new DeleteRoleTemplateOptions instance - */ - public DeleteRoleTemplateOptions build() { - return new DeleteRoleTemplateOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the DeleteRoleTemplateOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - } - - protected DeleteRoleTemplateOptions() { } - - protected DeleteRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - roleTemplateId = builder.roleTemplateId; - } - - /** - * New builder. - * - * @return a DeleteRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java deleted file mode 100644 index 9f974213165..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteRoleTemplateVersion options. - */ -public class DeleteRoleTemplateVersionOptions extends GenericModel { - - protected String roleTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing DeleteRoleTemplateVersionOptions instance. - * - * @param deleteRoleTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptions) { - this.roleTemplateId = deleteRoleTemplateVersionOptions.roleTemplateId; - this.version = deleteRoleTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - * @param version the version - */ - public Builder(String roleTemplateId, String version) { - this.roleTemplateId = roleTemplateId; - this.version = version; - } - - /** - * Builds a DeleteRoleTemplateVersionOptions. - * - * @return the new DeleteRoleTemplateVersionOptions instance - */ - public DeleteRoleTemplateVersionOptions build() { - return new DeleteRoleTemplateVersionOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the DeleteRoleTemplateVersionOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the DeleteRoleTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected DeleteRoleTemplateVersionOptions() { } - - protected DeleteRoleTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - roleTemplateId = builder.roleTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a DeleteRoleTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the version. - * - * Role template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java deleted file mode 100644 index 92c1caaa34c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteV2Policy options. - */ -public class DeleteV2PolicyOptions extends GenericModel { - - protected String id; - - /** - * Builder. - */ - public static class Builder { - private String id; - - /** - * Instantiates a new Builder from an existing DeleteV2PolicyOptions instance. - * - * @param deleteV2PolicyOptions the instance to initialize the Builder with - */ - private Builder(DeleteV2PolicyOptions deleteV2PolicyOptions) { - this.id = deleteV2PolicyOptions.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 DeleteV2PolicyOptions. - * - * @return the new DeleteV2PolicyOptions instance - */ - public DeleteV2PolicyOptions build() { - return new DeleteV2PolicyOptions(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the DeleteV2PolicyOptions builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - } - - protected DeleteV2PolicyOptions() { } - - protected DeleteV2PolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, - "id cannot be empty"); - id = builder.id; - } - - /** - * New builder. - * - * @return a DeleteV2PolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String id() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java deleted file mode 100644 index 0978eb1040b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role associated with a policy with additional information (display_name, description, actions) when - * `format=display`. - */ -public class EnrichedRoles extends GenericModel { - - @SerializedName("role_id") - protected String roleId; - @SerializedName("display_name") - protected String displayName; - protected String description; - protected List actions; - - protected EnrichedRoles() { } - - /** - * Gets the roleId. - * - * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. - * - * @return the roleId - */ - public String getRoleId() { - return roleId; - } - - /** - * Gets the displayName. - * - * The display name of the role, either service-defined or user-defined for custom roles. - * - * @return the displayName - */ - public String getDisplayName() { - return displayName; - } - - /** - * Gets the description. - * - * The role description, either service-defined or user-defined for custom roles. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List getActions() { - return actions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java deleted file mode 100644 index e99ea48f5f6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Additional error details. - */ -public class ErrorDetails extends GenericModel { - - @SerializedName("conflicts_with") - protected ConflictsWith conflictsWith; - - protected ErrorDetails() { } - - /** - * Gets the conflictsWith. - * - * Details of conflicting resource. - * - * @return the conflictsWith - */ - public ConflictsWith getConflictsWith() { - return conflictsWith; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java deleted file mode 100644 index b5411a7bb36..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * ErrorObject. - */ -public class ErrorObject extends GenericModel { - - /** - * The API error code for the error. - */ - public interface Code { - /** insufficent_permissions. */ - String INSUFFICENT_PERMISSIONS = "insufficent_permissions"; - /** invalid_body. */ - String INVALID_BODY = "invalid_body"; - /** invalid_token. */ - String INVALID_TOKEN = "invalid_token"; - /** missing_required_query_parameter. */ - String MISSING_REQUIRED_QUERY_PARAMETER = "missing_required_query_parameter"; - /** not_found. */ - String NOT_FOUND = "not_found"; - /** policy_conflict_error. */ - String POLICY_CONFLICT_ERROR = "policy_conflict_error"; - /** policy_not_found. */ - String POLICY_NOT_FOUND = "policy_not_found"; - /** request_not_processed. */ - String REQUEST_NOT_PROCESSED = "request_not_processed"; - /** role_conflict_error. */ - String ROLE_CONFLICT_ERROR = "role_conflict_error"; - /** role_not_found. */ - String ROLE_NOT_FOUND = "role_not_found"; - /** too_many_requests. */ - String TOO_MANY_REQUESTS = "too_many_requests"; - /** unable_to_process. */ - String UNABLE_TO_PROCESS = "unable_to_process"; - /** unsupported_content_type. */ - String UNSUPPORTED_CONTENT_TYPE = "unsupported_content_type"; - /** policy_template_conflict_error. */ - String POLICY_TEMPLATE_CONFLICT_ERROR = "policy_template_conflict_error"; - /** policy_template_not_found. */ - String POLICY_TEMPLATE_NOT_FOUND = "policy_template_not_found"; - /** policy_assignment_not_found. */ - String POLICY_ASSIGNMENT_NOT_FOUND = "policy_assignment_not_found"; - /** policy_assignment_conflict_error. */ - String POLICY_ASSIGNMENT_CONFLICT_ERROR = "policy_assignment_conflict_error"; - /** resource_not_found. */ - String RESOURCE_NOT_FOUND = "resource_not_found"; - /** action_control_template_not_found. */ - String ACTION_CONTROL_TEMPLATE_NOT_FOUND = "action_control_template_not_found"; - /** action_control_assignment_not_found. */ - String ACTION_CONTROL_ASSIGNMENT_NOT_FOUND = "action_control_assignment_not_found"; - /** role_template_conflict_error. */ - String ROLE_TEMPLATE_CONFLICT_ERROR = "role_template_conflict_error"; - /** role_template_not_found. */ - String ROLE_TEMPLATE_NOT_FOUND = "role_template_not_found"; - /** role_assignment_not_found. */ - String ROLE_ASSIGNMENT_NOT_FOUND = "role_assignment_not_found"; - } - - protected String code; - protected String message; - protected ErrorDetails details; - @SerializedName("more_info") - protected String moreInfo; - - protected ErrorObject() { } - - /** - * Gets the code. - * - * The API error code for the error. - * - * @return the code - */ - public String getCode() { - return code; - } - - /** - * Gets the message. - * - * The error message returned by the API. - * - * @return the message - */ - public String getMessage() { - return message; - } - - /** - * Gets the details. - * - * Additional error details. - * - * @return the details - */ - public ErrorDetails getDetails() { - return details; - } - - /** - * Gets the moreInfo. - * - * Additional info for error. - * - * @return the moreInfo - */ - public String getMoreInfo() { - return moreInfo; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java deleted file mode 100644 index 5c1c9a9fad6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * How external accounts can interact in relation to the requested account. - */ -public class ExternalAccountIdentityInteraction extends GenericModel { - - @SerializedName("identity_types") - protected IdentityTypes identityTypes; - - protected ExternalAccountIdentityInteraction() { } - - /** - * Gets the identityTypes. - * - * The settings for each identity type. - * - * @return the identityTypes - */ - public IdentityTypes getIdentityTypes() { - return identityTypes; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java deleted file mode 100644 index 1efd0673e9d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Update to how external accounts can interact in relation to the requested account. - */ -public class ExternalAccountIdentityInteractionPatch extends GenericModel { - - @SerializedName("identity_types") - protected IdentityTypesPatch identityTypes; - - /** - * Builder. - */ - public static class Builder { - private IdentityTypesPatch identityTypes; - - /** - * Instantiates a new Builder from an existing ExternalAccountIdentityInteractionPatch instance. - * - * @param externalAccountIdentityInteractionPatch the instance to initialize the Builder with - */ - private Builder(ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatch) { - this.identityTypes = externalAccountIdentityInteractionPatch.identityTypes; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a ExternalAccountIdentityInteractionPatch. - * - * @return the new ExternalAccountIdentityInteractionPatch instance - */ - public ExternalAccountIdentityInteractionPatch build() { - return new ExternalAccountIdentityInteractionPatch(this); - } - - /** - * Set the identityTypes. - * - * @param identityTypes the identityTypes - * @return the ExternalAccountIdentityInteractionPatch builder - */ - public Builder identityTypes(IdentityTypesPatch identityTypes) { - this.identityTypes = identityTypes; - return this; - } - } - - protected ExternalAccountIdentityInteractionPatch() { } - - protected ExternalAccountIdentityInteractionPatch(Builder builder) { - identityTypes = builder.identityTypes; - } - - /** - * New builder. - * - * @return a ExternalAccountIdentityInteractionPatch builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the identityTypes. - * - * The settings to apply for each identity type for a request. - * - * @return the identityTypes - */ - public IdentityTypesPatch identityTypes() { - return identityTypes; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java deleted file mode 100644 index 83cd67d33c9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Details with linking href to first page of requested collection. - */ -public class First extends GenericModel { - - protected String href; - - protected First() { } - - /** - * Gets the href. - * - * The href linking to the page of requested collection. - * - * @return the href - */ - public String getHref() { - return href; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java deleted file mode 100644 index f87e7d741a4..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getActionControlAssignment options. - */ -public class GetActionControlAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing GetActionControlAssignmentOptions instance. - * - * @param getActionControlAssignmentOptions the instance to initialize the Builder with - */ - private Builder(GetActionControlAssignmentOptions getActionControlAssignmentOptions) { - this.assignmentId = getActionControlAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a GetActionControlAssignmentOptions. - * - * @return the new GetActionControlAssignmentOptions instance - */ - public GetActionControlAssignmentOptions build() { - return new GetActionControlAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the GetActionControlAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected GetActionControlAssignmentOptions() { } - - protected GetActionControlAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a GetActionControlAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Action control template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java deleted file mode 100644 index 963c68e8876..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getActionControlTemplate options. - */ -public class GetActionControlTemplateOptions extends GenericModel { - - /** - * The action control template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String actionControlTemplateId; - protected String state; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String state; - - /** - * Instantiates a new Builder from an existing GetActionControlTemplateOptions instance. - * - * @param getActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(GetActionControlTemplateOptions getActionControlTemplateOptions) { - this.actionControlTemplateId = getActionControlTemplateOptions.actionControlTemplateId; - this.state = getActionControlTemplateOptions.state; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - */ - public Builder(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - } - - /** - * Builds a GetActionControlTemplateOptions. - * - * @return the new GetActionControlTemplateOptions instance - */ - public GetActionControlTemplateOptions build() { - return new GetActionControlTemplateOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the GetActionControlTemplateOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the GetActionControlTemplateOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - } - - protected GetActionControlTemplateOptions() { } - - protected GetActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - state = builder.state; - } - - /** - * New builder. - * - * @return a GetActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the state. - * - * The action control template state. - * - * @return the state - */ - public String state() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java deleted file mode 100644 index 95bc94950bb..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getActionControlTemplateVersion options. - */ -public class GetActionControlTemplateVersionOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing GetActionControlTemplateVersionOptions instance. - * - * @param getActionControlTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptions) { - this.actionControlTemplateId = getActionControlTemplateVersionOptions.actionControlTemplateId; - this.version = getActionControlTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - * @param version the version - */ - public Builder(String actionControlTemplateId, String version) { - this.actionControlTemplateId = actionControlTemplateId; - this.version = version; - } - - /** - * Builds a GetActionControlTemplateVersionOptions. - * - * @return the new GetActionControlTemplateVersionOptions instance - */ - public GetActionControlTemplateVersionOptions build() { - return new GetActionControlTemplateVersionOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the GetActionControlTemplateVersionOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the GetActionControlTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected GetActionControlTemplateVersionOptions() { } - - protected GetActionControlTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a GetActionControlTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java deleted file mode 100644 index d1c7c359003..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getPolicyAssignment options. - */ -public class GetPolicyAssignmentOptions extends GenericModel { - - protected String assignmentId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - private String version; - - /** - * Instantiates a new Builder from an existing GetPolicyAssignmentOptions instance. - * - * @param getPolicyAssignmentOptions the instance to initialize the Builder with - */ - private Builder(GetPolicyAssignmentOptions getPolicyAssignmentOptions) { - this.assignmentId = getPolicyAssignmentOptions.assignmentId; - this.version = getPolicyAssignmentOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - * @param version the version - */ - public Builder(String assignmentId, String version) { - this.assignmentId = assignmentId; - this.version = version; - } - - /** - * Builds a GetPolicyAssignmentOptions. - * - * @return the new GetPolicyAssignmentOptions instance - */ - public GetPolicyAssignmentOptions build() { - return new GetPolicyAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the GetPolicyAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the GetPolicyAssignmentOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected GetPolicyAssignmentOptions() { } - - protected GetPolicyAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - assignmentId = builder.assignmentId; - version = builder.version; - } - - /** - * New builder. - * - * @return a GetPolicyAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * The policy template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } - - /** - * Gets the version. - * - * specify version of response body format. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java deleted file mode 100644 index e780ac06896..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getPolicy options. - */ -public class GetPolicyOptions extends GenericModel { - - protected String policyId; - - /** - * Builder. - */ - public static class Builder { - private String policyId; - - /** - * Instantiates a new Builder from an existing GetPolicyOptions instance. - * - * @param getPolicyOptions the instance to initialize the Builder with - */ - private Builder(GetPolicyOptions getPolicyOptions) { - this.policyId = getPolicyOptions.policyId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyId the policyId - */ - public Builder(String policyId) { - this.policyId = policyId; - } - - /** - * Builds a GetPolicyOptions. - * - * @return the new GetPolicyOptions instance - */ - public GetPolicyOptions build() { - return new GetPolicyOptions(this); - } - - /** - * Set the policyId. - * - * @param policyId the policyId - * @return the GetPolicyOptions builder - */ - public Builder policyId(String policyId) { - this.policyId = policyId; - return this; - } - } - - protected GetPolicyOptions() { } - - protected GetPolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, - "policyId cannot be empty"); - policyId = builder.policyId; - } - - /** - * New builder. - * - * @return a GetPolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyId. - * - * The policy ID. - * - * @return the policyId - */ - public String policyId() { - return policyId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java deleted file mode 100644 index ee604554a85..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getPolicyTemplate options. - */ -public class GetPolicyTemplateOptions extends GenericModel { - - /** - * The policy template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String policyTemplateId; - protected String state; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String state; - - /** - * Instantiates a new Builder from an existing GetPolicyTemplateOptions instance. - * - * @param getPolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(GetPolicyTemplateOptions getPolicyTemplateOptions) { - this.policyTemplateId = getPolicyTemplateOptions.policyTemplateId; - this.state = getPolicyTemplateOptions.state; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - */ - public Builder(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - } - - /** - * Builds a GetPolicyTemplateOptions. - * - * @return the new GetPolicyTemplateOptions instance - */ - public GetPolicyTemplateOptions build() { - return new GetPolicyTemplateOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the GetPolicyTemplateOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the GetPolicyTemplateOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - } - - protected GetPolicyTemplateOptions() { } - - protected GetPolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - policyTemplateId = builder.policyTemplateId; - state = builder.state; - } - - /** - * New builder. - * - * @return a GetPolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the state. - * - * The policy template state. - * - * @return the state - */ - public String state() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java deleted file mode 100644 index 8741f83357d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getPolicyTemplateVersion options. - */ -public class GetPolicyTemplateVersionOptions extends GenericModel { - - protected String policyTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing GetPolicyTemplateVersionOptions instance. - * - * @param getPolicyTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptions) { - this.policyTemplateId = getPolicyTemplateVersionOptions.policyTemplateId; - this.version = getPolicyTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param version the version - */ - public Builder(String policyTemplateId, String version) { - this.policyTemplateId = policyTemplateId; - this.version = version; - } - - /** - * Builds a GetPolicyTemplateVersionOptions. - * - * @return the new GetPolicyTemplateVersionOptions instance - */ - public GetPolicyTemplateVersionOptions build() { - return new GetPolicyTemplateVersionOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the GetPolicyTemplateVersionOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the GetPolicyTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected GetPolicyTemplateVersionOptions() { } - - protected GetPolicyTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - policyTemplateId = builder.policyTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a GetPolicyTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the version. - * - * The policy template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java deleted file mode 100644 index 35313b9b746..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getRoleAssignment options. - */ -public class GetRoleAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing GetRoleAssignmentOptions instance. - * - * @param getRoleAssignmentOptions the instance to initialize the Builder with - */ - private Builder(GetRoleAssignmentOptions getRoleAssignmentOptions) { - this.assignmentId = getRoleAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a GetRoleAssignmentOptions. - * - * @return the new GetRoleAssignmentOptions instance - */ - public GetRoleAssignmentOptions build() { - return new GetRoleAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the GetRoleAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected GetRoleAssignmentOptions() { } - - protected GetRoleAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a GetRoleAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Role template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java deleted file mode 100644 index 8c56ac7f58a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getRole options. - */ -public class GetRoleOptions extends GenericModel { - - protected String roleId; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - - /** - * Instantiates a new Builder from an existing GetRoleOptions instance. - * - * @param getRoleOptions the instance to initialize the Builder with - */ - private Builder(GetRoleOptions getRoleOptions) { - this.roleId = getRoleOptions.roleId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - */ - public Builder(String roleId) { - this.roleId = roleId; - } - - /** - * Builds a GetRoleOptions. - * - * @return the new GetRoleOptions instance - */ - public GetRoleOptions build() { - return new GetRoleOptions(this); - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the GetRoleOptions builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - } - - protected GetRoleOptions() { } - - protected GetRoleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, - "roleId cannot be empty"); - roleId = builder.roleId; - } - - /** - * New builder. - * - * @return a GetRoleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role ID. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java deleted file mode 100644 index e33fcf29b32..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getRoleTemplate options. - */ -public class GetRoleTemplateOptions extends GenericModel { - - /** - * The role template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String roleTemplateId; - protected String state; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String state; - - /** - * Instantiates a new Builder from an existing GetRoleTemplateOptions instance. - * - * @param getRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(GetRoleTemplateOptions getRoleTemplateOptions) { - this.roleTemplateId = getRoleTemplateOptions.roleTemplateId; - this.state = getRoleTemplateOptions.state; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - */ - public Builder(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - } - - /** - * Builds a GetRoleTemplateOptions. - * - * @return the new GetRoleTemplateOptions instance - */ - public GetRoleTemplateOptions build() { - return new GetRoleTemplateOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the GetRoleTemplateOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the GetRoleTemplateOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - } - - protected GetRoleTemplateOptions() { } - - protected GetRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - roleTemplateId = builder.roleTemplateId; - state = builder.state; - } - - /** - * New builder. - * - * @return a GetRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the state. - * - * The role template state. - * - * @return the state - */ - public String state() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java deleted file mode 100644 index 4757484f969..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getRoleTemplateVersion options. - */ -public class GetRoleTemplateVersionOptions extends GenericModel { - - protected String roleTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing GetRoleTemplateVersionOptions instance. - * - * @param getRoleTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(GetRoleTemplateVersionOptions getRoleTemplateVersionOptions) { - this.roleTemplateId = getRoleTemplateVersionOptions.roleTemplateId; - this.version = getRoleTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - * @param version the version - */ - public Builder(String roleTemplateId, String version) { - this.roleTemplateId = roleTemplateId; - this.version = version; - } - - /** - * Builds a GetRoleTemplateVersionOptions. - * - * @return the new GetRoleTemplateVersionOptions instance - */ - public GetRoleTemplateVersionOptions build() { - return new GetRoleTemplateVersionOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the GetRoleTemplateVersionOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the GetRoleTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected GetRoleTemplateVersionOptions() { } - - protected GetRoleTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - roleTemplateId = builder.roleTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a GetRoleTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the version. - * - * Role template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java deleted file mode 100644 index ebc88bbf45c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getSettings options. - */ -public class GetSettingsOptions extends GenericModel { - - protected String accountId; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing GetSettingsOptions instance. - * - * @param getSettingsOptions the instance to initialize the Builder with - */ - private Builder(GetSettingsOptions getSettingsOptions) { - this.accountId = getSettingsOptions.accountId; - this.acceptLanguage = getSettingsOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a GetSettingsOptions. - * - * @return the new GetSettingsOptions instance - */ - public GetSettingsOptions build() { - return new GetSettingsOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the GetSettingsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the GetSettingsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected GetSettingsOptions() { } - - protected GetSettingsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.accountId, - "accountId cannot be empty"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a GetSettingsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the settings belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java deleted file mode 100644 index 23a950cc815..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getV2Policy options. - */ -public class GetV2PolicyOptions extends GenericModel { - - /** - * Include additional data for policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles and translations for all - * relevant fields. - */ - public interface Format { - /** include_last_permit. */ - String INCLUDE_LAST_PERMIT = "include_last_permit"; - /** display. */ - String DISPLAY = "display"; - } - - protected String id; - protected String format; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String format; - - /** - * Instantiates a new Builder from an existing GetV2PolicyOptions instance. - * - * @param getV2PolicyOptions the instance to initialize the Builder with - */ - private Builder(GetV2PolicyOptions getV2PolicyOptions) { - this.id = getV2PolicyOptions.id; - this.format = getV2PolicyOptions.format; - } - - /** - * 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 GetV2PolicyOptions. - * - * @return the new GetV2PolicyOptions instance - */ - public GetV2PolicyOptions build() { - return new GetV2PolicyOptions(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the GetV2PolicyOptions builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the format. - * - * @param format the format - * @return the GetV2PolicyOptions builder - */ - public Builder format(String format) { - this.format = format; - return this; - } - } - - protected GetV2PolicyOptions() { } - - protected GetV2PolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, - "id cannot be empty"); - id = builder.id; - format = builder.format; - } - - /** - * New builder. - * - * @return a GetV2PolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the format. - * - * Include additional data for policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles and translations for all - * relevant fields. - * - * @return the format - */ - public String format() { - return format; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java deleted file mode 100644 index d8439c9d6f7..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Permission is granted by the policy. - */ -public class Grant extends GenericModel { - - protected List roles; - - /** - * Builder. - */ - public static class Builder { - private List roles; - - /** - * Instantiates a new Builder from an existing Grant instance. - * - * @param grant the instance to initialize the Builder with - */ - private Builder(Grant grant) { - this.roles = grant.roles; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roles the roles - */ - public Builder(List roles) { - this.roles = roles; - } - - /** - * Builds a Grant. - * - * @return the new Grant instance - */ - public Grant build() { - return new Grant(this); - } - - /** - * Adds a new element to roles. - * - * @param roles the new element to be added - * @return the Grant builder - */ - public Builder addRoles(Roles roles) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roles, - "roles cannot be null"); - if (this.roles == null) { - this.roles = new ArrayList(); - } - this.roles.add(roles); - return this; - } - - /** - * Set the roles. - * Existing roles will be replaced. - * - * @param roles the roles - * @return the Grant builder - */ - public Builder roles(List roles) { - this.roles = roles; - return this; - } - } - - protected Grant() { } - - protected Grant(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, - "roles cannot be null"); - roles = builder.roles; - } - - /** - * New builder. - * - * @return a Grant builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List roles() { - return roles; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java deleted file mode 100644 index 1dbc53fefb6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Permission granted by the policy with translated roles and additional role information. - */ -public class GrantWithEnrichedRoles extends GenericModel { - - protected List roles; - - protected GrantWithEnrichedRoles() { } - - /** - * Gets the roles. - * - * A set of roles granted by the policy. - * - * @return the roles - */ - public List getRoles() { - return roles; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java deleted file mode 100644 index 0ac71d8192b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The settings for each identity type. - */ -public class IdentityTypes extends GenericModel { - - protected IdentityTypesBase user; - @SerializedName("service_id") - protected IdentityTypesBase serviceId; - protected IdentityTypesBase service; - - protected IdentityTypes() { } - - /** - * Gets the user. - * - * The core set of properties associated with an identity type. - * - * @return the user - */ - public IdentityTypesBase getUser() { - return user; - } - - /** - * Gets the serviceId. - * - * The core set of properties associated with an identity type. - * - * @return the serviceId - */ - public IdentityTypesBase getServiceId() { - return serviceId; - } - - /** - * Gets the service. - * - * The core set of properties associated with an identity type. - * - * @return the service - */ - public IdentityTypesBase getService() { - return service; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java deleted file mode 100644 index e8df91a1e5d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with an identity type. - */ -public class IdentityTypesBase extends GenericModel { - - /** - * The state of the identity type. - */ - public interface State { - /** enabled. */ - String ENABLED = "enabled"; - /** monitor. */ - String MONITOR = "monitor"; - /** limited. */ - String LIMITED = "limited"; - } - - protected String state; - @SerializedName("external_allowed_accounts") - protected List externalAllowedAccounts; - - /** - * Builder. - */ - public static class Builder { - private String state; - private List externalAllowedAccounts; - - /** - * Instantiates a new Builder from an existing IdentityTypesBase instance. - * - * @param identityTypesBase the instance to initialize the Builder with - */ - private Builder(IdentityTypesBase identityTypesBase) { - this.state = identityTypesBase.state; - this.externalAllowedAccounts = identityTypesBase.externalAllowedAccounts; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param state the state - * @param externalAllowedAccounts the externalAllowedAccounts - */ - public Builder(String state, List externalAllowedAccounts) { - this.state = state; - this.externalAllowedAccounts = externalAllowedAccounts; - } - - /** - * Builds a IdentityTypesBase. - * - * @return the new IdentityTypesBase instance - */ - public IdentityTypesBase build() { - return new IdentityTypesBase(this); - } - - /** - * Adds a new element to externalAllowedAccounts. - * - * @param externalAllowedAccounts the new element to be added - * @return the IdentityTypesBase builder - */ - public Builder addExternalAllowedAccounts(String externalAllowedAccounts) { - com.ibm.cloud.sdk.core.util.Validator.notNull(externalAllowedAccounts, - "externalAllowedAccounts cannot be null"); - if (this.externalAllowedAccounts == null) { - this.externalAllowedAccounts = new ArrayList(); - } - this.externalAllowedAccounts.add(externalAllowedAccounts); - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the IdentityTypesBase builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the externalAllowedAccounts. - * Existing externalAllowedAccounts will be replaced. - * - * @param externalAllowedAccounts the externalAllowedAccounts - * @return the IdentityTypesBase builder - */ - public Builder externalAllowedAccounts(List externalAllowedAccounts) { - this.externalAllowedAccounts = externalAllowedAccounts; - return this; - } - } - - protected IdentityTypesBase() { } - - protected IdentityTypesBase(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.state, - "state cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.externalAllowedAccounts, - "externalAllowedAccounts cannot be null"); - state = builder.state; - externalAllowedAccounts = builder.externalAllowedAccounts; - } - - /** - * New builder. - * - * @return a IdentityTypesBase builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the state. - * - * The state of the identity type. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the externalAllowedAccounts. - * - * List of accounts that the state applies to for a given identity. - * - * @return the externalAllowedAccounts - */ - public List externalAllowedAccounts() { - return externalAllowedAccounts; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java deleted file mode 100644 index 77aa5a26366..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The settings to apply for each identity type for a request. - */ -public class IdentityTypesPatch extends GenericModel { - - protected IdentityTypesBase user; - @SerializedName("service_id") - protected IdentityTypesBase serviceId; - protected IdentityTypesBase service; - - /** - * Builder. - */ - public static class Builder { - private IdentityTypesBase user; - private IdentityTypesBase serviceId; - private IdentityTypesBase service; - - /** - * Instantiates a new Builder from an existing IdentityTypesPatch instance. - * - * @param identityTypesPatch the instance to initialize the Builder with - */ - private Builder(IdentityTypesPatch identityTypesPatch) { - this.user = identityTypesPatch.user; - this.serviceId = identityTypesPatch.serviceId; - this.service = identityTypesPatch.service; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a IdentityTypesPatch. - * - * @return the new IdentityTypesPatch instance - */ - public IdentityTypesPatch build() { - return new IdentityTypesPatch(this); - } - - /** - * Set the user. - * - * @param user the user - * @return the IdentityTypesPatch builder - */ - public Builder user(IdentityTypesBase user) { - this.user = user; - return this; - } - - /** - * Set the serviceId. - * - * @param serviceId the serviceId - * @return the IdentityTypesPatch builder - */ - public Builder serviceId(IdentityTypesBase serviceId) { - this.serviceId = serviceId; - return this; - } - - /** - * Set the service. - * - * @param service the service - * @return the IdentityTypesPatch builder - */ - public Builder service(IdentityTypesBase service) { - this.service = service; - return this; - } - } - - protected IdentityTypesPatch() { } - - protected IdentityTypesPatch(Builder builder) { - user = builder.user; - serviceId = builder.serviceId; - service = builder.service; - } - - /** - * New builder. - * - * @return a IdentityTypesPatch builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the user. - * - * The core set of properties associated with an identity type. - * - * @return the user - */ - public IdentityTypesBase user() { - return user; - } - - /** - * Gets the serviceId. - * - * The core set of properties associated with an identity type. - * - * @return the serviceId - */ - public IdentityTypesBase serviceId() { - return serviceId; - } - - /** - * Gets the service. - * - * The core set of properties associated with an identity type. - * - * @return the service - */ - public IdentityTypesBase service() { - return service; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java deleted file mode 100644 index 5aa0b39573b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * policy template current and limit details with in an account. - */ -public class LimitData extends GenericModel { - - protected Long current; - protected Long limit; - - protected LimitData() { } - - /** - * Gets the current. - * - * policy template current count. - * - * @return the current - */ - public Long getCurrent() { - return current; - } - - /** - * Gets the limit. - * - * policy template limit count. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java deleted file mode 100644 index 6835f5afccc..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listActionControlAssignments options. - */ -public class ListActionControlAssignmentsOptions extends GenericModel { - - protected String accountId; - protected String acceptLanguage; - protected String templateId; - protected String templateVersion; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String templateId; - private String templateVersion; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListActionControlAssignmentsOptions instance. - * - * @param listActionControlAssignmentsOptions the instance to initialize the Builder with - */ - private Builder(ListActionControlAssignmentsOptions listActionControlAssignmentsOptions) { - this.accountId = listActionControlAssignmentsOptions.accountId; - this.acceptLanguage = listActionControlAssignmentsOptions.acceptLanguage; - this.templateId = listActionControlAssignmentsOptions.templateId; - this.templateVersion = listActionControlAssignmentsOptions.templateVersion; - this.limit = listActionControlAssignmentsOptions.limit; - this.start = listActionControlAssignmentsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListActionControlAssignmentsOptions. - * - * @return the new ListActionControlAssignmentsOptions instance - */ - public ListActionControlAssignmentsOptions build() { - return new ListActionControlAssignmentsOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the templateId. - * - * @param templateId the templateId - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder templateId(String templateId) { - this.templateId = templateId; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListActionControlAssignmentsOptions() { } - - protected ListActionControlAssignmentsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - templateId = builder.templateId; - templateVersion = builder.templateVersion; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListActionControlAssignmentsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID in which the action control assignment belongs to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the templateId. - * - * Optional template ID. - * - * @return the templateId - */ - public String templateId() { - return templateId; - } - - /** - * Gets the templateVersion. - * - * Optional action control template version. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java deleted file mode 100644 index 984d1060c83..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listActionControlTemplateVersions options. - */ -public class ListActionControlTemplateVersionsOptions extends GenericModel { - - /** - * Action control template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String actionControlTemplateId; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListActionControlTemplateVersionsOptions instance. - * - * @param listActionControlTemplateVersionsOptions the instance to initialize the Builder with - */ - private Builder(ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions) { - this.actionControlTemplateId = listActionControlTemplateVersionsOptions.actionControlTemplateId; - this.state = listActionControlTemplateVersionsOptions.state; - this.limit = listActionControlTemplateVersionsOptions.limit; - this.start = listActionControlTemplateVersionsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - */ - public Builder(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - } - - /** - * Builds a ListActionControlTemplateVersionsOptions. - * - * @return the new ListActionControlTemplateVersionsOptions instance - */ - public ListActionControlTemplateVersionsOptions build() { - return new ListActionControlTemplateVersionsOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the ListActionControlTemplateVersionsOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListActionControlTemplateVersionsOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListActionControlTemplateVersionsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListActionControlTemplateVersionsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListActionControlTemplateVersionsOptions() { } - - protected ListActionControlTemplateVersionsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListActionControlTemplateVersionsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * The action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the state. - * - * Action control template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java deleted file mode 100644 index d019db6119f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listActionControlTemplates options. - */ -public class ListActionControlTemplatesOptions extends GenericModel { - - protected String accountId; - protected String acceptLanguage; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListActionControlTemplatesOptions instance. - * - * @param listActionControlTemplatesOptions the instance to initialize the Builder with - */ - private Builder(ListActionControlTemplatesOptions listActionControlTemplatesOptions) { - this.accountId = listActionControlTemplatesOptions.accountId; - this.acceptLanguage = listActionControlTemplatesOptions.acceptLanguage; - this.limit = listActionControlTemplatesOptions.limit; - this.start = listActionControlTemplatesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListActionControlTemplatesOptions. - * - * @return the new ListActionControlTemplatesOptions instance - */ - public ListActionControlTemplatesOptions build() { - return new ListActionControlTemplatesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListActionControlTemplatesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListActionControlTemplatesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListActionControlTemplatesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListActionControlTemplatesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListActionControlTemplatesOptions() { } - - protected ListActionControlTemplatesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListActionControlTemplatesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the action control templates belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java deleted file mode 100644 index 90ecb352c37..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java +++ /dev/null @@ -1,501 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listPolicies options. - */ -public class ListPoliciesOptions extends GenericModel { - - /** - * Optional type of policy. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - /** - * Optional type of service. - */ - public interface ServiceType { - /** service. */ - String SERVICE = "service"; - /** platform_service. */ - String PLATFORM_SERVICE = "platform_service"; - } - - /** - * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending - * '-' to field. Example '-last_modified_at'. - */ - public interface Sort { - /** id. */ - String ID = "id"; - /** type. */ - String TYPE = "type"; - /** href. */ - String HREF = "href"; - /** created_at. */ - String CREATED_AT = "created_at"; - /** created_by_id. */ - String CREATED_BY_ID = "created_by_id"; - /** last_modified_at. */ - String LAST_MODIFIED_AT = "last_modified_at"; - /** last_modified_by_id. */ - String LAST_MODIFIED_BY_ID = "last_modified_by_id"; - /** state. */ - String STATE = "state"; - } - - /** - * Include additional data per policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles. - */ - public interface Format { - /** include_last_permit. */ - String INCLUDE_LAST_PERMIT = "include_last_permit"; - /** display. */ - String DISPLAY = "display"; - } - - /** - * The state of the policy. - * * `active` - returns active policies - * * `deleted` - returns non-active policies. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String accountId; - protected String acceptLanguage; - protected String iamId; - protected String accessGroupId; - protected String type; - protected String serviceType; - protected String tagName; - protected String tagValue; - protected String sort; - protected String format; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String iamId; - private String accessGroupId; - private String type; - private String serviceType; - private String tagName; - private String tagValue; - private String sort; - private String format; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListPoliciesOptions instance. - * - * @param listPoliciesOptions the instance to initialize the Builder with - */ - private Builder(ListPoliciesOptions listPoliciesOptions) { - this.accountId = listPoliciesOptions.accountId; - this.acceptLanguage = listPoliciesOptions.acceptLanguage; - this.iamId = listPoliciesOptions.iamId; - this.accessGroupId = listPoliciesOptions.accessGroupId; - this.type = listPoliciesOptions.type; - this.serviceType = listPoliciesOptions.serviceType; - this.tagName = listPoliciesOptions.tagName; - this.tagValue = listPoliciesOptions.tagValue; - this.sort = listPoliciesOptions.sort; - this.format = listPoliciesOptions.format; - this.state = listPoliciesOptions.state; - this.limit = listPoliciesOptions.limit; - this.start = listPoliciesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListPoliciesOptions. - * - * @return the new ListPoliciesOptions instance - */ - public ListPoliciesOptions build() { - return new ListPoliciesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListPoliciesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListPoliciesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the iamId. - * - * @param iamId the iamId - * @return the ListPoliciesOptions builder - */ - public Builder iamId(String iamId) { - this.iamId = iamId; - return this; - } - - /** - * Set the accessGroupId. - * - * @param accessGroupId the accessGroupId - * @return the ListPoliciesOptions builder - */ - public Builder accessGroupId(String accessGroupId) { - this.accessGroupId = accessGroupId; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the ListPoliciesOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the serviceType. - * - * @param serviceType the serviceType - * @return the ListPoliciesOptions builder - */ - public Builder serviceType(String serviceType) { - this.serviceType = serviceType; - return this; - } - - /** - * Set the tagName. - * - * @param tagName the tagName - * @return the ListPoliciesOptions builder - */ - public Builder tagName(String tagName) { - this.tagName = tagName; - return this; - } - - /** - * Set the tagValue. - * - * @param tagValue the tagValue - * @return the ListPoliciesOptions builder - */ - public Builder tagValue(String tagValue) { - this.tagValue = tagValue; - return this; - } - - /** - * Set the sort. - * - * @param sort the sort - * @return the ListPoliciesOptions builder - */ - public Builder sort(String sort) { - this.sort = sort; - return this; - } - - /** - * Set the format. - * - * @param format the format - * @return the ListPoliciesOptions builder - */ - public Builder format(String format) { - this.format = format; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListPoliciesOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListPoliciesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListPoliciesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListPoliciesOptions() { } - - protected ListPoliciesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - iamId = builder.iamId; - accessGroupId = builder.accessGroupId; - type = builder.type; - serviceType = builder.serviceType; - tagName = builder.tagName; - tagValue = builder.tagValue; - sort = builder.sort; - format = builder.format; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListPoliciesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the policies belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the iamId. - * - * Optional IAM ID used to identify the subject. - * - * @return the iamId - */ - public String iamId() { - return iamId; - } - - /** - * Gets the accessGroupId. - * - * Optional access group id. - * - * @return the accessGroupId - */ - public String accessGroupId() { - return accessGroupId; - } - - /** - * Gets the type. - * - * Optional type of policy. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the serviceType. - * - * Optional type of service. - * - * @return the serviceType - */ - public String serviceType() { - return serviceType; - } - - /** - * Gets the tagName. - * - * Optional name of the access tag in the policy. - * - * @return the tagName - */ - public String tagName() { - return tagName; - } - - /** - * Gets the tagValue. - * - * Optional value of the access tag in the policy. - * - * @return the tagValue - */ - public String tagValue() { - return tagValue; - } - - /** - * Gets the sort. - * - * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending - * '-' to field. Example '-last_modified_at'. - * - * @return the sort - */ - public String sort() { - return sort; - } - - /** - * Gets the format. - * - * Include additional data per policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles. - * - * @return the format - */ - public String format() { - return format; - } - - /** - * Gets the state. - * - * The state of the policy. - * * `active` - returns active policies - * * `deleted` - returns non-active policies. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java deleted file mode 100644 index 9362749c670..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java +++ /dev/null @@ -1,275 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listPolicyAssignments options. - */ -public class ListPolicyAssignmentsOptions extends GenericModel { - - protected String version; - protected String accountId; - protected String acceptLanguage; - protected String templateId; - protected String templateVersion; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String version; - private String accountId; - private String acceptLanguage; - private String templateId; - private String templateVersion; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListPolicyAssignmentsOptions instance. - * - * @param listPolicyAssignmentsOptions the instance to initialize the Builder with - */ - private Builder(ListPolicyAssignmentsOptions listPolicyAssignmentsOptions) { - this.version = listPolicyAssignmentsOptions.version; - this.accountId = listPolicyAssignmentsOptions.accountId; - this.acceptLanguage = listPolicyAssignmentsOptions.acceptLanguage; - this.templateId = listPolicyAssignmentsOptions.templateId; - this.templateVersion = listPolicyAssignmentsOptions.templateVersion; - this.limit = listPolicyAssignmentsOptions.limit; - this.start = listPolicyAssignmentsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param version the version - * @param accountId the accountId - */ - public Builder(String version, String accountId) { - this.version = version; - this.accountId = accountId; - } - - /** - * Builds a ListPolicyAssignmentsOptions. - * - * @return the new ListPolicyAssignmentsOptions instance - */ - public ListPolicyAssignmentsOptions build() { - return new ListPolicyAssignmentsOptions(this); - } - - /** - * Set the version. - * - * @param version the version - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the templateId. - * - * @param templateId the templateId - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder templateId(String templateId) { - this.templateId = templateId; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListPolicyAssignmentsOptions() { } - - protected ListPolicyAssignmentsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - version = builder.version; - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - templateId = builder.templateId; - templateVersion = builder.templateVersion; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListPolicyAssignmentsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the version. - * - * specify version of response body format. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the accountId. - * - * The account GUID in which the policies belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the templateId. - * - * Optional template id. - * - * @return the templateId - */ - public String templateId() { - return templateId; - } - - /** - * Gets the templateVersion. - * - * Optional policy template version. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java deleted file mode 100644 index c7965ba6c31..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listPolicyTemplateVersions options. - */ -public class ListPolicyTemplateVersionsOptions extends GenericModel { - - /** - * The policy template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String policyTemplateId; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListPolicyTemplateVersionsOptions instance. - * - * @param listPolicyTemplateVersionsOptions the instance to initialize the Builder with - */ - private Builder(ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions) { - this.policyTemplateId = listPolicyTemplateVersionsOptions.policyTemplateId; - this.state = listPolicyTemplateVersionsOptions.state; - this.limit = listPolicyTemplateVersionsOptions.limit; - this.start = listPolicyTemplateVersionsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - */ - public Builder(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - } - - /** - * Builds a ListPolicyTemplateVersionsOptions. - * - * @return the new ListPolicyTemplateVersionsOptions instance - */ - public ListPolicyTemplateVersionsOptions build() { - return new ListPolicyTemplateVersionsOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the ListPolicyTemplateVersionsOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListPolicyTemplateVersionsOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListPolicyTemplateVersionsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListPolicyTemplateVersionsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListPolicyTemplateVersionsOptions() { } - - protected ListPolicyTemplateVersionsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - policyTemplateId = builder.policyTemplateId; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListPolicyTemplateVersionsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the state. - * - * The policy template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java deleted file mode 100644 index f230c9bd549..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java +++ /dev/null @@ -1,379 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listPolicyTemplates options. - */ -public class ListPolicyTemplatesOptions extends GenericModel { - - /** - * The policy template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - /** - * Service type, Optional. - */ - public interface PolicyServiceType { - /** service. */ - String SERVICE = "service"; - /** platform_service. */ - String PLATFORM_SERVICE = "platform_service"; - } - - /** - * Policy type, Optional. - */ - public interface PolicyType { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - protected String accountId; - protected String acceptLanguage; - protected String state; - protected String name; - protected String policyServiceType; - protected String policyServiceName; - protected String policyServiceGroupId; - protected String policyType; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String state; - private String name; - private String policyServiceType; - private String policyServiceName; - private String policyServiceGroupId; - private String policyType; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListPolicyTemplatesOptions instance. - * - * @param listPolicyTemplatesOptions the instance to initialize the Builder with - */ - private Builder(ListPolicyTemplatesOptions listPolicyTemplatesOptions) { - this.accountId = listPolicyTemplatesOptions.accountId; - this.acceptLanguage = listPolicyTemplatesOptions.acceptLanguage; - this.state = listPolicyTemplatesOptions.state; - this.name = listPolicyTemplatesOptions.name; - this.policyServiceType = listPolicyTemplatesOptions.policyServiceType; - this.policyServiceName = listPolicyTemplatesOptions.policyServiceName; - this.policyServiceGroupId = listPolicyTemplatesOptions.policyServiceGroupId; - this.policyType = listPolicyTemplatesOptions.policyType; - this.limit = listPolicyTemplatesOptions.limit; - this.start = listPolicyTemplatesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListPolicyTemplatesOptions. - * - * @return the new ListPolicyTemplatesOptions instance - */ - public ListPolicyTemplatesOptions build() { - return new ListPolicyTemplatesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListPolicyTemplatesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListPolicyTemplatesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListPolicyTemplatesOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ListPolicyTemplatesOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the policyServiceType. - * - * @param policyServiceType the policyServiceType - * @return the ListPolicyTemplatesOptions builder - */ - public Builder policyServiceType(String policyServiceType) { - this.policyServiceType = policyServiceType; - return this; - } - - /** - * Set the policyServiceName. - * - * @param policyServiceName the policyServiceName - * @return the ListPolicyTemplatesOptions builder - */ - public Builder policyServiceName(String policyServiceName) { - this.policyServiceName = policyServiceName; - return this; - } - - /** - * Set the policyServiceGroupId. - * - * @param policyServiceGroupId the policyServiceGroupId - * @return the ListPolicyTemplatesOptions builder - */ - public Builder policyServiceGroupId(String policyServiceGroupId) { - this.policyServiceGroupId = policyServiceGroupId; - return this; - } - - /** - * Set the policyType. - * - * @param policyType the policyType - * @return the ListPolicyTemplatesOptions builder - */ - public Builder policyType(String policyType) { - this.policyType = policyType; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListPolicyTemplatesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListPolicyTemplatesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListPolicyTemplatesOptions() { } - - protected ListPolicyTemplatesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - state = builder.state; - name = builder.name; - policyServiceType = builder.policyServiceType; - policyServiceName = builder.policyServiceName; - policyServiceGroupId = builder.policyServiceGroupId; - policyType = builder.policyType; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListPolicyTemplatesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the policy templates belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the state. - * - * The policy template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the name. - * - * The policy template name. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the policyServiceType. - * - * Service type, Optional. - * - * @return the policyServiceType - */ - public String policyServiceType() { - return policyServiceType; - } - - /** - * Gets the policyServiceName. - * - * Service name, Optional. - * - * @return the policyServiceName - */ - public String policyServiceName() { - return policyServiceName; - } - - /** - * Gets the policyServiceGroupId. - * - * Service group id, Optional. - * - * @return the policyServiceGroupId - */ - public String policyServiceGroupId() { - return policyServiceGroupId; - } - - /** - * Gets the policyType. - * - * Policy type, Optional. - * - * @return the policyType - */ - public String policyType() { - return policyType; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java deleted file mode 100644 index adcb3f0cc90..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listRoleAssignments options. - */ -public class ListRoleAssignmentsOptions extends GenericModel { - - protected String accountId; - protected String acceptLanguage; - protected String templateId; - protected String templateVersion; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String templateId; - private String templateVersion; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListRoleAssignmentsOptions instance. - * - * @param listRoleAssignmentsOptions the instance to initialize the Builder with - */ - private Builder(ListRoleAssignmentsOptions listRoleAssignmentsOptions) { - this.accountId = listRoleAssignmentsOptions.accountId; - this.acceptLanguage = listRoleAssignmentsOptions.acceptLanguage; - this.templateId = listRoleAssignmentsOptions.templateId; - this.templateVersion = listRoleAssignmentsOptions.templateVersion; - this.limit = listRoleAssignmentsOptions.limit; - this.start = listRoleAssignmentsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListRoleAssignmentsOptions. - * - * @return the new ListRoleAssignmentsOptions instance - */ - public ListRoleAssignmentsOptions build() { - return new ListRoleAssignmentsOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListRoleAssignmentsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListRoleAssignmentsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the templateId. - * - * @param templateId the templateId - * @return the ListRoleAssignmentsOptions builder - */ - public Builder templateId(String templateId) { - this.templateId = templateId; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the ListRoleAssignmentsOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListRoleAssignmentsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListRoleAssignmentsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListRoleAssignmentsOptions() { } - - protected ListRoleAssignmentsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - templateId = builder.templateId; - templateVersion = builder.templateVersion; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListRoleAssignmentsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID in which the role assignment belongs to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the templateId. - * - * Optional template ID. - * - * @return the templateId - */ - public String templateId() { - return templateId; - } - - /** - * Gets the templateVersion. - * - * Optional role template version. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java deleted file mode 100644 index e22751433e5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listRoleTemplateVersions options. - */ -public class ListRoleTemplateVersionsOptions extends GenericModel { - - /** - * Role template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String roleTemplateId; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListRoleTemplateVersionsOptions instance. - * - * @param listRoleTemplateVersionsOptions the instance to initialize the Builder with - */ - private Builder(ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions) { - this.roleTemplateId = listRoleTemplateVersionsOptions.roleTemplateId; - this.state = listRoleTemplateVersionsOptions.state; - this.limit = listRoleTemplateVersionsOptions.limit; - this.start = listRoleTemplateVersionsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - */ - public Builder(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - } - - /** - * Builds a ListRoleTemplateVersionsOptions. - * - * @return the new ListRoleTemplateVersionsOptions instance - */ - public ListRoleTemplateVersionsOptions build() { - return new ListRoleTemplateVersionsOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the ListRoleTemplateVersionsOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListRoleTemplateVersionsOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListRoleTemplateVersionsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListRoleTemplateVersionsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListRoleTemplateVersionsOptions() { } - - protected ListRoleTemplateVersionsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - roleTemplateId = builder.roleTemplateId; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListRoleTemplateVersionsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * The role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the state. - * - * Role template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java deleted file mode 100644 index 8f889bdce96..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java +++ /dev/null @@ -1,307 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listRoleTemplates options. - */ -public class ListRoleTemplatesOptions extends GenericModel { - - /** - * The role template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String accountId; - protected String acceptLanguage; - protected String name; - protected String roleName; - protected String roleServiceName; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String name; - private String roleName; - private String roleServiceName; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListRoleTemplatesOptions instance. - * - * @param listRoleTemplatesOptions the instance to initialize the Builder with - */ - private Builder(ListRoleTemplatesOptions listRoleTemplatesOptions) { - this.accountId = listRoleTemplatesOptions.accountId; - this.acceptLanguage = listRoleTemplatesOptions.acceptLanguage; - this.name = listRoleTemplatesOptions.name; - this.roleName = listRoleTemplatesOptions.roleName; - this.roleServiceName = listRoleTemplatesOptions.roleServiceName; - this.state = listRoleTemplatesOptions.state; - this.limit = listRoleTemplatesOptions.limit; - this.start = listRoleTemplatesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListRoleTemplatesOptions. - * - * @return the new ListRoleTemplatesOptions instance - */ - public ListRoleTemplatesOptions build() { - return new ListRoleTemplatesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListRoleTemplatesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListRoleTemplatesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ListRoleTemplatesOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the roleName. - * - * @param roleName the roleName - * @return the ListRoleTemplatesOptions builder - */ - public Builder roleName(String roleName) { - this.roleName = roleName; - return this; - } - - /** - * Set the roleServiceName. - * - * @param roleServiceName the roleServiceName - * @return the ListRoleTemplatesOptions builder - */ - public Builder roleServiceName(String roleServiceName) { - this.roleServiceName = roleServiceName; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListRoleTemplatesOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListRoleTemplatesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListRoleTemplatesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListRoleTemplatesOptions() { } - - protected ListRoleTemplatesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - name = builder.name; - roleName = builder.roleName; - roleServiceName = builder.roleServiceName; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListRoleTemplatesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the role templates belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the name. - * - * The role template name. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the roleName. - * - * The template role name. - * - * @return the roleName - */ - public String roleName() { - return roleName; - } - - /** - * Gets the roleServiceName. - * - * The template role service name. - * - * @return the roleServiceName - */ - public String roleServiceName() { - return roleServiceName; - } - - /** - * Gets the state. - * - * The role template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java deleted file mode 100644 index 2ca364c53a3..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listRoles options. - */ -public class ListRolesOptions extends GenericModel { - - protected String acceptLanguage; - protected String accountId; - protected String serviceName; - protected String sourceServiceName; - protected String policyType; - protected String serviceGroupId; - - /** - * Builder. - */ - public static class Builder { - private String acceptLanguage; - private String accountId; - private String serviceName; - private String sourceServiceName; - private String policyType; - private String serviceGroupId; - - /** - * Instantiates a new Builder from an existing ListRolesOptions instance. - * - * @param listRolesOptions the instance to initialize the Builder with - */ - private Builder(ListRolesOptions listRolesOptions) { - this.acceptLanguage = listRolesOptions.acceptLanguage; - this.accountId = listRolesOptions.accountId; - this.serviceName = listRolesOptions.serviceName; - this.sourceServiceName = listRolesOptions.sourceServiceName; - this.policyType = listRolesOptions.policyType; - this.serviceGroupId = listRolesOptions.serviceGroupId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a ListRolesOptions. - * - * @return the new ListRolesOptions instance - */ - public ListRolesOptions build() { - return new ListRolesOptions(this); - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListRolesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListRolesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the ListRolesOptions builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the sourceServiceName. - * - * @param sourceServiceName the sourceServiceName - * @return the ListRolesOptions builder - */ - public Builder sourceServiceName(String sourceServiceName) { - this.sourceServiceName = sourceServiceName; - return this; - } - - /** - * Set the policyType. - * - * @param policyType the policyType - * @return the ListRolesOptions builder - */ - public Builder policyType(String policyType) { - this.policyType = policyType; - return this; - } - - /** - * Set the serviceGroupId. - * - * @param serviceGroupId the serviceGroupId - * @return the ListRolesOptions builder - */ - public Builder serviceGroupId(String serviceGroupId) { - this.serviceGroupId = serviceGroupId; - return this; - } - } - - protected ListRolesOptions() { } - - protected ListRolesOptions(Builder builder) { - acceptLanguage = builder.acceptLanguage; - accountId = builder.accountId; - serviceName = builder.serviceName; - sourceServiceName = builder.sourceServiceName; - policyType = builder.policyType; - serviceGroupId = builder.serviceGroupId; - } - - /** - * New builder. - * - * @return a ListRolesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the accountId. - * - * Optional account GUID in which the roles belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the serviceName. - * - * Optional name of IAM enabled service. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the sourceServiceName. - * - * Optional name of source IAM enabled service. - * - * @return the sourceServiceName - */ - public String sourceServiceName() { - return sourceServiceName; - } - - /** - * Gets the policyType. - * - * Optional Policy Type. - * - * @return the policyType - */ - public String policyType() { - return policyType; - } - - /** - * Gets the serviceGroupId. - * - * Optional id of service group. - * - * @return the serviceGroupId - */ - public String serviceGroupId() { - return serviceGroupId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java deleted file mode 100644 index 65849c3d9a6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java +++ /dev/null @@ -1,492 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listV2Policies options. - */ -public class ListV2PoliciesOptions extends GenericModel { - - /** - * Optional type of policy. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - /** - * Optional type of service. - */ - public interface ServiceType { - /** service. */ - String SERVICE = "service"; - /** platform_service. */ - String PLATFORM_SERVICE = "platform_service"; - } - - /** - * Include additional data per policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles and translations for all - * relevant fields. - */ - public interface Format { - /** include_last_permit. */ - String INCLUDE_LAST_PERMIT = "include_last_permit"; - /** display. */ - String DISPLAY = "display"; - } - - /** - * The state of the policy. - * * `active` - returns active policies - * * `deleted` - returns non-active policies. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String accountId; - protected String acceptLanguage; - protected String iamId; - protected String accessGroupId; - protected String type; - protected String serviceType; - protected String serviceName; - protected String serviceGroupId; - protected String sort; - protected String format; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String iamId; - private String accessGroupId; - private String type; - private String serviceType; - private String serviceName; - private String serviceGroupId; - private String sort; - private String format; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListV2PoliciesOptions instance. - * - * @param listV2PoliciesOptions the instance to initialize the Builder with - */ - private Builder(ListV2PoliciesOptions listV2PoliciesOptions) { - this.accountId = listV2PoliciesOptions.accountId; - this.acceptLanguage = listV2PoliciesOptions.acceptLanguage; - this.iamId = listV2PoliciesOptions.iamId; - this.accessGroupId = listV2PoliciesOptions.accessGroupId; - this.type = listV2PoliciesOptions.type; - this.serviceType = listV2PoliciesOptions.serviceType; - this.serviceName = listV2PoliciesOptions.serviceName; - this.serviceGroupId = listV2PoliciesOptions.serviceGroupId; - this.sort = listV2PoliciesOptions.sort; - this.format = listV2PoliciesOptions.format; - this.state = listV2PoliciesOptions.state; - this.limit = listV2PoliciesOptions.limit; - this.start = listV2PoliciesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListV2PoliciesOptions. - * - * @return the new ListV2PoliciesOptions instance - */ - public ListV2PoliciesOptions build() { - return new ListV2PoliciesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListV2PoliciesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListV2PoliciesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the iamId. - * - * @param iamId the iamId - * @return the ListV2PoliciesOptions builder - */ - public Builder iamId(String iamId) { - this.iamId = iamId; - return this; - } - - /** - * Set the accessGroupId. - * - * @param accessGroupId the accessGroupId - * @return the ListV2PoliciesOptions builder - */ - public Builder accessGroupId(String accessGroupId) { - this.accessGroupId = accessGroupId; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the ListV2PoliciesOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the serviceType. - * - * @param serviceType the serviceType - * @return the ListV2PoliciesOptions builder - */ - public Builder serviceType(String serviceType) { - this.serviceType = serviceType; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the ListV2PoliciesOptions builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the serviceGroupId. - * - * @param serviceGroupId the serviceGroupId - * @return the ListV2PoliciesOptions builder - */ - public Builder serviceGroupId(String serviceGroupId) { - this.serviceGroupId = serviceGroupId; - return this; - } - - /** - * Set the sort. - * - * @param sort the sort - * @return the ListV2PoliciesOptions builder - */ - public Builder sort(String sort) { - this.sort = sort; - return this; - } - - /** - * Set the format. - * - * @param format the format - * @return the ListV2PoliciesOptions builder - */ - public Builder format(String format) { - this.format = format; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListV2PoliciesOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListV2PoliciesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListV2PoliciesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListV2PoliciesOptions() { } - - protected ListV2PoliciesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - iamId = builder.iamId; - accessGroupId = builder.accessGroupId; - type = builder.type; - serviceType = builder.serviceType; - serviceName = builder.serviceName; - serviceGroupId = builder.serviceGroupId; - sort = builder.sort; - format = builder.format; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListV2PoliciesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID in which the policies belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the iamId. - * - * Optional IAM ID used to identify the subject. - * - * @return the iamId - */ - public String iamId() { - return iamId; - } - - /** - * Gets the accessGroupId. - * - * Optional access group id. - * - * @return the accessGroupId - */ - public String accessGroupId() { - return accessGroupId; - } - - /** - * Gets the type. - * - * Optional type of policy. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the serviceType. - * - * Optional type of service. - * - * @return the serviceType - */ - public String serviceType() { - return serviceType; - } - - /** - * Gets the serviceName. - * - * Optional name of service. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the serviceGroupId. - * - * Optional ID of service group. - * - * @return the serviceGroupId - */ - public String serviceGroupId() { - return serviceGroupId; - } - - /** - * Gets the sort. - * - * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending - * '-' to field, for example, '-last_modified_at'. Note that last permit information is only included when - * 'format=include_last_permit', for example, "format=include_last_permit&sort=last_permit_at" Example fields that - * can be sorted on: - * - 'id' - * - 'type' - * - 'href' - * - 'created_at' - * - 'created_by_id' - * - 'last_modified_at' - * - 'last_modified_by_id' - * - 'state' - * - 'last_permit_at' - * - 'last_permit_frequency'. - * - * @return the sort - */ - public String sort() { - return sort; - } - - /** - * Gets the format. - * - * Include additional data per policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles and translations for all - * relevant fields. - * - * @return the format - */ - public String format() { - return format; - } - - /** - * Gets the state. - * - * The state of the policy. - * * `active` - returns active policies - * * `deleted` - returns non-active policies. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java deleted file mode 100644 index 4d43d84dbba..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Condition that specifies additional conditions or RuleAttribute to grant access. - * - * Classes which extend this class: - * - NestedConditionRuleAttribute - * - NestedConditionRuleWithConditions - */ -public class NestedCondition extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - protected String key; - protected String operator; - protected Object value; - protected List conditions; - - protected NestedCondition() { } - - /** - * Gets the key. - * - * The name of an attribute. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } - - /** - * Gets the conditions. - * - * List of conditions associated with a policy. For example, time-based conditions that grant access over a certain - * time period. - * - * @return the conditions - */ - public List conditions() { - return conditions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java deleted file mode 100644 index b1d44da3f6b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * Rule that specifies additional access that is granted (For example, time-based condition). - */ -public class NestedConditionRuleAttribute extends NestedCondition { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing NestedConditionRuleAttribute instance. - * - * @param nestedConditionRuleAttribute the instance to initialize the Builder with - */ - public Builder(NestedCondition nestedConditionRuleAttribute) { - this.key = nestedConditionRuleAttribute.key; - this.operator = nestedConditionRuleAttribute.operator; - this.value = nestedConditionRuleAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a NestedConditionRuleAttribute. - * - * @return the new NestedConditionRuleAttribute instance - */ - public NestedConditionRuleAttribute build() { - return new NestedConditionRuleAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the NestedConditionRuleAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the NestedConditionRuleAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the NestedConditionRuleAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected NestedConditionRuleAttribute() { } - - protected NestedConditionRuleAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a NestedConditionRuleAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java deleted file mode 100644 index 20d0faac795..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * Rule that specifies additional access that is granted (for example, time-based condition) accross multiple - * conditions. - */ -public class NestedConditionRuleWithConditions extends NestedCondition { - - /** - * Operator to evaluate conditions. - */ - public interface Operator { - /** and. */ - String AND = "and"; - /** or. */ - String OR = "or"; - } - - - /** - * Builder. - */ - public static class Builder { - private String operator; - private List conditions; - - /** - * Instantiates a new Builder from an existing NestedConditionRuleWithConditions instance. - * - * @param nestedConditionRuleWithConditions the instance to initialize the Builder with - */ - public Builder(NestedCondition nestedConditionRuleWithConditions) { - this.operator = nestedConditionRuleWithConditions.operator; - this.conditions = nestedConditionRuleWithConditions.conditions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param operator the operator - * @param conditions the conditions - */ - public Builder(String operator, List conditions) { - this.operator = operator; - this.conditions = conditions; - } - - /** - * Builds a NestedConditionRuleWithConditions. - * - * @return the new NestedConditionRuleWithConditions instance - */ - public NestedConditionRuleWithConditions build() { - return new NestedConditionRuleWithConditions(this); - } - - /** - * Adds a new element to conditions. - * - * @param conditions the new element to be added - * @return the NestedConditionRuleWithConditions builder - */ - public Builder addConditions(RuleAttribute conditions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(conditions, - "conditions cannot be null"); - if (this.conditions == null) { - this.conditions = new ArrayList(); - } - this.conditions.add(conditions); - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the NestedConditionRuleWithConditions builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the conditions. - * Existing conditions will be replaced. - * - * @param conditions the conditions - * @return the NestedConditionRuleWithConditions builder - */ - public Builder conditions(List conditions) { - this.conditions = conditions; - return this; - } - } - - protected NestedConditionRuleWithConditions() { } - - protected NestedConditionRuleWithConditions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.conditions, - "conditions cannot be null"); - operator = builder.operator; - conditions = builder.conditions; - } - - /** - * New builder. - * - * @return a NestedConditionRuleWithConditions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java deleted file mode 100644 index b0442f902bc..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Details with href linking to the following page of requested collection. - */ -public class Next extends GenericModel { - - protected String href; - protected String start; - - protected Next() { } - - /** - * Gets the href. - * - * The href linking to the page of requested collection. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection. - * - * @return the start - */ - public String getStart() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java deleted file mode 100644 index 8f12053c72e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * PoliciesPager can be used to simplify the use of the "listPolicies" method. - */ -public class PoliciesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListPoliciesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected PoliciesPager() { } - - /** - * Constructs a new PoliciesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listPolicies" method - * @param options the ListPoliciesOptions instance to be used to invoke the "listPolicies" method - */ - public PoliciesPager(IamPolicyManagement client, ListPoliciesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<PolicyTemplateMetaData> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListPoliciesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - PolicyCollection result = client.listPolicies(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getPolicies(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<PolicyTemplateMetaData> containing all results returned by the "listPolicies" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java deleted file mode 100644 index af852b7cd74..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with a policy. - */ -public class Policy extends GenericModel { - - /** - * The policy state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String id; - protected String type; - protected String description; - protected List subjects; - protected List roles; - protected List resources; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String state; - - protected Policy() { } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Gets the description. - * - * Customer-defined description. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the subjects. - * - * The subjects associated with a policy. - * - * @return the subjects - */ - public List getSubjects() { - return subjects; - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List getRoles() { - return roles; - } - - /** - * Gets the resources. - * - * The resources associated with a policy. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the href. - * - * The href links back to the policy. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the state. - * - * The policy state. - * - * @return the state - */ - public String getState() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java deleted file mode 100644 index 3e566ce7bdf..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Set of properties for the assigned resource. - */ -public class PolicyAssignmentResourcePolicy extends GenericModel { - - @SerializedName("resource_created") - protected AssignmentResourceCreated resourceCreated; - protected String status; - @SerializedName("error_message") - protected AssignmentResourceError errorMessage; - - protected PolicyAssignmentResourcePolicy() { } - - /** - * Gets the resourceCreated. - * - * On success, includes the policy that is assigned. - * - * @return the resourceCreated - */ - public AssignmentResourceCreated getResourceCreated() { - return resourceCreated; - } - - /** - * Gets the status. - * - * policy status. - * - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * Gets the errorMessage. - * - * Body parameters for assignment error. - * - * @return the errorMessage - */ - public AssignmentResourceError getErrorMessage() { - return errorMessage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java deleted file mode 100644 index ad944536b0d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The policy assignment resources. - */ -public class PolicyAssignmentResources extends GenericModel { - - protected String target; - protected PolicyAssignmentResourcePolicy policy; - - protected PolicyAssignmentResources() { } - - /** - * Gets the target. - * - * Account ID where resources are assigned. - * - * @return the target - */ - public String getTarget() { - return target; - } - - /** - * Gets the policy. - * - * Set of properties for the assigned resource. - * - * @return the policy - */ - public PolicyAssignmentResourcePolicy getPolicy() { - return policy; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java deleted file mode 100644 index f1ea295713c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the policy template assignment. - */ -public class PolicyAssignmentV1 extends GenericModel { - - /** - * The policy assignment status. - */ - public interface Status { - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** succeeded. */ - String SUCCEEDED = "succeeded"; - /** succeed_with_errors. */ - String SUCCEED_WITH_ERRORS = "succeed_with_errors"; - /** failed. */ - String FAILED = "failed"; - } - - protected AssignmentTargetDetails target; - protected String id; - @SerializedName("account_id") - protected String accountId; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected List resources; - protected PolicyAssignmentV1Subject subject; - protected AssignmentTemplateDetails template; - protected String status; - - protected PolicyAssignmentV1() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the id. - * - * Policy assignment ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the accountId. - * - * The account GUID that the policies assignments belong to. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the href. - * - * The href URL that links to the policies assignments API by policy assignment ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy assignment was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy assignment. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy assignment was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy assignment. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the resources. - * - * Object for each account assigned. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the subject. - * - * Subject details of access type assignment. - * - * @return the subject - */ - public PolicyAssignmentV1Subject getSubject() { - return subject; - } - - /** - * Gets the template. - * - * policy template details. - * - * @return the template - */ - public AssignmentTemplateDetails getTemplate() { - return template; - } - - /** - * Gets the status. - * - * The policy assignment status. - * - * @return the status - */ - public String getStatus() { - return status; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java deleted file mode 100644 index 7331ee5a854..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Policy assignment response. - */ -public class PolicyAssignmentV1Collection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List assignments; - - protected PolicyAssignmentV1Collection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the assignments. - * - * Response of policy assignments. - * - * @return the assignments - */ - public List getAssignments() { - return assignments; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java deleted file mode 100644 index c05eb90816b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The policy assignment resources. - */ -public class PolicyAssignmentV1Resources extends GenericModel { - - protected AssignmentTargetDetails target; - protected PolicyAssignmentResourcePolicy policy; - - protected PolicyAssignmentV1Resources() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the policy. - * - * Set of properties for the assigned resource. - * - * @return the policy - */ - public PolicyAssignmentResourcePolicy getPolicy() { - return policy; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java deleted file mode 100644 index 58b2cd240ba..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Subject details of access type assignment. - */ -public class PolicyAssignmentV1Subject extends GenericModel { - - /** - * The identity type of the subject of the assignment. - */ - public interface Type { - /** iam_id. */ - String IAM_ID = "iam_id"; - /** access_group_id. */ - String ACCESS_GROUP_ID = "access_group_id"; - } - - protected String id; - protected String type; - - protected PolicyAssignmentV1Subject() { } - - /** - * Gets the id. - * - * The unique identifier of the subject of the assignment. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the type. - * - * The identity type of the subject of the assignment. - * - * @return the type - */ - public String getType() { - return type; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java deleted file mode 100644 index 931769daed5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * PolicyAssignmentsPager can be used to simplify the use of the "listPolicyAssignments" method. - */ -public class PolicyAssignmentsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListPolicyAssignmentsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected PolicyAssignmentsPager() { } - - /** - * Constructs a new PolicyAssignmentsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyAssignments" method - * @param options the ListPolicyAssignmentsOptions instance to be used to invoke the "listPolicyAssignments" method - */ - public PolicyAssignmentsPager(IamPolicyManagement client, ListPolicyAssignmentsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<PolicyTemplateAssignmentItems> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListPolicyAssignmentsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - PolicyTemplateAssignmentCollection result = client.listPolicyAssignments(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getAssignments(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<PolicyTemplateAssignmentItems> containing all results returned by the "listPolicyAssignments" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java deleted file mode 100644 index 25062dd0a52..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of policies. - */ -public class PolicyCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List policies; - - protected PolicyCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the policies. - * - * List of policies. - * - * @return the policies - */ - public List getPolicies() { - return policies; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java deleted file mode 100644 index 4033f2dbc9d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The attributes of the resource. Note that only one resource is allowed in a policy. - */ -public class PolicyResource extends GenericModel { - - protected List attributes; - protected List tags; - - /** - * Builder. - */ - public static class Builder { - private List attributes; - private List tags; - - /** - * Instantiates a new Builder from an existing PolicyResource instance. - * - * @param policyResource the instance to initialize the Builder with - */ - private Builder(PolicyResource policyResource) { - this.attributes = policyResource.attributes; - this.tags = policyResource.tags; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param attributes the attributes - */ - public Builder(List attributes) { - this.attributes = attributes; - } - - /** - * Builds a PolicyResource. - * - * @return the new PolicyResource instance - */ - public PolicyResource build() { - return new PolicyResource(this); - } - - /** - * Adds a new element to attributes. - * - * @param attributes the new element to be added - * @return the PolicyResource builder - */ - public Builder addAttributes(ResourceAttribute attributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, - "attributes cannot be null"); - if (this.attributes == null) { - this.attributes = new ArrayList(); - } - this.attributes.add(attributes); - return this; - } - - /** - * Adds a new element to tags. - * - * @param tags the new element to be added - * @return the PolicyResource builder - */ - public Builder addTags(ResourceTag tags) { - com.ibm.cloud.sdk.core.util.Validator.notNull(tags, - "tags cannot be null"); - if (this.tags == null) { - this.tags = new ArrayList(); - } - this.tags.add(tags); - return this; - } - - /** - * Set the attributes. - * Existing attributes will be replaced. - * - * @param attributes the attributes - * @return the PolicyResource builder - */ - public Builder attributes(List attributes) { - this.attributes = attributes; - return this; - } - - /** - * Set the tags. - * Existing tags will be replaced. - * - * @param tags the tags - * @return the PolicyResource builder - */ - public Builder tags(List tags) { - this.tags = tags; - return this; - } - } - - protected PolicyResource() { } - - protected PolicyResource(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, - "attributes cannot be null"); - attributes = builder.attributes; - tags = builder.tags; - } - - /** - * New builder. - * - * @return a PolicyResource builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the attributes. - * - * List of resource attributes. - * - * @return the attributes - */ - public List attributes() { - return attributes; - } - - /** - * Gets the tags. - * - * List of access management tags. - * - * @return the tags - */ - public List tags() { - return tags; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java deleted file mode 100644 index 7319eabce7b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role associated with a policy. - */ -public class PolicyRole extends GenericModel { - - @SerializedName("role_id") - protected String roleId; - @SerializedName("display_name") - protected String displayName; - protected String description; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - - /** - * Instantiates a new Builder from an existing PolicyRole instance. - * - * @param policyRole the instance to initialize the Builder with - */ - private Builder(PolicyRole policyRole) { - this.roleId = policyRole.roleId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - */ - public Builder(String roleId) { - this.roleId = roleId; - } - - /** - * Builds a PolicyRole. - * - * @return the new PolicyRole instance - */ - public PolicyRole build() { - return new PolicyRole(this); - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the PolicyRole builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - } - - protected PolicyRole() { } - - protected PolicyRole(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleId, - "roleId cannot be null"); - roleId = builder.roleId; - } - - /** - * New builder. - * - * @return a PolicyRole builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } - - /** - * Gets the displayName. - * - * The display name of the role. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String description() { - return description; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java deleted file mode 100644 index bf1b035a6b7..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The subject attribute values that must match in order for this policy to apply in a permission decision. - */ -public class PolicySubject extends GenericModel { - - protected List attributes; - - /** - * Builder. - */ - public static class Builder { - private List attributes; - - /** - * Instantiates a new Builder from an existing PolicySubject instance. - * - * @param policySubject the instance to initialize the Builder with - */ - private Builder(PolicySubject policySubject) { - this.attributes = policySubject.attributes; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param attributes the attributes - */ - public Builder(List attributes) { - this.attributes = attributes; - } - - /** - * Builds a PolicySubject. - * - * @return the new PolicySubject instance - */ - public PolicySubject build() { - return new PolicySubject(this); - } - - /** - * Adds a new element to attributes. - * - * @param attributes the new element to be added - * @return the PolicySubject builder - */ - public Builder addAttributes(SubjectAttribute attributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, - "attributes cannot be null"); - if (this.attributes == null) { - this.attributes = new ArrayList(); - } - this.attributes.add(attributes); - return this; - } - - /** - * Set the attributes. - * Existing attributes will be replaced. - * - * @param attributes the attributes - * @return the PolicySubject builder - */ - public Builder attributes(List attributes) { - this.attributes = attributes; - return this; - } - } - - protected PolicySubject() { } - - protected PolicySubject(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, - "attributes cannot be null"); - attributes = builder.attributes; - } - - /** - * New builder. - * - * @return a PolicySubject builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the attributes. - * - * List of subject attributes. - * - * @return the attributes - */ - public List attributes() { - return attributes; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java deleted file mode 100644 index bdffbe98c10..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the policy template. - */ -public class PolicyTemplate extends GenericModel { - - /** - * State of policy template. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String name; - protected String description; - @SerializedName("account_id") - protected String accountId; - protected String version; - protected Boolean committed; - protected TemplatePolicy policy; - protected String state; - protected String id; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - - protected PolicyTemplate() { } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the version. - * - * Template version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the committed. - * - * Committed status of the template version. - * - * @return the committed - */ - public Boolean isCommitted() { - return committed; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy getPolicy() { - return policy; - } - - /** - * Gets the state. - * - * State of policy template. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the id. - * - * The policy template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the policy templates API by policy template ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy template was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy template. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy template was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy template. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java deleted file mode 100644 index 54727eadf4d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of policies assignments. - */ -public class PolicyTemplateAssignmentCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List assignments; - - protected PolicyTemplateAssignmentCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the assignments. - * - * List of policy assignments. - * - * @return the assignments - */ - public List getAssignments() { - return assignments; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java deleted file mode 100644 index 2c8e82df441..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * PolicyTemplateAssignmentItems. - * - * Classes which extend this class: - * - PolicyTemplateAssignmentItemsPolicyAssignmentV1 - * - PolicyTemplateAssignmentItemsPolicyAssignment - */ -public class PolicyTemplateAssignmentItems extends GenericModel { - - /** - * The policy assignment status. - */ - public interface Status { - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** succeeded. */ - String SUCCEEDED = "succeeded"; - /** succeed_with_errors. */ - String SUCCEED_WITH_ERRORS = "succeed_with_errors"; - /** failed. */ - String FAILED = "failed"; - } - - /** - * Assignment target type. - */ - public interface TargetType { - /** Account. */ - String ACCOUNT = "Account"; - /** AccountGroup. */ - String ACCOUNTGROUP = "AccountGroup"; - /** Enterprise. */ - String ENTERPRISE = "Enterprise"; - } - - protected AssignmentTargetDetails target; - protected String id; - @SerializedName("account_id") - protected String accountId; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected List resources; - protected PolicyAssignmentV1Subject subject; - protected AssignmentTemplateDetails template; - protected String status; - @SerializedName("template_id") - protected String templateId; - @SerializedName("template_version") - protected String templateVersion; - @SerializedName("assignment_id") - protected String assignmentId; - @SerializedName("target_type") - protected String targetType; - - protected PolicyTemplateAssignmentItems() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the id. - * - * Policy assignment ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the accountId. - * - * The account GUID that the policies assignments belong to. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the href. - * - * The href URL that links to the policies assignments API by policy assignment ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy assignment was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy assignment. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy assignment was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy assignment. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the resources. - * - * Object for each account assigned. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the subject. - * - * Subject details of access type assignment. - * - * @return the subject - */ - public PolicyAssignmentV1Subject getSubject() { - return subject; - } - - /** - * Gets the template. - * - * policy template details. - * - * @return the template - */ - public AssignmentTemplateDetails getTemplate() { - return template; - } - - /** - * Gets the status. - * - * The policy assignment status. - * - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * Gets the templateId. - * - * policy template ID. - * - * @return the templateId - */ - public String getTemplateId() { - return templateId; - } - - /** - * Gets the templateVersion. - * - * policy template version. - * - * @return the templateVersion - */ - public String getTemplateVersion() { - return templateVersion; - } - - /** - * Gets the assignmentId. - * - * Passed in value to correlate with other assignments. - * - * @return the assignmentId - */ - public String getAssignmentId() { - return assignmentId; - } - - /** - * Gets the targetType. - * - * Assignment target type. - * - * @return the targetType - */ - public String getTargetType() { - return targetType; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java deleted file mode 100644 index ec9c32e5bdd..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * The set of properties associated with the policy template assignment. - */ -public class PolicyTemplateAssignmentItemsPolicyAssignment extends PolicyTemplateAssignmentItems { - - /** - * Assignment target type. - */ - public interface TargetType { - /** Account. */ - String ACCOUNT = "Account"; - /** AccountGroup. */ - String ACCOUNTGROUP = "AccountGroup"; - /** Enterprise. */ - String ENTERPRISE = "Enterprise"; - } - - /** - * The policy assignment status. - */ - public interface Status { - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** succeeded. */ - String SUCCEEDED = "succeeded"; - /** succeed_with_errors. */ - String SUCCEED_WITH_ERRORS = "succeed_with_errors"; - /** failed. */ - String FAILED = "failed"; - } - - - protected PolicyTemplateAssignmentItemsPolicyAssignment() { } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java deleted file mode 100644 index 4cebdbb17b1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * The set of properties associated with the policy template assignment. - */ -public class PolicyTemplateAssignmentItemsPolicyAssignmentV1 extends PolicyTemplateAssignmentItems { - - /** - * The policy assignment status. - */ - public interface Status { - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** succeeded. */ - String SUCCEEDED = "succeeded"; - /** succeed_with_errors. */ - String SUCCEED_WITH_ERRORS = "succeed_with_errors"; - /** failed. */ - String FAILED = "failed"; - } - - - protected PolicyTemplateAssignmentItemsPolicyAssignmentV1() { } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java deleted file mode 100644 index 2a262c584b5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of policy Templates. - */ -public class PolicyTemplateCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - @SerializedName("policy_templates") - protected List policyTemplates; - - protected PolicyTemplateCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the policyTemplates. - * - * List of policy templates. - * - * @return the policyTemplates - */ - public List getPolicyTemplates() { - return policyTemplates; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java deleted file mode 100644 index 5a2876dfe28..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the policy template. - */ -public class PolicyTemplateLimitData extends GenericModel { - - /** - * State of policy template. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String name; - protected String description; - @SerializedName("account_id") - protected String accountId; - protected String version; - protected Boolean committed; - protected TemplatePolicy policy; - protected String state; - protected String id; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected TemplateCountData counts; - - protected PolicyTemplateLimitData() { } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the version. - * - * Template version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the committed. - * - * Committed status of the template version. - * - * @return the committed - */ - public Boolean isCommitted() { - return committed; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy getPolicy() { - return policy; - } - - /** - * Gets the state. - * - * State of policy template. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the id. - * - * The policy template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the policy templates API by policy template ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy template was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy template. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy template was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy template. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the counts. - * - * policy template count details. - * - * @return the counts - */ - public TemplateCountData getCounts() { - return counts; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java deleted file mode 100644 index 07effc5b3ad..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with a policy. - */ -public class PolicyTemplateMetaData extends GenericModel { - - /** - * The policy state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String id; - protected String type; - protected String description; - protected List subjects; - protected List roles; - protected List resources; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String state; - protected TemplateMetadata template; - - protected PolicyTemplateMetaData() { } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Gets the description. - * - * Customer-defined description. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the subjects. - * - * The subjects associated with a policy. - * - * @return the subjects - */ - public List getSubjects() { - return subjects; - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List getRoles() { - return roles; - } - - /** - * Gets the resources. - * - * The resources associated with a policy. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the href. - * - * The href links back to the policy. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the state. - * - * The policy state. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the template. - * - * The details of the IAM template that was used to create an enterprise-managed policy in your account. When - * returned, this indicates that the policy is created from and managed by a template in the root enterprise account. - * - * @return the template - */ - public TemplateMetadata getTemplate() { - return template; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java deleted file mode 100644 index a4f95bc6562..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of versions for a specific policy template. - */ -public class PolicyTemplateVersionsCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List versions; - - protected PolicyTemplateVersionsCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the versions. - * - * List of policy templates versions. - * - * @return the versions - */ - public List getVersions() { - return versions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java deleted file mode 100644 index f6a2496cf91..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * PolicyTemplateVersionsPager can be used to simplify the use of the "listPolicyTemplateVersions" method. - */ -public class PolicyTemplateVersionsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListPolicyTemplateVersionsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected PolicyTemplateVersionsPager() { } - - /** - * Constructs a new PolicyTemplateVersionsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyTemplateVersions" method - * @param options the ListPolicyTemplateVersionsOptions instance to be used to invoke the "listPolicyTemplateVersions" method - */ - public PolicyTemplateVersionsPager(IamPolicyManagement client, ListPolicyTemplateVersionsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<PolicyTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListPolicyTemplateVersionsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - PolicyTemplateVersionsCollection result = client.listPolicyTemplateVersions(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getVersions(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<PolicyTemplate> containing all results returned by the "listPolicyTemplateVersions" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java deleted file mode 100644 index eba6e6c8fad..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * PolicyTemplatesPager can be used to simplify the use of the "listPolicyTemplates" method. - */ -public class PolicyTemplatesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListPolicyTemplatesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected PolicyTemplatesPager() { } - - /** - * Constructs a new PolicyTemplatesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyTemplates" method - * @param options the ListPolicyTemplatesOptions instance to be used to invoke the "listPolicyTemplates" method - */ - public PolicyTemplatesPager(IamPolicyManagement client, ListPolicyTemplatesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<PolicyTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListPolicyTemplatesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - PolicyTemplateCollection result = client.listPolicyTemplates(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getPolicyTemplates(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<PolicyTemplate> containing all results returned by the "listPolicyTemplates" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java deleted file mode 100644 index 2656f3fb790..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Details with linking href to previous page of requested collection. - */ -public class Previous extends GenericModel { - - protected String href; - protected String start; - - protected Previous() { } - - /** - * Gets the href. - * - * The href linking to the page of requested collection. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection. - * - * @return the start - */ - public String getStart() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java deleted file mode 100644 index 151a77e8cb9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java +++ /dev/null @@ -1,273 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replaceActionControlTemplate options. - */ -public class ReplaceActionControlTemplateOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String version; - protected String ifMatch; - protected String name; - protected String description; - protected TemplateActionControl actionControl; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String version; - private String ifMatch; - private String name; - private String description; - private TemplateActionControl actionControl; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing ReplaceActionControlTemplateOptions instance. - * - * @param replaceActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(ReplaceActionControlTemplateOptions replaceActionControlTemplateOptions) { - this.actionControlTemplateId = replaceActionControlTemplateOptions.actionControlTemplateId; - this.version = replaceActionControlTemplateOptions.version; - this.ifMatch = replaceActionControlTemplateOptions.ifMatch; - this.name = replaceActionControlTemplateOptions.name; - this.description = replaceActionControlTemplateOptions.description; - this.actionControl = replaceActionControlTemplateOptions.actionControl; - this.committed = replaceActionControlTemplateOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - * @param version the version - * @param ifMatch the ifMatch - */ - public Builder(String actionControlTemplateId, String version, String ifMatch) { - this.actionControlTemplateId = actionControlTemplateId; - this.version = version; - this.ifMatch = ifMatch; - } - - /** - * Builds a ReplaceActionControlTemplateOptions. - * - * @return the new ReplaceActionControlTemplateOptions instance - */ - public ReplaceActionControlTemplateOptions build() { - return new ReplaceActionControlTemplateOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actionControl. - * - * @param actionControl the actionControl - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder actionControl(TemplateActionControl actionControl) { - this.actionControl = actionControl; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected ReplaceActionControlTemplateOptions() { } - - protected ReplaceActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - actionControlTemplateId = builder.actionControlTemplateId; - version = builder.version; - ifMatch = builder.ifMatch; - name = builder.name; - description = builder.description; - actionControl = builder.actionControl; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a ReplaceActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating an action control template version must match the Etag value of the existing - * action control template version. The Etag can be retrieved using the GET - * /v1/action_control_templates/{template_id}/versions/{version} API and looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will - * change the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the action control template. This is shown to users in the enterprise account. Use this to describe - * the purpose or context of the action control for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actionControl. - * - * The action control properties that are created in an action resource when the template is assigned. - * - * @return the actionControl - */ - public TemplateActionControl actionControl() { - return actionControl; - } - - /** - * Gets the committed. - * - * Committed status of the template version. If committed is set to true, then the template version can no longer be - * updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java deleted file mode 100644 index 80cbe9e4c79..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java +++ /dev/null @@ -1,335 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replacePolicy options. - */ -public class ReplacePolicyOptions extends GenericModel { - - protected String policyId; - protected String ifMatch; - protected String type; - protected List subjects; - protected List roles; - protected List resources; - protected String description; - - /** - * Builder. - */ - public static class Builder { - private String policyId; - private String ifMatch; - private String type; - private List subjects; - private List roles; - private List resources; - private String description; - - /** - * Instantiates a new Builder from an existing ReplacePolicyOptions instance. - * - * @param replacePolicyOptions the instance to initialize the Builder with - */ - private Builder(ReplacePolicyOptions replacePolicyOptions) { - this.policyId = replacePolicyOptions.policyId; - this.ifMatch = replacePolicyOptions.ifMatch; - this.type = replacePolicyOptions.type; - this.subjects = replacePolicyOptions.subjects; - this.roles = replacePolicyOptions.roles; - this.resources = replacePolicyOptions.resources; - this.description = replacePolicyOptions.description; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyId the policyId - * @param ifMatch the ifMatch - * @param type the type - * @param subjects the subjects - * @param roles the roles - * @param resources the resources - */ - public Builder(String policyId, String ifMatch, String type, List subjects, List roles, List resources) { - this.policyId = policyId; - this.ifMatch = ifMatch; - this.type = type; - this.subjects = subjects; - this.roles = roles; - this.resources = resources; - } - - /** - * Builds a ReplacePolicyOptions. - * - * @return the new ReplacePolicyOptions instance - */ - public ReplacePolicyOptions build() { - return new ReplacePolicyOptions(this); - } - - /** - * Adds a new element to subjects. - * - * @param subjects the new element to be added - * @return the ReplacePolicyOptions builder - */ - public Builder addSubjects(PolicySubject subjects) { - com.ibm.cloud.sdk.core.util.Validator.notNull(subjects, - "subjects cannot be null"); - if (this.subjects == null) { - this.subjects = new ArrayList(); - } - this.subjects.add(subjects); - return this; - } - - /** - * Adds a new element to roles. - * - * @param roles the new element to be added - * @return the ReplacePolicyOptions builder - */ - public Builder addRoles(PolicyRole roles) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roles, - "roles cannot be null"); - if (this.roles == null) { - this.roles = new ArrayList(); - } - this.roles.add(roles); - return this; - } - - /** - * Adds a new element to resources. - * - * @param resources the new element to be added - * @return the ReplacePolicyOptions builder - */ - public Builder addResources(PolicyResource resources) { - com.ibm.cloud.sdk.core.util.Validator.notNull(resources, - "resources cannot be null"); - if (this.resources == null) { - this.resources = new ArrayList(); - } - this.resources.add(resources); - return this; - } - - /** - * Set the policyId. - * - * @param policyId the policyId - * @return the ReplacePolicyOptions builder - */ - public Builder policyId(String policyId) { - this.policyId = policyId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplacePolicyOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the ReplacePolicyOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the subjects. - * Existing subjects will be replaced. - * - * @param subjects the subjects - * @return the ReplacePolicyOptions builder - */ - public Builder subjects(List subjects) { - this.subjects = subjects; - return this; - } - - /** - * Set the roles. - * Existing roles will be replaced. - * - * @param roles the roles - * @return the ReplacePolicyOptions builder - */ - public Builder roles(List roles) { - this.roles = roles; - return this; - } - - /** - * Set the resources. - * Existing resources will be replaced. - * - * @param resources the resources - * @return the ReplacePolicyOptions builder - */ - public Builder resources(List resources) { - this.resources = resources; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplacePolicyOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - } - - protected ReplacePolicyOptions() { } - - protected ReplacePolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, - "policyId 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.type, - "type cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subjects, - "subjects cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, - "roles cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resources, - "resources cannot be null"); - policyId = builder.policyId; - ifMatch = builder.ifMatch; - type = builder.type; - subjects = builder.subjects; - roles = builder.roles; - resources = builder.resources; - description = builder.description; - } - - /** - * New builder. - * - * @return a ReplacePolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyId. - * - * The policy ID. - * - * @return the policyId - */ - public String policyId() { - return policyId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be - * retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the subjects. - * - * The subjects associated with a policy. - * - * @return the subjects - */ - public List subjects() { - return subjects; - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List roles() { - return roles; - } - - /** - * Gets the resources. - * - * The resources associated with a policy. - * - * @return the resources - */ - public List resources() { - return resources; - } - - /** - * Gets the description. - * - * Customer-defined description. - * - * @return the description - */ - public String description() { - return description; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java deleted file mode 100644 index 5a55c4898e5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replacePolicyTemplate options. - */ -public class ReplacePolicyTemplateOptions extends GenericModel { - - protected String policyTemplateId; - protected String version; - protected String ifMatch; - protected TemplatePolicy policy; - protected String name; - protected String description; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String version; - private String ifMatch; - private TemplatePolicy policy; - private String name; - private String description; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing ReplacePolicyTemplateOptions instance. - * - * @param replacePolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(ReplacePolicyTemplateOptions replacePolicyTemplateOptions) { - this.policyTemplateId = replacePolicyTemplateOptions.policyTemplateId; - this.version = replacePolicyTemplateOptions.version; - this.ifMatch = replacePolicyTemplateOptions.ifMatch; - this.policy = replacePolicyTemplateOptions.policy; - this.name = replacePolicyTemplateOptions.name; - this.description = replacePolicyTemplateOptions.description; - this.committed = replacePolicyTemplateOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param version the version - * @param ifMatch the ifMatch - * @param policy the policy - */ - public Builder(String policyTemplateId, String version, String ifMatch, TemplatePolicy policy) { - this.policyTemplateId = policyTemplateId; - this.version = version; - this.ifMatch = ifMatch; - this.policy = policy; - } - - /** - * Builds a ReplacePolicyTemplateOptions. - * - * @return the new ReplacePolicyTemplateOptions instance - */ - public ReplacePolicyTemplateOptions build() { - return new ReplacePolicyTemplateOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the policy. - * - * @param policy the policy - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder policy(TemplatePolicy policy) { - this.policy = policy; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected ReplacePolicyTemplateOptions() { } - - protected ReplacePolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version 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.policy, - "policy cannot be null"); - policyTemplateId = builder.policyTemplateId; - version = builder.version; - ifMatch = builder.ifMatch; - policy = builder.policy; - name = builder.name; - description = builder.description; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a ReplacePolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the version. - * - * The policy template version. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy template version and must match the Etag value of the existing policy - * template version. The Etag can be retrieved using the GET - * /v1/policy_templates/{policy_template_id}/versions/{version} API and looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy policy() { - return policy; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template version. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java deleted file mode 100644 index fc4b536103d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java +++ /dev/null @@ -1,255 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replaceRole options. - */ -public class ReplaceRoleOptions extends GenericModel { - - protected String roleId; - protected String ifMatch; - protected String displayName; - protected List actions; - protected String description; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - private String ifMatch; - private String displayName; - private List actions; - private String description; - - /** - * Instantiates a new Builder from an existing ReplaceRoleOptions instance. - * - * @param replaceRoleOptions the instance to initialize the Builder with - */ - private Builder(ReplaceRoleOptions replaceRoleOptions) { - this.roleId = replaceRoleOptions.roleId; - this.ifMatch = replaceRoleOptions.ifMatch; - this.displayName = replaceRoleOptions.displayName; - this.actions = replaceRoleOptions.actions; - this.description = replaceRoleOptions.description; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - * @param ifMatch the ifMatch - * @param displayName the displayName - * @param actions the actions - */ - public Builder(String roleId, String ifMatch, String displayName, List actions) { - this.roleId = roleId; - this.ifMatch = ifMatch; - this.displayName = displayName; - this.actions = actions; - } - - /** - * Builds a ReplaceRoleOptions. - * - * @return the new ReplaceRoleOptions instance - */ - public ReplaceRoleOptions build() { - return new ReplaceRoleOptions(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the ReplaceRoleOptions builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the ReplaceRoleOptions builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplaceRoleOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the ReplaceRoleOptions builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the ReplaceRoleOptions builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplaceRoleOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the role. - * - * @param role the role - * @return the ReplaceRoleOptions builder - */ - public Builder role(Role role) { - this.displayName = role.displayName(); - this.actions = role.actions(); - this.description = role.description(); - return this; - } - } - - protected ReplaceRoleOptions() { } - - protected ReplaceRoleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, - "roleId 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.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - roleId = builder.roleId; - ifMatch = builder.ifMatch; - displayName = builder.displayName; - actions = builder.actions; - description = builder.description; - } - - /** - * New builder. - * - * @return a ReplaceRoleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role ID. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a role and must match the ETag value of the existing role. The Etag can be - * retrieved using the GET /v2/roles/{role_id} API and looking at the ETag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List actions() { - return actions; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String description() { - return description; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java deleted file mode 100644 index 9a69b13326c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java +++ /dev/null @@ -1,273 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replaceRoleTemplate options. - */ -public class ReplaceRoleTemplateOptions extends GenericModel { - - protected String roleTemplateId; - protected String version; - protected String ifMatch; - protected String name; - protected String description; - protected TemplateRole role; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String version; - private String ifMatch; - private String name; - private String description; - private TemplateRole role; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing ReplaceRoleTemplateOptions instance. - * - * @param replaceRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(ReplaceRoleTemplateOptions replaceRoleTemplateOptions) { - this.roleTemplateId = replaceRoleTemplateOptions.roleTemplateId; - this.version = replaceRoleTemplateOptions.version; - this.ifMatch = replaceRoleTemplateOptions.ifMatch; - this.name = replaceRoleTemplateOptions.name; - this.description = replaceRoleTemplateOptions.description; - this.role = replaceRoleTemplateOptions.role; - this.committed = replaceRoleTemplateOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - * @param version the version - * @param ifMatch the ifMatch - */ - public Builder(String roleTemplateId, String version, String ifMatch) { - this.roleTemplateId = roleTemplateId; - this.version = version; - this.ifMatch = ifMatch; - } - - /** - * Builds a ReplaceRoleTemplateOptions. - * - * @return the new ReplaceRoleTemplateOptions instance - */ - public ReplaceRoleTemplateOptions build() { - return new ReplaceRoleTemplateOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the role. - * - * @param role the role - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder role(TemplateRole role) { - this.role = role; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected ReplaceRoleTemplateOptions() { } - - protected ReplaceRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - roleTemplateId = builder.roleTemplateId; - version = builder.version; - ifMatch = builder.ifMatch; - name = builder.name; - description = builder.description; - role = builder.role; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a ReplaceRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the version. - * - * Role template version. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a role template version must match the Etag value of the existing role template - * version. The Etag can be retrieved using the GET /v1/role_templates/{template_id}/versions/{version} API and - * looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will - * change the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the role template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the role for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the role. - * - * The role properties that are created in an action resource when the template is assigned. - * - * @return the role - */ - public TemplateRole role() { - return role; - } - - /** - * Gets the committed. - * - * Committed status of the template version. If committed is set to true, then the template version can no longer be - * updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java deleted file mode 100644 index 960f4782635..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java +++ /dev/null @@ -1,336 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replaceV2Policy options. - */ -public class ReplaceV2PolicyOptions extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - protected String id; - protected String ifMatch; - protected Control control; - protected String type; - protected String description; - protected V2PolicySubject subject; - protected V2PolicyResource resource; - protected String pattern; - protected V2PolicyRule rule; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String ifMatch; - private Control control; - private String type; - private String description; - private V2PolicySubject subject; - private V2PolicyResource resource; - private String pattern; - private V2PolicyRule rule; - - /** - * Instantiates a new Builder from an existing ReplaceV2PolicyOptions instance. - * - * @param replaceV2PolicyOptions the instance to initialize the Builder with - */ - private Builder(ReplaceV2PolicyOptions replaceV2PolicyOptions) { - this.id = replaceV2PolicyOptions.id; - this.ifMatch = replaceV2PolicyOptions.ifMatch; - this.control = replaceV2PolicyOptions.control; - this.type = replaceV2PolicyOptions.type; - this.description = replaceV2PolicyOptions.description; - this.subject = replaceV2PolicyOptions.subject; - this.resource = replaceV2PolicyOptions.resource; - this.pattern = replaceV2PolicyOptions.pattern; - this.rule = replaceV2PolicyOptions.rule; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param id the id - * @param ifMatch the ifMatch - * @param control the control - * @param type the type - */ - public Builder(String id, String ifMatch, Control control, String type) { - this.id = id; - this.ifMatch = ifMatch; - this.control = control; - this.type = type; - } - - /** - * Builds a ReplaceV2PolicyOptions. - * - * @return the new ReplaceV2PolicyOptions instance - */ - public ReplaceV2PolicyOptions build() { - return new ReplaceV2PolicyOptions(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the ReplaceV2PolicyOptions builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplaceV2PolicyOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the control. - * - * @param control the control - * @return the ReplaceV2PolicyOptions builder - */ - public Builder control(Control control) { - this.control = control; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the ReplaceV2PolicyOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplaceV2PolicyOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the subject. - * - * @param subject the subject - * @return the ReplaceV2PolicyOptions builder - */ - public Builder subject(V2PolicySubject subject) { - this.subject = subject; - return this; - } - - /** - * Set the resource. - * - * @param resource the resource - * @return the ReplaceV2PolicyOptions builder - */ - public Builder resource(V2PolicyResource resource) { - this.resource = resource; - return this; - } - - /** - * Set the pattern. - * - * @param pattern the pattern - * @return the ReplaceV2PolicyOptions builder - */ - public Builder pattern(String pattern) { - this.pattern = pattern; - return this; - } - - /** - * Set the rule. - * - * @param rule the rule - * @return the ReplaceV2PolicyOptions builder - */ - public Builder rule(V2PolicyRule rule) { - this.rule = rule; - return this; - } - } - - protected ReplaceV2PolicyOptions() { } - - protected ReplaceV2PolicyOptions(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.control, - "control cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - id = builder.id; - ifMatch = builder.ifMatch; - control = builder.control; - type = builder.type; - description = builder.description; - subject = builder.subject; - resource = builder.resource; - pattern = builder.pattern; - rule = builder.rule; - } - - /** - * New builder. - * - * @return a ReplaceV2PolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be - * retrieved using the GET /v2/policies/{id} API and looking at the ETag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the control. - * - * Specifies the type of access that is granted by the policy. - * - * @return the control - */ - public Control control() { - return control; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject subject() { - return subject; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource resource() { - return resource; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String pattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule rule() { - return rule; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java deleted file mode 100644 index 3a8b7e87b9e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * An attribute associated with a resource. - */ -public class ResourceAttribute extends GenericModel { - - protected String name; - protected String value; - protected String operator; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String value; - private String operator; - - /** - * Instantiates a new Builder from an existing ResourceAttribute instance. - * - * @param resourceAttribute the instance to initialize the Builder with - */ - private Builder(ResourceAttribute resourceAttribute) { - this.name = resourceAttribute.name; - this.value = resourceAttribute.value; - this.operator = resourceAttribute.operator; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param value the value - */ - public Builder(String name, String value) { - this.name = name; - this.value = value; - } - - /** - * Builds a ResourceAttribute. - * - * @return the new ResourceAttribute instance - */ - public ResourceAttribute build() { - return new ResourceAttribute(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the ResourceAttribute builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the ResourceAttribute builder - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the ResourceAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - } - - protected ResourceAttribute() { } - - protected ResourceAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - name = builder.name; - value = builder.value; - operator = builder.operator; - } - - /** - * New builder. - * - * @return a ResourceAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * The name of an attribute. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the value. - * - * The value of an attribute. - * - * @return the value - */ - public String value() { - return value; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java deleted file mode 100644 index 7da4cffee56..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A tag associated with a resource. - */ -public class ResourceTag extends GenericModel { - - protected String name; - protected String value; - protected String operator; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String value; - private String operator; - - /** - * Instantiates a new Builder from an existing ResourceTag instance. - * - * @param resourceTag the instance to initialize the Builder with - */ - private Builder(ResourceTag resourceTag) { - this.name = resourceTag.name; - this.value = resourceTag.value; - this.operator = resourceTag.operator; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param value the value - */ - public Builder(String name, String value) { - this.name = name; - this.value = value; - } - - /** - * Builds a ResourceTag. - * - * @return the new ResourceTag instance - */ - public ResourceTag build() { - return new ResourceTag(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the ResourceTag builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the ResourceTag builder - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the ResourceTag builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - } - - protected ResourceTag() { } - - protected ResourceTag(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - name = builder.name; - value = builder.value; - operator = builder.operator; - } - - /** - * New builder. - * - * @return a ResourceTag builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * The name of an access management tag. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the value. - * - * The value of an access management tag. - * - * @return the value - */ - public String value() { - return value; - } - - /** - * Gets the operator. - * - * The operator of an access management tag. - * - * @return the operator - */ - public String operator() { - return operator; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java deleted file mode 100644 index 24b99c9bd08..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role resource. - */ -public class Role extends GenericModel { - - @SerializedName("display_name") - protected String displayName; - protected String description; - protected List actions; - protected String crn; - - /** - * Builder. - */ - public static class Builder { - private String displayName; - private String description; - private List actions; - - /** - * Instantiates a new Builder from an existing Role instance. - * - * @param role the instance to initialize the Builder with - */ - private Builder(Role role) { - this.displayName = role.displayName; - this.description = role.description; - this.actions = role.actions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param displayName the displayName - * @param actions the actions - */ - public Builder(String displayName, List actions) { - this.displayName = displayName; - this.actions = actions; - } - - /** - * Builds a Role. - * - * @return the new Role instance - */ - public Role build() { - return new Role(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the Role builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the Role builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the Role builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the Role builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - } - - protected Role() { } - - protected Role(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - displayName = builder.displayName; - description = builder.description; - actions = builder.actions; - } - - /** - * New builder. - * - * @return a Role builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List actions() { - return actions; - } - - /** - * Gets the crn. - * - * The role Cloud Resource Name (CRN). Example CRN: - * 'crn:v1:ibmcloud:public:iam-access-management::a/exampleAccountId::customRole:ExampleRoleName'. - * - * @return the crn - */ - public String crn() { - return crn; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java deleted file mode 100644 index 9169fc88572..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * An action that can be performed by the policy subject when assigned a role. - */ -public class RoleAction extends GenericModel { - - protected String id; - @SerializedName("display_name") - protected String displayName; - protected String description; - - protected RoleAction() { } - - /** - * Gets the id. - * - * Unique identifier for action with structure service.resource.action. For example, cbr.rule.read. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the displayName. - * - * Services defined display name for action. - * - * @return the displayName - */ - public String getDisplayName() { - return displayName; - } - - /** - * Gets the description. - * - * Service defined description for action. - * - * @return the description - */ - public String getDescription() { - return description; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java deleted file mode 100644 index 23bb4b65c6f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the assigned role template. - */ -public class RoleAssignment extends GenericModel { - - /** - * The current operation of the role assignment. - */ - public interface Operation { - /** create. */ - String CREATE = "create"; - /** apply. */ - String APPLY = "apply"; - /** update. */ - String UPDATE = "update"; - /** remove. */ - String REMOVE = "remove"; - } - - /** - * The role assignment status. - */ - public interface Status { - /** accepted. */ - String ACCEPTED = "accepted"; - /** failure. */ - String FAILURE = "failure"; - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** superseded. */ - String SUPERSEDED = "superseded"; - } - - protected String id; - @SerializedName("account_id") - protected String accountId; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String operation; - protected List resources; - protected RoleAssignmentTemplate template; - protected AssignmentTargetDetails target; - protected String status; - - protected RoleAssignment() { } - - /** - * Gets the id. - * - * Action control assignment ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the accountId. - * - * The account GUID that the role assignments belong to. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the href. - * - * The href URL that links to the role assignments API by role assignment ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the role assignment was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the role assignment. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the role assignment was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the role assignment. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the operation. - * - * The current operation of the role assignment. - * - * @return the operation - */ - public String getOperation() { - return operation; - } - - /** - * Gets the resources. - * - * Resources created when role template is assigned. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the template. - * - * The role template id and version that will be assigned. - * - * @return the template - */ - public RoleAssignmentTemplate getTemplate() { - return template; - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the status. - * - * The role assignment status. - * - * @return the status - */ - public String getStatus() { - return status; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java deleted file mode 100644 index 658ac5b8c99..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of role assignments. - */ -public class RoleAssignmentCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List assignments; - - protected RoleAssignmentCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the assignments. - * - * List of role assignments. - * - * @return the assignments - */ - public List getAssignments() { - return assignments; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java deleted file mode 100644 index 60d7a02d604..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The role assignment resources and target where the template is assigned. - */ -public class RoleAssignmentResource extends GenericModel { - - protected AssignmentTargetDetails target; - protected RoleAssignmentResourceRole role; - - protected RoleAssignmentResource() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the role. - * - * Set of properties of the assigned resource or error message if assignment failed. - * - * @return the role - */ - public RoleAssignmentResourceRole getRole() { - return role; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java deleted file mode 100644 index 9ea359d63fb..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * On success, it includes the role assigned. - */ -public class RoleAssignmentResourceCreated extends GenericModel { - - protected String id; - - protected RoleAssignmentResourceCreated() { } - - /** - * Gets the id. - * - * role id. - * - * @return the id - */ - public String getId() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java deleted file mode 100644 index 22d40bdaef4..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Set of properties of the assigned resource or error message if assignment failed. - */ -public class RoleAssignmentResourceRole extends GenericModel { - - @SerializedName("resource_created") - protected RoleAssignmentResourceCreated resourceCreated; - @SerializedName("error_message") - protected AssignmentResourceError errorMessage; - - protected RoleAssignmentResourceRole() { } - - /** - * Gets the resourceCreated. - * - * On success, it includes the role assigned. - * - * @return the resourceCreated - */ - public RoleAssignmentResourceCreated getResourceCreated() { - return resourceCreated; - } - - /** - * Gets the errorMessage. - * - * Body parameters for assignment error. - * - * @return the errorMessage - */ - public AssignmentResourceError getErrorMessage() { - return errorMessage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java deleted file mode 100644 index 3524b91f4d5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The role template id and version that will be assigned. - */ -public class RoleAssignmentTemplate extends GenericModel { - - protected String id; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String version; - - /** - * Instantiates a new Builder from an existing RoleAssignmentTemplate instance. - * - * @param roleAssignmentTemplate the instance to initialize the Builder with - */ - private Builder(RoleAssignmentTemplate roleAssignmentTemplate) { - this.id = roleAssignmentTemplate.id; - this.version = roleAssignmentTemplate.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param id the id - * @param version the version - */ - public Builder(String id, String version) { - this.id = id; - this.version = version; - } - - /** - * Builds a RoleAssignmentTemplate. - * - * @return the new RoleAssignmentTemplate instance - */ - public RoleAssignmentTemplate build() { - return new RoleAssignmentTemplate(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the RoleAssignmentTemplate builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the RoleAssignmentTemplate builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected RoleAssignmentTemplate() { } - - protected RoleAssignmentTemplate(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - id = builder.id; - version = builder.version; - } - - /** - * New builder. - * - * @return a RoleAssignmentTemplate builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * Action control template ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java deleted file mode 100644 index 16296a82e40..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * RoleAssignmentsPager can be used to simplify the use of the "listRoleAssignments" method. - */ -public class RoleAssignmentsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListRoleAssignmentsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected RoleAssignmentsPager() { } - - /** - * Constructs a new RoleAssignmentsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listRoleAssignments" method - * @param options the ListRoleAssignmentsOptions instance to be used to invoke the "listRoleAssignments" method - */ - public RoleAssignmentsPager(IamPolicyManagement client, ListRoleAssignmentsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<RoleAssignment> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListRoleAssignmentsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - RoleAssignmentCollection result = client.listRoleAssignments(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getAssignments(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<RoleAssignment> containing all results returned by the "listRoleAssignments" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java deleted file mode 100644 index 282730a2dfc..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of roles returned by the 'list roles' operation. - */ -public class RoleCollection extends GenericModel { - - @SerializedName("custom_roles") - protected List customRoles; - @SerializedName("service_roles") - protected List serviceRoles; - @SerializedName("system_roles") - protected List systemRoles; - - protected RoleCollection() { } - - /** - * Gets the customRoles. - * - * List of custom roles. - * - * @return the customRoles - */ - public List getCustomRoles() { - return customRoles; - } - - /** - * Gets the serviceRoles. - * - * List of service roles. - * - * @return the serviceRoles - */ - public List getServiceRoles() { - return serviceRoles; - } - - /** - * Gets the systemRoles. - * - * List of system roles. - * - * @return the systemRoles - */ - public List getSystemRoles() { - return systemRoles; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java deleted file mode 100644 index 663d0f7f1d0..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the role template. - */ -public class RoleTemplate extends GenericModel { - - /** - * State of role template. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String name; - protected String description; - @SerializedName("account_id") - protected String accountId; - protected Boolean committed; - protected RoleTemplatePrototypeRole role; - protected String id; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String version; - protected String state; - - protected RoleTemplate() { } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the description. - * - * Description of the role template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the role for enterprise users managing IAM templates. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the committed. - * - * Committed status of the template. If committed is set to true, then the template version can no longer be updated. - * - * @return the committed - */ - public Boolean isCommitted() { - return committed; - } - - /** - * Gets the role. - * - * The role properties that are created in an action resource when the template is assigned. - * - * @return the role - */ - public RoleTemplatePrototypeRole getRole() { - return role; - } - - /** - * Gets the id. - * - * The role template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the role templates API by role template ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the role template was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the role template. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the role template was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the role template. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the version. - * - * The version number of the template used to identify different versions of same template. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the state. - * - * State of role template. - * - * @return the state - */ - public String getState() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java deleted file mode 100644 index 22a739b4a58..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of role templates. - */ -public class RoleTemplateCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - @SerializedName("role_templates") - protected List roleTemplates; - - protected RoleTemplateCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the roleTemplates. - * - * List of role templates. - * - * @return the roleTemplates - */ - public List getRoleTemplates() { - return roleTemplates; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java deleted file mode 100644 index 43197620689..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java +++ /dev/null @@ -1,239 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The role properties that are created in an action resource when the template is assigned. - */ -public class RoleTemplatePrototypeRole extends GenericModel { - - protected String name; - @SerializedName("display_name") - protected String displayName; - @SerializedName("service_name") - protected String serviceName; - protected String description; - protected List actions; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String displayName; - private String serviceName; - private String description; - private List actions; - - /** - * Instantiates a new Builder from an existing RoleTemplatePrototypeRole instance. - * - * @param roleTemplatePrototypeRole the instance to initialize the Builder with - */ - private Builder(RoleTemplatePrototypeRole roleTemplatePrototypeRole) { - this.name = roleTemplatePrototypeRole.name; - this.displayName = roleTemplatePrototypeRole.displayName; - this.serviceName = roleTemplatePrototypeRole.serviceName; - this.description = roleTemplatePrototypeRole.description; - this.actions = roleTemplatePrototypeRole.actions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param displayName the displayName - * @param actions the actions - */ - public Builder(String name, String displayName, List actions) { - this.name = name; - this.displayName = displayName; - this.actions = actions; - } - - /** - * Builds a RoleTemplatePrototypeRole. - * - * @return the new RoleTemplatePrototypeRole instance - */ - public RoleTemplatePrototypeRole build() { - return new RoleTemplatePrototypeRole(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the RoleTemplatePrototypeRole builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the RoleTemplatePrototypeRole builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the RoleTemplatePrototypeRole builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the RoleTemplatePrototypeRole builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the RoleTemplatePrototypeRole builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the RoleTemplatePrototypeRole builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - } - - protected RoleTemplatePrototypeRole() { } - - protected RoleTemplatePrototypeRole(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - name = builder.name; - displayName = builder.displayName; - serviceName = builder.serviceName; - description = builder.description; - actions = builder.actions; - } - - /** - * New builder. - * - * @return a RoleTemplatePrototypeRole builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the serviceName. - * - * The service name that the role refers. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the description. - * - * Description of the role. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. - * - * @return the actions - */ - public List actions() { - return actions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java deleted file mode 100644 index 673ff7f9750..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role template reference associated with a policy template. - */ -public class RoleTemplateReferencesItem extends GenericModel { - - protected String id; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String version; - - /** - * Instantiates a new Builder from an existing RoleTemplateReferencesItem instance. - * - * @param roleTemplateReferencesItem the instance to initialize the Builder with - */ - private Builder(RoleTemplateReferencesItem roleTemplateReferencesItem) { - this.id = roleTemplateReferencesItem.id; - this.version = roleTemplateReferencesItem.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param id the id - * @param version the version - */ - public Builder(String id, String version) { - this.id = id; - this.version = version; - } - - /** - * Builds a RoleTemplateReferencesItem. - * - * @return the new RoleTemplateReferencesItem instance - */ - public RoleTemplateReferencesItem build() { - return new RoleTemplateReferencesItem(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the RoleTemplateReferencesItem builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the RoleTemplateReferencesItem builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected RoleTemplateReferencesItem() { } - - protected RoleTemplateReferencesItem(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - id = builder.id; - version = builder.version; - } - - /** - * New builder. - * - * @return a RoleTemplateReferencesItem builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * The role template ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the version. - * - * Role template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java deleted file mode 100644 index a983208afe3..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of versions for a specific role template. - */ -public class RoleTemplateVersionsCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List versions; - - protected RoleTemplateVersionsCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the versions. - * - * List of role templates versions. - * - * @return the versions - */ - public List getVersions() { - return versions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java deleted file mode 100644 index 7af200cd72f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * RoleTemplateVersionsPager can be used to simplify the use of the "listRoleTemplateVersions" method. - */ -public class RoleTemplateVersionsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListRoleTemplateVersionsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected RoleTemplateVersionsPager() { } - - /** - * Constructs a new RoleTemplateVersionsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listRoleTemplateVersions" method - * @param options the ListRoleTemplateVersionsOptions instance to be used to invoke the "listRoleTemplateVersions" method - */ - public RoleTemplateVersionsPager(IamPolicyManagement client, ListRoleTemplateVersionsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<RoleTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListRoleTemplateVersionsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - RoleTemplateVersionsCollection result = client.listRoleTemplateVersions(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getVersions(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<RoleTemplate> containing all results returned by the "listRoleTemplateVersions" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java deleted file mode 100644 index 3654e0757ba..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * RoleTemplatesPager can be used to simplify the use of the "listRoleTemplates" method. - */ -public class RoleTemplatesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListRoleTemplatesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected RoleTemplatesPager() { } - - /** - * Constructs a new RoleTemplatesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listRoleTemplates" method - * @param options the ListRoleTemplatesOptions instance to be used to invoke the "listRoleTemplates" method - */ - public RoleTemplatesPager(IamPolicyManagement client, ListRoleTemplatesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<RoleTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListRoleTemplatesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - RoleTemplateCollection result = client.listRoleTemplates(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getRoleTemplates(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<RoleTemplate> containing all results returned by the "listRoleTemplates" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java deleted file mode 100644 index 03b6ff75eb1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role associated with a policy. - */ -public class Roles extends GenericModel { - - @SerializedName("role_id") - protected String roleId; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - - /** - * Instantiates a new Builder from an existing Roles instance. - * - * @param roles the instance to initialize the Builder with - */ - private Builder(Roles roles) { - this.roleId = roles.roleId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - */ - public Builder(String roleId) { - this.roleId = roleId; - } - - /** - * Builds a Roles. - * - * @return the new Roles instance - */ - public Roles build() { - return new Roles(this); - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the Roles builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - } - - protected Roles() { } - - protected Roles(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleId, - "roleId cannot be null"); - roleId = builder.roleId; - } - - /** - * New builder. - * - * @return a Roles builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java deleted file mode 100644 index fbf66d53ae1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Rule that specifies additional access that is granted (For example, time-based condition). - */ -public class RuleAttribute extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - protected String key; - protected String operator; - protected Object value; - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing RuleAttribute instance. - * - * @param ruleAttribute the instance to initialize the Builder with - */ - private Builder(RuleAttribute ruleAttribute) { - this.key = ruleAttribute.key; - this.operator = ruleAttribute.operator; - this.value = ruleAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a RuleAttribute. - * - * @return the new RuleAttribute instance - */ - public RuleAttribute build() { - return new RuleAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the RuleAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the RuleAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the RuleAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected RuleAttribute() { } - - protected RuleAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a RuleAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the key. - * - * The name of an attribute. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java deleted file mode 100644 index d7e54e112c5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * An attribute associated with a subject. - */ -public class SubjectAttribute extends GenericModel { - - protected String name; - protected String value; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String value; - - /** - * Instantiates a new Builder from an existing SubjectAttribute instance. - * - * @param subjectAttribute the instance to initialize the Builder with - */ - private Builder(SubjectAttribute subjectAttribute) { - this.name = subjectAttribute.name; - this.value = subjectAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param value the value - */ - public Builder(String name, String value) { - this.name = name; - this.value = value; - } - - /** - * Builds a SubjectAttribute. - * - * @return the new SubjectAttribute instance - */ - public SubjectAttribute build() { - return new SubjectAttribute(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the SubjectAttribute builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the SubjectAttribute builder - */ - public Builder value(String value) { - this.value = value; - return this; - } - } - - protected SubjectAttribute() { } - - protected SubjectAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - name = builder.name; - value = builder.value; - } - - /** - * New builder. - * - * @return a SubjectAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * The name of an attribute. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the value. - * - * The value of an attribute. - * - * @return the value - */ - public String value() { - return value; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java deleted file mode 100644 index 62f4bd77f87..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The action control properties that are created in an action resource when the template is assigned. - */ -public class TemplateActionControl extends GenericModel { - - @SerializedName("service_name") - protected String serviceName; - protected String description; - protected List actions; - - /** - * Builder. - */ - public static class Builder { - private String serviceName; - private String description; - private List actions; - - /** - * Instantiates a new Builder from an existing TemplateActionControl instance. - * - * @param templateActionControl the instance to initialize the Builder with - */ - private Builder(TemplateActionControl templateActionControl) { - this.serviceName = templateActionControl.serviceName; - this.description = templateActionControl.description; - this.actions = templateActionControl.actions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param serviceName the serviceName - * @param actions the actions - */ - public Builder(String serviceName, List actions) { - this.serviceName = serviceName; - this.actions = actions; - } - - /** - * Builds a TemplateActionControl. - * - * @return the new TemplateActionControl instance - */ - public TemplateActionControl build() { - return new TemplateActionControl(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the TemplateActionControl builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the TemplateActionControl builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the TemplateActionControl builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the TemplateActionControl builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - } - - protected TemplateActionControl() { } - - protected TemplateActionControl(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, - "serviceName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - serviceName = builder.serviceName; - description = builder.description; - actions = builder.actions; - } - - /** - * New builder. - * - * @return a TemplateActionControl builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the serviceName. - * - * The service name that the action control refers. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the description. - * - * Description of the action control. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actions. - * - * List of actions to control access. - * - * @return the actions - */ - public List actions() { - return actions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java deleted file mode 100644 index c74a77d9b6d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Specifies the type of access that is granted by the policy. - */ -public class TemplateControl extends GenericModel { - - protected TemplateGrant grant; - - /** - * Builder. - */ - public static class Builder { - private TemplateGrant grant; - - /** - * Instantiates a new Builder from an existing TemplateControl instance. - * - * @param templateControl the instance to initialize the Builder with - */ - private Builder(TemplateControl templateControl) { - this.grant = templateControl.grant; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param grant the grant - */ - public Builder(TemplateGrant grant) { - this.grant = grant; - } - - /** - * Builds a TemplateControl. - * - * @return the new TemplateControl instance - */ - public TemplateControl build() { - return new TemplateControl(this); - } - - /** - * Set the grant. - * - * @param grant the grant - * @return the TemplateControl builder - */ - public Builder grant(TemplateGrant grant) { - this.grant = grant; - return this; - } - } - - protected TemplateControl() { } - - protected TemplateControl(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.grant, - "grant cannot be null"); - grant = builder.grant; - } - - /** - * New builder. - * - * @return a TemplateControl builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the grant. - * - * Permission is granted by the policy. - * - * @return the grant - */ - public TemplateGrant grant() { - return grant; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java deleted file mode 100644 index edb134e1270..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * policy template count details. - */ -public class TemplateCountData extends GenericModel { - - protected LimitData template; - protected LimitData version; - - protected TemplateCountData() { } - - /** - * Gets the template. - * - * policy template current and limit details with in an account. - * - * @return the template - */ - public LimitData getTemplate() { - return template; - } - - /** - * Gets the version. - * - * policy template current and limit details with in an account. - * - * @return the version - */ - public LimitData getVersion() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java deleted file mode 100644 index fd0daff9665..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Permission is granted by the policy. - * - * Classes which extend this class: - * - TemplateGrantRoles - * - TemplateGrantRoleReferences - */ -public class TemplateGrant extends GenericModel { - - protected List roles; - @SerializedName("role_template_references") - protected List roleTemplateReferences; - - protected TemplateGrant() { } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List roles() { - return roles; - } - - /** - * Gets the roleTemplateReferences. - * - * A set of role template reference IDs granted by the policy. - * - * @return the roleTemplateReferences - */ - public List roleTemplateReferences() { - return roleTemplateReferences; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java deleted file mode 100644 index 248eb121b72..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * TemplateGrantRoleReferences. - */ -public class TemplateGrantRoleReferences extends TemplateGrant { - - - /** - * Builder. - */ - public static class Builder { - private List roleTemplateReferences; - - /** - * Instantiates a new Builder from an existing TemplateGrantRoleReferences instance. - * - * @param templateGrantRoleReferences the instance to initialize the Builder with - */ - public Builder(TemplateGrant templateGrantRoleReferences) { - this.roleTemplateReferences = templateGrantRoleReferences.roleTemplateReferences; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateReferences the roleTemplateReferences - */ - public Builder(List roleTemplateReferences) { - this.roleTemplateReferences = roleTemplateReferences; - } - - /** - * Builds a TemplateGrantRoleReferences. - * - * @return the new TemplateGrantRoleReferences instance - */ - public TemplateGrantRoleReferences build() { - return new TemplateGrantRoleReferences(this); - } - - /** - * Adds a new element to roleTemplateReferences. - * - * @param roleTemplateReferences the new element to be added - * @return the TemplateGrantRoleReferences builder - */ - public Builder addRoleTemplateReferences(RoleTemplateReferencesItem roleTemplateReferences) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roleTemplateReferences, - "roleTemplateReferences cannot be null"); - if (this.roleTemplateReferences == null) { - this.roleTemplateReferences = new ArrayList(); - } - this.roleTemplateReferences.add(roleTemplateReferences); - return this; - } - - /** - * Set the roleTemplateReferences. - * Existing roleTemplateReferences will be replaced. - * - * @param roleTemplateReferences the roleTemplateReferences - * @return the TemplateGrantRoleReferences builder - */ - public Builder roleTemplateReferences(List roleTemplateReferences) { - this.roleTemplateReferences = roleTemplateReferences; - return this; - } - } - - protected TemplateGrantRoleReferences() { } - - protected TemplateGrantRoleReferences(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleTemplateReferences, - "roleTemplateReferences cannot be null"); - roleTemplateReferences = builder.roleTemplateReferences; - } - - /** - * New builder. - * - * @return a TemplateGrantRoleReferences builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java deleted file mode 100644 index 6524b3645eb..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * TemplateGrantRoles. - */ -public class TemplateGrantRoles extends TemplateGrant { - - - /** - * Builder. - */ - public static class Builder { - private List roles; - - /** - * Instantiates a new Builder from an existing TemplateGrantRoles instance. - * - * @param templateGrantRoles the instance to initialize the Builder with - */ - public Builder(TemplateGrant templateGrantRoles) { - this.roles = templateGrantRoles.roles; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roles the roles - */ - public Builder(List roles) { - this.roles = roles; - } - - /** - * Builds a TemplateGrantRoles. - * - * @return the new TemplateGrantRoles instance - */ - public TemplateGrantRoles build() { - return new TemplateGrantRoles(this); - } - - /** - * Adds a new element to roles. - * - * @param roles the new element to be added - * @return the TemplateGrantRoles builder - */ - public Builder addRoles(Roles roles) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roles, - "roles cannot be null"); - if (this.roles == null) { - this.roles = new ArrayList(); - } - this.roles.add(roles); - return this; - } - - /** - * Set the roles. - * Existing roles will be replaced. - * - * @param roles the roles - * @return the TemplateGrantRoles builder - */ - public Builder roles(List roles) { - this.roles = roles; - return this; - } - } - - protected TemplateGrantRoles() { } - - protected TemplateGrantRoles(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, - "roles cannot be null"); - roles = builder.roles; - } - - /** - * New builder. - * - * @return a TemplateGrantRoles builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java deleted file mode 100644 index 41f112312cd..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The details of the IAM template that was used to create an enterprise-managed policy in your account. When returned, - * this indicates that the policy is created from and managed by a template in the root enterprise account. - */ -public class TemplateMetadata extends GenericModel { - - protected String id; - protected String version; - @SerializedName("assignment_id") - protected String assignmentId; - @SerializedName("root_id") - protected String rootId; - @SerializedName("root_version") - protected String rootVersion; - - protected TemplateMetadata() { } - - /** - * Gets the id. - * - * The policy template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the version. - * - * Template version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the assignmentId. - * - * Policy assignment ID. - * - * @return the assignmentId - */ - public String getAssignmentId() { - return assignmentId; - } - - /** - * Gets the rootId. - * - * Orchestrator template ID. - * - * @return the rootId - */ - public String getRootId() { - return rootId; - } - - /** - * Gets the rootVersion. - * - * Orchestrator template version. - * - * @return the rootVersion - */ - public String getRootVersion() { - return rootVersion; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java deleted file mode 100644 index 496b2e70e40..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java +++ /dev/null @@ -1,272 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the template's policy object. - */ -public class TemplatePolicy extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - protected String type; - protected String description; - protected V2PolicyResource resource; - protected V2PolicySubject subject; - protected String pattern; - protected V2PolicyRule rule; - protected TemplateControl control; - - /** - * Builder. - */ - public static class Builder { - private String type; - private String description; - private V2PolicyResource resource; - private V2PolicySubject subject; - private String pattern; - private V2PolicyRule rule; - private TemplateControl control; - - /** - * Instantiates a new Builder from an existing TemplatePolicy instance. - * - * @param templatePolicy the instance to initialize the Builder with - */ - private Builder(TemplatePolicy templatePolicy) { - this.type = templatePolicy.type; - this.description = templatePolicy.description; - this.resource = templatePolicy.resource; - this.subject = templatePolicy.subject; - this.pattern = templatePolicy.pattern; - this.rule = templatePolicy.rule; - this.control = templatePolicy.control; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param type the type - */ - public Builder(String type) { - this.type = type; - } - - /** - * Builds a TemplatePolicy. - * - * @return the new TemplatePolicy instance - */ - public TemplatePolicy build() { - return new TemplatePolicy(this); - } - - /** - * Set the type. - * - * @param type the type - * @return the TemplatePolicy builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the TemplatePolicy builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the resource. - * - * @param resource the resource - * @return the TemplatePolicy builder - */ - public Builder resource(V2PolicyResource resource) { - this.resource = resource; - return this; - } - - /** - * Set the subject. - * - * @param subject the subject - * @return the TemplatePolicy builder - */ - public Builder subject(V2PolicySubject subject) { - this.subject = subject; - return this; - } - - /** - * Set the pattern. - * - * @param pattern the pattern - * @return the TemplatePolicy builder - */ - public Builder pattern(String pattern) { - this.pattern = pattern; - return this; - } - - /** - * Set the rule. - * - * @param rule the rule - * @return the TemplatePolicy builder - */ - public Builder rule(V2PolicyRule rule) { - this.rule = rule; - return this; - } - - /** - * Set the control. - * - * @param control the control - * @return the TemplatePolicy builder - */ - public Builder control(TemplateControl control) { - this.control = control; - return this; - } - } - - protected TemplatePolicy() { } - - protected TemplatePolicy(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - type = builder.type; - description = builder.description; - resource = builder.resource; - subject = builder.subject; - pattern = builder.pattern; - rule = builder.rule; - control = builder.control; - } - - /** - * New builder. - * - * @return a TemplatePolicy builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. This is shown in child accounts when an access group or trusted profile template uses - * the policy template to assign access. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource resource() { - return resource; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject subject() { - return subject; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String pattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule rule() { - return rule; - } - - /** - * Gets the control. - * - * Specifies the type of access that is granted by the policy. - * - * @return the control - */ - public TemplateControl control() { - return control; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java deleted file mode 100644 index b76beb3bddb..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The role properties that are created in an action resource when the template is assigned. - */ -public class TemplateRole extends GenericModel { - - @SerializedName("display_name") - protected String displayName; - @SerializedName("service_name") - protected String serviceName; - protected String description; - protected List actions; - - /** - * Builder. - */ - public static class Builder { - private String displayName; - private String serviceName; - private String description; - private List actions; - - /** - * Instantiates a new Builder from an existing TemplateRole instance. - * - * @param templateRole the instance to initialize the Builder with - */ - private Builder(TemplateRole templateRole) { - this.displayName = templateRole.displayName; - this.serviceName = templateRole.serviceName; - this.description = templateRole.description; - this.actions = templateRole.actions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param displayName the displayName - * @param actions the actions - */ - public Builder(String displayName, List actions) { - this.displayName = displayName; - this.actions = actions; - } - - /** - * Builds a TemplateRole. - * - * @return the new TemplateRole instance - */ - public TemplateRole build() { - return new TemplateRole(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the TemplateRole builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the TemplateRole builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the TemplateRole builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the TemplateRole builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the TemplateRole builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - } - - protected TemplateRole() { } - - protected TemplateRole(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - displayName = builder.displayName; - serviceName = builder.serviceName; - description = builder.description; - actions = builder.actions; - } - - /** - * New builder. - * - * @return a TemplateRole builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the serviceName. - * - * The service name that the role refers. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the description. - * - * Description of the role. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. - * - * @return the actions - */ - public List actions() { - return actions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java deleted file mode 100644 index caf2f737b55..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updateActionControlAssignment options. - */ -public class UpdateActionControlAssignmentOptions extends GenericModel { - - protected String assignmentId; - protected String ifMatch; - protected String templateVersion; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - private String ifMatch; - private String templateVersion; - - /** - * Instantiates a new Builder from an existing UpdateActionControlAssignmentOptions instance. - * - * @param updateActionControlAssignmentOptions the instance to initialize the Builder with - */ - private Builder(UpdateActionControlAssignmentOptions updateActionControlAssignmentOptions) { - this.assignmentId = updateActionControlAssignmentOptions.assignmentId; - this.ifMatch = updateActionControlAssignmentOptions.ifMatch; - this.templateVersion = updateActionControlAssignmentOptions.templateVersion; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - * @param ifMatch the ifMatch - * @param templateVersion the templateVersion - */ - public Builder(String assignmentId, String ifMatch, String templateVersion) { - this.assignmentId = assignmentId; - this.ifMatch = ifMatch; - this.templateVersion = templateVersion; - } - - /** - * Builds a UpdateActionControlAssignmentOptions. - * - * @return the new UpdateActionControlAssignmentOptions instance - */ - public UpdateActionControlAssignmentOptions build() { - return new UpdateActionControlAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the UpdateActionControlAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdateActionControlAssignmentOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the UpdateActionControlAssignmentOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - } - - protected UpdateActionControlAssignmentOptions() { } - - protected UpdateActionControlAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId 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.templateVersion, - "templateVersion cannot be null"); - assignmentId = builder.assignmentId; - ifMatch = builder.ifMatch; - templateVersion = builder.templateVersion; - } - - /** - * New builder. - * - * @return a UpdateActionControlAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Action control template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating an action control assignment and must match the Etag value of the existing action - * control assignment. The Etag can be retrieved using the GET /v1/action_control_assignments/{assignment_id} API and - * looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the templateVersion. - * - * The version number of the template used to identify different versions of same template. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java deleted file mode 100644 index 869eb357802..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updatePolicyAssignment options. - */ -public class UpdatePolicyAssignmentOptions extends GenericModel { - - protected String assignmentId; - protected String version; - protected String ifMatch; - protected String templateVersion; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - private String version; - private String ifMatch; - private String templateVersion; - - /** - * Instantiates a new Builder from an existing UpdatePolicyAssignmentOptions instance. - * - * @param updatePolicyAssignmentOptions the instance to initialize the Builder with - */ - private Builder(UpdatePolicyAssignmentOptions updatePolicyAssignmentOptions) { - this.assignmentId = updatePolicyAssignmentOptions.assignmentId; - this.version = updatePolicyAssignmentOptions.version; - this.ifMatch = updatePolicyAssignmentOptions.ifMatch; - this.templateVersion = updatePolicyAssignmentOptions.templateVersion; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - * @param version the version - * @param ifMatch the ifMatch - * @param templateVersion the templateVersion - */ - public Builder(String assignmentId, String version, String ifMatch, String templateVersion) { - this.assignmentId = assignmentId; - this.version = version; - this.ifMatch = ifMatch; - this.templateVersion = templateVersion; - } - - /** - * Builds a UpdatePolicyAssignmentOptions. - * - * @return the new UpdatePolicyAssignmentOptions instance - */ - public UpdatePolicyAssignmentOptions build() { - return new UpdatePolicyAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the UpdatePolicyAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the UpdatePolicyAssignmentOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdatePolicyAssignmentOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the UpdatePolicyAssignmentOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - } - - protected UpdatePolicyAssignmentOptions() { } - - protected UpdatePolicyAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templateVersion, - "templateVersion cannot be null"); - assignmentId = builder.assignmentId; - version = builder.version; - ifMatch = builder.ifMatch; - templateVersion = builder.templateVersion; - } - - /** - * New builder. - * - * @return a UpdatePolicyAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * The policy template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } - - /** - * Gets the version. - * - * specify version of response body format. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy assignment and must match the Etag value of the existing policy - * assignment. The Etag can be retrieved using the GET /v1/policy_assignments/{assignment_id} API and looking at the - * Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the templateVersion. - * - * The policy template version to update to. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java deleted file mode 100644 index a28b357641f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updatePolicyState options. - */ -public class UpdatePolicyStateOptions extends GenericModel { - - /** - * The policy state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String policyId; - protected String ifMatch; - protected String state; - - /** - * Builder. - */ - public static class Builder { - private String policyId; - private String ifMatch; - private String state; - - /** - * Instantiates a new Builder from an existing UpdatePolicyStateOptions instance. - * - * @param updatePolicyStateOptions the instance to initialize the Builder with - */ - private Builder(UpdatePolicyStateOptions updatePolicyStateOptions) { - this.policyId = updatePolicyStateOptions.policyId; - this.ifMatch = updatePolicyStateOptions.ifMatch; - this.state = updatePolicyStateOptions.state; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyId the policyId - * @param ifMatch the ifMatch - */ - public Builder(String policyId, String ifMatch) { - this.policyId = policyId; - this.ifMatch = ifMatch; - } - - /** - * Builds a UpdatePolicyStateOptions. - * - * @return the new UpdatePolicyStateOptions instance - */ - public UpdatePolicyStateOptions build() { - return new UpdatePolicyStateOptions(this); - } - - /** - * Set the policyId. - * - * @param policyId the policyId - * @return the UpdatePolicyStateOptions builder - */ - public Builder policyId(String policyId) { - this.policyId = policyId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdatePolicyStateOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the UpdatePolicyStateOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - } - - protected UpdatePolicyStateOptions() { } - - protected UpdatePolicyStateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, - "policyId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - policyId = builder.policyId; - ifMatch = builder.ifMatch; - state = builder.state; - } - - /** - * New builder. - * - * @return a UpdatePolicyStateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyId. - * - * The policy ID. - * - * @return the policyId - */ - public String policyId() { - return policyId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be - * retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the state. - * - * The policy state. - * - * @return the state - */ - public String state() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java deleted file mode 100644 index f10cba5fe93..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updateRoleAssignment options. - */ -public class UpdateRoleAssignmentOptions extends GenericModel { - - protected String assignmentId; - protected String ifMatch; - protected String templateVersion; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - private String ifMatch; - private String templateVersion; - - /** - * Instantiates a new Builder from an existing UpdateRoleAssignmentOptions instance. - * - * @param updateRoleAssignmentOptions the instance to initialize the Builder with - */ - private Builder(UpdateRoleAssignmentOptions updateRoleAssignmentOptions) { - this.assignmentId = updateRoleAssignmentOptions.assignmentId; - this.ifMatch = updateRoleAssignmentOptions.ifMatch; - this.templateVersion = updateRoleAssignmentOptions.templateVersion; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - * @param ifMatch the ifMatch - * @param templateVersion the templateVersion - */ - public Builder(String assignmentId, String ifMatch, String templateVersion) { - this.assignmentId = assignmentId; - this.ifMatch = ifMatch; - this.templateVersion = templateVersion; - } - - /** - * Builds a UpdateRoleAssignmentOptions. - * - * @return the new UpdateRoleAssignmentOptions instance - */ - public UpdateRoleAssignmentOptions build() { - return new UpdateRoleAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the UpdateRoleAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdateRoleAssignmentOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the UpdateRoleAssignmentOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - } - - protected UpdateRoleAssignmentOptions() { } - - protected UpdateRoleAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId 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.templateVersion, - "templateVersion cannot be null"); - assignmentId = builder.assignmentId; - ifMatch = builder.ifMatch; - templateVersion = builder.templateVersion; - } - - /** - * New builder. - * - * @return a UpdateRoleAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Role template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a role assignment and must match the Etag value of the existing role assignment. - * The Etag can be retrieved using the GET /v1/role_assignments/{assignment_id} API and looking at the Etag response - * header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the templateVersion. - * - * The version number of the template used to identify different versions of same template. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java deleted file mode 100644 index 3d9dbb43fb3..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updateSettings options. - */ -public class UpdateSettingsOptions extends GenericModel { - - protected String accountId; - protected String ifMatch; - protected ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String ifMatch; - private ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing UpdateSettingsOptions instance. - * - * @param updateSettingsOptions the instance to initialize the Builder with - */ - private Builder(UpdateSettingsOptions updateSettingsOptions) { - this.accountId = updateSettingsOptions.accountId; - this.ifMatch = updateSettingsOptions.ifMatch; - this.externalAccountIdentityInteraction = updateSettingsOptions.externalAccountIdentityInteraction; - this.acceptLanguage = updateSettingsOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - * @param ifMatch the ifMatch - */ - public Builder(String accountId, String ifMatch) { - this.accountId = accountId; - this.ifMatch = ifMatch; - } - - /** - * Builds a UpdateSettingsOptions. - * - * @return the new UpdateSettingsOptions instance - */ - public UpdateSettingsOptions build() { - return new UpdateSettingsOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the UpdateSettingsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdateSettingsOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the externalAccountIdentityInteraction. - * - * @param externalAccountIdentityInteraction the externalAccountIdentityInteraction - * @return the UpdateSettingsOptions builder - */ - public Builder externalAccountIdentityInteraction(ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction) { - this.externalAccountIdentityInteraction = externalAccountIdentityInteraction; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the UpdateSettingsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected UpdateSettingsOptions() { } - - protected UpdateSettingsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.accountId, - "accountId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - accountId = builder.accountId; - ifMatch = builder.ifMatch; - externalAccountIdentityInteraction = builder.externalAccountIdentityInteraction; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a UpdateSettingsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the settings belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating Access Management Account Settings and must match the Etag value of the existing - * Access Management Account Settings. The Etag can be retrieved using the GET - * /v1/accounts/{account_id}/settings/access_management API and looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the externalAccountIdentityInteraction. - * - * Update to how external accounts can interact in relation to the requested account. - * - * @return the externalAccountIdentityInteraction - */ - public ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction() { - return externalAccountIdentityInteraction; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java deleted file mode 100644 index fdae9e28c12..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * V2PoliciesPager can be used to simplify the use of the "listV2Policies" method. - */ -public class V2PoliciesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListV2PoliciesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected V2PoliciesPager() { } - - /** - * Constructs a new V2PoliciesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listV2Policies" method - * @param options the ListV2PoliciesOptions instance to be used to invoke the "listV2Policies" method - */ - public V2PoliciesPager(IamPolicyManagement client, ListV2PoliciesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<V2PolicyTemplateMetaData> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListV2PoliciesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - V2PolicyCollection result = client.listV2Policies(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getPolicies(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<V2PolicyTemplateMetaData> containing all results returned by the "listV2Policies" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java deleted file mode 100644 index 842a354b7b1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java +++ /dev/null @@ -1,247 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the policy. - */ -public class V2Policy extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - /** - * The policy state, either 'deleted' or 'active'. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String type; - protected String description; - protected V2PolicySubject subject; - protected V2PolicyResource resource; - protected String pattern; - protected V2PolicyRule rule; - protected String id; - protected String href; - protected ControlResponse control; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String state; - @SerializedName("last_permit_at") - protected String lastPermitAt; - @SerializedName("last_permit_frequency") - protected Long lastPermitFrequency; - - protected V2Policy() { } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject getSubject() { - return subject; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource getResource() { - return resource; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String getPattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule getRule() { - return rule; - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the policies API by policy ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the control. - * - * @return the control - */ - public ControlResponse getControl() { - return control; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the state. - * - * The policy state, either 'deleted' or 'active'. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the lastPermitAt. - * - * The optional last permit time of policy, when passing query parameter format=include_last_permit. - * - * @return the lastPermitAt - */ - public String getLastPermitAt() { - return lastPermitAt; - } - - /** - * Gets the lastPermitFrequency. - * - * The optional count of times that policy has provided a permit, when passing query parameter - * format=include_last_permit. - * - * @return the lastPermitFrequency - */ - public Long getLastPermitFrequency() { - return lastPermitFrequency; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java deleted file mode 100644 index d392025f8d8..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of policies. - */ -public class V2PolicyCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List policies; - - protected V2PolicyCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the policies. - * - * List of policies. - * - * @return the policies - */ - public List getPolicies() { - return policies; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java deleted file mode 100644 index caf8dd522a9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The resource attributes to which the policy grants access. - */ -public class V2PolicyResource extends GenericModel { - - protected List attributes; - protected List tags; - - /** - * Builder. - */ - public static class Builder { - private List attributes; - private List tags; - - /** - * Instantiates a new Builder from an existing V2PolicyResource instance. - * - * @param v2PolicyResource the instance to initialize the Builder with - */ - private Builder(V2PolicyResource v2PolicyResource) { - this.attributes = v2PolicyResource.attributes; - this.tags = v2PolicyResource.tags; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param attributes the attributes - */ - public Builder(List attributes) { - this.attributes = attributes; - } - - /** - * Builds a V2PolicyResource. - * - * @return the new V2PolicyResource instance - */ - public V2PolicyResource build() { - return new V2PolicyResource(this); - } - - /** - * Adds a new element to attributes. - * - * @param attributes the new element to be added - * @return the V2PolicyResource builder - */ - public Builder addAttributes(V2PolicyResourceAttribute attributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, - "attributes cannot be null"); - if (this.attributes == null) { - this.attributes = new ArrayList(); - } - this.attributes.add(attributes); - return this; - } - - /** - * Adds a new element to tags. - * - * @param tags the new element to be added - * @return the V2PolicyResource builder - */ - public Builder addTags(V2PolicyResourceTag tags) { - com.ibm.cloud.sdk.core.util.Validator.notNull(tags, - "tags cannot be null"); - if (this.tags == null) { - this.tags = new ArrayList(); - } - this.tags.add(tags); - return this; - } - - /** - * Set the attributes. - * Existing attributes will be replaced. - * - * @param attributes the attributes - * @return the V2PolicyResource builder - */ - public Builder attributes(List attributes) { - this.attributes = attributes; - return this; - } - - /** - * Set the tags. - * Existing tags will be replaced. - * - * @param tags the tags - * @return the V2PolicyResource builder - */ - public Builder tags(List tags) { - this.tags = tags; - return this; - } - } - - protected V2PolicyResource() { } - - protected V2PolicyResource(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, - "attributes cannot be null"); - attributes = builder.attributes; - tags = builder.tags; - } - - /** - * New builder. - * - * @return a V2PolicyResource builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the attributes. - * - * List of resource attributes to which the policy grants access. - * - * @return the attributes - */ - public List attributes() { - return attributes; - } - - /** - * Gets the tags. - * - * Optional list of resource tags to which the policy grants access. - * - * @return the tags - */ - public List tags() { - return tags; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java deleted file mode 100644 index 73e7cedd55e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Resource attribute to which the policy grants access. - */ -public class V2PolicyResourceAttribute extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - } - - protected String key; - protected String operator; - protected Object value; - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing V2PolicyResourceAttribute instance. - * - * @param v2PolicyResourceAttribute the instance to initialize the Builder with - */ - private Builder(V2PolicyResourceAttribute v2PolicyResourceAttribute) { - this.key = v2PolicyResourceAttribute.key; - this.operator = v2PolicyResourceAttribute.operator; - this.value = v2PolicyResourceAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a V2PolicyResourceAttribute. - * - * @return the new V2PolicyResourceAttribute instance - */ - public V2PolicyResourceAttribute build() { - return new V2PolicyResourceAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the V2PolicyResourceAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicyResourceAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the V2PolicyResourceAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected V2PolicyResourceAttribute() { } - - protected V2PolicyResourceAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a V2PolicyResourceAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the key. - * - * The name of a resource attribute. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java deleted file mode 100644 index bb32772b8dc..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A tag associated with a resource. - */ -public class V2PolicyResourceTag extends GenericModel { - - /** - * The operator of an access management tag. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - } - - protected String key; - protected String value; - protected String operator; - - /** - * Builder. - */ - public static class Builder { - private String key; - private String value; - private String operator; - - /** - * Instantiates a new Builder from an existing V2PolicyResourceTag instance. - * - * @param v2PolicyResourceTag the instance to initialize the Builder with - */ - private Builder(V2PolicyResourceTag v2PolicyResourceTag) { - this.key = v2PolicyResourceTag.key; - this.value = v2PolicyResourceTag.value; - this.operator = v2PolicyResourceTag.operator; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param value the value - * @param operator the operator - */ - public Builder(String key, String value, String operator) { - this.key = key; - this.value = value; - this.operator = operator; - } - - /** - * Builds a V2PolicyResourceTag. - * - * @return the new V2PolicyResourceTag instance - */ - public V2PolicyResourceTag build() { - return new V2PolicyResourceTag(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the V2PolicyResourceTag builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the V2PolicyResourceTag builder - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicyResourceTag builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - } - - protected V2PolicyResourceTag() { } - - protected V2PolicyResourceTag(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - key = builder.key; - value = builder.value; - operator = builder.operator; - } - - /** - * New builder. - * - * @return a V2PolicyResourceTag builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the key. - * - * The name of an access management tag. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the value. - * - * The value of an access management tag. - * - * @return the value - */ - public String value() { - return value; - } - - /** - * Gets the operator. - * - * The operator of an access management tag. - * - * @return the operator - */ - public String operator() { - return operator; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java deleted file mode 100644 index 13a9f5fbd94..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Additional access conditions associated with the policy. - * - * Classes which extend this class: - * - V2PolicyRuleRuleAttribute - * - V2PolicyRuleRuleWithNestedConditions - */ -public class V2PolicyRule extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - protected String key; - protected String operator; - protected Object value; - protected List conditions; - - protected V2PolicyRule() { } - - /** - * Gets the key. - * - * The name of an attribute. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } - - /** - * Gets the conditions. - * - * List of conditions associated with a policy. For example, time-based conditions that grant access over a certain - * time period. - * - * @return the conditions - */ - public List conditions() { - return conditions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java deleted file mode 100644 index c20b3a8cb0c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * Rule that specifies additional access that is granted (For example, time-based condition). - */ -public class V2PolicyRuleRuleAttribute extends V2PolicyRule { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing V2PolicyRuleRuleAttribute instance. - * - * @param v2PolicyRuleRuleAttribute the instance to initialize the Builder with - */ - public Builder(V2PolicyRule v2PolicyRuleRuleAttribute) { - this.key = v2PolicyRuleRuleAttribute.key; - this.operator = v2PolicyRuleRuleAttribute.operator; - this.value = v2PolicyRuleRuleAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a V2PolicyRuleRuleAttribute. - * - * @return the new V2PolicyRuleRuleAttribute instance - */ - public V2PolicyRuleRuleAttribute build() { - return new V2PolicyRuleRuleAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the V2PolicyRuleRuleAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicyRuleRuleAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the V2PolicyRuleRuleAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected V2PolicyRuleRuleAttribute() { } - - protected V2PolicyRuleRuleAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a V2PolicyRuleRuleAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java deleted file mode 100644 index 8d6e57920f9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * Rule that specifies additional access that is granted (for example, time-based condition) accross multiple - * conditions. - */ -public class V2PolicyRuleRuleWithNestedConditions extends V2PolicyRule { - - /** - * Operator to evaluate conditions. - */ - public interface Operator { - /** and. */ - String AND = "and"; - /** or. */ - String OR = "or"; - } - - - /** - * Builder. - */ - public static class Builder { - private String operator; - private List conditions; - - /** - * Instantiates a new Builder from an existing V2PolicyRuleRuleWithNestedConditions instance. - * - * @param v2PolicyRuleRuleWithNestedConditions the instance to initialize the Builder with - */ - public Builder(V2PolicyRule v2PolicyRuleRuleWithNestedConditions) { - this.operator = v2PolicyRuleRuleWithNestedConditions.operator; - this.conditions = v2PolicyRuleRuleWithNestedConditions.conditions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param operator the operator - * @param conditions the conditions - */ - public Builder(String operator, List conditions) { - this.operator = operator; - this.conditions = conditions; - } - - /** - * Builds a V2PolicyRuleRuleWithNestedConditions. - * - * @return the new V2PolicyRuleRuleWithNestedConditions instance - */ - public V2PolicyRuleRuleWithNestedConditions build() { - return new V2PolicyRuleRuleWithNestedConditions(this); - } - - /** - * Adds a new element to conditions. - * - * @param conditions the new element to be added - * @return the V2PolicyRuleRuleWithNestedConditions builder - */ - public Builder addConditions(NestedCondition conditions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(conditions, - "conditions cannot be null"); - if (this.conditions == null) { - this.conditions = new ArrayList(); - } - this.conditions.add(conditions); - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicyRuleRuleWithNestedConditions builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the conditions. - * Existing conditions will be replaced. - * - * @param conditions the conditions - * @return the V2PolicyRuleRuleWithNestedConditions builder - */ - public Builder conditions(List conditions) { - this.conditions = conditions; - return this; - } - } - - protected V2PolicyRuleRuleWithNestedConditions() { } - - protected V2PolicyRuleRuleWithNestedConditions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.conditions, - "conditions cannot be null"); - operator = builder.operator; - conditions = builder.conditions; - } - - /** - * New builder. - * - * @return a V2PolicyRuleRuleWithNestedConditions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java deleted file mode 100644 index 891513fd45a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The subject attributes for whom the policy grants access. - */ -public class V2PolicySubject extends GenericModel { - - protected List attributes; - - /** - * Builder. - */ - public static class Builder { - private List attributes; - - /** - * Instantiates a new Builder from an existing V2PolicySubject instance. - * - * @param v2PolicySubject the instance to initialize the Builder with - */ - private Builder(V2PolicySubject v2PolicySubject) { - this.attributes = v2PolicySubject.attributes; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param attributes the attributes - */ - public Builder(List attributes) { - this.attributes = attributes; - } - - /** - * Builds a V2PolicySubject. - * - * @return the new V2PolicySubject instance - */ - public V2PolicySubject build() { - return new V2PolicySubject(this); - } - - /** - * Adds a new element to attributes. - * - * @param attributes the new element to be added - * @return the V2PolicySubject builder - */ - public Builder addAttributes(V2PolicySubjectAttribute attributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, - "attributes cannot be null"); - if (this.attributes == null) { - this.attributes = new ArrayList(); - } - this.attributes.add(attributes); - return this; - } - - /** - * Set the attributes. - * Existing attributes will be replaced. - * - * @param attributes the attributes - * @return the V2PolicySubject builder - */ - public Builder attributes(List attributes) { - this.attributes = attributes; - return this; - } - } - - protected V2PolicySubject() { } - - protected V2PolicySubject(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, - "attributes cannot be null"); - attributes = builder.attributes; - } - - /** - * New builder. - * - * @return a V2PolicySubject builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the attributes. - * - * List of subject attributes associated with policy. - * - * @return the attributes - */ - public List attributes() { - return attributes; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java deleted file mode 100644 index c90606429df..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Subject attribute for whom the policy grants access. - */ -public class V2PolicySubjectAttribute extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - } - - protected String key; - protected String operator; - protected Object value; - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing V2PolicySubjectAttribute instance. - * - * @param v2PolicySubjectAttribute the instance to initialize the Builder with - */ - private Builder(V2PolicySubjectAttribute v2PolicySubjectAttribute) { - this.key = v2PolicySubjectAttribute.key; - this.operator = v2PolicySubjectAttribute.operator; - this.value = v2PolicySubjectAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a V2PolicySubjectAttribute. - * - * @return the new V2PolicySubjectAttribute instance - */ - public V2PolicySubjectAttribute build() { - return new V2PolicySubjectAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the V2PolicySubjectAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicySubjectAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the V2PolicySubjectAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected V2PolicySubjectAttribute() { } - - protected V2PolicySubjectAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a V2PolicySubjectAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the key. - * - * The name of a subject attribute. For example, iam_id, access_group_id. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java deleted file mode 100644 index 720f7b57d4e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the policy. - */ -public class V2PolicyTemplateMetaData extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - /** - * The policy state, either 'deleted' or 'active'. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String type; - protected String description; - protected V2PolicySubject subject; - protected V2PolicyResource resource; - protected String pattern; - protected V2PolicyRule rule; - protected String id; - protected String href; - protected ControlResponse control; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String state; - @SerializedName("last_permit_at") - protected String lastPermitAt; - @SerializedName("last_permit_frequency") - protected Long lastPermitFrequency; - protected TemplateMetadata template; - - protected V2PolicyTemplateMetaData() { } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject getSubject() { - return subject; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource getResource() { - return resource; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String getPattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule getRule() { - return rule; - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the policies API by policy ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the control. - * - * @return the control - */ - public ControlResponse getControl() { - return control; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the state. - * - * The policy state, either 'deleted' or 'active'. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the lastPermitAt. - * - * The optional last permit time of policy, when passing query parameter format=include_last_permit. - * - * @return the lastPermitAt - */ - public String getLastPermitAt() { - return lastPermitAt; - } - - /** - * Gets the lastPermitFrequency. - * - * The optional count of times that policy has provided a permit, when passing query parameter - * format=include_last_permit. - * - * @return the lastPermitFrequency - */ - public Long getLastPermitFrequency() { - return lastPermitFrequency; - } - - /** - * Gets the template. - * - * The details of the IAM template that was used to create an enterprise-managed policy in your account. When - * returned, this indicates that the policy is created from and managed by a template in the root enterprise account. - * - * @return the template - */ - public TemplateMetadata getTemplate() { - return template; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java deleted file mode 100644 index 63a87389391..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * (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. - */ - -/** - * IAM Policy Management v1. - */ -package com.ibm.cloud.platform_services.iam_policy_management.v1; diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java deleted file mode 100644 index b38933306a6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java +++ /dev/null @@ -1,5007 +0,0 @@ -/* - * (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_policy_management.v1; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplatesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponse; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControlWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedCondition; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleWithConditions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PoliciesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplatesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoleReferences; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PoliciesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRule; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleWithNestedConditions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.utils.TestUtilities; -import com.ibm.cloud.sdk.core.http.Response; -import com.ibm.cloud.sdk.core.security.Authenticator; -import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import okhttp3.mockwebserver.MockResponse; -import okhttp3.mockwebserver.MockWebServer; -import okhttp3.mockwebserver.RecordedRequest; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; -import static org.testng.Assert.*; - -/** - * Unit test class for the IamPolicyManagement service. - */ -public class IamPolicyManagementTest { - - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - protected MockWebServer server; - protected IamPolicyManagement iamPolicyManagementService; - - // Construct the service with a null authenticator (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testConstructorWithNullAuthenticator() throws Throwable { - final String serviceName = "testService"; - new IamPolicyManagement(serviceName, null); - } - - // Test the listPolicies operation with a valid options model parameter - @Test - public void testListPoliciesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policies\": [{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}]}"; - String listPoliciesPath = "/v1/policies"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListPoliciesOptions model - ListPoliciesOptions listPoliciesOptionsModel = new ListPoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .tagName("testString") - .tagValue("testString") - .sort("id") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listPolicies() with a valid options model and verify the result - Response response = iamPolicyManagementService.listPolicies(listPoliciesOptionsModel).execute(); - assertNotNull(response); - PolicyCollection 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, listPoliciesPath); - // 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("access_group_id"), "testString"); - assertEquals(query.get("type"), "access"); - assertEquals(query.get("service_type"), "service"); - assertEquals(query.get("tag_name"), "testString"); - assertEquals(query.get("tag_value"), "testString"); - assertEquals(query.get("sort"), "id"); - assertEquals(query.get("format"), "include_last_permit"); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listPolicies operation with and without retries enabled - @Test - public void testListPoliciesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListPoliciesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListPoliciesWOptions(); - } - - // Test the listPolicies operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPoliciesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listPolicies(null).execute(); - } - - // Test the listPolicies operation using the PoliciesPager.getNext() method - @Test - public void testListPoliciesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPoliciesOptions listPoliciesOptions = new ListPoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .tagName("testString") - .tagValue("testString") - .sort("id") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - PoliciesPager pager = new PoliciesPager(iamPolicyManagementService, listPoliciesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listPolicies operation using the PoliciesPager.getAll() method - @Test - public void testListPoliciesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPoliciesOptions listPoliciesOptions = new ListPoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .tagName("testString") - .tagValue("testString") - .sort("id") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - PoliciesPager pager = new PoliciesPager(iamPolicyManagementService, listPoliciesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createPolicy operation with a valid options model parameter - @Test - public void testCreatePolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; - String createPolicyPath = "/v1/policies"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the SubjectAttribute model - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - - // Construct an instance of the PolicySubject model - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - - // Construct an instance of the PolicyRole model - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the ResourceAttribute model - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - - // Construct an instance of the ResourceTag model - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - - // Construct an instance of the PolicyResource model - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - - // Construct an instance of the CreatePolicyOptions model - CreatePolicyOptions createPolicyOptionsModel = new CreatePolicyOptions.Builder() - .type("testString") - .subjects(java.util.Arrays.asList(policySubjectModel)) - .roles(java.util.Arrays.asList(policyRoleModel)) - .resources(java.util.Arrays.asList(policyResourceModel)) - .description("testString") - .acceptLanguage("default") - .build(); - - // Invoke createPolicy() with a valid options model and verify the result - Response response = iamPolicyManagementService.createPolicy(createPolicyOptionsModel).execute(); - assertNotNull(response); - Policy 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createPolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createPolicy operation with and without retries enabled - @Test - public void testCreatePolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreatePolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreatePolicyWOptions(); - } - - // Test the createPolicy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createPolicy(null).execute(); - } - - // Test the replacePolicy operation with a valid options model parameter - @Test - public void testReplacePolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; - String replacePolicyPath = "/v1/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the SubjectAttribute model - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - - // Construct an instance of the PolicySubject model - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - - // Construct an instance of the PolicyRole model - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the ResourceAttribute model - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - - // Construct an instance of the ResourceTag model - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - - // Construct an instance of the PolicyResource model - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - - // Construct an instance of the ReplacePolicyOptions model - ReplacePolicyOptions replacePolicyOptionsModel = new ReplacePolicyOptions.Builder() - .policyId("testString") - .ifMatch("testString") - .type("testString") - .subjects(java.util.Arrays.asList(policySubjectModel)) - .roles(java.util.Arrays.asList(policyRoleModel)) - .resources(java.util.Arrays.asList(policyResourceModel)) - .description("testString") - .build(); - - // Invoke replacePolicy() with a valid options model and verify the result - Response response = iamPolicyManagementService.replacePolicy(replacePolicyOptionsModel).execute(); - assertNotNull(response); - Policy 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, replacePolicyPath); - // 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 replacePolicy operation with and without retries enabled - @Test - public void testReplacePolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplacePolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplacePolicyWOptions(); - } - - // Test the replacePolicy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplacePolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replacePolicy(null).execute(); - } - - // Test the getPolicy operation with a valid options model parameter - @Test - public void testGetPolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}"; - String getPolicyPath = "/v1/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetPolicyOptions model - GetPolicyOptions getPolicyOptionsModel = new GetPolicyOptions.Builder() - .policyId("testString") - .build(); - - // Invoke getPolicy() with a valid options model and verify the result - Response response = iamPolicyManagementService.getPolicy(getPolicyOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateMetaData 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, getPolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getPolicy operation with and without retries enabled - @Test - public void testGetPolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetPolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetPolicyWOptions(); - } - - // Test the getPolicy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getPolicy(null).execute(); - } - - // Test the deletePolicy operation with a valid options model parameter - @Test - public void testDeletePolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deletePolicyPath = "/v1/policies/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeletePolicyOptions model - DeletePolicyOptions deletePolicyOptionsModel = new DeletePolicyOptions.Builder() - .policyId("testString") - .build(); - - // Invoke deletePolicy() with a valid options model and verify the result - Response response = iamPolicyManagementService.deletePolicy(deletePolicyOptionsModel).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, deletePolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deletePolicy operation with and without retries enabled - @Test - public void testDeletePolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeletePolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeletePolicyWOptions(); - } - - // Test the deletePolicy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deletePolicy(null).execute(); - } - - // Test the updatePolicyState operation with a valid options model parameter - @Test - public void testUpdatePolicyStateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; - String updatePolicyStatePath = "/v1/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdatePolicyStateOptions model - UpdatePolicyStateOptions updatePolicyStateOptionsModel = new UpdatePolicyStateOptions.Builder() - .policyId("testString") - .ifMatch("testString") - .state("active") - .build(); - - // Invoke updatePolicyState() with a valid options model and verify the result - Response response = iamPolicyManagementService.updatePolicyState(updatePolicyStateOptionsModel).execute(); - assertNotNull(response); - Policy 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updatePolicyStatePath); - // 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 updatePolicyState operation with and without retries enabled - @Test - public void testUpdatePolicyStateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdatePolicyStateWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdatePolicyStateWOptions(); - } - - // Test the updatePolicyState operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdatePolicyStateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updatePolicyState(null).execute(); - } - - // Test the listRoles operation with a valid options model parameter - @Test - public void testListRolesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"custom_roles\": [{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}], \"service_roles\": [{\"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\"}], \"system_roles\": [{\"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\"}]}"; - String listRolesPath = "/v2/roles"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListRolesOptions model - ListRolesOptions listRolesOptionsModel = new ListRolesOptions.Builder() - .acceptLanguage("default") - .accountId("testString") - .serviceName("iam-groups") - .sourceServiceName("iam-groups") - .policyType("authorization") - .serviceGroupId("IAM") - .build(); - - // Invoke listRoles() with a valid options model and verify the result - Response response = iamPolicyManagementService.listRoles(listRolesOptionsModel).execute(); - assertNotNull(response); - RoleCollection 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, listRolesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("service_name"), "iam-groups"); - assertEquals(query.get("source_service_name"), "iam-groups"); - assertEquals(query.get("policy_type"), "authorization"); - assertEquals(query.get("service_group_id"), "IAM"); - } - - // Test the listRoles operation with and without retries enabled - @Test - public void testListRolesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListRolesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListRolesWOptions(); - } - - // Test the createRole operation with a valid options model parameter - @Test - public void testCreateRoleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; - String createRolePath = "/v2/roles"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the CreateRoleOptions model - CreateRoleOptions createRoleOptionsModel = new CreateRoleOptions.Builder() - .displayName("testString") - .actions(java.util.Arrays.asList("testString")) - .name("Developer") - .accountId("testString") - .serviceName("iam-groups") - .description("testString") - .acceptLanguage("default") - .build(); - - // Invoke createRole() with a valid options model and verify the result - Response response = iamPolicyManagementService.createRole(createRoleOptionsModel).execute(); - assertNotNull(response); - CustomRole 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createRolePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createRole operation with and without retries enabled - @Test - public void testCreateRoleWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateRoleWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateRoleWOptions(); - } - - // Test the createRole operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createRole(null).execute(); - } - - // Test the replaceRole operation with a valid options model parameter - @Test - public void testReplaceRoleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; - String replaceRolePath = "/v2/roles/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ReplaceRoleOptions model - ReplaceRoleOptions replaceRoleOptionsModel = new ReplaceRoleOptions.Builder() - .roleId("testString") - .ifMatch("testString") - .displayName("testString") - .actions(java.util.Arrays.asList("testString")) - .description("testString") - .build(); - - // Invoke replaceRole() with a valid options model and verify the result - Response response = iamPolicyManagementService.replaceRole(replaceRoleOptionsModel).execute(); - assertNotNull(response); - CustomRole 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, replaceRolePath); - // 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 replaceRole operation with and without retries enabled - @Test - public void testReplaceRoleWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplaceRoleWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplaceRoleWOptions(); - } - - // Test the replaceRole operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceRoleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replaceRole(null).execute(); - } - - // Test the getRole operation with a valid options model parameter - @Test - public void testGetRoleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; - String getRolePath = "/v2/roles/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetRoleOptions model - GetRoleOptions getRoleOptionsModel = new GetRoleOptions.Builder() - .roleId("testString") - .build(); - - // Invoke getRole() with a valid options model and verify the result - Response response = iamPolicyManagementService.getRole(getRoleOptionsModel).execute(); - assertNotNull(response); - CustomRole 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, getRolePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getRole operation with and without retries enabled - @Test - public void testGetRoleWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetRoleWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetRoleWOptions(); - } - - // Test the getRole operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getRole(null).execute(); - } - - // Test the deleteRole operation with a valid options model parameter - @Test - public void testDeleteRoleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteRolePath = "/v2/roles/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteRoleOptions model - DeleteRoleOptions deleteRoleOptionsModel = new DeleteRoleOptions.Builder() - .roleId("testString") - .build(); - - // Invoke deleteRole() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteRole(deleteRoleOptionsModel).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, deleteRolePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteRole operation with and without retries enabled - @Test - public void testDeleteRoleWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteRoleWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteRoleWOptions(); - } - - // Test the deleteRole operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteRole(null).execute(); - } - - // Test the listV2Policies operation with a valid options model parameter - @Test - public void testListV2PoliciesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policies\": [{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19, \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}]}"; - String listV2PoliciesPath = "/v2/policies"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListV2PoliciesOptions model - ListV2PoliciesOptions listV2PoliciesOptionsModel = new ListV2PoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .serviceName("testString") - .serviceGroupId("testString") - .sort("testString") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listV2Policies() with a valid options model and verify the result - Response response = iamPolicyManagementService.listV2Policies(listV2PoliciesOptionsModel).execute(); - assertNotNull(response); - V2PolicyCollection 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, listV2PoliciesPath); - // 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("access_group_id"), "testString"); - assertEquals(query.get("type"), "access"); - assertEquals(query.get("service_type"), "service"); - assertEquals(query.get("service_name"), "testString"); - assertEquals(query.get("service_group_id"), "testString"); - assertEquals(query.get("sort"), "testString"); - assertEquals(query.get("format"), "include_last_permit"); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listV2Policies operation with and without retries enabled - @Test - public void testListV2PoliciesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListV2PoliciesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListV2PoliciesWOptions(); - } - - // Test the listV2Policies operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListV2PoliciesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listV2Policies(null).execute(); - } - - // Test the listV2Policies operation using the V2PoliciesPager.getNext() method - @Test - public void testListV2PoliciesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListV2PoliciesOptions listV2PoliciesOptions = new ListV2PoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .serviceName("testString") - .serviceGroupId("testString") - .sort("testString") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - V2PoliciesPager pager = new V2PoliciesPager(iamPolicyManagementService, listV2PoliciesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listV2Policies operation using the V2PoliciesPager.getAll() method - @Test - public void testListV2PoliciesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListV2PoliciesOptions listV2PoliciesOptions = new ListV2PoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .serviceName("testString") - .serviceGroupId("testString") - .sort("testString") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - V2PoliciesPager pager = new V2PoliciesPager(iamPolicyManagementService, listV2PoliciesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createV2Policy operation with a valid options model parameter - @Test - public void testCreateV2PolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19}"; - String createV2PolicyPath = "/v2/policies"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the Grant model - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the Control model - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the CreateV2PolicyOptions model - CreateV2PolicyOptions createV2PolicyOptionsModel = new CreateV2PolicyOptions.Builder() - .control(controlModel) - .type("access") - .description("testString") - .subject(v2PolicySubjectModel) - .resource(v2PolicyResourceModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .acceptLanguage("default") - .build(); - - // Invoke createV2Policy() with a valid options model and verify the result - Response response = iamPolicyManagementService.createV2Policy(createV2PolicyOptionsModel).execute(); - assertNotNull(response); - V2Policy 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createV2PolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createV2Policy operation with and without retries enabled - @Test - public void testCreateV2PolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateV2PolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateV2PolicyWOptions(); - } - - // Test the createV2Policy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateV2PolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createV2Policy(null).execute(); - } - - // Test the replaceV2Policy operation with a valid options model parameter - @Test - public void testReplaceV2PolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19}"; - String replaceV2PolicyPath = "/v2/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the Grant model - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the Control model - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the ReplaceV2PolicyOptions model - ReplaceV2PolicyOptions replaceV2PolicyOptionsModel = new ReplaceV2PolicyOptions.Builder() - .id("testString") - .ifMatch("testString") - .control(controlModel) - .type("access") - .description("testString") - .subject(v2PolicySubjectModel) - .resource(v2PolicyResourceModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .build(); - - // Invoke replaceV2Policy() with a valid options model and verify the result - Response response = iamPolicyManagementService.replaceV2Policy(replaceV2PolicyOptionsModel).execute(); - assertNotNull(response); - V2Policy 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, replaceV2PolicyPath); - // 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 replaceV2Policy operation with and without retries enabled - @Test - public void testReplaceV2PolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplaceV2PolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplaceV2PolicyWOptions(); - } - - // Test the replaceV2Policy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceV2PolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replaceV2Policy(null).execute(); - } - - // Test the getV2Policy operation with a valid options model parameter - @Test - public void testGetV2PolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19, \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}"; - String getV2PolicyPath = "/v2/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetV2PolicyOptions model - GetV2PolicyOptions getV2PolicyOptionsModel = new GetV2PolicyOptions.Builder() - .id("testString") - .format("include_last_permit") - .build(); - - // Invoke getV2Policy() with a valid options model and verify the result - Response response = iamPolicyManagementService.getV2Policy(getV2PolicyOptionsModel).execute(); - assertNotNull(response); - V2PolicyTemplateMetaData 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, getV2PolicyPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("format"), "include_last_permit"); - } - - // Test the getV2Policy operation with and without retries enabled - @Test - public void testGetV2PolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetV2PolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetV2PolicyWOptions(); - } - - // Test the getV2Policy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetV2PolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getV2Policy(null).execute(); - } - - // Test the deleteV2Policy operation with a valid options model parameter - @Test - public void testDeleteV2PolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteV2PolicyPath = "/v2/policies/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteV2PolicyOptions model - DeleteV2PolicyOptions deleteV2PolicyOptionsModel = new DeleteV2PolicyOptions.Builder() - .id("testString") - .build(); - - // Invoke deleteV2Policy() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteV2Policy(deleteV2PolicyOptionsModel).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, deleteV2PolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteV2Policy operation with and without retries enabled - @Test - public void testDeleteV2PolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteV2PolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteV2PolicyWOptions(); - } - - // Test the deleteV2Policy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteV2PolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteV2Policy(null).execute(); - } - - // Test the listPolicyTemplates operation with a valid options model parameter - @Test - public void testListPolicyTemplatesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policy_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; - String listPolicyTemplatesPath = "/v1/policy_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListPolicyTemplatesOptions model - ListPolicyTemplatesOptions listPolicyTemplatesOptionsModel = new ListPolicyTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .state("active") - .name("testString") - .policyServiceType("service") - .policyServiceName("testString") - .policyServiceGroupId("testString") - .policyType("access") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listPolicyTemplates() with a valid options model and verify the result - Response response = iamPolicyManagementService.listPolicyTemplates(listPolicyTemplatesOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateCollection 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, listPolicyTemplatesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("state"), "active"); - assertEquals(query.get("name"), "testString"); - assertEquals(query.get("policy_service_type"), "service"); - assertEquals(query.get("policy_service_name"), "testString"); - assertEquals(query.get("policy_service_group_id"), "testString"); - assertEquals(query.get("policy_type"), "access"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listPolicyTemplates operation with and without retries enabled - @Test - public void testListPolicyTemplatesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListPolicyTemplatesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListPolicyTemplatesWOptions(); - } - - // Test the listPolicyTemplates operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyTemplatesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listPolicyTemplates(null).execute(); - } - - // Test the listPolicyTemplates operation using the PolicyTemplatesPager.getNext() method - @Test - public void testListPolicyTemplatesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyTemplatesOptions listPolicyTemplatesOptions = new ListPolicyTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .state("active") - .name("testString") - .policyServiceType("service") - .policyServiceName("testString") - .policyServiceGroupId("testString") - .policyType("access") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - PolicyTemplatesPager pager = new PolicyTemplatesPager(iamPolicyManagementService, listPolicyTemplatesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listPolicyTemplates operation using the PolicyTemplatesPager.getAll() method - @Test - public void testListPolicyTemplatesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyTemplatesOptions listPolicyTemplatesOptions = new ListPolicyTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .state("active") - .name("testString") - .policyServiceType("service") - .policyServiceName("testString") - .policyServiceGroupId("testString") - .policyType("access") - .limit(Long.valueOf("10")) - .build(); - - PolicyTemplatesPager pager = new PolicyTemplatesPager(iamPolicyManagementService, listPolicyTemplatesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createPolicyTemplate operation with a valid options model parameter - @Test - public void testCreatePolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; - String createPolicyTemplatePath = "/v1/policy_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the TemplateGrantRoles model - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the TemplateControl model - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - - // Construct an instance of the TemplatePolicy model - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - - // Construct an instance of the CreatePolicyTemplateOptions model - CreatePolicyTemplateOptions createPolicyTemplateOptionsModel = new CreatePolicyTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .policy(templatePolicyModel) - .description("testString") - .committed(true) - .acceptLanguage("default") - .build(); - - // Invoke createPolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.createPolicyTemplate(createPolicyTemplateOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateLimitData 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createPolicyTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createPolicyTemplate operation with and without retries enabled - @Test - public void testCreatePolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreatePolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreatePolicyTemplateWOptions(); - } - - // Test the createPolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createPolicyTemplate(null).execute(); - } - - // Test the getPolicyTemplate operation with a valid options model parameter - @Test - public void testGetPolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String getPolicyTemplatePath = "/v1/policy_templates/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetPolicyTemplateOptions model - GetPolicyTemplateOptions getPolicyTemplateOptionsModel = new GetPolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .state("active") - .build(); - - // Invoke getPolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.getPolicyTemplate(getPolicyTemplateOptionsModel).execute(); - assertNotNull(response); - PolicyTemplate 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, getPolicyTemplatePath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - } - - // Test the getPolicyTemplate operation with and without retries enabled - @Test - public void testGetPolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetPolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetPolicyTemplateWOptions(); - } - - // Test the getPolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getPolicyTemplate(null).execute(); - } - - // Test the deletePolicyTemplate operation with a valid options model parameter - @Test - public void testDeletePolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deletePolicyTemplatePath = "/v1/policy_templates/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeletePolicyTemplateOptions model - DeletePolicyTemplateOptions deletePolicyTemplateOptionsModel = new DeletePolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .build(); - - // Invoke deletePolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.deletePolicyTemplate(deletePolicyTemplateOptionsModel).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, deletePolicyTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deletePolicyTemplate operation with and without retries enabled - @Test - public void testDeletePolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeletePolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeletePolicyTemplateWOptions(); - } - - // Test the deletePolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deletePolicyTemplate(null).execute(); - } - - // Test the createPolicyTemplateVersion operation with a valid options model parameter - @Test - public void testCreatePolicyTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; - String createPolicyTemplateVersionPath = "/v1/policy_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the TemplateGrantRoles model - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the TemplateControl model - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - - // Construct an instance of the TemplatePolicy model - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - - // Construct an instance of the CreatePolicyTemplateVersionOptions model - CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptionsModel = new CreatePolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .policy(templatePolicyModel) - .name("testString") - .description("testString") - .committed(true) - .build(); - - // Invoke createPolicyTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.createPolicyTemplateVersion(createPolicyTemplateVersionOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateLimitData 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createPolicyTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createPolicyTemplateVersion operation with and without retries enabled - @Test - public void testCreatePolicyTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreatePolicyTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreatePolicyTemplateVersionWOptions(); - } - - // Test the createPolicyTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createPolicyTemplateVersion(null).execute(); - } - - // Test the listPolicyTemplateVersions operation with a valid options model parameter - @Test - public void testListPolicyTemplateVersionsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; - String listPolicyTemplateVersionsPath = "/v1/policy_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListPolicyTemplateVersionsOptions model - ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptionsModel = new ListPolicyTemplateVersionsOptions.Builder() - .policyTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listPolicyTemplateVersions() with a valid options model and verify the result - Response response = iamPolicyManagementService.listPolicyTemplateVersions(listPolicyTemplateVersionsOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateVersionsCollection 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, listPolicyTemplateVersionsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listPolicyTemplateVersions operation with and without retries enabled - @Test - public void testListPolicyTemplateVersionsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListPolicyTemplateVersionsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListPolicyTemplateVersionsWOptions(); - } - - // Test the listPolicyTemplateVersions operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyTemplateVersionsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listPolicyTemplateVersions(null).execute(); - } - - // Test the listPolicyTemplateVersions operation using the PolicyTemplateVersionsPager.getNext() method - @Test - public void testListPolicyTemplateVersionsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions = new ListPolicyTemplateVersionsOptions.Builder() - .policyTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - PolicyTemplateVersionsPager pager = new PolicyTemplateVersionsPager(iamPolicyManagementService, listPolicyTemplateVersionsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listPolicyTemplateVersions operation using the PolicyTemplateVersionsPager.getAll() method - @Test - public void testListPolicyTemplateVersionsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions = new ListPolicyTemplateVersionsOptions.Builder() - .policyTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - PolicyTemplateVersionsPager pager = new PolicyTemplateVersionsPager(iamPolicyManagementService, listPolicyTemplateVersionsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the replacePolicyTemplate operation with a valid options model parameter - @Test - public void testReplacePolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String replacePolicyTemplatePath = "/v1/policy_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the TemplateGrantRoles model - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the TemplateControl model - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - - // Construct an instance of the TemplatePolicy model - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - - // Construct an instance of the ReplacePolicyTemplateOptions model - ReplacePolicyTemplateOptions replacePolicyTemplateOptionsModel = new ReplacePolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .ifMatch("testString") - .policy(templatePolicyModel) - .name("testString") - .description("testString") - .committed(true) - .build(); - - // Invoke replacePolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.replacePolicyTemplate(replacePolicyTemplateOptionsModel).execute(); - assertNotNull(response); - PolicyTemplate 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, replacePolicyTemplatePath); - // 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 replacePolicyTemplate operation with and without retries enabled - @Test - public void testReplacePolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplacePolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplacePolicyTemplateWOptions(); - } - - // Test the replacePolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplacePolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replacePolicyTemplate(null).execute(); - } - - // Test the deletePolicyTemplateVersion operation with a valid options model parameter - @Test - public void testDeletePolicyTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deletePolicyTemplateVersionPath = "/v1/policy_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeletePolicyTemplateVersionOptions model - DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptionsModel = new DeletePolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - - // Invoke deletePolicyTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.deletePolicyTemplateVersion(deletePolicyTemplateVersionOptionsModel).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, deletePolicyTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deletePolicyTemplateVersion operation with and without retries enabled - @Test - public void testDeletePolicyTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeletePolicyTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeletePolicyTemplateVersionWOptions(); - } - - // Test the deletePolicyTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deletePolicyTemplateVersion(null).execute(); - } - - // Test the getPolicyTemplateVersion operation with a valid options model parameter - @Test - public void testGetPolicyTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String getPolicyTemplateVersionPath = "/v1/policy_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetPolicyTemplateVersionOptions model - GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptionsModel = new GetPolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - - // Invoke getPolicyTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.getPolicyTemplateVersion(getPolicyTemplateVersionOptionsModel).execute(); - assertNotNull(response); - PolicyTemplate 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, getPolicyTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getPolicyTemplateVersion operation with and without retries enabled - @Test - public void testGetPolicyTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetPolicyTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetPolicyTemplateVersionWOptions(); - } - - // Test the getPolicyTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getPolicyTemplateVersion(null).execute(); - } - - // Test the commitPolicyTemplate operation with a valid options model parameter - @Test - public void testCommitPolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String commitPolicyTemplatePath = "/v1/policy_templates/testString/versions/testString/commit"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the CommitPolicyTemplateOptions model - CommitPolicyTemplateOptions commitPolicyTemplateOptionsModel = new CommitPolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - - // Invoke commitPolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.commitPolicyTemplate(commitPolicyTemplateOptionsModel).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, commitPolicyTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the commitPolicyTemplate operation with and without retries enabled - @Test - public void testCommitPolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCommitPolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCommitPolicyTemplateWOptions(); - } - - // Test the commitPolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitPolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.commitPolicyTemplate(null).execute(); - } - - // Test the listPolicyAssignments operation with a valid options model parameter - @Test - public void testListPolicyAssignmentsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}]}"; - String listPolicyAssignmentsPath = "/v1/policy_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListPolicyAssignmentsOptions model - ListPolicyAssignmentsOptions listPolicyAssignmentsOptionsModel = new ListPolicyAssignmentsOptions.Builder() - .version("1.0") - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listPolicyAssignments() with a valid options model and verify the result - Response response = iamPolicyManagementService.listPolicyAssignments(listPolicyAssignmentsOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateAssignmentCollection 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, listPolicyAssignmentsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "1.0"); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("template_id"), "testString"); - assertEquals(query.get("template_version"), "testString"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listPolicyAssignments operation with and without retries enabled - @Test - public void testListPolicyAssignmentsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListPolicyAssignmentsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListPolicyAssignmentsWOptions(); - } - - // Test the listPolicyAssignments operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyAssignmentsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listPolicyAssignments(null).execute(); - } - - // Test the listPolicyAssignments operation using the PolicyAssignmentsPager.getNext() method - @Test - public void testListPolicyAssignmentsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyAssignmentsOptions listPolicyAssignmentsOptions = new ListPolicyAssignmentsOptions.Builder() - .version("1.0") - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - PolicyAssignmentsPager pager = new PolicyAssignmentsPager(iamPolicyManagementService, listPolicyAssignmentsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listPolicyAssignments operation using the PolicyAssignmentsPager.getAll() method - @Test - public void testListPolicyAssignmentsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyAssignmentsOptions listPolicyAssignmentsOptions = new ListPolicyAssignmentsOptions.Builder() - .version("1.0") - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - PolicyAssignmentsPager pager = new PolicyAssignmentsPager(iamPolicyManagementService, listPolicyAssignmentsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createPolicyTemplateAssignment operation with a valid options model parameter - @Test - public void testCreatePolicyTemplateAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}]}"; - String createPolicyTemplateAssignmentPath = "/v1/policy_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the AssignmentTargetDetails model - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - - // Construct an instance of the AssignmentTemplateDetails model - AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() - .id("testString") - .version("testString") - .build(); - - // Construct an instance of the CreatePolicyTemplateAssignmentOptions model - CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptionsModel = new CreatePolicyTemplateAssignmentOptions.Builder() - .version("1.0") - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(assignmentTemplateDetailsModel)) - .acceptLanguage("default") - .build(); - - // Invoke createPolicyTemplateAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.createPolicyTemplateAssignment(createPolicyTemplateAssignmentOptionsModel).execute(); - assertNotNull(response); - PolicyAssignmentV1Collection 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createPolicyTemplateAssignmentPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "1.0"); - } - - // Test the createPolicyTemplateAssignment operation with and without retries enabled - @Test - public void testCreatePolicyTemplateAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreatePolicyTemplateAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreatePolicyTemplateAssignmentWOptions(); - } - - // Test the createPolicyTemplateAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createPolicyTemplateAssignment(null).execute(); - } - - // Test the getPolicyAssignment operation with a valid options model parameter - @Test - public void testGetPolicyAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}"; - String getPolicyAssignmentPath = "/v1/policy_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetPolicyAssignmentOptions model - GetPolicyAssignmentOptions getPolicyAssignmentOptionsModel = new GetPolicyAssignmentOptions.Builder() - .assignmentId("testString") - .version("1.0") - .build(); - - // Invoke getPolicyAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.getPolicyAssignment(getPolicyAssignmentOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateAssignmentItems 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, getPolicyAssignmentPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "1.0"); - } - - // Test the getPolicyAssignment operation with and without retries enabled - @Test - public void testGetPolicyAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetPolicyAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetPolicyAssignmentWOptions(); - } - - // Test the getPolicyAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getPolicyAssignment(null).execute(); - } - - // Test the updatePolicyAssignment operation with a valid options model parameter - @Test - public void testUpdatePolicyAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}"; - String updatePolicyAssignmentPath = "/v1/policy_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdatePolicyAssignmentOptions model - UpdatePolicyAssignmentOptions updatePolicyAssignmentOptionsModel = new UpdatePolicyAssignmentOptions.Builder() - .assignmentId("testString") - .version("1.0") - .ifMatch("testString") - .templateVersion("testString") - .build(); - - // Invoke updatePolicyAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.updatePolicyAssignment(updatePolicyAssignmentOptionsModel).execute(); - assertNotNull(response); - PolicyAssignmentV1 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updatePolicyAssignmentPath); - // Verify header parameters - assertEquals(request.getHeader("If-Match"), "testString"); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "1.0"); - } - - // Test the updatePolicyAssignment operation with and without retries enabled - @Test - public void testUpdatePolicyAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdatePolicyAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdatePolicyAssignmentWOptions(); - } - - // Test the updatePolicyAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdatePolicyAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updatePolicyAssignment(null).execute(); - } - - // Test the deletePolicyAssignment operation with a valid options model parameter - @Test - public void testDeletePolicyAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deletePolicyAssignmentPath = "/v1/policy_assignments/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeletePolicyAssignmentOptions model - DeletePolicyAssignmentOptions deletePolicyAssignmentOptionsModel = new DeletePolicyAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke deletePolicyAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.deletePolicyAssignment(deletePolicyAssignmentOptionsModel).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, deletePolicyAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deletePolicyAssignment operation with and without retries enabled - @Test - public void testDeletePolicyAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeletePolicyAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeletePolicyAssignmentWOptions(); - } - - // Test the deletePolicyAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deletePolicyAssignment(null).execute(); - } - - // Test the getSettings operation with a valid options model parameter - @Test - public void testGetSettingsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"external_account_identity_interaction\": {\"identity_types\": {\"user\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service_id\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}}}}"; - String getSettingsPath = "/v1/accounts/testString/settings/access_management"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetSettingsOptions model - GetSettingsOptions getSettingsOptionsModel = new GetSettingsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .build(); - - // Invoke getSettings() with a valid options model and verify the result - Response response = iamPolicyManagementService.getSettings(getSettingsOptionsModel).execute(); - assertNotNull(response); - AccountSettingsAccessManagement 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, getSettingsPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getSettings operation with and without retries enabled - @Test - public void testGetSettingsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetSettingsWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetSettingsWOptions(); - } - - // Test the getSettings operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetSettingsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getSettings(null).execute(); - } - - // Test the updateSettings operation with a valid options model parameter - @Test - public void testUpdateSettingsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"external_account_identity_interaction\": {\"identity_types\": {\"user\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service_id\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}}}}"; - String updateSettingsPath = "/v1/accounts/testString/settings/access_management"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the IdentityTypesBase model - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the IdentityTypesPatch model - IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() - .user(identityTypesBaseModel) - .serviceId(identityTypesBaseModel) - .service(identityTypesBaseModel) - .build(); - - // Construct an instance of the ExternalAccountIdentityInteractionPatch model - ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() - .identityTypes(identityTypesPatchModel) - .build(); - - // Construct an instance of the UpdateSettingsOptions model - UpdateSettingsOptions updateSettingsOptionsModel = new UpdateSettingsOptions.Builder() - .accountId("testString") - .ifMatch("testString") - .externalAccountIdentityInteraction(externalAccountIdentityInteractionPatchModel) - .acceptLanguage("default") - .build(); - - // Invoke updateSettings() with a valid options model and verify the result - Response response = iamPolicyManagementService.updateSettings(updateSettingsOptionsModel).execute(); - assertNotNull(response); - AccountSettingsAccessManagement 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateSettingsPath); - // 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 updateSettings operation with and without retries enabled - @Test - public void testUpdateSettingsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdateSettingsWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdateSettingsWOptions(); - } - - // Test the updateSettings operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateSettingsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updateSettings(null).execute(); - } - - // Test the listActionControlTemplates operation with a valid options model parameter - @Test - public void testListActionControlTemplatesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"action_control_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; - String listActionControlTemplatesPath = "/v1/action_control_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListActionControlTemplatesOptions model - ListActionControlTemplatesOptions listActionControlTemplatesOptionsModel = new ListActionControlTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listActionControlTemplates() with a valid options model and verify the result - Response response = iamPolicyManagementService.listActionControlTemplates(listActionControlTemplatesOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplateCollection 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, listActionControlTemplatesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listActionControlTemplates operation with and without retries enabled - @Test - public void testListActionControlTemplatesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListActionControlTemplatesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListActionControlTemplatesWOptions(); - } - - // Test the listActionControlTemplates operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlTemplatesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listActionControlTemplates(null).execute(); - } - - // Test the listActionControlTemplates operation using the ActionControlTemplatesPager.getNext() method - @Test - public void testListActionControlTemplatesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlTemplatesOptions listActionControlTemplatesOptions = new ListActionControlTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - ActionControlTemplatesPager pager = new ActionControlTemplatesPager(iamPolicyManagementService, listActionControlTemplatesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listActionControlTemplates operation using the ActionControlTemplatesPager.getAll() method - @Test - public void testListActionControlTemplatesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlTemplatesOptions listActionControlTemplatesOptions = new ListActionControlTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .limit(Long.valueOf("10")) - .build(); - - ActionControlTemplatesPager pager = new ActionControlTemplatesPager(iamPolicyManagementService, listActionControlTemplatesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createActionControlTemplate operation with a valid options model parameter - @Test - public void testCreateActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String createActionControlTemplatePath = "/v1/action_control_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateActionControl model - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the CreateActionControlTemplateOptions model - CreateActionControlTemplateOptions createActionControlTemplateOptionsModel = new CreateActionControlTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .description("testString") - .committed(true) - .actionControl(templateActionControlModel) - .acceptLanguage("default") - .build(); - - // Invoke createActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.createActionControlTemplate(createActionControlTemplateOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createActionControlTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createActionControlTemplate operation with and without retries enabled - @Test - public void testCreateActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateActionControlTemplateWOptions(); - } - - // Test the createActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createActionControlTemplate(null).execute(); - } - - // Test the getActionControlTemplate operation with a valid options model parameter - @Test - public void testGetActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String getActionControlTemplatePath = "/v1/action_control_templates/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetActionControlTemplateOptions model - GetActionControlTemplateOptions getActionControlTemplateOptionsModel = new GetActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .build(); - - // Invoke getActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.getActionControlTemplate(getActionControlTemplateOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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, getActionControlTemplatePath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - } - - // Test the getActionControlTemplate operation with and without retries enabled - @Test - public void testGetActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetActionControlTemplateWOptions(); - } - - // Test the getActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getActionControlTemplate(null).execute(); - } - - // Test the deleteActionControlTemplate operation with a valid options model parameter - @Test - public void testDeleteActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteActionControlTemplatePath = "/v1/action_control_templates/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteActionControlTemplateOptions model - DeleteActionControlTemplateOptions deleteActionControlTemplateOptionsModel = new DeleteActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .build(); - - // Invoke deleteActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteActionControlTemplate(deleteActionControlTemplateOptionsModel).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, deleteActionControlTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteActionControlTemplate operation with and without retries enabled - @Test - public void testDeleteActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteActionControlTemplateWOptions(); - } - - // Test the deleteActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteActionControlTemplate(null).execute(); - } - - // Test the createActionControlTemplateVersion operation with a valid options model parameter - @Test - public void testCreateActionControlTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String createActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateActionControl model - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the CreateActionControlTemplateVersionOptions model - CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptionsModel = new CreateActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .name("testString") - .description("testString") - .actionControl(templateActionControlModel) - .committed(true) - .build(); - - // Invoke createActionControlTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.createActionControlTemplateVersion(createActionControlTemplateVersionOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createActionControlTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createActionControlTemplateVersion operation with and without retries enabled - @Test - public void testCreateActionControlTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateActionControlTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateActionControlTemplateVersionWOptions(); - } - - // Test the createActionControlTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createActionControlTemplateVersion(null).execute(); - } - - // Test the listActionControlTemplateVersions operation with a valid options model parameter - @Test - public void testListActionControlTemplateVersionsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; - String listActionControlTemplateVersionsPath = "/v1/action_control_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListActionControlTemplateVersionsOptions model - ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptionsModel = new ListActionControlTemplateVersionsOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listActionControlTemplateVersions() with a valid options model and verify the result - Response response = iamPolicyManagementService.listActionControlTemplateVersions(listActionControlTemplateVersionsOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplateVersionsCollection 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, listActionControlTemplateVersionsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listActionControlTemplateVersions operation with and without retries enabled - @Test - public void testListActionControlTemplateVersionsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListActionControlTemplateVersionsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListActionControlTemplateVersionsWOptions(); - } - - // Test the listActionControlTemplateVersions operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlTemplateVersionsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listActionControlTemplateVersions(null).execute(); - } - - // Test the listActionControlTemplateVersions operation using the ActionControlTemplateVersionsPager.getNext() method - @Test - public void testListActionControlTemplateVersionsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions = new ListActionControlTemplateVersionsOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - ActionControlTemplateVersionsPager pager = new ActionControlTemplateVersionsPager(iamPolicyManagementService, listActionControlTemplateVersionsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listActionControlTemplateVersions operation using the ActionControlTemplateVersionsPager.getAll() method - @Test - public void testListActionControlTemplateVersionsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions = new ListActionControlTemplateVersionsOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - ActionControlTemplateVersionsPager pager = new ActionControlTemplateVersionsPager(iamPolicyManagementService, listActionControlTemplateVersionsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the replaceActionControlTemplate operation with a valid options model parameter - @Test - public void testReplaceActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String replaceActionControlTemplatePath = "/v1/action_control_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateActionControl model - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the ReplaceActionControlTemplateOptions model - ReplaceActionControlTemplateOptions replaceActionControlTemplateOptionsModel = new ReplaceActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .ifMatch("testString") - .name("testString") - .description("testString") - .actionControl(templateActionControlModel) - .committed(true) - .build(); - - // Invoke replaceActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.replaceActionControlTemplate(replaceActionControlTemplateOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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, replaceActionControlTemplatePath); - // 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 replaceActionControlTemplate operation with and without retries enabled - @Test - public void testReplaceActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplaceActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplaceActionControlTemplateWOptions(); - } - - // Test the replaceActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replaceActionControlTemplate(null).execute(); - } - - // Test the deleteActionControlTemplateVersion operation with a valid options model parameter - @Test - public void testDeleteActionControlTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteActionControlTemplateVersionOptions model - DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptionsModel = new DeleteActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - - // Invoke deleteActionControlTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteActionControlTemplateVersion(deleteActionControlTemplateVersionOptionsModel).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, deleteActionControlTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteActionControlTemplateVersion operation with and without retries enabled - @Test - public void testDeleteActionControlTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteActionControlTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteActionControlTemplateVersionWOptions(); - } - - // Test the deleteActionControlTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteActionControlTemplateVersion(null).execute(); - } - - // Test the getActionControlTemplateVersion operation with a valid options model parameter - @Test - public void testGetActionControlTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String getActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetActionControlTemplateVersionOptions model - GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptionsModel = new GetActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - - // Invoke getActionControlTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.getActionControlTemplateVersion(getActionControlTemplateVersionOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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, getActionControlTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getActionControlTemplateVersion operation with and without retries enabled - @Test - public void testGetActionControlTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetActionControlTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetActionControlTemplateVersionWOptions(); - } - - // Test the getActionControlTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getActionControlTemplateVersion(null).execute(); - } - - // Test the commitActionControlTemplate operation with a valid options model parameter - @Test - public void testCommitActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String commitActionControlTemplatePath = "/v1/action_control_templates/testString/versions/testString/commit"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the CommitActionControlTemplateOptions model - CommitActionControlTemplateOptions commitActionControlTemplateOptionsModel = new CommitActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - - // Invoke commitActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.commitActionControlTemplate(commitActionControlTemplateOptionsModel).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, commitActionControlTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the commitActionControlTemplate operation with and without retries enabled - @Test - public void testCommitActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCommitActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCommitActionControlTemplateWOptions(); - } - - // Test the commitActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.commitActionControlTemplate(null).execute(); - } - - // Test the listActionControlAssignments operation with a valid options model parameter - @Test - public void testListActionControlAssignmentsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; - String listActionControlAssignmentsPath = "/v1/action_control_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListActionControlAssignmentsOptions model - ListActionControlAssignmentsOptions listActionControlAssignmentsOptionsModel = new ListActionControlAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listActionControlAssignments() with a valid options model and verify the result - Response response = iamPolicyManagementService.listActionControlAssignments(listActionControlAssignmentsOptionsModel).execute(); - assertNotNull(response); - ActionControlAssignmentCollection 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, listActionControlAssignmentsPath); - // 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(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listActionControlAssignments operation with and without retries enabled - @Test - public void testListActionControlAssignmentsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListActionControlAssignmentsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListActionControlAssignmentsWOptions(); - } - - // Test the listActionControlAssignments operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlAssignmentsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listActionControlAssignments(null).execute(); - } - - // Test the listActionControlAssignments operation using the ActionControlAssignmentsPager.getNext() method - @Test - public void testListActionControlAssignmentsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlAssignmentsOptions listActionControlAssignmentsOptions = new ListActionControlAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - ActionControlAssignmentsPager pager = new ActionControlAssignmentsPager(iamPolicyManagementService, listActionControlAssignmentsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listActionControlAssignments operation using the ActionControlAssignmentsPager.getAll() method - @Test - public void testListActionControlAssignmentsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlAssignmentsOptions listActionControlAssignmentsOptions = new ListActionControlAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - ActionControlAssignmentsPager pager = new ActionControlAssignmentsPager(iamPolicyManagementService, listActionControlAssignmentsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createActionControlTemplateAssignment operation with a valid options model parameter - @Test - public void testCreateActionControlTemplateAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; - String createActionControlTemplateAssignmentPath = "/v1/action_control_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the AssignmentTargetDetails model - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - - // Construct an instance of the ActionControlAssignmentTemplate model - ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - - // Construct an instance of the CreateActionControlTemplateAssignmentOptions model - CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptionsModel = new CreateActionControlTemplateAssignmentOptions.Builder() - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(actionControlAssignmentTemplateModel)) - .acceptLanguage("default") - .build(); - - // Invoke createActionControlTemplateAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.createActionControlTemplateAssignment(createActionControlTemplateAssignmentOptionsModel).execute(); - assertNotNull(response); - ActionControlAssignmentCollection 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createActionControlTemplateAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createActionControlTemplateAssignment operation with and without retries enabled - @Test - public void testCreateActionControlTemplateAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateActionControlTemplateAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateActionControlTemplateAssignmentWOptions(); - } - - // Test the createActionControlTemplateAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createActionControlTemplateAssignment(null).execute(); - } - - // Test the getActionControlAssignment operation with a valid options model parameter - @Test - public void testGetActionControlAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; - String getActionControlAssignmentPath = "/v1/action_control_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetActionControlAssignmentOptions model - GetActionControlAssignmentOptions getActionControlAssignmentOptionsModel = new GetActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke getActionControlAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.getActionControlAssignment(getActionControlAssignmentOptionsModel).execute(); - assertNotNull(response); - ActionControlAssignment 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, getActionControlAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getActionControlAssignment operation with and without retries enabled - @Test - public void testGetActionControlAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetActionControlAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetActionControlAssignmentWOptions(); - } - - // Test the getActionControlAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getActionControlAssignment(null).execute(); - } - - // Test the updateActionControlAssignment operation with a valid options model parameter - @Test - public void testUpdateActionControlAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; - String updateActionControlAssignmentPath = "/v1/action_control_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdateActionControlAssignmentOptions model - UpdateActionControlAssignmentOptions updateActionControlAssignmentOptionsModel = new UpdateActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .ifMatch("testString") - .templateVersion("testString") - .build(); - - // Invoke updateActionControlAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.updateActionControlAssignment(updateActionControlAssignmentOptionsModel).execute(); - assertNotNull(response); - ActionControlAssignment 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateActionControlAssignmentPath); - // 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 updateActionControlAssignment operation with and without retries enabled - @Test - public void testUpdateActionControlAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdateActionControlAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdateActionControlAssignmentWOptions(); - } - - // Test the updateActionControlAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateActionControlAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updateActionControlAssignment(null).execute(); - } - - // Test the deleteActionControlAssignment operation with a valid options model parameter - @Test - public void testDeleteActionControlAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteActionControlAssignmentPath = "/v1/action_control_assignments/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteActionControlAssignmentOptions model - DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptionsModel = new DeleteActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke deleteActionControlAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteActionControlAssignment(deleteActionControlAssignmentOptionsModel).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, deleteActionControlAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteActionControlAssignment operation with and without retries enabled - @Test - public void testDeleteActionControlAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteActionControlAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteActionControlAssignmentWOptions(); - } - - // Test the deleteActionControlAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteActionControlAssignment(null).execute(); - } - - // Test the listRoleTemplates operation with a valid options model parameter - @Test - public void testListRoleTemplatesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"role_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; - String listRoleTemplatesPath = "/v1/role_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListRoleTemplatesOptions model - ListRoleTemplatesOptions listRoleTemplatesOptionsModel = new ListRoleTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .name("testString") - .roleName("testString") - .roleServiceName("testString") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listRoleTemplates() with a valid options model and verify the result - Response response = iamPolicyManagementService.listRoleTemplates(listRoleTemplatesOptionsModel).execute(); - assertNotNull(response); - RoleTemplateCollection 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, listRoleTemplatesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("name"), "testString"); - assertEquals(query.get("role_name"), "testString"); - assertEquals(query.get("role_service_name"), "testString"); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listRoleTemplates operation with and without retries enabled - @Test - public void testListRoleTemplatesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListRoleTemplatesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListRoleTemplatesWOptions(); - } - - // Test the listRoleTemplates operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleTemplatesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listRoleTemplates(null).execute(); - } - - // Test the listRoleTemplates operation using the RoleTemplatesPager.getNext() method - @Test - public void testListRoleTemplatesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleTemplatesOptions listRoleTemplatesOptions = new ListRoleTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .name("testString") - .roleName("testString") - .roleServiceName("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - RoleTemplatesPager pager = new RoleTemplatesPager(iamPolicyManagementService, listRoleTemplatesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listRoleTemplates operation using the RoleTemplatesPager.getAll() method - @Test - public void testListRoleTemplatesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleTemplatesOptions listRoleTemplatesOptions = new ListRoleTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .name("testString") - .roleName("testString") - .roleServiceName("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - RoleTemplatesPager pager = new RoleTemplatesPager(iamPolicyManagementService, listRoleTemplatesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createRoleTemplate operation with a valid options model parameter - @Test - public void testCreateRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String createRoleTemplatePath = "/v1/role_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the RoleTemplatePrototypeRole model - RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() - .name("testString") - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the CreateRoleTemplateOptions model - CreateRoleTemplateOptions createRoleTemplateOptionsModel = new CreateRoleTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .description("testString") - .committed(true) - .role(roleTemplatePrototypeRoleModel) - .acceptLanguage("default") - .build(); - - // Invoke createRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.createRoleTemplate(createRoleTemplateOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createRoleTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createRoleTemplate operation with and without retries enabled - @Test - public void testCreateRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateRoleTemplateWOptions(); - } - - // Test the createRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createRoleTemplate(null).execute(); - } - - // Test the getRoleTemplate operation with a valid options model parameter - @Test - public void testGetRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String getRoleTemplatePath = "/v1/role_templates/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetRoleTemplateOptions model - GetRoleTemplateOptions getRoleTemplateOptionsModel = new GetRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .state("active") - .build(); - - // Invoke getRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.getRoleTemplate(getRoleTemplateOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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, getRoleTemplatePath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - } - - // Test the getRoleTemplate operation with and without retries enabled - @Test - public void testGetRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetRoleTemplateWOptions(); - } - - // Test the getRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getRoleTemplate(null).execute(); - } - - // Test the deleteRoleTemplate operation with a valid options model parameter - @Test - public void testDeleteRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteRoleTemplatePath = "/v1/role_templates/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteRoleTemplateOptions model - DeleteRoleTemplateOptions deleteRoleTemplateOptionsModel = new DeleteRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .build(); - - // Invoke deleteRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteRoleTemplate(deleteRoleTemplateOptionsModel).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, deleteRoleTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteRoleTemplate operation with and without retries enabled - @Test - public void testDeleteRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteRoleTemplateWOptions(); - } - - // Test the deleteRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteRoleTemplate(null).execute(); - } - - // Test the createRoleTemplateVersion operation with a valid options model parameter - @Test - public void testCreateRoleTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String createRoleTemplateVersionPath = "/v1/role_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateRole model - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the CreateRoleTemplateVersionOptions model - CreateRoleTemplateVersionOptions createRoleTemplateVersionOptionsModel = new CreateRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .name("testString") - .description("testString") - .role(templateRoleModel) - .committed(true) - .build(); - - // Invoke createRoleTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.createRoleTemplateVersion(createRoleTemplateVersionOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createRoleTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createRoleTemplateVersion operation with and without retries enabled - @Test - public void testCreateRoleTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateRoleTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateRoleTemplateVersionWOptions(); - } - - // Test the createRoleTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createRoleTemplateVersion(null).execute(); - } - - // Test the listRoleTemplateVersions operation with a valid options model parameter - @Test - public void testListRoleTemplateVersionsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; - String listRoleTemplateVersionsPath = "/v1/role_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListRoleTemplateVersionsOptions model - ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptionsModel = new ListRoleTemplateVersionsOptions.Builder() - .roleTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listRoleTemplateVersions() with a valid options model and verify the result - Response response = iamPolicyManagementService.listRoleTemplateVersions(listRoleTemplateVersionsOptionsModel).execute(); - assertNotNull(response); - RoleTemplateVersionsCollection 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, listRoleTemplateVersionsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listRoleTemplateVersions operation with and without retries enabled - @Test - public void testListRoleTemplateVersionsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListRoleTemplateVersionsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListRoleTemplateVersionsWOptions(); - } - - // Test the listRoleTemplateVersions operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleTemplateVersionsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listRoleTemplateVersions(null).execute(); - } - - // Test the listRoleTemplateVersions operation using the RoleTemplateVersionsPager.getNext() method - @Test - public void testListRoleTemplateVersionsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions = new ListRoleTemplateVersionsOptions.Builder() - .roleTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - RoleTemplateVersionsPager pager = new RoleTemplateVersionsPager(iamPolicyManagementService, listRoleTemplateVersionsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listRoleTemplateVersions operation using the RoleTemplateVersionsPager.getAll() method - @Test - public void testListRoleTemplateVersionsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions = new ListRoleTemplateVersionsOptions.Builder() - .roleTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - RoleTemplateVersionsPager pager = new RoleTemplateVersionsPager(iamPolicyManagementService, listRoleTemplateVersionsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the replaceRoleTemplate operation with a valid options model parameter - @Test - public void testReplaceRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String replaceRoleTemplatePath = "/v1/role_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateRole model - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the ReplaceRoleTemplateOptions model - ReplaceRoleTemplateOptions replaceRoleTemplateOptionsModel = new ReplaceRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .ifMatch("testString") - .name("testString") - .description("testString") - .role(templateRoleModel) - .committed(true) - .build(); - - // Invoke replaceRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.replaceRoleTemplate(replaceRoleTemplateOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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, replaceRoleTemplatePath); - // 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 replaceRoleTemplate operation with and without retries enabled - @Test - public void testReplaceRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplaceRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplaceRoleTemplateWOptions(); - } - - // Test the replaceRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replaceRoleTemplate(null).execute(); - } - - // Test the deleteRoleTemplateVersion operation with a valid options model parameter - @Test - public void testDeleteRoleTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteRoleTemplateVersionPath = "/v1/role_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteRoleTemplateVersionOptions model - DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptionsModel = new DeleteRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - - // Invoke deleteRoleTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteRoleTemplateVersion(deleteRoleTemplateVersionOptionsModel).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, deleteRoleTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteRoleTemplateVersion operation with and without retries enabled - @Test - public void testDeleteRoleTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteRoleTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteRoleTemplateVersionWOptions(); - } - - // Test the deleteRoleTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteRoleTemplateVersion(null).execute(); - } - - // Test the getRoleTemplateVersion operation with a valid options model parameter - @Test - public void testGetRoleTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String getRoleTemplateVersionPath = "/v1/role_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetRoleTemplateVersionOptions model - GetRoleTemplateVersionOptions getRoleTemplateVersionOptionsModel = new GetRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - - // Invoke getRoleTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.getRoleTemplateVersion(getRoleTemplateVersionOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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, getRoleTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getRoleTemplateVersion operation with and without retries enabled - @Test - public void testGetRoleTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetRoleTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetRoleTemplateVersionWOptions(); - } - - // Test the getRoleTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getRoleTemplateVersion(null).execute(); - } - - // Test the commitRoleTemplate operation with a valid options model parameter - @Test - public void testCommitRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String commitRoleTemplatePath = "/v1/role_templates/testString/versions/testString/commit"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the CommitRoleTemplateOptions model - CommitRoleTemplateOptions commitRoleTemplateOptionsModel = new CommitRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - - // Invoke commitRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.commitRoleTemplate(commitRoleTemplateOptionsModel).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, commitRoleTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the commitRoleTemplate operation with and without retries enabled - @Test - public void testCommitRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCommitRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCommitRoleTemplateWOptions(); - } - - // Test the commitRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.commitRoleTemplate(null).execute(); - } - - // Test the listRoleAssignments operation with a valid options model parameter - @Test - public void testListRoleAssignmentsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; - String listRoleAssignmentsPath = "/v1/role_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListRoleAssignmentsOptions model - ListRoleAssignmentsOptions listRoleAssignmentsOptionsModel = new ListRoleAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listRoleAssignments() with a valid options model and verify the result - Response response = iamPolicyManagementService.listRoleAssignments(listRoleAssignmentsOptionsModel).execute(); - assertNotNull(response); - RoleAssignmentCollection 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, listRoleAssignmentsPath); - // 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(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listRoleAssignments operation with and without retries enabled - @Test - public void testListRoleAssignmentsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListRoleAssignmentsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListRoleAssignmentsWOptions(); - } - - // Test the listRoleAssignments operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleAssignmentsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listRoleAssignments(null).execute(); - } - - // Test the listRoleAssignments operation using the RoleAssignmentsPager.getNext() method - @Test - public void testListRoleAssignmentsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleAssignmentsOptions listRoleAssignmentsOptions = new ListRoleAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - RoleAssignmentsPager pager = new RoleAssignmentsPager(iamPolicyManagementService, listRoleAssignmentsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listRoleAssignments operation using the RoleAssignmentsPager.getAll() method - @Test - public void testListRoleAssignmentsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleAssignmentsOptions listRoleAssignmentsOptions = new ListRoleAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - RoleAssignmentsPager pager = new RoleAssignmentsPager(iamPolicyManagementService, listRoleAssignmentsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createRoleTemplateAssignment operation with a valid options model parameter - @Test - public void testCreateRoleTemplateAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; - String createRoleTemplateAssignmentPath = "/v1/role_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the AssignmentTargetDetails model - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - - // Construct an instance of the RoleAssignmentTemplate model - RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - - // Construct an instance of the CreateRoleTemplateAssignmentOptions model - CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptionsModel = new CreateRoleTemplateAssignmentOptions.Builder() - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(roleAssignmentTemplateModel)) - .acceptLanguage("default") - .build(); - - // Invoke createRoleTemplateAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.createRoleTemplateAssignment(createRoleTemplateAssignmentOptionsModel).execute(); - assertNotNull(response); - RoleAssignmentCollection 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createRoleTemplateAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createRoleTemplateAssignment operation with and without retries enabled - @Test - public void testCreateRoleTemplateAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateRoleTemplateAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateRoleTemplateAssignmentWOptions(); - } - - // Test the createRoleTemplateAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createRoleTemplateAssignment(null).execute(); - } - - // Test the getRoleAssignment operation with a valid options model parameter - @Test - public void testGetRoleAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; - String getRoleAssignmentPath = "/v1/role_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetRoleAssignmentOptions model - GetRoleAssignmentOptions getRoleAssignmentOptionsModel = new GetRoleAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke getRoleAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.getRoleAssignment(getRoleAssignmentOptionsModel).execute(); - assertNotNull(response); - RoleAssignment 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, getRoleAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getRoleAssignment operation with and without retries enabled - @Test - public void testGetRoleAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetRoleAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetRoleAssignmentWOptions(); - } - - // Test the getRoleAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getRoleAssignment(null).execute(); - } - - // Test the updateRoleAssignment operation with a valid options model parameter - @Test - public void testUpdateRoleAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; - String updateRoleAssignmentPath = "/v1/role_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdateRoleAssignmentOptions model - UpdateRoleAssignmentOptions updateRoleAssignmentOptionsModel = new UpdateRoleAssignmentOptions.Builder() - .assignmentId("testString") - .ifMatch("testString") - .templateVersion("testString") - .build(); - - // Invoke updateRoleAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.updateRoleAssignment(updateRoleAssignmentOptionsModel).execute(); - assertNotNull(response); - RoleAssignment 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateRoleAssignmentPath); - // 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 updateRoleAssignment operation with and without retries enabled - @Test - public void testUpdateRoleAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdateRoleAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdateRoleAssignmentWOptions(); - } - - // Test the updateRoleAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateRoleAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updateRoleAssignment(null).execute(); - } - - // Test the deleteRoleAssignment operation with a valid options model parameter - @Test - public void testDeleteRoleAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteRoleAssignmentPath = "/v1/role_assignments/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteRoleAssignmentOptions model - DeleteRoleAssignmentOptions deleteRoleAssignmentOptionsModel = new DeleteRoleAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke deleteRoleAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteRoleAssignment(deleteRoleAssignmentOptionsModel).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, deleteRoleAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteRoleAssignment operation with and without retries enabled - @Test - public void testDeleteRoleAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteRoleAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteRoleAssignmentWOptions(); - } - - // Test the deleteRoleAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteRoleAssignment(null).execute(); - } - - // Perform setup needed before each test method - @BeforeMethod - public void beforeEachTest() { - // Start the mock server. - try { - server = new MockWebServer(); - server.start(); - } catch (IOException err) { - fail("Failed to instantiate mock web server"); - } - - // Construct an instance of the service - constructClientService(); - } - - // Perform tear down after each test method - @AfterMethod - public void afterEachTest() throws IOException { - server.shutdown(); - iamPolicyManagementService = null; - } - - // Constructs an instance of the service to be used by the tests - public void constructClientService() { - System.setProperty("TESTSERVICE_AUTH_TYPE", "noAuth"); - final String serviceName = "testService"; - - iamPolicyManagementService = IamPolicyManagement.newInstance(serviceName); - String url = server.url("/").toString(); - iamPolicyManagementService.setServiceUrl(url); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java deleted file mode 100644 index 5630ccb0c03..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.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 AccountSettingsAccessManagement model. - */ -public class AccountSettingsAccessManagementTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAccountSettingsAccessManagement() throws Throwable { - AccountSettingsAccessManagement accountSettingsAccessManagementModel = new AccountSettingsAccessManagement(); - assertNull(accountSettingsAccessManagementModel.getExternalAccountIdentityInteraction()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java deleted file mode 100644 index d4dfc8863c6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentCollection model. - */ -public class ActionControlAssignmentCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentCollection() throws Throwable { - ActionControlAssignmentCollection actionControlAssignmentCollectionModel = new ActionControlAssignmentCollection(); - assertNull(actionControlAssignmentCollectionModel.getLimit()); - assertNull(actionControlAssignmentCollectionModel.getFirst()); - assertNull(actionControlAssignmentCollectionModel.getNext()); - assertNull(actionControlAssignmentCollectionModel.getPrevious()); - assertNull(actionControlAssignmentCollectionModel.getAssignments()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java deleted file mode 100644 index cb53bc44d1c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResourceActionControl model. - */ -public class ActionControlAssignmentResourceActionControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentResourceActionControl() throws Throwable { - ActionControlAssignmentResourceActionControl actionControlAssignmentResourceActionControlModel = new ActionControlAssignmentResourceActionControl(); - assertNull(actionControlAssignmentResourceActionControlModel.getResourceCreated()); - assertNull(actionControlAssignmentResourceActionControlModel.getErrorMessage()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java deleted file mode 100644 index 284ec17a0f0..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResourceCreated model. - */ -public class ActionControlAssignmentResourceCreatedTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentResourceCreated() throws Throwable { - ActionControlAssignmentResourceCreated actionControlAssignmentResourceCreatedModel = new ActionControlAssignmentResourceCreated(); - assertNull(actionControlAssignmentResourceCreatedModel.getId()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java deleted file mode 100644 index eaa560dce78..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResource model. - */ -public class ActionControlAssignmentResourceTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentResource() throws Throwable { - ActionControlAssignmentResource actionControlAssignmentResourceModel = new ActionControlAssignmentResource(); - assertNull(actionControlAssignmentResourceModel.getTarget()); - assertNull(actionControlAssignmentResourceModel.getActionControl()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java deleted file mode 100644 index 262a74bea45..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentTemplate model. - */ -public class ActionControlAssignmentTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentTemplate() throws Throwable { - ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(actionControlAssignmentTemplateModel.id(), "testString"); - assertEquals(actionControlAssignmentTemplateModel.version(), "testString"); - - String json = TestUtilities.serialize(actionControlAssignmentTemplateModel); - - ActionControlAssignmentTemplate actionControlAssignmentTemplateModelNew = TestUtilities.deserialize(json, ActionControlAssignmentTemplate.class); - assertTrue(actionControlAssignmentTemplateModelNew instanceof ActionControlAssignmentTemplate); - assertEquals(actionControlAssignmentTemplateModelNew.id(), "testString"); - assertEquals(actionControlAssignmentTemplateModelNew.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testActionControlAssignmentTemplateError() throws Throwable { - new ActionControlAssignmentTemplate.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java deleted file mode 100644 index c5173f940c4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignment model. - */ -public class ActionControlAssignmentTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignment() throws Throwable { - ActionControlAssignment actionControlAssignmentModel = new ActionControlAssignment(); - assertNull(actionControlAssignmentModel.getTemplate()); - assertNull(actionControlAssignmentModel.getTarget()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java deleted file mode 100644 index 58155ee1e7e..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplateCollection model. - */ -public class ActionControlTemplateCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlTemplateCollection() throws Throwable { - ActionControlTemplateCollection actionControlTemplateCollectionModel = new ActionControlTemplateCollection(); - assertNull(actionControlTemplateCollectionModel.getLimit()); - assertNull(actionControlTemplateCollectionModel.getFirst()); - assertNull(actionControlTemplateCollectionModel.getNext()); - assertNull(actionControlTemplateCollectionModel.getPrevious()); - assertNull(actionControlTemplateCollectionModel.getActionControlTemplates()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java deleted file mode 100644 index a086106a57e..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplate model. - */ -public class ActionControlTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlTemplate() throws Throwable { - ActionControlTemplate actionControlTemplateModel = new ActionControlTemplate(); - assertNull(actionControlTemplateModel.getName()); - assertNull(actionControlTemplateModel.getDescription()); - assertNull(actionControlTemplateModel.getAccountId()); - assertNull(actionControlTemplateModel.isCommitted()); - assertNull(actionControlTemplateModel.getActionControl()); - assertNull(actionControlTemplateModel.getVersion()); - assertNull(actionControlTemplateModel.getState()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java deleted file mode 100644 index 7b6bf014357..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplateVersionsCollection model. - */ -public class ActionControlTemplateVersionsCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlTemplateVersionsCollection() throws Throwable { - ActionControlTemplateVersionsCollection actionControlTemplateVersionsCollectionModel = new ActionControlTemplateVersionsCollection(); - assertNull(actionControlTemplateVersionsCollectionModel.getLimit()); - assertNull(actionControlTemplateVersionsCollectionModel.getFirst()); - assertNull(actionControlTemplateVersionsCollectionModel.getNext()); - assertNull(actionControlTemplateVersionsCollectionModel.getPrevious()); - assertNull(actionControlTemplateVersionsCollectionModel.getVersions()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java deleted file mode 100644 index 4038d52606c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentResourceCreated model. - */ -public class AssignmentResourceCreatedTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAssignmentResourceCreated() throws Throwable { - AssignmentResourceCreated assignmentResourceCreatedModel = new AssignmentResourceCreated(); - assertNull(assignmentResourceCreatedModel.getId()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java deleted file mode 100644 index 81e3799a42c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentResourceError model. - */ -public class AssignmentResourceErrorTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAssignmentResourceError() throws Throwable { - AssignmentResourceError assignmentResourceErrorModel = new AssignmentResourceError(); - assertNull(assignmentResourceErrorModel.getName()); - assertNull(assignmentResourceErrorModel.getErrorCode()); - assertNull(assignmentResourceErrorModel.getMessage()); - assertNull(assignmentResourceErrorModel.getCode()); - assertNull(assignmentResourceErrorModel.getErrors()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java deleted file mode 100644 index 48e4a605cbb..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentTargetDetails model. - */ -public class AssignmentTargetDetailsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAssignmentTargetDetails() throws Throwable { - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - assertEquals(assignmentTargetDetailsModel.type(), "Account"); - assertEquals(assignmentTargetDetailsModel.id(), "testString"); - - String json = TestUtilities.serialize(assignmentTargetDetailsModel); - - AssignmentTargetDetails assignmentTargetDetailsModelNew = TestUtilities.deserialize(json, AssignmentTargetDetails.class); - assertTrue(assignmentTargetDetailsModelNew instanceof AssignmentTargetDetails); - assertEquals(assignmentTargetDetailsModelNew.type(), "Account"); - assertEquals(assignmentTargetDetailsModelNew.id(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testAssignmentTargetDetailsError() throws Throwable { - new AssignmentTargetDetails.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java deleted file mode 100644 index bcecf27ed27..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentTemplateDetails model. - */ -public class AssignmentTemplateDetailsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAssignmentTemplateDetails() throws Throwable { - AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(assignmentTemplateDetailsModel.id(), "testString"); - assertEquals(assignmentTemplateDetailsModel.version(), "testString"); - - String json = TestUtilities.serialize(assignmentTemplateDetailsModel); - - AssignmentTemplateDetails assignmentTemplateDetailsModelNew = TestUtilities.deserialize(json, AssignmentTemplateDetails.class); - assertTrue(assignmentTemplateDetailsModelNew instanceof AssignmentTemplateDetails); - assertEquals(assignmentTemplateDetailsModelNew.id(), "testString"); - assertEquals(assignmentTemplateDetailsModelNew.version(), "testString"); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java deleted file mode 100644 index 2b5ed42c76a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CommitActionControlTemplateOptions model. - */ -public class CommitActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCommitActionControlTemplateOptions() throws Throwable { - CommitActionControlTemplateOptions commitActionControlTemplateOptionsModel = new CommitActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - assertEquals(commitActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(commitActionControlTemplateOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitActionControlTemplateOptionsError() throws Throwable { - new CommitActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java deleted file mode 100644 index 66cdca59588..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CommitPolicyTemplateOptions model. - */ -public class CommitPolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCommitPolicyTemplateOptions() throws Throwable { - CommitPolicyTemplateOptions commitPolicyTemplateOptionsModel = new CommitPolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - assertEquals(commitPolicyTemplateOptionsModel.policyTemplateId(), "testString"); - assertEquals(commitPolicyTemplateOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitPolicyTemplateOptionsError() throws Throwable { - new CommitPolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java deleted file mode 100644 index 09c48b8e80e..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CommitRoleTemplateOptions model. - */ -public class CommitRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCommitRoleTemplateOptions() throws Throwable { - CommitRoleTemplateOptions commitRoleTemplateOptionsModel = new CommitRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - assertEquals(commitRoleTemplateOptionsModel.roleTemplateId(), "testString"); - assertEquals(commitRoleTemplateOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitRoleTemplateOptionsError() throws Throwable { - new CommitRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java deleted file mode 100644 index 94ef6ce21e8..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.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 ConflictsWith model. - */ -public class ConflictsWithTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testConflictsWith() throws Throwable { - ConflictsWith conflictsWithModel = new ConflictsWith(); - assertNull(conflictsWithModel.getEtag()); - assertNull(conflictsWithModel.getRole()); - assertNull(conflictsWithModel.getPolicy()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java deleted file mode 100644 index bbe19a7b9b1..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponseControl model. - */ -public class ControlResponseControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testControlResponseControl() throws Throwable { - ControlResponseControl controlResponseControlModel = new ControlResponseControl(); - assertNull(controlResponseControlModel.getGrant()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java deleted file mode 100644 index 7b2fbfae90d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControlWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponseControlWithEnrichedRoles model. - */ -public class ControlResponseControlWithEnrichedRolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testControlResponseControlWithEnrichedRoles() throws Throwable { - ControlResponseControlWithEnrichedRoles controlResponseControlWithEnrichedRolesModel = new ControlResponseControlWithEnrichedRoles(); - assertNull(controlResponseControlWithEnrichedRolesModel.getGrant()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java deleted file mode 100644 index f42cbc0a2d8..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponse; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponse model. - */ -public class ControlResponseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testControlResponse() throws Throwable { - ControlResponse controlResponseModel = new ControlResponse(); - assertNotNull(controlResponseModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java deleted file mode 100644 index c8b1e3000f9..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 Control model. - */ -public class ControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testControl() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); - - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - assertEquals(controlModel.grant(), grantModel); - - String json = TestUtilities.serialize(controlModel); - - Control controlModelNew = TestUtilities.deserialize(json, Control.class); - assertTrue(controlModelNew instanceof Control); - assertEquals(controlModelNew.grant().toString(), grantModel.toString()); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testControlError() throws Throwable { - new Control.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java deleted file mode 100644 index f2557c8f64f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateAssignmentOptions model. - */ -public class CreateActionControlTemplateAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateActionControlTemplateAssignmentOptions() throws Throwable { - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - assertEquals(assignmentTargetDetailsModel.type(), "Account"); - assertEquals(assignmentTargetDetailsModel.id(), "testString"); - - ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(actionControlAssignmentTemplateModel.id(), "testString"); - assertEquals(actionControlAssignmentTemplateModel.version(), "testString"); - - CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptionsModel = new CreateActionControlTemplateAssignmentOptions.Builder() - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(actionControlAssignmentTemplateModel)) - .acceptLanguage("default") - .build(); - assertEquals(createActionControlTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); - assertEquals(createActionControlTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(actionControlAssignmentTemplateModel)); - assertEquals(createActionControlTemplateAssignmentOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateAssignmentOptionsError() throws Throwable { - new CreateActionControlTemplateAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java deleted file mode 100644 index 2508072a03c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateOptions model. - */ -public class CreateActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateActionControlTemplateOptions() throws Throwable { - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateActionControlModel.serviceName(), "testString"); - assertEquals(templateActionControlModel.description(), "testString"); - assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); - - CreateActionControlTemplateOptions createActionControlTemplateOptionsModel = new CreateActionControlTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .description("testString") - .committed(true) - .actionControl(templateActionControlModel) - .acceptLanguage("default") - .build(); - assertEquals(createActionControlTemplateOptionsModel.name(), "testString"); - assertEquals(createActionControlTemplateOptionsModel.accountId(), "testString"); - assertEquals(createActionControlTemplateOptionsModel.description(), "testString"); - assertEquals(createActionControlTemplateOptionsModel.committed(), Boolean.valueOf(true)); - assertEquals(createActionControlTemplateOptionsModel.actionControl(), templateActionControlModel); - assertEquals(createActionControlTemplateOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateOptionsError() throws Throwable { - new CreateActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java deleted file mode 100644 index d5070249115..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateVersionOptions model. - */ -public class CreateActionControlTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateActionControlTemplateVersionOptions() throws Throwable { - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateActionControlModel.serviceName(), "testString"); - assertEquals(templateActionControlModel.description(), "testString"); - assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); - - CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptionsModel = new CreateActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .name("testString") - .description("testString") - .actionControl(templateActionControlModel) - .committed(true) - .build(); - assertEquals(createActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(createActionControlTemplateVersionOptionsModel.name(), "testString"); - assertEquals(createActionControlTemplateVersionOptionsModel.description(), "testString"); - assertEquals(createActionControlTemplateVersionOptionsModel.actionControl(), templateActionControlModel); - assertEquals(createActionControlTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateVersionOptionsError() throws Throwable { - new CreateActionControlTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java deleted file mode 100644 index c2dd24fd213..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyOptions model. - */ -public class CreatePolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreatePolicyOptions() throws Throwable { - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - assertEquals(subjectAttributeModel.name(), "testString"); - assertEquals(subjectAttributeModel.value(), "testString"); - - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); - - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - assertEquals(policyRoleModel.roleId(), "testString"); - - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceAttributeModel.name(), "testString"); - assertEquals(resourceAttributeModel.value(), "testString"); - assertEquals(resourceAttributeModel.operator(), "testString"); - - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceTagModel.name(), "testString"); - assertEquals(resourceTagModel.value(), "testString"); - assertEquals(resourceTagModel.operator(), "testString"); - - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); - assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); - - CreatePolicyOptions createPolicyOptionsModel = new CreatePolicyOptions.Builder() - .type("testString") - .subjects(java.util.Arrays.asList(policySubjectModel)) - .roles(java.util.Arrays.asList(policyRoleModel)) - .resources(java.util.Arrays.asList(policyResourceModel)) - .description("testString") - .acceptLanguage("default") - .build(); - assertEquals(createPolicyOptionsModel.type(), "testString"); - assertEquals(createPolicyOptionsModel.subjects(), java.util.Arrays.asList(policySubjectModel)); - assertEquals(createPolicyOptionsModel.roles(), java.util.Arrays.asList(policyRoleModel)); - assertEquals(createPolicyOptionsModel.resources(), java.util.Arrays.asList(policyResourceModel)); - assertEquals(createPolicyOptionsModel.description(), "testString"); - assertEquals(createPolicyOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyOptionsError() throws Throwable { - new CreatePolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java deleted file mode 100644 index 5b08b4b398a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateAssignmentOptions model. - */ -public class CreatePolicyTemplateAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreatePolicyTemplateAssignmentOptions() throws Throwable { - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - assertEquals(assignmentTargetDetailsModel.type(), "Account"); - assertEquals(assignmentTargetDetailsModel.id(), "testString"); - - AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(assignmentTemplateDetailsModel.id(), "testString"); - assertEquals(assignmentTemplateDetailsModel.version(), "testString"); - - CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptionsModel = new CreatePolicyTemplateAssignmentOptions.Builder() - .version("1.0") - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(assignmentTemplateDetailsModel)) - .acceptLanguage("default") - .build(); - assertEquals(createPolicyTemplateAssignmentOptionsModel.version(), "1.0"); - assertEquals(createPolicyTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); - assertEquals(createPolicyTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(assignmentTemplateDetailsModel)); - assertEquals(createPolicyTemplateAssignmentOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateAssignmentOptionsError() throws Throwable { - new CreatePolicyTemplateAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java deleted file mode 100644 index 68617451831..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateOptions model. - */ -public class CreatePolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreatePolicyTemplateOptions() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - assertEquals(templatePolicyModel.type(), "access"); - assertEquals(templatePolicyModel.description(), "testString"); - assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); - assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); - assertEquals(templatePolicyModel.pattern(), "testString"); - assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), templateControlModel); - - CreatePolicyTemplateOptions createPolicyTemplateOptionsModel = new CreatePolicyTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .policy(templatePolicyModel) - .description("testString") - .committed(true) - .acceptLanguage("default") - .build(); - assertEquals(createPolicyTemplateOptionsModel.name(), "testString"); - assertEquals(createPolicyTemplateOptionsModel.accountId(), "testString"); - assertEquals(createPolicyTemplateOptionsModel.policy(), templatePolicyModel); - assertEquals(createPolicyTemplateOptionsModel.description(), "testString"); - assertEquals(createPolicyTemplateOptionsModel.committed(), Boolean.valueOf(true)); - assertEquals(createPolicyTemplateOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateOptionsError() throws Throwable { - new CreatePolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java deleted file mode 100644 index d6919e6e1b9..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateVersionOptions model. - */ -public class CreatePolicyTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreatePolicyTemplateVersionOptions() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - assertEquals(templatePolicyModel.type(), "access"); - assertEquals(templatePolicyModel.description(), "testString"); - assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); - assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); - assertEquals(templatePolicyModel.pattern(), "testString"); - assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), templateControlModel); - - CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptionsModel = new CreatePolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .policy(templatePolicyModel) - .name("testString") - .description("testString") - .committed(true) - .build(); - assertEquals(createPolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); - assertEquals(createPolicyTemplateVersionOptionsModel.policy(), templatePolicyModel); - assertEquals(createPolicyTemplateVersionOptionsModel.name(), "testString"); - assertEquals(createPolicyTemplateVersionOptionsModel.description(), "testString"); - assertEquals(createPolicyTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateVersionOptionsError() throws Throwable { - new CreatePolicyTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java deleted file mode 100644 index 849512f2bda..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleOptions model. - */ -public class CreateRoleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateRoleOptions() throws Throwable { - CreateRoleOptions createRoleOptionsModel = new CreateRoleOptions.Builder() - .displayName("testString") - .actions(java.util.Arrays.asList("testString")) - .name("Developer") - .accountId("testString") - .serviceName("iam-groups") - .description("testString") - .acceptLanguage("default") - .build(); - assertEquals(createRoleOptionsModel.displayName(), "testString"); - assertEquals(createRoleOptionsModel.actions(), java.util.Arrays.asList("testString")); - assertEquals(createRoleOptionsModel.name(), "Developer"); - assertEquals(createRoleOptionsModel.accountId(), "testString"); - assertEquals(createRoleOptionsModel.serviceName(), "iam-groups"); - assertEquals(createRoleOptionsModel.description(), "testString"); - assertEquals(createRoleOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleOptionsError() throws Throwable { - new CreateRoleOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java deleted file mode 100644 index bff414389a5..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateAssignmentOptions model. - */ -public class CreateRoleTemplateAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateRoleTemplateAssignmentOptions() throws Throwable { - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - assertEquals(assignmentTargetDetailsModel.type(), "Account"); - assertEquals(assignmentTargetDetailsModel.id(), "testString"); - - RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(roleAssignmentTemplateModel.id(), "testString"); - assertEquals(roleAssignmentTemplateModel.version(), "testString"); - - CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptionsModel = new CreateRoleTemplateAssignmentOptions.Builder() - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(roleAssignmentTemplateModel)) - .acceptLanguage("default") - .build(); - assertEquals(createRoleTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); - assertEquals(createRoleTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(roleAssignmentTemplateModel)); - assertEquals(createRoleTemplateAssignmentOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateAssignmentOptionsError() throws Throwable { - new CreateRoleTemplateAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java deleted file mode 100644 index 799743ddbf4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateOptions model. - */ -public class CreateRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateRoleTemplateOptions() throws Throwable { - RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() - .name("testString") - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(roleTemplatePrototypeRoleModel.name(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.displayName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.serviceName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.description(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.actions(), java.util.Arrays.asList("testString")); - - CreateRoleTemplateOptions createRoleTemplateOptionsModel = new CreateRoleTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .description("testString") - .committed(true) - .role(roleTemplatePrototypeRoleModel) - .acceptLanguage("default") - .build(); - assertEquals(createRoleTemplateOptionsModel.name(), "testString"); - assertEquals(createRoleTemplateOptionsModel.accountId(), "testString"); - assertEquals(createRoleTemplateOptionsModel.description(), "testString"); - assertEquals(createRoleTemplateOptionsModel.committed(), Boolean.valueOf(true)); - assertEquals(createRoleTemplateOptionsModel.role(), roleTemplatePrototypeRoleModel); - assertEquals(createRoleTemplateOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateOptionsError() throws Throwable { - new CreateRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java deleted file mode 100644 index a7d2d312afa..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateVersionOptions model. - */ -public class CreateRoleTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateRoleTemplateVersionOptions() throws Throwable { - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateRoleModel.displayName(), "testString"); - assertEquals(templateRoleModel.serviceName(), "testString"); - assertEquals(templateRoleModel.description(), "testString"); - assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); - - CreateRoleTemplateVersionOptions createRoleTemplateVersionOptionsModel = new CreateRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .name("testString") - .description("testString") - .role(templateRoleModel) - .committed(true) - .build(); - assertEquals(createRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); - assertEquals(createRoleTemplateVersionOptionsModel.name(), "testString"); - assertEquals(createRoleTemplateVersionOptionsModel.description(), "testString"); - assertEquals(createRoleTemplateVersionOptionsModel.role(), templateRoleModel); - assertEquals(createRoleTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateVersionOptionsError() throws Throwable { - new CreateRoleTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java deleted file mode 100644 index acce8b7b537..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateV2PolicyOptions model. - */ -public class CreateV2PolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateV2PolicyOptions() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); - - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - assertEquals(controlModel.grant(), grantModel); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - CreateV2PolicyOptions createV2PolicyOptionsModel = new CreateV2PolicyOptions.Builder() - .control(controlModel) - .type("access") - .description("testString") - .subject(v2PolicySubjectModel) - .resource(v2PolicyResourceModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .acceptLanguage("default") - .build(); - assertEquals(createV2PolicyOptionsModel.control(), controlModel); - assertEquals(createV2PolicyOptionsModel.type(), "access"); - assertEquals(createV2PolicyOptionsModel.description(), "testString"); - assertEquals(createV2PolicyOptionsModel.subject(), v2PolicySubjectModel); - assertEquals(createV2PolicyOptionsModel.resource(), v2PolicyResourceModel); - assertEquals(createV2PolicyOptionsModel.pattern(), "testString"); - assertEquals(createV2PolicyOptionsModel.rule(), v2PolicyRuleModel); - assertEquals(createV2PolicyOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateV2PolicyOptionsError() throws Throwable { - new CreateV2PolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java deleted file mode 100644 index acc0dc0a3c1..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 CustomRole model. - */ -public class CustomRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCustomRole() throws Throwable { - CustomRole customRoleModel = new CustomRole(); - assertNull(customRoleModel.getDisplayName()); - assertNull(customRoleModel.getDescription()); - assertNull(customRoleModel.getActions()); - assertNull(customRoleModel.getName()); - assertNull(customRoleModel.getAccountId()); - assertNull(customRoleModel.getServiceName()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java deleted file mode 100644 index 1a38606ede5..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlAssignmentOptions model. - */ -public class DeleteActionControlAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteActionControlAssignmentOptions() throws Throwable { - DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptionsModel = new DeleteActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(deleteActionControlAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlAssignmentOptionsError() throws Throwable { - new DeleteActionControlAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java deleted file mode 100644 index 75b111e9214..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlTemplateOptions model. - */ -public class DeleteActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteActionControlTemplateOptions() throws Throwable { - DeleteActionControlTemplateOptions deleteActionControlTemplateOptionsModel = new DeleteActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .build(); - assertEquals(deleteActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlTemplateOptionsError() throws Throwable { - new DeleteActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java deleted file mode 100644 index 64fb5790244..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlTemplateVersionOptions model. - */ -public class DeleteActionControlTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteActionControlTemplateVersionOptions() throws Throwable { - DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptionsModel = new DeleteActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - assertEquals(deleteActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(deleteActionControlTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlTemplateVersionOptionsError() throws Throwable { - new DeleteActionControlTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java deleted file mode 100644 index 75aed905222..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyAssignmentOptions model. - */ -public class DeletePolicyAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeletePolicyAssignmentOptions() throws Throwable { - DeletePolicyAssignmentOptions deletePolicyAssignmentOptionsModel = new DeletePolicyAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(deletePolicyAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyAssignmentOptionsError() throws Throwable { - new DeletePolicyAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java deleted file mode 100644 index 1b130eb0f79..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyOptions model. - */ -public class DeletePolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeletePolicyOptions() throws Throwable { - DeletePolicyOptions deletePolicyOptionsModel = new DeletePolicyOptions.Builder() - .policyId("testString") - .build(); - assertEquals(deletePolicyOptionsModel.policyId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyOptionsError() throws Throwable { - new DeletePolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java deleted file mode 100644 index 288517222aa..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyTemplateOptions model. - */ -public class DeletePolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeletePolicyTemplateOptions() throws Throwable { - DeletePolicyTemplateOptions deletePolicyTemplateOptionsModel = new DeletePolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .build(); - assertEquals(deletePolicyTemplateOptionsModel.policyTemplateId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyTemplateOptionsError() throws Throwable { - new DeletePolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java deleted file mode 100644 index 7b1c6cffa1d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyTemplateVersionOptions model. - */ -public class DeletePolicyTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeletePolicyTemplateVersionOptions() throws Throwable { - DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptionsModel = new DeletePolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - assertEquals(deletePolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); - assertEquals(deletePolicyTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyTemplateVersionOptionsError() throws Throwable { - new DeletePolicyTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java deleted file mode 100644 index 7f9b614304f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleAssignmentOptions model. - */ -public class DeleteRoleAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteRoleAssignmentOptions() throws Throwable { - DeleteRoleAssignmentOptions deleteRoleAssignmentOptionsModel = new DeleteRoleAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(deleteRoleAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleAssignmentOptionsError() throws Throwable { - new DeleteRoleAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java deleted file mode 100644 index 9c6690cda7b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleOptions model. - */ -public class DeleteRoleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteRoleOptions() throws Throwable { - DeleteRoleOptions deleteRoleOptionsModel = new DeleteRoleOptions.Builder() - .roleId("testString") - .build(); - assertEquals(deleteRoleOptionsModel.roleId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleOptionsError() throws Throwable { - new DeleteRoleOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java deleted file mode 100644 index 3fc04286ed3..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleTemplateOptions model. - */ -public class DeleteRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteRoleTemplateOptions() throws Throwable { - DeleteRoleTemplateOptions deleteRoleTemplateOptionsModel = new DeleteRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .build(); - assertEquals(deleteRoleTemplateOptionsModel.roleTemplateId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleTemplateOptionsError() throws Throwable { - new DeleteRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java deleted file mode 100644 index ff652fa335c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleTemplateVersionOptions model. - */ -public class DeleteRoleTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteRoleTemplateVersionOptions() throws Throwable { - DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptionsModel = new DeleteRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - assertEquals(deleteRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); - assertEquals(deleteRoleTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleTemplateVersionOptionsError() throws Throwable { - new DeleteRoleTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java deleted file mode 100644 index 6a33aa8f116..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteV2PolicyOptions model. - */ -public class DeleteV2PolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteV2PolicyOptions() throws Throwable { - DeleteV2PolicyOptions deleteV2PolicyOptionsModel = new DeleteV2PolicyOptions.Builder() - .id("testString") - .build(); - assertEquals(deleteV2PolicyOptionsModel.id(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteV2PolicyOptionsError() throws Throwable { - new DeleteV2PolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java deleted file mode 100644 index 104a5210ed9..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.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 EnrichedRoles model. - */ -public class EnrichedRolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testEnrichedRoles() throws Throwable { - EnrichedRoles enrichedRolesModel = new EnrichedRoles(); - assertNull(enrichedRolesModel.getRoleId()); - assertNull(enrichedRolesModel.getActions()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java deleted file mode 100644 index 460b37f8105..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.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 ErrorDetails model. - */ -public class ErrorDetailsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testErrorDetails() throws Throwable { - ErrorDetails errorDetailsModel = new ErrorDetails(); - assertNull(errorDetailsModel.getConflictsWith()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java deleted file mode 100644 index e7f7f9afbfc..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.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 ErrorObject model. - */ -public class ErrorObjectTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testErrorObject() throws Throwable { - ErrorObject errorObjectModel = new ErrorObject(); - assertNull(errorObjectModel.getCode()); - assertNull(errorObjectModel.getMessage()); - assertNull(errorObjectModel.getDetails()); - assertNull(errorObjectModel.getMoreInfo()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java deleted file mode 100644 index 90c91c8fcaf..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; -import com.ibm.cloud.platform_services.iam_policy_management.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 ExternalAccountIdentityInteractionPatch model. - */ -public class ExternalAccountIdentityInteractionPatchTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testExternalAccountIdentityInteractionPatch() throws Throwable { - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - assertEquals(identityTypesBaseModel.state(), "enabled"); - assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); - - IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() - .user(identityTypesBaseModel) - .serviceId(identityTypesBaseModel) - .service(identityTypesBaseModel) - .build(); - assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); - - ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() - .identityTypes(identityTypesPatchModel) - .build(); - assertEquals(externalAccountIdentityInteractionPatchModel.identityTypes(), identityTypesPatchModel); - - String json = TestUtilities.serialize(externalAccountIdentityInteractionPatchModel); - - ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModelNew = TestUtilities.deserialize(json, ExternalAccountIdentityInteractionPatch.class); - assertTrue(externalAccountIdentityInteractionPatchModelNew instanceof ExternalAccountIdentityInteractionPatch); - assertEquals(externalAccountIdentityInteractionPatchModelNew.identityTypes().toString(), identityTypesPatchModel.toString()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java deleted file mode 100644 index 2e4aaef7e07..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.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 ExternalAccountIdentityInteraction model. - */ -public class ExternalAccountIdentityInteractionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testExternalAccountIdentityInteraction() throws Throwable { - ExternalAccountIdentityInteraction externalAccountIdentityInteractionModel = new ExternalAccountIdentityInteraction(); - assertNull(externalAccountIdentityInteractionModel.getIdentityTypes()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java deleted file mode 100644 index b4d68673091..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.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 First model. - */ -public class FirstTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testFirst() throws Throwable { - First firstModel = new First(); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java deleted file mode 100644 index 73e66a5a756..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlAssignmentOptions model. - */ -public class GetActionControlAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetActionControlAssignmentOptions() throws Throwable { - GetActionControlAssignmentOptions getActionControlAssignmentOptionsModel = new GetActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(getActionControlAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlAssignmentOptionsError() throws Throwable { - new GetActionControlAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java deleted file mode 100644 index d6e66ce6939..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlTemplateOptions model. - */ -public class GetActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetActionControlTemplateOptions() throws Throwable { - GetActionControlTemplateOptions getActionControlTemplateOptionsModel = new GetActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .build(); - assertEquals(getActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(getActionControlTemplateOptionsModel.state(), "active"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlTemplateOptionsError() throws Throwable { - new GetActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java deleted file mode 100644 index ac8e17fe083..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlTemplateVersionOptions model. - */ -public class GetActionControlTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetActionControlTemplateVersionOptions() throws Throwable { - GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptionsModel = new GetActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - assertEquals(getActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(getActionControlTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlTemplateVersionOptionsError() throws Throwable { - new GetActionControlTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java deleted file mode 100644 index 6b2a479c37d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyAssignmentOptions model. - */ -public class GetPolicyAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetPolicyAssignmentOptions() throws Throwable { - GetPolicyAssignmentOptions getPolicyAssignmentOptionsModel = new GetPolicyAssignmentOptions.Builder() - .assignmentId("testString") - .version("1.0") - .build(); - assertEquals(getPolicyAssignmentOptionsModel.assignmentId(), "testString"); - assertEquals(getPolicyAssignmentOptionsModel.version(), "1.0"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyAssignmentOptionsError() throws Throwable { - new GetPolicyAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java deleted file mode 100644 index 2a7348c2c2d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyOptions model. - */ -public class GetPolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetPolicyOptions() throws Throwable { - GetPolicyOptions getPolicyOptionsModel = new GetPolicyOptions.Builder() - .policyId("testString") - .build(); - assertEquals(getPolicyOptionsModel.policyId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyOptionsError() throws Throwable { - new GetPolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java deleted file mode 100644 index 06535ed77ed..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyTemplateOptions model. - */ -public class GetPolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetPolicyTemplateOptions() throws Throwable { - GetPolicyTemplateOptions getPolicyTemplateOptionsModel = new GetPolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .state("active") - .build(); - assertEquals(getPolicyTemplateOptionsModel.policyTemplateId(), "testString"); - assertEquals(getPolicyTemplateOptionsModel.state(), "active"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyTemplateOptionsError() throws Throwable { - new GetPolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java deleted file mode 100644 index 264b5db4912..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyTemplateVersionOptions model. - */ -public class GetPolicyTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetPolicyTemplateVersionOptions() throws Throwable { - GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptionsModel = new GetPolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - assertEquals(getPolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); - assertEquals(getPolicyTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyTemplateVersionOptionsError() throws Throwable { - new GetPolicyTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java deleted file mode 100644 index 0c1f6b2bb5a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleAssignmentOptions model. - */ -public class GetRoleAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetRoleAssignmentOptions() throws Throwable { - GetRoleAssignmentOptions getRoleAssignmentOptionsModel = new GetRoleAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(getRoleAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleAssignmentOptionsError() throws Throwable { - new GetRoleAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java deleted file mode 100644 index e589b8d1285..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleOptions model. - */ -public class GetRoleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetRoleOptions() throws Throwable { - GetRoleOptions getRoleOptionsModel = new GetRoleOptions.Builder() - .roleId("testString") - .build(); - assertEquals(getRoleOptionsModel.roleId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleOptionsError() throws Throwable { - new GetRoleOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java deleted file mode 100644 index 3c10b5207dc..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleTemplateOptions model. - */ -public class GetRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetRoleTemplateOptions() throws Throwable { - GetRoleTemplateOptions getRoleTemplateOptionsModel = new GetRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .state("active") - .build(); - assertEquals(getRoleTemplateOptionsModel.roleTemplateId(), "testString"); - assertEquals(getRoleTemplateOptionsModel.state(), "active"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleTemplateOptionsError() throws Throwable { - new GetRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java deleted file mode 100644 index 3bd5d278630..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleTemplateVersionOptions model. - */ -public class GetRoleTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetRoleTemplateVersionOptions() throws Throwable { - GetRoleTemplateVersionOptions getRoleTemplateVersionOptionsModel = new GetRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - assertEquals(getRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); - assertEquals(getRoleTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleTemplateVersionOptionsError() throws Throwable { - new GetRoleTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java deleted file mode 100644 index 00f780c4153..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetSettingsOptions model. - */ -public class GetSettingsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetSettingsOptions() throws Throwable { - GetSettingsOptions getSettingsOptionsModel = new GetSettingsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .build(); - assertEquals(getSettingsOptionsModel.accountId(), "testString"); - assertEquals(getSettingsOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetSettingsOptionsError() throws Throwable { - new GetSettingsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java deleted file mode 100644 index ebad7af7371..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetV2PolicyOptions model. - */ -public class GetV2PolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetV2PolicyOptions() throws Throwable { - GetV2PolicyOptions getV2PolicyOptionsModel = new GetV2PolicyOptions.Builder() - .id("testString") - .format("include_last_permit") - .build(); - assertEquals(getV2PolicyOptionsModel.id(), "testString"); - assertEquals(getV2PolicyOptionsModel.format(), "include_last_permit"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetV2PolicyOptionsError() throws Throwable { - new GetV2PolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java deleted file mode 100644 index f627a54ecc2..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 Grant model. - */ -public class GrantTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGrant() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); - - String json = TestUtilities.serialize(grantModel); - - Grant grantModelNew = TestUtilities.deserialize(json, Grant.class); - assertTrue(grantModelNew instanceof Grant); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGrantError() throws Throwable { - new Grant.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java deleted file mode 100644 index f86af34fab8..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.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 GrantWithEnrichedRoles model. - */ -public class GrantWithEnrichedRolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGrantWithEnrichedRoles() throws Throwable { - GrantWithEnrichedRoles grantWithEnrichedRolesModel = new GrantWithEnrichedRoles(); - assertNull(grantWithEnrichedRolesModel.getRoles()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java deleted file mode 100644 index 2a4d38de51a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypesBase model. - */ -public class IdentityTypesBaseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testIdentityTypesBase() throws Throwable { - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - assertEquals(identityTypesBaseModel.state(), "enabled"); - assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(identityTypesBaseModel); - - IdentityTypesBase identityTypesBaseModelNew = TestUtilities.deserialize(json, IdentityTypesBase.class); - assertTrue(identityTypesBaseModelNew instanceof IdentityTypesBase); - assertEquals(identityTypesBaseModelNew.state(), "enabled"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testIdentityTypesBaseError() throws Throwable { - new IdentityTypesBase.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java deleted file mode 100644 index 3e762536695..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; -import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypesPatch model. - */ -public class IdentityTypesPatchTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testIdentityTypesPatch() throws Throwable { - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - assertEquals(identityTypesBaseModel.state(), "enabled"); - assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); - - IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() - .user(identityTypesBaseModel) - .serviceId(identityTypesBaseModel) - .service(identityTypesBaseModel) - .build(); - assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); - - String json = TestUtilities.serialize(identityTypesPatchModel); - - IdentityTypesPatch identityTypesPatchModelNew = TestUtilities.deserialize(json, IdentityTypesPatch.class); - assertTrue(identityTypesPatchModelNew instanceof IdentityTypesPatch); - assertEquals(identityTypesPatchModelNew.user().toString(), identityTypesBaseModel.toString()); - assertEquals(identityTypesPatchModelNew.serviceId().toString(), identityTypesBaseModel.toString()); - assertEquals(identityTypesPatchModelNew.service().toString(), identityTypesBaseModel.toString()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java deleted file mode 100644 index e2b6c77338f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypes model. - */ -public class IdentityTypesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testIdentityTypes() throws Throwable { - IdentityTypes identityTypesModel = new IdentityTypes(); - assertNull(identityTypesModel.getUser()); - assertNull(identityTypesModel.getServiceId()); - assertNull(identityTypesModel.getService()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java deleted file mode 100644 index c3f51516e25..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; -import com.ibm.cloud.platform_services.iam_policy_management.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 LimitData model. - */ -public class LimitDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testLimitData() throws Throwable { - LimitData limitDataModel = new LimitData(); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java deleted file mode 100644 index 0d64653d829..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlAssignmentsOptions model. - */ -public class ListActionControlAssignmentsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListActionControlAssignmentsOptions() throws Throwable { - ListActionControlAssignmentsOptions listActionControlAssignmentsOptionsModel = new ListActionControlAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listActionControlAssignmentsOptionsModel.accountId(), "testString"); - assertEquals(listActionControlAssignmentsOptionsModel.acceptLanguage(), "default"); - assertEquals(listActionControlAssignmentsOptionsModel.templateId(), "testString"); - assertEquals(listActionControlAssignmentsOptionsModel.templateVersion(), "testString"); - assertEquals(listActionControlAssignmentsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listActionControlAssignmentsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlAssignmentsOptionsError() throws Throwable { - new ListActionControlAssignmentsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java deleted file mode 100644 index dfe91662d83..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlTemplateVersionsOptions model. - */ -public class ListActionControlTemplateVersionsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListActionControlTemplateVersionsOptions() throws Throwable { - ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptionsModel = new ListActionControlTemplateVersionsOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listActionControlTemplateVersionsOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(listActionControlTemplateVersionsOptionsModel.state(), "active"); - assertEquals(listActionControlTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listActionControlTemplateVersionsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlTemplateVersionsOptionsError() throws Throwable { - new ListActionControlTemplateVersionsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java deleted file mode 100644 index 9e2e6a18158..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlTemplatesOptions model. - */ -public class ListActionControlTemplatesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListActionControlTemplatesOptions() throws Throwable { - ListActionControlTemplatesOptions listActionControlTemplatesOptionsModel = new ListActionControlTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listActionControlTemplatesOptionsModel.accountId(), "testString"); - assertEquals(listActionControlTemplatesOptionsModel.acceptLanguage(), "default"); - assertEquals(listActionControlTemplatesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listActionControlTemplatesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlTemplatesOptionsError() throws Throwable { - new ListActionControlTemplatesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java deleted file mode 100644 index 8bfe5000355..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListPoliciesOptions model. - */ -public class ListPoliciesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListPoliciesOptions() throws Throwable { - ListPoliciesOptions listPoliciesOptionsModel = new ListPoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .tagName("testString") - .tagValue("testString") - .sort("id") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listPoliciesOptionsModel.accountId(), "testString"); - assertEquals(listPoliciesOptionsModel.acceptLanguage(), "default"); - assertEquals(listPoliciesOptionsModel.iamId(), "testString"); - assertEquals(listPoliciesOptionsModel.accessGroupId(), "testString"); - assertEquals(listPoliciesOptionsModel.type(), "access"); - assertEquals(listPoliciesOptionsModel.serviceType(), "service"); - assertEquals(listPoliciesOptionsModel.tagName(), "testString"); - assertEquals(listPoliciesOptionsModel.tagValue(), "testString"); - assertEquals(listPoliciesOptionsModel.sort(), "id"); - assertEquals(listPoliciesOptionsModel.format(), "include_last_permit"); - assertEquals(listPoliciesOptionsModel.state(), "active"); - assertEquals(listPoliciesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listPoliciesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPoliciesOptionsError() throws Throwable { - new ListPoliciesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java deleted file mode 100644 index 32729befeda..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyAssignmentsOptions model. - */ -public class ListPolicyAssignmentsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListPolicyAssignmentsOptions() throws Throwable { - ListPolicyAssignmentsOptions listPolicyAssignmentsOptionsModel = new ListPolicyAssignmentsOptions.Builder() - .version("1.0") - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listPolicyAssignmentsOptionsModel.version(), "1.0"); - assertEquals(listPolicyAssignmentsOptionsModel.accountId(), "testString"); - assertEquals(listPolicyAssignmentsOptionsModel.acceptLanguage(), "default"); - assertEquals(listPolicyAssignmentsOptionsModel.templateId(), "testString"); - assertEquals(listPolicyAssignmentsOptionsModel.templateVersion(), "testString"); - assertEquals(listPolicyAssignmentsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listPolicyAssignmentsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyAssignmentsOptionsError() throws Throwable { - new ListPolicyAssignmentsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java deleted file mode 100644 index 1053d41b84b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyTemplateVersionsOptions model. - */ -public class ListPolicyTemplateVersionsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListPolicyTemplateVersionsOptions() throws Throwable { - ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptionsModel = new ListPolicyTemplateVersionsOptions.Builder() - .policyTemplateId("testString") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listPolicyTemplateVersionsOptionsModel.policyTemplateId(), "testString"); - assertEquals(listPolicyTemplateVersionsOptionsModel.state(), "active"); - assertEquals(listPolicyTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listPolicyTemplateVersionsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyTemplateVersionsOptionsError() throws Throwable { - new ListPolicyTemplateVersionsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java deleted file mode 100644 index 5065a9d9495..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyTemplatesOptions model. - */ -public class ListPolicyTemplatesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListPolicyTemplatesOptions() throws Throwable { - ListPolicyTemplatesOptions listPolicyTemplatesOptionsModel = new ListPolicyTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .state("active") - .name("testString") - .policyServiceType("service") - .policyServiceName("testString") - .policyServiceGroupId("testString") - .policyType("access") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listPolicyTemplatesOptionsModel.accountId(), "testString"); - assertEquals(listPolicyTemplatesOptionsModel.acceptLanguage(), "default"); - assertEquals(listPolicyTemplatesOptionsModel.state(), "active"); - assertEquals(listPolicyTemplatesOptionsModel.name(), "testString"); - assertEquals(listPolicyTemplatesOptionsModel.policyServiceType(), "service"); - assertEquals(listPolicyTemplatesOptionsModel.policyServiceName(), "testString"); - assertEquals(listPolicyTemplatesOptionsModel.policyServiceGroupId(), "testString"); - assertEquals(listPolicyTemplatesOptionsModel.policyType(), "access"); - assertEquals(listPolicyTemplatesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listPolicyTemplatesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyTemplatesOptionsError() throws Throwable { - new ListPolicyTemplatesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java deleted file mode 100644 index bd82df9bfd5..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleAssignmentsOptions model. - */ -public class ListRoleAssignmentsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListRoleAssignmentsOptions() throws Throwable { - ListRoleAssignmentsOptions listRoleAssignmentsOptionsModel = new ListRoleAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listRoleAssignmentsOptionsModel.accountId(), "testString"); - assertEquals(listRoleAssignmentsOptionsModel.acceptLanguage(), "default"); - assertEquals(listRoleAssignmentsOptionsModel.templateId(), "testString"); - assertEquals(listRoleAssignmentsOptionsModel.templateVersion(), "testString"); - assertEquals(listRoleAssignmentsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listRoleAssignmentsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleAssignmentsOptionsError() throws Throwable { - new ListRoleAssignmentsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java deleted file mode 100644 index 2e89527b653..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleTemplateVersionsOptions model. - */ -public class ListRoleTemplateVersionsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListRoleTemplateVersionsOptions() throws Throwable { - ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptionsModel = new ListRoleTemplateVersionsOptions.Builder() - .roleTemplateId("testString") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listRoleTemplateVersionsOptionsModel.roleTemplateId(), "testString"); - assertEquals(listRoleTemplateVersionsOptionsModel.state(), "active"); - assertEquals(listRoleTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listRoleTemplateVersionsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleTemplateVersionsOptionsError() throws Throwable { - new ListRoleTemplateVersionsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java deleted file mode 100644 index 21d23a7be0f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleTemplatesOptions model. - */ -public class ListRoleTemplatesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListRoleTemplatesOptions() throws Throwable { - ListRoleTemplatesOptions listRoleTemplatesOptionsModel = new ListRoleTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .name("testString") - .roleName("testString") - .roleServiceName("testString") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listRoleTemplatesOptionsModel.accountId(), "testString"); - assertEquals(listRoleTemplatesOptionsModel.acceptLanguage(), "default"); - assertEquals(listRoleTemplatesOptionsModel.name(), "testString"); - assertEquals(listRoleTemplatesOptionsModel.roleName(), "testString"); - assertEquals(listRoleTemplatesOptionsModel.roleServiceName(), "testString"); - assertEquals(listRoleTemplatesOptionsModel.state(), "active"); - assertEquals(listRoleTemplatesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listRoleTemplatesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleTemplatesOptionsError() throws Throwable { - new ListRoleTemplatesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java deleted file mode 100644 index 4fb97c7fc9a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListRolesOptions model. - */ -public class ListRolesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListRolesOptions() throws Throwable { - ListRolesOptions listRolesOptionsModel = new ListRolesOptions.Builder() - .acceptLanguage("default") - .accountId("testString") - .serviceName("iam-groups") - .sourceServiceName("iam-groups") - .policyType("authorization") - .serviceGroupId("IAM") - .build(); - assertEquals(listRolesOptionsModel.acceptLanguage(), "default"); - assertEquals(listRolesOptionsModel.accountId(), "testString"); - assertEquals(listRolesOptionsModel.serviceName(), "iam-groups"); - assertEquals(listRolesOptionsModel.sourceServiceName(), "iam-groups"); - assertEquals(listRolesOptionsModel.policyType(), "authorization"); - assertEquals(listRolesOptionsModel.serviceGroupId(), "IAM"); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java deleted file mode 100644 index 8c72945373b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListV2PoliciesOptions model. - */ -public class ListV2PoliciesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListV2PoliciesOptions() throws Throwable { - ListV2PoliciesOptions listV2PoliciesOptionsModel = new ListV2PoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .serviceName("testString") - .serviceGroupId("testString") - .sort("testString") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listV2PoliciesOptionsModel.accountId(), "testString"); - assertEquals(listV2PoliciesOptionsModel.acceptLanguage(), "default"); - assertEquals(listV2PoliciesOptionsModel.iamId(), "testString"); - assertEquals(listV2PoliciesOptionsModel.accessGroupId(), "testString"); - assertEquals(listV2PoliciesOptionsModel.type(), "access"); - assertEquals(listV2PoliciesOptionsModel.serviceType(), "service"); - assertEquals(listV2PoliciesOptionsModel.serviceName(), "testString"); - assertEquals(listV2PoliciesOptionsModel.serviceGroupId(), "testString"); - assertEquals(listV2PoliciesOptionsModel.sort(), "testString"); - assertEquals(listV2PoliciesOptionsModel.format(), "include_last_permit"); - assertEquals(listV2PoliciesOptionsModel.state(), "active"); - assertEquals(listV2PoliciesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listV2PoliciesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListV2PoliciesOptionsError() throws Throwable { - new ListV2PoliciesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java deleted file mode 100644 index 0661d4245a2..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 NestedConditionRuleAttribute model. - */ -public class NestedConditionRuleAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNestedConditionRuleAttribute() throws Throwable { - NestedConditionRuleAttribute nestedConditionRuleAttributeModel = new NestedConditionRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(nestedConditionRuleAttributeModel.key(), "testString"); - assertEquals(nestedConditionRuleAttributeModel.operator(), "stringEquals"); - assertEquals(nestedConditionRuleAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(nestedConditionRuleAttributeModel); - - NestedConditionRuleAttribute nestedConditionRuleAttributeModelNew = TestUtilities.deserialize(json, NestedConditionRuleAttribute.class); - assertTrue(nestedConditionRuleAttributeModelNew instanceof NestedConditionRuleAttribute); - assertEquals(nestedConditionRuleAttributeModelNew.key(), "testString"); - assertEquals(nestedConditionRuleAttributeModelNew.operator(), "stringEquals"); - assertEquals(nestedConditionRuleAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testNestedConditionRuleAttributeError() throws Throwable { - new NestedConditionRuleAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java deleted file mode 100644 index 1ba394dbb7d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleWithConditions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 NestedConditionRuleWithConditions model. - */ -public class NestedConditionRuleWithConditionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNestedConditionRuleWithConditions() throws Throwable { - RuleAttribute ruleAttributeModel = new RuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(ruleAttributeModel.key(), "testString"); - assertEquals(ruleAttributeModel.operator(), "stringEquals"); - assertEquals(ruleAttributeModel.value(), "testString"); - - NestedConditionRuleWithConditions nestedConditionRuleWithConditionsModel = new NestedConditionRuleWithConditions.Builder() - .operator("and") - .conditions(java.util.Arrays.asList(ruleAttributeModel)) - .build(); - assertEquals(nestedConditionRuleWithConditionsModel.operator(), "and"); - assertEquals(nestedConditionRuleWithConditionsModel.conditions(), java.util.Arrays.asList(ruleAttributeModel)); - - String json = TestUtilities.serialize(nestedConditionRuleWithConditionsModel); - - NestedConditionRuleWithConditions nestedConditionRuleWithConditionsModelNew = TestUtilities.deserialize(json, NestedConditionRuleWithConditions.class); - assertTrue(nestedConditionRuleWithConditionsModelNew instanceof NestedConditionRuleWithConditions); - assertEquals(nestedConditionRuleWithConditionsModelNew.operator(), "and"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testNestedConditionRuleWithConditionsError() throws Throwable { - new NestedConditionRuleWithConditions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java deleted file mode 100644 index 4956eea2675..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedCondition; -import com.ibm.cloud.platform_services.iam_policy_management.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 NestedCondition model. - */ -public class NestedConditionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testNestedCondition() throws Throwable { - NestedCondition nestedConditionModel = new NestedCondition(); - assertNotNull(nestedConditionModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java deleted file mode 100644 index c5e084a44d5..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.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 Next model. - */ -public class NextTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNext() throws Throwable { - Next nextModel = new Next(); - assertNull(nextModel.getStart()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java deleted file mode 100644 index d5b05ede760..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentResourcePolicy model. - */ -public class PolicyAssignmentResourcePolicyTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentResourcePolicy() throws Throwable { - PolicyAssignmentResourcePolicy policyAssignmentResourcePolicyModel = new PolicyAssignmentResourcePolicy(); - assertNull(policyAssignmentResourcePolicyModel.getResourceCreated()); - assertNull(policyAssignmentResourcePolicyModel.getStatus()); - assertNull(policyAssignmentResourcePolicyModel.getErrorMessage()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java deleted file mode 100644 index 8b146425617..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentResources model. - */ -public class PolicyAssignmentResourcesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentResources() throws Throwable { - PolicyAssignmentResources policyAssignmentResourcesModel = new PolicyAssignmentResources(); - assertNull(policyAssignmentResourcesModel.getTarget()); - assertNull(policyAssignmentResourcesModel.getPolicy()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java deleted file mode 100644 index 8a3a6b67703..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Collection model. - */ -public class PolicyAssignmentV1CollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentV1Collection() throws Throwable { - PolicyAssignmentV1Collection policyAssignmentV1CollectionModel = new PolicyAssignmentV1Collection(); - assertNull(policyAssignmentV1CollectionModel.getLimit()); - assertNull(policyAssignmentV1CollectionModel.getFirst()); - assertNull(policyAssignmentV1CollectionModel.getNext()); - assertNull(policyAssignmentV1CollectionModel.getPrevious()); - assertNull(policyAssignmentV1CollectionModel.getAssignments()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java deleted file mode 100644 index 56c843a232e..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Resources model. - */ -public class PolicyAssignmentV1ResourcesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentV1Resources() throws Throwable { - PolicyAssignmentV1Resources policyAssignmentV1ResourcesModel = new PolicyAssignmentV1Resources(); - assertNull(policyAssignmentV1ResourcesModel.getTarget()); - assertNull(policyAssignmentV1ResourcesModel.getPolicy()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java deleted file mode 100644 index f5d14b29447..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Subject model. - */ -public class PolicyAssignmentV1SubjectTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentV1Subject() throws Throwable { - PolicyAssignmentV1Subject policyAssignmentV1SubjectModel = new PolicyAssignmentV1Subject(); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java deleted file mode 100644 index d9889483421..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1 model. - */ -public class PolicyAssignmentV1Test { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentV1() throws Throwable { - PolicyAssignmentV1 policyAssignmentV1Model = new PolicyAssignmentV1(); - assertNull(policyAssignmentV1Model.getTarget()); - assertNull(policyAssignmentV1Model.getResources()); - assertNull(policyAssignmentV1Model.getSubject()); - assertNull(policyAssignmentV1Model.getTemplate()); - assertNull(policyAssignmentV1Model.getStatus()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java deleted file mode 100644 index 3d372dfaf20..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyCollection model. - */ -public class PolicyCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyCollection() throws Throwable { - PolicyCollection policyCollectionModel = new PolicyCollection(); - assertNull(policyCollectionModel.getLimit()); - assertNull(policyCollectionModel.getFirst()); - assertNull(policyCollectionModel.getNext()); - assertNull(policyCollectionModel.getPrevious()); - assertNull(policyCollectionModel.getPolicies()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java deleted file mode 100644 index cb2f203a5c3..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyResource model. - */ -public class PolicyResourceTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyResource() throws Throwable { - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceAttributeModel.name(), "testString"); - assertEquals(resourceAttributeModel.value(), "testString"); - assertEquals(resourceAttributeModel.operator(), "testString"); - - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceTagModel.name(), "testString"); - assertEquals(resourceTagModel.value(), "testString"); - assertEquals(resourceTagModel.operator(), "testString"); - - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); - assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); - - String json = TestUtilities.serialize(policyResourceModel); - - PolicyResource policyResourceModelNew = TestUtilities.deserialize(json, PolicyResource.class); - assertTrue(policyResourceModelNew instanceof PolicyResource); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testPolicyResourceError() throws Throwable { - new PolicyResource.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java deleted file mode 100644 index 299e15b1fd4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyRole model. - */ -public class PolicyRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyRole() throws Throwable { - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - assertEquals(policyRoleModel.roleId(), "testString"); - - String json = TestUtilities.serialize(policyRoleModel); - - PolicyRole policyRoleModelNew = TestUtilities.deserialize(json, PolicyRole.class); - assertTrue(policyRoleModelNew instanceof PolicyRole); - assertEquals(policyRoleModelNew.roleId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testPolicyRoleError() throws Throwable { - new PolicyRole.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java deleted file mode 100644 index 6d0a937bd53..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicySubject model. - */ -public class PolicySubjectTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicySubject() throws Throwable { - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - assertEquals(subjectAttributeModel.name(), "testString"); - assertEquals(subjectAttributeModel.value(), "testString"); - - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); - - String json = TestUtilities.serialize(policySubjectModel); - - PolicySubject policySubjectModelNew = TestUtilities.deserialize(json, PolicySubject.class); - assertTrue(policySubjectModelNew instanceof PolicySubject); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testPolicySubjectError() throws Throwable { - new PolicySubject.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java deleted file mode 100644 index 8cb98be3d32..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentCollection model. - */ -public class PolicyTemplateAssignmentCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateAssignmentCollection() throws Throwable { - PolicyTemplateAssignmentCollection policyTemplateAssignmentCollectionModel = new PolicyTemplateAssignmentCollection(); - assertNull(policyTemplateAssignmentCollectionModel.getLimit()); - assertNull(policyTemplateAssignmentCollectionModel.getFirst()); - assertNull(policyTemplateAssignmentCollectionModel.getNext()); - assertNull(policyTemplateAssignmentCollectionModel.getPrevious()); - assertNull(policyTemplateAssignmentCollectionModel.getAssignments()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java deleted file mode 100644 index fded12633d2..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItemsPolicyAssignment model. - */ -public class PolicyTemplateAssignmentItemsPolicyAssignmentTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateAssignmentItemsPolicyAssignment() throws Throwable { - PolicyTemplateAssignmentItemsPolicyAssignment policyTemplateAssignmentItemsPolicyAssignmentModel = new PolicyTemplateAssignmentItemsPolicyAssignment(); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTemplateId()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTemplateVersion()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getAssignmentId()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTargetType()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTarget()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getResources()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getStatus()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java deleted file mode 100644 index 6b74125d238..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItemsPolicyAssignmentV1 model. - */ -public class PolicyTemplateAssignmentItemsPolicyAssignmentV1Test { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateAssignmentItemsPolicyAssignmentV1() throws Throwable { - PolicyTemplateAssignmentItemsPolicyAssignmentV1 policyTemplateAssignmentItemsPolicyAssignmentV1Model = new PolicyTemplateAssignmentItemsPolicyAssignmentV1(); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getTarget()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getResources()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getSubject()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getTemplate()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getStatus()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java deleted file mode 100644 index 05b400e91c1..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItems model. - */ -public class PolicyTemplateAssignmentItemsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testPolicyTemplateAssignmentItems() throws Throwable { - PolicyTemplateAssignmentItems policyTemplateAssignmentItemsModel = new PolicyTemplateAssignmentItems(); - assertNotNull(policyTemplateAssignmentItemsModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java deleted file mode 100644 index 52041b1a6a3..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateCollection model. - */ -public class PolicyTemplateCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateCollection() throws Throwable { - PolicyTemplateCollection policyTemplateCollectionModel = new PolicyTemplateCollection(); - assertNull(policyTemplateCollectionModel.getLimit()); - assertNull(policyTemplateCollectionModel.getFirst()); - assertNull(policyTemplateCollectionModel.getNext()); - assertNull(policyTemplateCollectionModel.getPrevious()); - assertNull(policyTemplateCollectionModel.getPolicyTemplates()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java deleted file mode 100644 index b6ee06990a2..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateLimitData model. - */ -public class PolicyTemplateLimitDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateLimitData() throws Throwable { - PolicyTemplateLimitData policyTemplateLimitDataModel = new PolicyTemplateLimitData(); - assertNull(policyTemplateLimitDataModel.getName()); - assertNull(policyTemplateLimitDataModel.getDescription()); - assertNull(policyTemplateLimitDataModel.getAccountId()); - assertNull(policyTemplateLimitDataModel.getVersion()); - assertNull(policyTemplateLimitDataModel.isCommitted()); - assertNull(policyTemplateLimitDataModel.getPolicy()); - assertNull(policyTemplateLimitDataModel.getState()); - assertNull(policyTemplateLimitDataModel.getCounts()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java deleted file mode 100644 index edeb45c4d96..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateMetaData model. - */ -public class PolicyTemplateMetaDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateMetaData() throws Throwable { - PolicyTemplateMetaData policyTemplateMetaDataModel = new PolicyTemplateMetaData(); - assertNull(policyTemplateMetaDataModel.getType()); - assertNull(policyTemplateMetaDataModel.getDescription()); - assertNull(policyTemplateMetaDataModel.getSubjects()); - assertNull(policyTemplateMetaDataModel.getRoles()); - assertNull(policyTemplateMetaDataModel.getResources()); - assertNull(policyTemplateMetaDataModel.getState()); - assertNull(policyTemplateMetaDataModel.getTemplate()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java deleted file mode 100644 index c349e4a3415..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplate model. - */ -public class PolicyTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplate() throws Throwable { - PolicyTemplate policyTemplateModel = new PolicyTemplate(); - assertNull(policyTemplateModel.getName()); - assertNull(policyTemplateModel.getDescription()); - assertNull(policyTemplateModel.getAccountId()); - assertNull(policyTemplateModel.getVersion()); - assertNull(policyTemplateModel.isCommitted()); - assertNull(policyTemplateModel.getPolicy()); - assertNull(policyTemplateModel.getState()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java deleted file mode 100644 index da651956461..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateVersionsCollection model. - */ -public class PolicyTemplateVersionsCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateVersionsCollection() throws Throwable { - PolicyTemplateVersionsCollection policyTemplateVersionsCollectionModel = new PolicyTemplateVersionsCollection(); - assertNull(policyTemplateVersionsCollectionModel.getLimit()); - assertNull(policyTemplateVersionsCollectionModel.getFirst()); - assertNull(policyTemplateVersionsCollectionModel.getNext()); - assertNull(policyTemplateVersionsCollectionModel.getPrevious()); - assertNull(policyTemplateVersionsCollectionModel.getVersions()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java deleted file mode 100644 index 28eba4f9a85..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 Policy model. - */ -public class PolicyTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicy() throws Throwable { - Policy policyModel = new Policy(); - assertNull(policyModel.getType()); - assertNull(policyModel.getDescription()); - assertNull(policyModel.getSubjects()); - assertNull(policyModel.getRoles()); - assertNull(policyModel.getResources()); - assertNull(policyModel.getState()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java deleted file mode 100644 index e3788c51212..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.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 Previous model. - */ -public class PreviousTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPrevious() throws Throwable { - Previous previousModel = new Previous(); - assertNull(previousModel.getStart()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java deleted file mode 100644 index 430f5f63764..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceActionControlTemplateOptions model. - */ -public class ReplaceActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplaceActionControlTemplateOptions() throws Throwable { - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateActionControlModel.serviceName(), "testString"); - assertEquals(templateActionControlModel.description(), "testString"); - assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); - - ReplaceActionControlTemplateOptions replaceActionControlTemplateOptionsModel = new ReplaceActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .ifMatch("testString") - .name("testString") - .description("testString") - .actionControl(templateActionControlModel) - .committed(true) - .build(); - assertEquals(replaceActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.version(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.ifMatch(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.name(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.description(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.actionControl(), templateActionControlModel); - assertEquals(replaceActionControlTemplateOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceActionControlTemplateOptionsError() throws Throwable { - new ReplaceActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java deleted file mode 100644 index 2f20b05f37c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplacePolicyOptions model. - */ -public class ReplacePolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplacePolicyOptions() throws Throwable { - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - assertEquals(subjectAttributeModel.name(), "testString"); - assertEquals(subjectAttributeModel.value(), "testString"); - - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); - - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - assertEquals(policyRoleModel.roleId(), "testString"); - - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceAttributeModel.name(), "testString"); - assertEquals(resourceAttributeModel.value(), "testString"); - assertEquals(resourceAttributeModel.operator(), "testString"); - - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceTagModel.name(), "testString"); - assertEquals(resourceTagModel.value(), "testString"); - assertEquals(resourceTagModel.operator(), "testString"); - - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); - assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); - - ReplacePolicyOptions replacePolicyOptionsModel = new ReplacePolicyOptions.Builder() - .policyId("testString") - .ifMatch("testString") - .type("testString") - .subjects(java.util.Arrays.asList(policySubjectModel)) - .roles(java.util.Arrays.asList(policyRoleModel)) - .resources(java.util.Arrays.asList(policyResourceModel)) - .description("testString") - .build(); - assertEquals(replacePolicyOptionsModel.policyId(), "testString"); - assertEquals(replacePolicyOptionsModel.ifMatch(), "testString"); - assertEquals(replacePolicyOptionsModel.type(), "testString"); - assertEquals(replacePolicyOptionsModel.subjects(), java.util.Arrays.asList(policySubjectModel)); - assertEquals(replacePolicyOptionsModel.roles(), java.util.Arrays.asList(policyRoleModel)); - assertEquals(replacePolicyOptionsModel.resources(), java.util.Arrays.asList(policyResourceModel)); - assertEquals(replacePolicyOptionsModel.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplacePolicyOptionsError() throws Throwable { - new ReplacePolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java deleted file mode 100644 index 2dc2430daca..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplacePolicyTemplateOptions model. - */ -public class ReplacePolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplacePolicyTemplateOptions() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - assertEquals(templatePolicyModel.type(), "access"); - assertEquals(templatePolicyModel.description(), "testString"); - assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); - assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); - assertEquals(templatePolicyModel.pattern(), "testString"); - assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), templateControlModel); - - ReplacePolicyTemplateOptions replacePolicyTemplateOptionsModel = new ReplacePolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .ifMatch("testString") - .policy(templatePolicyModel) - .name("testString") - .description("testString") - .committed(true) - .build(); - assertEquals(replacePolicyTemplateOptionsModel.policyTemplateId(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.version(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.ifMatch(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.policy(), templatePolicyModel); - assertEquals(replacePolicyTemplateOptionsModel.name(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.description(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplacePolicyTemplateOptionsError() throws Throwable { - new ReplacePolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java deleted file mode 100644 index 9900abb2543..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceRoleOptions model. - */ -public class ReplaceRoleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplaceRoleOptions() throws Throwable { - ReplaceRoleOptions replaceRoleOptionsModel = new ReplaceRoleOptions.Builder() - .roleId("testString") - .ifMatch("testString") - .displayName("testString") - .actions(java.util.Arrays.asList("testString")) - .description("testString") - .build(); - assertEquals(replaceRoleOptionsModel.roleId(), "testString"); - assertEquals(replaceRoleOptionsModel.ifMatch(), "testString"); - assertEquals(replaceRoleOptionsModel.displayName(), "testString"); - assertEquals(replaceRoleOptionsModel.actions(), java.util.Arrays.asList("testString")); - assertEquals(replaceRoleOptionsModel.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceRoleOptionsError() throws Throwable { - new ReplaceRoleOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java deleted file mode 100644 index 2f731aea7d4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceRoleTemplateOptions model. - */ -public class ReplaceRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplaceRoleTemplateOptions() throws Throwable { - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateRoleModel.displayName(), "testString"); - assertEquals(templateRoleModel.serviceName(), "testString"); - assertEquals(templateRoleModel.description(), "testString"); - assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); - - ReplaceRoleTemplateOptions replaceRoleTemplateOptionsModel = new ReplaceRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .ifMatch("testString") - .name("testString") - .description("testString") - .role(templateRoleModel) - .committed(true) - .build(); - assertEquals(replaceRoleTemplateOptionsModel.roleTemplateId(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.version(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.ifMatch(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.name(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.description(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.role(), templateRoleModel); - assertEquals(replaceRoleTemplateOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceRoleTemplateOptionsError() throws Throwable { - new ReplaceRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java deleted file mode 100644 index 23690eda780..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceV2PolicyOptions model. - */ -public class ReplaceV2PolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplaceV2PolicyOptions() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); - - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - assertEquals(controlModel.grant(), grantModel); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - ReplaceV2PolicyOptions replaceV2PolicyOptionsModel = new ReplaceV2PolicyOptions.Builder() - .id("testString") - .ifMatch("testString") - .control(controlModel) - .type("access") - .description("testString") - .subject(v2PolicySubjectModel) - .resource(v2PolicyResourceModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .build(); - assertEquals(replaceV2PolicyOptionsModel.id(), "testString"); - assertEquals(replaceV2PolicyOptionsModel.ifMatch(), "testString"); - assertEquals(replaceV2PolicyOptionsModel.control(), controlModel); - assertEquals(replaceV2PolicyOptionsModel.type(), "access"); - assertEquals(replaceV2PolicyOptionsModel.description(), "testString"); - assertEquals(replaceV2PolicyOptionsModel.subject(), v2PolicySubjectModel); - assertEquals(replaceV2PolicyOptionsModel.resource(), v2PolicyResourceModel); - assertEquals(replaceV2PolicyOptionsModel.pattern(), "testString"); - assertEquals(replaceV2PolicyOptionsModel.rule(), v2PolicyRuleModel); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceV2PolicyOptionsError() throws Throwable { - new ReplaceV2PolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java deleted file mode 100644 index bd50b514f43..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 ResourceAttribute model. - */ -public class ResourceAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testResourceAttribute() throws Throwable { - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceAttributeModel.name(), "testString"); - assertEquals(resourceAttributeModel.value(), "testString"); - assertEquals(resourceAttributeModel.operator(), "testString"); - - String json = TestUtilities.serialize(resourceAttributeModel); - - ResourceAttribute resourceAttributeModelNew = TestUtilities.deserialize(json, ResourceAttribute.class); - assertTrue(resourceAttributeModelNew instanceof ResourceAttribute); - assertEquals(resourceAttributeModelNew.name(), "testString"); - assertEquals(resourceAttributeModelNew.value(), "testString"); - assertEquals(resourceAttributeModelNew.operator(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testResourceAttributeError() throws Throwable { - new ResourceAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java deleted file mode 100644 index 88a1eb5d5b6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.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 ResourceTag model. - */ -public class ResourceTagTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testResourceTag() throws Throwable { - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceTagModel.name(), "testString"); - assertEquals(resourceTagModel.value(), "testString"); - assertEquals(resourceTagModel.operator(), "testString"); - - String json = TestUtilities.serialize(resourceTagModel); - - ResourceTag resourceTagModelNew = TestUtilities.deserialize(json, ResourceTag.class); - assertTrue(resourceTagModelNew instanceof ResourceTag); - assertEquals(resourceTagModelNew.name(), "testString"); - assertEquals(resourceTagModelNew.value(), "testString"); - assertEquals(resourceTagModelNew.operator(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testResourceTagError() throws Throwable { - new ResourceTag.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java deleted file mode 100644 index e4c0bcc6f92..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAction model. - */ -public class RoleActionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAction() throws Throwable { - RoleAction roleActionModel = new RoleAction(); - assertNull(roleActionModel.getId()); - assertNull(roleActionModel.getDisplayName()); - assertNull(roleActionModel.getDescription()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java deleted file mode 100644 index 42801bc7771..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentCollection model. - */ -public class RoleAssignmentCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentCollection() throws Throwable { - RoleAssignmentCollection roleAssignmentCollectionModel = new RoleAssignmentCollection(); - assertNull(roleAssignmentCollectionModel.getLimit()); - assertNull(roleAssignmentCollectionModel.getFirst()); - assertNull(roleAssignmentCollectionModel.getNext()); - assertNull(roleAssignmentCollectionModel.getPrevious()); - assertNull(roleAssignmentCollectionModel.getAssignments()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java deleted file mode 100644 index bef8b71b0fa..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResourceCreated model. - */ -public class RoleAssignmentResourceCreatedTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentResourceCreated() throws Throwable { - RoleAssignmentResourceCreated roleAssignmentResourceCreatedModel = new RoleAssignmentResourceCreated(); - assertNull(roleAssignmentResourceCreatedModel.getId()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java deleted file mode 100644 index c346ca0f48f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResourceRole model. - */ -public class RoleAssignmentResourceRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentResourceRole() throws Throwable { - RoleAssignmentResourceRole roleAssignmentResourceRoleModel = new RoleAssignmentResourceRole(); - assertNull(roleAssignmentResourceRoleModel.getResourceCreated()); - assertNull(roleAssignmentResourceRoleModel.getErrorMessage()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java deleted file mode 100644 index 4fca1b25b5b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResource model. - */ -public class RoleAssignmentResourceTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentResource() throws Throwable { - RoleAssignmentResource roleAssignmentResourceModel = new RoleAssignmentResource(); - assertNull(roleAssignmentResourceModel.getTarget()); - assertNull(roleAssignmentResourceModel.getRole()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java deleted file mode 100644 index 4f2e3a37200..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentTemplate model. - */ -public class RoleAssignmentTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentTemplate() throws Throwable { - RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(roleAssignmentTemplateModel.id(), "testString"); - assertEquals(roleAssignmentTemplateModel.version(), "testString"); - - String json = TestUtilities.serialize(roleAssignmentTemplateModel); - - RoleAssignmentTemplate roleAssignmentTemplateModelNew = TestUtilities.deserialize(json, RoleAssignmentTemplate.class); - assertTrue(roleAssignmentTemplateModelNew instanceof RoleAssignmentTemplate); - assertEquals(roleAssignmentTemplateModelNew.id(), "testString"); - assertEquals(roleAssignmentTemplateModelNew.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRoleAssignmentTemplateError() throws Throwable { - new RoleAssignmentTemplate.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java deleted file mode 100644 index bd3bda7ce24..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignment model. - */ -public class RoleAssignmentTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignment() throws Throwable { - RoleAssignment roleAssignmentModel = new RoleAssignment(); - assertNull(roleAssignmentModel.getTemplate()); - assertNull(roleAssignmentModel.getTarget()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java deleted file mode 100644 index 812c2dcb131..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleCollection model. - */ -public class RoleCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleCollection() throws Throwable { - RoleCollection roleCollectionModel = new RoleCollection(); - assertNull(roleCollectionModel.getCustomRoles()); - assertNull(roleCollectionModel.getServiceRoles()); - assertNull(roleCollectionModel.getSystemRoles()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java deleted file mode 100644 index fde4d11ff4c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateCollection model. - */ -public class RoleTemplateCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplateCollection() throws Throwable { - RoleTemplateCollection roleTemplateCollectionModel = new RoleTemplateCollection(); - assertNull(roleTemplateCollectionModel.getLimit()); - assertNull(roleTemplateCollectionModel.getFirst()); - assertNull(roleTemplateCollectionModel.getNext()); - assertNull(roleTemplateCollectionModel.getPrevious()); - assertNull(roleTemplateCollectionModel.getRoleTemplates()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java deleted file mode 100644 index 6c208e1c38f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplatePrototypeRole model. - */ -public class RoleTemplatePrototypeRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplatePrototypeRole() throws Throwable { - RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() - .name("testString") - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(roleTemplatePrototypeRoleModel.name(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.displayName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.serviceName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.description(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.actions(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(roleTemplatePrototypeRoleModel); - - RoleTemplatePrototypeRole roleTemplatePrototypeRoleModelNew = TestUtilities.deserialize(json, RoleTemplatePrototypeRole.class); - assertTrue(roleTemplatePrototypeRoleModelNew instanceof RoleTemplatePrototypeRole); - assertEquals(roleTemplatePrototypeRoleModelNew.name(), "testString"); - assertEquals(roleTemplatePrototypeRoleModelNew.displayName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModelNew.serviceName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModelNew.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRoleTemplatePrototypeRoleError() throws Throwable { - new RoleTemplatePrototypeRole.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java deleted file mode 100644 index af9de718e23..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateReferencesItem model. - */ -public class RoleTemplateReferencesItemTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplateReferencesItem() throws Throwable { - RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(roleTemplateReferencesItemModel.id(), "testString"); - assertEquals(roleTemplateReferencesItemModel.version(), "testString"); - - String json = TestUtilities.serialize(roleTemplateReferencesItemModel); - - RoleTemplateReferencesItem roleTemplateReferencesItemModelNew = TestUtilities.deserialize(json, RoleTemplateReferencesItem.class); - assertTrue(roleTemplateReferencesItemModelNew instanceof RoleTemplateReferencesItem); - assertEquals(roleTemplateReferencesItemModelNew.id(), "testString"); - assertEquals(roleTemplateReferencesItemModelNew.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRoleTemplateReferencesItemError() throws Throwable { - new RoleTemplateReferencesItem.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java deleted file mode 100644 index 8bb27d8dd62..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplate model. - */ -public class RoleTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplate() throws Throwable { - RoleTemplate roleTemplateModel = new RoleTemplate(); - assertNull(roleTemplateModel.getName()); - assertNull(roleTemplateModel.getDescription()); - assertNull(roleTemplateModel.getAccountId()); - assertNull(roleTemplateModel.isCommitted()); - assertNull(roleTemplateModel.getRole()); - assertNull(roleTemplateModel.getVersion()); - assertNull(roleTemplateModel.getState()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java deleted file mode 100644 index 068cf309bd6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateVersionsCollection model. - */ -public class RoleTemplateVersionsCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplateVersionsCollection() throws Throwable { - RoleTemplateVersionsCollection roleTemplateVersionsCollectionModel = new RoleTemplateVersionsCollection(); - assertNull(roleTemplateVersionsCollectionModel.getLimit()); - assertNull(roleTemplateVersionsCollectionModel.getFirst()); - assertNull(roleTemplateVersionsCollectionModel.getNext()); - assertNull(roleTemplateVersionsCollectionModel.getPrevious()); - assertNull(roleTemplateVersionsCollectionModel.getVersions()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java deleted file mode 100644 index a632e63587f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; -import com.ibm.cloud.platform_services.iam_policy_management.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 Role model. - */ -public class RoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRole() throws Throwable { - Role roleModel = new Role.Builder() - .displayName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(roleModel.displayName(), "testString"); - assertEquals(roleModel.description(), "testString"); - assertEquals(roleModel.actions(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(roleModel); - - Role roleModelNew = TestUtilities.deserialize(json, Role.class); - assertTrue(roleModelNew instanceof Role); - assertEquals(roleModelNew.displayName(), "testString"); - assertEquals(roleModelNew.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRoleError() throws Throwable { - new Role.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java deleted file mode 100644 index 8383ef794a9..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 Roles model. - */ -public class RolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoles() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - String json = TestUtilities.serialize(rolesModel); - - Roles rolesModelNew = TestUtilities.deserialize(json, Roles.class); - assertTrue(rolesModelNew instanceof Roles); - assertEquals(rolesModelNew.roleId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRolesError() throws Throwable { - new Roles.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java deleted file mode 100644 index a05e5ee8704..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 RuleAttribute model. - */ -public class RuleAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRuleAttribute() throws Throwable { - RuleAttribute ruleAttributeModel = new RuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(ruleAttributeModel.key(), "testString"); - assertEquals(ruleAttributeModel.operator(), "stringEquals"); - assertEquals(ruleAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(ruleAttributeModel); - - RuleAttribute ruleAttributeModelNew = TestUtilities.deserialize(json, RuleAttribute.class); - assertTrue(ruleAttributeModelNew instanceof RuleAttribute); - assertEquals(ruleAttributeModelNew.key(), "testString"); - assertEquals(ruleAttributeModelNew.operator(), "stringEquals"); - assertEquals(ruleAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRuleAttributeError() throws Throwable { - new RuleAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java deleted file mode 100644 index 7bae03a42e0..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 SubjectAttribute model. - */ -public class SubjectAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testSubjectAttribute() throws Throwable { - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - assertEquals(subjectAttributeModel.name(), "testString"); - assertEquals(subjectAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(subjectAttributeModel); - - SubjectAttribute subjectAttributeModelNew = TestUtilities.deserialize(json, SubjectAttribute.class); - assertTrue(subjectAttributeModelNew instanceof SubjectAttribute); - assertEquals(subjectAttributeModelNew.name(), "testString"); - assertEquals(subjectAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testSubjectAttributeError() throws Throwable { - new SubjectAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java deleted file mode 100644 index d3a6d4ef53a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateActionControl model. - */ -public class TemplateActionControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateActionControl() throws Throwable { - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateActionControlModel.serviceName(), "testString"); - assertEquals(templateActionControlModel.description(), "testString"); - assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(templateActionControlModel); - - TemplateActionControl templateActionControlModelNew = TestUtilities.deserialize(json, TemplateActionControl.class); - assertTrue(templateActionControlModelNew instanceof TemplateActionControl); - assertEquals(templateActionControlModelNew.serviceName(), "testString"); - assertEquals(templateActionControlModelNew.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateActionControlError() throws Throwable { - new TemplateActionControl.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java deleted file mode 100644 index fba96e64cef..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateControl model. - */ -public class TemplateControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateControl() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - String json = TestUtilities.serialize(templateControlModel); - - TemplateControl templateControlModelNew = TestUtilities.deserialize(json, TemplateControl.class); - assertTrue(templateControlModelNew instanceof TemplateControl); - assertEquals(templateControlModelNew.grant().toString(), templateGrantModel.toString()); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateControlError() throws Throwable { - new TemplateControl.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java deleted file mode 100644 index b440cf19100..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateCountData model. - */ -public class TemplateCountDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateCountData() throws Throwable { - TemplateCountData templateCountDataModel = new TemplateCountData(); - assertNull(templateCountDataModel.getTemplate()); - assertNull(templateCountDataModel.getVersion()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java deleted file mode 100644 index e7759eacc21..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoleReferences; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrantRoleReferences model. - */ -public class TemplateGrantRoleReferencesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateGrantRoleReferences() throws Throwable { - RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(roleTemplateReferencesItemModel.id(), "testString"); - assertEquals(roleTemplateReferencesItemModel.version(), "testString"); - - TemplateGrantRoleReferences templateGrantRoleReferencesModel = new TemplateGrantRoleReferences.Builder() - .roleTemplateReferences(java.util.Arrays.asList(roleTemplateReferencesItemModel)) - .build(); - assertEquals(templateGrantRoleReferencesModel.roleTemplateReferences(), java.util.Arrays.asList(roleTemplateReferencesItemModel)); - - String json = TestUtilities.serialize(templateGrantRoleReferencesModel); - - TemplateGrantRoleReferences templateGrantRoleReferencesModelNew = TestUtilities.deserialize(json, TemplateGrantRoleReferences.class); - assertTrue(templateGrantRoleReferencesModelNew instanceof TemplateGrantRoleReferences); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateGrantRoleReferencesError() throws Throwable { - new TemplateGrantRoleReferences.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java deleted file mode 100644 index 8cddc6f9a19..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrantRoles model. - */ -public class TemplateGrantRolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateGrantRoles() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantRolesModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantRolesModel.roles(), java.util.Arrays.asList(rolesModel)); - - String json = TestUtilities.serialize(templateGrantRolesModel); - - TemplateGrantRoles templateGrantRolesModelNew = TestUtilities.deserialize(json, TemplateGrantRoles.class); - assertTrue(templateGrantRolesModelNew instanceof TemplateGrantRoles); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateGrantRolesError() throws Throwable { - new TemplateGrantRoles.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java deleted file mode 100644 index 90e6fdc2b9f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrant model. - */ -public class TemplateGrantTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testTemplateGrant() throws Throwable { - TemplateGrant templateGrantModel = new TemplateGrant(); - assertNotNull(templateGrantModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java deleted file mode 100644 index c2688232e2b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateMetadata model. - */ -public class TemplateMetadataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateMetadata() throws Throwable { - TemplateMetadata templateMetadataModel = new TemplateMetadata(); - assertNull(templateMetadataModel.getId()); - assertNull(templateMetadataModel.getVersion()); - assertNull(templateMetadataModel.getAssignmentId()); - assertNull(templateMetadataModel.getRootId()); - assertNull(templateMetadataModel.getRootVersion()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java deleted file mode 100644 index 0e256ffd599..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplatePolicy model. - */ -public class TemplatePolicyTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplatePolicy() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - assertEquals(templatePolicyModel.type(), "access"); - assertEquals(templatePolicyModel.description(), "testString"); - assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); - assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); - assertEquals(templatePolicyModel.pattern(), "testString"); - assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), templateControlModel); - - String json = TestUtilities.serialize(templatePolicyModel); - - TemplatePolicy templatePolicyModelNew = TestUtilities.deserialize(json, TemplatePolicy.class); - assertTrue(templatePolicyModelNew instanceof TemplatePolicy); - assertEquals(templatePolicyModelNew.type(), "access"); - assertEquals(templatePolicyModelNew.description(), "testString"); - assertEquals(templatePolicyModelNew.resource().toString(), v2PolicyResourceModel.toString()); - assertEquals(templatePolicyModelNew.subject().toString(), v2PolicySubjectModel.toString()); - assertEquals(templatePolicyModelNew.pattern(), "testString"); - assertEquals(templatePolicyModelNew.rule().toString(), v2PolicyRuleModel.toString()); - assertEquals(templatePolicyModelNew.control().toString(), templateControlModel.toString()); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplatePolicyError() throws Throwable { - new TemplatePolicy.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java deleted file mode 100644 index 1735364bc85..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateRole model. - */ -public class TemplateRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateRole() throws Throwable { - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateRoleModel.displayName(), "testString"); - assertEquals(templateRoleModel.serviceName(), "testString"); - assertEquals(templateRoleModel.description(), "testString"); - assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(templateRoleModel); - - TemplateRole templateRoleModelNew = TestUtilities.deserialize(json, TemplateRole.class); - assertTrue(templateRoleModelNew instanceof TemplateRole); - assertEquals(templateRoleModelNew.displayName(), "testString"); - assertEquals(templateRoleModelNew.serviceName(), "testString"); - assertEquals(templateRoleModelNew.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateRoleError() throws Throwable { - new TemplateRole.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java deleted file mode 100644 index df7a09c2829..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateActionControlAssignmentOptions model. - */ -public class UpdateActionControlAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdateActionControlAssignmentOptions() throws Throwable { - UpdateActionControlAssignmentOptions updateActionControlAssignmentOptionsModel = new UpdateActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .ifMatch("testString") - .templateVersion("testString") - .build(); - assertEquals(updateActionControlAssignmentOptionsModel.assignmentId(), "testString"); - assertEquals(updateActionControlAssignmentOptionsModel.ifMatch(), "testString"); - assertEquals(updateActionControlAssignmentOptionsModel.templateVersion(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateActionControlAssignmentOptionsError() throws Throwable { - new UpdateActionControlAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java deleted file mode 100644 index 0008325ffcf..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdatePolicyAssignmentOptions model. - */ -public class UpdatePolicyAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdatePolicyAssignmentOptions() throws Throwable { - UpdatePolicyAssignmentOptions updatePolicyAssignmentOptionsModel = new UpdatePolicyAssignmentOptions.Builder() - .assignmentId("testString") - .version("1.0") - .ifMatch("testString") - .templateVersion("testString") - .build(); - assertEquals(updatePolicyAssignmentOptionsModel.assignmentId(), "testString"); - assertEquals(updatePolicyAssignmentOptionsModel.version(), "1.0"); - assertEquals(updatePolicyAssignmentOptionsModel.ifMatch(), "testString"); - assertEquals(updatePolicyAssignmentOptionsModel.templateVersion(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdatePolicyAssignmentOptionsError() throws Throwable { - new UpdatePolicyAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java deleted file mode 100644 index de000e8c745..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdatePolicyStateOptions model. - */ -public class UpdatePolicyStateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdatePolicyStateOptions() throws Throwable { - UpdatePolicyStateOptions updatePolicyStateOptionsModel = new UpdatePolicyStateOptions.Builder() - .policyId("testString") - .ifMatch("testString") - .state("active") - .build(); - assertEquals(updatePolicyStateOptionsModel.policyId(), "testString"); - assertEquals(updatePolicyStateOptionsModel.ifMatch(), "testString"); - assertEquals(updatePolicyStateOptionsModel.state(), "active"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdatePolicyStateOptionsError() throws Throwable { - new UpdatePolicyStateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java deleted file mode 100644 index 879c3d5f456..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateRoleAssignmentOptions model. - */ -public class UpdateRoleAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdateRoleAssignmentOptions() throws Throwable { - UpdateRoleAssignmentOptions updateRoleAssignmentOptionsModel = new UpdateRoleAssignmentOptions.Builder() - .assignmentId("testString") - .ifMatch("testString") - .templateVersion("testString") - .build(); - assertEquals(updateRoleAssignmentOptionsModel.assignmentId(), "testString"); - assertEquals(updateRoleAssignmentOptionsModel.ifMatch(), "testString"); - assertEquals(updateRoleAssignmentOptionsModel.templateVersion(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateRoleAssignmentOptionsError() throws Throwable { - new UpdateRoleAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java deleted file mode 100644 index 1d69d016781..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateSettingsOptions model. - */ -public class UpdateSettingsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdateSettingsOptions() throws Throwable { - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - assertEquals(identityTypesBaseModel.state(), "enabled"); - assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); - - IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() - .user(identityTypesBaseModel) - .serviceId(identityTypesBaseModel) - .service(identityTypesBaseModel) - .build(); - assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); - - ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() - .identityTypes(identityTypesPatchModel) - .build(); - assertEquals(externalAccountIdentityInteractionPatchModel.identityTypes(), identityTypesPatchModel); - - UpdateSettingsOptions updateSettingsOptionsModel = new UpdateSettingsOptions.Builder() - .accountId("testString") - .ifMatch("testString") - .externalAccountIdentityInteraction(externalAccountIdentityInteractionPatchModel) - .acceptLanguage("default") - .build(); - assertEquals(updateSettingsOptionsModel.accountId(), "testString"); - assertEquals(updateSettingsOptionsModel.ifMatch(), "testString"); - assertEquals(updateSettingsOptionsModel.externalAccountIdentityInteraction(), externalAccountIdentityInteractionPatchModel); - assertEquals(updateSettingsOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateSettingsOptionsError() throws Throwable { - new UpdateSettingsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java deleted file mode 100644 index aff020c8985..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyCollection model. - */ -public class V2PolicyCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyCollection() throws Throwable { - V2PolicyCollection v2PolicyCollectionModel = new V2PolicyCollection(); - assertNull(v2PolicyCollectionModel.getLimit()); - assertNull(v2PolicyCollectionModel.getFirst()); - assertNull(v2PolicyCollectionModel.getNext()); - assertNull(v2PolicyCollectionModel.getPrevious()); - assertNull(v2PolicyCollectionModel.getPolicies()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java deleted file mode 100644 index 407eaadb155..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResourceAttribute model. - */ -public class V2PolicyResourceAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyResourceAttribute() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(v2PolicyResourceAttributeModel); - - V2PolicyResourceAttribute v2PolicyResourceAttributeModelNew = TestUtilities.deserialize(json, V2PolicyResourceAttribute.class); - assertTrue(v2PolicyResourceAttributeModelNew instanceof V2PolicyResourceAttribute); - assertEquals(v2PolicyResourceAttributeModelNew.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModelNew.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyResourceAttributeError() throws Throwable { - new V2PolicyResourceAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java deleted file mode 100644 index 97c9c813216..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResourceTag model. - */ -public class V2PolicyResourceTagTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyResourceTag() throws Throwable { - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - String json = TestUtilities.serialize(v2PolicyResourceTagModel); - - V2PolicyResourceTag v2PolicyResourceTagModelNew = TestUtilities.deserialize(json, V2PolicyResourceTag.class); - assertTrue(v2PolicyResourceTagModelNew instanceof V2PolicyResourceTag); - assertEquals(v2PolicyResourceTagModelNew.key(), "testString"); - assertEquals(v2PolicyResourceTagModelNew.value(), "testString"); - assertEquals(v2PolicyResourceTagModelNew.operator(), "stringEquals"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyResourceTagError() throws Throwable { - new V2PolicyResourceTag.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java deleted file mode 100644 index d153fd97be6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResource model. - */ -public class V2PolicyResourceTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyResource() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - String json = TestUtilities.serialize(v2PolicyResourceModel); - - V2PolicyResource v2PolicyResourceModelNew = TestUtilities.deserialize(json, V2PolicyResource.class); - assertTrue(v2PolicyResourceModelNew instanceof V2PolicyResource); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyResourceError() throws Throwable { - new V2PolicyResource.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java deleted file mode 100644 index 6d6da85f2b4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRuleRuleAttribute model. - */ -public class V2PolicyRuleRuleAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyRuleRuleAttribute() throws Throwable { - V2PolicyRuleRuleAttribute v2PolicyRuleRuleAttributeModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleRuleAttributeModel.key(), "testString"); - assertEquals(v2PolicyRuleRuleAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleRuleAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(v2PolicyRuleRuleAttributeModel); - - V2PolicyRuleRuleAttribute v2PolicyRuleRuleAttributeModelNew = TestUtilities.deserialize(json, V2PolicyRuleRuleAttribute.class); - assertTrue(v2PolicyRuleRuleAttributeModelNew instanceof V2PolicyRuleRuleAttribute); - assertEquals(v2PolicyRuleRuleAttributeModelNew.key(), "testString"); - assertEquals(v2PolicyRuleRuleAttributeModelNew.operator(), "stringEquals"); - assertEquals(v2PolicyRuleRuleAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyRuleRuleAttributeError() throws Throwable { - new V2PolicyRuleRuleAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java deleted file mode 100644 index fdf25669ef7..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleWithNestedConditions; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRuleRuleWithNestedConditions model. - */ -public class V2PolicyRuleRuleWithNestedConditionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyRuleRuleWithNestedConditions() throws Throwable { - NestedConditionRuleAttribute nestedConditionModel = new NestedConditionRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(nestedConditionModel.key(), "testString"); - assertEquals(nestedConditionModel.operator(), "stringEquals"); - assertEquals(nestedConditionModel.value(), "testString"); - - V2PolicyRuleRuleWithNestedConditions v2PolicyRuleRuleWithNestedConditionsModel = new V2PolicyRuleRuleWithNestedConditions.Builder() - .operator("and") - .conditions(java.util.Arrays.asList(nestedConditionModel)) - .build(); - assertEquals(v2PolicyRuleRuleWithNestedConditionsModel.operator(), "and"); - assertEquals(v2PolicyRuleRuleWithNestedConditionsModel.conditions(), java.util.Arrays.asList(nestedConditionModel)); - - String json = TestUtilities.serialize(v2PolicyRuleRuleWithNestedConditionsModel); - - V2PolicyRuleRuleWithNestedConditions v2PolicyRuleRuleWithNestedConditionsModelNew = TestUtilities.deserialize(json, V2PolicyRuleRuleWithNestedConditions.class); - assertTrue(v2PolicyRuleRuleWithNestedConditionsModelNew instanceof V2PolicyRuleRuleWithNestedConditions); - assertEquals(v2PolicyRuleRuleWithNestedConditionsModelNew.operator(), "and"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyRuleRuleWithNestedConditionsError() throws Throwable { - new V2PolicyRuleRuleWithNestedConditions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java deleted file mode 100644 index e0af599840c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRule; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRule model. - */ -public class V2PolicyRuleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testV2PolicyRule() throws Throwable { - V2PolicyRule v2PolicyRuleModel = new V2PolicyRule(); - assertNotNull(v2PolicyRuleModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java deleted file mode 100644 index a6e8f9d8922..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicySubjectAttribute model. - */ -public class V2PolicySubjectAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicySubjectAttribute() throws Throwable { - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(v2PolicySubjectAttributeModel); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModelNew = TestUtilities.deserialize(json, V2PolicySubjectAttribute.class); - assertTrue(v2PolicySubjectAttributeModelNew instanceof V2PolicySubjectAttribute); - assertEquals(v2PolicySubjectAttributeModelNew.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModelNew.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicySubjectAttributeError() throws Throwable { - new V2PolicySubjectAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java deleted file mode 100644 index 37adbaff5df..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicySubject model. - */ -public class V2PolicySubjectTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicySubject() throws Throwable { - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - String json = TestUtilities.serialize(v2PolicySubjectModel); - - V2PolicySubject v2PolicySubjectModelNew = TestUtilities.deserialize(json, V2PolicySubject.class); - assertTrue(v2PolicySubjectModelNew instanceof V2PolicySubject); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicySubjectError() throws Throwable { - new V2PolicySubject.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java deleted file mode 100644 index 2ffbe45575b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyTemplateMetaData model. - */ -public class V2PolicyTemplateMetaDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyTemplateMetaData() throws Throwable { - V2PolicyTemplateMetaData v2PolicyTemplateMetaDataModel = new V2PolicyTemplateMetaData(); - assertNull(v2PolicyTemplateMetaDataModel.getType()); - assertNull(v2PolicyTemplateMetaDataModel.getDescription()); - assertNull(v2PolicyTemplateMetaDataModel.getSubject()); - assertNull(v2PolicyTemplateMetaDataModel.getResource()); - assertNull(v2PolicyTemplateMetaDataModel.getPattern()); - assertNull(v2PolicyTemplateMetaDataModel.getRule()); - assertNull(v2PolicyTemplateMetaDataModel.getControl()); - assertNull(v2PolicyTemplateMetaDataModel.getState()); - assertNull(v2PolicyTemplateMetaDataModel.getLastPermitAt()); - assertNull(v2PolicyTemplateMetaDataModel.getLastPermitFrequency()); - assertNull(v2PolicyTemplateMetaDataModel.getTemplate()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java deleted file mode 100644 index 1630201062c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2Policy model. - */ -public class V2PolicyTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2Policy() throws Throwable { - V2Policy v2PolicyModel = new V2Policy(); - assertNull(v2PolicyModel.getType()); - assertNull(v2PolicyModel.getDescription()); - assertNull(v2PolicyModel.getSubject()); - assertNull(v2PolicyModel.getResource()); - assertNull(v2PolicyModel.getPattern()); - assertNull(v2PolicyModel.getRule()); - assertNull(v2PolicyModel.getControl()); - assertNull(v2PolicyModel.getState()); - assertNull(v2PolicyModel.getLastPermitAt()); - assertNull(v2PolicyModel.getLastPermitFrequency()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java deleted file mode 100644 index 04aaecc16ae..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * (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_policy_management.v1.utils; - -import java.util.Base64; -import java.util.Map; -import java.util.Set; -import java.util.List; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.io.InputStream; -import java.io.ByteArrayInputStream; - -import okhttp3.mockwebserver.RecordedRequest; -import okhttp3.HttpUrl; -import com.ibm.cloud.sdk.core.util.DateUtils; -import com.ibm.cloud.sdk.core.util.GsonSingleton; -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; - -/** - * A class used by the unit tests containing utility functions. - */ -public class TestUtilities { - public static Map createMockMap() { - Map mockMap = new HashMap<>(); - mockMap.put("foo", "bar"); - return mockMap; - } - - public static HashMap createMockStreamMap() { - return new HashMap() { - { put("key1", createMockStream("This is a mock file.")); } - }; - } - - public static Map parseQueryString(RecordedRequest req) { - Map queryMap = new HashMap<>(); - - try { - HttpUrl requestUrl = req.getRequestUrl(); - - if (requestUrl != null) { - Set queryParamsNames = requestUrl.queryParameterNames(); - // map the parameter name to its corresponding value - for (String p : queryParamsNames) { - // get the corresponding value for the parameter (p) - List val = requestUrl.queryParameterValues(p); - if (val != null && !val.isEmpty()) { - String joinedQuery = String.join(",", val); - queryMap.put(p, joinedQuery); - } - } - } - if (queryMap.isEmpty()) { - return null; - } - } catch (Exception e) { - return null; - } - - return queryMap; - } - - public static String parseReqPath(RecordedRequest req) { - String parsedPath = null; - - try { - String fullPath = req.getPath(); - if (fullPath != null && !fullPath.isEmpty()) { - // retrieve the path segment before the query parameter - parsedPath = fullPath.split("\\?", 2)[0]; - } - if (parsedPath.isEmpty() || parsedPath == null) { - return null; - } - - } catch (Exception e) { - return null; - } - - return parsedPath; - } - - public static String serialize(Object obj) { - return GsonSingleton.getGson().toJson(obj); - } - - public static T deserialize(String json, Class clazz) { - return GsonSingleton.getGson().fromJson(json, clazz); - } - - public static InputStream createMockStream(String s) { - return new ByteArrayInputStream(s.getBytes()); - } - - public static List creatMockListFileWithMetadata() { - List list = new ArrayList(); - byte[] fileBytes = {(byte) 0xde, (byte) 0xad, (byte) 0xbe, (byte) 0xef}; - InputStream inputStream = new ByteArrayInputStream(fileBytes); - FileWithMetadata.Builder builder = new FileWithMetadata.Builder(); - builder.data(inputStream); - FileWithMetadata fileWithMetadata = builder.build(); - list.add(fileWithMetadata); - - return list; - } - - public static byte[] createMockByteArray(String encodedString) throws Exception { - return Base64.getDecoder().decode(encodedString); - } - - public static Date createMockDate(String date) throws Exception { - return DateUtils.parseAsDate(date); - } - - public static Date createMockDateTime(String date) throws Exception { - return DateUtils.parseAsDateTime(date); - } -} \ No newline at end of file From 74cb202d5f1021a33e983cc0358dbf440bbb2333 Mon Sep 17 00:00:00 2001 From: Bhavana Bellamgari Date: Wed, 10 Dec 2025 15:31:49 +0530 Subject: [PATCH 10/13] Updated template grant schema Signed-off-by: Bhavana Bellamgari Signed-off-by: Bhavana Bellamgari --- .../v1/IamPolicyManagement.java | 2566 +++++++++ .../AccountSettingsAccessManagement.java | 40 + .../v1/model/ActionControlAssignment.java | 207 + .../ActionControlAssignmentCollection.java | 88 + .../ActionControlAssignmentResource.java | 52 + ...ontrolAssignmentResourceActionControl.java | 53 + ...ctionControlAssignmentResourceCreated.java | 38 + .../ActionControlAssignmentTemplate.java | 134 + .../model/ActionControlAssignmentsPager.java | 108 + .../v1/model/ActionControlTemplate.java | 203 + .../ActionControlTemplateCollection.java | 90 + ...tionControlTemplateVersionsCollection.java | 88 + .../ActionControlTemplateVersionsPager.java | 108 + .../v1/model/ActionControlTemplatesPager.java | 108 + .../v1/model/AssignmentResourceCreated.java | 38 + .../v1/model/AssignmentResourceError.java | 88 + .../v1/model/AssignmentTargetDetails.java | 142 + .../v1/model/AssignmentTemplateDetails.java | 119 + .../CommitActionControlTemplateOptions.java | 134 + .../v1/model/CommitPolicyTemplateOptions.java | 134 + .../v1/model/CommitRoleTemplateOptions.java | 134 + .../v1/model/ConflictsWith.java | 62 + .../v1/model/Control.java | 104 + .../v1/model/ControlResponse.java | 42 + .../v1/model/ControlResponseControl.java | 24 + ...ntrolResponseControlWithEnrichedRoles.java | 24 + ...ctionControlTemplateAssignmentOptions.java | 191 + .../CreateActionControlTemplateOptions.java | 251 + ...teActionControlTemplateVersionOptions.java | 211 + .../v1/model/CreatePolicyOptions.java | 311 + ...CreatePolicyTemplateAssignmentOptions.java | 221 + .../v1/model/CreatePolicyTemplateOptions.java | 255 + .../CreatePolicyTemplateVersionOptions.java | 214 + .../v1/model/CreateRoleOptions.java | 308 + .../CreateRoleTemplateAssignmentOptions.java | 191 + .../v1/model/CreateRoleTemplateOptions.java | 251 + .../CreateRoleTemplateVersionOptions.java | 211 + .../v1/model/CreateV2PolicyOptions.java | 312 + .../v1/model/CustomRole.java | 195 + .../DeleteActionControlAssignmentOptions.java | 104 + .../DeleteActionControlTemplateOptions.java | 104 + ...teActionControlTemplateVersionOptions.java | 134 + .../model/DeletePolicyAssignmentOptions.java | 104 + .../v1/model/DeletePolicyOptions.java | 104 + .../v1/model/DeletePolicyTemplateOptions.java | 104 + .../DeletePolicyTemplateVersionOptions.java | 134 + .../v1/model/DeleteRoleAssignmentOptions.java | 104 + .../v1/model/DeleteRoleOptions.java | 104 + .../v1/model/DeleteRoleTemplateOptions.java | 104 + .../DeleteRoleTemplateVersionOptions.java | 134 + .../v1/model/DeleteV2PolicyOptions.java | 104 + .../v1/model/EnrichedRoles.java | 81 + .../v1/model/ErrorDetails.java | 40 + .../v1/model/ErrorObject.java | 128 + .../ExternalAccountIdentityInteraction.java | 40 + ...ternalAccountIdentityInteractionPatch.java | 95 + .../iam_policy_management/v1/model/First.java | 38 + .../GetActionControlAssignmentOptions.java | 104 + .../GetActionControlTemplateOptions.java | 140 + ...etActionControlTemplateVersionOptions.java | 134 + .../v1/model/GetPolicyAssignmentOptions.java | 134 + .../v1/model/GetPolicyOptions.java | 104 + .../v1/model/GetPolicyTemplateOptions.java | 140 + .../GetPolicyTemplateVersionOptions.java | 134 + .../v1/model/GetRoleAssignmentOptions.java | 104 + .../v1/model/GetRoleOptions.java | 104 + .../v1/model/GetRoleTemplateOptions.java | 140 + .../model/GetRoleTemplateVersionOptions.java | 134 + .../v1/model/GetSettingsOptions.java | 141 + .../v1/model/GetV2PolicyOptions.java | 148 + .../iam_policy_management/v1/model/Grant.java | 124 + .../v1/model/GrantWithEnrichedRoles.java | 40 + .../v1/model/IdentityTypes.java | 64 + .../v1/model/IdentityTypesBase.java | 168 + .../v1/model/IdentityTypesPatch.java | 147 + .../v1/model/LimitData.java | 50 + .../ListActionControlAssignmentsOptions.java | 245 + ...tActionControlTemplateVersionsOptions.java | 192 + .../ListActionControlTemplatesOptions.java | 193 + .../v1/model/ListPoliciesOptions.java | 501 ++ .../model/ListPolicyAssignmentsOptions.java | 275 + .../ListPolicyTemplateVersionsOptions.java | 192 + .../v1/model/ListPolicyTemplatesOptions.java | 379 ++ .../v1/model/ListRoleAssignmentsOptions.java | 245 + .../ListRoleTemplateVersionsOptions.java | 192 + .../v1/model/ListRoleTemplatesOptions.java | 307 + .../v1/model/ListRolesOptions.java | 234 + .../v1/model/ListV2PoliciesOptions.java | 492 ++ .../v1/model/NestedCondition.java | 126 + .../model/NestedConditionRuleAttribute.java | 170 + .../NestedConditionRuleWithConditions.java | 139 + .../iam_policy_management/v1/model/Next.java | 50 + .../v1/model/PoliciesPager.java | 108 + .../v1/model/Policy.java | 188 + .../model/PolicyAssignmentResourcePolicy.java | 65 + .../v1/model/PolicyAssignmentResources.java | 50 + .../v1/model/PolicyAssignmentV1.java | 193 + .../model/PolicyAssignmentV1Collection.java | 88 + .../v1/model/PolicyAssignmentV1Resources.java | 50 + .../v1/model/PolicyAssignmentV1Subject.java | 60 + .../v1/model/PolicyAssignmentsPager.java | 108 + .../v1/model/PolicyCollection.java | 88 + .../v1/model/PolicyResource.java | 167 + .../v1/model/PolicyRole.java | 131 + .../v1/model/PolicySubject.java | 124 + .../v1/model/PolicyTemplate.java | 202 + .../PolicyTemplateAssignmentCollection.java | 88 + .../model/PolicyTemplateAssignmentItems.java | 261 + ...mplateAssignmentItemsPolicyAssignment.java | 50 + ...lateAssignmentItemsPolicyAssignmentV1.java | 38 + .../v1/model/PolicyTemplateCollection.java | 90 + .../v1/model/PolicyTemplateLimitData.java | 214 + .../v1/model/PolicyTemplateMetaData.java | 201 + .../PolicyTemplateVersionsCollection.java | 88 + .../v1/model/PolicyTemplateVersionsPager.java | 108 + .../v1/model/PolicyTemplatesPager.java | 108 + .../v1/model/Previous.java | 50 + .../ReplaceActionControlTemplateOptions.java | 273 + .../v1/model/ReplacePolicyOptions.java | 335 ++ .../model/ReplacePolicyTemplateOptions.java | 276 + .../v1/model/ReplaceRoleOptions.java | 255 + .../v1/model/ReplaceRoleTemplateOptions.java | 273 + .../v1/model/ReplaceV2PolicyOptions.java | 336 ++ .../v1/model/ResourceAttribute.java | 160 + .../v1/model/ResourceTag.java | 160 + .../iam_policy_management/v1/model/Role.java | 196 + .../v1/model/RoleAction.java | 64 + .../v1/model/RoleAssignment.java | 207 + .../v1/model/RoleAssignmentCollection.java | 88 + .../v1/model/RoleAssignmentResource.java | 50 + .../model/RoleAssignmentResourceCreated.java | 38 + .../v1/model/RoleAssignmentResourceRole.java | 53 + .../v1/model/RoleAssignmentTemplate.java | 134 + .../v1/model/RoleAssignmentsPager.java | 108 + .../v1/model/RoleCollection.java | 68 + .../v1/model/RoleTemplate.java | 202 + .../v1/model/RoleTemplateCollection.java | 90 + .../v1/model/RoleTemplatePrototypeRole.java | 239 + .../v1/model/RoleTemplateReferencesItem.java | 134 + .../model/RoleTemplateVersionsCollection.java | 88 + .../v1/model/RoleTemplateVersionsPager.java | 108 + .../v1/model/RoleTemplatesPager.java | 108 + .../iam_policy_management/v1/model/Roles.java | 106 + .../v1/model/RuleAttribute.java | 209 + .../v1/model/SubjectAttribute.java | 134 + .../v1/model/TemplateActionControl.java | 182 + .../v1/model/TemplateControl.java | 104 + .../v1/model/TemplateCountData.java | 50 + .../v1/model/TemplateGrant.java | 58 + .../v1/model/TemplateGrantRoleReferences.java | 110 + .../v1/model/TemplateGrantRoles.java | 110 + .../v1/model/TemplateMetadata.java | 91 + .../v1/model/TemplatePolicy.java | 272 + .../v1/model/TemplateRole.java | 209 + .../UpdateActionControlAssignmentOptions.java | 166 + .../model/UpdatePolicyAssignmentOptions.java | 196 + .../v1/model/UpdatePolicyStateOptions.java | 171 + .../v1/model/UpdateRoleAssignmentOptions.java | 166 + .../v1/model/UpdateSettingsOptions.java | 199 + .../v1/model/V2PoliciesPager.java | 108 + .../v1/model/V2Policy.java | 247 + .../v1/model/V2PolicyCollection.java | 88 + .../v1/model/V2PolicyResource.java | 167 + .../v1/model/V2PolicyResourceAttribute.java | 181 + .../v1/model/V2PolicyResourceTag.java | 174 + .../v1/model/V2PolicyRule.java | 126 + .../v1/model/V2PolicyRuleRuleAttribute.java | 170 + .../V2PolicyRuleRuleWithNestedConditions.java | 139 + .../v1/model/V2PolicySubject.java | 124 + .../v1/model/V2PolicySubjectAttribute.java | 175 + .../v1/model/V2PolicyTemplateMetaData.java | 260 + .../v1/package-info.java | 17 + .../v1/IamPolicyManagementTest.java | 5007 +++++++++++++++++ .../AccountSettingsAccessManagementTest.java | 40 + ...ActionControlAssignmentCollectionTest.java | 47 + ...olAssignmentResourceActionControlTest.java | 43 + ...nControlAssignmentResourceCreatedTest.java | 37 + .../ActionControlAssignmentResourceTest.java | 45 + .../ActionControlAssignmentTemplateTest.java | 54 + .../v1/model/ActionControlAssignmentTest.java | 40 + .../ActionControlTemplateCollectionTest.java | 46 + .../v1/model/ActionControlTemplateTest.java | 44 + ...ControlTemplateVersionsCollectionTest.java | 46 + .../model/AssignmentResourceCreatedTest.java | 37 + .../v1/model/AssignmentResourceErrorTest.java | 44 + .../v1/model/AssignmentTargetDetailsTest.java | 54 + .../model/AssignmentTemplateDetailsTest.java | 48 + ...ommitActionControlTemplateOptionsTest.java | 47 + .../CommitPolicyTemplateOptionsTest.java | 47 + .../model/CommitRoleTemplateOptionsTest.java | 47 + .../v1/model/ConflictsWithTest.java | 39 + .../v1/model/ControlResponseControlTest.java | 39 + ...lResponseControlWithEnrichedRolesTest.java | 40 + .../v1/model/ControlResponseTest.java | 40 + .../v1/model/ControlTest.java | 63 + ...nControlTemplateAssignmentOptionsTest.java | 65 + ...reateActionControlTemplateOptionsTest.java | 65 + ...tionControlTemplateVersionOptionsTest.java | 63 + .../v1/model/CreatePolicyOptionsTest.java | 103 + ...tePolicyTemplateAssignmentOptionsTest.java | 67 + .../CreatePolicyTemplateOptionsTest.java | 145 + ...reatePolicyTemplateVersionOptionsTest.java | 143 + .../v1/model/CreateRoleOptionsTest.java | 57 + ...eateRoleTemplateAssignmentOptionsTest.java | 65 + .../model/CreateRoleTemplateOptionsTest.java | 69 + .../CreateRoleTemplateVersionOptionsTest.java | 65 + .../v1/model/CreateV2PolicyOptionsTest.java | 131 + .../v1/model/CustomRoleTest.java | 42 + ...eteActionControlAssignmentOptionsTest.java | 45 + ...eleteActionControlTemplateOptionsTest.java | 45 + ...tionControlTemplateVersionOptionsTest.java | 47 + .../DeletePolicyAssignmentOptionsTest.java | 45 + .../v1/model/DeletePolicyOptionsTest.java | 45 + .../DeletePolicyTemplateOptionsTest.java | 45 + ...eletePolicyTemplateVersionOptionsTest.java | 47 + .../DeleteRoleAssignmentOptionsTest.java | 45 + .../v1/model/DeleteRoleOptionsTest.java | 45 + .../model/DeleteRoleTemplateOptionsTest.java | 45 + .../DeleteRoleTemplateVersionOptionsTest.java | 47 + .../v1/model/DeleteV2PolicyOptionsTest.java | 45 + .../v1/model/EnrichedRolesTest.java | 39 + .../v1/model/ErrorDetailsTest.java | 38 + .../v1/model/ErrorObjectTest.java | 42 + ...alAccountIdentityInteractionPatchTest.java | 63 + ...xternalAccountIdentityInteractionTest.java | 39 + .../v1/model/FirstTest.java | 36 + ...GetActionControlAssignmentOptionsTest.java | 45 + .../GetActionControlTemplateOptionsTest.java | 47 + ...tionControlTemplateVersionOptionsTest.java | 47 + .../model/GetPolicyAssignmentOptionsTest.java | 47 + .../v1/model/GetPolicyOptionsTest.java | 45 + .../model/GetPolicyTemplateOptionsTest.java | 47 + .../GetPolicyTemplateVersionOptionsTest.java | 47 + .../model/GetRoleAssignmentOptionsTest.java | 45 + .../v1/model/GetRoleOptionsTest.java | 45 + .../v1/model/GetRoleTemplateOptionsTest.java | 47 + .../GetRoleTemplateVersionOptionsTest.java | 47 + .../v1/model/GetSettingsOptionsTest.java | 47 + .../v1/model/GetV2PolicyOptionsTest.java | 47 + .../v1/model/GrantTest.java | 56 + .../v1/model/GrantWithEnrichedRolesTest.java | 39 + .../v1/model/IdentityTypesBaseTest.java | 53 + .../v1/model/IdentityTypesPatchTest.java | 59 + .../v1/model/IdentityTypesTest.java | 40 + .../v1/model/LimitDataTest.java | 36 + ...stActionControlAssignmentsOptionsTest.java | 55 + ...ionControlTemplateVersionsOptionsTest.java | 51 + ...ListActionControlTemplatesOptionsTest.java | 51 + .../v1/model/ListPoliciesOptionsTest.java | 69 + .../ListPolicyAssignmentsOptionsTest.java | 57 + ...ListPolicyTemplateVersionsOptionsTest.java | 51 + .../model/ListPolicyTemplatesOptionsTest.java | 63 + .../model/ListRoleAssignmentsOptionsTest.java | 55 + .../ListRoleTemplateVersionsOptionsTest.java | 51 + .../model/ListRoleTemplatesOptionsTest.java | 59 + .../v1/model/ListRolesOptionsTest.java | 49 + .../v1/model/ListV2PoliciesOptionsTest.java | 69 + .../NestedConditionRuleAttributeTest.java | 57 + ...NestedConditionRuleWithConditionsTest.java | 63 + .../v1/model/NestedConditionTest.java | 38 + .../v1/model/NextTest.java | 37 + .../PolicyAssignmentResourcePolicyTest.java | 44 + .../model/PolicyAssignmentResourcesTest.java | 44 + .../PolicyAssignmentV1CollectionTest.java | 55 + .../PolicyAssignmentV1ResourcesTest.java | 45 + .../model/PolicyAssignmentV1SubjectTest.java | 36 + .../v1/model/PolicyAssignmentV1Test.java | 51 + .../v1/model/PolicyCollectionTest.java | 52 + .../v1/model/PolicyResourceTest.java | 72 + .../v1/model/PolicyRoleTest.java | 51 + .../v1/model/PolicySubjectTest.java | 58 + ...olicyTemplateAssignmentCollectionTest.java | 55 + ...teAssignmentItemsPolicyAssignmentTest.java | 50 + ...AssignmentItemsPolicyAssignmentV1Test.java | 51 + .../PolicyTemplateAssignmentItemsTest.java | 48 + .../model/PolicyTemplateCollectionTest.java | 55 + .../v1/model/PolicyTemplateLimitDataTest.java | 56 + .../v1/model/PolicyTemplateMetaDataTest.java | 50 + .../v1/model/PolicyTemplateTest.java | 53 + .../PolicyTemplateVersionsCollectionTest.java | 55 + .../v1/model/PolicyTest.java | 48 + .../v1/model/PreviousTest.java | 37 + ...placeActionControlTemplateOptionsTest.java | 67 + .../v1/model/ReplacePolicyOptionsTest.java | 105 + .../ReplacePolicyTemplateOptionsTest.java | 147 + .../v1/model/ReplaceRoleOptionsTest.java | 53 + .../model/ReplaceRoleTemplateOptionsTest.java | 69 + .../v1/model/ReplaceV2PolicyOptionsTest.java | 133 + .../v1/model/ResourceAttributeTest.java | 57 + .../v1/model/ResourceTagTest.java | 57 + .../v1/model/RoleActionTest.java | 39 + .../model/RoleAssignmentCollectionTest.java | 47 + .../RoleAssignmentResourceCreatedTest.java | 37 + .../model/RoleAssignmentResourceRoleTest.java | 43 + .../v1/model/RoleAssignmentResourceTest.java | 45 + .../v1/model/RoleAssignmentTemplateTest.java | 54 + .../v1/model/RoleAssignmentTest.java | 40 + .../v1/model/RoleCollectionTest.java | 41 + .../v1/model/RoleTemplateCollectionTest.java | 46 + .../model/RoleTemplatePrototypeRoleTest.java | 62 + .../model/RoleTemplateReferencesItemTest.java | 54 + .../v1/model/RoleTemplateTest.java | 44 + .../RoleTemplateVersionsCollectionTest.java | 46 + .../v1/model/RoleTest.java | 56 + .../v1/model/RolesTest.java | 51 + .../v1/model/RuleAttributeTest.java | 57 + .../v1/model/SubjectAttributeTest.java | 54 + .../v1/model/TemplateActionControlTest.java | 56 + .../v1/model/TemplateControlTest.java | 63 + .../v1/model/TemplateCountDataTest.java | 39 + .../TemplateGrantRoleReferencesTest.java | 58 + .../v1/model/TemplateGrantRolesTest.java | 56 + .../v1/model/TemplateGrantTest.java | 39 + .../v1/model/TemplateMetadataTest.java | 41 + .../v1/model/TemplatePolicyTest.java | 141 + .../v1/model/TemplateRoleTest.java | 59 + ...ateActionControlAssignmentOptionsTest.java | 49 + .../UpdatePolicyAssignmentOptionsTest.java | 51 + .../model/UpdatePolicyStateOptionsTest.java | 49 + .../UpdateRoleAssignmentOptionsTest.java | 49 + .../v1/model/UpdateSettingsOptionsTest.java | 75 + .../v1/model/V2PolicyCollectionTest.java | 55 + .../model/V2PolicyResourceAttributeTest.java | 57 + .../v1/model/V2PolicyResourceTagTest.java | 57 + .../v1/model/V2PolicyResourceTest.java | 72 + .../model/V2PolicyRuleRuleAttributeTest.java | 57 + ...olicyRuleRuleWithNestedConditionsTest.java | 63 + .../v1/model/V2PolicyRuleTest.java | 38 + .../model/V2PolicySubjectAttributeTest.java | 57 + .../v1/model/V2PolicySubjectTest.java | 60 + .../model/V2PolicyTemplateMetaDataTest.java | 57 + .../v1/model/V2PolicyTest.java | 55 + .../v1/utils/TestUtilities.java | 131 + 333 files changed, 41258 insertions(+) create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java new file mode 100644 index 00000000000..2abe3baea4e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java @@ -0,0 +1,2566 @@ +/* + * (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. + */ + +/* + * IBM OpenAPI SDK Code Generator Version: 3.107.1-41b0fbd0-20250825-080732 + */ + +package com.ibm.cloud.platform_services.iam_policy_management.v1; + +import com.google.gson.JsonObject; +import com.ibm.cloud.platform_services.common.SdkCommon; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; +import com.ibm.cloud.sdk.core.http.RequestBuilder; +import com.ibm.cloud.sdk.core.http.ResponseConverter; +import com.ibm.cloud.sdk.core.http.ServiceCall; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.ConfigBasedAuthenticatorFactory; +import com.ibm.cloud.sdk.core.service.BaseService; +import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; + +/** + * IAM Policy Management API. + * + * API Version: 1.0.1 + */ +public class IamPolicyManagement extends BaseService { + + /** + * Default service name used when configuring the `IamPolicyManagement` client. + */ + public static final String DEFAULT_SERVICE_NAME = "iam_policy_management"; + + /** + * Default service endpoint URL. + */ + public static final String DEFAULT_SERVICE_URL = "https://iam.cloud.ibm.com"; + + /** + * Class method which constructs an instance of the `IamPolicyManagement` client. + * The default service name is used to configure the client instance. + * + * @return an instance of the `IamPolicyManagement` client using external configuration + */ + public static IamPolicyManagement newInstance() { + return newInstance(DEFAULT_SERVICE_NAME); + } + + /** + * Class method which constructs an instance of the `IamPolicyManagement` client. + * The specified service name is used to configure the client instance. + * + * @param serviceName the service name to be used when configuring the client instance + * @return an instance of the `IamPolicyManagement` client using external configuration + */ + public static IamPolicyManagement newInstance(String serviceName) { + Authenticator authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(serviceName); + IamPolicyManagement service = new IamPolicyManagement(serviceName, authenticator); + service.configureService(serviceName); + return service; + } + + /** + * Constructs an instance of the `IamPolicyManagement` client. + * The specified service name and authenticator are used to configure the client instance. + * + * @param serviceName the service name to be used when configuring the client instance + * @param authenticator the {@link Authenticator} instance to be configured for this client + */ + public IamPolicyManagement(String serviceName, Authenticator authenticator) { + super(serviceName, authenticator); + setServiceUrl(DEFAULT_SERVICE_URL); + } + + /** + * Get policies by attributes. + * + * Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account + * and filter by attribute values. This can be done through query parameters. The following attributes are supported: + * account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query + * parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If + * the caller does not have read access to any policies an empty array is returned. + * + * @param listPoliciesOptions the {@link ListPoliciesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyCollection} + */ + public ServiceCall listPolicies(ListPoliciesOptions listPoliciesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listPoliciesOptions, + "listPoliciesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicies"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listPoliciesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listPoliciesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listPoliciesOptions.accountId())); + if (listPoliciesOptions.iamId() != null) { + builder.query("iam_id", String.valueOf(listPoliciesOptions.iamId())); + } + if (listPoliciesOptions.accessGroupId() != null) { + builder.query("access_group_id", String.valueOf(listPoliciesOptions.accessGroupId())); + } + if (listPoliciesOptions.type() != null) { + builder.query("type", String.valueOf(listPoliciesOptions.type())); + } + if (listPoliciesOptions.serviceType() != null) { + builder.query("service_type", String.valueOf(listPoliciesOptions.serviceType())); + } + if (listPoliciesOptions.tagName() != null) { + builder.query("tag_name", String.valueOf(listPoliciesOptions.tagName())); + } + if (listPoliciesOptions.tagValue() != null) { + builder.query("tag_value", String.valueOf(listPoliciesOptions.tagValue())); + } + if (listPoliciesOptions.sort() != null) { + builder.query("sort", String.valueOf(listPoliciesOptions.sort())); + } + if (listPoliciesOptions.format() != null) { + builder.query("format", String.valueOf(listPoliciesOptions.format())); + } + if (listPoliciesOptions.state() != null) { + builder.query("state", String.valueOf(listPoliciesOptions.state())); + } + if (listPoliciesOptions.limit() != null) { + builder.query("limit", String.valueOf(listPoliciesOptions.limit())); + } + if (listPoliciesOptions.start() != null) { + builder.query("start", String.valueOf(listPoliciesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a policy. + * + * Creates a policy to grant access between a subject and a resource. There are two types of policies: **access** and + * **authorization**. A policy administrator might want to create an access policy which grants access to a user, + * service-id, or an access group. They might also want to create an authorization policy and setup access between + * services. + * + * ### Access + * + * To create an access policy, use **`"type": "access"`** in the body. The possible subject attributes are + * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or + * service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. Assign roles + * that are supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or + * **`service_group_id`** attribute and the **`accountId`** attribute. The IAM Services group (`IAM`) is a subset of + * account management services that includes the IAM platform services IAM Identity, IAM Access Management, IAM Users + * Management, IAM Groups, and future IAM services. If the subject is a locked service-id, the request will fail. + * + * ### Authorization + * + * Authorization policies are supported by services on a case by case basis. Refer to service documentation to verify + * their support of authorization policies. To create an authorization policy, use **`"type": "authorization"`** in + * the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject + * attributes might be provided. The following attributes are supported: + * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are + * supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access + * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject + * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. + * + * ### Attribute Operators + * + * Currently, only the `stringEquals` and the `stringMatch` operators are available. Resource attributes may support + * one or both operators. For more information, see [Assigning access by using wildcard + * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). + * + * ### Attribute Validations + * + * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like + * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated + * against Global Catalog locations. + * + * @param createPolicyOptions the {@link CreatePolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Policy} + */ + public ServiceCall createPolicy(CreatePolicyOptions createPolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyOptions, + "createPolicyOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createPolicyOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createPolicyOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("type", createPolicyOptions.type()); + contentJson.add("subjects", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.subjects())); + contentJson.add("roles", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.roles())); + contentJson.add("resources", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.resources())); + if (createPolicyOptions.description() != null) { + contentJson.addProperty("description", createPolicyOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a policy. + * + * Update a policy to grant access between a subject and a resource. A policy administrator might want to update an + * existing policy. The policy type cannot be changed (You cannot change an access policy to an authorization policy). + * + * ### Access + * + * To update an access policy, use **`"type": "access"`** in the body. The possible subject attributes are + * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or + * service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. Assign roles + * that are supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * The policy resource must include either the **`serviceType`**, **`serviceName`**, or **`resourceGroupId`** + * attribute and the **`accountId`** attribute.` If the subject is a locked service-id, the request will fail. + * + * ### Authorization + * + * To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match + * the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following + * attributes are supported: + * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are + * supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access + * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject + * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. + * + * ### Attribute Operators + * + * Currently, only the `stringEquals` and the `stringMatch` operators are available. Resource attributes might support + * one or both operators. For more information, see [Assigning access by using wildcard + * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). + * + * ### Attribute Validations + * + * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like + * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated + * against Global Catalog locations. + * + * @param replacePolicyOptions the {@link ReplacePolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Policy} + */ + public ServiceCall replacePolicy(ReplacePolicyOptions replacePolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replacePolicyOptions, + "replacePolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_id", replacePolicyOptions.policyId()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replacePolicy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replacePolicyOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("type", replacePolicyOptions.type()); + contentJson.add("subjects", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.subjects())); + contentJson.add("roles", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.roles())); + contentJson.add("resources", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.resources())); + if (replacePolicyOptions.description() != null) { + contentJson.addProperty("description", replacePolicyOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a policy by ID. + * + * Retrieve a policy by providing a policy ID. + * + * @param getPolicyOptions the {@link GetPolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateMetaData} + */ + public ServiceCall getPolicy(GetPolicyOptions getPolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyOptions, + "getPolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_id", getPolicyOptions.policyId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicy"); + 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); + } + + /** + * Delete a policy by ID. + * + * Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service + * ID. If the subject of the policy is a locked service-id, the request will fail. + * + * @param deletePolicyOptions the {@link DeletePolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deletePolicy(DeletePolicyOptions deletePolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyOptions, + "deletePolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_id", deletePolicyOptions.policyId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Restore a deleted policy by ID. + * + * Restore a policy that has recently been deleted. A policy administrator might want to restore a deleted policy. To + * restore a policy, use **`"state": "active"`** in the body. + * + * @param updatePolicyStateOptions the {@link UpdatePolicyStateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Policy} + */ + public ServiceCall updatePolicyState(UpdatePolicyStateOptions updatePolicyStateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updatePolicyStateOptions, + "updatePolicyStateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_id", updatePolicyStateOptions.policyId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updatePolicyState"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updatePolicyStateOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + if (updatePolicyStateOptions.state() != null) { + contentJson.addProperty("state", updatePolicyStateOptions.state()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get roles by filters. + * + * Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can + * be done through query parameters. Currently, we only support the following attributes: account_id, service_name, + * service_group_id, source_service_name and policy_type. Both service_name and service_group_id attributes are + * mutually exclusive. Only roles that match the filter and that the caller has read access to are returned. If the + * caller does not have read access to any roles an empty array is returned. + * + * @param listRolesOptions the {@link ListRolesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleCollection} + */ + public ServiceCall listRoles(ListRolesOptions listRolesOptions) { + if (listRolesOptions == null) { + listRolesOptions = new ListRolesOptions.Builder().build(); + } + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoles"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listRolesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listRolesOptions.acceptLanguage()); + } + if (listRolesOptions.accountId() != null) { + builder.query("account_id", String.valueOf(listRolesOptions.accountId())); + } + if (listRolesOptions.serviceName() != null) { + builder.query("service_name", String.valueOf(listRolesOptions.serviceName())); + } + if (listRolesOptions.sourceServiceName() != null) { + builder.query("source_service_name", String.valueOf(listRolesOptions.sourceServiceName())); + } + if (listRolesOptions.policyType() != null) { + builder.query("policy_type", String.valueOf(listRolesOptions.policyType())); + } + if (listRolesOptions.serviceGroupId() != null) { + builder.query("service_group_id", String.valueOf(listRolesOptions.serviceGroupId())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get roles by filters. + * + * Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can + * be done through query parameters. Currently, we only support the following attributes: account_id, service_name, + * service_group_id, source_service_name and policy_type. Both service_name and service_group_id attributes are + * mutually exclusive. Only roles that match the filter and that the caller has read access to are returned. If the + * caller does not have read access to any roles an empty array is returned. + * + * @return a {@link ServiceCall} with a result of type {@link RoleCollection} + */ + public ServiceCall listRoles() { + return listRoles(null); + } + + /** + * Create a role. + * + * Creates a custom role for a specific service within the account. An account owner or a user assigned the + * Administrator role on the Role management service can create a custom role. Any number of actions for a single + * service can be mapped to the new role, but there must be at least one service-defined action to successfully create + * the new role. + * + * @param createRoleOptions the {@link CreateRoleOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link CustomRole} + */ + public ServiceCall createRole(CreateRoleOptions createRoleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleOptions, + "createRoleOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRole"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createRoleOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createRoleOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("display_name", createRoleOptions.displayName()); + contentJson.add("actions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleOptions.actions())); + contentJson.addProperty("name", createRoleOptions.name()); + contentJson.addProperty("account_id", createRoleOptions.accountId()); + contentJson.addProperty("service_name", createRoleOptions.serviceName()); + if (createRoleOptions.description() != null) { + contentJson.addProperty("description", createRoleOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a role. + * + * Update a custom role. A role administrator might want to update an existing role by updating the display name, + * description, or the actions that are mapped to the role. The name, account_id, and service_name can't be changed. + * + * @param replaceRoleOptions the {@link ReplaceRoleOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link CustomRole} + */ + public ServiceCall replaceRole(ReplaceRoleOptions replaceRoleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceRoleOptions, + "replaceRoleOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_id", replaceRoleOptions.roleId()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceRole"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replaceRoleOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("display_name", replaceRoleOptions.displayName()); + contentJson.add("actions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRoleOptions.actions())); + if (replaceRoleOptions.description() != null) { + contentJson.addProperty("description", replaceRoleOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a role by ID. + * + * Retrieve a role by providing a role ID. + * + * @param getRoleOptions the {@link GetRoleOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link CustomRole} + */ + public ServiceCall getRole(GetRoleOptions getRoleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleOptions, + "getRoleOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_id", getRoleOptions.roleId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRole"); + 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); + } + + /** + * Delete a role by ID. + * + * Delete a role by providing a role ID. + * + * @param deleteRoleOptions the {@link DeleteRoleOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteRole(DeleteRoleOptions deleteRoleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleOptions, + "deleteRoleOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_id", deleteRoleOptions.roleId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRole"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get policies by attributes. + * + * Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account + * and filter by attribute values. This can be done through query parameters. The following attributes are supported: + * account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query + * parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If + * the caller does not have read access to any policies an empty array is returned. + * + * @param listV2PoliciesOptions the {@link ListV2PoliciesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link V2PolicyCollection} + */ + public ServiceCall listV2Policies(ListV2PoliciesOptions listV2PoliciesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listV2PoliciesOptions, + "listV2PoliciesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listV2Policies"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listV2PoliciesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listV2PoliciesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listV2PoliciesOptions.accountId())); + if (listV2PoliciesOptions.iamId() != null) { + builder.query("iam_id", String.valueOf(listV2PoliciesOptions.iamId())); + } + if (listV2PoliciesOptions.accessGroupId() != null) { + builder.query("access_group_id", String.valueOf(listV2PoliciesOptions.accessGroupId())); + } + if (listV2PoliciesOptions.type() != null) { + builder.query("type", String.valueOf(listV2PoliciesOptions.type())); + } + if (listV2PoliciesOptions.serviceType() != null) { + builder.query("service_type", String.valueOf(listV2PoliciesOptions.serviceType())); + } + if (listV2PoliciesOptions.serviceName() != null) { + builder.query("service_name", String.valueOf(listV2PoliciesOptions.serviceName())); + } + if (listV2PoliciesOptions.serviceGroupId() != null) { + builder.query("service_group_id", String.valueOf(listV2PoliciesOptions.serviceGroupId())); + } + if (listV2PoliciesOptions.sort() != null) { + builder.query("sort", String.valueOf(listV2PoliciesOptions.sort())); + } + if (listV2PoliciesOptions.format() != null) { + builder.query("format", String.valueOf(listV2PoliciesOptions.format())); + } + if (listV2PoliciesOptions.state() != null) { + builder.query("state", String.valueOf(listV2PoliciesOptions.state())); + } + if (listV2PoliciesOptions.limit() != null) { + builder.query("limit", String.valueOf(listV2PoliciesOptions.limit())); + } + if (listV2PoliciesOptions.start() != null) { + builder.query("start", String.valueOf(listV2PoliciesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a policy. + * + * Creates a policy to grant access between a subject and a resource. Currently, there is one type of a v2/policy: + * **access**. A policy administrator might want to create an access policy that grants access to a user, service-id, + * or an access group. + * + * ### Access + * + * To create an access policy, use **`"type": "access"`** in the body. The supported subject attributes are + * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute to assign access to a user or + * service-id. Use the **`access_group_id`** subject attribute to assign access to an access group. Assign roles that + * are supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or + * **`service_group_id`** attribute and the **`accountId`** attribute. In the rule field, you can specify a single + * condition by using **`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`** with a + * combination **`operator`**. The possible combination operators are **`and`** and **`or`**. + * + * Currently, we support two types of patterns: + * + * 1. `time-based`: Used to specify a time-based restriction + * + * Combine conditions to specify a time-based restriction (e.g., access only during business hours, during the + * Monday-Friday work week). For example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following + * rule: + * ```json + * "rule": { + * "operator": "and", + * "conditions": [{ + * "key": "{{environment.attributes.day_of_week}}", + * "operator": "dayOfWeekAnyOf", + * "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] + * }, + * "key": "{{environment.attributes.current_time}}", + * "operator": "timeGreaterThanOrEquals", + * "value": "09:00:00+00:00" + * }, + * "key": "{{environment.attributes.current_time}}", + * "operator": "timeLessThanOrEquals", + * "value": "17:00:00+00:00" + * }] + * } + * ``` You can use the following operators in the **`key`** and **`value`** pair: + * ``` + * 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', + * 'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan', 'dateGreaterThanOrEquals', + * 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', + * 'dayOfWeekEquals', 'dayOfWeekAnyOf' + * ``` + * + * The pattern field that matches the rule is required when rule is provided. For the business hour rule example + * above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions + * operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) and + * [Limiting access with time-based conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the + * subject is a locked service-id, the request will fail. + * + * 2. `attribute-based`: Used to specify a combination of OR/AND based conditions applied on resource attributes. + * + * Combine conditions to specify an attribute-based condition using AND/OR-based operators. + * + * For example, a policy can grant access based on multiple conditions applied on the resource attributes below: + * ```json + * "pattern": "attribute-based-condition:resource:literal-and-wildcard" + * "rule": { + * "operator": "or", + * "conditions": [ + * { + * "operator": "and", + * "conditions": [ + * { + * "key": "{{resource.attributes.prefix}}", + * "operator": "stringEquals", + * "value": "home/test" + * }, + * { + * "key": "{{environment.attributes.delimiter}}", + * "operator": "stringEquals", + * "value": "/" + * } + * ] + * }, + * { + * "key": "{{resource.attributes.path}}", + * "operator": "stringMatch", + * "value": "home/David/_*" + * } + * ] + * } + * ``` + * + * In addition to satisfying the `resources` section, the policy grants permission only if either the `path` begins + * with `home/David/` **OR** the `prefix` is `home/test` and the `delimiter` is `/`. This mechanism helps you + * consolidate multiple policies in to a single policy, making policies easier to administer and stay within the + * policy limit for an account. View the list of operators that can be used in the condition + * [here](/docs/account?topic=account-wildcard#string-comparisons). + * + * ### Authorization + * + * Authorization policies are supported by services on a case by case basis. Refer to service documentation to verify + * their support of authorization policies. To create an authorization policy, use **`"type": "authorization"`** in + * the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject + * attributes might be provided. The following attributes are supported: + * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are + * supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access + * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject + * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. + * + * ### Attribute Operators + * + * Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators are available. For more + * information, see [Assigning access by using wildcard + * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). + * + * ### Attribute Validations + * + * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like + * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated + * against Global Catalog locations. + * + * @param createV2PolicyOptions the {@link CreateV2PolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link V2Policy} + */ + public ServiceCall createV2Policy(CreateV2PolicyOptions createV2PolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createV2PolicyOptions, + "createV2PolicyOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createV2Policy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createV2PolicyOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createV2PolicyOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.add("control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.control())); + contentJson.addProperty("type", createV2PolicyOptions.type()); + if (createV2PolicyOptions.description() != null) { + contentJson.addProperty("description", createV2PolicyOptions.description()); + } + if (createV2PolicyOptions.subject() != null) { + contentJson.add("subject", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.subject())); + } + if (createV2PolicyOptions.resource() != null) { + contentJson.add("resource", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.resource())); + } + if (createV2PolicyOptions.pattern() != null) { + contentJson.addProperty("pattern", createV2PolicyOptions.pattern()); + } + if (createV2PolicyOptions.rule() != null) { + contentJson.add("rule", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.rule())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a policy. + * + * Update a policy to grant access between a subject and a resource. A policy administrator might want to update an + * existing policy. + * + * ### Access + * + * To update an access policy, use **`"type": "access"`** in the body. The supported subject attributes are + * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute to assign access to a user or + * service-id. Use the **`access_group_id`** subject attribute to assign access to an access group. Assign roles that + * are supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or + * **`service_group_id`** attribute and the **`accountId`** attribute. In the rule field, you can specify a single + * condition by using **`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`** with a + * combination **`operator`**. The possible combination operators are **`and`** and **`or`**. + * + * Currently, we support two types of patterns: + * + * 1. `time-based`: Used to specify a time-based restriction + * + * Combine conditions to specify a time-based restriction (e.g., access only during business hours, during the + * Monday-Friday work week). For example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following + * rule: + * ```json + * "rule": { + * "operator": "and", + * "conditions": [{ + * "key": "{{environment.attributes.day_of_week}}", + * "operator": "dayOfWeekAnyOf", + * "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] + * }, + * "key": "{{environment.attributes.current_time}}", + * "operator": "timeGreaterThanOrEquals", + * "value": "09:00:00+00:00" + * }, + * "key": "{{environment.attributes.current_time}}", + * "operator": "timeLessThanOrEquals", + * "value": "17:00:00+00:00" + * }] + * } + * ``` You can use the following operators in the **`key`** and **`value`** pair: + * ``` + * 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', + * 'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan', 'dateGreaterThanOrEquals', + * 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', + * 'dayOfWeekEquals', 'dayOfWeekAnyOf' + * ``` The pattern field that matches the rule is required when rule is provided. For the business hour rule example + * above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions + * operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) and + * [Limiting access with time-based conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the + * subject is a locked service-id, the request will fail. + * + * 2. `attribute-based`: Used to specify a combination of OR/AND based conditions applied on resource attributes. + * + * Combine conditions to specify an attribute-based condition using AND/OR-based operators. + * + * For example, a policy can grant access based on multiple conditions applied on the resource attributes below: + * ```json + * "pattern": "attribute-based-condition:resource:literal-and-wildcard" + * "rule": { + * "operator": "or", + * "conditions": [ + * { + * "operator": "and", + * "conditions": [ + * { + * "key": "{{resource.attributes.prefix}}", + * "operator": "stringEquals", + * "value": "home/test" + * }, + * { + * "key": "{{environment.attributes.delimiter}}", + * "operator": "stringEquals", + * "value": "/" + * } + * ] + * }, + * { + * "key": "{{resource.attributes.path}}", + * "operator": "stringMatch", + * "value": "home/David/_*" + * } + * ] + * } + * ``` + * + * In addition to satisfying the `resources` section, the policy grants permission only if either the `path` begins + * with `home/David/` **OR** the `prefix` is `home/test` and the `delimiter` is `/`. This mechanism helps you + * consolidate multiple policies in to a single policy, making policies easier to administer and stay within the + * policy limit for an account. View the list of operators that can be used in the condition + * [here](/docs/account?topic=account-wildcard#string-comparisons). + * + * ### Authorization + * + * To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match + * the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following + * attributes are supported: + * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are + * supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access + * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject + * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. + * + * ### Attribute Operators + * + * Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators are available. For more + * information, see [Assigning access by using wildcard + * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). + * + * ### Attribute Validations + * + * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like + * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated + * against Global Catalog locations. + * + * @param replaceV2PolicyOptions the {@link ReplaceV2PolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link V2Policy} + */ + public ServiceCall replaceV2Policy(ReplaceV2PolicyOptions replaceV2PolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceV2PolicyOptions, + "replaceV2PolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("id", replaceV2PolicyOptions.id()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceV2Policy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replaceV2PolicyOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.add("control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.control())); + contentJson.addProperty("type", replaceV2PolicyOptions.type()); + if (replaceV2PolicyOptions.description() != null) { + contentJson.addProperty("description", replaceV2PolicyOptions.description()); + } + if (replaceV2PolicyOptions.subject() != null) { + contentJson.add("subject", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.subject())); + } + if (replaceV2PolicyOptions.resource() != null) { + contentJson.add("resource", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.resource())); + } + if (replaceV2PolicyOptions.pattern() != null) { + contentJson.addProperty("pattern", replaceV2PolicyOptions.pattern()); + } + if (replaceV2PolicyOptions.rule() != null) { + contentJson.add("rule", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.rule())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a policy by ID. + * + * Retrieve a policy by providing a policy ID. + * + * @param getV2PolicyOptions the {@link GetV2PolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link V2PolicyTemplateMetaData} + */ + public ServiceCall getV2Policy(GetV2PolicyOptions getV2PolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getV2PolicyOptions, + "getV2PolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("id", getV2PolicyOptions.id()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getV2Policy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getV2PolicyOptions.format() != null) { + builder.query("format", String.valueOf(getV2PolicyOptions.format())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a policy by ID. + * + * Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service + * ID. If the subject of the policy is a locked service-id, the request will fail. + * + * @param deleteV2PolicyOptions the {@link DeleteV2PolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteV2Policy(DeleteV2PolicyOptions deleteV2PolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteV2PolicyOptions, + "deleteV2PolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("id", deleteV2PolicyOptions.id()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteV2Policy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * List policy templates by attributes. + * + * List policy templates and filter by attributes by using query parameters. The following attributes are supported: + * `account_id`, `policy_service_name`, `policy_service_type`, `policy_service_group_id` and `policy_type`. + * `account_id` is a required query parameter. These attributes `policy_service_name`, `policy_service_type` and + * `policy_service_group_id` are mutually exclusive. Only policy templates that have the specified attributes and that + * the caller has read access to are returned. If the caller does not have read access to any policy templates an + * empty array is returned. + * + * @param listPolicyTemplatesOptions the {@link ListPolicyTemplatesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateCollection} + */ + public ServiceCall listPolicyTemplates(ListPolicyTemplatesOptions listPolicyTemplatesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyTemplatesOptions, + "listPolicyTemplatesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyTemplates"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listPolicyTemplatesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listPolicyTemplatesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listPolicyTemplatesOptions.accountId())); + if (listPolicyTemplatesOptions.state() != null) { + builder.query("state", String.valueOf(listPolicyTemplatesOptions.state())); + } + if (listPolicyTemplatesOptions.name() != null) { + builder.query("name", String.valueOf(listPolicyTemplatesOptions.name())); + } + if (listPolicyTemplatesOptions.policyServiceType() != null) { + builder.query("policy_service_type", String.valueOf(listPolicyTemplatesOptions.policyServiceType())); + } + if (listPolicyTemplatesOptions.policyServiceName() != null) { + builder.query("policy_service_name", String.valueOf(listPolicyTemplatesOptions.policyServiceName())); + } + if (listPolicyTemplatesOptions.policyServiceGroupId() != null) { + builder.query("policy_service_group_id", String.valueOf(listPolicyTemplatesOptions.policyServiceGroupId())); + } + if (listPolicyTemplatesOptions.policyType() != null) { + builder.query("policy_type", String.valueOf(listPolicyTemplatesOptions.policyType())); + } + if (listPolicyTemplatesOptions.limit() != null) { + builder.query("limit", String.valueOf(listPolicyTemplatesOptions.limit())); + } + if (listPolicyTemplatesOptions.start() != null) { + builder.query("start", String.valueOf(listPolicyTemplatesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a policy template. + * + * Create a policy template. Policy templates define a policy without requiring a subject, and you can use them to + * grant access to multiple subjects. + * + * @param createPolicyTemplateOptions the {@link CreatePolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateLimitData} + */ + public ServiceCall createPolicyTemplate(CreatePolicyTemplateOptions createPolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateOptions, + "createPolicyTemplateOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createPolicyTemplateOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createPolicyTemplateOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("name", createPolicyTemplateOptions.name()); + contentJson.addProperty("account_id", createPolicyTemplateOptions.accountId()); + contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateOptions.policy())); + if (createPolicyTemplateOptions.description() != null) { + contentJson.addProperty("description", createPolicyTemplateOptions.description()); + } + if (createPolicyTemplateOptions.committed() != null) { + contentJson.addProperty("committed", createPolicyTemplateOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve latest version of a policy template. + * + * Retrieve the latest version of a policy template by providing a policy template ID. + * + * @param getPolicyTemplateOptions the {@link GetPolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} + */ + public ServiceCall getPolicyTemplate(GetPolicyTemplateOptions getPolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyTemplateOptions, + "getPolicyTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", getPolicyTemplateOptions.policyTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getPolicyTemplateOptions.state() != null) { + builder.query("state", String.valueOf(getPolicyTemplateOptions.state())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a policy template. + * + * Delete a policy template by providing the policy template ID. This deletes all versions of this template. A policy + * template can't be deleted if any version of the template is assigned to one or more child accounts. You must remove + * the policy assignments first. + * + * @param deletePolicyTemplateOptions the {@link DeletePolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deletePolicyTemplate(DeletePolicyTemplateOptions deletePolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyTemplateOptions, + "deletePolicyTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", deletePolicyTemplateOptions.policyTemplateId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a new policy template version. + * + * Create a new version of a policy template. Use this if you need to make updates to a policy template that is + * committed. + * + * @param createPolicyTemplateVersionOptions the {@link CreatePolicyTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateLimitData} + */ + public ServiceCall createPolicyTemplateVersion(CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateVersionOptions, + "createPolicyTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", createPolicyTemplateVersionOptions.policyTemplateId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateVersionOptions.policy())); + if (createPolicyTemplateVersionOptions.name() != null) { + contentJson.addProperty("name", createPolicyTemplateVersionOptions.name()); + } + if (createPolicyTemplateVersionOptions.description() != null) { + contentJson.addProperty("description", createPolicyTemplateVersionOptions.description()); + } + if (createPolicyTemplateVersionOptions.committed() != null) { + contentJson.addProperty("committed", createPolicyTemplateVersionOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve policy template versions. + * + * Retrieve the versions of a policy template by providing a policy template ID. + * + * @param listPolicyTemplateVersionsOptions the {@link ListPolicyTemplateVersionsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateVersionsCollection} + */ + public ServiceCall listPolicyTemplateVersions(ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyTemplateVersionsOptions, + "listPolicyTemplateVersionsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", listPolicyTemplateVersionsOptions.policyTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyTemplateVersions"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listPolicyTemplateVersionsOptions.state() != null) { + builder.query("state", String.valueOf(listPolicyTemplateVersionsOptions.state())); + } + if (listPolicyTemplateVersionsOptions.limit() != null) { + builder.query("limit", String.valueOf(listPolicyTemplateVersionsOptions.limit())); + } + if (listPolicyTemplateVersionsOptions.start() != null) { + builder.query("start", String.valueOf(listPolicyTemplateVersionsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a policy template version. + * + * Update a specific version of a policy template. You can use this only if the version isn't committed. + * + * @param replacePolicyTemplateOptions the {@link ReplacePolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} + */ + public ServiceCall replacePolicyTemplate(ReplacePolicyTemplateOptions replacePolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replacePolicyTemplateOptions, + "replacePolicyTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", replacePolicyTemplateOptions.policyTemplateId()); + pathParamsMap.put("version", replacePolicyTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replacePolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replacePolicyTemplateOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyTemplateOptions.policy())); + if (replacePolicyTemplateOptions.name() != null) { + contentJson.addProperty("name", replacePolicyTemplateOptions.name()); + } + if (replacePolicyTemplateOptions.description() != null) { + contentJson.addProperty("description", replacePolicyTemplateOptions.description()); + } + if (replacePolicyTemplateOptions.committed() != null) { + contentJson.addProperty("committed", replacePolicyTemplateOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a policy template version. + * + * Delete a specific version of a policy template by providing a policy template ID and version number. You can't + * delete a policy template version that is assigned to one or more child accounts. You must remove the policy + * assignments first. + * + * @param deletePolicyTemplateVersionOptions the {@link DeletePolicyTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deletePolicyTemplateVersion(DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyTemplateVersionOptions, + "deletePolicyTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", deletePolicyTemplateVersionOptions.policyTemplateId()); + pathParamsMap.put("version", deletePolicyTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a policy template version. + * + * Retrieve a policy template by providing a policy template ID and version number. + * + * @param getPolicyTemplateVersionOptions the {@link GetPolicyTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} + */ + public ServiceCall getPolicyTemplateVersion(GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyTemplateVersionOptions, + "getPolicyTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", getPolicyTemplateVersionOptions.policyTemplateId()); + pathParamsMap.put("version", getPolicyTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyTemplateVersion"); + 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); + } + + /** + * Commit a policy template version. + * + * Commit a policy template version. You can make no further changes to the policy template once it's committed. If + * you need to make updates after committing a version, create a new version. + * + * @param commitPolicyTemplateOptions the {@link CommitPolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall commitPolicyTemplate(CommitPolicyTemplateOptions commitPolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(commitPolicyTemplateOptions, + "commitPolicyTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", commitPolicyTemplateOptions.policyTemplateId()); + pathParamsMap.put("version", commitPolicyTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}/commit", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitPolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get policy template assignments. + * + * Get policy template assignments by attributes. The following attributes are supported: + * `account_id`, `template_id`, `template_version`, `sort`. + * `account_id` is a required query parameter. Only policy template assignments that have the specified attributes and + * that the caller has read access to are returned. If the caller does not have read access to any policy template + * assignments an empty array is returned. + * + * @param listPolicyAssignmentsOptions the {@link ListPolicyAssignmentsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateAssignmentCollection} + */ + public ServiceCall listPolicyAssignments(ListPolicyAssignmentsOptions listPolicyAssignmentsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyAssignmentsOptions, + "listPolicyAssignmentsOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyAssignments"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listPolicyAssignmentsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listPolicyAssignmentsOptions.acceptLanguage()); + } + builder.query("version", String.valueOf(listPolicyAssignmentsOptions.version())); + builder.query("account_id", String.valueOf(listPolicyAssignmentsOptions.accountId())); + if (listPolicyAssignmentsOptions.templateId() != null) { + builder.query("template_id", String.valueOf(listPolicyAssignmentsOptions.templateId())); + } + if (listPolicyAssignmentsOptions.templateVersion() != null) { + builder.query("template_version", String.valueOf(listPolicyAssignmentsOptions.templateVersion())); + } + if (listPolicyAssignmentsOptions.limit() != null) { + builder.query("limit", String.valueOf(listPolicyAssignmentsOptions.limit())); + } + if (listPolicyAssignmentsOptions.start() != null) { + builder.query("start", String.valueOf(listPolicyAssignmentsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a policy authorization template assignment. + * + * Assign a policy template to child accounts and account groups. This creates the policy in the accounts and account + * groups that you specify. + * + * @param createPolicyTemplateAssignmentOptions the {@link CreatePolicyTemplateAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyAssignmentV1Collection} + */ + public ServiceCall createPolicyTemplateAssignment(CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateAssignmentOptions, + "createPolicyTemplateAssignmentOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplateAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createPolicyTemplateAssignmentOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createPolicyTemplateAssignmentOptions.acceptLanguage()); + } + builder.query("version", String.valueOf(createPolicyTemplateAssignmentOptions.version())); + final JsonObject contentJson = new JsonObject(); + contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateAssignmentOptions.target())); + contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateAssignmentOptions.templates())); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a policy assignment. + * + * Retrieve a policy template assignment by providing a policy assignment ID. + * + * @param getPolicyAssignmentOptions the {@link GetPolicyAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateAssignmentItems} + */ + public ServiceCall getPolicyAssignment(GetPolicyAssignmentOptions getPolicyAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyAssignmentOptions, + "getPolicyAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", getPolicyAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.query("version", String.valueOf(getPolicyAssignmentOptions.version())); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a policy authorization type assignment. + * + * Update a policy assignment by providing a policy assignment ID. + * + * @param updatePolicyAssignmentOptions the {@link UpdatePolicyAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyAssignmentV1} + */ + public ServiceCall updatePolicyAssignment(UpdatePolicyAssignmentOptions updatePolicyAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updatePolicyAssignmentOptions, + "updatePolicyAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", updatePolicyAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updatePolicyAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updatePolicyAssignmentOptions.ifMatch()); + builder.query("version", String.valueOf(updatePolicyAssignmentOptions.version())); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("template_version", updatePolicyAssignmentOptions.templateVersion()); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Remove a policy assignment. + * + * Remove a policy template assignment by providing a policy assignment ID. You can't delete a policy assignment if + * the status is "in_progress". + * + * @param deletePolicyAssignmentOptions the {@link DeletePolicyAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deletePolicyAssignment(DeletePolicyAssignmentOptions deletePolicyAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyAssignmentOptions, + "deletePolicyAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", deletePolicyAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve Access Management account settings by account ID. + * + * Retrieve Access Management settings for an account by providing the account ID. + * + * @param getSettingsOptions the {@link GetSettingsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccountSettingsAccessManagement} + */ + public ServiceCall getSettings(GetSettingsOptions getSettingsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getSettingsOptions, + "getSettingsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("account_id", getSettingsOptions.accountId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/settings/access_management", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getSettings"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getSettingsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", getSettingsOptions.acceptLanguage()); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update Access Management account settings by account ID. + * + * Update access management settings for an account. + * + * ### External Account Identity Interaction + * + * Update the way identities within an external account are allowed to interact with the requested account by + * providing: + * * the `account_id` as a parameter + * * one or more external account ID(s) and state for the specific identity in the request body + * + * External account identity interaction includes the following `identity_types`: `user` (user identities that are + * defined as [IBMid's](https://cloud.ibm.com/docs/account?topic=account-identity-overview#users-bestpract)), + * `service_id` (defined as [IAM + * ServiceIds](https://cloud.ibm.com/docs/account?topic=account-identity-overview#serviceid-bestpract)), `service` + * (defined by a service’s [CRN](https://cloud.ibm.com/docs/account?topic=account-crn)). To update an Identity’s + * setting, the `state` and `external_allowed_accounts` fields are required. + * + * Different identity states are: + * * "enabled": An identity type is allowed to access resources in the account provided it has access policies on + * those resources. + * * "limited": An identity type is allowed to access resources in the account provided it has access policies on + * those resources AND it is associated with either the account the resources are in or one of the allowed accounts. + * This setting uses the "external_allowed_accounts" list. + * * "monitor": It has no direct impact on an Identity’s access. Instead, it creates AT events for access decisions as + * if the account were in a limited “state”. + * + * **Note**: The state "enabled" is a special case. In this case, access is given to all accounts and there is no need + * to specify a particular list. Therefore, when updating "state" to "enabled" for an identity type + * "external_allowed_accounts" should be left empty. + * + * @param updateSettingsOptions the {@link UpdateSettingsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccountSettingsAccessManagement} + */ + public ServiceCall updateSettings(UpdateSettingsOptions updateSettingsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateSettingsOptions, + "updateSettingsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("account_id", updateSettingsOptions.accountId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/settings/access_management", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateSettings"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updateSettingsOptions.ifMatch()); + if (updateSettingsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", updateSettingsOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + if (updateSettingsOptions.externalAccountIdentityInteraction() != null) { + contentJson.add("external_account_identity_interaction", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateSettingsOptions.externalAccountIdentityInteraction())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * List action control templates by attributes. + * + * List action control templates and filter by attributes by using query parameters. The following attributes are + * supported: + * `account_id` + * `account_id` is a required query parameter. Only action control templates that have the specified attributes and + * that the caller has read access to are returned. If the caller does not have read access to any action control + * templates an empty array is returned. + * + * @param listActionControlTemplatesOptions the {@link ListActionControlTemplatesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplateCollection} + */ + public ServiceCall listActionControlTemplates(ListActionControlTemplatesOptions listActionControlTemplatesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlTemplatesOptions, + "listActionControlTemplatesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlTemplates"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listActionControlTemplatesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listActionControlTemplatesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listActionControlTemplatesOptions.accountId())); + if (listActionControlTemplatesOptions.limit() != null) { + builder.query("limit", String.valueOf(listActionControlTemplatesOptions.limit())); + } + if (listActionControlTemplatesOptions.start() != null) { + builder.query("start", String.valueOf(listActionControlTemplatesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create an action control template. + * + * Create an action control template. Action control templates define a service action control. + * + * @param createActionControlTemplateOptions the {@link CreateActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall createActionControlTemplate(CreateActionControlTemplateOptions createActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateOptions, + "createActionControlTemplateOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createActionControlTemplateOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createActionControlTemplateOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("name", createActionControlTemplateOptions.name()); + contentJson.addProperty("account_id", createActionControlTemplateOptions.accountId()); + if (createActionControlTemplateOptions.description() != null) { + contentJson.addProperty("description", createActionControlTemplateOptions.description()); + } + if (createActionControlTemplateOptions.committed() != null) { + contentJson.addProperty("committed", createActionControlTemplateOptions.committed()); + } + if (createActionControlTemplateOptions.actionControl() != null) { + contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateOptions.actionControl())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve the latest version of an action control template. + * + * Retrieve the latest version of an action control template by providing an action control template ID. + * + * @param getActionControlTemplateOptions the {@link GetActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall getActionControlTemplate(GetActionControlTemplateOptions getActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlTemplateOptions, + "getActionControlTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", getActionControlTemplateOptions.actionControlTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getActionControlTemplateOptions.state() != null) { + builder.query("state", String.valueOf(getActionControlTemplateOptions.state())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete an action control template. + * + * Delete an action control template by providing the action control template ID. This deletes all versions of this + * template. An action control template can't be deleted if any version of the template is assigned to one or more + * child accounts. You must remove the action control assignments first. + * + * @param deleteActionControlTemplateOptions the {@link DeleteActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteActionControlTemplate(DeleteActionControlTemplateOptions deleteActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlTemplateOptions, + "deleteActionControlTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", deleteActionControlTemplateOptions.actionControlTemplateId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a new action control template version. + * + * Create a new version of an action control template. Use this if you need to make updates to an action control + * template that is committed. + * + * @param createActionControlTemplateVersionOptions the {@link CreateActionControlTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall createActionControlTemplateVersion(CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateVersionOptions, + "createActionControlTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", createActionControlTemplateVersionOptions.actionControlTemplateId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + if (createActionControlTemplateVersionOptions.name() != null) { + contentJson.addProperty("name", createActionControlTemplateVersionOptions.name()); + } + if (createActionControlTemplateVersionOptions.description() != null) { + contentJson.addProperty("description", createActionControlTemplateVersionOptions.description()); + } + if (createActionControlTemplateVersionOptions.actionControl() != null) { + contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateVersionOptions.actionControl())); + } + if (createActionControlTemplateVersionOptions.committed() != null) { + contentJson.addProperty("committed", createActionControlTemplateVersionOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve action control template versions. + * + * Retrieve the versions of an action control template by providing an action control template ID. + * + * @param listActionControlTemplateVersionsOptions the {@link ListActionControlTemplateVersionsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplateVersionsCollection} + */ + public ServiceCall listActionControlTemplateVersions(ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlTemplateVersionsOptions, + "listActionControlTemplateVersionsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", listActionControlTemplateVersionsOptions.actionControlTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlTemplateVersions"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listActionControlTemplateVersionsOptions.state() != null) { + builder.query("state", String.valueOf(listActionControlTemplateVersionsOptions.state())); + } + if (listActionControlTemplateVersionsOptions.limit() != null) { + builder.query("limit", String.valueOf(listActionControlTemplateVersionsOptions.limit())); + } + if (listActionControlTemplateVersionsOptions.start() != null) { + builder.query("start", String.valueOf(listActionControlTemplateVersionsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update an action control template version. + * + * Update a specific version of an action control template. You can use this only if the version isn't committed. + * + * @param replaceActionControlTemplateOptions the {@link ReplaceActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall replaceActionControlTemplate(ReplaceActionControlTemplateOptions replaceActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceActionControlTemplateOptions, + "replaceActionControlTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", replaceActionControlTemplateOptions.actionControlTemplateId()); + pathParamsMap.put("version", replaceActionControlTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replaceActionControlTemplateOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + if (replaceActionControlTemplateOptions.name() != null) { + contentJson.addProperty("name", replaceActionControlTemplateOptions.name()); + } + if (replaceActionControlTemplateOptions.description() != null) { + contentJson.addProperty("description", replaceActionControlTemplateOptions.description()); + } + if (replaceActionControlTemplateOptions.actionControl() != null) { + contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceActionControlTemplateOptions.actionControl())); + } + if (replaceActionControlTemplateOptions.committed() != null) { + contentJson.addProperty("committed", replaceActionControlTemplateOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete an action control template version. + * + * Delete a specific version of an action control template by providing an action control template ID and version + * number. You can't delete an action control template version that is assigned to one or more child accounts. You + * must remove the action control assignments first. + * + * @param deleteActionControlTemplateVersionOptions the {@link DeleteActionControlTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteActionControlTemplateVersion(DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlTemplateVersionOptions, + "deleteActionControlTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", deleteActionControlTemplateVersionOptions.actionControlTemplateId()); + pathParamsMap.put("version", deleteActionControlTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve an action control template version. + * + * Retrieve an action control template by providing an action control template ID and version number. + * + * @param getActionControlTemplateVersionOptions the {@link GetActionControlTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall getActionControlTemplateVersion(GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlTemplateVersionOptions, + "getActionControlTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", getActionControlTemplateVersionOptions.actionControlTemplateId()); + pathParamsMap.put("version", getActionControlTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlTemplateVersion"); + 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); + } + + /** + * Commit an action control template version. + * + * Commit an action control template version. You cannot make any further changes to the action control template once + * it's committed. If you have to make updates after committing a version, create a new version. + * + * @param commitActionControlTemplateOptions the {@link CommitActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall commitActionControlTemplate(CommitActionControlTemplateOptions commitActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(commitActionControlTemplateOptions, + "commitActionControlTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", commitActionControlTemplateOptions.actionControlTemplateId()); + pathParamsMap.put("version", commitActionControlTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}/commit", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get action control template assignments. + * + * Get action control template assignments by attributes. The following attributes are supported: + * `account_id`, `template_id`, `template_version`, `sort`. + * `account_id` is a required query parameter. Only action control template assignments with the specified attributes + * and accessible by the caller are returned. If the caller does not have read access to any action control template + * assignments, an empty array is returned. + * + * @param listActionControlAssignmentsOptions the {@link ListActionControlAssignmentsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignmentCollection} + */ + public ServiceCall listActionControlAssignments(ListActionControlAssignmentsOptions listActionControlAssignmentsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlAssignmentsOptions, + "listActionControlAssignmentsOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlAssignments"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listActionControlAssignmentsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listActionControlAssignmentsOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listActionControlAssignmentsOptions.accountId())); + if (listActionControlAssignmentsOptions.templateId() != null) { + builder.query("template_id", String.valueOf(listActionControlAssignmentsOptions.templateId())); + } + if (listActionControlAssignmentsOptions.templateVersion() != null) { + builder.query("template_version", String.valueOf(listActionControlAssignmentsOptions.templateVersion())); + } + if (listActionControlAssignmentsOptions.limit() != null) { + builder.query("limit", String.valueOf(listActionControlAssignmentsOptions.limit())); + } + if (listActionControlAssignmentsOptions.start() != null) { + builder.query("start", String.valueOf(listActionControlAssignmentsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create an action control template assignment. + * + * Assign an action control template to child accounts and account groups. This creates the action control in the + * accounts and account groups that you specify. + * + * @param createActionControlTemplateAssignmentOptions the {@link CreateActionControlTemplateAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignmentCollection} + */ + public ServiceCall createActionControlTemplateAssignment(CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateAssignmentOptions, + "createActionControlTemplateAssignmentOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplateAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createActionControlTemplateAssignmentOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createActionControlTemplateAssignmentOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateAssignmentOptions.target())); + contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateAssignmentOptions.templates())); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve an action control assignment. + * + * Retrieve an action control template assignment by providing an action control assignment ID. + * + * @param getActionControlAssignmentOptions the {@link GetActionControlAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignment} + */ + public ServiceCall getActionControlAssignment(GetActionControlAssignmentOptions getActionControlAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlAssignmentOptions, + "getActionControlAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", getActionControlAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlAssignment"); + 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 an action control assignment. + * + * Update an action control assignment by providing an action control assignment ID. + * + * @param updateActionControlAssignmentOptions the {@link UpdateActionControlAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignment} + */ + public ServiceCall updateActionControlAssignment(UpdateActionControlAssignmentOptions updateActionControlAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateActionControlAssignmentOptions, + "updateActionControlAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", updateActionControlAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateActionControlAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updateActionControlAssignmentOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("template_version", updateActionControlAssignmentOptions.templateVersion()); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Remove an action control assignment. + * + * Remove an action control template assignment by providing an action control assignment ID. You can't delete an + * action control assignment if the status is "in_progress". + * + * @param deleteActionControlAssignmentOptions the {@link DeleteActionControlAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteActionControlAssignment(DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlAssignmentOptions, + "deleteActionControlAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", deleteActionControlAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * List role templates by attributes. + * + * List role templates and filter by attributes by using query parameters. The following attributes are supported: + * `account_id`, `name`, `role_name`, `role_service_name`, `state`, `limit`, `start`. + * `account_id` is a required query parameter. Only role templates that have the specified attributes and that the + * caller has read access to are returned. If the caller does not have read access to any role templates an empty + * array is returned. + * + * @param listRoleTemplatesOptions the {@link ListRoleTemplatesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplateCollection} + */ + public ServiceCall listRoleTemplates(ListRoleTemplatesOptions listRoleTemplatesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleTemplatesOptions, + "listRoleTemplatesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleTemplates"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listRoleTemplatesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listRoleTemplatesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listRoleTemplatesOptions.accountId())); + if (listRoleTemplatesOptions.name() != null) { + builder.query("name", String.valueOf(listRoleTemplatesOptions.name())); + } + if (listRoleTemplatesOptions.roleName() != null) { + builder.query("role_name", String.valueOf(listRoleTemplatesOptions.roleName())); + } + if (listRoleTemplatesOptions.roleServiceName() != null) { + builder.query("role_service_name", String.valueOf(listRoleTemplatesOptions.roleServiceName())); + } + if (listRoleTemplatesOptions.state() != null) { + builder.query("state", String.valueOf(listRoleTemplatesOptions.state())); + } + if (listRoleTemplatesOptions.limit() != null) { + builder.query("limit", String.valueOf(listRoleTemplatesOptions.limit())); + } + if (listRoleTemplatesOptions.start() != null) { + builder.query("start", String.valueOf(listRoleTemplatesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create role template. + * + * Create a role template. Role templates define roles from an existing system or service defined role. + * + * @param createRoleTemplateOptions the {@link CreateRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall createRoleTemplate(CreateRoleTemplateOptions createRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateOptions, + "createRoleTemplateOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createRoleTemplateOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createRoleTemplateOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("name", createRoleTemplateOptions.name()); + contentJson.addProperty("account_id", createRoleTemplateOptions.accountId()); + if (createRoleTemplateOptions.description() != null) { + contentJson.addProperty("description", createRoleTemplateOptions.description()); + } + if (createRoleTemplateOptions.committed() != null) { + contentJson.addProperty("committed", createRoleTemplateOptions.committed()); + } + if (createRoleTemplateOptions.role() != null) { + contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateOptions.role())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve the latest version of a role template. + * + * Retrieve the latest version of a role template by providing a role template ID. + * + * @param getRoleTemplateOptions the {@link GetRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall getRoleTemplate(GetRoleTemplateOptions getRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleTemplateOptions, + "getRoleTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", getRoleTemplateOptions.roleTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getRoleTemplateOptions.state() != null) { + builder.query("state", String.valueOf(getRoleTemplateOptions.state())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a Role template. + * + * Delete a role template by providing the role template ID. This deletes all versions of this template. A role + * template can't be deleted if any version of the template is assigned to one or more child accounts. You must remove + * the role assignments first. + * + * @param deleteRoleTemplateOptions the {@link DeleteRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteRoleTemplate(DeleteRoleTemplateOptions deleteRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleTemplateOptions, + "deleteRoleTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", deleteRoleTemplateOptions.roleTemplateId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a new role template version. + * + * Create a new version of a role template. Use this if you need to make updates to a role template that is committed. + * + * @param createRoleTemplateVersionOptions the {@link CreateRoleTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall createRoleTemplateVersion(CreateRoleTemplateVersionOptions createRoleTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateVersionOptions, + "createRoleTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", createRoleTemplateVersionOptions.roleTemplateId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + if (createRoleTemplateVersionOptions.name() != null) { + contentJson.addProperty("name", createRoleTemplateVersionOptions.name()); + } + if (createRoleTemplateVersionOptions.description() != null) { + contentJson.addProperty("description", createRoleTemplateVersionOptions.description()); + } + if (createRoleTemplateVersionOptions.role() != null) { + contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateVersionOptions.role())); + } + if (createRoleTemplateVersionOptions.committed() != null) { + contentJson.addProperty("committed", createRoleTemplateVersionOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve role template versions. + * + * Retrieve the versions of a role template by providing a role template ID. + * + * @param listRoleTemplateVersionsOptions the {@link ListRoleTemplateVersionsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplateVersionsCollection} + */ + public ServiceCall listRoleTemplateVersions(ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleTemplateVersionsOptions, + "listRoleTemplateVersionsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", listRoleTemplateVersionsOptions.roleTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleTemplateVersions"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listRoleTemplateVersionsOptions.state() != null) { + builder.query("state", String.valueOf(listRoleTemplateVersionsOptions.state())); + } + if (listRoleTemplateVersionsOptions.limit() != null) { + builder.query("limit", String.valueOf(listRoleTemplateVersionsOptions.limit())); + } + if (listRoleTemplateVersionsOptions.start() != null) { + builder.query("start", String.valueOf(listRoleTemplateVersionsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a role template version. + * + * Update a specific version of a role template. You can use this only if the version isn't committed. + * + * @param replaceRoleTemplateOptions the {@link ReplaceRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall replaceRoleTemplate(ReplaceRoleTemplateOptions replaceRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceRoleTemplateOptions, + "replaceRoleTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", replaceRoleTemplateOptions.roleTemplateId()); + pathParamsMap.put("version", replaceRoleTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replaceRoleTemplateOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + if (replaceRoleTemplateOptions.name() != null) { + contentJson.addProperty("name", replaceRoleTemplateOptions.name()); + } + if (replaceRoleTemplateOptions.description() != null) { + contentJson.addProperty("description", replaceRoleTemplateOptions.description()); + } + if (replaceRoleTemplateOptions.role() != null) { + contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRoleTemplateOptions.role())); + } + if (replaceRoleTemplateOptions.committed() != null) { + contentJson.addProperty("committed", replaceRoleTemplateOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a role template version. + * + * Delete a specific version of a role template by providing a role template ID and version number. You can't delete a + * role template version that is assigned to one or more child accounts. You must remove the role assignments first. + * + * @param deleteRoleTemplateVersionOptions the {@link DeleteRoleTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteRoleTemplateVersion(DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleTemplateVersionOptions, + "deleteRoleTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", deleteRoleTemplateVersionOptions.roleTemplateId()); + pathParamsMap.put("version", deleteRoleTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a role template version. + * + * Retrieve a role template by providing a role template ID and version number. + * + * @param getRoleTemplateVersionOptions the {@link GetRoleTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall getRoleTemplateVersion(GetRoleTemplateVersionOptions getRoleTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleTemplateVersionOptions, + "getRoleTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", getRoleTemplateVersionOptions.roleTemplateId()); + pathParamsMap.put("version", getRoleTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleTemplateVersion"); + 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); + } + + /** + * Commit a role template version. + * + * Commit a role template version. You cannot make any further changes to the role template once it's committed. If + * you have to make updates after committing a version, create a new version. + * + * @param commitRoleTemplateOptions the {@link CommitRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall commitRoleTemplate(CommitRoleTemplateOptions commitRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(commitRoleTemplateOptions, + "commitRoleTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", commitRoleTemplateOptions.roleTemplateId()); + pathParamsMap.put("version", commitRoleTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}/commit", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get role template assignments. + * + * Get role template assignments by attributes. The following attributes are supported: + * `account_id`, `template_id`, `template_version`, `target`, `target_type`, `limit`, `start`. + * `account_id` is a required query parameter. Only role template assignments with the specified attributes and + * accessible by the caller are returned. If the caller does not have read access to any role template assignments, an + * empty array is returned. + * + * @param listRoleAssignmentsOptions the {@link ListRoleAssignmentsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleAssignmentCollection} + */ + public ServiceCall listRoleAssignments(ListRoleAssignmentsOptions listRoleAssignmentsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleAssignmentsOptions, + "listRoleAssignmentsOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleAssignments"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listRoleAssignmentsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listRoleAssignmentsOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listRoleAssignmentsOptions.accountId())); + if (listRoleAssignmentsOptions.templateId() != null) { + builder.query("template_id", String.valueOf(listRoleAssignmentsOptions.templateId())); + } + if (listRoleAssignmentsOptions.templateVersion() != null) { + builder.query("template_version", String.valueOf(listRoleAssignmentsOptions.templateVersion())); + } + if (listRoleAssignmentsOptions.limit() != null) { + builder.query("limit", String.valueOf(listRoleAssignmentsOptions.limit())); + } + if (listRoleAssignmentsOptions.start() != null) { + builder.query("start", String.valueOf(listRoleAssignmentsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a role template assignment. + * + * Assign a role template to child accounts and account groups. This creates the role in the accounts and account + * groups that you specify. + * + * @param createRoleTemplateAssignmentOptions the {@link CreateRoleTemplateAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleAssignmentCollection} + */ + public ServiceCall createRoleTemplateAssignment(CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateAssignmentOptions, + "createRoleTemplateAssignmentOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplateAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createRoleTemplateAssignmentOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createRoleTemplateAssignmentOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateAssignmentOptions.target())); + contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateAssignmentOptions.templates())); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a role assignment. + * + * Retrieve a role template assignment by providing a role assignment ID. + * + * @param getRoleAssignmentOptions the {@link GetRoleAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleAssignment} + */ + public ServiceCall getRoleAssignment(GetRoleAssignmentOptions getRoleAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleAssignmentOptions, + "getRoleAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", getRoleAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleAssignment"); + 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 a role assignment. + * + * Update a role assignment by providing a role assignment ID. + * + * @param updateRoleAssignmentOptions the {@link UpdateRoleAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleAssignment} + */ + public ServiceCall updateRoleAssignment(UpdateRoleAssignmentOptions updateRoleAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateRoleAssignmentOptions, + "updateRoleAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", updateRoleAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateRoleAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updateRoleAssignmentOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("template_version", updateRoleAssignmentOptions.templateVersion()); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Remove a role assignment. + * + * Remove a role template assignment by providing a role assignment ID. You can't delete a role assignment if the + * status is "in_progress". + * + * @param deleteRoleAssignmentOptions the {@link DeleteRoleAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteRoleAssignment(DeleteRoleAssignmentOptions deleteRoleAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleAssignmentOptions, + "deleteRoleAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", deleteRoleAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java new file mode 100644 index 00000000000..af82ea2abe8 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The Access Management Account Settings that are currently set for the requested account. + */ +public class AccountSettingsAccessManagement extends GenericModel { + + @SerializedName("external_account_identity_interaction") + protected ExternalAccountIdentityInteraction externalAccountIdentityInteraction; + + protected AccountSettingsAccessManagement() { } + + /** + * Gets the externalAccountIdentityInteraction. + * + * How external accounts can interact in relation to the requested account. + * + * @return the externalAccountIdentityInteraction + */ + public ExternalAccountIdentityInteraction getExternalAccountIdentityInteraction() { + return externalAccountIdentityInteraction; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java new file mode 100644 index 00000000000..ea230f57263 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java @@ -0,0 +1,207 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the assigned action control template. + */ +public class ActionControlAssignment extends GenericModel { + + /** + * The current operation of the action control assignment. + */ + public interface Operation { + /** create. */ + String CREATE = "create"; + /** apply. */ + String APPLY = "apply"; + /** update. */ + String UPDATE = "update"; + /** remove. */ + String REMOVE = "remove"; + } + + /** + * The action control assignment status. + */ + public interface Status { + /** accepted. */ + String ACCEPTED = "accepted"; + /** failure. */ + String FAILURE = "failure"; + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** superseded. */ + String SUPERSEDED = "superseded"; + } + + protected String id; + @SerializedName("account_id") + protected String accountId; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String operation; + protected List resources; + protected ActionControlAssignmentTemplate template; + protected AssignmentTargetDetails target; + protected String status; + + protected ActionControlAssignment() { } + + /** + * Gets the id. + * + * Action control assignment ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the accountId. + * + * The account GUID that the action control assignments belong to. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the href. + * + * The href URL that links to the action control assignments API by action control assignment ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the action control assignment was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the action control assignment. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the action control assignment was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the action control assignment. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the operation. + * + * The current operation of the action control assignment. + * + * @return the operation + */ + public String getOperation() { + return operation; + } + + /** + * Gets the resources. + * + * Resources created when action control template is assigned. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the template. + * + * The action control template id and version that will be assigned. + * + * @return the template + */ + public ActionControlAssignmentTemplate getTemplate() { + return template; + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the status. + * + * The action control assignment status. + * + * @return the status + */ + public String getStatus() { + return status; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java new file mode 100644 index 00000000000..a9d6b28ce39 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of action control assignments. + */ +public class ActionControlAssignmentCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List assignments; + + protected ActionControlAssignmentCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the assignments. + * + * List of action control assignments. + * + * @return the assignments + */ + public List getAssignments() { + return assignments; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java new file mode 100644 index 00000000000..122d3c8277b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java @@ -0,0 +1,52 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The action control assignment resources and target where the template is assigned. + */ +public class ActionControlAssignmentResource extends GenericModel { + + protected AssignmentTargetDetails target; + @SerializedName("action_control") + protected ActionControlAssignmentResourceActionControl actionControl; + + protected ActionControlAssignmentResource() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the actionControl. + * + * Set of properties of the assigned resource or error message if assignment failed. + * + * @return the actionControl + */ + public ActionControlAssignmentResourceActionControl getActionControl() { + return actionControl; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java new file mode 100644 index 00000000000..0e5550eb4da --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Set of properties of the assigned resource or error message if assignment failed. + */ +public class ActionControlAssignmentResourceActionControl extends GenericModel { + + @SerializedName("resource_created") + protected ActionControlAssignmentResourceCreated resourceCreated; + @SerializedName("error_message") + protected AssignmentResourceError errorMessage; + + protected ActionControlAssignmentResourceActionControl() { } + + /** + * Gets the resourceCreated. + * + * On success, it includes the action control assigned. + * + * @return the resourceCreated + */ + public ActionControlAssignmentResourceCreated getResourceCreated() { + return resourceCreated; + } + + /** + * Gets the errorMessage. + * + * Body parameters for assignment error. + * + * @return the errorMessage + */ + public AssignmentResourceError getErrorMessage() { + return errorMessage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java new file mode 100644 index 00000000000..6ecbd23392a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * On success, it includes the action control assigned. + */ +public class ActionControlAssignmentResourceCreated extends GenericModel { + + protected String id; + + protected ActionControlAssignmentResourceCreated() { } + + /** + * Gets the id. + * + * action control id. + * + * @return the id + */ + public String getId() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java new file mode 100644 index 00000000000..4e6d2543e18 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The action control template id and version that will be assigned. + */ +public class ActionControlAssignmentTemplate extends GenericModel { + + protected String id; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String version; + + /** + * Instantiates a new Builder from an existing ActionControlAssignmentTemplate instance. + * + * @param actionControlAssignmentTemplate the instance to initialize the Builder with + */ + private Builder(ActionControlAssignmentTemplate actionControlAssignmentTemplate) { + this.id = actionControlAssignmentTemplate.id; + this.version = actionControlAssignmentTemplate.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + * @param version the version + */ + public Builder(String id, String version) { + this.id = id; + this.version = version; + } + + /** + * Builds a ActionControlAssignmentTemplate. + * + * @return the new ActionControlAssignmentTemplate instance + */ + public ActionControlAssignmentTemplate build() { + return new ActionControlAssignmentTemplate(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the ActionControlAssignmentTemplate builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the ActionControlAssignmentTemplate builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected ActionControlAssignmentTemplate() { } + + protected ActionControlAssignmentTemplate(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, + "id cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + id = builder.id; + version = builder.version; + } + + /** + * New builder. + * + * @return a ActionControlAssignmentTemplate builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * Action control template ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java new file mode 100644 index 00000000000..78b6d56be6d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * ActionControlAssignmentsPager can be used to simplify the use of the "listActionControlAssignments" method. + */ +public class ActionControlAssignmentsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListActionControlAssignmentsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected ActionControlAssignmentsPager() { } + + /** + * Constructs a new ActionControlAssignmentsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlAssignments" method + * @param options the ListActionControlAssignmentsOptions instance to be used to invoke the "listActionControlAssignments" method + */ + public ActionControlAssignmentsPager(IamPolicyManagement client, ListActionControlAssignmentsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<ActionControlAssignment> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListActionControlAssignmentsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + ActionControlAssignmentCollection result = client.listActionControlAssignments(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getAssignments(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<ActionControlAssignment> containing all results returned by the "listActionControlAssignments" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java new file mode 100644 index 00000000000..157c9f6a390 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java @@ -0,0 +1,203 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the action control template. + */ +public class ActionControlTemplate extends GenericModel { + + /** + * State of action control template. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String name; + protected String description; + @SerializedName("account_id") + protected String accountId; + protected Boolean committed; + @SerializedName("action_control") + protected TemplateActionControl actionControl; + protected String id; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String version; + protected String state; + + protected ActionControlTemplate() { } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Description of the action control template. This is shown to users in the enterprise account. Use this to describe + * the purpose or context of the action control for enterprise users managing IAM templates. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the committed. + * + * Committed status of the template. If committed is set to true, then the template version can no longer be updated. + * + * @return the committed + */ + public Boolean isCommitted() { + return committed; + } + + /** + * Gets the actionControl. + * + * The action control properties that are created in an action resource when the template is assigned. + * + * @return the actionControl + */ + public TemplateActionControl getActionControl() { + return actionControl; + } + + /** + * Gets the id. + * + * The action control template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the action control templates API by action control template ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the action control template was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the action control template. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the action control template was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the action control template. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the version. + * + * The version number of the template used to identify different versions of same template. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the state. + * + * State of action control template. + * + * @return the state + */ + public String getState() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java new file mode 100644 index 00000000000..e7536d2c9ae --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java @@ -0,0 +1,90 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of action control templates. + */ +public class ActionControlTemplateCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + @SerializedName("action_control_templates") + protected List actionControlTemplates; + + protected ActionControlTemplateCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the actionControlTemplates. + * + * List of action control templates. + * + * @return the actionControlTemplates + */ + public List getActionControlTemplates() { + return actionControlTemplates; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java new file mode 100644 index 00000000000..5e26f45cf46 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of versions for a specific action control template. + */ +public class ActionControlTemplateVersionsCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List versions; + + protected ActionControlTemplateVersionsCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the versions. + * + * List of action control templates versions. + * + * @return the versions + */ + public List getVersions() { + return versions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java new file mode 100644 index 00000000000..660aefe11ba --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * ActionControlTemplateVersionsPager can be used to simplify the use of the "listActionControlTemplateVersions" method. + */ +public class ActionControlTemplateVersionsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListActionControlTemplateVersionsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected ActionControlTemplateVersionsPager() { } + + /** + * Constructs a new ActionControlTemplateVersionsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlTemplateVersions" method + * @param options the ListActionControlTemplateVersionsOptions instance to be used to invoke the "listActionControlTemplateVersions" method + */ + public ActionControlTemplateVersionsPager(IamPolicyManagement client, ListActionControlTemplateVersionsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<ActionControlTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListActionControlTemplateVersionsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + ActionControlTemplateVersionsCollection result = client.listActionControlTemplateVersions(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getVersions(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<ActionControlTemplate> containing all results returned by the "listActionControlTemplateVersions" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java new file mode 100644 index 00000000000..bd326c8d7ec --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * ActionControlTemplatesPager can be used to simplify the use of the "listActionControlTemplates" method. + */ +public class ActionControlTemplatesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListActionControlTemplatesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected ActionControlTemplatesPager() { } + + /** + * Constructs a new ActionControlTemplatesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlTemplates" method + * @param options the ListActionControlTemplatesOptions instance to be used to invoke the "listActionControlTemplates" method + */ + public ActionControlTemplatesPager(IamPolicyManagement client, ListActionControlTemplatesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<ActionControlTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListActionControlTemplatesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + ActionControlTemplateCollection result = client.listActionControlTemplates(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getActionControlTemplates(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<ActionControlTemplate> containing all results returned by the "listActionControlTemplates" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java new file mode 100644 index 00000000000..c454c7a3ef5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * On success, includes the policy that is assigned. + */ +public class AssignmentResourceCreated extends GenericModel { + + protected String id; + + protected AssignmentResourceCreated() { } + + /** + * Gets the id. + * + * Policy id. + * + * @return the id + */ + public String getId() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java new file mode 100644 index 00000000000..e74dbe58b3a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Body parameters for assignment error. + */ +public class AssignmentResourceError extends GenericModel { + + protected String name; + protected String errorCode; + protected String message; + protected String code; + protected List errors; + + protected AssignmentResourceError() { } + + /** + * Gets the name. + * + * Name of the error. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the errorCode. + * + * error code. + * + * @return the errorCode + */ + public String getErrorCode() { + return errorCode; + } + + /** + * Gets the message. + * + * Error message detailing the nature of the error. + * + * @return the message + */ + public String getMessage() { + return message; + } + + /** + * Gets the code. + * + * Internal status code for the error. + * + * @return the code + */ + public String getCode() { + return code; + } + + /** + * Gets the errors. + * + * The errors encountered during the response. + * + * @return the errors + */ + public List getErrors() { + return errors; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java new file mode 100644 index 00000000000..893d528604c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java @@ -0,0 +1,142 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * assignment target account and type. + */ +public class AssignmentTargetDetails extends GenericModel { + + /** + * Assignment target type. + */ + public interface Type { + /** Account. */ + String ACCOUNT = "Account"; + } + + protected String type; + protected String id; + + /** + * Builder. + */ + public static class Builder { + private String type; + private String id; + + /** + * Instantiates a new Builder from an existing AssignmentTargetDetails instance. + * + * @param assignmentTargetDetails the instance to initialize the Builder with + */ + private Builder(AssignmentTargetDetails assignmentTargetDetails) { + this.type = assignmentTargetDetails.type; + this.id = assignmentTargetDetails.id; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param type the type + * @param id the id + */ + public Builder(String type, String id) { + this.type = type; + this.id = id; + } + + /** + * Builds a AssignmentTargetDetails. + * + * @return the new AssignmentTargetDetails instance + */ + public AssignmentTargetDetails build() { + return new AssignmentTargetDetails(this); + } + + /** + * Set the type. + * + * @param type the type + * @return the AssignmentTargetDetails builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the id. + * + * @param id the id + * @return the AssignmentTargetDetails builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + } + + protected AssignmentTargetDetails() { } + + protected AssignmentTargetDetails(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, + "id cannot be null"); + type = builder.type; + id = builder.id; + } + + /** + * New builder. + * + * @return a AssignmentTargetDetails builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the type. + * + * Assignment target type. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the id. + * + * ID of the target account. + * + * @return the id + */ + public String id() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java new file mode 100644 index 00000000000..b8025e305a9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java @@ -0,0 +1,119 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * policy template details. + */ +public class AssignmentTemplateDetails extends GenericModel { + + protected String id; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String version; + + /** + * Instantiates a new Builder from an existing AssignmentTemplateDetails instance. + * + * @param assignmentTemplateDetails the instance to initialize the Builder with + */ + private Builder(AssignmentTemplateDetails assignmentTemplateDetails) { + this.id = assignmentTemplateDetails.id; + this.version = assignmentTemplateDetails.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a AssignmentTemplateDetails. + * + * @return the new AssignmentTemplateDetails instance + */ + public AssignmentTemplateDetails build() { + return new AssignmentTemplateDetails(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the AssignmentTemplateDetails builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the AssignmentTemplateDetails builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected AssignmentTemplateDetails() { } + + protected AssignmentTemplateDetails(Builder builder) { + id = builder.id; + version = builder.version; + } + + /** + * New builder. + * + * @return a AssignmentTemplateDetails builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * Policy template ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the version. + * + * Policy template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java new file mode 100644 index 00000000000..78291e6c2c5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The commitActionControlTemplate options. + */ +public class CommitActionControlTemplateOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing CommitActionControlTemplateOptions instance. + * + * @param commitActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(CommitActionControlTemplateOptions commitActionControlTemplateOptions) { + this.actionControlTemplateId = commitActionControlTemplateOptions.actionControlTemplateId; + this.version = commitActionControlTemplateOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + * @param version the version + */ + public Builder(String actionControlTemplateId, String version) { + this.actionControlTemplateId = actionControlTemplateId; + this.version = version; + } + + /** + * Builds a CommitActionControlTemplateOptions. + * + * @return the new CommitActionControlTemplateOptions instance + */ + public CommitActionControlTemplateOptions build() { + return new CommitActionControlTemplateOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the CommitActionControlTemplateOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the CommitActionControlTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected CommitActionControlTemplateOptions() { } + + protected CommitActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a CommitActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the version. + * + * The action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java new file mode 100644 index 00000000000..61283194c44 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The commitPolicyTemplate options. + */ +public class CommitPolicyTemplateOptions extends GenericModel { + + protected String policyTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing CommitPolicyTemplateOptions instance. + * + * @param commitPolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(CommitPolicyTemplateOptions commitPolicyTemplateOptions) { + this.policyTemplateId = commitPolicyTemplateOptions.policyTemplateId; + this.version = commitPolicyTemplateOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param version the version + */ + public Builder(String policyTemplateId, String version) { + this.policyTemplateId = policyTemplateId; + this.version = version; + } + + /** + * Builds a CommitPolicyTemplateOptions. + * + * @return the new CommitPolicyTemplateOptions instance + */ + public CommitPolicyTemplateOptions build() { + return new CommitPolicyTemplateOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the CommitPolicyTemplateOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the CommitPolicyTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected CommitPolicyTemplateOptions() { } + + protected CommitPolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + policyTemplateId = builder.policyTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a CommitPolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the version. + * + * The policy template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java new file mode 100644 index 00000000000..7e93c92fb0b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The commitRoleTemplate options. + */ +public class CommitRoleTemplateOptions extends GenericModel { + + protected String roleTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing CommitRoleTemplateOptions instance. + * + * @param commitRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(CommitRoleTemplateOptions commitRoleTemplateOptions) { + this.roleTemplateId = commitRoleTemplateOptions.roleTemplateId; + this.version = commitRoleTemplateOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + * @param version the version + */ + public Builder(String roleTemplateId, String version) { + this.roleTemplateId = roleTemplateId; + this.version = version; + } + + /** + * Builds a CommitRoleTemplateOptions. + * + * @return the new CommitRoleTemplateOptions instance + */ + public CommitRoleTemplateOptions build() { + return new CommitRoleTemplateOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the CommitRoleTemplateOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the CommitRoleTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected CommitRoleTemplateOptions() { } + + protected CommitRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + roleTemplateId = builder.roleTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a CommitRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the version. + * + * The role template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java new file mode 100644 index 00000000000..be0c3d0aa98 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java @@ -0,0 +1,62 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Details of conflicting resource. + */ +public class ConflictsWith extends GenericModel { + + protected String etag; + protected String role; + protected String policy; + + protected ConflictsWith() { } + + /** + * Gets the etag. + * + * The revision number of the resource. + * + * @return the etag + */ + public String getEtag() { + return etag; + } + + /** + * Gets the role. + * + * The conflicting role of ID. + * + * @return the role + */ + public String getRole() { + return role; + } + + /** + * Gets the policy. + * + * The conflicting policy ID. + * + * @return the policy + */ + public String getPolicy() { + return policy; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java new file mode 100644 index 00000000000..15e502ac214 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Specifies the type of access that is granted by the policy. + */ +public class Control extends GenericModel { + + protected Grant grant; + + /** + * Builder. + */ + public static class Builder { + private Grant grant; + + /** + * Instantiates a new Builder from an existing Control instance. + * + * @param control the instance to initialize the Builder with + */ + private Builder(Control control) { + this.grant = control.grant; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param grant the grant + */ + public Builder(Grant grant) { + this.grant = grant; + } + + /** + * Builds a Control. + * + * @return the new Control instance + */ + public Control build() { + return new Control(this); + } + + /** + * Set the grant. + * + * @param grant the grant + * @return the Control builder + */ + public Builder grant(Grant grant) { + this.grant = grant; + return this; + } + } + + protected Control() { } + + protected Control(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.grant, + "grant cannot be null"); + grant = builder.grant; + } + + /** + * New builder. + * + * @return a Control builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the grant. + * + * Permission is granted by the policy. + * + * @return the grant + */ + public Grant grant() { + return grant; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java new file mode 100644 index 00000000000..5055d290c80 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * ControlResponse. + * + * Classes which extend this class: + * - ControlResponseControl + * - ControlResponseControlWithEnrichedRoles + */ +public class ControlResponse extends GenericModel { + + protected Grant grant; + + protected ControlResponse() { } + + /** + * Gets the grant. + * + * Permission is granted by the policy. + * + * @return the grant + */ + public Grant getGrant() { + return grant; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java new file mode 100644 index 00000000000..5934ebf7c76 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java @@ -0,0 +1,24 @@ +/* + * (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_policy_management.v1.model; + +/** + * Specifies the type of access that is granted by the policy. + */ +public class ControlResponseControl extends ControlResponse { + + + protected ControlResponseControl() { } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java new file mode 100644 index 00000000000..8b3c73d73c0 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java @@ -0,0 +1,24 @@ +/* + * (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_policy_management.v1.model; + +/** + * Specifies the type of access that is granted by the policy with additional role information. + */ +public class ControlResponseControlWithEnrichedRoles extends ControlResponse { + + + protected ControlResponseControlWithEnrichedRoles() { } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java new file mode 100644 index 00000000000..1ccd3f8b4dd --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java @@ -0,0 +1,191 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createActionControlTemplateAssignment options. + */ +public class CreateActionControlTemplateAssignmentOptions extends GenericModel { + + protected AssignmentTargetDetails target; + protected List templates; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private AssignmentTargetDetails target; + private List templates; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateActionControlTemplateAssignmentOptions instance. + * + * @param createActionControlTemplateAssignmentOptions the instance to initialize the Builder with + */ + private Builder(CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptions) { + this.target = createActionControlTemplateAssignmentOptions.target; + this.templates = createActionControlTemplateAssignmentOptions.templates; + this.acceptLanguage = createActionControlTemplateAssignmentOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param target the target + * @param templates the templates + */ + public Builder(AssignmentTargetDetails target, List templates) { + this.target = target; + this.templates = templates; + } + + /** + * Builds a CreateActionControlTemplateAssignmentOptions. + * + * @return the new CreateActionControlTemplateAssignmentOptions instance + */ + public CreateActionControlTemplateAssignmentOptions build() { + return new CreateActionControlTemplateAssignmentOptions(this); + } + + /** + * Adds a new element to templates. + * + * @param templates the new element to be added + * @return the CreateActionControlTemplateAssignmentOptions builder + */ + public Builder addTemplates(ActionControlAssignmentTemplate templates) { + com.ibm.cloud.sdk.core.util.Validator.notNull(templates, + "templates cannot be null"); + if (this.templates == null) { + this.templates = new ArrayList(); + } + this.templates.add(templates); + return this; + } + + /** + * Set the target. + * + * @param target the target + * @return the CreateActionControlTemplateAssignmentOptions builder + */ + public Builder target(AssignmentTargetDetails target) { + this.target = target; + return this; + } + + /** + * Set the templates. + * Existing templates will be replaced. + * + * @param templates the templates + * @return the CreateActionControlTemplateAssignmentOptions builder + */ + public Builder templates(List templates) { + this.templates = templates; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateActionControlTemplateAssignmentOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateActionControlTemplateAssignmentOptions() { } + + protected CreateActionControlTemplateAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, + "target cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, + "templates cannot be null"); + target = builder.target; + templates = builder.templates; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateActionControlTemplateAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails target() { + return target; + } + + /** + * Gets the templates. + * + * List of action control template details for action control assignment. + * + * @return the templates + */ + public List templates() { + return templates; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java new file mode 100644 index 00000000000..37594a7a440 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java @@ -0,0 +1,251 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createActionControlTemplate options. + */ +public class CreateActionControlTemplateOptions extends GenericModel { + + protected String name; + protected String accountId; + protected String description; + protected Boolean committed; + protected TemplateActionControl actionControl; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String accountId; + private String description; + private Boolean committed; + private TemplateActionControl actionControl; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateActionControlTemplateOptions instance. + * + * @param createActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(CreateActionControlTemplateOptions createActionControlTemplateOptions) { + this.name = createActionControlTemplateOptions.name; + this.accountId = createActionControlTemplateOptions.accountId; + this.description = createActionControlTemplateOptions.description; + this.committed = createActionControlTemplateOptions.committed; + this.actionControl = createActionControlTemplateOptions.actionControl; + this.acceptLanguage = createActionControlTemplateOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param accountId the accountId + */ + public Builder(String name, String accountId) { + this.name = name; + this.accountId = accountId; + } + + /** + * Builds a CreateActionControlTemplateOptions. + * + * @return the new CreateActionControlTemplateOptions instance + */ + public CreateActionControlTemplateOptions build() { + return new CreateActionControlTemplateOptions(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateActionControlTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreateActionControlTemplateOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateActionControlTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreateActionControlTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + + /** + * Set the actionControl. + * + * @param actionControl the actionControl + * @return the CreateActionControlTemplateOptions builder + */ + public Builder actionControl(TemplateActionControl actionControl) { + this.actionControl = actionControl; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateActionControlTemplateOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateActionControlTemplateOptions() { } + + protected CreateActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + name = builder.name; + accountId = builder.accountId; + description = builder.description; + committed = builder.committed; + actionControl = builder.actionControl; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the description. + * + * Description of the action control template. This is shown to users in the enterprise account. Use this to describe + * the purpose or context of the action control for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template. If committed is set to true, then the template version can no longer be updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } + + /** + * Gets the actionControl. + * + * The action control properties that are created in an action resource when the template is assigned. + * + * @return the actionControl + */ + public TemplateActionControl actionControl() { + return actionControl; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java new file mode 100644 index 00000000000..13ce1a8e60f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java @@ -0,0 +1,211 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createActionControlTemplateVersion options. + */ +public class CreateActionControlTemplateVersionOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String name; + protected String description; + protected TemplateActionControl actionControl; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String name; + private String description; + private TemplateActionControl actionControl; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing CreateActionControlTemplateVersionOptions instance. + * + * @param createActionControlTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptions) { + this.actionControlTemplateId = createActionControlTemplateVersionOptions.actionControlTemplateId; + this.name = createActionControlTemplateVersionOptions.name; + this.description = createActionControlTemplateVersionOptions.description; + this.actionControl = createActionControlTemplateVersionOptions.actionControl; + this.committed = createActionControlTemplateVersionOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + */ + public Builder(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + } + + /** + * Builds a CreateActionControlTemplateVersionOptions. + * + * @return the new CreateActionControlTemplateVersionOptions instance + */ + public CreateActionControlTemplateVersionOptions build() { + return new CreateActionControlTemplateVersionOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actionControl. + * + * @param actionControl the actionControl + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder actionControl(TemplateActionControl actionControl) { + this.actionControl = actionControl; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected CreateActionControlTemplateVersionOptions() { } + + protected CreateActionControlTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + name = builder.name; + description = builder.description; + actionControl = builder.actionControl; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a CreateActionControlTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * The action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will + * change the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the action control template. This is shown to users in the enterprise account. Use this to describe + * the purpose or context of the action control for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actionControl. + * + * The action control properties that are created in an action resource when the template is assigned. + * + * @return the actionControl + */ + public TemplateActionControl actionControl() { + return actionControl; + } + + /** + * Gets the committed. + * + * Committed status of the template version. If committed is set to true, then the template version can no longer be + * updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java new file mode 100644 index 00000000000..b6ec9f78c02 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java @@ -0,0 +1,311 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createPolicy options. + */ +public class CreatePolicyOptions extends GenericModel { + + protected String type; + protected List subjects; + protected List roles; + protected List resources; + protected String description; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String type; + private List subjects; + private List roles; + private List resources; + private String description; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreatePolicyOptions instance. + * + * @param createPolicyOptions the instance to initialize the Builder with + */ + private Builder(CreatePolicyOptions createPolicyOptions) { + this.type = createPolicyOptions.type; + this.subjects = createPolicyOptions.subjects; + this.roles = createPolicyOptions.roles; + this.resources = createPolicyOptions.resources; + this.description = createPolicyOptions.description; + this.acceptLanguage = createPolicyOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param type the type + * @param subjects the subjects + * @param roles the roles + * @param resources the resources + */ + public Builder(String type, List subjects, List roles, List resources) { + this.type = type; + this.subjects = subjects; + this.roles = roles; + this.resources = resources; + } + + /** + * Builds a CreatePolicyOptions. + * + * @return the new CreatePolicyOptions instance + */ + public CreatePolicyOptions build() { + return new CreatePolicyOptions(this); + } + + /** + * Adds a new element to subjects. + * + * @param subjects the new element to be added + * @return the CreatePolicyOptions builder + */ + public Builder addSubjects(PolicySubject subjects) { + com.ibm.cloud.sdk.core.util.Validator.notNull(subjects, + "subjects cannot be null"); + if (this.subjects == null) { + this.subjects = new ArrayList(); + } + this.subjects.add(subjects); + return this; + } + + /** + * Adds a new element to roles. + * + * @param roles the new element to be added + * @return the CreatePolicyOptions builder + */ + public Builder addRoles(PolicyRole roles) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roles, + "roles cannot be null"); + if (this.roles == null) { + this.roles = new ArrayList(); + } + this.roles.add(roles); + return this; + } + + /** + * Adds a new element to resources. + * + * @param resources the new element to be added + * @return the CreatePolicyOptions builder + */ + public Builder addResources(PolicyResource resources) { + com.ibm.cloud.sdk.core.util.Validator.notNull(resources, + "resources cannot be null"); + if (this.resources == null) { + this.resources = new ArrayList(); + } + this.resources.add(resources); + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the CreatePolicyOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the subjects. + * Existing subjects will be replaced. + * + * @param subjects the subjects + * @return the CreatePolicyOptions builder + */ + public Builder subjects(List subjects) { + this.subjects = subjects; + return this; + } + + /** + * Set the roles. + * Existing roles will be replaced. + * + * @param roles the roles + * @return the CreatePolicyOptions builder + */ + public Builder roles(List roles) { + this.roles = roles; + return this; + } + + /** + * Set the resources. + * Existing resources will be replaced. + * + * @param resources the resources + * @return the CreatePolicyOptions builder + */ + public Builder resources(List resources) { + this.resources = resources; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreatePolicyOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreatePolicyOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreatePolicyOptions() { } + + protected CreatePolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subjects, + "subjects cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, + "roles cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resources, + "resources cannot be null"); + type = builder.type; + subjects = builder.subjects; + roles = builder.roles; + resources = builder.resources; + description = builder.description; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreatePolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the subjects. + * + * The subjects associated with a policy. + * + * @return the subjects + */ + public List subjects() { + return subjects; + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List roles() { + return roles; + } + + /** + * Gets the resources. + * + * The resources associated with a policy. + * + * @return the resources + */ + public List resources() { + return resources; + } + + /** + * Gets the description. + * + * Customer-defined description. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java new file mode 100644 index 00000000000..b71ca393f11 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java @@ -0,0 +1,221 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createPolicyTemplateAssignment options. + */ +public class CreatePolicyTemplateAssignmentOptions extends GenericModel { + + protected String version; + protected AssignmentTargetDetails target; + protected List templates; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String version; + private AssignmentTargetDetails target; + private List templates; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreatePolicyTemplateAssignmentOptions instance. + * + * @param createPolicyTemplateAssignmentOptions the instance to initialize the Builder with + */ + private Builder(CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptions) { + this.version = createPolicyTemplateAssignmentOptions.version; + this.target = createPolicyTemplateAssignmentOptions.target; + this.templates = createPolicyTemplateAssignmentOptions.templates; + this.acceptLanguage = createPolicyTemplateAssignmentOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param version the version + * @param target the target + * @param templates the templates + */ + public Builder(String version, AssignmentTargetDetails target, List templates) { + this.version = version; + this.target = target; + this.templates = templates; + } + + /** + * Builds a CreatePolicyTemplateAssignmentOptions. + * + * @return the new CreatePolicyTemplateAssignmentOptions instance + */ + public CreatePolicyTemplateAssignmentOptions build() { + return new CreatePolicyTemplateAssignmentOptions(this); + } + + /** + * Adds a new element to templates. + * + * @param templates the new element to be added + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder addTemplates(AssignmentTemplateDetails templates) { + com.ibm.cloud.sdk.core.util.Validator.notNull(templates, + "templates cannot be null"); + if (this.templates == null) { + this.templates = new ArrayList(); + } + this.templates.add(templates); + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the target. + * + * @param target the target + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder target(AssignmentTargetDetails target) { + this.target = target; + return this; + } + + /** + * Set the templates. + * Existing templates will be replaced. + * + * @param templates the templates + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder templates(List templates) { + this.templates = templates; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreatePolicyTemplateAssignmentOptions() { } + + protected CreatePolicyTemplateAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, + "target cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, + "templates cannot be null"); + version = builder.version; + target = builder.target; + templates = builder.templates; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreatePolicyTemplateAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the version. + * + * specify version of response body format. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails target() { + return target; + } + + /** + * Gets the templates. + * + * List of template details for policy assignment. + * + * @return the templates + */ + public List templates() { + return templates; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java new file mode 100644 index 00000000000..72944308428 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java @@ -0,0 +1,255 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createPolicyTemplate options. + */ +public class CreatePolicyTemplateOptions extends GenericModel { + + protected String name; + protected String accountId; + protected TemplatePolicy policy; + protected String description; + protected Boolean committed; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String accountId; + private TemplatePolicy policy; + private String description; + private Boolean committed; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreatePolicyTemplateOptions instance. + * + * @param createPolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(CreatePolicyTemplateOptions createPolicyTemplateOptions) { + this.name = createPolicyTemplateOptions.name; + this.accountId = createPolicyTemplateOptions.accountId; + this.policy = createPolicyTemplateOptions.policy; + this.description = createPolicyTemplateOptions.description; + this.committed = createPolicyTemplateOptions.committed; + this.acceptLanguage = createPolicyTemplateOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param accountId the accountId + * @param policy the policy + */ + public Builder(String name, String accountId, TemplatePolicy policy) { + this.name = name; + this.accountId = accountId; + this.policy = policy; + } + + /** + * Builds a CreatePolicyTemplateOptions. + * + * @return the new CreatePolicyTemplateOptions instance + */ + public CreatePolicyTemplateOptions build() { + return new CreatePolicyTemplateOptions(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the CreatePolicyTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreatePolicyTemplateOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the policy. + * + * @param policy the policy + * @return the CreatePolicyTemplateOptions builder + */ + public Builder policy(TemplatePolicy policy) { + this.policy = policy; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreatePolicyTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreatePolicyTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreatePolicyTemplateOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreatePolicyTemplateOptions() { } + + protected CreatePolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.policy, + "policy cannot be null"); + name = builder.name; + accountId = builder.accountId; + policy = builder.policy; + description = builder.description; + committed = builder.committed; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreatePolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy policy() { + return policy; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java new file mode 100644 index 00000000000..6903774c335 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java @@ -0,0 +1,214 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createPolicyTemplateVersion options. + */ +public class CreatePolicyTemplateVersionOptions extends GenericModel { + + protected String policyTemplateId; + protected TemplatePolicy policy; + protected String name; + protected String description; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private TemplatePolicy policy; + private String name; + private String description; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing CreatePolicyTemplateVersionOptions instance. + * + * @param createPolicyTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptions) { + this.policyTemplateId = createPolicyTemplateVersionOptions.policyTemplateId; + this.policy = createPolicyTemplateVersionOptions.policy; + this.name = createPolicyTemplateVersionOptions.name; + this.description = createPolicyTemplateVersionOptions.description; + this.committed = createPolicyTemplateVersionOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param policy the policy + */ + public Builder(String policyTemplateId, TemplatePolicy policy) { + this.policyTemplateId = policyTemplateId; + this.policy = policy; + } + + /** + * Builds a CreatePolicyTemplateVersionOptions. + * + * @return the new CreatePolicyTemplateVersionOptions instance + */ + public CreatePolicyTemplateVersionOptions build() { + return new CreatePolicyTemplateVersionOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the policy. + * + * @param policy the policy + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder policy(TemplatePolicy policy) { + this.policy = policy; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected CreatePolicyTemplateVersionOptions() { } + + protected CreatePolicyTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.policy, + "policy cannot be null"); + policyTemplateId = builder.policyTemplateId; + policy = builder.policy; + name = builder.name; + description = builder.description; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a CreatePolicyTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy policy() { + return policy; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template version. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java new file mode 100644 index 00000000000..725ec5d8a53 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java @@ -0,0 +1,308 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createRole options. + */ +public class CreateRoleOptions extends GenericModel { + + protected String displayName; + protected List actions; + protected String name; + protected String accountId; + protected String serviceName; + protected String description; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String displayName; + private List actions; + private String name; + private String accountId; + private String serviceName; + private String description; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateRoleOptions instance. + * + * @param createRoleOptions the instance to initialize the Builder with + */ + private Builder(CreateRoleOptions createRoleOptions) { + this.displayName = createRoleOptions.displayName; + this.actions = createRoleOptions.actions; + this.name = createRoleOptions.name; + this.accountId = createRoleOptions.accountId; + this.serviceName = createRoleOptions.serviceName; + this.description = createRoleOptions.description; + this.acceptLanguage = createRoleOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param displayName the displayName + * @param actions the actions + * @param name the name + * @param accountId the accountId + * @param serviceName the serviceName + */ + public Builder(String displayName, List actions, String name, String accountId, String serviceName) { + this.displayName = displayName; + this.actions = actions; + this.name = name; + this.accountId = accountId; + this.serviceName = serviceName; + } + + /** + * Builds a CreateRoleOptions. + * + * @return the new CreateRoleOptions instance + */ + public CreateRoleOptions build() { + return new CreateRoleOptions(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the CreateRoleOptions builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the CreateRoleOptions builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the CreateRoleOptions builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateRoleOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreateRoleOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the CreateRoleOptions builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateRoleOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateRoleOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateRoleOptions() { } + + protected CreateRoleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, + "serviceName cannot be null"); + displayName = builder.displayName; + actions = builder.actions; + name = builder.name; + accountId = builder.accountId; + serviceName = builder.serviceName; + description = builder.description; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateRoleOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List actions() { + return actions; + } + + /** + * Gets the name. + * + * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the accountId. + * + * The account GUID. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the serviceName. + * + * The service name. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java new file mode 100644 index 00000000000..c9bef88e703 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java @@ -0,0 +1,191 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createRoleTemplateAssignment options. + */ +public class CreateRoleTemplateAssignmentOptions extends GenericModel { + + protected AssignmentTargetDetails target; + protected List templates; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private AssignmentTargetDetails target; + private List templates; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateRoleTemplateAssignmentOptions instance. + * + * @param createRoleTemplateAssignmentOptions the instance to initialize the Builder with + */ + private Builder(CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptions) { + this.target = createRoleTemplateAssignmentOptions.target; + this.templates = createRoleTemplateAssignmentOptions.templates; + this.acceptLanguage = createRoleTemplateAssignmentOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param target the target + * @param templates the templates + */ + public Builder(AssignmentTargetDetails target, List templates) { + this.target = target; + this.templates = templates; + } + + /** + * Builds a CreateRoleTemplateAssignmentOptions. + * + * @return the new CreateRoleTemplateAssignmentOptions instance + */ + public CreateRoleTemplateAssignmentOptions build() { + return new CreateRoleTemplateAssignmentOptions(this); + } + + /** + * Adds a new element to templates. + * + * @param templates the new element to be added + * @return the CreateRoleTemplateAssignmentOptions builder + */ + public Builder addTemplates(RoleAssignmentTemplate templates) { + com.ibm.cloud.sdk.core.util.Validator.notNull(templates, + "templates cannot be null"); + if (this.templates == null) { + this.templates = new ArrayList(); + } + this.templates.add(templates); + return this; + } + + /** + * Set the target. + * + * @param target the target + * @return the CreateRoleTemplateAssignmentOptions builder + */ + public Builder target(AssignmentTargetDetails target) { + this.target = target; + return this; + } + + /** + * Set the templates. + * Existing templates will be replaced. + * + * @param templates the templates + * @return the CreateRoleTemplateAssignmentOptions builder + */ + public Builder templates(List templates) { + this.templates = templates; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateRoleTemplateAssignmentOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateRoleTemplateAssignmentOptions() { } + + protected CreateRoleTemplateAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, + "target cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, + "templates cannot be null"); + target = builder.target; + templates = builder.templates; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateRoleTemplateAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails target() { + return target; + } + + /** + * Gets the templates. + * + * List of role template details for role assignment. + * + * @return the templates + */ + public List templates() { + return templates; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java new file mode 100644 index 00000000000..baf82e17961 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java @@ -0,0 +1,251 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createRoleTemplate options. + */ +public class CreateRoleTemplateOptions extends GenericModel { + + protected String name; + protected String accountId; + protected String description; + protected Boolean committed; + protected RoleTemplatePrototypeRole role; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String accountId; + private String description; + private Boolean committed; + private RoleTemplatePrototypeRole role; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateRoleTemplateOptions instance. + * + * @param createRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(CreateRoleTemplateOptions createRoleTemplateOptions) { + this.name = createRoleTemplateOptions.name; + this.accountId = createRoleTemplateOptions.accountId; + this.description = createRoleTemplateOptions.description; + this.committed = createRoleTemplateOptions.committed; + this.role = createRoleTemplateOptions.role; + this.acceptLanguage = createRoleTemplateOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param accountId the accountId + */ + public Builder(String name, String accountId) { + this.name = name; + this.accountId = accountId; + } + + /** + * Builds a CreateRoleTemplateOptions. + * + * @return the new CreateRoleTemplateOptions instance + */ + public CreateRoleTemplateOptions build() { + return new CreateRoleTemplateOptions(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateRoleTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreateRoleTemplateOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateRoleTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreateRoleTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + + /** + * Set the role. + * + * @param role the role + * @return the CreateRoleTemplateOptions builder + */ + public Builder role(RoleTemplatePrototypeRole role) { + this.role = role; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateRoleTemplateOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateRoleTemplateOptions() { } + + protected CreateRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + name = builder.name; + accountId = builder.accountId; + description = builder.description; + committed = builder.committed; + role = builder.role; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the description. + * + * Description of the role template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the role for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template. If committed is set to true, then the template version can no longer be updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } + + /** + * Gets the role. + * + * The role properties that are created in an action resource when the template is assigned. + * + * @return the role + */ + public RoleTemplatePrototypeRole role() { + return role; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java new file mode 100644 index 00000000000..c322c5a332d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java @@ -0,0 +1,211 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createRoleTemplateVersion options. + */ +public class CreateRoleTemplateVersionOptions extends GenericModel { + + protected String roleTemplateId; + protected String name; + protected String description; + protected TemplateRole role; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String name; + private String description; + private TemplateRole role; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing CreateRoleTemplateVersionOptions instance. + * + * @param createRoleTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(CreateRoleTemplateVersionOptions createRoleTemplateVersionOptions) { + this.roleTemplateId = createRoleTemplateVersionOptions.roleTemplateId; + this.name = createRoleTemplateVersionOptions.name; + this.description = createRoleTemplateVersionOptions.description; + this.role = createRoleTemplateVersionOptions.role; + this.committed = createRoleTemplateVersionOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + */ + public Builder(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + } + + /** + * Builds a CreateRoleTemplateVersionOptions. + * + * @return the new CreateRoleTemplateVersionOptions instance + */ + public CreateRoleTemplateVersionOptions build() { + return new CreateRoleTemplateVersionOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the role. + * + * @param role the role + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder role(TemplateRole role) { + this.role = role; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected CreateRoleTemplateVersionOptions() { } + + protected CreateRoleTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + roleTemplateId = builder.roleTemplateId; + name = builder.name; + description = builder.description; + role = builder.role; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a CreateRoleTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * The role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will + * change the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the role template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the role for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the role. + * + * The role properties that are created in an action resource when the template is assigned. + * + * @return the role + */ + public TemplateRole role() { + return role; + } + + /** + * Gets the committed. + * + * Committed status of the template version. If committed is set to true, then the template version can no longer be + * updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java new file mode 100644 index 00000000000..59ccb4b908a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java @@ -0,0 +1,312 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createV2Policy options. + */ +public class CreateV2PolicyOptions extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + protected Control control; + protected String type; + protected String description; + protected V2PolicySubject subject; + protected V2PolicyResource resource; + protected String pattern; + protected V2PolicyRule rule; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private Control control; + private String type; + private String description; + private V2PolicySubject subject; + private V2PolicyResource resource; + private String pattern; + private V2PolicyRule rule; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateV2PolicyOptions instance. + * + * @param createV2PolicyOptions the instance to initialize the Builder with + */ + private Builder(CreateV2PolicyOptions createV2PolicyOptions) { + this.control = createV2PolicyOptions.control; + this.type = createV2PolicyOptions.type; + this.description = createV2PolicyOptions.description; + this.subject = createV2PolicyOptions.subject; + this.resource = createV2PolicyOptions.resource; + this.pattern = createV2PolicyOptions.pattern; + this.rule = createV2PolicyOptions.rule; + this.acceptLanguage = createV2PolicyOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param control the control + * @param type the type + */ + public Builder(Control control, String type) { + this.control = control; + this.type = type; + } + + /** + * Builds a CreateV2PolicyOptions. + * + * @return the new CreateV2PolicyOptions instance + */ + public CreateV2PolicyOptions build() { + return new CreateV2PolicyOptions(this); + } + + /** + * Set the control. + * + * @param control the control + * @return the CreateV2PolicyOptions builder + */ + public Builder control(Control control) { + this.control = control; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the CreateV2PolicyOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateV2PolicyOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the subject. + * + * @param subject the subject + * @return the CreateV2PolicyOptions builder + */ + public Builder subject(V2PolicySubject subject) { + this.subject = subject; + return this; + } + + /** + * Set the resource. + * + * @param resource the resource + * @return the CreateV2PolicyOptions builder + */ + public Builder resource(V2PolicyResource resource) { + this.resource = resource; + return this; + } + + /** + * Set the pattern. + * + * @param pattern the pattern + * @return the CreateV2PolicyOptions builder + */ + public Builder pattern(String pattern) { + this.pattern = pattern; + return this; + } + + /** + * Set the rule. + * + * @param rule the rule + * @return the CreateV2PolicyOptions builder + */ + public Builder rule(V2PolicyRule rule) { + this.rule = rule; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateV2PolicyOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateV2PolicyOptions() { } + + protected CreateV2PolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.control, + "control cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + control = builder.control; + type = builder.type; + description = builder.description; + subject = builder.subject; + resource = builder.resource; + pattern = builder.pattern; + rule = builder.rule; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateV2PolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the control. + * + * Specifies the type of access that is granted by the policy. + * + * @return the control + */ + public Control control() { + return control; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject subject() { + return subject; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource resource() { + return resource; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String pattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule rule() { + return rule; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java new file mode 100644 index 00000000000..f5e35c13d9f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java @@ -0,0 +1,195 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * An additional set of properties associated with a role. + */ +public class CustomRole extends GenericModel { + + protected String id; + @SerializedName("display_name") + protected String displayName; + protected String description; + protected List actions; + protected String crn; + protected String name; + @SerializedName("account_id") + protected String accountId; + @SerializedName("service_name") + protected String serviceName; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String href; + + protected CustomRole() { } + + /** + * Gets the id. + * + * The role ID. Composed of hexadecimal characters. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String getDisplayName() { + return displayName; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List getActions() { + return actions; + } + + /** + * Gets the crn. + * + * The role Cloud Resource Name (CRN). Example CRN: + * 'crn:v1:ibmcloud:public:iam-access-management::a/exampleAccountId::customRole:ExampleRoleName'. + * + * @return the crn + */ + public String getCrn() { + return crn; + } + + /** + * Gets the name. + * + * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the accountId. + * + * The account GUID. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the serviceName. + * + * The service name. + * + * @return the serviceName + */ + public String getServiceName() { + return serviceName; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the role was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the role. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the role was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the href. + * + * The href links back to the role. + * + * @return the href + */ + public String getHref() { + return href; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java new file mode 100644 index 00000000000..f71d2c2ab9d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteActionControlAssignment options. + */ +public class DeleteActionControlAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing DeleteActionControlAssignmentOptions instance. + * + * @param deleteActionControlAssignmentOptions the instance to initialize the Builder with + */ + private Builder(DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptions) { + this.assignmentId = deleteActionControlAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a DeleteActionControlAssignmentOptions. + * + * @return the new DeleteActionControlAssignmentOptions instance + */ + public DeleteActionControlAssignmentOptions build() { + return new DeleteActionControlAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the DeleteActionControlAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected DeleteActionControlAssignmentOptions() { } + + protected DeleteActionControlAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a DeleteActionControlAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Action control template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java new file mode 100644 index 00000000000..6ff35d83603 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteActionControlTemplate options. + */ +public class DeleteActionControlTemplateOptions extends GenericModel { + + protected String actionControlTemplateId; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + + /** + * Instantiates a new Builder from an existing DeleteActionControlTemplateOptions instance. + * + * @param deleteActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(DeleteActionControlTemplateOptions deleteActionControlTemplateOptions) { + this.actionControlTemplateId = deleteActionControlTemplateOptions.actionControlTemplateId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + */ + public Builder(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + } + + /** + * Builds a DeleteActionControlTemplateOptions. + * + * @return the new DeleteActionControlTemplateOptions instance + */ + public DeleteActionControlTemplateOptions build() { + return new DeleteActionControlTemplateOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the DeleteActionControlTemplateOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + } + + protected DeleteActionControlTemplateOptions() { } + + protected DeleteActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + } + + /** + * New builder. + * + * @return a DeleteActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java new file mode 100644 index 00000000000..69aca0555a1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteActionControlTemplateVersion options. + */ +public class DeleteActionControlTemplateVersionOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing DeleteActionControlTemplateVersionOptions instance. + * + * @param deleteActionControlTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptions) { + this.actionControlTemplateId = deleteActionControlTemplateVersionOptions.actionControlTemplateId; + this.version = deleteActionControlTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + * @param version the version + */ + public Builder(String actionControlTemplateId, String version) { + this.actionControlTemplateId = actionControlTemplateId; + this.version = version; + } + + /** + * Builds a DeleteActionControlTemplateVersionOptions. + * + * @return the new DeleteActionControlTemplateVersionOptions instance + */ + public DeleteActionControlTemplateVersionOptions build() { + return new DeleteActionControlTemplateVersionOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the DeleteActionControlTemplateVersionOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the DeleteActionControlTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected DeleteActionControlTemplateVersionOptions() { } + + protected DeleteActionControlTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a DeleteActionControlTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java new file mode 100644 index 00000000000..3ab2cf17469 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deletePolicyAssignment options. + */ +public class DeletePolicyAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing DeletePolicyAssignmentOptions instance. + * + * @param deletePolicyAssignmentOptions the instance to initialize the Builder with + */ + private Builder(DeletePolicyAssignmentOptions deletePolicyAssignmentOptions) { + this.assignmentId = deletePolicyAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a DeletePolicyAssignmentOptions. + * + * @return the new DeletePolicyAssignmentOptions instance + */ + public DeletePolicyAssignmentOptions build() { + return new DeletePolicyAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the DeletePolicyAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected DeletePolicyAssignmentOptions() { } + + protected DeletePolicyAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a DeletePolicyAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * The policy template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java new file mode 100644 index 00000000000..fe070b2064a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deletePolicy options. + */ +public class DeletePolicyOptions extends GenericModel { + + protected String policyId; + + /** + * Builder. + */ + public static class Builder { + private String policyId; + + /** + * Instantiates a new Builder from an existing DeletePolicyOptions instance. + * + * @param deletePolicyOptions the instance to initialize the Builder with + */ + private Builder(DeletePolicyOptions deletePolicyOptions) { + this.policyId = deletePolicyOptions.policyId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyId the policyId + */ + public Builder(String policyId) { + this.policyId = policyId; + } + + /** + * Builds a DeletePolicyOptions. + * + * @return the new DeletePolicyOptions instance + */ + public DeletePolicyOptions build() { + return new DeletePolicyOptions(this); + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the DeletePolicyOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + } + + protected DeletePolicyOptions() { } + + protected DeletePolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId cannot be empty"); + policyId = builder.policyId; + } + + /** + * New builder. + * + * @return a DeletePolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyId. + * + * The policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java new file mode 100644 index 00000000000..bb70b0d6727 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deletePolicyTemplate options. + */ +public class DeletePolicyTemplateOptions extends GenericModel { + + protected String policyTemplateId; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + + /** + * Instantiates a new Builder from an existing DeletePolicyTemplateOptions instance. + * + * @param deletePolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(DeletePolicyTemplateOptions deletePolicyTemplateOptions) { + this.policyTemplateId = deletePolicyTemplateOptions.policyTemplateId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + */ + public Builder(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + } + + /** + * Builds a DeletePolicyTemplateOptions. + * + * @return the new DeletePolicyTemplateOptions instance + */ + public DeletePolicyTemplateOptions build() { + return new DeletePolicyTemplateOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the DeletePolicyTemplateOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + } + + protected DeletePolicyTemplateOptions() { } + + protected DeletePolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + policyTemplateId = builder.policyTemplateId; + } + + /** + * New builder. + * + * @return a DeletePolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java new file mode 100644 index 00000000000..9a04a5157b6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deletePolicyTemplateVersion options. + */ +public class DeletePolicyTemplateVersionOptions extends GenericModel { + + protected String policyTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing DeletePolicyTemplateVersionOptions instance. + * + * @param deletePolicyTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptions) { + this.policyTemplateId = deletePolicyTemplateVersionOptions.policyTemplateId; + this.version = deletePolicyTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param version the version + */ + public Builder(String policyTemplateId, String version) { + this.policyTemplateId = policyTemplateId; + this.version = version; + } + + /** + * Builds a DeletePolicyTemplateVersionOptions. + * + * @return the new DeletePolicyTemplateVersionOptions instance + */ + public DeletePolicyTemplateVersionOptions build() { + return new DeletePolicyTemplateVersionOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the DeletePolicyTemplateVersionOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the DeletePolicyTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected DeletePolicyTemplateVersionOptions() { } + + protected DeletePolicyTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + policyTemplateId = builder.policyTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a DeletePolicyTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the version. + * + * The policy template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java new file mode 100644 index 00000000000..b9341a9f414 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteRoleAssignment options. + */ +public class DeleteRoleAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing DeleteRoleAssignmentOptions instance. + * + * @param deleteRoleAssignmentOptions the instance to initialize the Builder with + */ + private Builder(DeleteRoleAssignmentOptions deleteRoleAssignmentOptions) { + this.assignmentId = deleteRoleAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a DeleteRoleAssignmentOptions. + * + * @return the new DeleteRoleAssignmentOptions instance + */ + public DeleteRoleAssignmentOptions build() { + return new DeleteRoleAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the DeleteRoleAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected DeleteRoleAssignmentOptions() { } + + protected DeleteRoleAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a DeleteRoleAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Role template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java new file mode 100644 index 00000000000..8675777719e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteRole options. + */ +public class DeleteRoleOptions extends GenericModel { + + protected String roleId; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + + /** + * Instantiates a new Builder from an existing DeleteRoleOptions instance. + * + * @param deleteRoleOptions the instance to initialize the Builder with + */ + private Builder(DeleteRoleOptions deleteRoleOptions) { + this.roleId = deleteRoleOptions.roleId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + */ + public Builder(String roleId) { + this.roleId = roleId; + } + + /** + * Builds a DeleteRoleOptions. + * + * @return the new DeleteRoleOptions instance + */ + public DeleteRoleOptions build() { + return new DeleteRoleOptions(this); + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the DeleteRoleOptions builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + } + + protected DeleteRoleOptions() { } + + protected DeleteRoleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, + "roleId cannot be empty"); + roleId = builder.roleId; + } + + /** + * New builder. + * + * @return a DeleteRoleOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role ID. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java new file mode 100644 index 00000000000..c76bf3bfda4 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteRoleTemplate options. + */ +public class DeleteRoleTemplateOptions extends GenericModel { + + protected String roleTemplateId; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + + /** + * Instantiates a new Builder from an existing DeleteRoleTemplateOptions instance. + * + * @param deleteRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(DeleteRoleTemplateOptions deleteRoleTemplateOptions) { + this.roleTemplateId = deleteRoleTemplateOptions.roleTemplateId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + */ + public Builder(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + } + + /** + * Builds a DeleteRoleTemplateOptions. + * + * @return the new DeleteRoleTemplateOptions instance + */ + public DeleteRoleTemplateOptions build() { + return new DeleteRoleTemplateOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the DeleteRoleTemplateOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + } + + protected DeleteRoleTemplateOptions() { } + + protected DeleteRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + roleTemplateId = builder.roleTemplateId; + } + + /** + * New builder. + * + * @return a DeleteRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java new file mode 100644 index 00000000000..9f974213165 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteRoleTemplateVersion options. + */ +public class DeleteRoleTemplateVersionOptions extends GenericModel { + + protected String roleTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing DeleteRoleTemplateVersionOptions instance. + * + * @param deleteRoleTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptions) { + this.roleTemplateId = deleteRoleTemplateVersionOptions.roleTemplateId; + this.version = deleteRoleTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + * @param version the version + */ + public Builder(String roleTemplateId, String version) { + this.roleTemplateId = roleTemplateId; + this.version = version; + } + + /** + * Builds a DeleteRoleTemplateVersionOptions. + * + * @return the new DeleteRoleTemplateVersionOptions instance + */ + public DeleteRoleTemplateVersionOptions build() { + return new DeleteRoleTemplateVersionOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the DeleteRoleTemplateVersionOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the DeleteRoleTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected DeleteRoleTemplateVersionOptions() { } + + protected DeleteRoleTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + roleTemplateId = builder.roleTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a DeleteRoleTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the version. + * + * Role template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java new file mode 100644 index 00000000000..92c1caaa34c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteV2Policy options. + */ +public class DeleteV2PolicyOptions extends GenericModel { + + protected String id; + + /** + * Builder. + */ + public static class Builder { + private String id; + + /** + * Instantiates a new Builder from an existing DeleteV2PolicyOptions instance. + * + * @param deleteV2PolicyOptions the instance to initialize the Builder with + */ + private Builder(DeleteV2PolicyOptions deleteV2PolicyOptions) { + this.id = deleteV2PolicyOptions.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 DeleteV2PolicyOptions. + * + * @return the new DeleteV2PolicyOptions instance + */ + public DeleteV2PolicyOptions build() { + return new DeleteV2PolicyOptions(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the DeleteV2PolicyOptions builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + } + + protected DeleteV2PolicyOptions() { } + + protected DeleteV2PolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, + "id cannot be empty"); + id = builder.id; + } + + /** + * New builder. + * + * @return a DeleteV2PolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String id() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java new file mode 100644 index 00000000000..0978eb1040b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java @@ -0,0 +1,81 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role associated with a policy with additional information (display_name, description, actions) when + * `format=display`. + */ +public class EnrichedRoles extends GenericModel { + + @SerializedName("role_id") + protected String roleId; + @SerializedName("display_name") + protected String displayName; + protected String description; + protected List actions; + + protected EnrichedRoles() { } + + /** + * Gets the roleId. + * + * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. + * + * @return the roleId + */ + public String getRoleId() { + return roleId; + } + + /** + * Gets the displayName. + * + * The display name of the role, either service-defined or user-defined for custom roles. + * + * @return the displayName + */ + public String getDisplayName() { + return displayName; + } + + /** + * Gets the description. + * + * The role description, either service-defined or user-defined for custom roles. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List getActions() { + return actions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java new file mode 100644 index 00000000000..e99ea48f5f6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Additional error details. + */ +public class ErrorDetails extends GenericModel { + + @SerializedName("conflicts_with") + protected ConflictsWith conflictsWith; + + protected ErrorDetails() { } + + /** + * Gets the conflictsWith. + * + * Details of conflicting resource. + * + * @return the conflictsWith + */ + public ConflictsWith getConflictsWith() { + return conflictsWith; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java new file mode 100644 index 00000000000..b5411a7bb36 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java @@ -0,0 +1,128 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * ErrorObject. + */ +public class ErrorObject extends GenericModel { + + /** + * The API error code for the error. + */ + public interface Code { + /** insufficent_permissions. */ + String INSUFFICENT_PERMISSIONS = "insufficent_permissions"; + /** invalid_body. */ + String INVALID_BODY = "invalid_body"; + /** invalid_token. */ + String INVALID_TOKEN = "invalid_token"; + /** missing_required_query_parameter. */ + String MISSING_REQUIRED_QUERY_PARAMETER = "missing_required_query_parameter"; + /** not_found. */ + String NOT_FOUND = "not_found"; + /** policy_conflict_error. */ + String POLICY_CONFLICT_ERROR = "policy_conflict_error"; + /** policy_not_found. */ + String POLICY_NOT_FOUND = "policy_not_found"; + /** request_not_processed. */ + String REQUEST_NOT_PROCESSED = "request_not_processed"; + /** role_conflict_error. */ + String ROLE_CONFLICT_ERROR = "role_conflict_error"; + /** role_not_found. */ + String ROLE_NOT_FOUND = "role_not_found"; + /** too_many_requests. */ + String TOO_MANY_REQUESTS = "too_many_requests"; + /** unable_to_process. */ + String UNABLE_TO_PROCESS = "unable_to_process"; + /** unsupported_content_type. */ + String UNSUPPORTED_CONTENT_TYPE = "unsupported_content_type"; + /** policy_template_conflict_error. */ + String POLICY_TEMPLATE_CONFLICT_ERROR = "policy_template_conflict_error"; + /** policy_template_not_found. */ + String POLICY_TEMPLATE_NOT_FOUND = "policy_template_not_found"; + /** policy_assignment_not_found. */ + String POLICY_ASSIGNMENT_NOT_FOUND = "policy_assignment_not_found"; + /** policy_assignment_conflict_error. */ + String POLICY_ASSIGNMENT_CONFLICT_ERROR = "policy_assignment_conflict_error"; + /** resource_not_found. */ + String RESOURCE_NOT_FOUND = "resource_not_found"; + /** action_control_template_not_found. */ + String ACTION_CONTROL_TEMPLATE_NOT_FOUND = "action_control_template_not_found"; + /** action_control_assignment_not_found. */ + String ACTION_CONTROL_ASSIGNMENT_NOT_FOUND = "action_control_assignment_not_found"; + /** role_template_conflict_error. */ + String ROLE_TEMPLATE_CONFLICT_ERROR = "role_template_conflict_error"; + /** role_template_not_found. */ + String ROLE_TEMPLATE_NOT_FOUND = "role_template_not_found"; + /** role_assignment_not_found. */ + String ROLE_ASSIGNMENT_NOT_FOUND = "role_assignment_not_found"; + } + + protected String code; + protected String message; + protected ErrorDetails details; + @SerializedName("more_info") + protected String moreInfo; + + protected ErrorObject() { } + + /** + * Gets the code. + * + * The API error code for the error. + * + * @return the code + */ + public String getCode() { + return code; + } + + /** + * Gets the message. + * + * The error message returned by the API. + * + * @return the message + */ + public String getMessage() { + return message; + } + + /** + * Gets the details. + * + * Additional error details. + * + * @return the details + */ + public ErrorDetails getDetails() { + return details; + } + + /** + * Gets the moreInfo. + * + * Additional info for error. + * + * @return the moreInfo + */ + public String getMoreInfo() { + return moreInfo; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java new file mode 100644 index 00000000000..5c1c9a9fad6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * How external accounts can interact in relation to the requested account. + */ +public class ExternalAccountIdentityInteraction extends GenericModel { + + @SerializedName("identity_types") + protected IdentityTypes identityTypes; + + protected ExternalAccountIdentityInteraction() { } + + /** + * Gets the identityTypes. + * + * The settings for each identity type. + * + * @return the identityTypes + */ + public IdentityTypes getIdentityTypes() { + return identityTypes; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java new file mode 100644 index 00000000000..1efd0673e9d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java @@ -0,0 +1,95 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Update to how external accounts can interact in relation to the requested account. + */ +public class ExternalAccountIdentityInteractionPatch extends GenericModel { + + @SerializedName("identity_types") + protected IdentityTypesPatch identityTypes; + + /** + * Builder. + */ + public static class Builder { + private IdentityTypesPatch identityTypes; + + /** + * Instantiates a new Builder from an existing ExternalAccountIdentityInteractionPatch instance. + * + * @param externalAccountIdentityInteractionPatch the instance to initialize the Builder with + */ + private Builder(ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatch) { + this.identityTypes = externalAccountIdentityInteractionPatch.identityTypes; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ExternalAccountIdentityInteractionPatch. + * + * @return the new ExternalAccountIdentityInteractionPatch instance + */ + public ExternalAccountIdentityInteractionPatch build() { + return new ExternalAccountIdentityInteractionPatch(this); + } + + /** + * Set the identityTypes. + * + * @param identityTypes the identityTypes + * @return the ExternalAccountIdentityInteractionPatch builder + */ + public Builder identityTypes(IdentityTypesPatch identityTypes) { + this.identityTypes = identityTypes; + return this; + } + } + + protected ExternalAccountIdentityInteractionPatch() { } + + protected ExternalAccountIdentityInteractionPatch(Builder builder) { + identityTypes = builder.identityTypes; + } + + /** + * New builder. + * + * @return a ExternalAccountIdentityInteractionPatch builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the identityTypes. + * + * The settings to apply for each identity type for a request. + * + * @return the identityTypes + */ + public IdentityTypesPatch identityTypes() { + return identityTypes; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java new file mode 100644 index 00000000000..83cd67d33c9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Details with linking href to first page of requested collection. + */ +public class First extends GenericModel { + + protected String href; + + protected First() { } + + /** + * Gets the href. + * + * The href linking to the page of requested collection. + * + * @return the href + */ + public String getHref() { + return href; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java new file mode 100644 index 00000000000..f87e7d741a4 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getActionControlAssignment options. + */ +public class GetActionControlAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing GetActionControlAssignmentOptions instance. + * + * @param getActionControlAssignmentOptions the instance to initialize the Builder with + */ + private Builder(GetActionControlAssignmentOptions getActionControlAssignmentOptions) { + this.assignmentId = getActionControlAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a GetActionControlAssignmentOptions. + * + * @return the new GetActionControlAssignmentOptions instance + */ + public GetActionControlAssignmentOptions build() { + return new GetActionControlAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the GetActionControlAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected GetActionControlAssignmentOptions() { } + + protected GetActionControlAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a GetActionControlAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Action control template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java new file mode 100644 index 00000000000..963c68e8876 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java @@ -0,0 +1,140 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getActionControlTemplate options. + */ +public class GetActionControlTemplateOptions extends GenericModel { + + /** + * The action control template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String actionControlTemplateId; + protected String state; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String state; + + /** + * Instantiates a new Builder from an existing GetActionControlTemplateOptions instance. + * + * @param getActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(GetActionControlTemplateOptions getActionControlTemplateOptions) { + this.actionControlTemplateId = getActionControlTemplateOptions.actionControlTemplateId; + this.state = getActionControlTemplateOptions.state; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + */ + public Builder(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + } + + /** + * Builds a GetActionControlTemplateOptions. + * + * @return the new GetActionControlTemplateOptions instance + */ + public GetActionControlTemplateOptions build() { + return new GetActionControlTemplateOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the GetActionControlTemplateOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the GetActionControlTemplateOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + } + + protected GetActionControlTemplateOptions() { } + + protected GetActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + state = builder.state; + } + + /** + * New builder. + * + * @return a GetActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the state. + * + * The action control template state. + * + * @return the state + */ + public String state() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java new file mode 100644 index 00000000000..95bc94950bb --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getActionControlTemplateVersion options. + */ +public class GetActionControlTemplateVersionOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing GetActionControlTemplateVersionOptions instance. + * + * @param getActionControlTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptions) { + this.actionControlTemplateId = getActionControlTemplateVersionOptions.actionControlTemplateId; + this.version = getActionControlTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + * @param version the version + */ + public Builder(String actionControlTemplateId, String version) { + this.actionControlTemplateId = actionControlTemplateId; + this.version = version; + } + + /** + * Builds a GetActionControlTemplateVersionOptions. + * + * @return the new GetActionControlTemplateVersionOptions instance + */ + public GetActionControlTemplateVersionOptions build() { + return new GetActionControlTemplateVersionOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the GetActionControlTemplateVersionOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the GetActionControlTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected GetActionControlTemplateVersionOptions() { } + + protected GetActionControlTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a GetActionControlTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java new file mode 100644 index 00000000000..d1c7c359003 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getPolicyAssignment options. + */ +public class GetPolicyAssignmentOptions extends GenericModel { + + protected String assignmentId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + private String version; + + /** + * Instantiates a new Builder from an existing GetPolicyAssignmentOptions instance. + * + * @param getPolicyAssignmentOptions the instance to initialize the Builder with + */ + private Builder(GetPolicyAssignmentOptions getPolicyAssignmentOptions) { + this.assignmentId = getPolicyAssignmentOptions.assignmentId; + this.version = getPolicyAssignmentOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + * @param version the version + */ + public Builder(String assignmentId, String version) { + this.assignmentId = assignmentId; + this.version = version; + } + + /** + * Builds a GetPolicyAssignmentOptions. + * + * @return the new GetPolicyAssignmentOptions instance + */ + public GetPolicyAssignmentOptions build() { + return new GetPolicyAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the GetPolicyAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the GetPolicyAssignmentOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected GetPolicyAssignmentOptions() { } + + protected GetPolicyAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + assignmentId = builder.assignmentId; + version = builder.version; + } + + /** + * New builder. + * + * @return a GetPolicyAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * The policy template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } + + /** + * Gets the version. + * + * specify version of response body format. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java new file mode 100644 index 00000000000..e780ac06896 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getPolicy options. + */ +public class GetPolicyOptions extends GenericModel { + + protected String policyId; + + /** + * Builder. + */ + public static class Builder { + private String policyId; + + /** + * Instantiates a new Builder from an existing GetPolicyOptions instance. + * + * @param getPolicyOptions the instance to initialize the Builder with + */ + private Builder(GetPolicyOptions getPolicyOptions) { + this.policyId = getPolicyOptions.policyId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyId the policyId + */ + public Builder(String policyId) { + this.policyId = policyId; + } + + /** + * Builds a GetPolicyOptions. + * + * @return the new GetPolicyOptions instance + */ + public GetPolicyOptions build() { + return new GetPolicyOptions(this); + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the GetPolicyOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + } + + protected GetPolicyOptions() { } + + protected GetPolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId cannot be empty"); + policyId = builder.policyId; + } + + /** + * New builder. + * + * @return a GetPolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyId. + * + * The policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java new file mode 100644 index 00000000000..ee604554a85 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java @@ -0,0 +1,140 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getPolicyTemplate options. + */ +public class GetPolicyTemplateOptions extends GenericModel { + + /** + * The policy template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String policyTemplateId; + protected String state; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String state; + + /** + * Instantiates a new Builder from an existing GetPolicyTemplateOptions instance. + * + * @param getPolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(GetPolicyTemplateOptions getPolicyTemplateOptions) { + this.policyTemplateId = getPolicyTemplateOptions.policyTemplateId; + this.state = getPolicyTemplateOptions.state; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + */ + public Builder(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + } + + /** + * Builds a GetPolicyTemplateOptions. + * + * @return the new GetPolicyTemplateOptions instance + */ + public GetPolicyTemplateOptions build() { + return new GetPolicyTemplateOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the GetPolicyTemplateOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the GetPolicyTemplateOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + } + + protected GetPolicyTemplateOptions() { } + + protected GetPolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + policyTemplateId = builder.policyTemplateId; + state = builder.state; + } + + /** + * New builder. + * + * @return a GetPolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the state. + * + * The policy template state. + * + * @return the state + */ + public String state() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java new file mode 100644 index 00000000000..8741f83357d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getPolicyTemplateVersion options. + */ +public class GetPolicyTemplateVersionOptions extends GenericModel { + + protected String policyTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing GetPolicyTemplateVersionOptions instance. + * + * @param getPolicyTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptions) { + this.policyTemplateId = getPolicyTemplateVersionOptions.policyTemplateId; + this.version = getPolicyTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param version the version + */ + public Builder(String policyTemplateId, String version) { + this.policyTemplateId = policyTemplateId; + this.version = version; + } + + /** + * Builds a GetPolicyTemplateVersionOptions. + * + * @return the new GetPolicyTemplateVersionOptions instance + */ + public GetPolicyTemplateVersionOptions build() { + return new GetPolicyTemplateVersionOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the GetPolicyTemplateVersionOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the GetPolicyTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected GetPolicyTemplateVersionOptions() { } + + protected GetPolicyTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + policyTemplateId = builder.policyTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a GetPolicyTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the version. + * + * The policy template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java new file mode 100644 index 00000000000..35313b9b746 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getRoleAssignment options. + */ +public class GetRoleAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing GetRoleAssignmentOptions instance. + * + * @param getRoleAssignmentOptions the instance to initialize the Builder with + */ + private Builder(GetRoleAssignmentOptions getRoleAssignmentOptions) { + this.assignmentId = getRoleAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a GetRoleAssignmentOptions. + * + * @return the new GetRoleAssignmentOptions instance + */ + public GetRoleAssignmentOptions build() { + return new GetRoleAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the GetRoleAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected GetRoleAssignmentOptions() { } + + protected GetRoleAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a GetRoleAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Role template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java new file mode 100644 index 00000000000..8c56ac7f58a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getRole options. + */ +public class GetRoleOptions extends GenericModel { + + protected String roleId; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + + /** + * Instantiates a new Builder from an existing GetRoleOptions instance. + * + * @param getRoleOptions the instance to initialize the Builder with + */ + private Builder(GetRoleOptions getRoleOptions) { + this.roleId = getRoleOptions.roleId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + */ + public Builder(String roleId) { + this.roleId = roleId; + } + + /** + * Builds a GetRoleOptions. + * + * @return the new GetRoleOptions instance + */ + public GetRoleOptions build() { + return new GetRoleOptions(this); + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the GetRoleOptions builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + } + + protected GetRoleOptions() { } + + protected GetRoleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, + "roleId cannot be empty"); + roleId = builder.roleId; + } + + /** + * New builder. + * + * @return a GetRoleOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role ID. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java new file mode 100644 index 00000000000..e33fcf29b32 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java @@ -0,0 +1,140 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getRoleTemplate options. + */ +public class GetRoleTemplateOptions extends GenericModel { + + /** + * The role template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String roleTemplateId; + protected String state; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String state; + + /** + * Instantiates a new Builder from an existing GetRoleTemplateOptions instance. + * + * @param getRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(GetRoleTemplateOptions getRoleTemplateOptions) { + this.roleTemplateId = getRoleTemplateOptions.roleTemplateId; + this.state = getRoleTemplateOptions.state; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + */ + public Builder(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + } + + /** + * Builds a GetRoleTemplateOptions. + * + * @return the new GetRoleTemplateOptions instance + */ + public GetRoleTemplateOptions build() { + return new GetRoleTemplateOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the GetRoleTemplateOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the GetRoleTemplateOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + } + + protected GetRoleTemplateOptions() { } + + protected GetRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + roleTemplateId = builder.roleTemplateId; + state = builder.state; + } + + /** + * New builder. + * + * @return a GetRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the state. + * + * The role template state. + * + * @return the state + */ + public String state() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java new file mode 100644 index 00000000000..4757484f969 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getRoleTemplateVersion options. + */ +public class GetRoleTemplateVersionOptions extends GenericModel { + + protected String roleTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing GetRoleTemplateVersionOptions instance. + * + * @param getRoleTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(GetRoleTemplateVersionOptions getRoleTemplateVersionOptions) { + this.roleTemplateId = getRoleTemplateVersionOptions.roleTemplateId; + this.version = getRoleTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + * @param version the version + */ + public Builder(String roleTemplateId, String version) { + this.roleTemplateId = roleTemplateId; + this.version = version; + } + + /** + * Builds a GetRoleTemplateVersionOptions. + * + * @return the new GetRoleTemplateVersionOptions instance + */ + public GetRoleTemplateVersionOptions build() { + return new GetRoleTemplateVersionOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the GetRoleTemplateVersionOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the GetRoleTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected GetRoleTemplateVersionOptions() { } + + protected GetRoleTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + roleTemplateId = builder.roleTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a GetRoleTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the version. + * + * Role template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java new file mode 100644 index 00000000000..ebc88bbf45c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getSettings options. + */ +public class GetSettingsOptions extends GenericModel { + + protected String accountId; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing GetSettingsOptions instance. + * + * @param getSettingsOptions the instance to initialize the Builder with + */ + private Builder(GetSettingsOptions getSettingsOptions) { + this.accountId = getSettingsOptions.accountId; + this.acceptLanguage = getSettingsOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a GetSettingsOptions. + * + * @return the new GetSettingsOptions instance + */ + public GetSettingsOptions build() { + return new GetSettingsOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the GetSettingsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the GetSettingsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected GetSettingsOptions() { } + + protected GetSettingsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.accountId, + "accountId cannot be empty"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a GetSettingsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the settings belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java new file mode 100644 index 00000000000..23a950cc815 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java @@ -0,0 +1,148 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getV2Policy options. + */ +public class GetV2PolicyOptions extends GenericModel { + + /** + * Include additional data for policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles and translations for all + * relevant fields. + */ + public interface Format { + /** include_last_permit. */ + String INCLUDE_LAST_PERMIT = "include_last_permit"; + /** display. */ + String DISPLAY = "display"; + } + + protected String id; + protected String format; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String format; + + /** + * Instantiates a new Builder from an existing GetV2PolicyOptions instance. + * + * @param getV2PolicyOptions the instance to initialize the Builder with + */ + private Builder(GetV2PolicyOptions getV2PolicyOptions) { + this.id = getV2PolicyOptions.id; + this.format = getV2PolicyOptions.format; + } + + /** + * 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 GetV2PolicyOptions. + * + * @return the new GetV2PolicyOptions instance + */ + public GetV2PolicyOptions build() { + return new GetV2PolicyOptions(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the GetV2PolicyOptions builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the format. + * + * @param format the format + * @return the GetV2PolicyOptions builder + */ + public Builder format(String format) { + this.format = format; + return this; + } + } + + protected GetV2PolicyOptions() { } + + protected GetV2PolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, + "id cannot be empty"); + id = builder.id; + format = builder.format; + } + + /** + * New builder. + * + * @return a GetV2PolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the format. + * + * Include additional data for policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles and translations for all + * relevant fields. + * + * @return the format + */ + public String format() { + return format; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java new file mode 100644 index 00000000000..d8439c9d6f7 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java @@ -0,0 +1,124 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Permission is granted by the policy. + */ +public class Grant extends GenericModel { + + protected List roles; + + /** + * Builder. + */ + public static class Builder { + private List roles; + + /** + * Instantiates a new Builder from an existing Grant instance. + * + * @param grant the instance to initialize the Builder with + */ + private Builder(Grant grant) { + this.roles = grant.roles; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roles the roles + */ + public Builder(List roles) { + this.roles = roles; + } + + /** + * Builds a Grant. + * + * @return the new Grant instance + */ + public Grant build() { + return new Grant(this); + } + + /** + * Adds a new element to roles. + * + * @param roles the new element to be added + * @return the Grant builder + */ + public Builder addRoles(Roles roles) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roles, + "roles cannot be null"); + if (this.roles == null) { + this.roles = new ArrayList(); + } + this.roles.add(roles); + return this; + } + + /** + * Set the roles. + * Existing roles will be replaced. + * + * @param roles the roles + * @return the Grant builder + */ + public Builder roles(List roles) { + this.roles = roles; + return this; + } + } + + protected Grant() { } + + protected Grant(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, + "roles cannot be null"); + roles = builder.roles; + } + + /** + * New builder. + * + * @return a Grant builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List roles() { + return roles; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java new file mode 100644 index 00000000000..1dbc53fefb6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Permission granted by the policy with translated roles and additional role information. + */ +public class GrantWithEnrichedRoles extends GenericModel { + + protected List roles; + + protected GrantWithEnrichedRoles() { } + + /** + * Gets the roles. + * + * A set of roles granted by the policy. + * + * @return the roles + */ + public List getRoles() { + return roles; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java new file mode 100644 index 00000000000..0ac71d8192b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java @@ -0,0 +1,64 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The settings for each identity type. + */ +public class IdentityTypes extends GenericModel { + + protected IdentityTypesBase user; + @SerializedName("service_id") + protected IdentityTypesBase serviceId; + protected IdentityTypesBase service; + + protected IdentityTypes() { } + + /** + * Gets the user. + * + * The core set of properties associated with an identity type. + * + * @return the user + */ + public IdentityTypesBase getUser() { + return user; + } + + /** + * Gets the serviceId. + * + * The core set of properties associated with an identity type. + * + * @return the serviceId + */ + public IdentityTypesBase getServiceId() { + return serviceId; + } + + /** + * Gets the service. + * + * The core set of properties associated with an identity type. + * + * @return the service + */ + public IdentityTypesBase getService() { + return service; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java new file mode 100644 index 00000000000..e8df91a1e5d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java @@ -0,0 +1,168 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with an identity type. + */ +public class IdentityTypesBase extends GenericModel { + + /** + * The state of the identity type. + */ + public interface State { + /** enabled. */ + String ENABLED = "enabled"; + /** monitor. */ + String MONITOR = "monitor"; + /** limited. */ + String LIMITED = "limited"; + } + + protected String state; + @SerializedName("external_allowed_accounts") + protected List externalAllowedAccounts; + + /** + * Builder. + */ + public static class Builder { + private String state; + private List externalAllowedAccounts; + + /** + * Instantiates a new Builder from an existing IdentityTypesBase instance. + * + * @param identityTypesBase the instance to initialize the Builder with + */ + private Builder(IdentityTypesBase identityTypesBase) { + this.state = identityTypesBase.state; + this.externalAllowedAccounts = identityTypesBase.externalAllowedAccounts; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param state the state + * @param externalAllowedAccounts the externalAllowedAccounts + */ + public Builder(String state, List externalAllowedAccounts) { + this.state = state; + this.externalAllowedAccounts = externalAllowedAccounts; + } + + /** + * Builds a IdentityTypesBase. + * + * @return the new IdentityTypesBase instance + */ + public IdentityTypesBase build() { + return new IdentityTypesBase(this); + } + + /** + * Adds a new element to externalAllowedAccounts. + * + * @param externalAllowedAccounts the new element to be added + * @return the IdentityTypesBase builder + */ + public Builder addExternalAllowedAccounts(String externalAllowedAccounts) { + com.ibm.cloud.sdk.core.util.Validator.notNull(externalAllowedAccounts, + "externalAllowedAccounts cannot be null"); + if (this.externalAllowedAccounts == null) { + this.externalAllowedAccounts = new ArrayList(); + } + this.externalAllowedAccounts.add(externalAllowedAccounts); + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the IdentityTypesBase builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the externalAllowedAccounts. + * Existing externalAllowedAccounts will be replaced. + * + * @param externalAllowedAccounts the externalAllowedAccounts + * @return the IdentityTypesBase builder + */ + public Builder externalAllowedAccounts(List externalAllowedAccounts) { + this.externalAllowedAccounts = externalAllowedAccounts; + return this; + } + } + + protected IdentityTypesBase() { } + + protected IdentityTypesBase(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.state, + "state cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.externalAllowedAccounts, + "externalAllowedAccounts cannot be null"); + state = builder.state; + externalAllowedAccounts = builder.externalAllowedAccounts; + } + + /** + * New builder. + * + * @return a IdentityTypesBase builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the state. + * + * The state of the identity type. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the externalAllowedAccounts. + * + * List of accounts that the state applies to for a given identity. + * + * @return the externalAllowedAccounts + */ + public List externalAllowedAccounts() { + return externalAllowedAccounts; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java new file mode 100644 index 00000000000..77aa5a26366 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java @@ -0,0 +1,147 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The settings to apply for each identity type for a request. + */ +public class IdentityTypesPatch extends GenericModel { + + protected IdentityTypesBase user; + @SerializedName("service_id") + protected IdentityTypesBase serviceId; + protected IdentityTypesBase service; + + /** + * Builder. + */ + public static class Builder { + private IdentityTypesBase user; + private IdentityTypesBase serviceId; + private IdentityTypesBase service; + + /** + * Instantiates a new Builder from an existing IdentityTypesPatch instance. + * + * @param identityTypesPatch the instance to initialize the Builder with + */ + private Builder(IdentityTypesPatch identityTypesPatch) { + this.user = identityTypesPatch.user; + this.serviceId = identityTypesPatch.serviceId; + this.service = identityTypesPatch.service; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a IdentityTypesPatch. + * + * @return the new IdentityTypesPatch instance + */ + public IdentityTypesPatch build() { + return new IdentityTypesPatch(this); + } + + /** + * Set the user. + * + * @param user the user + * @return the IdentityTypesPatch builder + */ + public Builder user(IdentityTypesBase user) { + this.user = user; + return this; + } + + /** + * Set the serviceId. + * + * @param serviceId the serviceId + * @return the IdentityTypesPatch builder + */ + public Builder serviceId(IdentityTypesBase serviceId) { + this.serviceId = serviceId; + return this; + } + + /** + * Set the service. + * + * @param service the service + * @return the IdentityTypesPatch builder + */ + public Builder service(IdentityTypesBase service) { + this.service = service; + return this; + } + } + + protected IdentityTypesPatch() { } + + protected IdentityTypesPatch(Builder builder) { + user = builder.user; + serviceId = builder.serviceId; + service = builder.service; + } + + /** + * New builder. + * + * @return a IdentityTypesPatch builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the user. + * + * The core set of properties associated with an identity type. + * + * @return the user + */ + public IdentityTypesBase user() { + return user; + } + + /** + * Gets the serviceId. + * + * The core set of properties associated with an identity type. + * + * @return the serviceId + */ + public IdentityTypesBase serviceId() { + return serviceId; + } + + /** + * Gets the service. + * + * The core set of properties associated with an identity type. + * + * @return the service + */ + public IdentityTypesBase service() { + return service; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java new file mode 100644 index 00000000000..5aa0b39573b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * policy template current and limit details with in an account. + */ +public class LimitData extends GenericModel { + + protected Long current; + protected Long limit; + + protected LimitData() { } + + /** + * Gets the current. + * + * policy template current count. + * + * @return the current + */ + public Long getCurrent() { + return current; + } + + /** + * Gets the limit. + * + * policy template limit count. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java new file mode 100644 index 00000000000..6835f5afccc --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java @@ -0,0 +1,245 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listActionControlAssignments options. + */ +public class ListActionControlAssignmentsOptions extends GenericModel { + + protected String accountId; + protected String acceptLanguage; + protected String templateId; + protected String templateVersion; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String templateId; + private String templateVersion; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListActionControlAssignmentsOptions instance. + * + * @param listActionControlAssignmentsOptions the instance to initialize the Builder with + */ + private Builder(ListActionControlAssignmentsOptions listActionControlAssignmentsOptions) { + this.accountId = listActionControlAssignmentsOptions.accountId; + this.acceptLanguage = listActionControlAssignmentsOptions.acceptLanguage; + this.templateId = listActionControlAssignmentsOptions.templateId; + this.templateVersion = listActionControlAssignmentsOptions.templateVersion; + this.limit = listActionControlAssignmentsOptions.limit; + this.start = listActionControlAssignmentsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListActionControlAssignmentsOptions. + * + * @return the new ListActionControlAssignmentsOptions instance + */ + public ListActionControlAssignmentsOptions build() { + return new ListActionControlAssignmentsOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the templateId. + * + * @param templateId the templateId + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder templateId(String templateId) { + this.templateId = templateId; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListActionControlAssignmentsOptions() { } + + protected ListActionControlAssignmentsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + templateId = builder.templateId; + templateVersion = builder.templateVersion; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListActionControlAssignmentsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID in which the action control assignment belongs to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the templateId. + * + * Optional template ID. + * + * @return the templateId + */ + public String templateId() { + return templateId; + } + + /** + * Gets the templateVersion. + * + * Optional action control template version. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java new file mode 100644 index 00000000000..984d1060c83 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listActionControlTemplateVersions options. + */ +public class ListActionControlTemplateVersionsOptions extends GenericModel { + + /** + * Action control template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String actionControlTemplateId; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListActionControlTemplateVersionsOptions instance. + * + * @param listActionControlTemplateVersionsOptions the instance to initialize the Builder with + */ + private Builder(ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions) { + this.actionControlTemplateId = listActionControlTemplateVersionsOptions.actionControlTemplateId; + this.state = listActionControlTemplateVersionsOptions.state; + this.limit = listActionControlTemplateVersionsOptions.limit; + this.start = listActionControlTemplateVersionsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + */ + public Builder(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + } + + /** + * Builds a ListActionControlTemplateVersionsOptions. + * + * @return the new ListActionControlTemplateVersionsOptions instance + */ + public ListActionControlTemplateVersionsOptions build() { + return new ListActionControlTemplateVersionsOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the ListActionControlTemplateVersionsOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListActionControlTemplateVersionsOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListActionControlTemplateVersionsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListActionControlTemplateVersionsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListActionControlTemplateVersionsOptions() { } + + protected ListActionControlTemplateVersionsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListActionControlTemplateVersionsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * The action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the state. + * + * Action control template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java new file mode 100644 index 00000000000..d019db6119f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java @@ -0,0 +1,193 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listActionControlTemplates options. + */ +public class ListActionControlTemplatesOptions extends GenericModel { + + protected String accountId; + protected String acceptLanguage; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListActionControlTemplatesOptions instance. + * + * @param listActionControlTemplatesOptions the instance to initialize the Builder with + */ + private Builder(ListActionControlTemplatesOptions listActionControlTemplatesOptions) { + this.accountId = listActionControlTemplatesOptions.accountId; + this.acceptLanguage = listActionControlTemplatesOptions.acceptLanguage; + this.limit = listActionControlTemplatesOptions.limit; + this.start = listActionControlTemplatesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListActionControlTemplatesOptions. + * + * @return the new ListActionControlTemplatesOptions instance + */ + public ListActionControlTemplatesOptions build() { + return new ListActionControlTemplatesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListActionControlTemplatesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListActionControlTemplatesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListActionControlTemplatesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListActionControlTemplatesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListActionControlTemplatesOptions() { } + + protected ListActionControlTemplatesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListActionControlTemplatesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the action control templates belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java new file mode 100644 index 00000000000..90ecb352c37 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java @@ -0,0 +1,501 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listPolicies options. + */ +public class ListPoliciesOptions extends GenericModel { + + /** + * Optional type of policy. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + /** + * Optional type of service. + */ + public interface ServiceType { + /** service. */ + String SERVICE = "service"; + /** platform_service. */ + String PLATFORM_SERVICE = "platform_service"; + } + + /** + * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending + * '-' to field. Example '-last_modified_at'. + */ + public interface Sort { + /** id. */ + String ID = "id"; + /** type. */ + String TYPE = "type"; + /** href. */ + String HREF = "href"; + /** created_at. */ + String CREATED_AT = "created_at"; + /** created_by_id. */ + String CREATED_BY_ID = "created_by_id"; + /** last_modified_at. */ + String LAST_MODIFIED_AT = "last_modified_at"; + /** last_modified_by_id. */ + String LAST_MODIFIED_BY_ID = "last_modified_by_id"; + /** state. */ + String STATE = "state"; + } + + /** + * Include additional data per policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles. + */ + public interface Format { + /** include_last_permit. */ + String INCLUDE_LAST_PERMIT = "include_last_permit"; + /** display. */ + String DISPLAY = "display"; + } + + /** + * The state of the policy. + * * `active` - returns active policies + * * `deleted` - returns non-active policies. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String accountId; + protected String acceptLanguage; + protected String iamId; + protected String accessGroupId; + protected String type; + protected String serviceType; + protected String tagName; + protected String tagValue; + protected String sort; + protected String format; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String iamId; + private String accessGroupId; + private String type; + private String serviceType; + private String tagName; + private String tagValue; + private String sort; + private String format; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListPoliciesOptions instance. + * + * @param listPoliciesOptions the instance to initialize the Builder with + */ + private Builder(ListPoliciesOptions listPoliciesOptions) { + this.accountId = listPoliciesOptions.accountId; + this.acceptLanguage = listPoliciesOptions.acceptLanguage; + this.iamId = listPoliciesOptions.iamId; + this.accessGroupId = listPoliciesOptions.accessGroupId; + this.type = listPoliciesOptions.type; + this.serviceType = listPoliciesOptions.serviceType; + this.tagName = listPoliciesOptions.tagName; + this.tagValue = listPoliciesOptions.tagValue; + this.sort = listPoliciesOptions.sort; + this.format = listPoliciesOptions.format; + this.state = listPoliciesOptions.state; + this.limit = listPoliciesOptions.limit; + this.start = listPoliciesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListPoliciesOptions. + * + * @return the new ListPoliciesOptions instance + */ + public ListPoliciesOptions build() { + return new ListPoliciesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListPoliciesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListPoliciesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the iamId. + * + * @param iamId the iamId + * @return the ListPoliciesOptions builder + */ + public Builder iamId(String iamId) { + this.iamId = iamId; + return this; + } + + /** + * Set the accessGroupId. + * + * @param accessGroupId the accessGroupId + * @return the ListPoliciesOptions builder + */ + public Builder accessGroupId(String accessGroupId) { + this.accessGroupId = accessGroupId; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the ListPoliciesOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the serviceType. + * + * @param serviceType the serviceType + * @return the ListPoliciesOptions builder + */ + public Builder serviceType(String serviceType) { + this.serviceType = serviceType; + return this; + } + + /** + * Set the tagName. + * + * @param tagName the tagName + * @return the ListPoliciesOptions builder + */ + public Builder tagName(String tagName) { + this.tagName = tagName; + return this; + } + + /** + * Set the tagValue. + * + * @param tagValue the tagValue + * @return the ListPoliciesOptions builder + */ + public Builder tagValue(String tagValue) { + this.tagValue = tagValue; + return this; + } + + /** + * Set the sort. + * + * @param sort the sort + * @return the ListPoliciesOptions builder + */ + public Builder sort(String sort) { + this.sort = sort; + return this; + } + + /** + * Set the format. + * + * @param format the format + * @return the ListPoliciesOptions builder + */ + public Builder format(String format) { + this.format = format; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListPoliciesOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListPoliciesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListPoliciesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListPoliciesOptions() { } + + protected ListPoliciesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + iamId = builder.iamId; + accessGroupId = builder.accessGroupId; + type = builder.type; + serviceType = builder.serviceType; + tagName = builder.tagName; + tagValue = builder.tagValue; + sort = builder.sort; + format = builder.format; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListPoliciesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the policies belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the iamId. + * + * Optional IAM ID used to identify the subject. + * + * @return the iamId + */ + public String iamId() { + return iamId; + } + + /** + * Gets the accessGroupId. + * + * Optional access group id. + * + * @return the accessGroupId + */ + public String accessGroupId() { + return accessGroupId; + } + + /** + * Gets the type. + * + * Optional type of policy. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the serviceType. + * + * Optional type of service. + * + * @return the serviceType + */ + public String serviceType() { + return serviceType; + } + + /** + * Gets the tagName. + * + * Optional name of the access tag in the policy. + * + * @return the tagName + */ + public String tagName() { + return tagName; + } + + /** + * Gets the tagValue. + * + * Optional value of the access tag in the policy. + * + * @return the tagValue + */ + public String tagValue() { + return tagValue; + } + + /** + * Gets the sort. + * + * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending + * '-' to field. Example '-last_modified_at'. + * + * @return the sort + */ + public String sort() { + return sort; + } + + /** + * Gets the format. + * + * Include additional data per policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles. + * + * @return the format + */ + public String format() { + return format; + } + + /** + * Gets the state. + * + * The state of the policy. + * * `active` - returns active policies + * * `deleted` - returns non-active policies. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java new file mode 100644 index 00000000000..9362749c670 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java @@ -0,0 +1,275 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listPolicyAssignments options. + */ +public class ListPolicyAssignmentsOptions extends GenericModel { + + protected String version; + protected String accountId; + protected String acceptLanguage; + protected String templateId; + protected String templateVersion; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String version; + private String accountId; + private String acceptLanguage; + private String templateId; + private String templateVersion; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListPolicyAssignmentsOptions instance. + * + * @param listPolicyAssignmentsOptions the instance to initialize the Builder with + */ + private Builder(ListPolicyAssignmentsOptions listPolicyAssignmentsOptions) { + this.version = listPolicyAssignmentsOptions.version; + this.accountId = listPolicyAssignmentsOptions.accountId; + this.acceptLanguage = listPolicyAssignmentsOptions.acceptLanguage; + this.templateId = listPolicyAssignmentsOptions.templateId; + this.templateVersion = listPolicyAssignmentsOptions.templateVersion; + this.limit = listPolicyAssignmentsOptions.limit; + this.start = listPolicyAssignmentsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param version the version + * @param accountId the accountId + */ + public Builder(String version, String accountId) { + this.version = version; + this.accountId = accountId; + } + + /** + * Builds a ListPolicyAssignmentsOptions. + * + * @return the new ListPolicyAssignmentsOptions instance + */ + public ListPolicyAssignmentsOptions build() { + return new ListPolicyAssignmentsOptions(this); + } + + /** + * Set the version. + * + * @param version the version + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the templateId. + * + * @param templateId the templateId + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder templateId(String templateId) { + this.templateId = templateId; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListPolicyAssignmentsOptions() { } + + protected ListPolicyAssignmentsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + version = builder.version; + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + templateId = builder.templateId; + templateVersion = builder.templateVersion; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListPolicyAssignmentsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the version. + * + * specify version of response body format. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the accountId. + * + * The account GUID in which the policies belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the templateId. + * + * Optional template id. + * + * @return the templateId + */ + public String templateId() { + return templateId; + } + + /** + * Gets the templateVersion. + * + * Optional policy template version. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java new file mode 100644 index 00000000000..c7965ba6c31 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listPolicyTemplateVersions options. + */ +public class ListPolicyTemplateVersionsOptions extends GenericModel { + + /** + * The policy template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String policyTemplateId; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListPolicyTemplateVersionsOptions instance. + * + * @param listPolicyTemplateVersionsOptions the instance to initialize the Builder with + */ + private Builder(ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions) { + this.policyTemplateId = listPolicyTemplateVersionsOptions.policyTemplateId; + this.state = listPolicyTemplateVersionsOptions.state; + this.limit = listPolicyTemplateVersionsOptions.limit; + this.start = listPolicyTemplateVersionsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + */ + public Builder(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + } + + /** + * Builds a ListPolicyTemplateVersionsOptions. + * + * @return the new ListPolicyTemplateVersionsOptions instance + */ + public ListPolicyTemplateVersionsOptions build() { + return new ListPolicyTemplateVersionsOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the ListPolicyTemplateVersionsOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListPolicyTemplateVersionsOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListPolicyTemplateVersionsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListPolicyTemplateVersionsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListPolicyTemplateVersionsOptions() { } + + protected ListPolicyTemplateVersionsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + policyTemplateId = builder.policyTemplateId; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListPolicyTemplateVersionsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the state. + * + * The policy template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java new file mode 100644 index 00000000000..f230c9bd549 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java @@ -0,0 +1,379 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listPolicyTemplates options. + */ +public class ListPolicyTemplatesOptions extends GenericModel { + + /** + * The policy template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + /** + * Service type, Optional. + */ + public interface PolicyServiceType { + /** service. */ + String SERVICE = "service"; + /** platform_service. */ + String PLATFORM_SERVICE = "platform_service"; + } + + /** + * Policy type, Optional. + */ + public interface PolicyType { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + protected String accountId; + protected String acceptLanguage; + protected String state; + protected String name; + protected String policyServiceType; + protected String policyServiceName; + protected String policyServiceGroupId; + protected String policyType; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String state; + private String name; + private String policyServiceType; + private String policyServiceName; + private String policyServiceGroupId; + private String policyType; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListPolicyTemplatesOptions instance. + * + * @param listPolicyTemplatesOptions the instance to initialize the Builder with + */ + private Builder(ListPolicyTemplatesOptions listPolicyTemplatesOptions) { + this.accountId = listPolicyTemplatesOptions.accountId; + this.acceptLanguage = listPolicyTemplatesOptions.acceptLanguage; + this.state = listPolicyTemplatesOptions.state; + this.name = listPolicyTemplatesOptions.name; + this.policyServiceType = listPolicyTemplatesOptions.policyServiceType; + this.policyServiceName = listPolicyTemplatesOptions.policyServiceName; + this.policyServiceGroupId = listPolicyTemplatesOptions.policyServiceGroupId; + this.policyType = listPolicyTemplatesOptions.policyType; + this.limit = listPolicyTemplatesOptions.limit; + this.start = listPolicyTemplatesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListPolicyTemplatesOptions. + * + * @return the new ListPolicyTemplatesOptions instance + */ + public ListPolicyTemplatesOptions build() { + return new ListPolicyTemplatesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListPolicyTemplatesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListPolicyTemplatesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListPolicyTemplatesOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ListPolicyTemplatesOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the policyServiceType. + * + * @param policyServiceType the policyServiceType + * @return the ListPolicyTemplatesOptions builder + */ + public Builder policyServiceType(String policyServiceType) { + this.policyServiceType = policyServiceType; + return this; + } + + /** + * Set the policyServiceName. + * + * @param policyServiceName the policyServiceName + * @return the ListPolicyTemplatesOptions builder + */ + public Builder policyServiceName(String policyServiceName) { + this.policyServiceName = policyServiceName; + return this; + } + + /** + * Set the policyServiceGroupId. + * + * @param policyServiceGroupId the policyServiceGroupId + * @return the ListPolicyTemplatesOptions builder + */ + public Builder policyServiceGroupId(String policyServiceGroupId) { + this.policyServiceGroupId = policyServiceGroupId; + return this; + } + + /** + * Set the policyType. + * + * @param policyType the policyType + * @return the ListPolicyTemplatesOptions builder + */ + public Builder policyType(String policyType) { + this.policyType = policyType; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListPolicyTemplatesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListPolicyTemplatesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListPolicyTemplatesOptions() { } + + protected ListPolicyTemplatesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + state = builder.state; + name = builder.name; + policyServiceType = builder.policyServiceType; + policyServiceName = builder.policyServiceName; + policyServiceGroupId = builder.policyServiceGroupId; + policyType = builder.policyType; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListPolicyTemplatesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the policy templates belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the state. + * + * The policy template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the name. + * + * The policy template name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the policyServiceType. + * + * Service type, Optional. + * + * @return the policyServiceType + */ + public String policyServiceType() { + return policyServiceType; + } + + /** + * Gets the policyServiceName. + * + * Service name, Optional. + * + * @return the policyServiceName + */ + public String policyServiceName() { + return policyServiceName; + } + + /** + * Gets the policyServiceGroupId. + * + * Service group id, Optional. + * + * @return the policyServiceGroupId + */ + public String policyServiceGroupId() { + return policyServiceGroupId; + } + + /** + * Gets the policyType. + * + * Policy type, Optional. + * + * @return the policyType + */ + public String policyType() { + return policyType; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java new file mode 100644 index 00000000000..adcb3f0cc90 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java @@ -0,0 +1,245 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listRoleAssignments options. + */ +public class ListRoleAssignmentsOptions extends GenericModel { + + protected String accountId; + protected String acceptLanguage; + protected String templateId; + protected String templateVersion; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String templateId; + private String templateVersion; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListRoleAssignmentsOptions instance. + * + * @param listRoleAssignmentsOptions the instance to initialize the Builder with + */ + private Builder(ListRoleAssignmentsOptions listRoleAssignmentsOptions) { + this.accountId = listRoleAssignmentsOptions.accountId; + this.acceptLanguage = listRoleAssignmentsOptions.acceptLanguage; + this.templateId = listRoleAssignmentsOptions.templateId; + this.templateVersion = listRoleAssignmentsOptions.templateVersion; + this.limit = listRoleAssignmentsOptions.limit; + this.start = listRoleAssignmentsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListRoleAssignmentsOptions. + * + * @return the new ListRoleAssignmentsOptions instance + */ + public ListRoleAssignmentsOptions build() { + return new ListRoleAssignmentsOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListRoleAssignmentsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListRoleAssignmentsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the templateId. + * + * @param templateId the templateId + * @return the ListRoleAssignmentsOptions builder + */ + public Builder templateId(String templateId) { + this.templateId = templateId; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the ListRoleAssignmentsOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListRoleAssignmentsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListRoleAssignmentsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListRoleAssignmentsOptions() { } + + protected ListRoleAssignmentsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + templateId = builder.templateId; + templateVersion = builder.templateVersion; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListRoleAssignmentsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID in which the role assignment belongs to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the templateId. + * + * Optional template ID. + * + * @return the templateId + */ + public String templateId() { + return templateId; + } + + /** + * Gets the templateVersion. + * + * Optional role template version. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java new file mode 100644 index 00000000000..e22751433e5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listRoleTemplateVersions options. + */ +public class ListRoleTemplateVersionsOptions extends GenericModel { + + /** + * Role template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String roleTemplateId; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListRoleTemplateVersionsOptions instance. + * + * @param listRoleTemplateVersionsOptions the instance to initialize the Builder with + */ + private Builder(ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions) { + this.roleTemplateId = listRoleTemplateVersionsOptions.roleTemplateId; + this.state = listRoleTemplateVersionsOptions.state; + this.limit = listRoleTemplateVersionsOptions.limit; + this.start = listRoleTemplateVersionsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + */ + public Builder(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + } + + /** + * Builds a ListRoleTemplateVersionsOptions. + * + * @return the new ListRoleTemplateVersionsOptions instance + */ + public ListRoleTemplateVersionsOptions build() { + return new ListRoleTemplateVersionsOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the ListRoleTemplateVersionsOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListRoleTemplateVersionsOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListRoleTemplateVersionsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListRoleTemplateVersionsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListRoleTemplateVersionsOptions() { } + + protected ListRoleTemplateVersionsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + roleTemplateId = builder.roleTemplateId; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListRoleTemplateVersionsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * The role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the state. + * + * Role template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java new file mode 100644 index 00000000000..8f889bdce96 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java @@ -0,0 +1,307 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listRoleTemplates options. + */ +public class ListRoleTemplatesOptions extends GenericModel { + + /** + * The role template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String accountId; + protected String acceptLanguage; + protected String name; + protected String roleName; + protected String roleServiceName; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String name; + private String roleName; + private String roleServiceName; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListRoleTemplatesOptions instance. + * + * @param listRoleTemplatesOptions the instance to initialize the Builder with + */ + private Builder(ListRoleTemplatesOptions listRoleTemplatesOptions) { + this.accountId = listRoleTemplatesOptions.accountId; + this.acceptLanguage = listRoleTemplatesOptions.acceptLanguage; + this.name = listRoleTemplatesOptions.name; + this.roleName = listRoleTemplatesOptions.roleName; + this.roleServiceName = listRoleTemplatesOptions.roleServiceName; + this.state = listRoleTemplatesOptions.state; + this.limit = listRoleTemplatesOptions.limit; + this.start = listRoleTemplatesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListRoleTemplatesOptions. + * + * @return the new ListRoleTemplatesOptions instance + */ + public ListRoleTemplatesOptions build() { + return new ListRoleTemplatesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListRoleTemplatesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListRoleTemplatesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ListRoleTemplatesOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the roleName. + * + * @param roleName the roleName + * @return the ListRoleTemplatesOptions builder + */ + public Builder roleName(String roleName) { + this.roleName = roleName; + return this; + } + + /** + * Set the roleServiceName. + * + * @param roleServiceName the roleServiceName + * @return the ListRoleTemplatesOptions builder + */ + public Builder roleServiceName(String roleServiceName) { + this.roleServiceName = roleServiceName; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListRoleTemplatesOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListRoleTemplatesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListRoleTemplatesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListRoleTemplatesOptions() { } + + protected ListRoleTemplatesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + name = builder.name; + roleName = builder.roleName; + roleServiceName = builder.roleServiceName; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListRoleTemplatesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the role templates belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the name. + * + * The role template name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the roleName. + * + * The template role name. + * + * @return the roleName + */ + public String roleName() { + return roleName; + } + + /** + * Gets the roleServiceName. + * + * The template role service name. + * + * @return the roleServiceName + */ + public String roleServiceName() { + return roleServiceName; + } + + /** + * Gets the state. + * + * The role template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java new file mode 100644 index 00000000000..2ca364c53a3 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java @@ -0,0 +1,234 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listRoles options. + */ +public class ListRolesOptions extends GenericModel { + + protected String acceptLanguage; + protected String accountId; + protected String serviceName; + protected String sourceServiceName; + protected String policyType; + protected String serviceGroupId; + + /** + * Builder. + */ + public static class Builder { + private String acceptLanguage; + private String accountId; + private String serviceName; + private String sourceServiceName; + private String policyType; + private String serviceGroupId; + + /** + * Instantiates a new Builder from an existing ListRolesOptions instance. + * + * @param listRolesOptions the instance to initialize the Builder with + */ + private Builder(ListRolesOptions listRolesOptions) { + this.acceptLanguage = listRolesOptions.acceptLanguage; + this.accountId = listRolesOptions.accountId; + this.serviceName = listRolesOptions.serviceName; + this.sourceServiceName = listRolesOptions.sourceServiceName; + this.policyType = listRolesOptions.policyType; + this.serviceGroupId = listRolesOptions.serviceGroupId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ListRolesOptions. + * + * @return the new ListRolesOptions instance + */ + public ListRolesOptions build() { + return new ListRolesOptions(this); + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListRolesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListRolesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the ListRolesOptions builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the sourceServiceName. + * + * @param sourceServiceName the sourceServiceName + * @return the ListRolesOptions builder + */ + public Builder sourceServiceName(String sourceServiceName) { + this.sourceServiceName = sourceServiceName; + return this; + } + + /** + * Set the policyType. + * + * @param policyType the policyType + * @return the ListRolesOptions builder + */ + public Builder policyType(String policyType) { + this.policyType = policyType; + return this; + } + + /** + * Set the serviceGroupId. + * + * @param serviceGroupId the serviceGroupId + * @return the ListRolesOptions builder + */ + public Builder serviceGroupId(String serviceGroupId) { + this.serviceGroupId = serviceGroupId; + return this; + } + } + + protected ListRolesOptions() { } + + protected ListRolesOptions(Builder builder) { + acceptLanguage = builder.acceptLanguage; + accountId = builder.accountId; + serviceName = builder.serviceName; + sourceServiceName = builder.sourceServiceName; + policyType = builder.policyType; + serviceGroupId = builder.serviceGroupId; + } + + /** + * New builder. + * + * @return a ListRolesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the accountId. + * + * Optional account GUID in which the roles belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the serviceName. + * + * Optional name of IAM enabled service. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the sourceServiceName. + * + * Optional name of source IAM enabled service. + * + * @return the sourceServiceName + */ + public String sourceServiceName() { + return sourceServiceName; + } + + /** + * Gets the policyType. + * + * Optional Policy Type. + * + * @return the policyType + */ + public String policyType() { + return policyType; + } + + /** + * Gets the serviceGroupId. + * + * Optional id of service group. + * + * @return the serviceGroupId + */ + public String serviceGroupId() { + return serviceGroupId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java new file mode 100644 index 00000000000..65849c3d9a6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java @@ -0,0 +1,492 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listV2Policies options. + */ +public class ListV2PoliciesOptions extends GenericModel { + + /** + * Optional type of policy. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + /** + * Optional type of service. + */ + public interface ServiceType { + /** service. */ + String SERVICE = "service"; + /** platform_service. */ + String PLATFORM_SERVICE = "platform_service"; + } + + /** + * Include additional data per policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles and translations for all + * relevant fields. + */ + public interface Format { + /** include_last_permit. */ + String INCLUDE_LAST_PERMIT = "include_last_permit"; + /** display. */ + String DISPLAY = "display"; + } + + /** + * The state of the policy. + * * `active` - returns active policies + * * `deleted` - returns non-active policies. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String accountId; + protected String acceptLanguage; + protected String iamId; + protected String accessGroupId; + protected String type; + protected String serviceType; + protected String serviceName; + protected String serviceGroupId; + protected String sort; + protected String format; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String iamId; + private String accessGroupId; + private String type; + private String serviceType; + private String serviceName; + private String serviceGroupId; + private String sort; + private String format; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListV2PoliciesOptions instance. + * + * @param listV2PoliciesOptions the instance to initialize the Builder with + */ + private Builder(ListV2PoliciesOptions listV2PoliciesOptions) { + this.accountId = listV2PoliciesOptions.accountId; + this.acceptLanguage = listV2PoliciesOptions.acceptLanguage; + this.iamId = listV2PoliciesOptions.iamId; + this.accessGroupId = listV2PoliciesOptions.accessGroupId; + this.type = listV2PoliciesOptions.type; + this.serviceType = listV2PoliciesOptions.serviceType; + this.serviceName = listV2PoliciesOptions.serviceName; + this.serviceGroupId = listV2PoliciesOptions.serviceGroupId; + this.sort = listV2PoliciesOptions.sort; + this.format = listV2PoliciesOptions.format; + this.state = listV2PoliciesOptions.state; + this.limit = listV2PoliciesOptions.limit; + this.start = listV2PoliciesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListV2PoliciesOptions. + * + * @return the new ListV2PoliciesOptions instance + */ + public ListV2PoliciesOptions build() { + return new ListV2PoliciesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListV2PoliciesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListV2PoliciesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the iamId. + * + * @param iamId the iamId + * @return the ListV2PoliciesOptions builder + */ + public Builder iamId(String iamId) { + this.iamId = iamId; + return this; + } + + /** + * Set the accessGroupId. + * + * @param accessGroupId the accessGroupId + * @return the ListV2PoliciesOptions builder + */ + public Builder accessGroupId(String accessGroupId) { + this.accessGroupId = accessGroupId; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the ListV2PoliciesOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the serviceType. + * + * @param serviceType the serviceType + * @return the ListV2PoliciesOptions builder + */ + public Builder serviceType(String serviceType) { + this.serviceType = serviceType; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the ListV2PoliciesOptions builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the serviceGroupId. + * + * @param serviceGroupId the serviceGroupId + * @return the ListV2PoliciesOptions builder + */ + public Builder serviceGroupId(String serviceGroupId) { + this.serviceGroupId = serviceGroupId; + return this; + } + + /** + * Set the sort. + * + * @param sort the sort + * @return the ListV2PoliciesOptions builder + */ + public Builder sort(String sort) { + this.sort = sort; + return this; + } + + /** + * Set the format. + * + * @param format the format + * @return the ListV2PoliciesOptions builder + */ + public Builder format(String format) { + this.format = format; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListV2PoliciesOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListV2PoliciesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListV2PoliciesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListV2PoliciesOptions() { } + + protected ListV2PoliciesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + iamId = builder.iamId; + accessGroupId = builder.accessGroupId; + type = builder.type; + serviceType = builder.serviceType; + serviceName = builder.serviceName; + serviceGroupId = builder.serviceGroupId; + sort = builder.sort; + format = builder.format; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListV2PoliciesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID in which the policies belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the iamId. + * + * Optional IAM ID used to identify the subject. + * + * @return the iamId + */ + public String iamId() { + return iamId; + } + + /** + * Gets the accessGroupId. + * + * Optional access group id. + * + * @return the accessGroupId + */ + public String accessGroupId() { + return accessGroupId; + } + + /** + * Gets the type. + * + * Optional type of policy. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the serviceType. + * + * Optional type of service. + * + * @return the serviceType + */ + public String serviceType() { + return serviceType; + } + + /** + * Gets the serviceName. + * + * Optional name of service. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the serviceGroupId. + * + * Optional ID of service group. + * + * @return the serviceGroupId + */ + public String serviceGroupId() { + return serviceGroupId; + } + + /** + * Gets the sort. + * + * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending + * '-' to field, for example, '-last_modified_at'. Note that last permit information is only included when + * 'format=include_last_permit', for example, "format=include_last_permit&sort=last_permit_at" Example fields that + * can be sorted on: + * - 'id' + * - 'type' + * - 'href' + * - 'created_at' + * - 'created_by_id' + * - 'last_modified_at' + * - 'last_modified_by_id' + * - 'state' + * - 'last_permit_at' + * - 'last_permit_frequency'. + * + * @return the sort + */ + public String sort() { + return sort; + } + + /** + * Gets the format. + * + * Include additional data per policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles and translations for all + * relevant fields. + * + * @return the format + */ + public String format() { + return format; + } + + /** + * Gets the state. + * + * The state of the policy. + * * `active` - returns active policies + * * `deleted` - returns non-active policies. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java new file mode 100644 index 00000000000..4d43d84dbba --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java @@ -0,0 +1,126 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Condition that specifies additional conditions or RuleAttribute to grant access. + * + * Classes which extend this class: + * - NestedConditionRuleAttribute + * - NestedConditionRuleWithConditions + */ +public class NestedCondition extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + protected String key; + protected String operator; + protected Object value; + protected List conditions; + + protected NestedCondition() { } + + /** + * Gets the key. + * + * The name of an attribute. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } + + /** + * Gets the conditions. + * + * List of conditions associated with a policy. For example, time-based conditions that grant access over a certain + * time period. + * + * @return the conditions + */ + public List conditions() { + return conditions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java new file mode 100644 index 00000000000..b1d44da3f6b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java @@ -0,0 +1,170 @@ +/* + * (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_policy_management.v1.model; + +/** + * Rule that specifies additional access that is granted (For example, time-based condition). + */ +public class NestedConditionRuleAttribute extends NestedCondition { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing NestedConditionRuleAttribute instance. + * + * @param nestedConditionRuleAttribute the instance to initialize the Builder with + */ + public Builder(NestedCondition nestedConditionRuleAttribute) { + this.key = nestedConditionRuleAttribute.key; + this.operator = nestedConditionRuleAttribute.operator; + this.value = nestedConditionRuleAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a NestedConditionRuleAttribute. + * + * @return the new NestedConditionRuleAttribute instance + */ + public NestedConditionRuleAttribute build() { + return new NestedConditionRuleAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the NestedConditionRuleAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the NestedConditionRuleAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the NestedConditionRuleAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected NestedConditionRuleAttribute() { } + + protected NestedConditionRuleAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a NestedConditionRuleAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java new file mode 100644 index 00000000000..20d0faac795 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java @@ -0,0 +1,139 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * Rule that specifies additional access that is granted (for example, time-based condition) accross multiple + * conditions. + */ +public class NestedConditionRuleWithConditions extends NestedCondition { + + /** + * Operator to evaluate conditions. + */ + public interface Operator { + /** and. */ + String AND = "and"; + /** or. */ + String OR = "or"; + } + + + /** + * Builder. + */ + public static class Builder { + private String operator; + private List conditions; + + /** + * Instantiates a new Builder from an existing NestedConditionRuleWithConditions instance. + * + * @param nestedConditionRuleWithConditions the instance to initialize the Builder with + */ + public Builder(NestedCondition nestedConditionRuleWithConditions) { + this.operator = nestedConditionRuleWithConditions.operator; + this.conditions = nestedConditionRuleWithConditions.conditions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param operator the operator + * @param conditions the conditions + */ + public Builder(String operator, List conditions) { + this.operator = operator; + this.conditions = conditions; + } + + /** + * Builds a NestedConditionRuleWithConditions. + * + * @return the new NestedConditionRuleWithConditions instance + */ + public NestedConditionRuleWithConditions build() { + return new NestedConditionRuleWithConditions(this); + } + + /** + * Adds a new element to conditions. + * + * @param conditions the new element to be added + * @return the NestedConditionRuleWithConditions builder + */ + public Builder addConditions(RuleAttribute conditions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(conditions, + "conditions cannot be null"); + if (this.conditions == null) { + this.conditions = new ArrayList(); + } + this.conditions.add(conditions); + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the NestedConditionRuleWithConditions builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the conditions. + * Existing conditions will be replaced. + * + * @param conditions the conditions + * @return the NestedConditionRuleWithConditions builder + */ + public Builder conditions(List conditions) { + this.conditions = conditions; + return this; + } + } + + protected NestedConditionRuleWithConditions() { } + + protected NestedConditionRuleWithConditions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.conditions, + "conditions cannot be null"); + operator = builder.operator; + conditions = builder.conditions; + } + + /** + * New builder. + * + * @return a NestedConditionRuleWithConditions builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java new file mode 100644 index 00000000000..b0442f902bc --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Details with href linking to the following page of requested collection. + */ +public class Next extends GenericModel { + + protected String href; + protected String start; + + protected Next() { } + + /** + * Gets the href. + * + * The href linking to the page of requested collection. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection. + * + * @return the start + */ + public String getStart() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java new file mode 100644 index 00000000000..8f12053c72e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * PoliciesPager can be used to simplify the use of the "listPolicies" method. + */ +public class PoliciesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListPoliciesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected PoliciesPager() { } + + /** + * Constructs a new PoliciesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listPolicies" method + * @param options the ListPoliciesOptions instance to be used to invoke the "listPolicies" method + */ + public PoliciesPager(IamPolicyManagement client, ListPoliciesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<PolicyTemplateMetaData> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListPoliciesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + PolicyCollection result = client.listPolicies(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getPolicies(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<PolicyTemplateMetaData> containing all results returned by the "listPolicies" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java new file mode 100644 index 00000000000..af852b7cd74 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java @@ -0,0 +1,188 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with a policy. + */ +public class Policy extends GenericModel { + + /** + * The policy state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String id; + protected String type; + protected String description; + protected List subjects; + protected List roles; + protected List resources; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String state; + + protected Policy() { } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the description. + * + * Customer-defined description. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the subjects. + * + * The subjects associated with a policy. + * + * @return the subjects + */ + public List getSubjects() { + return subjects; + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List getRoles() { + return roles; + } + + /** + * Gets the resources. + * + * The resources associated with a policy. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the href. + * + * The href links back to the policy. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the state. + * + * The policy state. + * + * @return the state + */ + public String getState() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java new file mode 100644 index 00000000000..3e566ce7bdf --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Set of properties for the assigned resource. + */ +public class PolicyAssignmentResourcePolicy extends GenericModel { + + @SerializedName("resource_created") + protected AssignmentResourceCreated resourceCreated; + protected String status; + @SerializedName("error_message") + protected AssignmentResourceError errorMessage; + + protected PolicyAssignmentResourcePolicy() { } + + /** + * Gets the resourceCreated. + * + * On success, includes the policy that is assigned. + * + * @return the resourceCreated + */ + public AssignmentResourceCreated getResourceCreated() { + return resourceCreated; + } + + /** + * Gets the status. + * + * policy status. + * + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * Gets the errorMessage. + * + * Body parameters for assignment error. + * + * @return the errorMessage + */ + public AssignmentResourceError getErrorMessage() { + return errorMessage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java new file mode 100644 index 00000000000..ad944536b0d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The policy assignment resources. + */ +public class PolicyAssignmentResources extends GenericModel { + + protected String target; + protected PolicyAssignmentResourcePolicy policy; + + protected PolicyAssignmentResources() { } + + /** + * Gets the target. + * + * Account ID where resources are assigned. + * + * @return the target + */ + public String getTarget() { + return target; + } + + /** + * Gets the policy. + * + * Set of properties for the assigned resource. + * + * @return the policy + */ + public PolicyAssignmentResourcePolicy getPolicy() { + return policy; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java new file mode 100644 index 00000000000..f1ea295713c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java @@ -0,0 +1,193 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the policy template assignment. + */ +public class PolicyAssignmentV1 extends GenericModel { + + /** + * The policy assignment status. + */ + public interface Status { + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** succeeded. */ + String SUCCEEDED = "succeeded"; + /** succeed_with_errors. */ + String SUCCEED_WITH_ERRORS = "succeed_with_errors"; + /** failed. */ + String FAILED = "failed"; + } + + protected AssignmentTargetDetails target; + protected String id; + @SerializedName("account_id") + protected String accountId; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected List resources; + protected PolicyAssignmentV1Subject subject; + protected AssignmentTemplateDetails template; + protected String status; + + protected PolicyAssignmentV1() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the id. + * + * Policy assignment ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the accountId. + * + * The account GUID that the policies assignments belong to. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the href. + * + * The href URL that links to the policies assignments API by policy assignment ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy assignment was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy assignment. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy assignment was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy assignment. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the resources. + * + * Object for each account assigned. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the subject. + * + * Subject details of access type assignment. + * + * @return the subject + */ + public PolicyAssignmentV1Subject getSubject() { + return subject; + } + + /** + * Gets the template. + * + * policy template details. + * + * @return the template + */ + public AssignmentTemplateDetails getTemplate() { + return template; + } + + /** + * Gets the status. + * + * The policy assignment status. + * + * @return the status + */ + public String getStatus() { + return status; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java new file mode 100644 index 00000000000..7331ee5a854 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Policy assignment response. + */ +public class PolicyAssignmentV1Collection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List assignments; + + protected PolicyAssignmentV1Collection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the assignments. + * + * Response of policy assignments. + * + * @return the assignments + */ + public List getAssignments() { + return assignments; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java new file mode 100644 index 00000000000..c05eb90816b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The policy assignment resources. + */ +public class PolicyAssignmentV1Resources extends GenericModel { + + protected AssignmentTargetDetails target; + protected PolicyAssignmentResourcePolicy policy; + + protected PolicyAssignmentV1Resources() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the policy. + * + * Set of properties for the assigned resource. + * + * @return the policy + */ + public PolicyAssignmentResourcePolicy getPolicy() { + return policy; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java new file mode 100644 index 00000000000..58b2cd240ba --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java @@ -0,0 +1,60 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Subject details of access type assignment. + */ +public class PolicyAssignmentV1Subject extends GenericModel { + + /** + * The identity type of the subject of the assignment. + */ + public interface Type { + /** iam_id. */ + String IAM_ID = "iam_id"; + /** access_group_id. */ + String ACCESS_GROUP_ID = "access_group_id"; + } + + protected String id; + protected String type; + + protected PolicyAssignmentV1Subject() { } + + /** + * Gets the id. + * + * The unique identifier of the subject of the assignment. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the type. + * + * The identity type of the subject of the assignment. + * + * @return the type + */ + public String getType() { + return type; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java new file mode 100644 index 00000000000..931769daed5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * PolicyAssignmentsPager can be used to simplify the use of the "listPolicyAssignments" method. + */ +public class PolicyAssignmentsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListPolicyAssignmentsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected PolicyAssignmentsPager() { } + + /** + * Constructs a new PolicyAssignmentsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyAssignments" method + * @param options the ListPolicyAssignmentsOptions instance to be used to invoke the "listPolicyAssignments" method + */ + public PolicyAssignmentsPager(IamPolicyManagement client, ListPolicyAssignmentsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<PolicyTemplateAssignmentItems> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListPolicyAssignmentsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + PolicyTemplateAssignmentCollection result = client.listPolicyAssignments(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getAssignments(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<PolicyTemplateAssignmentItems> containing all results returned by the "listPolicyAssignments" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java new file mode 100644 index 00000000000..25062dd0a52 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of policies. + */ +public class PolicyCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List policies; + + protected PolicyCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the policies. + * + * List of policies. + * + * @return the policies + */ + public List getPolicies() { + return policies; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java new file mode 100644 index 00000000000..4033f2dbc9d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java @@ -0,0 +1,167 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The attributes of the resource. Note that only one resource is allowed in a policy. + */ +public class PolicyResource extends GenericModel { + + protected List attributes; + protected List tags; + + /** + * Builder. + */ + public static class Builder { + private List attributes; + private List tags; + + /** + * Instantiates a new Builder from an existing PolicyResource instance. + * + * @param policyResource the instance to initialize the Builder with + */ + private Builder(PolicyResource policyResource) { + this.attributes = policyResource.attributes; + this.tags = policyResource.tags; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param attributes the attributes + */ + public Builder(List attributes) { + this.attributes = attributes; + } + + /** + * Builds a PolicyResource. + * + * @return the new PolicyResource instance + */ + public PolicyResource build() { + return new PolicyResource(this); + } + + /** + * Adds a new element to attributes. + * + * @param attributes the new element to be added + * @return the PolicyResource builder + */ + public Builder addAttributes(ResourceAttribute attributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, + "attributes cannot be null"); + if (this.attributes == null) { + this.attributes = new ArrayList(); + } + this.attributes.add(attributes); + return this; + } + + /** + * Adds a new element to tags. + * + * @param tags the new element to be added + * @return the PolicyResource builder + */ + public Builder addTags(ResourceTag tags) { + com.ibm.cloud.sdk.core.util.Validator.notNull(tags, + "tags cannot be null"); + if (this.tags == null) { + this.tags = new ArrayList(); + } + this.tags.add(tags); + return this; + } + + /** + * Set the attributes. + * Existing attributes will be replaced. + * + * @param attributes the attributes + * @return the PolicyResource builder + */ + public Builder attributes(List attributes) { + this.attributes = attributes; + return this; + } + + /** + * Set the tags. + * Existing tags will be replaced. + * + * @param tags the tags + * @return the PolicyResource builder + */ + public Builder tags(List tags) { + this.tags = tags; + return this; + } + } + + protected PolicyResource() { } + + protected PolicyResource(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, + "attributes cannot be null"); + attributes = builder.attributes; + tags = builder.tags; + } + + /** + * New builder. + * + * @return a PolicyResource builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the attributes. + * + * List of resource attributes. + * + * @return the attributes + */ + public List attributes() { + return attributes; + } + + /** + * Gets the tags. + * + * List of access management tags. + * + * @return the tags + */ + public List tags() { + return tags; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java new file mode 100644 index 00000000000..7319eabce7b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java @@ -0,0 +1,131 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role associated with a policy. + */ +public class PolicyRole extends GenericModel { + + @SerializedName("role_id") + protected String roleId; + @SerializedName("display_name") + protected String displayName; + protected String description; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + + /** + * Instantiates a new Builder from an existing PolicyRole instance. + * + * @param policyRole the instance to initialize the Builder with + */ + private Builder(PolicyRole policyRole) { + this.roleId = policyRole.roleId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + */ + public Builder(String roleId) { + this.roleId = roleId; + } + + /** + * Builds a PolicyRole. + * + * @return the new PolicyRole instance + */ + public PolicyRole build() { + return new PolicyRole(this); + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the PolicyRole builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + } + + protected PolicyRole() { } + + protected PolicyRole(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleId, + "roleId cannot be null"); + roleId = builder.roleId; + } + + /** + * New builder. + * + * @return a PolicyRole builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } + + /** + * Gets the displayName. + * + * The display name of the role. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String description() { + return description; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java new file mode 100644 index 00000000000..bf1b035a6b7 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java @@ -0,0 +1,124 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The subject attribute values that must match in order for this policy to apply in a permission decision. + */ +public class PolicySubject extends GenericModel { + + protected List attributes; + + /** + * Builder. + */ + public static class Builder { + private List attributes; + + /** + * Instantiates a new Builder from an existing PolicySubject instance. + * + * @param policySubject the instance to initialize the Builder with + */ + private Builder(PolicySubject policySubject) { + this.attributes = policySubject.attributes; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param attributes the attributes + */ + public Builder(List attributes) { + this.attributes = attributes; + } + + /** + * Builds a PolicySubject. + * + * @return the new PolicySubject instance + */ + public PolicySubject build() { + return new PolicySubject(this); + } + + /** + * Adds a new element to attributes. + * + * @param attributes the new element to be added + * @return the PolicySubject builder + */ + public Builder addAttributes(SubjectAttribute attributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, + "attributes cannot be null"); + if (this.attributes == null) { + this.attributes = new ArrayList(); + } + this.attributes.add(attributes); + return this; + } + + /** + * Set the attributes. + * Existing attributes will be replaced. + * + * @param attributes the attributes + * @return the PolicySubject builder + */ + public Builder attributes(List attributes) { + this.attributes = attributes; + return this; + } + } + + protected PolicySubject() { } + + protected PolicySubject(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, + "attributes cannot be null"); + attributes = builder.attributes; + } + + /** + * New builder. + * + * @return a PolicySubject builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the attributes. + * + * List of subject attributes. + * + * @return the attributes + */ + public List attributes() { + return attributes; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java new file mode 100644 index 00000000000..bdffbe98c10 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java @@ -0,0 +1,202 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the policy template. + */ +public class PolicyTemplate extends GenericModel { + + /** + * State of policy template. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String name; + protected String description; + @SerializedName("account_id") + protected String accountId; + protected String version; + protected Boolean committed; + protected TemplatePolicy policy; + protected String state; + protected String id; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + + protected PolicyTemplate() { } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the version. + * + * Template version. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the committed. + * + * Committed status of the template version. + * + * @return the committed + */ + public Boolean isCommitted() { + return committed; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy getPolicy() { + return policy; + } + + /** + * Gets the state. + * + * State of policy template. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the id. + * + * The policy template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the policy templates API by policy template ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy template was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy template. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy template was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy template. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java new file mode 100644 index 00000000000..54727eadf4d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of policies assignments. + */ +public class PolicyTemplateAssignmentCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List assignments; + + protected PolicyTemplateAssignmentCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the assignments. + * + * List of policy assignments. + * + * @return the assignments + */ + public List getAssignments() { + return assignments; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java new file mode 100644 index 00000000000..2c8e82df441 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java @@ -0,0 +1,261 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * PolicyTemplateAssignmentItems. + * + * Classes which extend this class: + * - PolicyTemplateAssignmentItemsPolicyAssignmentV1 + * - PolicyTemplateAssignmentItemsPolicyAssignment + */ +public class PolicyTemplateAssignmentItems extends GenericModel { + + /** + * The policy assignment status. + */ + public interface Status { + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** succeeded. */ + String SUCCEEDED = "succeeded"; + /** succeed_with_errors. */ + String SUCCEED_WITH_ERRORS = "succeed_with_errors"; + /** failed. */ + String FAILED = "failed"; + } + + /** + * Assignment target type. + */ + public interface TargetType { + /** Account. */ + String ACCOUNT = "Account"; + /** AccountGroup. */ + String ACCOUNTGROUP = "AccountGroup"; + /** Enterprise. */ + String ENTERPRISE = "Enterprise"; + } + + protected AssignmentTargetDetails target; + protected String id; + @SerializedName("account_id") + protected String accountId; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected List resources; + protected PolicyAssignmentV1Subject subject; + protected AssignmentTemplateDetails template; + protected String status; + @SerializedName("template_id") + protected String templateId; + @SerializedName("template_version") + protected String templateVersion; + @SerializedName("assignment_id") + protected String assignmentId; + @SerializedName("target_type") + protected String targetType; + + protected PolicyTemplateAssignmentItems() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the id. + * + * Policy assignment ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the accountId. + * + * The account GUID that the policies assignments belong to. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the href. + * + * The href URL that links to the policies assignments API by policy assignment ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy assignment was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy assignment. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy assignment was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy assignment. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the resources. + * + * Object for each account assigned. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the subject. + * + * Subject details of access type assignment. + * + * @return the subject + */ + public PolicyAssignmentV1Subject getSubject() { + return subject; + } + + /** + * Gets the template. + * + * policy template details. + * + * @return the template + */ + public AssignmentTemplateDetails getTemplate() { + return template; + } + + /** + * Gets the status. + * + * The policy assignment status. + * + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * Gets the templateId. + * + * policy template ID. + * + * @return the templateId + */ + public String getTemplateId() { + return templateId; + } + + /** + * Gets the templateVersion. + * + * policy template version. + * + * @return the templateVersion + */ + public String getTemplateVersion() { + return templateVersion; + } + + /** + * Gets the assignmentId. + * + * Passed in value to correlate with other assignments. + * + * @return the assignmentId + */ + public String getAssignmentId() { + return assignmentId; + } + + /** + * Gets the targetType. + * + * Assignment target type. + * + * @return the targetType + */ + public String getTargetType() { + return targetType; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java new file mode 100644 index 00000000000..ec9c32e5bdd --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +/** + * The set of properties associated with the policy template assignment. + */ +public class PolicyTemplateAssignmentItemsPolicyAssignment extends PolicyTemplateAssignmentItems { + + /** + * Assignment target type. + */ + public interface TargetType { + /** Account. */ + String ACCOUNT = "Account"; + /** AccountGroup. */ + String ACCOUNTGROUP = "AccountGroup"; + /** Enterprise. */ + String ENTERPRISE = "Enterprise"; + } + + /** + * The policy assignment status. + */ + public interface Status { + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** succeeded. */ + String SUCCEEDED = "succeeded"; + /** succeed_with_errors. */ + String SUCCEED_WITH_ERRORS = "succeed_with_errors"; + /** failed. */ + String FAILED = "failed"; + } + + + protected PolicyTemplateAssignmentItemsPolicyAssignment() { } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java new file mode 100644 index 00000000000..4cebdbb17b1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.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_policy_management.v1.model; + +/** + * The set of properties associated with the policy template assignment. + */ +public class PolicyTemplateAssignmentItemsPolicyAssignmentV1 extends PolicyTemplateAssignmentItems { + + /** + * The policy assignment status. + */ + public interface Status { + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** succeeded. */ + String SUCCEEDED = "succeeded"; + /** succeed_with_errors. */ + String SUCCEED_WITH_ERRORS = "succeed_with_errors"; + /** failed. */ + String FAILED = "failed"; + } + + + protected PolicyTemplateAssignmentItemsPolicyAssignmentV1() { } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java new file mode 100644 index 00000000000..2a262c584b5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java @@ -0,0 +1,90 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of policy Templates. + */ +public class PolicyTemplateCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + @SerializedName("policy_templates") + protected List policyTemplates; + + protected PolicyTemplateCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the policyTemplates. + * + * List of policy templates. + * + * @return the policyTemplates + */ + public List getPolicyTemplates() { + return policyTemplates; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java new file mode 100644 index 00000000000..5a2876dfe28 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java @@ -0,0 +1,214 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the policy template. + */ +public class PolicyTemplateLimitData extends GenericModel { + + /** + * State of policy template. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String name; + protected String description; + @SerializedName("account_id") + protected String accountId; + protected String version; + protected Boolean committed; + protected TemplatePolicy policy; + protected String state; + protected String id; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected TemplateCountData counts; + + protected PolicyTemplateLimitData() { } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the version. + * + * Template version. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the committed. + * + * Committed status of the template version. + * + * @return the committed + */ + public Boolean isCommitted() { + return committed; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy getPolicy() { + return policy; + } + + /** + * Gets the state. + * + * State of policy template. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the id. + * + * The policy template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the policy templates API by policy template ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy template was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy template. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy template was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy template. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the counts. + * + * policy template count details. + * + * @return the counts + */ + public TemplateCountData getCounts() { + return counts; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java new file mode 100644 index 00000000000..07effc5b3ad --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java @@ -0,0 +1,201 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with a policy. + */ +public class PolicyTemplateMetaData extends GenericModel { + + /** + * The policy state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String id; + protected String type; + protected String description; + protected List subjects; + protected List roles; + protected List resources; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String state; + protected TemplateMetadata template; + + protected PolicyTemplateMetaData() { } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the description. + * + * Customer-defined description. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the subjects. + * + * The subjects associated with a policy. + * + * @return the subjects + */ + public List getSubjects() { + return subjects; + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List getRoles() { + return roles; + } + + /** + * Gets the resources. + * + * The resources associated with a policy. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the href. + * + * The href links back to the policy. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the state. + * + * The policy state. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the template. + * + * The details of the IAM template that was used to create an enterprise-managed policy in your account. When + * returned, this indicates that the policy is created from and managed by a template in the root enterprise account. + * + * @return the template + */ + public TemplateMetadata getTemplate() { + return template; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java new file mode 100644 index 00000000000..a4f95bc6562 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of versions for a specific policy template. + */ +public class PolicyTemplateVersionsCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List versions; + + protected PolicyTemplateVersionsCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the versions. + * + * List of policy templates versions. + * + * @return the versions + */ + public List getVersions() { + return versions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java new file mode 100644 index 00000000000..f6a2496cf91 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * PolicyTemplateVersionsPager can be used to simplify the use of the "listPolicyTemplateVersions" method. + */ +public class PolicyTemplateVersionsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListPolicyTemplateVersionsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected PolicyTemplateVersionsPager() { } + + /** + * Constructs a new PolicyTemplateVersionsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyTemplateVersions" method + * @param options the ListPolicyTemplateVersionsOptions instance to be used to invoke the "listPolicyTemplateVersions" method + */ + public PolicyTemplateVersionsPager(IamPolicyManagement client, ListPolicyTemplateVersionsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<PolicyTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListPolicyTemplateVersionsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + PolicyTemplateVersionsCollection result = client.listPolicyTemplateVersions(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getVersions(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<PolicyTemplate> containing all results returned by the "listPolicyTemplateVersions" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java new file mode 100644 index 00000000000..eba6e6c8fad --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * PolicyTemplatesPager can be used to simplify the use of the "listPolicyTemplates" method. + */ +public class PolicyTemplatesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListPolicyTemplatesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected PolicyTemplatesPager() { } + + /** + * Constructs a new PolicyTemplatesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyTemplates" method + * @param options the ListPolicyTemplatesOptions instance to be used to invoke the "listPolicyTemplates" method + */ + public PolicyTemplatesPager(IamPolicyManagement client, ListPolicyTemplatesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<PolicyTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListPolicyTemplatesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + PolicyTemplateCollection result = client.listPolicyTemplates(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getPolicyTemplates(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<PolicyTemplate> containing all results returned by the "listPolicyTemplates" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java new file mode 100644 index 00000000000..2656f3fb790 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Details with linking href to previous page of requested collection. + */ +public class Previous extends GenericModel { + + protected String href; + protected String start; + + protected Previous() { } + + /** + * Gets the href. + * + * The href linking to the page of requested collection. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection. + * + * @return the start + */ + public String getStart() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java new file mode 100644 index 00000000000..151a77e8cb9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java @@ -0,0 +1,273 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replaceActionControlTemplate options. + */ +public class ReplaceActionControlTemplateOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String version; + protected String ifMatch; + protected String name; + protected String description; + protected TemplateActionControl actionControl; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String version; + private String ifMatch; + private String name; + private String description; + private TemplateActionControl actionControl; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing ReplaceActionControlTemplateOptions instance. + * + * @param replaceActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(ReplaceActionControlTemplateOptions replaceActionControlTemplateOptions) { + this.actionControlTemplateId = replaceActionControlTemplateOptions.actionControlTemplateId; + this.version = replaceActionControlTemplateOptions.version; + this.ifMatch = replaceActionControlTemplateOptions.ifMatch; + this.name = replaceActionControlTemplateOptions.name; + this.description = replaceActionControlTemplateOptions.description; + this.actionControl = replaceActionControlTemplateOptions.actionControl; + this.committed = replaceActionControlTemplateOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + * @param version the version + * @param ifMatch the ifMatch + */ + public Builder(String actionControlTemplateId, String version, String ifMatch) { + this.actionControlTemplateId = actionControlTemplateId; + this.version = version; + this.ifMatch = ifMatch; + } + + /** + * Builds a ReplaceActionControlTemplateOptions. + * + * @return the new ReplaceActionControlTemplateOptions instance + */ + public ReplaceActionControlTemplateOptions build() { + return new ReplaceActionControlTemplateOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actionControl. + * + * @param actionControl the actionControl + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder actionControl(TemplateActionControl actionControl) { + this.actionControl = actionControl; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected ReplaceActionControlTemplateOptions() { } + + protected ReplaceActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + actionControlTemplateId = builder.actionControlTemplateId; + version = builder.version; + ifMatch = builder.ifMatch; + name = builder.name; + description = builder.description; + actionControl = builder.actionControl; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a ReplaceActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating an action control template version must match the Etag value of the existing + * action control template version. The Etag can be retrieved using the GET + * /v1/action_control_templates/{template_id}/versions/{version} API and looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will + * change the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the action control template. This is shown to users in the enterprise account. Use this to describe + * the purpose or context of the action control for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actionControl. + * + * The action control properties that are created in an action resource when the template is assigned. + * + * @return the actionControl + */ + public TemplateActionControl actionControl() { + return actionControl; + } + + /** + * Gets the committed. + * + * Committed status of the template version. If committed is set to true, then the template version can no longer be + * updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java new file mode 100644 index 00000000000..80cbe9e4c79 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java @@ -0,0 +1,335 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replacePolicy options. + */ +public class ReplacePolicyOptions extends GenericModel { + + protected String policyId; + protected String ifMatch; + protected String type; + protected List subjects; + protected List roles; + protected List resources; + protected String description; + + /** + * Builder. + */ + public static class Builder { + private String policyId; + private String ifMatch; + private String type; + private List subjects; + private List roles; + private List resources; + private String description; + + /** + * Instantiates a new Builder from an existing ReplacePolicyOptions instance. + * + * @param replacePolicyOptions the instance to initialize the Builder with + */ + private Builder(ReplacePolicyOptions replacePolicyOptions) { + this.policyId = replacePolicyOptions.policyId; + this.ifMatch = replacePolicyOptions.ifMatch; + this.type = replacePolicyOptions.type; + this.subjects = replacePolicyOptions.subjects; + this.roles = replacePolicyOptions.roles; + this.resources = replacePolicyOptions.resources; + this.description = replacePolicyOptions.description; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyId the policyId + * @param ifMatch the ifMatch + * @param type the type + * @param subjects the subjects + * @param roles the roles + * @param resources the resources + */ + public Builder(String policyId, String ifMatch, String type, List subjects, List roles, List resources) { + this.policyId = policyId; + this.ifMatch = ifMatch; + this.type = type; + this.subjects = subjects; + this.roles = roles; + this.resources = resources; + } + + /** + * Builds a ReplacePolicyOptions. + * + * @return the new ReplacePolicyOptions instance + */ + public ReplacePolicyOptions build() { + return new ReplacePolicyOptions(this); + } + + /** + * Adds a new element to subjects. + * + * @param subjects the new element to be added + * @return the ReplacePolicyOptions builder + */ + public Builder addSubjects(PolicySubject subjects) { + com.ibm.cloud.sdk.core.util.Validator.notNull(subjects, + "subjects cannot be null"); + if (this.subjects == null) { + this.subjects = new ArrayList(); + } + this.subjects.add(subjects); + return this; + } + + /** + * Adds a new element to roles. + * + * @param roles the new element to be added + * @return the ReplacePolicyOptions builder + */ + public Builder addRoles(PolicyRole roles) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roles, + "roles cannot be null"); + if (this.roles == null) { + this.roles = new ArrayList(); + } + this.roles.add(roles); + return this; + } + + /** + * Adds a new element to resources. + * + * @param resources the new element to be added + * @return the ReplacePolicyOptions builder + */ + public Builder addResources(PolicyResource resources) { + com.ibm.cloud.sdk.core.util.Validator.notNull(resources, + "resources cannot be null"); + if (this.resources == null) { + this.resources = new ArrayList(); + } + this.resources.add(resources); + return this; + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the ReplacePolicyOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplacePolicyOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the ReplacePolicyOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the subjects. + * Existing subjects will be replaced. + * + * @param subjects the subjects + * @return the ReplacePolicyOptions builder + */ + public Builder subjects(List subjects) { + this.subjects = subjects; + return this; + } + + /** + * Set the roles. + * Existing roles will be replaced. + * + * @param roles the roles + * @return the ReplacePolicyOptions builder + */ + public Builder roles(List roles) { + this.roles = roles; + return this; + } + + /** + * Set the resources. + * Existing resources will be replaced. + * + * @param resources the resources + * @return the ReplacePolicyOptions builder + */ + public Builder resources(List resources) { + this.resources = resources; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplacePolicyOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + } + + protected ReplacePolicyOptions() { } + + protected ReplacePolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId 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.type, + "type cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subjects, + "subjects cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, + "roles cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resources, + "resources cannot be null"); + policyId = builder.policyId; + ifMatch = builder.ifMatch; + type = builder.type; + subjects = builder.subjects; + roles = builder.roles; + resources = builder.resources; + description = builder.description; + } + + /** + * New builder. + * + * @return a ReplacePolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyId. + * + * The policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be + * retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the subjects. + * + * The subjects associated with a policy. + * + * @return the subjects + */ + public List subjects() { + return subjects; + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List roles() { + return roles; + } + + /** + * Gets the resources. + * + * The resources associated with a policy. + * + * @return the resources + */ + public List resources() { + return resources; + } + + /** + * Gets the description. + * + * Customer-defined description. + * + * @return the description + */ + public String description() { + return description; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java new file mode 100644 index 00000000000..5a55c4898e5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java @@ -0,0 +1,276 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replacePolicyTemplate options. + */ +public class ReplacePolicyTemplateOptions extends GenericModel { + + protected String policyTemplateId; + protected String version; + protected String ifMatch; + protected TemplatePolicy policy; + protected String name; + protected String description; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String version; + private String ifMatch; + private TemplatePolicy policy; + private String name; + private String description; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing ReplacePolicyTemplateOptions instance. + * + * @param replacePolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(ReplacePolicyTemplateOptions replacePolicyTemplateOptions) { + this.policyTemplateId = replacePolicyTemplateOptions.policyTemplateId; + this.version = replacePolicyTemplateOptions.version; + this.ifMatch = replacePolicyTemplateOptions.ifMatch; + this.policy = replacePolicyTemplateOptions.policy; + this.name = replacePolicyTemplateOptions.name; + this.description = replacePolicyTemplateOptions.description; + this.committed = replacePolicyTemplateOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param version the version + * @param ifMatch the ifMatch + * @param policy the policy + */ + public Builder(String policyTemplateId, String version, String ifMatch, TemplatePolicy policy) { + this.policyTemplateId = policyTemplateId; + this.version = version; + this.ifMatch = ifMatch; + this.policy = policy; + } + + /** + * Builds a ReplacePolicyTemplateOptions. + * + * @return the new ReplacePolicyTemplateOptions instance + */ + public ReplacePolicyTemplateOptions build() { + return new ReplacePolicyTemplateOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the policy. + * + * @param policy the policy + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder policy(TemplatePolicy policy) { + this.policy = policy; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected ReplacePolicyTemplateOptions() { } + + protected ReplacePolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version 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.policy, + "policy cannot be null"); + policyTemplateId = builder.policyTemplateId; + version = builder.version; + ifMatch = builder.ifMatch; + policy = builder.policy; + name = builder.name; + description = builder.description; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a ReplacePolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the version. + * + * The policy template version. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy template version and must match the Etag value of the existing policy + * template version. The Etag can be retrieved using the GET + * /v1/policy_templates/{policy_template_id}/versions/{version} API and looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy policy() { + return policy; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template version. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java new file mode 100644 index 00000000000..fc4b536103d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java @@ -0,0 +1,255 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replaceRole options. + */ +public class ReplaceRoleOptions extends GenericModel { + + protected String roleId; + protected String ifMatch; + protected String displayName; + protected List actions; + protected String description; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + private String ifMatch; + private String displayName; + private List actions; + private String description; + + /** + * Instantiates a new Builder from an existing ReplaceRoleOptions instance. + * + * @param replaceRoleOptions the instance to initialize the Builder with + */ + private Builder(ReplaceRoleOptions replaceRoleOptions) { + this.roleId = replaceRoleOptions.roleId; + this.ifMatch = replaceRoleOptions.ifMatch; + this.displayName = replaceRoleOptions.displayName; + this.actions = replaceRoleOptions.actions; + this.description = replaceRoleOptions.description; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + * @param ifMatch the ifMatch + * @param displayName the displayName + * @param actions the actions + */ + public Builder(String roleId, String ifMatch, String displayName, List actions) { + this.roleId = roleId; + this.ifMatch = ifMatch; + this.displayName = displayName; + this.actions = actions; + } + + /** + * Builds a ReplaceRoleOptions. + * + * @return the new ReplaceRoleOptions instance + */ + public ReplaceRoleOptions build() { + return new ReplaceRoleOptions(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the ReplaceRoleOptions builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the ReplaceRoleOptions builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplaceRoleOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the ReplaceRoleOptions builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the ReplaceRoleOptions builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplaceRoleOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the role. + * + * @param role the role + * @return the ReplaceRoleOptions builder + */ + public Builder role(Role role) { + this.displayName = role.displayName(); + this.actions = role.actions(); + this.description = role.description(); + return this; + } + } + + protected ReplaceRoleOptions() { } + + protected ReplaceRoleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, + "roleId 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.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + roleId = builder.roleId; + ifMatch = builder.ifMatch; + displayName = builder.displayName; + actions = builder.actions; + description = builder.description; + } + + /** + * New builder. + * + * @return a ReplaceRoleOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role ID. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a role and must match the ETag value of the existing role. The Etag can be + * retrieved using the GET /v2/roles/{role_id} API and looking at the ETag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List actions() { + return actions; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String description() { + return description; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java new file mode 100644 index 00000000000..9a69b13326c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java @@ -0,0 +1,273 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replaceRoleTemplate options. + */ +public class ReplaceRoleTemplateOptions extends GenericModel { + + protected String roleTemplateId; + protected String version; + protected String ifMatch; + protected String name; + protected String description; + protected TemplateRole role; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String version; + private String ifMatch; + private String name; + private String description; + private TemplateRole role; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing ReplaceRoleTemplateOptions instance. + * + * @param replaceRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(ReplaceRoleTemplateOptions replaceRoleTemplateOptions) { + this.roleTemplateId = replaceRoleTemplateOptions.roleTemplateId; + this.version = replaceRoleTemplateOptions.version; + this.ifMatch = replaceRoleTemplateOptions.ifMatch; + this.name = replaceRoleTemplateOptions.name; + this.description = replaceRoleTemplateOptions.description; + this.role = replaceRoleTemplateOptions.role; + this.committed = replaceRoleTemplateOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + * @param version the version + * @param ifMatch the ifMatch + */ + public Builder(String roleTemplateId, String version, String ifMatch) { + this.roleTemplateId = roleTemplateId; + this.version = version; + this.ifMatch = ifMatch; + } + + /** + * Builds a ReplaceRoleTemplateOptions. + * + * @return the new ReplaceRoleTemplateOptions instance + */ + public ReplaceRoleTemplateOptions build() { + return new ReplaceRoleTemplateOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the role. + * + * @param role the role + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder role(TemplateRole role) { + this.role = role; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected ReplaceRoleTemplateOptions() { } + + protected ReplaceRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + roleTemplateId = builder.roleTemplateId; + version = builder.version; + ifMatch = builder.ifMatch; + name = builder.name; + description = builder.description; + role = builder.role; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a ReplaceRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the version. + * + * Role template version. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a role template version must match the Etag value of the existing role template + * version. The Etag can be retrieved using the GET /v1/role_templates/{template_id}/versions/{version} API and + * looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will + * change the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the role template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the role for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the role. + * + * The role properties that are created in an action resource when the template is assigned. + * + * @return the role + */ + public TemplateRole role() { + return role; + } + + /** + * Gets the committed. + * + * Committed status of the template version. If committed is set to true, then the template version can no longer be + * updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java new file mode 100644 index 00000000000..960f4782635 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java @@ -0,0 +1,336 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replaceV2Policy options. + */ +public class ReplaceV2PolicyOptions extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + protected String id; + protected String ifMatch; + protected Control control; + protected String type; + protected String description; + protected V2PolicySubject subject; + protected V2PolicyResource resource; + protected String pattern; + protected V2PolicyRule rule; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String ifMatch; + private Control control; + private String type; + private String description; + private V2PolicySubject subject; + private V2PolicyResource resource; + private String pattern; + private V2PolicyRule rule; + + /** + * Instantiates a new Builder from an existing ReplaceV2PolicyOptions instance. + * + * @param replaceV2PolicyOptions the instance to initialize the Builder with + */ + private Builder(ReplaceV2PolicyOptions replaceV2PolicyOptions) { + this.id = replaceV2PolicyOptions.id; + this.ifMatch = replaceV2PolicyOptions.ifMatch; + this.control = replaceV2PolicyOptions.control; + this.type = replaceV2PolicyOptions.type; + this.description = replaceV2PolicyOptions.description; + this.subject = replaceV2PolicyOptions.subject; + this.resource = replaceV2PolicyOptions.resource; + this.pattern = replaceV2PolicyOptions.pattern; + this.rule = replaceV2PolicyOptions.rule; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + * @param ifMatch the ifMatch + * @param control the control + * @param type the type + */ + public Builder(String id, String ifMatch, Control control, String type) { + this.id = id; + this.ifMatch = ifMatch; + this.control = control; + this.type = type; + } + + /** + * Builds a ReplaceV2PolicyOptions. + * + * @return the new ReplaceV2PolicyOptions instance + */ + public ReplaceV2PolicyOptions build() { + return new ReplaceV2PolicyOptions(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the ReplaceV2PolicyOptions builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplaceV2PolicyOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the control. + * + * @param control the control + * @return the ReplaceV2PolicyOptions builder + */ + public Builder control(Control control) { + this.control = control; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the ReplaceV2PolicyOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplaceV2PolicyOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the subject. + * + * @param subject the subject + * @return the ReplaceV2PolicyOptions builder + */ + public Builder subject(V2PolicySubject subject) { + this.subject = subject; + return this; + } + + /** + * Set the resource. + * + * @param resource the resource + * @return the ReplaceV2PolicyOptions builder + */ + public Builder resource(V2PolicyResource resource) { + this.resource = resource; + return this; + } + + /** + * Set the pattern. + * + * @param pattern the pattern + * @return the ReplaceV2PolicyOptions builder + */ + public Builder pattern(String pattern) { + this.pattern = pattern; + return this; + } + + /** + * Set the rule. + * + * @param rule the rule + * @return the ReplaceV2PolicyOptions builder + */ + public Builder rule(V2PolicyRule rule) { + this.rule = rule; + return this; + } + } + + protected ReplaceV2PolicyOptions() { } + + protected ReplaceV2PolicyOptions(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.control, + "control cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + id = builder.id; + ifMatch = builder.ifMatch; + control = builder.control; + type = builder.type; + description = builder.description; + subject = builder.subject; + resource = builder.resource; + pattern = builder.pattern; + rule = builder.rule; + } + + /** + * New builder. + * + * @return a ReplaceV2PolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be + * retrieved using the GET /v2/policies/{id} API and looking at the ETag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the control. + * + * Specifies the type of access that is granted by the policy. + * + * @return the control + */ + public Control control() { + return control; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject subject() { + return subject; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource resource() { + return resource; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String pattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule rule() { + return rule; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java new file mode 100644 index 00000000000..3a8b7e87b9e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * An attribute associated with a resource. + */ +public class ResourceAttribute extends GenericModel { + + protected String name; + protected String value; + protected String operator; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String value; + private String operator; + + /** + * Instantiates a new Builder from an existing ResourceAttribute instance. + * + * @param resourceAttribute the instance to initialize the Builder with + */ + private Builder(ResourceAttribute resourceAttribute) { + this.name = resourceAttribute.name; + this.value = resourceAttribute.value; + this.operator = resourceAttribute.operator; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param value the value + */ + public Builder(String name, String value) { + this.name = name; + this.value = value; + } + + /** + * Builds a ResourceAttribute. + * + * @return the new ResourceAttribute instance + */ + public ResourceAttribute build() { + return new ResourceAttribute(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the ResourceAttribute builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the ResourceAttribute builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the ResourceAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + } + + protected ResourceAttribute() { } + + protected ResourceAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + name = builder.name; + value = builder.value; + operator = builder.operator; + } + + /** + * New builder. + * + * @return a ResourceAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The name of an attribute. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the value. + * + * The value of an attribute. + * + * @return the value + */ + public String value() { + return value; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java new file mode 100644 index 00000000000..7da4cffee56 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A tag associated with a resource. + */ +public class ResourceTag extends GenericModel { + + protected String name; + protected String value; + protected String operator; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String value; + private String operator; + + /** + * Instantiates a new Builder from an existing ResourceTag instance. + * + * @param resourceTag the instance to initialize the Builder with + */ + private Builder(ResourceTag resourceTag) { + this.name = resourceTag.name; + this.value = resourceTag.value; + this.operator = resourceTag.operator; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param value the value + */ + public Builder(String name, String value) { + this.name = name; + this.value = value; + } + + /** + * Builds a ResourceTag. + * + * @return the new ResourceTag instance + */ + public ResourceTag build() { + return new ResourceTag(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the ResourceTag builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the ResourceTag builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the ResourceTag builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + } + + protected ResourceTag() { } + + protected ResourceTag(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + name = builder.name; + value = builder.value; + operator = builder.operator; + } + + /** + * New builder. + * + * @return a ResourceTag builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The name of an access management tag. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the value. + * + * The value of an access management tag. + * + * @return the value + */ + public String value() { + return value; + } + + /** + * Gets the operator. + * + * The operator of an access management tag. + * + * @return the operator + */ + public String operator() { + return operator; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java new file mode 100644 index 00000000000..24b99c9bd08 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java @@ -0,0 +1,196 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role resource. + */ +public class Role extends GenericModel { + + @SerializedName("display_name") + protected String displayName; + protected String description; + protected List actions; + protected String crn; + + /** + * Builder. + */ + public static class Builder { + private String displayName; + private String description; + private List actions; + + /** + * Instantiates a new Builder from an existing Role instance. + * + * @param role the instance to initialize the Builder with + */ + private Builder(Role role) { + this.displayName = role.displayName; + this.description = role.description; + this.actions = role.actions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param displayName the displayName + * @param actions the actions + */ + public Builder(String displayName, List actions) { + this.displayName = displayName; + this.actions = actions; + } + + /** + * Builds a Role. + * + * @return the new Role instance + */ + public Role build() { + return new Role(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the Role builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the Role builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the Role builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the Role builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + } + + protected Role() { } + + protected Role(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + displayName = builder.displayName; + description = builder.description; + actions = builder.actions; + } + + /** + * New builder. + * + * @return a Role builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List actions() { + return actions; + } + + /** + * Gets the crn. + * + * The role Cloud Resource Name (CRN). Example CRN: + * 'crn:v1:ibmcloud:public:iam-access-management::a/exampleAccountId::customRole:ExampleRoleName'. + * + * @return the crn + */ + public String crn() { + return crn; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java new file mode 100644 index 00000000000..9169fc88572 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java @@ -0,0 +1,64 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * An action that can be performed by the policy subject when assigned a role. + */ +public class RoleAction extends GenericModel { + + protected String id; + @SerializedName("display_name") + protected String displayName; + protected String description; + + protected RoleAction() { } + + /** + * Gets the id. + * + * Unique identifier for action with structure service.resource.action. For example, cbr.rule.read. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the displayName. + * + * Services defined display name for action. + * + * @return the displayName + */ + public String getDisplayName() { + return displayName; + } + + /** + * Gets the description. + * + * Service defined description for action. + * + * @return the description + */ + public String getDescription() { + return description; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java new file mode 100644 index 00000000000..23bb4b65c6f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java @@ -0,0 +1,207 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the assigned role template. + */ +public class RoleAssignment extends GenericModel { + + /** + * The current operation of the role assignment. + */ + public interface Operation { + /** create. */ + String CREATE = "create"; + /** apply. */ + String APPLY = "apply"; + /** update. */ + String UPDATE = "update"; + /** remove. */ + String REMOVE = "remove"; + } + + /** + * The role assignment status. + */ + public interface Status { + /** accepted. */ + String ACCEPTED = "accepted"; + /** failure. */ + String FAILURE = "failure"; + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** superseded. */ + String SUPERSEDED = "superseded"; + } + + protected String id; + @SerializedName("account_id") + protected String accountId; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String operation; + protected List resources; + protected RoleAssignmentTemplate template; + protected AssignmentTargetDetails target; + protected String status; + + protected RoleAssignment() { } + + /** + * Gets the id. + * + * Action control assignment ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the accountId. + * + * The account GUID that the role assignments belong to. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the href. + * + * The href URL that links to the role assignments API by role assignment ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the role assignment was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the role assignment. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the role assignment was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the role assignment. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the operation. + * + * The current operation of the role assignment. + * + * @return the operation + */ + public String getOperation() { + return operation; + } + + /** + * Gets the resources. + * + * Resources created when role template is assigned. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the template. + * + * The role template id and version that will be assigned. + * + * @return the template + */ + public RoleAssignmentTemplate getTemplate() { + return template; + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the status. + * + * The role assignment status. + * + * @return the status + */ + public String getStatus() { + return status; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java new file mode 100644 index 00000000000..658ac5b8c99 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of role assignments. + */ +public class RoleAssignmentCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List assignments; + + protected RoleAssignmentCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the assignments. + * + * List of role assignments. + * + * @return the assignments + */ + public List getAssignments() { + return assignments; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java new file mode 100644 index 00000000000..60d7a02d604 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The role assignment resources and target where the template is assigned. + */ +public class RoleAssignmentResource extends GenericModel { + + protected AssignmentTargetDetails target; + protected RoleAssignmentResourceRole role; + + protected RoleAssignmentResource() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the role. + * + * Set of properties of the assigned resource or error message if assignment failed. + * + * @return the role + */ + public RoleAssignmentResourceRole getRole() { + return role; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java new file mode 100644 index 00000000000..9ea359d63fb --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * On success, it includes the role assigned. + */ +public class RoleAssignmentResourceCreated extends GenericModel { + + protected String id; + + protected RoleAssignmentResourceCreated() { } + + /** + * Gets the id. + * + * role id. + * + * @return the id + */ + public String getId() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java new file mode 100644 index 00000000000..22d40bdaef4 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Set of properties of the assigned resource or error message if assignment failed. + */ +public class RoleAssignmentResourceRole extends GenericModel { + + @SerializedName("resource_created") + protected RoleAssignmentResourceCreated resourceCreated; + @SerializedName("error_message") + protected AssignmentResourceError errorMessage; + + protected RoleAssignmentResourceRole() { } + + /** + * Gets the resourceCreated. + * + * On success, it includes the role assigned. + * + * @return the resourceCreated + */ + public RoleAssignmentResourceCreated getResourceCreated() { + return resourceCreated; + } + + /** + * Gets the errorMessage. + * + * Body parameters for assignment error. + * + * @return the errorMessage + */ + public AssignmentResourceError getErrorMessage() { + return errorMessage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java new file mode 100644 index 00000000000..3524b91f4d5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The role template id and version that will be assigned. + */ +public class RoleAssignmentTemplate extends GenericModel { + + protected String id; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String version; + + /** + * Instantiates a new Builder from an existing RoleAssignmentTemplate instance. + * + * @param roleAssignmentTemplate the instance to initialize the Builder with + */ + private Builder(RoleAssignmentTemplate roleAssignmentTemplate) { + this.id = roleAssignmentTemplate.id; + this.version = roleAssignmentTemplate.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + * @param version the version + */ + public Builder(String id, String version) { + this.id = id; + this.version = version; + } + + /** + * Builds a RoleAssignmentTemplate. + * + * @return the new RoleAssignmentTemplate instance + */ + public RoleAssignmentTemplate build() { + return new RoleAssignmentTemplate(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the RoleAssignmentTemplate builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the RoleAssignmentTemplate builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected RoleAssignmentTemplate() { } + + protected RoleAssignmentTemplate(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, + "id cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + id = builder.id; + version = builder.version; + } + + /** + * New builder. + * + * @return a RoleAssignmentTemplate builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * Action control template ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java new file mode 100644 index 00000000000..16296a82e40 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * RoleAssignmentsPager can be used to simplify the use of the "listRoleAssignments" method. + */ +public class RoleAssignmentsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListRoleAssignmentsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected RoleAssignmentsPager() { } + + /** + * Constructs a new RoleAssignmentsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listRoleAssignments" method + * @param options the ListRoleAssignmentsOptions instance to be used to invoke the "listRoleAssignments" method + */ + public RoleAssignmentsPager(IamPolicyManagement client, ListRoleAssignmentsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<RoleAssignment> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListRoleAssignmentsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + RoleAssignmentCollection result = client.listRoleAssignments(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getAssignments(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<RoleAssignment> containing all results returned by the "listRoleAssignments" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java new file mode 100644 index 00000000000..282730a2dfc --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java @@ -0,0 +1,68 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of roles returned by the 'list roles' operation. + */ +public class RoleCollection extends GenericModel { + + @SerializedName("custom_roles") + protected List customRoles; + @SerializedName("service_roles") + protected List serviceRoles; + @SerializedName("system_roles") + protected List systemRoles; + + protected RoleCollection() { } + + /** + * Gets the customRoles. + * + * List of custom roles. + * + * @return the customRoles + */ + public List getCustomRoles() { + return customRoles; + } + + /** + * Gets the serviceRoles. + * + * List of service roles. + * + * @return the serviceRoles + */ + public List getServiceRoles() { + return serviceRoles; + } + + /** + * Gets the systemRoles. + * + * List of system roles. + * + * @return the systemRoles + */ + public List getSystemRoles() { + return systemRoles; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java new file mode 100644 index 00000000000..663d0f7f1d0 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java @@ -0,0 +1,202 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the role template. + */ +public class RoleTemplate extends GenericModel { + + /** + * State of role template. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String name; + protected String description; + @SerializedName("account_id") + protected String accountId; + protected Boolean committed; + protected RoleTemplatePrototypeRole role; + protected String id; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String version; + protected String state; + + protected RoleTemplate() { } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Description of the role template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the role for enterprise users managing IAM templates. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the committed. + * + * Committed status of the template. If committed is set to true, then the template version can no longer be updated. + * + * @return the committed + */ + public Boolean isCommitted() { + return committed; + } + + /** + * Gets the role. + * + * The role properties that are created in an action resource when the template is assigned. + * + * @return the role + */ + public RoleTemplatePrototypeRole getRole() { + return role; + } + + /** + * Gets the id. + * + * The role template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the role templates API by role template ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the role template was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the role template. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the role template was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the role template. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the version. + * + * The version number of the template used to identify different versions of same template. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the state. + * + * State of role template. + * + * @return the state + */ + public String getState() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java new file mode 100644 index 00000000000..22a739b4a58 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java @@ -0,0 +1,90 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of role templates. + */ +public class RoleTemplateCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + @SerializedName("role_templates") + protected List roleTemplates; + + protected RoleTemplateCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the roleTemplates. + * + * List of role templates. + * + * @return the roleTemplates + */ + public List getRoleTemplates() { + return roleTemplates; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java new file mode 100644 index 00000000000..43197620689 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java @@ -0,0 +1,239 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The role properties that are created in an action resource when the template is assigned. + */ +public class RoleTemplatePrototypeRole extends GenericModel { + + protected String name; + @SerializedName("display_name") + protected String displayName; + @SerializedName("service_name") + protected String serviceName; + protected String description; + protected List actions; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String displayName; + private String serviceName; + private String description; + private List actions; + + /** + * Instantiates a new Builder from an existing RoleTemplatePrototypeRole instance. + * + * @param roleTemplatePrototypeRole the instance to initialize the Builder with + */ + private Builder(RoleTemplatePrototypeRole roleTemplatePrototypeRole) { + this.name = roleTemplatePrototypeRole.name; + this.displayName = roleTemplatePrototypeRole.displayName; + this.serviceName = roleTemplatePrototypeRole.serviceName; + this.description = roleTemplatePrototypeRole.description; + this.actions = roleTemplatePrototypeRole.actions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param displayName the displayName + * @param actions the actions + */ + public Builder(String name, String displayName, List actions) { + this.name = name; + this.displayName = displayName; + this.actions = actions; + } + + /** + * Builds a RoleTemplatePrototypeRole. + * + * @return the new RoleTemplatePrototypeRole instance + */ + public RoleTemplatePrototypeRole build() { + return new RoleTemplatePrototypeRole(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the RoleTemplatePrototypeRole builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the RoleTemplatePrototypeRole builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the RoleTemplatePrototypeRole builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the RoleTemplatePrototypeRole builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the RoleTemplatePrototypeRole builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the RoleTemplatePrototypeRole builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + } + + protected RoleTemplatePrototypeRole() { } + + protected RoleTemplatePrototypeRole(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + name = builder.name; + displayName = builder.displayName; + serviceName = builder.serviceName; + description = builder.description; + actions = builder.actions; + } + + /** + * New builder. + * + * @return a RoleTemplatePrototypeRole builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the serviceName. + * + * The service name that the role refers. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the description. + * + * Description of the role. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. + * + * @return the actions + */ + public List actions() { + return actions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java new file mode 100644 index 00000000000..673ff7f9750 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role template reference associated with a policy template. + */ +public class RoleTemplateReferencesItem extends GenericModel { + + protected String id; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String version; + + /** + * Instantiates a new Builder from an existing RoleTemplateReferencesItem instance. + * + * @param roleTemplateReferencesItem the instance to initialize the Builder with + */ + private Builder(RoleTemplateReferencesItem roleTemplateReferencesItem) { + this.id = roleTemplateReferencesItem.id; + this.version = roleTemplateReferencesItem.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + * @param version the version + */ + public Builder(String id, String version) { + this.id = id; + this.version = version; + } + + /** + * Builds a RoleTemplateReferencesItem. + * + * @return the new RoleTemplateReferencesItem instance + */ + public RoleTemplateReferencesItem build() { + return new RoleTemplateReferencesItem(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the RoleTemplateReferencesItem builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the RoleTemplateReferencesItem builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected RoleTemplateReferencesItem() { } + + protected RoleTemplateReferencesItem(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, + "id cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + id = builder.id; + version = builder.version; + } + + /** + * New builder. + * + * @return a RoleTemplateReferencesItem builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The role template ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the version. + * + * Role template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java new file mode 100644 index 00000000000..a983208afe3 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of versions for a specific role template. + */ +public class RoleTemplateVersionsCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List versions; + + protected RoleTemplateVersionsCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the versions. + * + * List of role templates versions. + * + * @return the versions + */ + public List getVersions() { + return versions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java new file mode 100644 index 00000000000..7af200cd72f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * RoleTemplateVersionsPager can be used to simplify the use of the "listRoleTemplateVersions" method. + */ +public class RoleTemplateVersionsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListRoleTemplateVersionsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected RoleTemplateVersionsPager() { } + + /** + * Constructs a new RoleTemplateVersionsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listRoleTemplateVersions" method + * @param options the ListRoleTemplateVersionsOptions instance to be used to invoke the "listRoleTemplateVersions" method + */ + public RoleTemplateVersionsPager(IamPolicyManagement client, ListRoleTemplateVersionsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<RoleTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListRoleTemplateVersionsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + RoleTemplateVersionsCollection result = client.listRoleTemplateVersions(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getVersions(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<RoleTemplate> containing all results returned by the "listRoleTemplateVersions" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java new file mode 100644 index 00000000000..3654e0757ba --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * RoleTemplatesPager can be used to simplify the use of the "listRoleTemplates" method. + */ +public class RoleTemplatesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListRoleTemplatesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected RoleTemplatesPager() { } + + /** + * Constructs a new RoleTemplatesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listRoleTemplates" method + * @param options the ListRoleTemplatesOptions instance to be used to invoke the "listRoleTemplates" method + */ + public RoleTemplatesPager(IamPolicyManagement client, ListRoleTemplatesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<RoleTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListRoleTemplatesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + RoleTemplateCollection result = client.listRoleTemplates(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getRoleTemplates(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<RoleTemplate> containing all results returned by the "listRoleTemplates" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java new file mode 100644 index 00000000000..03b6ff75eb1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java @@ -0,0 +1,106 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role associated with a policy. + */ +public class Roles extends GenericModel { + + @SerializedName("role_id") + protected String roleId; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + + /** + * Instantiates a new Builder from an existing Roles instance. + * + * @param roles the instance to initialize the Builder with + */ + private Builder(Roles roles) { + this.roleId = roles.roleId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + */ + public Builder(String roleId) { + this.roleId = roleId; + } + + /** + * Builds a Roles. + * + * @return the new Roles instance + */ + public Roles build() { + return new Roles(this); + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the Roles builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + } + + protected Roles() { } + + protected Roles(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleId, + "roleId cannot be null"); + roleId = builder.roleId; + } + + /** + * New builder. + * + * @return a Roles builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java new file mode 100644 index 00000000000..fbf66d53ae1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java @@ -0,0 +1,209 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Rule that specifies additional access that is granted (For example, time-based condition). + */ +public class RuleAttribute extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + protected String key; + protected String operator; + protected Object value; + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing RuleAttribute instance. + * + * @param ruleAttribute the instance to initialize the Builder with + */ + private Builder(RuleAttribute ruleAttribute) { + this.key = ruleAttribute.key; + this.operator = ruleAttribute.operator; + this.value = ruleAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a RuleAttribute. + * + * @return the new RuleAttribute instance + */ + public RuleAttribute build() { + return new RuleAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the RuleAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the RuleAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the RuleAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected RuleAttribute() { } + + protected RuleAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a RuleAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the key. + * + * The name of an attribute. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java new file mode 100644 index 00000000000..d7e54e112c5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * An attribute associated with a subject. + */ +public class SubjectAttribute extends GenericModel { + + protected String name; + protected String value; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String value; + + /** + * Instantiates a new Builder from an existing SubjectAttribute instance. + * + * @param subjectAttribute the instance to initialize the Builder with + */ + private Builder(SubjectAttribute subjectAttribute) { + this.name = subjectAttribute.name; + this.value = subjectAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param value the value + */ + public Builder(String name, String value) { + this.name = name; + this.value = value; + } + + /** + * Builds a SubjectAttribute. + * + * @return the new SubjectAttribute instance + */ + public SubjectAttribute build() { + return new SubjectAttribute(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the SubjectAttribute builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the SubjectAttribute builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + } + + protected SubjectAttribute() { } + + protected SubjectAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + name = builder.name; + value = builder.value; + } + + /** + * New builder. + * + * @return a SubjectAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The name of an attribute. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the value. + * + * The value of an attribute. + * + * @return the value + */ + public String value() { + return value; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java new file mode 100644 index 00000000000..62f4bd77f87 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java @@ -0,0 +1,182 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The action control properties that are created in an action resource when the template is assigned. + */ +public class TemplateActionControl extends GenericModel { + + @SerializedName("service_name") + protected String serviceName; + protected String description; + protected List actions; + + /** + * Builder. + */ + public static class Builder { + private String serviceName; + private String description; + private List actions; + + /** + * Instantiates a new Builder from an existing TemplateActionControl instance. + * + * @param templateActionControl the instance to initialize the Builder with + */ + private Builder(TemplateActionControl templateActionControl) { + this.serviceName = templateActionControl.serviceName; + this.description = templateActionControl.description; + this.actions = templateActionControl.actions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param serviceName the serviceName + * @param actions the actions + */ + public Builder(String serviceName, List actions) { + this.serviceName = serviceName; + this.actions = actions; + } + + /** + * Builds a TemplateActionControl. + * + * @return the new TemplateActionControl instance + */ + public TemplateActionControl build() { + return new TemplateActionControl(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the TemplateActionControl builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the TemplateActionControl builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the TemplateActionControl builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the TemplateActionControl builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + } + + protected TemplateActionControl() { } + + protected TemplateActionControl(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, + "serviceName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + serviceName = builder.serviceName; + description = builder.description; + actions = builder.actions; + } + + /** + * New builder. + * + * @return a TemplateActionControl builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the serviceName. + * + * The service name that the action control refers. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the description. + * + * Description of the action control. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actions. + * + * List of actions to control access. + * + * @return the actions + */ + public List actions() { + return actions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java new file mode 100644 index 00000000000..c74a77d9b6d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Specifies the type of access that is granted by the policy. + */ +public class TemplateControl extends GenericModel { + + protected TemplateGrant grant; + + /** + * Builder. + */ + public static class Builder { + private TemplateGrant grant; + + /** + * Instantiates a new Builder from an existing TemplateControl instance. + * + * @param templateControl the instance to initialize the Builder with + */ + private Builder(TemplateControl templateControl) { + this.grant = templateControl.grant; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param grant the grant + */ + public Builder(TemplateGrant grant) { + this.grant = grant; + } + + /** + * Builds a TemplateControl. + * + * @return the new TemplateControl instance + */ + public TemplateControl build() { + return new TemplateControl(this); + } + + /** + * Set the grant. + * + * @param grant the grant + * @return the TemplateControl builder + */ + public Builder grant(TemplateGrant grant) { + this.grant = grant; + return this; + } + } + + protected TemplateControl() { } + + protected TemplateControl(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.grant, + "grant cannot be null"); + grant = builder.grant; + } + + /** + * New builder. + * + * @return a TemplateControl builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the grant. + * + * Permission is granted by the policy. + * + * @return the grant + */ + public TemplateGrant grant() { + return grant; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java new file mode 100644 index 00000000000..edb134e1270 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * policy template count details. + */ +public class TemplateCountData extends GenericModel { + + protected LimitData template; + protected LimitData version; + + protected TemplateCountData() { } + + /** + * Gets the template. + * + * policy template current and limit details with in an account. + * + * @return the template + */ + public LimitData getTemplate() { + return template; + } + + /** + * Gets the version. + * + * policy template current and limit details with in an account. + * + * @return the version + */ + public LimitData getVersion() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java new file mode 100644 index 00000000000..fd0daff9665 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java @@ -0,0 +1,58 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Permission is granted by the policy. + * + * Classes which extend this class: + * - TemplateGrantRoles + * - TemplateGrantRoleReferences + */ +public class TemplateGrant extends GenericModel { + + protected List roles; + @SerializedName("role_template_references") + protected List roleTemplateReferences; + + protected TemplateGrant() { } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List roles() { + return roles; + } + + /** + * Gets the roleTemplateReferences. + * + * A set of role template reference IDs granted by the policy. + * + * @return the roleTemplateReferences + */ + public List roleTemplateReferences() { + return roleTemplateReferences; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java new file mode 100644 index 00000000000..248eb121b72 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java @@ -0,0 +1,110 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * TemplateGrantRoleReferences. + */ +public class TemplateGrantRoleReferences extends TemplateGrant { + + + /** + * Builder. + */ + public static class Builder { + private List roleTemplateReferences; + + /** + * Instantiates a new Builder from an existing TemplateGrantRoleReferences instance. + * + * @param templateGrantRoleReferences the instance to initialize the Builder with + */ + public Builder(TemplateGrant templateGrantRoleReferences) { + this.roleTemplateReferences = templateGrantRoleReferences.roleTemplateReferences; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateReferences the roleTemplateReferences + */ + public Builder(List roleTemplateReferences) { + this.roleTemplateReferences = roleTemplateReferences; + } + + /** + * Builds a TemplateGrantRoleReferences. + * + * @return the new TemplateGrantRoleReferences instance + */ + public TemplateGrantRoleReferences build() { + return new TemplateGrantRoleReferences(this); + } + + /** + * Adds a new element to roleTemplateReferences. + * + * @param roleTemplateReferences the new element to be added + * @return the TemplateGrantRoleReferences builder + */ + public Builder addRoleTemplateReferences(RoleTemplateReferencesItem roleTemplateReferences) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roleTemplateReferences, + "roleTemplateReferences cannot be null"); + if (this.roleTemplateReferences == null) { + this.roleTemplateReferences = new ArrayList(); + } + this.roleTemplateReferences.add(roleTemplateReferences); + return this; + } + + /** + * Set the roleTemplateReferences. + * Existing roleTemplateReferences will be replaced. + * + * @param roleTemplateReferences the roleTemplateReferences + * @return the TemplateGrantRoleReferences builder + */ + public Builder roleTemplateReferences(List roleTemplateReferences) { + this.roleTemplateReferences = roleTemplateReferences; + return this; + } + } + + protected TemplateGrantRoleReferences() { } + + protected TemplateGrantRoleReferences(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleTemplateReferences, + "roleTemplateReferences cannot be null"); + roleTemplateReferences = builder.roleTemplateReferences; + } + + /** + * New builder. + * + * @return a TemplateGrantRoleReferences builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java new file mode 100644 index 00000000000..6524b3645eb --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java @@ -0,0 +1,110 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * TemplateGrantRoles. + */ +public class TemplateGrantRoles extends TemplateGrant { + + + /** + * Builder. + */ + public static class Builder { + private List roles; + + /** + * Instantiates a new Builder from an existing TemplateGrantRoles instance. + * + * @param templateGrantRoles the instance to initialize the Builder with + */ + public Builder(TemplateGrant templateGrantRoles) { + this.roles = templateGrantRoles.roles; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roles the roles + */ + public Builder(List roles) { + this.roles = roles; + } + + /** + * Builds a TemplateGrantRoles. + * + * @return the new TemplateGrantRoles instance + */ + public TemplateGrantRoles build() { + return new TemplateGrantRoles(this); + } + + /** + * Adds a new element to roles. + * + * @param roles the new element to be added + * @return the TemplateGrantRoles builder + */ + public Builder addRoles(Roles roles) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roles, + "roles cannot be null"); + if (this.roles == null) { + this.roles = new ArrayList(); + } + this.roles.add(roles); + return this; + } + + /** + * Set the roles. + * Existing roles will be replaced. + * + * @param roles the roles + * @return the TemplateGrantRoles builder + */ + public Builder roles(List roles) { + this.roles = roles; + return this; + } + } + + protected TemplateGrantRoles() { } + + protected TemplateGrantRoles(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, + "roles cannot be null"); + roles = builder.roles; + } + + /** + * New builder. + * + * @return a TemplateGrantRoles builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java new file mode 100644 index 00000000000..41f112312cd --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java @@ -0,0 +1,91 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The details of the IAM template that was used to create an enterprise-managed policy in your account. When returned, + * this indicates that the policy is created from and managed by a template in the root enterprise account. + */ +public class TemplateMetadata extends GenericModel { + + protected String id; + protected String version; + @SerializedName("assignment_id") + protected String assignmentId; + @SerializedName("root_id") + protected String rootId; + @SerializedName("root_version") + protected String rootVersion; + + protected TemplateMetadata() { } + + /** + * Gets the id. + * + * The policy template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the version. + * + * Template version. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the assignmentId. + * + * Policy assignment ID. + * + * @return the assignmentId + */ + public String getAssignmentId() { + return assignmentId; + } + + /** + * Gets the rootId. + * + * Orchestrator template ID. + * + * @return the rootId + */ + public String getRootId() { + return rootId; + } + + /** + * Gets the rootVersion. + * + * Orchestrator template version. + * + * @return the rootVersion + */ + public String getRootVersion() { + return rootVersion; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java new file mode 100644 index 00000000000..496b2e70e40 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java @@ -0,0 +1,272 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the template's policy object. + */ +public class TemplatePolicy extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + protected String type; + protected String description; + protected V2PolicyResource resource; + protected V2PolicySubject subject; + protected String pattern; + protected V2PolicyRule rule; + protected TemplateControl control; + + /** + * Builder. + */ + public static class Builder { + private String type; + private String description; + private V2PolicyResource resource; + private V2PolicySubject subject; + private String pattern; + private V2PolicyRule rule; + private TemplateControl control; + + /** + * Instantiates a new Builder from an existing TemplatePolicy instance. + * + * @param templatePolicy the instance to initialize the Builder with + */ + private Builder(TemplatePolicy templatePolicy) { + this.type = templatePolicy.type; + this.description = templatePolicy.description; + this.resource = templatePolicy.resource; + this.subject = templatePolicy.subject; + this.pattern = templatePolicy.pattern; + this.rule = templatePolicy.rule; + this.control = templatePolicy.control; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param type the type + */ + public Builder(String type) { + this.type = type; + } + + /** + * Builds a TemplatePolicy. + * + * @return the new TemplatePolicy instance + */ + public TemplatePolicy build() { + return new TemplatePolicy(this); + } + + /** + * Set the type. + * + * @param type the type + * @return the TemplatePolicy builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the TemplatePolicy builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the resource. + * + * @param resource the resource + * @return the TemplatePolicy builder + */ + public Builder resource(V2PolicyResource resource) { + this.resource = resource; + return this; + } + + /** + * Set the subject. + * + * @param subject the subject + * @return the TemplatePolicy builder + */ + public Builder subject(V2PolicySubject subject) { + this.subject = subject; + return this; + } + + /** + * Set the pattern. + * + * @param pattern the pattern + * @return the TemplatePolicy builder + */ + public Builder pattern(String pattern) { + this.pattern = pattern; + return this; + } + + /** + * Set the rule. + * + * @param rule the rule + * @return the TemplatePolicy builder + */ + public Builder rule(V2PolicyRule rule) { + this.rule = rule; + return this; + } + + /** + * Set the control. + * + * @param control the control + * @return the TemplatePolicy builder + */ + public Builder control(TemplateControl control) { + this.control = control; + return this; + } + } + + protected TemplatePolicy() { } + + protected TemplatePolicy(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + type = builder.type; + description = builder.description; + resource = builder.resource; + subject = builder.subject; + pattern = builder.pattern; + rule = builder.rule; + control = builder.control; + } + + /** + * New builder. + * + * @return a TemplatePolicy builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. This is shown in child accounts when an access group or trusted profile template uses + * the policy template to assign access. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource resource() { + return resource; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject subject() { + return subject; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String pattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule rule() { + return rule; + } + + /** + * Gets the control. + * + * Specifies the type of access that is granted by the policy. + * + * @return the control + */ + public TemplateControl control() { + return control; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java new file mode 100644 index 00000000000..b76beb3bddb --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java @@ -0,0 +1,209 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The role properties that are created in an action resource when the template is assigned. + */ +public class TemplateRole extends GenericModel { + + @SerializedName("display_name") + protected String displayName; + @SerializedName("service_name") + protected String serviceName; + protected String description; + protected List actions; + + /** + * Builder. + */ + public static class Builder { + private String displayName; + private String serviceName; + private String description; + private List actions; + + /** + * Instantiates a new Builder from an existing TemplateRole instance. + * + * @param templateRole the instance to initialize the Builder with + */ + private Builder(TemplateRole templateRole) { + this.displayName = templateRole.displayName; + this.serviceName = templateRole.serviceName; + this.description = templateRole.description; + this.actions = templateRole.actions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param displayName the displayName + * @param actions the actions + */ + public Builder(String displayName, List actions) { + this.displayName = displayName; + this.actions = actions; + } + + /** + * Builds a TemplateRole. + * + * @return the new TemplateRole instance + */ + public TemplateRole build() { + return new TemplateRole(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the TemplateRole builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the TemplateRole builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the TemplateRole builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the TemplateRole builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the TemplateRole builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + } + + protected TemplateRole() { } + + protected TemplateRole(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + displayName = builder.displayName; + serviceName = builder.serviceName; + description = builder.description; + actions = builder.actions; + } + + /** + * New builder. + * + * @return a TemplateRole builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the serviceName. + * + * The service name that the role refers. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the description. + * + * Description of the role. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. + * + * @return the actions + */ + public List actions() { + return actions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java new file mode 100644 index 00000000000..caf2f737b55 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java @@ -0,0 +1,166 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updateActionControlAssignment options. + */ +public class UpdateActionControlAssignmentOptions extends GenericModel { + + protected String assignmentId; + protected String ifMatch; + protected String templateVersion; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + private String ifMatch; + private String templateVersion; + + /** + * Instantiates a new Builder from an existing UpdateActionControlAssignmentOptions instance. + * + * @param updateActionControlAssignmentOptions the instance to initialize the Builder with + */ + private Builder(UpdateActionControlAssignmentOptions updateActionControlAssignmentOptions) { + this.assignmentId = updateActionControlAssignmentOptions.assignmentId; + this.ifMatch = updateActionControlAssignmentOptions.ifMatch; + this.templateVersion = updateActionControlAssignmentOptions.templateVersion; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + * @param ifMatch the ifMatch + * @param templateVersion the templateVersion + */ + public Builder(String assignmentId, String ifMatch, String templateVersion) { + this.assignmentId = assignmentId; + this.ifMatch = ifMatch; + this.templateVersion = templateVersion; + } + + /** + * Builds a UpdateActionControlAssignmentOptions. + * + * @return the new UpdateActionControlAssignmentOptions instance + */ + public UpdateActionControlAssignmentOptions build() { + return new UpdateActionControlAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the UpdateActionControlAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdateActionControlAssignmentOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the UpdateActionControlAssignmentOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + } + + protected UpdateActionControlAssignmentOptions() { } + + protected UpdateActionControlAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId 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.templateVersion, + "templateVersion cannot be null"); + assignmentId = builder.assignmentId; + ifMatch = builder.ifMatch; + templateVersion = builder.templateVersion; + } + + /** + * New builder. + * + * @return a UpdateActionControlAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Action control template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating an action control assignment and must match the Etag value of the existing action + * control assignment. The Etag can be retrieved using the GET /v1/action_control_assignments/{assignment_id} API and + * looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the templateVersion. + * + * The version number of the template used to identify different versions of same template. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java new file mode 100644 index 00000000000..869eb357802 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java @@ -0,0 +1,196 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updatePolicyAssignment options. + */ +public class UpdatePolicyAssignmentOptions extends GenericModel { + + protected String assignmentId; + protected String version; + protected String ifMatch; + protected String templateVersion; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + private String version; + private String ifMatch; + private String templateVersion; + + /** + * Instantiates a new Builder from an existing UpdatePolicyAssignmentOptions instance. + * + * @param updatePolicyAssignmentOptions the instance to initialize the Builder with + */ + private Builder(UpdatePolicyAssignmentOptions updatePolicyAssignmentOptions) { + this.assignmentId = updatePolicyAssignmentOptions.assignmentId; + this.version = updatePolicyAssignmentOptions.version; + this.ifMatch = updatePolicyAssignmentOptions.ifMatch; + this.templateVersion = updatePolicyAssignmentOptions.templateVersion; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + * @param version the version + * @param ifMatch the ifMatch + * @param templateVersion the templateVersion + */ + public Builder(String assignmentId, String version, String ifMatch, String templateVersion) { + this.assignmentId = assignmentId; + this.version = version; + this.ifMatch = ifMatch; + this.templateVersion = templateVersion; + } + + /** + * Builds a UpdatePolicyAssignmentOptions. + * + * @return the new UpdatePolicyAssignmentOptions instance + */ + public UpdatePolicyAssignmentOptions build() { + return new UpdatePolicyAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the UpdatePolicyAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the UpdatePolicyAssignmentOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdatePolicyAssignmentOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the UpdatePolicyAssignmentOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + } + + protected UpdatePolicyAssignmentOptions() { } + + protected UpdatePolicyAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templateVersion, + "templateVersion cannot be null"); + assignmentId = builder.assignmentId; + version = builder.version; + ifMatch = builder.ifMatch; + templateVersion = builder.templateVersion; + } + + /** + * New builder. + * + * @return a UpdatePolicyAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * The policy template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } + + /** + * Gets the version. + * + * specify version of response body format. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy assignment and must match the Etag value of the existing policy + * assignment. The Etag can be retrieved using the GET /v1/policy_assignments/{assignment_id} API and looking at the + * Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the templateVersion. + * + * The policy template version to update to. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java new file mode 100644 index 00000000000..a28b357641f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java @@ -0,0 +1,171 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updatePolicyState options. + */ +public class UpdatePolicyStateOptions extends GenericModel { + + /** + * The policy state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String policyId; + protected String ifMatch; + protected String state; + + /** + * Builder. + */ + public static class Builder { + private String policyId; + private String ifMatch; + private String state; + + /** + * Instantiates a new Builder from an existing UpdatePolicyStateOptions instance. + * + * @param updatePolicyStateOptions the instance to initialize the Builder with + */ + private Builder(UpdatePolicyStateOptions updatePolicyStateOptions) { + this.policyId = updatePolicyStateOptions.policyId; + this.ifMatch = updatePolicyStateOptions.ifMatch; + this.state = updatePolicyStateOptions.state; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyId the policyId + * @param ifMatch the ifMatch + */ + public Builder(String policyId, String ifMatch) { + this.policyId = policyId; + this.ifMatch = ifMatch; + } + + /** + * Builds a UpdatePolicyStateOptions. + * + * @return the new UpdatePolicyStateOptions instance + */ + public UpdatePolicyStateOptions build() { + return new UpdatePolicyStateOptions(this); + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the UpdatePolicyStateOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdatePolicyStateOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the UpdatePolicyStateOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + } + + protected UpdatePolicyStateOptions() { } + + protected UpdatePolicyStateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + policyId = builder.policyId; + ifMatch = builder.ifMatch; + state = builder.state; + } + + /** + * New builder. + * + * @return a UpdatePolicyStateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyId. + * + * The policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be + * retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the state. + * + * The policy state. + * + * @return the state + */ + public String state() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java new file mode 100644 index 00000000000..f10cba5fe93 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java @@ -0,0 +1,166 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updateRoleAssignment options. + */ +public class UpdateRoleAssignmentOptions extends GenericModel { + + protected String assignmentId; + protected String ifMatch; + protected String templateVersion; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + private String ifMatch; + private String templateVersion; + + /** + * Instantiates a new Builder from an existing UpdateRoleAssignmentOptions instance. + * + * @param updateRoleAssignmentOptions the instance to initialize the Builder with + */ + private Builder(UpdateRoleAssignmentOptions updateRoleAssignmentOptions) { + this.assignmentId = updateRoleAssignmentOptions.assignmentId; + this.ifMatch = updateRoleAssignmentOptions.ifMatch; + this.templateVersion = updateRoleAssignmentOptions.templateVersion; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + * @param ifMatch the ifMatch + * @param templateVersion the templateVersion + */ + public Builder(String assignmentId, String ifMatch, String templateVersion) { + this.assignmentId = assignmentId; + this.ifMatch = ifMatch; + this.templateVersion = templateVersion; + } + + /** + * Builds a UpdateRoleAssignmentOptions. + * + * @return the new UpdateRoleAssignmentOptions instance + */ + public UpdateRoleAssignmentOptions build() { + return new UpdateRoleAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the UpdateRoleAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdateRoleAssignmentOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the UpdateRoleAssignmentOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + } + + protected UpdateRoleAssignmentOptions() { } + + protected UpdateRoleAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId 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.templateVersion, + "templateVersion cannot be null"); + assignmentId = builder.assignmentId; + ifMatch = builder.ifMatch; + templateVersion = builder.templateVersion; + } + + /** + * New builder. + * + * @return a UpdateRoleAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Role template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a role assignment and must match the Etag value of the existing role assignment. + * The Etag can be retrieved using the GET /v1/role_assignments/{assignment_id} API and looking at the Etag response + * header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the templateVersion. + * + * The version number of the template used to identify different versions of same template. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java new file mode 100644 index 00000000000..3d9dbb43fb3 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java @@ -0,0 +1,199 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updateSettings options. + */ +public class UpdateSettingsOptions extends GenericModel { + + protected String accountId; + protected String ifMatch; + protected ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String ifMatch; + private ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing UpdateSettingsOptions instance. + * + * @param updateSettingsOptions the instance to initialize the Builder with + */ + private Builder(UpdateSettingsOptions updateSettingsOptions) { + this.accountId = updateSettingsOptions.accountId; + this.ifMatch = updateSettingsOptions.ifMatch; + this.externalAccountIdentityInteraction = updateSettingsOptions.externalAccountIdentityInteraction; + this.acceptLanguage = updateSettingsOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + * @param ifMatch the ifMatch + */ + public Builder(String accountId, String ifMatch) { + this.accountId = accountId; + this.ifMatch = ifMatch; + } + + /** + * Builds a UpdateSettingsOptions. + * + * @return the new UpdateSettingsOptions instance + */ + public UpdateSettingsOptions build() { + return new UpdateSettingsOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the UpdateSettingsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdateSettingsOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the externalAccountIdentityInteraction. + * + * @param externalAccountIdentityInteraction the externalAccountIdentityInteraction + * @return the UpdateSettingsOptions builder + */ + public Builder externalAccountIdentityInteraction(ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction) { + this.externalAccountIdentityInteraction = externalAccountIdentityInteraction; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the UpdateSettingsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected UpdateSettingsOptions() { } + + protected UpdateSettingsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.accountId, + "accountId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + accountId = builder.accountId; + ifMatch = builder.ifMatch; + externalAccountIdentityInteraction = builder.externalAccountIdentityInteraction; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a UpdateSettingsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the settings belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating Access Management Account Settings and must match the Etag value of the existing + * Access Management Account Settings. The Etag can be retrieved using the GET + * /v1/accounts/{account_id}/settings/access_management API and looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the externalAccountIdentityInteraction. + * + * Update to how external accounts can interact in relation to the requested account. + * + * @return the externalAccountIdentityInteraction + */ + public ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction() { + return externalAccountIdentityInteraction; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java new file mode 100644 index 00000000000..fdae9e28c12 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * V2PoliciesPager can be used to simplify the use of the "listV2Policies" method. + */ +public class V2PoliciesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListV2PoliciesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected V2PoliciesPager() { } + + /** + * Constructs a new V2PoliciesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listV2Policies" method + * @param options the ListV2PoliciesOptions instance to be used to invoke the "listV2Policies" method + */ + public V2PoliciesPager(IamPolicyManagement client, ListV2PoliciesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<V2PolicyTemplateMetaData> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListV2PoliciesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + V2PolicyCollection result = client.listV2Policies(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getPolicies(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<V2PolicyTemplateMetaData> containing all results returned by the "listV2Policies" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java new file mode 100644 index 00000000000..842a354b7b1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java @@ -0,0 +1,247 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the policy. + */ +public class V2Policy extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + /** + * The policy state, either 'deleted' or 'active'. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String type; + protected String description; + protected V2PolicySubject subject; + protected V2PolicyResource resource; + protected String pattern; + protected V2PolicyRule rule; + protected String id; + protected String href; + protected ControlResponse control; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String state; + @SerializedName("last_permit_at") + protected String lastPermitAt; + @SerializedName("last_permit_frequency") + protected Long lastPermitFrequency; + + protected V2Policy() { } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject getSubject() { + return subject; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource getResource() { + return resource; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String getPattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule getRule() { + return rule; + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the policies API by policy ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the control. + * + * @return the control + */ + public ControlResponse getControl() { + return control; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the state. + * + * The policy state, either 'deleted' or 'active'. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the lastPermitAt. + * + * The optional last permit time of policy, when passing query parameter format=include_last_permit. + * + * @return the lastPermitAt + */ + public String getLastPermitAt() { + return lastPermitAt; + } + + /** + * Gets the lastPermitFrequency. + * + * The optional count of times that policy has provided a permit, when passing query parameter + * format=include_last_permit. + * + * @return the lastPermitFrequency + */ + public Long getLastPermitFrequency() { + return lastPermitFrequency; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java new file mode 100644 index 00000000000..d392025f8d8 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of policies. + */ +public class V2PolicyCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List policies; + + protected V2PolicyCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the policies. + * + * List of policies. + * + * @return the policies + */ + public List getPolicies() { + return policies; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java new file mode 100644 index 00000000000..caf8dd522a9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java @@ -0,0 +1,167 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The resource attributes to which the policy grants access. + */ +public class V2PolicyResource extends GenericModel { + + protected List attributes; + protected List tags; + + /** + * Builder. + */ + public static class Builder { + private List attributes; + private List tags; + + /** + * Instantiates a new Builder from an existing V2PolicyResource instance. + * + * @param v2PolicyResource the instance to initialize the Builder with + */ + private Builder(V2PolicyResource v2PolicyResource) { + this.attributes = v2PolicyResource.attributes; + this.tags = v2PolicyResource.tags; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param attributes the attributes + */ + public Builder(List attributes) { + this.attributes = attributes; + } + + /** + * Builds a V2PolicyResource. + * + * @return the new V2PolicyResource instance + */ + public V2PolicyResource build() { + return new V2PolicyResource(this); + } + + /** + * Adds a new element to attributes. + * + * @param attributes the new element to be added + * @return the V2PolicyResource builder + */ + public Builder addAttributes(V2PolicyResourceAttribute attributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, + "attributes cannot be null"); + if (this.attributes == null) { + this.attributes = new ArrayList(); + } + this.attributes.add(attributes); + return this; + } + + /** + * Adds a new element to tags. + * + * @param tags the new element to be added + * @return the V2PolicyResource builder + */ + public Builder addTags(V2PolicyResourceTag tags) { + com.ibm.cloud.sdk.core.util.Validator.notNull(tags, + "tags cannot be null"); + if (this.tags == null) { + this.tags = new ArrayList(); + } + this.tags.add(tags); + return this; + } + + /** + * Set the attributes. + * Existing attributes will be replaced. + * + * @param attributes the attributes + * @return the V2PolicyResource builder + */ + public Builder attributes(List attributes) { + this.attributes = attributes; + return this; + } + + /** + * Set the tags. + * Existing tags will be replaced. + * + * @param tags the tags + * @return the V2PolicyResource builder + */ + public Builder tags(List tags) { + this.tags = tags; + return this; + } + } + + protected V2PolicyResource() { } + + protected V2PolicyResource(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, + "attributes cannot be null"); + attributes = builder.attributes; + tags = builder.tags; + } + + /** + * New builder. + * + * @return a V2PolicyResource builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the attributes. + * + * List of resource attributes to which the policy grants access. + * + * @return the attributes + */ + public List attributes() { + return attributes; + } + + /** + * Gets the tags. + * + * Optional list of resource tags to which the policy grants access. + * + * @return the tags + */ + public List tags() { + return tags; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java new file mode 100644 index 00000000000..73e7cedd55e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java @@ -0,0 +1,181 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Resource attribute to which the policy grants access. + */ +public class V2PolicyResourceAttribute extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + } + + protected String key; + protected String operator; + protected Object value; + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing V2PolicyResourceAttribute instance. + * + * @param v2PolicyResourceAttribute the instance to initialize the Builder with + */ + private Builder(V2PolicyResourceAttribute v2PolicyResourceAttribute) { + this.key = v2PolicyResourceAttribute.key; + this.operator = v2PolicyResourceAttribute.operator; + this.value = v2PolicyResourceAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a V2PolicyResourceAttribute. + * + * @return the new V2PolicyResourceAttribute instance + */ + public V2PolicyResourceAttribute build() { + return new V2PolicyResourceAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the V2PolicyResourceAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicyResourceAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the V2PolicyResourceAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected V2PolicyResourceAttribute() { } + + protected V2PolicyResourceAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a V2PolicyResourceAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the key. + * + * The name of a resource attribute. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java new file mode 100644 index 00000000000..bb32772b8dc --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java @@ -0,0 +1,174 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A tag associated with a resource. + */ +public class V2PolicyResourceTag extends GenericModel { + + /** + * The operator of an access management tag. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + } + + protected String key; + protected String value; + protected String operator; + + /** + * Builder. + */ + public static class Builder { + private String key; + private String value; + private String operator; + + /** + * Instantiates a new Builder from an existing V2PolicyResourceTag instance. + * + * @param v2PolicyResourceTag the instance to initialize the Builder with + */ + private Builder(V2PolicyResourceTag v2PolicyResourceTag) { + this.key = v2PolicyResourceTag.key; + this.value = v2PolicyResourceTag.value; + this.operator = v2PolicyResourceTag.operator; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param value the value + * @param operator the operator + */ + public Builder(String key, String value, String operator) { + this.key = key; + this.value = value; + this.operator = operator; + } + + /** + * Builds a V2PolicyResourceTag. + * + * @return the new V2PolicyResourceTag instance + */ + public V2PolicyResourceTag build() { + return new V2PolicyResourceTag(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the V2PolicyResourceTag builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the V2PolicyResourceTag builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicyResourceTag builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + } + + protected V2PolicyResourceTag() { } + + protected V2PolicyResourceTag(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + key = builder.key; + value = builder.value; + operator = builder.operator; + } + + /** + * New builder. + * + * @return a V2PolicyResourceTag builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the key. + * + * The name of an access management tag. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the value. + * + * The value of an access management tag. + * + * @return the value + */ + public String value() { + return value; + } + + /** + * Gets the operator. + * + * The operator of an access management tag. + * + * @return the operator + */ + public String operator() { + return operator; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java new file mode 100644 index 00000000000..13a9f5fbd94 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java @@ -0,0 +1,126 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Additional access conditions associated with the policy. + * + * Classes which extend this class: + * - V2PolicyRuleRuleAttribute + * - V2PolicyRuleRuleWithNestedConditions + */ +public class V2PolicyRule extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + protected String key; + protected String operator; + protected Object value; + protected List conditions; + + protected V2PolicyRule() { } + + /** + * Gets the key. + * + * The name of an attribute. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } + + /** + * Gets the conditions. + * + * List of conditions associated with a policy. For example, time-based conditions that grant access over a certain + * time period. + * + * @return the conditions + */ + public List conditions() { + return conditions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java new file mode 100644 index 00000000000..c20b3a8cb0c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java @@ -0,0 +1,170 @@ +/* + * (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_policy_management.v1.model; + +/** + * Rule that specifies additional access that is granted (For example, time-based condition). + */ +public class V2PolicyRuleRuleAttribute extends V2PolicyRule { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing V2PolicyRuleRuleAttribute instance. + * + * @param v2PolicyRuleRuleAttribute the instance to initialize the Builder with + */ + public Builder(V2PolicyRule v2PolicyRuleRuleAttribute) { + this.key = v2PolicyRuleRuleAttribute.key; + this.operator = v2PolicyRuleRuleAttribute.operator; + this.value = v2PolicyRuleRuleAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a V2PolicyRuleRuleAttribute. + * + * @return the new V2PolicyRuleRuleAttribute instance + */ + public V2PolicyRuleRuleAttribute build() { + return new V2PolicyRuleRuleAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the V2PolicyRuleRuleAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicyRuleRuleAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the V2PolicyRuleRuleAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected V2PolicyRuleRuleAttribute() { } + + protected V2PolicyRuleRuleAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a V2PolicyRuleRuleAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java new file mode 100644 index 00000000000..8d6e57920f9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java @@ -0,0 +1,139 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * Rule that specifies additional access that is granted (for example, time-based condition) accross multiple + * conditions. + */ +public class V2PolicyRuleRuleWithNestedConditions extends V2PolicyRule { + + /** + * Operator to evaluate conditions. + */ + public interface Operator { + /** and. */ + String AND = "and"; + /** or. */ + String OR = "or"; + } + + + /** + * Builder. + */ + public static class Builder { + private String operator; + private List conditions; + + /** + * Instantiates a new Builder from an existing V2PolicyRuleRuleWithNestedConditions instance. + * + * @param v2PolicyRuleRuleWithNestedConditions the instance to initialize the Builder with + */ + public Builder(V2PolicyRule v2PolicyRuleRuleWithNestedConditions) { + this.operator = v2PolicyRuleRuleWithNestedConditions.operator; + this.conditions = v2PolicyRuleRuleWithNestedConditions.conditions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param operator the operator + * @param conditions the conditions + */ + public Builder(String operator, List conditions) { + this.operator = operator; + this.conditions = conditions; + } + + /** + * Builds a V2PolicyRuleRuleWithNestedConditions. + * + * @return the new V2PolicyRuleRuleWithNestedConditions instance + */ + public V2PolicyRuleRuleWithNestedConditions build() { + return new V2PolicyRuleRuleWithNestedConditions(this); + } + + /** + * Adds a new element to conditions. + * + * @param conditions the new element to be added + * @return the V2PolicyRuleRuleWithNestedConditions builder + */ + public Builder addConditions(NestedCondition conditions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(conditions, + "conditions cannot be null"); + if (this.conditions == null) { + this.conditions = new ArrayList(); + } + this.conditions.add(conditions); + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicyRuleRuleWithNestedConditions builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the conditions. + * Existing conditions will be replaced. + * + * @param conditions the conditions + * @return the V2PolicyRuleRuleWithNestedConditions builder + */ + public Builder conditions(List conditions) { + this.conditions = conditions; + return this; + } + } + + protected V2PolicyRuleRuleWithNestedConditions() { } + + protected V2PolicyRuleRuleWithNestedConditions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.conditions, + "conditions cannot be null"); + operator = builder.operator; + conditions = builder.conditions; + } + + /** + * New builder. + * + * @return a V2PolicyRuleRuleWithNestedConditions builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java new file mode 100644 index 00000000000..891513fd45a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java @@ -0,0 +1,124 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The subject attributes for whom the policy grants access. + */ +public class V2PolicySubject extends GenericModel { + + protected List attributes; + + /** + * Builder. + */ + public static class Builder { + private List attributes; + + /** + * Instantiates a new Builder from an existing V2PolicySubject instance. + * + * @param v2PolicySubject the instance to initialize the Builder with + */ + private Builder(V2PolicySubject v2PolicySubject) { + this.attributes = v2PolicySubject.attributes; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param attributes the attributes + */ + public Builder(List attributes) { + this.attributes = attributes; + } + + /** + * Builds a V2PolicySubject. + * + * @return the new V2PolicySubject instance + */ + public V2PolicySubject build() { + return new V2PolicySubject(this); + } + + /** + * Adds a new element to attributes. + * + * @param attributes the new element to be added + * @return the V2PolicySubject builder + */ + public Builder addAttributes(V2PolicySubjectAttribute attributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, + "attributes cannot be null"); + if (this.attributes == null) { + this.attributes = new ArrayList(); + } + this.attributes.add(attributes); + return this; + } + + /** + * Set the attributes. + * Existing attributes will be replaced. + * + * @param attributes the attributes + * @return the V2PolicySubject builder + */ + public Builder attributes(List attributes) { + this.attributes = attributes; + return this; + } + } + + protected V2PolicySubject() { } + + protected V2PolicySubject(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, + "attributes cannot be null"); + attributes = builder.attributes; + } + + /** + * New builder. + * + * @return a V2PolicySubject builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the attributes. + * + * List of subject attributes associated with policy. + * + * @return the attributes + */ + public List attributes() { + return attributes; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java new file mode 100644 index 00000000000..c90606429df --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java @@ -0,0 +1,175 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Subject attribute for whom the policy grants access. + */ +public class V2PolicySubjectAttribute extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + } + + protected String key; + protected String operator; + protected Object value; + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing V2PolicySubjectAttribute instance. + * + * @param v2PolicySubjectAttribute the instance to initialize the Builder with + */ + private Builder(V2PolicySubjectAttribute v2PolicySubjectAttribute) { + this.key = v2PolicySubjectAttribute.key; + this.operator = v2PolicySubjectAttribute.operator; + this.value = v2PolicySubjectAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a V2PolicySubjectAttribute. + * + * @return the new V2PolicySubjectAttribute instance + */ + public V2PolicySubjectAttribute build() { + return new V2PolicySubjectAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the V2PolicySubjectAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicySubjectAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the V2PolicySubjectAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected V2PolicySubjectAttribute() { } + + protected V2PolicySubjectAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a V2PolicySubjectAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the key. + * + * The name of a subject attribute. For example, iam_id, access_group_id. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java new file mode 100644 index 00000000000..720f7b57d4e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java @@ -0,0 +1,260 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the policy. + */ +public class V2PolicyTemplateMetaData extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + /** + * The policy state, either 'deleted' or 'active'. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String type; + protected String description; + protected V2PolicySubject subject; + protected V2PolicyResource resource; + protected String pattern; + protected V2PolicyRule rule; + protected String id; + protected String href; + protected ControlResponse control; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String state; + @SerializedName("last_permit_at") + protected String lastPermitAt; + @SerializedName("last_permit_frequency") + protected Long lastPermitFrequency; + protected TemplateMetadata template; + + protected V2PolicyTemplateMetaData() { } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject getSubject() { + return subject; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource getResource() { + return resource; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String getPattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule getRule() { + return rule; + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the policies API by policy ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the control. + * + * @return the control + */ + public ControlResponse getControl() { + return control; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the state. + * + * The policy state, either 'deleted' or 'active'. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the lastPermitAt. + * + * The optional last permit time of policy, when passing query parameter format=include_last_permit. + * + * @return the lastPermitAt + */ + public String getLastPermitAt() { + return lastPermitAt; + } + + /** + * Gets the lastPermitFrequency. + * + * The optional count of times that policy has provided a permit, when passing query parameter + * format=include_last_permit. + * + * @return the lastPermitFrequency + */ + public Long getLastPermitFrequency() { + return lastPermitFrequency; + } + + /** + * Gets the template. + * + * The details of the IAM template that was used to create an enterprise-managed policy in your account. When + * returned, this indicates that the policy is created from and managed by a template in the root enterprise account. + * + * @return the template + */ + public TemplateMetadata getTemplate() { + return template; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java new file mode 100644 index 00000000000..63a87389391 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java @@ -0,0 +1,17 @@ +/* + * (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. + */ + +/** + * IAM Policy Management v1. + */ +package com.ibm.cloud.platform_services.iam_policy_management.v1; diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java new file mode 100644 index 00000000000..b38933306a6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java @@ -0,0 +1,5007 @@ +/* + * (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_policy_management.v1; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplatesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponse; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControlWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedCondition; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleWithConditions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PoliciesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplatesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoleReferences; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PoliciesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRule; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleWithNestedConditions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.http.Response; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import okhttp3.mockwebserver.RecordedRequest; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the IamPolicyManagement service. + */ +public class IamPolicyManagementTest { + + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + protected MockWebServer server; + protected IamPolicyManagement iamPolicyManagementService; + + // Construct the service with a null authenticator (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testConstructorWithNullAuthenticator() throws Throwable { + final String serviceName = "testService"; + new IamPolicyManagement(serviceName, null); + } + + // Test the listPolicies operation with a valid options model parameter + @Test + public void testListPoliciesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policies\": [{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}]}"; + String listPoliciesPath = "/v1/policies"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListPoliciesOptions model + ListPoliciesOptions listPoliciesOptionsModel = new ListPoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .tagName("testString") + .tagValue("testString") + .sort("id") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listPolicies() with a valid options model and verify the result + Response response = iamPolicyManagementService.listPolicies(listPoliciesOptionsModel).execute(); + assertNotNull(response); + PolicyCollection 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, listPoliciesPath); + // 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("access_group_id"), "testString"); + assertEquals(query.get("type"), "access"); + assertEquals(query.get("service_type"), "service"); + assertEquals(query.get("tag_name"), "testString"); + assertEquals(query.get("tag_value"), "testString"); + assertEquals(query.get("sort"), "id"); + assertEquals(query.get("format"), "include_last_permit"); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listPolicies operation with and without retries enabled + @Test + public void testListPoliciesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListPoliciesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListPoliciesWOptions(); + } + + // Test the listPolicies operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPoliciesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listPolicies(null).execute(); + } + + // Test the listPolicies operation using the PoliciesPager.getNext() method + @Test + public void testListPoliciesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPoliciesOptions listPoliciesOptions = new ListPoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .tagName("testString") + .tagValue("testString") + .sort("id") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + PoliciesPager pager = new PoliciesPager(iamPolicyManagementService, listPoliciesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listPolicies operation using the PoliciesPager.getAll() method + @Test + public void testListPoliciesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPoliciesOptions listPoliciesOptions = new ListPoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .tagName("testString") + .tagValue("testString") + .sort("id") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + PoliciesPager pager = new PoliciesPager(iamPolicyManagementService, listPoliciesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createPolicy operation with a valid options model parameter + @Test + public void testCreatePolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; + String createPolicyPath = "/v1/policies"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the SubjectAttribute model + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + + // Construct an instance of the PolicySubject model + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + + // Construct an instance of the PolicyRole model + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the ResourceAttribute model + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + + // Construct an instance of the ResourceTag model + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + + // Construct an instance of the PolicyResource model + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + + // Construct an instance of the CreatePolicyOptions model + CreatePolicyOptions createPolicyOptionsModel = new CreatePolicyOptions.Builder() + .type("testString") + .subjects(java.util.Arrays.asList(policySubjectModel)) + .roles(java.util.Arrays.asList(policyRoleModel)) + .resources(java.util.Arrays.asList(policyResourceModel)) + .description("testString") + .acceptLanguage("default") + .build(); + + // Invoke createPolicy() with a valid options model and verify the result + Response response = iamPolicyManagementService.createPolicy(createPolicyOptionsModel).execute(); + assertNotNull(response); + Policy 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createPolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createPolicy operation with and without retries enabled + @Test + public void testCreatePolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreatePolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreatePolicyWOptions(); + } + + // Test the createPolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createPolicy(null).execute(); + } + + // Test the replacePolicy operation with a valid options model parameter + @Test + public void testReplacePolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; + String replacePolicyPath = "/v1/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the SubjectAttribute model + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + + // Construct an instance of the PolicySubject model + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + + // Construct an instance of the PolicyRole model + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the ResourceAttribute model + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + + // Construct an instance of the ResourceTag model + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + + // Construct an instance of the PolicyResource model + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + + // Construct an instance of the ReplacePolicyOptions model + ReplacePolicyOptions replacePolicyOptionsModel = new ReplacePolicyOptions.Builder() + .policyId("testString") + .ifMatch("testString") + .type("testString") + .subjects(java.util.Arrays.asList(policySubjectModel)) + .roles(java.util.Arrays.asList(policyRoleModel)) + .resources(java.util.Arrays.asList(policyResourceModel)) + .description("testString") + .build(); + + // Invoke replacePolicy() with a valid options model and verify the result + Response response = iamPolicyManagementService.replacePolicy(replacePolicyOptionsModel).execute(); + assertNotNull(response); + Policy 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, replacePolicyPath); + // 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 replacePolicy operation with and without retries enabled + @Test + public void testReplacePolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplacePolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplacePolicyWOptions(); + } + + // Test the replacePolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplacePolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replacePolicy(null).execute(); + } + + // Test the getPolicy operation with a valid options model parameter + @Test + public void testGetPolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}"; + String getPolicyPath = "/v1/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetPolicyOptions model + GetPolicyOptions getPolicyOptionsModel = new GetPolicyOptions.Builder() + .policyId("testString") + .build(); + + // Invoke getPolicy() with a valid options model and verify the result + Response response = iamPolicyManagementService.getPolicy(getPolicyOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateMetaData 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, getPolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getPolicy operation with and without retries enabled + @Test + public void testGetPolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetPolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetPolicyWOptions(); + } + + // Test the getPolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getPolicy(null).execute(); + } + + // Test the deletePolicy operation with a valid options model parameter + @Test + public void testDeletePolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deletePolicyPath = "/v1/policies/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeletePolicyOptions model + DeletePolicyOptions deletePolicyOptionsModel = new DeletePolicyOptions.Builder() + .policyId("testString") + .build(); + + // Invoke deletePolicy() with a valid options model and verify the result + Response response = iamPolicyManagementService.deletePolicy(deletePolicyOptionsModel).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, deletePolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deletePolicy operation with and without retries enabled + @Test + public void testDeletePolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeletePolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeletePolicyWOptions(); + } + + // Test the deletePolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deletePolicy(null).execute(); + } + + // Test the updatePolicyState operation with a valid options model parameter + @Test + public void testUpdatePolicyStateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; + String updatePolicyStatePath = "/v1/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdatePolicyStateOptions model + UpdatePolicyStateOptions updatePolicyStateOptionsModel = new UpdatePolicyStateOptions.Builder() + .policyId("testString") + .ifMatch("testString") + .state("active") + .build(); + + // Invoke updatePolicyState() with a valid options model and verify the result + Response response = iamPolicyManagementService.updatePolicyState(updatePolicyStateOptionsModel).execute(); + assertNotNull(response); + Policy 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updatePolicyStatePath); + // 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 updatePolicyState operation with and without retries enabled + @Test + public void testUpdatePolicyStateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdatePolicyStateWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdatePolicyStateWOptions(); + } + + // Test the updatePolicyState operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdatePolicyStateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updatePolicyState(null).execute(); + } + + // Test the listRoles operation with a valid options model parameter + @Test + public void testListRolesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"custom_roles\": [{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}], \"service_roles\": [{\"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\"}], \"system_roles\": [{\"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\"}]}"; + String listRolesPath = "/v2/roles"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListRolesOptions model + ListRolesOptions listRolesOptionsModel = new ListRolesOptions.Builder() + .acceptLanguage("default") + .accountId("testString") + .serviceName("iam-groups") + .sourceServiceName("iam-groups") + .policyType("authorization") + .serviceGroupId("IAM") + .build(); + + // Invoke listRoles() with a valid options model and verify the result + Response response = iamPolicyManagementService.listRoles(listRolesOptionsModel).execute(); + assertNotNull(response); + RoleCollection 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, listRolesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("service_name"), "iam-groups"); + assertEquals(query.get("source_service_name"), "iam-groups"); + assertEquals(query.get("policy_type"), "authorization"); + assertEquals(query.get("service_group_id"), "IAM"); + } + + // Test the listRoles operation with and without retries enabled + @Test + public void testListRolesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListRolesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListRolesWOptions(); + } + + // Test the createRole operation with a valid options model parameter + @Test + public void testCreateRoleWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; + String createRolePath = "/v2/roles"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the CreateRoleOptions model + CreateRoleOptions createRoleOptionsModel = new CreateRoleOptions.Builder() + .displayName("testString") + .actions(java.util.Arrays.asList("testString")) + .name("Developer") + .accountId("testString") + .serviceName("iam-groups") + .description("testString") + .acceptLanguage("default") + .build(); + + // Invoke createRole() with a valid options model and verify the result + Response response = iamPolicyManagementService.createRole(createRoleOptionsModel).execute(); + assertNotNull(response); + CustomRole 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createRolePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createRole operation with and without retries enabled + @Test + public void testCreateRoleWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateRoleWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateRoleWOptions(); + } + + // Test the createRole operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createRole(null).execute(); + } + + // Test the replaceRole operation with a valid options model parameter + @Test + public void testReplaceRoleWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; + String replaceRolePath = "/v2/roles/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ReplaceRoleOptions model + ReplaceRoleOptions replaceRoleOptionsModel = new ReplaceRoleOptions.Builder() + .roleId("testString") + .ifMatch("testString") + .displayName("testString") + .actions(java.util.Arrays.asList("testString")) + .description("testString") + .build(); + + // Invoke replaceRole() with a valid options model and verify the result + Response response = iamPolicyManagementService.replaceRole(replaceRoleOptionsModel).execute(); + assertNotNull(response); + CustomRole 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, replaceRolePath); + // 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 replaceRole operation with and without retries enabled + @Test + public void testReplaceRoleWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplaceRoleWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplaceRoleWOptions(); + } + + // Test the replaceRole operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceRoleNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replaceRole(null).execute(); + } + + // Test the getRole operation with a valid options model parameter + @Test + public void testGetRoleWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; + String getRolePath = "/v2/roles/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetRoleOptions model + GetRoleOptions getRoleOptionsModel = new GetRoleOptions.Builder() + .roleId("testString") + .build(); + + // Invoke getRole() with a valid options model and verify the result + Response response = iamPolicyManagementService.getRole(getRoleOptionsModel).execute(); + assertNotNull(response); + CustomRole 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, getRolePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getRole operation with and without retries enabled + @Test + public void testGetRoleWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetRoleWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetRoleWOptions(); + } + + // Test the getRole operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getRole(null).execute(); + } + + // Test the deleteRole operation with a valid options model parameter + @Test + public void testDeleteRoleWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteRolePath = "/v2/roles/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteRoleOptions model + DeleteRoleOptions deleteRoleOptionsModel = new DeleteRoleOptions.Builder() + .roleId("testString") + .build(); + + // Invoke deleteRole() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteRole(deleteRoleOptionsModel).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, deleteRolePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteRole operation with and without retries enabled + @Test + public void testDeleteRoleWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteRoleWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteRoleWOptions(); + } + + // Test the deleteRole operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteRole(null).execute(); + } + + // Test the listV2Policies operation with a valid options model parameter + @Test + public void testListV2PoliciesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policies\": [{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19, \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}]}"; + String listV2PoliciesPath = "/v2/policies"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListV2PoliciesOptions model + ListV2PoliciesOptions listV2PoliciesOptionsModel = new ListV2PoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .serviceName("testString") + .serviceGroupId("testString") + .sort("testString") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listV2Policies() with a valid options model and verify the result + Response response = iamPolicyManagementService.listV2Policies(listV2PoliciesOptionsModel).execute(); + assertNotNull(response); + V2PolicyCollection 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, listV2PoliciesPath); + // 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("access_group_id"), "testString"); + assertEquals(query.get("type"), "access"); + assertEquals(query.get("service_type"), "service"); + assertEquals(query.get("service_name"), "testString"); + assertEquals(query.get("service_group_id"), "testString"); + assertEquals(query.get("sort"), "testString"); + assertEquals(query.get("format"), "include_last_permit"); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listV2Policies operation with and without retries enabled + @Test + public void testListV2PoliciesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListV2PoliciesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListV2PoliciesWOptions(); + } + + // Test the listV2Policies operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListV2PoliciesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listV2Policies(null).execute(); + } + + // Test the listV2Policies operation using the V2PoliciesPager.getNext() method + @Test + public void testListV2PoliciesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListV2PoliciesOptions listV2PoliciesOptions = new ListV2PoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .serviceName("testString") + .serviceGroupId("testString") + .sort("testString") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + V2PoliciesPager pager = new V2PoliciesPager(iamPolicyManagementService, listV2PoliciesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listV2Policies operation using the V2PoliciesPager.getAll() method + @Test + public void testListV2PoliciesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListV2PoliciesOptions listV2PoliciesOptions = new ListV2PoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .serviceName("testString") + .serviceGroupId("testString") + .sort("testString") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + V2PoliciesPager pager = new V2PoliciesPager(iamPolicyManagementService, listV2PoliciesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createV2Policy operation with a valid options model parameter + @Test + public void testCreateV2PolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19}"; + String createV2PolicyPath = "/v2/policies"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the Grant model + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the Control model + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the CreateV2PolicyOptions model + CreateV2PolicyOptions createV2PolicyOptionsModel = new CreateV2PolicyOptions.Builder() + .control(controlModel) + .type("access") + .description("testString") + .subject(v2PolicySubjectModel) + .resource(v2PolicyResourceModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .acceptLanguage("default") + .build(); + + // Invoke createV2Policy() with a valid options model and verify the result + Response response = iamPolicyManagementService.createV2Policy(createV2PolicyOptionsModel).execute(); + assertNotNull(response); + V2Policy 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createV2PolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createV2Policy operation with and without retries enabled + @Test + public void testCreateV2PolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateV2PolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateV2PolicyWOptions(); + } + + // Test the createV2Policy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateV2PolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createV2Policy(null).execute(); + } + + // Test the replaceV2Policy operation with a valid options model parameter + @Test + public void testReplaceV2PolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19}"; + String replaceV2PolicyPath = "/v2/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the Grant model + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the Control model + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the ReplaceV2PolicyOptions model + ReplaceV2PolicyOptions replaceV2PolicyOptionsModel = new ReplaceV2PolicyOptions.Builder() + .id("testString") + .ifMatch("testString") + .control(controlModel) + .type("access") + .description("testString") + .subject(v2PolicySubjectModel) + .resource(v2PolicyResourceModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .build(); + + // Invoke replaceV2Policy() with a valid options model and verify the result + Response response = iamPolicyManagementService.replaceV2Policy(replaceV2PolicyOptionsModel).execute(); + assertNotNull(response); + V2Policy 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, replaceV2PolicyPath); + // 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 replaceV2Policy operation with and without retries enabled + @Test + public void testReplaceV2PolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplaceV2PolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplaceV2PolicyWOptions(); + } + + // Test the replaceV2Policy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceV2PolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replaceV2Policy(null).execute(); + } + + // Test the getV2Policy operation with a valid options model parameter + @Test + public void testGetV2PolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19, \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}"; + String getV2PolicyPath = "/v2/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetV2PolicyOptions model + GetV2PolicyOptions getV2PolicyOptionsModel = new GetV2PolicyOptions.Builder() + .id("testString") + .format("include_last_permit") + .build(); + + // Invoke getV2Policy() with a valid options model and verify the result + Response response = iamPolicyManagementService.getV2Policy(getV2PolicyOptionsModel).execute(); + assertNotNull(response); + V2PolicyTemplateMetaData 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, getV2PolicyPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("format"), "include_last_permit"); + } + + // Test the getV2Policy operation with and without retries enabled + @Test + public void testGetV2PolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetV2PolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetV2PolicyWOptions(); + } + + // Test the getV2Policy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetV2PolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getV2Policy(null).execute(); + } + + // Test the deleteV2Policy operation with a valid options model parameter + @Test + public void testDeleteV2PolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteV2PolicyPath = "/v2/policies/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteV2PolicyOptions model + DeleteV2PolicyOptions deleteV2PolicyOptionsModel = new DeleteV2PolicyOptions.Builder() + .id("testString") + .build(); + + // Invoke deleteV2Policy() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteV2Policy(deleteV2PolicyOptionsModel).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, deleteV2PolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteV2Policy operation with and without retries enabled + @Test + public void testDeleteV2PolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteV2PolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteV2PolicyWOptions(); + } + + // Test the deleteV2Policy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteV2PolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteV2Policy(null).execute(); + } + + // Test the listPolicyTemplates operation with a valid options model parameter + @Test + public void testListPolicyTemplatesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policy_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; + String listPolicyTemplatesPath = "/v1/policy_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListPolicyTemplatesOptions model + ListPolicyTemplatesOptions listPolicyTemplatesOptionsModel = new ListPolicyTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .state("active") + .name("testString") + .policyServiceType("service") + .policyServiceName("testString") + .policyServiceGroupId("testString") + .policyType("access") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listPolicyTemplates() with a valid options model and verify the result + Response response = iamPolicyManagementService.listPolicyTemplates(listPolicyTemplatesOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateCollection 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, listPolicyTemplatesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("state"), "active"); + assertEquals(query.get("name"), "testString"); + assertEquals(query.get("policy_service_type"), "service"); + assertEquals(query.get("policy_service_name"), "testString"); + assertEquals(query.get("policy_service_group_id"), "testString"); + assertEquals(query.get("policy_type"), "access"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listPolicyTemplates operation with and without retries enabled + @Test + public void testListPolicyTemplatesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListPolicyTemplatesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListPolicyTemplatesWOptions(); + } + + // Test the listPolicyTemplates operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyTemplatesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listPolicyTemplates(null).execute(); + } + + // Test the listPolicyTemplates operation using the PolicyTemplatesPager.getNext() method + @Test + public void testListPolicyTemplatesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyTemplatesOptions listPolicyTemplatesOptions = new ListPolicyTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .state("active") + .name("testString") + .policyServiceType("service") + .policyServiceName("testString") + .policyServiceGroupId("testString") + .policyType("access") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + PolicyTemplatesPager pager = new PolicyTemplatesPager(iamPolicyManagementService, listPolicyTemplatesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listPolicyTemplates operation using the PolicyTemplatesPager.getAll() method + @Test + public void testListPolicyTemplatesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyTemplatesOptions listPolicyTemplatesOptions = new ListPolicyTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .state("active") + .name("testString") + .policyServiceType("service") + .policyServiceName("testString") + .policyServiceGroupId("testString") + .policyType("access") + .limit(Long.valueOf("10")) + .build(); + + PolicyTemplatesPager pager = new PolicyTemplatesPager(iamPolicyManagementService, listPolicyTemplatesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createPolicyTemplate operation with a valid options model parameter + @Test + public void testCreatePolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; + String createPolicyTemplatePath = "/v1/policy_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the TemplateGrantRoles model + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the TemplateControl model + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + + // Construct an instance of the TemplatePolicy model + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + + // Construct an instance of the CreatePolicyTemplateOptions model + CreatePolicyTemplateOptions createPolicyTemplateOptionsModel = new CreatePolicyTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .policy(templatePolicyModel) + .description("testString") + .committed(true) + .acceptLanguage("default") + .build(); + + // Invoke createPolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.createPolicyTemplate(createPolicyTemplateOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateLimitData 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createPolicyTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createPolicyTemplate operation with and without retries enabled + @Test + public void testCreatePolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreatePolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreatePolicyTemplateWOptions(); + } + + // Test the createPolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createPolicyTemplate(null).execute(); + } + + // Test the getPolicyTemplate operation with a valid options model parameter + @Test + public void testGetPolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String getPolicyTemplatePath = "/v1/policy_templates/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetPolicyTemplateOptions model + GetPolicyTemplateOptions getPolicyTemplateOptionsModel = new GetPolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .state("active") + .build(); + + // Invoke getPolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.getPolicyTemplate(getPolicyTemplateOptionsModel).execute(); + assertNotNull(response); + PolicyTemplate 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, getPolicyTemplatePath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + } + + // Test the getPolicyTemplate operation with and without retries enabled + @Test + public void testGetPolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetPolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetPolicyTemplateWOptions(); + } + + // Test the getPolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getPolicyTemplate(null).execute(); + } + + // Test the deletePolicyTemplate operation with a valid options model parameter + @Test + public void testDeletePolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deletePolicyTemplatePath = "/v1/policy_templates/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeletePolicyTemplateOptions model + DeletePolicyTemplateOptions deletePolicyTemplateOptionsModel = new DeletePolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .build(); + + // Invoke deletePolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.deletePolicyTemplate(deletePolicyTemplateOptionsModel).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, deletePolicyTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deletePolicyTemplate operation with and without retries enabled + @Test + public void testDeletePolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeletePolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeletePolicyTemplateWOptions(); + } + + // Test the deletePolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deletePolicyTemplate(null).execute(); + } + + // Test the createPolicyTemplateVersion operation with a valid options model parameter + @Test + public void testCreatePolicyTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; + String createPolicyTemplateVersionPath = "/v1/policy_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the TemplateGrantRoles model + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the TemplateControl model + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + + // Construct an instance of the TemplatePolicy model + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + + // Construct an instance of the CreatePolicyTemplateVersionOptions model + CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptionsModel = new CreatePolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .policy(templatePolicyModel) + .name("testString") + .description("testString") + .committed(true) + .build(); + + // Invoke createPolicyTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.createPolicyTemplateVersion(createPolicyTemplateVersionOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateLimitData 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createPolicyTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createPolicyTemplateVersion operation with and without retries enabled + @Test + public void testCreatePolicyTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreatePolicyTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreatePolicyTemplateVersionWOptions(); + } + + // Test the createPolicyTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createPolicyTemplateVersion(null).execute(); + } + + // Test the listPolicyTemplateVersions operation with a valid options model parameter + @Test + public void testListPolicyTemplateVersionsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; + String listPolicyTemplateVersionsPath = "/v1/policy_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListPolicyTemplateVersionsOptions model + ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptionsModel = new ListPolicyTemplateVersionsOptions.Builder() + .policyTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listPolicyTemplateVersions() with a valid options model and verify the result + Response response = iamPolicyManagementService.listPolicyTemplateVersions(listPolicyTemplateVersionsOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateVersionsCollection 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, listPolicyTemplateVersionsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listPolicyTemplateVersions operation with and without retries enabled + @Test + public void testListPolicyTemplateVersionsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListPolicyTemplateVersionsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListPolicyTemplateVersionsWOptions(); + } + + // Test the listPolicyTemplateVersions operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyTemplateVersionsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listPolicyTemplateVersions(null).execute(); + } + + // Test the listPolicyTemplateVersions operation using the PolicyTemplateVersionsPager.getNext() method + @Test + public void testListPolicyTemplateVersionsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions = new ListPolicyTemplateVersionsOptions.Builder() + .policyTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + PolicyTemplateVersionsPager pager = new PolicyTemplateVersionsPager(iamPolicyManagementService, listPolicyTemplateVersionsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listPolicyTemplateVersions operation using the PolicyTemplateVersionsPager.getAll() method + @Test + public void testListPolicyTemplateVersionsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions = new ListPolicyTemplateVersionsOptions.Builder() + .policyTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + PolicyTemplateVersionsPager pager = new PolicyTemplateVersionsPager(iamPolicyManagementService, listPolicyTemplateVersionsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the replacePolicyTemplate operation with a valid options model parameter + @Test + public void testReplacePolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String replacePolicyTemplatePath = "/v1/policy_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the TemplateGrantRoles model + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the TemplateControl model + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + + // Construct an instance of the TemplatePolicy model + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + + // Construct an instance of the ReplacePolicyTemplateOptions model + ReplacePolicyTemplateOptions replacePolicyTemplateOptionsModel = new ReplacePolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .ifMatch("testString") + .policy(templatePolicyModel) + .name("testString") + .description("testString") + .committed(true) + .build(); + + // Invoke replacePolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.replacePolicyTemplate(replacePolicyTemplateOptionsModel).execute(); + assertNotNull(response); + PolicyTemplate 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, replacePolicyTemplatePath); + // 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 replacePolicyTemplate operation with and without retries enabled + @Test + public void testReplacePolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplacePolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplacePolicyTemplateWOptions(); + } + + // Test the replacePolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplacePolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replacePolicyTemplate(null).execute(); + } + + // Test the deletePolicyTemplateVersion operation with a valid options model parameter + @Test + public void testDeletePolicyTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deletePolicyTemplateVersionPath = "/v1/policy_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeletePolicyTemplateVersionOptions model + DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptionsModel = new DeletePolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + + // Invoke deletePolicyTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.deletePolicyTemplateVersion(deletePolicyTemplateVersionOptionsModel).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, deletePolicyTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deletePolicyTemplateVersion operation with and without retries enabled + @Test + public void testDeletePolicyTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeletePolicyTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeletePolicyTemplateVersionWOptions(); + } + + // Test the deletePolicyTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deletePolicyTemplateVersion(null).execute(); + } + + // Test the getPolicyTemplateVersion operation with a valid options model parameter + @Test + public void testGetPolicyTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String getPolicyTemplateVersionPath = "/v1/policy_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetPolicyTemplateVersionOptions model + GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptionsModel = new GetPolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + + // Invoke getPolicyTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.getPolicyTemplateVersion(getPolicyTemplateVersionOptionsModel).execute(); + assertNotNull(response); + PolicyTemplate 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, getPolicyTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getPolicyTemplateVersion operation with and without retries enabled + @Test + public void testGetPolicyTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetPolicyTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetPolicyTemplateVersionWOptions(); + } + + // Test the getPolicyTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getPolicyTemplateVersion(null).execute(); + } + + // Test the commitPolicyTemplate operation with a valid options model parameter + @Test + public void testCommitPolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String commitPolicyTemplatePath = "/v1/policy_templates/testString/versions/testString/commit"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the CommitPolicyTemplateOptions model + CommitPolicyTemplateOptions commitPolicyTemplateOptionsModel = new CommitPolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + + // Invoke commitPolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.commitPolicyTemplate(commitPolicyTemplateOptionsModel).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, commitPolicyTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the commitPolicyTemplate operation with and without retries enabled + @Test + public void testCommitPolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCommitPolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCommitPolicyTemplateWOptions(); + } + + // Test the commitPolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitPolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.commitPolicyTemplate(null).execute(); + } + + // Test the listPolicyAssignments operation with a valid options model parameter + @Test + public void testListPolicyAssignmentsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}]}"; + String listPolicyAssignmentsPath = "/v1/policy_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListPolicyAssignmentsOptions model + ListPolicyAssignmentsOptions listPolicyAssignmentsOptionsModel = new ListPolicyAssignmentsOptions.Builder() + .version("1.0") + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listPolicyAssignments() with a valid options model and verify the result + Response response = iamPolicyManagementService.listPolicyAssignments(listPolicyAssignmentsOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateAssignmentCollection 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, listPolicyAssignmentsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "1.0"); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("template_id"), "testString"); + assertEquals(query.get("template_version"), "testString"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listPolicyAssignments operation with and without retries enabled + @Test + public void testListPolicyAssignmentsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListPolicyAssignmentsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListPolicyAssignmentsWOptions(); + } + + // Test the listPolicyAssignments operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyAssignmentsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listPolicyAssignments(null).execute(); + } + + // Test the listPolicyAssignments operation using the PolicyAssignmentsPager.getNext() method + @Test + public void testListPolicyAssignmentsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyAssignmentsOptions listPolicyAssignmentsOptions = new ListPolicyAssignmentsOptions.Builder() + .version("1.0") + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + PolicyAssignmentsPager pager = new PolicyAssignmentsPager(iamPolicyManagementService, listPolicyAssignmentsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listPolicyAssignments operation using the PolicyAssignmentsPager.getAll() method + @Test + public void testListPolicyAssignmentsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyAssignmentsOptions listPolicyAssignmentsOptions = new ListPolicyAssignmentsOptions.Builder() + .version("1.0") + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + PolicyAssignmentsPager pager = new PolicyAssignmentsPager(iamPolicyManagementService, listPolicyAssignmentsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createPolicyTemplateAssignment operation with a valid options model parameter + @Test + public void testCreatePolicyTemplateAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}]}"; + String createPolicyTemplateAssignmentPath = "/v1/policy_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the AssignmentTargetDetails model + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + + // Construct an instance of the AssignmentTemplateDetails model + AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() + .id("testString") + .version("testString") + .build(); + + // Construct an instance of the CreatePolicyTemplateAssignmentOptions model + CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptionsModel = new CreatePolicyTemplateAssignmentOptions.Builder() + .version("1.0") + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(assignmentTemplateDetailsModel)) + .acceptLanguage("default") + .build(); + + // Invoke createPolicyTemplateAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.createPolicyTemplateAssignment(createPolicyTemplateAssignmentOptionsModel).execute(); + assertNotNull(response); + PolicyAssignmentV1Collection 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createPolicyTemplateAssignmentPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "1.0"); + } + + // Test the createPolicyTemplateAssignment operation with and without retries enabled + @Test + public void testCreatePolicyTemplateAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreatePolicyTemplateAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreatePolicyTemplateAssignmentWOptions(); + } + + // Test the createPolicyTemplateAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createPolicyTemplateAssignment(null).execute(); + } + + // Test the getPolicyAssignment operation with a valid options model parameter + @Test + public void testGetPolicyAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}"; + String getPolicyAssignmentPath = "/v1/policy_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetPolicyAssignmentOptions model + GetPolicyAssignmentOptions getPolicyAssignmentOptionsModel = new GetPolicyAssignmentOptions.Builder() + .assignmentId("testString") + .version("1.0") + .build(); + + // Invoke getPolicyAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.getPolicyAssignment(getPolicyAssignmentOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateAssignmentItems 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, getPolicyAssignmentPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "1.0"); + } + + // Test the getPolicyAssignment operation with and without retries enabled + @Test + public void testGetPolicyAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetPolicyAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetPolicyAssignmentWOptions(); + } + + // Test the getPolicyAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getPolicyAssignment(null).execute(); + } + + // Test the updatePolicyAssignment operation with a valid options model parameter + @Test + public void testUpdatePolicyAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}"; + String updatePolicyAssignmentPath = "/v1/policy_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdatePolicyAssignmentOptions model + UpdatePolicyAssignmentOptions updatePolicyAssignmentOptionsModel = new UpdatePolicyAssignmentOptions.Builder() + .assignmentId("testString") + .version("1.0") + .ifMatch("testString") + .templateVersion("testString") + .build(); + + // Invoke updatePolicyAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.updatePolicyAssignment(updatePolicyAssignmentOptionsModel).execute(); + assertNotNull(response); + PolicyAssignmentV1 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updatePolicyAssignmentPath); + // Verify header parameters + assertEquals(request.getHeader("If-Match"), "testString"); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "1.0"); + } + + // Test the updatePolicyAssignment operation with and without retries enabled + @Test + public void testUpdatePolicyAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdatePolicyAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdatePolicyAssignmentWOptions(); + } + + // Test the updatePolicyAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdatePolicyAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updatePolicyAssignment(null).execute(); + } + + // Test the deletePolicyAssignment operation with a valid options model parameter + @Test + public void testDeletePolicyAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deletePolicyAssignmentPath = "/v1/policy_assignments/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeletePolicyAssignmentOptions model + DeletePolicyAssignmentOptions deletePolicyAssignmentOptionsModel = new DeletePolicyAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke deletePolicyAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.deletePolicyAssignment(deletePolicyAssignmentOptionsModel).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, deletePolicyAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deletePolicyAssignment operation with and without retries enabled + @Test + public void testDeletePolicyAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeletePolicyAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeletePolicyAssignmentWOptions(); + } + + // Test the deletePolicyAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deletePolicyAssignment(null).execute(); + } + + // Test the getSettings operation with a valid options model parameter + @Test + public void testGetSettingsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"external_account_identity_interaction\": {\"identity_types\": {\"user\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service_id\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}}}}"; + String getSettingsPath = "/v1/accounts/testString/settings/access_management"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetSettingsOptions model + GetSettingsOptions getSettingsOptionsModel = new GetSettingsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .build(); + + // Invoke getSettings() with a valid options model and verify the result + Response response = iamPolicyManagementService.getSettings(getSettingsOptionsModel).execute(); + assertNotNull(response); + AccountSettingsAccessManagement 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, getSettingsPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getSettings operation with and without retries enabled + @Test + public void testGetSettingsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetSettingsWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetSettingsWOptions(); + } + + // Test the getSettings operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetSettingsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getSettings(null).execute(); + } + + // Test the updateSettings operation with a valid options model parameter + @Test + public void testUpdateSettingsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"external_account_identity_interaction\": {\"identity_types\": {\"user\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service_id\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}}}}"; + String updateSettingsPath = "/v1/accounts/testString/settings/access_management"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the IdentityTypesBase model + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the IdentityTypesPatch model + IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() + .user(identityTypesBaseModel) + .serviceId(identityTypesBaseModel) + .service(identityTypesBaseModel) + .build(); + + // Construct an instance of the ExternalAccountIdentityInteractionPatch model + ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() + .identityTypes(identityTypesPatchModel) + .build(); + + // Construct an instance of the UpdateSettingsOptions model + UpdateSettingsOptions updateSettingsOptionsModel = new UpdateSettingsOptions.Builder() + .accountId("testString") + .ifMatch("testString") + .externalAccountIdentityInteraction(externalAccountIdentityInteractionPatchModel) + .acceptLanguage("default") + .build(); + + // Invoke updateSettings() with a valid options model and verify the result + Response response = iamPolicyManagementService.updateSettings(updateSettingsOptionsModel).execute(); + assertNotNull(response); + AccountSettingsAccessManagement 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updateSettingsPath); + // 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 updateSettings operation with and without retries enabled + @Test + public void testUpdateSettingsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdateSettingsWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdateSettingsWOptions(); + } + + // Test the updateSettings operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateSettingsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updateSettings(null).execute(); + } + + // Test the listActionControlTemplates operation with a valid options model parameter + @Test + public void testListActionControlTemplatesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"action_control_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; + String listActionControlTemplatesPath = "/v1/action_control_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListActionControlTemplatesOptions model + ListActionControlTemplatesOptions listActionControlTemplatesOptionsModel = new ListActionControlTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listActionControlTemplates() with a valid options model and verify the result + Response response = iamPolicyManagementService.listActionControlTemplates(listActionControlTemplatesOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplateCollection 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, listActionControlTemplatesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listActionControlTemplates operation with and without retries enabled + @Test + public void testListActionControlTemplatesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListActionControlTemplatesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListActionControlTemplatesWOptions(); + } + + // Test the listActionControlTemplates operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlTemplatesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listActionControlTemplates(null).execute(); + } + + // Test the listActionControlTemplates operation using the ActionControlTemplatesPager.getNext() method + @Test + public void testListActionControlTemplatesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlTemplatesOptions listActionControlTemplatesOptions = new ListActionControlTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + ActionControlTemplatesPager pager = new ActionControlTemplatesPager(iamPolicyManagementService, listActionControlTemplatesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listActionControlTemplates operation using the ActionControlTemplatesPager.getAll() method + @Test + public void testListActionControlTemplatesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlTemplatesOptions listActionControlTemplatesOptions = new ListActionControlTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .limit(Long.valueOf("10")) + .build(); + + ActionControlTemplatesPager pager = new ActionControlTemplatesPager(iamPolicyManagementService, listActionControlTemplatesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createActionControlTemplate operation with a valid options model parameter + @Test + public void testCreateActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String createActionControlTemplatePath = "/v1/action_control_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateActionControl model + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the CreateActionControlTemplateOptions model + CreateActionControlTemplateOptions createActionControlTemplateOptionsModel = new CreateActionControlTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .description("testString") + .committed(true) + .actionControl(templateActionControlModel) + .acceptLanguage("default") + .build(); + + // Invoke createActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.createActionControlTemplate(createActionControlTemplateOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createActionControlTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createActionControlTemplate operation with and without retries enabled + @Test + public void testCreateActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateActionControlTemplateWOptions(); + } + + // Test the createActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createActionControlTemplate(null).execute(); + } + + // Test the getActionControlTemplate operation with a valid options model parameter + @Test + public void testGetActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String getActionControlTemplatePath = "/v1/action_control_templates/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetActionControlTemplateOptions model + GetActionControlTemplateOptions getActionControlTemplateOptionsModel = new GetActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .build(); + + // Invoke getActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.getActionControlTemplate(getActionControlTemplateOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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, getActionControlTemplatePath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + } + + // Test the getActionControlTemplate operation with and without retries enabled + @Test + public void testGetActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetActionControlTemplateWOptions(); + } + + // Test the getActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getActionControlTemplate(null).execute(); + } + + // Test the deleteActionControlTemplate operation with a valid options model parameter + @Test + public void testDeleteActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteActionControlTemplatePath = "/v1/action_control_templates/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteActionControlTemplateOptions model + DeleteActionControlTemplateOptions deleteActionControlTemplateOptionsModel = new DeleteActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .build(); + + // Invoke deleteActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteActionControlTemplate(deleteActionControlTemplateOptionsModel).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, deleteActionControlTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteActionControlTemplate operation with and without retries enabled + @Test + public void testDeleteActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteActionControlTemplateWOptions(); + } + + // Test the deleteActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteActionControlTemplate(null).execute(); + } + + // Test the createActionControlTemplateVersion operation with a valid options model parameter + @Test + public void testCreateActionControlTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String createActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateActionControl model + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the CreateActionControlTemplateVersionOptions model + CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptionsModel = new CreateActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .name("testString") + .description("testString") + .actionControl(templateActionControlModel) + .committed(true) + .build(); + + // Invoke createActionControlTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.createActionControlTemplateVersion(createActionControlTemplateVersionOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createActionControlTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createActionControlTemplateVersion operation with and without retries enabled + @Test + public void testCreateActionControlTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateActionControlTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateActionControlTemplateVersionWOptions(); + } + + // Test the createActionControlTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createActionControlTemplateVersion(null).execute(); + } + + // Test the listActionControlTemplateVersions operation with a valid options model parameter + @Test + public void testListActionControlTemplateVersionsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; + String listActionControlTemplateVersionsPath = "/v1/action_control_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListActionControlTemplateVersionsOptions model + ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptionsModel = new ListActionControlTemplateVersionsOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listActionControlTemplateVersions() with a valid options model and verify the result + Response response = iamPolicyManagementService.listActionControlTemplateVersions(listActionControlTemplateVersionsOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplateVersionsCollection 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, listActionControlTemplateVersionsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listActionControlTemplateVersions operation with and without retries enabled + @Test + public void testListActionControlTemplateVersionsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListActionControlTemplateVersionsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListActionControlTemplateVersionsWOptions(); + } + + // Test the listActionControlTemplateVersions operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlTemplateVersionsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listActionControlTemplateVersions(null).execute(); + } + + // Test the listActionControlTemplateVersions operation using the ActionControlTemplateVersionsPager.getNext() method + @Test + public void testListActionControlTemplateVersionsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions = new ListActionControlTemplateVersionsOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + ActionControlTemplateVersionsPager pager = new ActionControlTemplateVersionsPager(iamPolicyManagementService, listActionControlTemplateVersionsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listActionControlTemplateVersions operation using the ActionControlTemplateVersionsPager.getAll() method + @Test + public void testListActionControlTemplateVersionsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions = new ListActionControlTemplateVersionsOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + ActionControlTemplateVersionsPager pager = new ActionControlTemplateVersionsPager(iamPolicyManagementService, listActionControlTemplateVersionsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the replaceActionControlTemplate operation with a valid options model parameter + @Test + public void testReplaceActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String replaceActionControlTemplatePath = "/v1/action_control_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateActionControl model + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the ReplaceActionControlTemplateOptions model + ReplaceActionControlTemplateOptions replaceActionControlTemplateOptionsModel = new ReplaceActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .actionControl(templateActionControlModel) + .committed(true) + .build(); + + // Invoke replaceActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.replaceActionControlTemplate(replaceActionControlTemplateOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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, replaceActionControlTemplatePath); + // 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 replaceActionControlTemplate operation with and without retries enabled + @Test + public void testReplaceActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplaceActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplaceActionControlTemplateWOptions(); + } + + // Test the replaceActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replaceActionControlTemplate(null).execute(); + } + + // Test the deleteActionControlTemplateVersion operation with a valid options model parameter + @Test + public void testDeleteActionControlTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteActionControlTemplateVersionOptions model + DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptionsModel = new DeleteActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + + // Invoke deleteActionControlTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteActionControlTemplateVersion(deleteActionControlTemplateVersionOptionsModel).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, deleteActionControlTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteActionControlTemplateVersion operation with and without retries enabled + @Test + public void testDeleteActionControlTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteActionControlTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteActionControlTemplateVersionWOptions(); + } + + // Test the deleteActionControlTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteActionControlTemplateVersion(null).execute(); + } + + // Test the getActionControlTemplateVersion operation with a valid options model parameter + @Test + public void testGetActionControlTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String getActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetActionControlTemplateVersionOptions model + GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptionsModel = new GetActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + + // Invoke getActionControlTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.getActionControlTemplateVersion(getActionControlTemplateVersionOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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, getActionControlTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getActionControlTemplateVersion operation with and without retries enabled + @Test + public void testGetActionControlTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetActionControlTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetActionControlTemplateVersionWOptions(); + } + + // Test the getActionControlTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getActionControlTemplateVersion(null).execute(); + } + + // Test the commitActionControlTemplate operation with a valid options model parameter + @Test + public void testCommitActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String commitActionControlTemplatePath = "/v1/action_control_templates/testString/versions/testString/commit"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the CommitActionControlTemplateOptions model + CommitActionControlTemplateOptions commitActionControlTemplateOptionsModel = new CommitActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + + // Invoke commitActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.commitActionControlTemplate(commitActionControlTemplateOptionsModel).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, commitActionControlTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the commitActionControlTemplate operation with and without retries enabled + @Test + public void testCommitActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCommitActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCommitActionControlTemplateWOptions(); + } + + // Test the commitActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.commitActionControlTemplate(null).execute(); + } + + // Test the listActionControlAssignments operation with a valid options model parameter + @Test + public void testListActionControlAssignmentsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; + String listActionControlAssignmentsPath = "/v1/action_control_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListActionControlAssignmentsOptions model + ListActionControlAssignmentsOptions listActionControlAssignmentsOptionsModel = new ListActionControlAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listActionControlAssignments() with a valid options model and verify the result + Response response = iamPolicyManagementService.listActionControlAssignments(listActionControlAssignmentsOptionsModel).execute(); + assertNotNull(response); + ActionControlAssignmentCollection 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, listActionControlAssignmentsPath); + // 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(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listActionControlAssignments operation with and without retries enabled + @Test + public void testListActionControlAssignmentsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListActionControlAssignmentsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListActionControlAssignmentsWOptions(); + } + + // Test the listActionControlAssignments operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlAssignmentsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listActionControlAssignments(null).execute(); + } + + // Test the listActionControlAssignments operation using the ActionControlAssignmentsPager.getNext() method + @Test + public void testListActionControlAssignmentsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlAssignmentsOptions listActionControlAssignmentsOptions = new ListActionControlAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + ActionControlAssignmentsPager pager = new ActionControlAssignmentsPager(iamPolicyManagementService, listActionControlAssignmentsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listActionControlAssignments operation using the ActionControlAssignmentsPager.getAll() method + @Test + public void testListActionControlAssignmentsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlAssignmentsOptions listActionControlAssignmentsOptions = new ListActionControlAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + ActionControlAssignmentsPager pager = new ActionControlAssignmentsPager(iamPolicyManagementService, listActionControlAssignmentsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createActionControlTemplateAssignment operation with a valid options model parameter + @Test + public void testCreateActionControlTemplateAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; + String createActionControlTemplateAssignmentPath = "/v1/action_control_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the AssignmentTargetDetails model + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + + // Construct an instance of the ActionControlAssignmentTemplate model + ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + + // Construct an instance of the CreateActionControlTemplateAssignmentOptions model + CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptionsModel = new CreateActionControlTemplateAssignmentOptions.Builder() + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(actionControlAssignmentTemplateModel)) + .acceptLanguage("default") + .build(); + + // Invoke createActionControlTemplateAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.createActionControlTemplateAssignment(createActionControlTemplateAssignmentOptionsModel).execute(); + assertNotNull(response); + ActionControlAssignmentCollection 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createActionControlTemplateAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createActionControlTemplateAssignment operation with and without retries enabled + @Test + public void testCreateActionControlTemplateAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateActionControlTemplateAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateActionControlTemplateAssignmentWOptions(); + } + + // Test the createActionControlTemplateAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createActionControlTemplateAssignment(null).execute(); + } + + // Test the getActionControlAssignment operation with a valid options model parameter + @Test + public void testGetActionControlAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; + String getActionControlAssignmentPath = "/v1/action_control_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetActionControlAssignmentOptions model + GetActionControlAssignmentOptions getActionControlAssignmentOptionsModel = new GetActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke getActionControlAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.getActionControlAssignment(getActionControlAssignmentOptionsModel).execute(); + assertNotNull(response); + ActionControlAssignment 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, getActionControlAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getActionControlAssignment operation with and without retries enabled + @Test + public void testGetActionControlAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetActionControlAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetActionControlAssignmentWOptions(); + } + + // Test the getActionControlAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getActionControlAssignment(null).execute(); + } + + // Test the updateActionControlAssignment operation with a valid options model parameter + @Test + public void testUpdateActionControlAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; + String updateActionControlAssignmentPath = "/v1/action_control_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdateActionControlAssignmentOptions model + UpdateActionControlAssignmentOptions updateActionControlAssignmentOptionsModel = new UpdateActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .ifMatch("testString") + .templateVersion("testString") + .build(); + + // Invoke updateActionControlAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.updateActionControlAssignment(updateActionControlAssignmentOptionsModel).execute(); + assertNotNull(response); + ActionControlAssignment 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updateActionControlAssignmentPath); + // 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 updateActionControlAssignment operation with and without retries enabled + @Test + public void testUpdateActionControlAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdateActionControlAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdateActionControlAssignmentWOptions(); + } + + // Test the updateActionControlAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateActionControlAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updateActionControlAssignment(null).execute(); + } + + // Test the deleteActionControlAssignment operation with a valid options model parameter + @Test + public void testDeleteActionControlAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteActionControlAssignmentPath = "/v1/action_control_assignments/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteActionControlAssignmentOptions model + DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptionsModel = new DeleteActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke deleteActionControlAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteActionControlAssignment(deleteActionControlAssignmentOptionsModel).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, deleteActionControlAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteActionControlAssignment operation with and without retries enabled + @Test + public void testDeleteActionControlAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteActionControlAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteActionControlAssignmentWOptions(); + } + + // Test the deleteActionControlAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteActionControlAssignment(null).execute(); + } + + // Test the listRoleTemplates operation with a valid options model parameter + @Test + public void testListRoleTemplatesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"role_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; + String listRoleTemplatesPath = "/v1/role_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListRoleTemplatesOptions model + ListRoleTemplatesOptions listRoleTemplatesOptionsModel = new ListRoleTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .name("testString") + .roleName("testString") + .roleServiceName("testString") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listRoleTemplates() with a valid options model and verify the result + Response response = iamPolicyManagementService.listRoleTemplates(listRoleTemplatesOptionsModel).execute(); + assertNotNull(response); + RoleTemplateCollection 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, listRoleTemplatesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("name"), "testString"); + assertEquals(query.get("role_name"), "testString"); + assertEquals(query.get("role_service_name"), "testString"); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listRoleTemplates operation with and without retries enabled + @Test + public void testListRoleTemplatesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListRoleTemplatesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListRoleTemplatesWOptions(); + } + + // Test the listRoleTemplates operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleTemplatesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listRoleTemplates(null).execute(); + } + + // Test the listRoleTemplates operation using the RoleTemplatesPager.getNext() method + @Test + public void testListRoleTemplatesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleTemplatesOptions listRoleTemplatesOptions = new ListRoleTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .name("testString") + .roleName("testString") + .roleServiceName("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + RoleTemplatesPager pager = new RoleTemplatesPager(iamPolicyManagementService, listRoleTemplatesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listRoleTemplates operation using the RoleTemplatesPager.getAll() method + @Test + public void testListRoleTemplatesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleTemplatesOptions listRoleTemplatesOptions = new ListRoleTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .name("testString") + .roleName("testString") + .roleServiceName("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + RoleTemplatesPager pager = new RoleTemplatesPager(iamPolicyManagementService, listRoleTemplatesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createRoleTemplate operation with a valid options model parameter + @Test + public void testCreateRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String createRoleTemplatePath = "/v1/role_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the RoleTemplatePrototypeRole model + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() + .name("testString") + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the CreateRoleTemplateOptions model + CreateRoleTemplateOptions createRoleTemplateOptionsModel = new CreateRoleTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .description("testString") + .committed(true) + .role(roleTemplatePrototypeRoleModel) + .acceptLanguage("default") + .build(); + + // Invoke createRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.createRoleTemplate(createRoleTemplateOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createRoleTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createRoleTemplate operation with and without retries enabled + @Test + public void testCreateRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateRoleTemplateWOptions(); + } + + // Test the createRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createRoleTemplate(null).execute(); + } + + // Test the getRoleTemplate operation with a valid options model parameter + @Test + public void testGetRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String getRoleTemplatePath = "/v1/role_templates/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetRoleTemplateOptions model + GetRoleTemplateOptions getRoleTemplateOptionsModel = new GetRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .state("active") + .build(); + + // Invoke getRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.getRoleTemplate(getRoleTemplateOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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, getRoleTemplatePath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + } + + // Test the getRoleTemplate operation with and without retries enabled + @Test + public void testGetRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetRoleTemplateWOptions(); + } + + // Test the getRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getRoleTemplate(null).execute(); + } + + // Test the deleteRoleTemplate operation with a valid options model parameter + @Test + public void testDeleteRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteRoleTemplatePath = "/v1/role_templates/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteRoleTemplateOptions model + DeleteRoleTemplateOptions deleteRoleTemplateOptionsModel = new DeleteRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .build(); + + // Invoke deleteRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteRoleTemplate(deleteRoleTemplateOptionsModel).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, deleteRoleTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteRoleTemplate operation with and without retries enabled + @Test + public void testDeleteRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteRoleTemplateWOptions(); + } + + // Test the deleteRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteRoleTemplate(null).execute(); + } + + // Test the createRoleTemplateVersion operation with a valid options model parameter + @Test + public void testCreateRoleTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String createRoleTemplateVersionPath = "/v1/role_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateRole model + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the CreateRoleTemplateVersionOptions model + CreateRoleTemplateVersionOptions createRoleTemplateVersionOptionsModel = new CreateRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .name("testString") + .description("testString") + .role(templateRoleModel) + .committed(true) + .build(); + + // Invoke createRoleTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.createRoleTemplateVersion(createRoleTemplateVersionOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createRoleTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createRoleTemplateVersion operation with and without retries enabled + @Test + public void testCreateRoleTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateRoleTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateRoleTemplateVersionWOptions(); + } + + // Test the createRoleTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createRoleTemplateVersion(null).execute(); + } + + // Test the listRoleTemplateVersions operation with a valid options model parameter + @Test + public void testListRoleTemplateVersionsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; + String listRoleTemplateVersionsPath = "/v1/role_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListRoleTemplateVersionsOptions model + ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptionsModel = new ListRoleTemplateVersionsOptions.Builder() + .roleTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listRoleTemplateVersions() with a valid options model and verify the result + Response response = iamPolicyManagementService.listRoleTemplateVersions(listRoleTemplateVersionsOptionsModel).execute(); + assertNotNull(response); + RoleTemplateVersionsCollection 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, listRoleTemplateVersionsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listRoleTemplateVersions operation with and without retries enabled + @Test + public void testListRoleTemplateVersionsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListRoleTemplateVersionsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListRoleTemplateVersionsWOptions(); + } + + // Test the listRoleTemplateVersions operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleTemplateVersionsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listRoleTemplateVersions(null).execute(); + } + + // Test the listRoleTemplateVersions operation using the RoleTemplateVersionsPager.getNext() method + @Test + public void testListRoleTemplateVersionsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions = new ListRoleTemplateVersionsOptions.Builder() + .roleTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + RoleTemplateVersionsPager pager = new RoleTemplateVersionsPager(iamPolicyManagementService, listRoleTemplateVersionsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listRoleTemplateVersions operation using the RoleTemplateVersionsPager.getAll() method + @Test + public void testListRoleTemplateVersionsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions = new ListRoleTemplateVersionsOptions.Builder() + .roleTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + RoleTemplateVersionsPager pager = new RoleTemplateVersionsPager(iamPolicyManagementService, listRoleTemplateVersionsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the replaceRoleTemplate operation with a valid options model parameter + @Test + public void testReplaceRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String replaceRoleTemplatePath = "/v1/role_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateRole model + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the ReplaceRoleTemplateOptions model + ReplaceRoleTemplateOptions replaceRoleTemplateOptionsModel = new ReplaceRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .role(templateRoleModel) + .committed(true) + .build(); + + // Invoke replaceRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.replaceRoleTemplate(replaceRoleTemplateOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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, replaceRoleTemplatePath); + // 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 replaceRoleTemplate operation with and without retries enabled + @Test + public void testReplaceRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplaceRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplaceRoleTemplateWOptions(); + } + + // Test the replaceRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replaceRoleTemplate(null).execute(); + } + + // Test the deleteRoleTemplateVersion operation with a valid options model parameter + @Test + public void testDeleteRoleTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteRoleTemplateVersionPath = "/v1/role_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteRoleTemplateVersionOptions model + DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptionsModel = new DeleteRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + + // Invoke deleteRoleTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteRoleTemplateVersion(deleteRoleTemplateVersionOptionsModel).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, deleteRoleTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteRoleTemplateVersion operation with and without retries enabled + @Test + public void testDeleteRoleTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteRoleTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteRoleTemplateVersionWOptions(); + } + + // Test the deleteRoleTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteRoleTemplateVersion(null).execute(); + } + + // Test the getRoleTemplateVersion operation with a valid options model parameter + @Test + public void testGetRoleTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String getRoleTemplateVersionPath = "/v1/role_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetRoleTemplateVersionOptions model + GetRoleTemplateVersionOptions getRoleTemplateVersionOptionsModel = new GetRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + + // Invoke getRoleTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.getRoleTemplateVersion(getRoleTemplateVersionOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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, getRoleTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getRoleTemplateVersion operation with and without retries enabled + @Test + public void testGetRoleTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetRoleTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetRoleTemplateVersionWOptions(); + } + + // Test the getRoleTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getRoleTemplateVersion(null).execute(); + } + + // Test the commitRoleTemplate operation with a valid options model parameter + @Test + public void testCommitRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String commitRoleTemplatePath = "/v1/role_templates/testString/versions/testString/commit"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the CommitRoleTemplateOptions model + CommitRoleTemplateOptions commitRoleTemplateOptionsModel = new CommitRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + + // Invoke commitRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.commitRoleTemplate(commitRoleTemplateOptionsModel).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, commitRoleTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the commitRoleTemplate operation with and without retries enabled + @Test + public void testCommitRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCommitRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCommitRoleTemplateWOptions(); + } + + // Test the commitRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.commitRoleTemplate(null).execute(); + } + + // Test the listRoleAssignments operation with a valid options model parameter + @Test + public void testListRoleAssignmentsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; + String listRoleAssignmentsPath = "/v1/role_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListRoleAssignmentsOptions model + ListRoleAssignmentsOptions listRoleAssignmentsOptionsModel = new ListRoleAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listRoleAssignments() with a valid options model and verify the result + Response response = iamPolicyManagementService.listRoleAssignments(listRoleAssignmentsOptionsModel).execute(); + assertNotNull(response); + RoleAssignmentCollection 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, listRoleAssignmentsPath); + // 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(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listRoleAssignments operation with and without retries enabled + @Test + public void testListRoleAssignmentsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListRoleAssignmentsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListRoleAssignmentsWOptions(); + } + + // Test the listRoleAssignments operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleAssignmentsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listRoleAssignments(null).execute(); + } + + // Test the listRoleAssignments operation using the RoleAssignmentsPager.getNext() method + @Test + public void testListRoleAssignmentsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleAssignmentsOptions listRoleAssignmentsOptions = new ListRoleAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + RoleAssignmentsPager pager = new RoleAssignmentsPager(iamPolicyManagementService, listRoleAssignmentsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listRoleAssignments operation using the RoleAssignmentsPager.getAll() method + @Test + public void testListRoleAssignmentsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleAssignmentsOptions listRoleAssignmentsOptions = new ListRoleAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + RoleAssignmentsPager pager = new RoleAssignmentsPager(iamPolicyManagementService, listRoleAssignmentsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createRoleTemplateAssignment operation with a valid options model parameter + @Test + public void testCreateRoleTemplateAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; + String createRoleTemplateAssignmentPath = "/v1/role_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the AssignmentTargetDetails model + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + + // Construct an instance of the RoleAssignmentTemplate model + RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + + // Construct an instance of the CreateRoleTemplateAssignmentOptions model + CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptionsModel = new CreateRoleTemplateAssignmentOptions.Builder() + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(roleAssignmentTemplateModel)) + .acceptLanguage("default") + .build(); + + // Invoke createRoleTemplateAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.createRoleTemplateAssignment(createRoleTemplateAssignmentOptionsModel).execute(); + assertNotNull(response); + RoleAssignmentCollection 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createRoleTemplateAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createRoleTemplateAssignment operation with and without retries enabled + @Test + public void testCreateRoleTemplateAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateRoleTemplateAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateRoleTemplateAssignmentWOptions(); + } + + // Test the createRoleTemplateAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createRoleTemplateAssignment(null).execute(); + } + + // Test the getRoleAssignment operation with a valid options model parameter + @Test + public void testGetRoleAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; + String getRoleAssignmentPath = "/v1/role_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetRoleAssignmentOptions model + GetRoleAssignmentOptions getRoleAssignmentOptionsModel = new GetRoleAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke getRoleAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.getRoleAssignment(getRoleAssignmentOptionsModel).execute(); + assertNotNull(response); + RoleAssignment 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, getRoleAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getRoleAssignment operation with and without retries enabled + @Test + public void testGetRoleAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetRoleAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetRoleAssignmentWOptions(); + } + + // Test the getRoleAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getRoleAssignment(null).execute(); + } + + // Test the updateRoleAssignment operation with a valid options model parameter + @Test + public void testUpdateRoleAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; + String updateRoleAssignmentPath = "/v1/role_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdateRoleAssignmentOptions model + UpdateRoleAssignmentOptions updateRoleAssignmentOptionsModel = new UpdateRoleAssignmentOptions.Builder() + .assignmentId("testString") + .ifMatch("testString") + .templateVersion("testString") + .build(); + + // Invoke updateRoleAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.updateRoleAssignment(updateRoleAssignmentOptionsModel).execute(); + assertNotNull(response); + RoleAssignment 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updateRoleAssignmentPath); + // 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 updateRoleAssignment operation with and without retries enabled + @Test + public void testUpdateRoleAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdateRoleAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdateRoleAssignmentWOptions(); + } + + // Test the updateRoleAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateRoleAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updateRoleAssignment(null).execute(); + } + + // Test the deleteRoleAssignment operation with a valid options model parameter + @Test + public void testDeleteRoleAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteRoleAssignmentPath = "/v1/role_assignments/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteRoleAssignmentOptions model + DeleteRoleAssignmentOptions deleteRoleAssignmentOptionsModel = new DeleteRoleAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke deleteRoleAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteRoleAssignment(deleteRoleAssignmentOptionsModel).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, deleteRoleAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteRoleAssignment operation with and without retries enabled + @Test + public void testDeleteRoleAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteRoleAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteRoleAssignmentWOptions(); + } + + // Test the deleteRoleAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteRoleAssignment(null).execute(); + } + + // Perform setup needed before each test method + @BeforeMethod + public void beforeEachTest() { + // Start the mock server. + try { + server = new MockWebServer(); + server.start(); + } catch (IOException err) { + fail("Failed to instantiate mock web server"); + } + + // Construct an instance of the service + constructClientService(); + } + + // Perform tear down after each test method + @AfterMethod + public void afterEachTest() throws IOException { + server.shutdown(); + iamPolicyManagementService = null; + } + + // Constructs an instance of the service to be used by the tests + public void constructClientService() { + System.setProperty("TESTSERVICE_AUTH_TYPE", "noAuth"); + final String serviceName = "testService"; + + iamPolicyManagementService = IamPolicyManagement.newInstance(serviceName); + String url = server.url("/").toString(); + iamPolicyManagementService.setServiceUrl(url); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java new file mode 100644 index 00000000000..5630ccb0c03 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.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 AccountSettingsAccessManagement model. + */ +public class AccountSettingsAccessManagementTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAccountSettingsAccessManagement() throws Throwable { + AccountSettingsAccessManagement accountSettingsAccessManagementModel = new AccountSettingsAccessManagement(); + assertNull(accountSettingsAccessManagementModel.getExternalAccountIdentityInteraction()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java new file mode 100644 index 00000000000..d4dfc8863c6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentCollection model. + */ +public class ActionControlAssignmentCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentCollection() throws Throwable { + ActionControlAssignmentCollection actionControlAssignmentCollectionModel = new ActionControlAssignmentCollection(); + assertNull(actionControlAssignmentCollectionModel.getLimit()); + assertNull(actionControlAssignmentCollectionModel.getFirst()); + assertNull(actionControlAssignmentCollectionModel.getNext()); + assertNull(actionControlAssignmentCollectionModel.getPrevious()); + assertNull(actionControlAssignmentCollectionModel.getAssignments()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java new file mode 100644 index 00000000000..cb53bc44d1c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java @@ -0,0 +1,43 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResourceActionControl model. + */ +public class ActionControlAssignmentResourceActionControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentResourceActionControl() throws Throwable { + ActionControlAssignmentResourceActionControl actionControlAssignmentResourceActionControlModel = new ActionControlAssignmentResourceActionControl(); + assertNull(actionControlAssignmentResourceActionControlModel.getResourceCreated()); + assertNull(actionControlAssignmentResourceActionControlModel.getErrorMessage()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java new file mode 100644 index 00000000000..284ec17a0f0 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResourceCreated model. + */ +public class ActionControlAssignmentResourceCreatedTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentResourceCreated() throws Throwable { + ActionControlAssignmentResourceCreated actionControlAssignmentResourceCreatedModel = new ActionControlAssignmentResourceCreated(); + assertNull(actionControlAssignmentResourceCreatedModel.getId()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java new file mode 100644 index 00000000000..eaa560dce78 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResource model. + */ +public class ActionControlAssignmentResourceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentResource() throws Throwable { + ActionControlAssignmentResource actionControlAssignmentResourceModel = new ActionControlAssignmentResource(); + assertNull(actionControlAssignmentResourceModel.getTarget()); + assertNull(actionControlAssignmentResourceModel.getActionControl()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java new file mode 100644 index 00000000000..262a74bea45 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentTemplate model. + */ +public class ActionControlAssignmentTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentTemplate() throws Throwable { + ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(actionControlAssignmentTemplateModel.id(), "testString"); + assertEquals(actionControlAssignmentTemplateModel.version(), "testString"); + + String json = TestUtilities.serialize(actionControlAssignmentTemplateModel); + + ActionControlAssignmentTemplate actionControlAssignmentTemplateModelNew = TestUtilities.deserialize(json, ActionControlAssignmentTemplate.class); + assertTrue(actionControlAssignmentTemplateModelNew instanceof ActionControlAssignmentTemplate); + assertEquals(actionControlAssignmentTemplateModelNew.id(), "testString"); + assertEquals(actionControlAssignmentTemplateModelNew.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testActionControlAssignmentTemplateError() throws Throwable { + new ActionControlAssignmentTemplate.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java new file mode 100644 index 00000000000..c5173f940c4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignment model. + */ +public class ActionControlAssignmentTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignment() throws Throwable { + ActionControlAssignment actionControlAssignmentModel = new ActionControlAssignment(); + assertNull(actionControlAssignmentModel.getTemplate()); + assertNull(actionControlAssignmentModel.getTarget()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java new file mode 100644 index 00000000000..58155ee1e7e --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java @@ -0,0 +1,46 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplateCollection model. + */ +public class ActionControlTemplateCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlTemplateCollection() throws Throwable { + ActionControlTemplateCollection actionControlTemplateCollectionModel = new ActionControlTemplateCollection(); + assertNull(actionControlTemplateCollectionModel.getLimit()); + assertNull(actionControlTemplateCollectionModel.getFirst()); + assertNull(actionControlTemplateCollectionModel.getNext()); + assertNull(actionControlTemplateCollectionModel.getPrevious()); + assertNull(actionControlTemplateCollectionModel.getActionControlTemplates()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java new file mode 100644 index 00000000000..a086106a57e --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplate model. + */ +public class ActionControlTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlTemplate() throws Throwable { + ActionControlTemplate actionControlTemplateModel = new ActionControlTemplate(); + assertNull(actionControlTemplateModel.getName()); + assertNull(actionControlTemplateModel.getDescription()); + assertNull(actionControlTemplateModel.getAccountId()); + assertNull(actionControlTemplateModel.isCommitted()); + assertNull(actionControlTemplateModel.getActionControl()); + assertNull(actionControlTemplateModel.getVersion()); + assertNull(actionControlTemplateModel.getState()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java new file mode 100644 index 00000000000..7b6bf014357 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java @@ -0,0 +1,46 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplateVersionsCollection model. + */ +public class ActionControlTemplateVersionsCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlTemplateVersionsCollection() throws Throwable { + ActionControlTemplateVersionsCollection actionControlTemplateVersionsCollectionModel = new ActionControlTemplateVersionsCollection(); + assertNull(actionControlTemplateVersionsCollectionModel.getLimit()); + assertNull(actionControlTemplateVersionsCollectionModel.getFirst()); + assertNull(actionControlTemplateVersionsCollectionModel.getNext()); + assertNull(actionControlTemplateVersionsCollectionModel.getPrevious()); + assertNull(actionControlTemplateVersionsCollectionModel.getVersions()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java new file mode 100644 index 00000000000..4038d52606c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentResourceCreated model. + */ +public class AssignmentResourceCreatedTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAssignmentResourceCreated() throws Throwable { + AssignmentResourceCreated assignmentResourceCreatedModel = new AssignmentResourceCreated(); + assertNull(assignmentResourceCreatedModel.getId()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java new file mode 100644 index 00000000000..81e3799a42c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentResourceError model. + */ +public class AssignmentResourceErrorTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAssignmentResourceError() throws Throwable { + AssignmentResourceError assignmentResourceErrorModel = new AssignmentResourceError(); + assertNull(assignmentResourceErrorModel.getName()); + assertNull(assignmentResourceErrorModel.getErrorCode()); + assertNull(assignmentResourceErrorModel.getMessage()); + assertNull(assignmentResourceErrorModel.getCode()); + assertNull(assignmentResourceErrorModel.getErrors()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java new file mode 100644 index 00000000000..48e4a605cbb --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentTargetDetails model. + */ +public class AssignmentTargetDetailsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAssignmentTargetDetails() throws Throwable { + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + assertEquals(assignmentTargetDetailsModel.type(), "Account"); + assertEquals(assignmentTargetDetailsModel.id(), "testString"); + + String json = TestUtilities.serialize(assignmentTargetDetailsModel); + + AssignmentTargetDetails assignmentTargetDetailsModelNew = TestUtilities.deserialize(json, AssignmentTargetDetails.class); + assertTrue(assignmentTargetDetailsModelNew instanceof AssignmentTargetDetails); + assertEquals(assignmentTargetDetailsModelNew.type(), "Account"); + assertEquals(assignmentTargetDetailsModelNew.id(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testAssignmentTargetDetailsError() throws Throwable { + new AssignmentTargetDetails.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java new file mode 100644 index 00000000000..bcecf27ed27 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java @@ -0,0 +1,48 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentTemplateDetails model. + */ +public class AssignmentTemplateDetailsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAssignmentTemplateDetails() throws Throwable { + AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(assignmentTemplateDetailsModel.id(), "testString"); + assertEquals(assignmentTemplateDetailsModel.version(), "testString"); + + String json = TestUtilities.serialize(assignmentTemplateDetailsModel); + + AssignmentTemplateDetails assignmentTemplateDetailsModelNew = TestUtilities.deserialize(json, AssignmentTemplateDetails.class); + assertTrue(assignmentTemplateDetailsModelNew instanceof AssignmentTemplateDetails); + assertEquals(assignmentTemplateDetailsModelNew.id(), "testString"); + assertEquals(assignmentTemplateDetailsModelNew.version(), "testString"); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..2b5ed42c76a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CommitActionControlTemplateOptions model. + */ +public class CommitActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCommitActionControlTemplateOptions() throws Throwable { + CommitActionControlTemplateOptions commitActionControlTemplateOptionsModel = new CommitActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + assertEquals(commitActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(commitActionControlTemplateOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitActionControlTemplateOptionsError() throws Throwable { + new CommitActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..66cdca59588 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CommitPolicyTemplateOptions model. + */ +public class CommitPolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCommitPolicyTemplateOptions() throws Throwable { + CommitPolicyTemplateOptions commitPolicyTemplateOptionsModel = new CommitPolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + assertEquals(commitPolicyTemplateOptionsModel.policyTemplateId(), "testString"); + assertEquals(commitPolicyTemplateOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitPolicyTemplateOptionsError() throws Throwable { + new CommitPolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..09c48b8e80e --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CommitRoleTemplateOptions model. + */ +public class CommitRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCommitRoleTemplateOptions() throws Throwable { + CommitRoleTemplateOptions commitRoleTemplateOptionsModel = new CommitRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + assertEquals(commitRoleTemplateOptionsModel.roleTemplateId(), "testString"); + assertEquals(commitRoleTemplateOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitRoleTemplateOptionsError() throws Throwable { + new CommitRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java new file mode 100644 index 00000000000..94ef6ce21e8 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.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 ConflictsWith model. + */ +public class ConflictsWithTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testConflictsWith() throws Throwable { + ConflictsWith conflictsWithModel = new ConflictsWith(); + assertNull(conflictsWithModel.getEtag()); + assertNull(conflictsWithModel.getRole()); + assertNull(conflictsWithModel.getPolicy()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java new file mode 100644 index 00000000000..bbe19a7b9b1 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponseControl model. + */ +public class ControlResponseControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testControlResponseControl() throws Throwable { + ControlResponseControl controlResponseControlModel = new ControlResponseControl(); + assertNull(controlResponseControlModel.getGrant()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java new file mode 100644 index 00000000000..7b2fbfae90d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControlWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponseControlWithEnrichedRoles model. + */ +public class ControlResponseControlWithEnrichedRolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testControlResponseControlWithEnrichedRoles() throws Throwable { + ControlResponseControlWithEnrichedRoles controlResponseControlWithEnrichedRolesModel = new ControlResponseControlWithEnrichedRoles(); + assertNull(controlResponseControlWithEnrichedRolesModel.getGrant()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java new file mode 100644 index 00000000000..f42cbc0a2d8 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponse; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponse model. + */ +public class ControlResponseTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testControlResponse() throws Throwable { + ControlResponse controlResponseModel = new ControlResponse(); + assertNotNull(controlResponseModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java new file mode 100644 index 00000000000..c8b1e3000f9 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 Control model. + */ +public class ControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testControl() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + assertEquals(controlModel.grant(), grantModel); + + String json = TestUtilities.serialize(controlModel); + + Control controlModelNew = TestUtilities.deserialize(json, Control.class); + assertTrue(controlModelNew instanceof Control); + assertEquals(controlModelNew.grant().toString(), grantModel.toString()); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testControlError() throws Throwable { + new Control.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java new file mode 100644 index 00000000000..f2557c8f64f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateAssignmentOptions model. + */ +public class CreateActionControlTemplateAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateActionControlTemplateAssignmentOptions() throws Throwable { + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + assertEquals(assignmentTargetDetailsModel.type(), "Account"); + assertEquals(assignmentTargetDetailsModel.id(), "testString"); + + ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(actionControlAssignmentTemplateModel.id(), "testString"); + assertEquals(actionControlAssignmentTemplateModel.version(), "testString"); + + CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptionsModel = new CreateActionControlTemplateAssignmentOptions.Builder() + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(actionControlAssignmentTemplateModel)) + .acceptLanguage("default") + .build(); + assertEquals(createActionControlTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); + assertEquals(createActionControlTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(actionControlAssignmentTemplateModel)); + assertEquals(createActionControlTemplateAssignmentOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateAssignmentOptionsError() throws Throwable { + new CreateActionControlTemplateAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..2508072a03c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateOptions model. + */ +public class CreateActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateActionControlTemplateOptions() throws Throwable { + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateActionControlModel.serviceName(), "testString"); + assertEquals(templateActionControlModel.description(), "testString"); + assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); + + CreateActionControlTemplateOptions createActionControlTemplateOptionsModel = new CreateActionControlTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .description("testString") + .committed(true) + .actionControl(templateActionControlModel) + .acceptLanguage("default") + .build(); + assertEquals(createActionControlTemplateOptionsModel.name(), "testString"); + assertEquals(createActionControlTemplateOptionsModel.accountId(), "testString"); + assertEquals(createActionControlTemplateOptionsModel.description(), "testString"); + assertEquals(createActionControlTemplateOptionsModel.committed(), Boolean.valueOf(true)); + assertEquals(createActionControlTemplateOptionsModel.actionControl(), templateActionControlModel); + assertEquals(createActionControlTemplateOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateOptionsError() throws Throwable { + new CreateActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..d5070249115 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateVersionOptions model. + */ +public class CreateActionControlTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateActionControlTemplateVersionOptions() throws Throwable { + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateActionControlModel.serviceName(), "testString"); + assertEquals(templateActionControlModel.description(), "testString"); + assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); + + CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptionsModel = new CreateActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .name("testString") + .description("testString") + .actionControl(templateActionControlModel) + .committed(true) + .build(); + assertEquals(createActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(createActionControlTemplateVersionOptionsModel.name(), "testString"); + assertEquals(createActionControlTemplateVersionOptionsModel.description(), "testString"); + assertEquals(createActionControlTemplateVersionOptionsModel.actionControl(), templateActionControlModel); + assertEquals(createActionControlTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateVersionOptionsError() throws Throwable { + new CreateActionControlTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java new file mode 100644 index 00000000000..c2dd24fd213 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java @@ -0,0 +1,103 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyOptions model. + */ +public class CreatePolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreatePolicyOptions() throws Throwable { + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(subjectAttributeModel.name(), "testString"); + assertEquals(subjectAttributeModel.value(), "testString"); + + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); + + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + assertEquals(policyRoleModel.roleId(), "testString"); + + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceAttributeModel.name(), "testString"); + assertEquals(resourceAttributeModel.value(), "testString"); + assertEquals(resourceAttributeModel.operator(), "testString"); + + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceTagModel.name(), "testString"); + assertEquals(resourceTagModel.value(), "testString"); + assertEquals(resourceTagModel.operator(), "testString"); + + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); + assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); + + CreatePolicyOptions createPolicyOptionsModel = new CreatePolicyOptions.Builder() + .type("testString") + .subjects(java.util.Arrays.asList(policySubjectModel)) + .roles(java.util.Arrays.asList(policyRoleModel)) + .resources(java.util.Arrays.asList(policyResourceModel)) + .description("testString") + .acceptLanguage("default") + .build(); + assertEquals(createPolicyOptionsModel.type(), "testString"); + assertEquals(createPolicyOptionsModel.subjects(), java.util.Arrays.asList(policySubjectModel)); + assertEquals(createPolicyOptionsModel.roles(), java.util.Arrays.asList(policyRoleModel)); + assertEquals(createPolicyOptionsModel.resources(), java.util.Arrays.asList(policyResourceModel)); + assertEquals(createPolicyOptionsModel.description(), "testString"); + assertEquals(createPolicyOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyOptionsError() throws Throwable { + new CreatePolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java new file mode 100644 index 00000000000..5b08b4b398a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java @@ -0,0 +1,67 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateAssignmentOptions model. + */ +public class CreatePolicyTemplateAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreatePolicyTemplateAssignmentOptions() throws Throwable { + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + assertEquals(assignmentTargetDetailsModel.type(), "Account"); + assertEquals(assignmentTargetDetailsModel.id(), "testString"); + + AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(assignmentTemplateDetailsModel.id(), "testString"); + assertEquals(assignmentTemplateDetailsModel.version(), "testString"); + + CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptionsModel = new CreatePolicyTemplateAssignmentOptions.Builder() + .version("1.0") + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(assignmentTemplateDetailsModel)) + .acceptLanguage("default") + .build(); + assertEquals(createPolicyTemplateAssignmentOptionsModel.version(), "1.0"); + assertEquals(createPolicyTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); + assertEquals(createPolicyTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(assignmentTemplateDetailsModel)); + assertEquals(createPolicyTemplateAssignmentOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateAssignmentOptionsError() throws Throwable { + new CreatePolicyTemplateAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..68617451831 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java @@ -0,0 +1,145 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateOptions model. + */ +public class CreatePolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreatePolicyTemplateOptions() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + assertEquals(templatePolicyModel.type(), "access"); + assertEquals(templatePolicyModel.description(), "testString"); + assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); + assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); + assertEquals(templatePolicyModel.pattern(), "testString"); + assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); + assertEquals(templatePolicyModel.control(), templateControlModel); + + CreatePolicyTemplateOptions createPolicyTemplateOptionsModel = new CreatePolicyTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .policy(templatePolicyModel) + .description("testString") + .committed(true) + .acceptLanguage("default") + .build(); + assertEquals(createPolicyTemplateOptionsModel.name(), "testString"); + assertEquals(createPolicyTemplateOptionsModel.accountId(), "testString"); + assertEquals(createPolicyTemplateOptionsModel.policy(), templatePolicyModel); + assertEquals(createPolicyTemplateOptionsModel.description(), "testString"); + assertEquals(createPolicyTemplateOptionsModel.committed(), Boolean.valueOf(true)); + assertEquals(createPolicyTemplateOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateOptionsError() throws Throwable { + new CreatePolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..d6919e6e1b9 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java @@ -0,0 +1,143 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateVersionOptions model. + */ +public class CreatePolicyTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreatePolicyTemplateVersionOptions() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + assertEquals(templatePolicyModel.type(), "access"); + assertEquals(templatePolicyModel.description(), "testString"); + assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); + assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); + assertEquals(templatePolicyModel.pattern(), "testString"); + assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); + assertEquals(templatePolicyModel.control(), templateControlModel); + + CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptionsModel = new CreatePolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .policy(templatePolicyModel) + .name("testString") + .description("testString") + .committed(true) + .build(); + assertEquals(createPolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); + assertEquals(createPolicyTemplateVersionOptionsModel.policy(), templatePolicyModel); + assertEquals(createPolicyTemplateVersionOptionsModel.name(), "testString"); + assertEquals(createPolicyTemplateVersionOptionsModel.description(), "testString"); + assertEquals(createPolicyTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateVersionOptionsError() throws Throwable { + new CreatePolicyTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java new file mode 100644 index 00000000000..849512f2bda --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleOptions model. + */ +public class CreateRoleOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateRoleOptions() throws Throwable { + CreateRoleOptions createRoleOptionsModel = new CreateRoleOptions.Builder() + .displayName("testString") + .actions(java.util.Arrays.asList("testString")) + .name("Developer") + .accountId("testString") + .serviceName("iam-groups") + .description("testString") + .acceptLanguage("default") + .build(); + assertEquals(createRoleOptionsModel.displayName(), "testString"); + assertEquals(createRoleOptionsModel.actions(), java.util.Arrays.asList("testString")); + assertEquals(createRoleOptionsModel.name(), "Developer"); + assertEquals(createRoleOptionsModel.accountId(), "testString"); + assertEquals(createRoleOptionsModel.serviceName(), "iam-groups"); + assertEquals(createRoleOptionsModel.description(), "testString"); + assertEquals(createRoleOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleOptionsError() throws Throwable { + new CreateRoleOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java new file mode 100644 index 00000000000..bff414389a5 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateAssignmentOptions model. + */ +public class CreateRoleTemplateAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateRoleTemplateAssignmentOptions() throws Throwable { + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + assertEquals(assignmentTargetDetailsModel.type(), "Account"); + assertEquals(assignmentTargetDetailsModel.id(), "testString"); + + RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleAssignmentTemplateModel.id(), "testString"); + assertEquals(roleAssignmentTemplateModel.version(), "testString"); + + CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptionsModel = new CreateRoleTemplateAssignmentOptions.Builder() + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(roleAssignmentTemplateModel)) + .acceptLanguage("default") + .build(); + assertEquals(createRoleTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); + assertEquals(createRoleTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(roleAssignmentTemplateModel)); + assertEquals(createRoleTemplateAssignmentOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateAssignmentOptionsError() throws Throwable { + new CreateRoleTemplateAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..799743ddbf4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateOptions model. + */ +public class CreateRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateRoleTemplateOptions() throws Throwable { + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() + .name("testString") + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(roleTemplatePrototypeRoleModel.name(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.displayName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.serviceName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.description(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.actions(), java.util.Arrays.asList("testString")); + + CreateRoleTemplateOptions createRoleTemplateOptionsModel = new CreateRoleTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .description("testString") + .committed(true) + .role(roleTemplatePrototypeRoleModel) + .acceptLanguage("default") + .build(); + assertEquals(createRoleTemplateOptionsModel.name(), "testString"); + assertEquals(createRoleTemplateOptionsModel.accountId(), "testString"); + assertEquals(createRoleTemplateOptionsModel.description(), "testString"); + assertEquals(createRoleTemplateOptionsModel.committed(), Boolean.valueOf(true)); + assertEquals(createRoleTemplateOptionsModel.role(), roleTemplatePrototypeRoleModel); + assertEquals(createRoleTemplateOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateOptionsError() throws Throwable { + new CreateRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..a7d2d312afa --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateVersionOptions model. + */ +public class CreateRoleTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateRoleTemplateVersionOptions() throws Throwable { + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateRoleModel.displayName(), "testString"); + assertEquals(templateRoleModel.serviceName(), "testString"); + assertEquals(templateRoleModel.description(), "testString"); + assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); + + CreateRoleTemplateVersionOptions createRoleTemplateVersionOptionsModel = new CreateRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .name("testString") + .description("testString") + .role(templateRoleModel) + .committed(true) + .build(); + assertEquals(createRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); + assertEquals(createRoleTemplateVersionOptionsModel.name(), "testString"); + assertEquals(createRoleTemplateVersionOptionsModel.description(), "testString"); + assertEquals(createRoleTemplateVersionOptionsModel.role(), templateRoleModel); + assertEquals(createRoleTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateVersionOptionsError() throws Throwable { + new CreateRoleTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java new file mode 100644 index 00000000000..acce8b7b537 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java @@ -0,0 +1,131 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateV2PolicyOptions model. + */ +public class CreateV2PolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateV2PolicyOptions() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + assertEquals(controlModel.grant(), grantModel); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + CreateV2PolicyOptions createV2PolicyOptionsModel = new CreateV2PolicyOptions.Builder() + .control(controlModel) + .type("access") + .description("testString") + .subject(v2PolicySubjectModel) + .resource(v2PolicyResourceModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .acceptLanguage("default") + .build(); + assertEquals(createV2PolicyOptionsModel.control(), controlModel); + assertEquals(createV2PolicyOptionsModel.type(), "access"); + assertEquals(createV2PolicyOptionsModel.description(), "testString"); + assertEquals(createV2PolicyOptionsModel.subject(), v2PolicySubjectModel); + assertEquals(createV2PolicyOptionsModel.resource(), v2PolicyResourceModel); + assertEquals(createV2PolicyOptionsModel.pattern(), "testString"); + assertEquals(createV2PolicyOptionsModel.rule(), v2PolicyRuleModel); + assertEquals(createV2PolicyOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateV2PolicyOptionsError() throws Throwable { + new CreateV2PolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java new file mode 100644 index 00000000000..acc0dc0a3c1 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 CustomRole model. + */ +public class CustomRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCustomRole() throws Throwable { + CustomRole customRoleModel = new CustomRole(); + assertNull(customRoleModel.getDisplayName()); + assertNull(customRoleModel.getDescription()); + assertNull(customRoleModel.getActions()); + assertNull(customRoleModel.getName()); + assertNull(customRoleModel.getAccountId()); + assertNull(customRoleModel.getServiceName()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java new file mode 100644 index 00000000000..1a38606ede5 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlAssignmentOptions model. + */ +public class DeleteActionControlAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteActionControlAssignmentOptions() throws Throwable { + DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptionsModel = new DeleteActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(deleteActionControlAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlAssignmentOptionsError() throws Throwable { + new DeleteActionControlAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..75b111e9214 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlTemplateOptions model. + */ +public class DeleteActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteActionControlTemplateOptions() throws Throwable { + DeleteActionControlTemplateOptions deleteActionControlTemplateOptionsModel = new DeleteActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .build(); + assertEquals(deleteActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlTemplateOptionsError() throws Throwable { + new DeleteActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..64fb5790244 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlTemplateVersionOptions model. + */ +public class DeleteActionControlTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteActionControlTemplateVersionOptions() throws Throwable { + DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptionsModel = new DeleteActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + assertEquals(deleteActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(deleteActionControlTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlTemplateVersionOptionsError() throws Throwable { + new DeleteActionControlTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java new file mode 100644 index 00000000000..75aed905222 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyAssignmentOptions model. + */ +public class DeletePolicyAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeletePolicyAssignmentOptions() throws Throwable { + DeletePolicyAssignmentOptions deletePolicyAssignmentOptionsModel = new DeletePolicyAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(deletePolicyAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyAssignmentOptionsError() throws Throwable { + new DeletePolicyAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java new file mode 100644 index 00000000000..1b130eb0f79 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyOptions model. + */ +public class DeletePolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeletePolicyOptions() throws Throwable { + DeletePolicyOptions deletePolicyOptionsModel = new DeletePolicyOptions.Builder() + .policyId("testString") + .build(); + assertEquals(deletePolicyOptionsModel.policyId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyOptionsError() throws Throwable { + new DeletePolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..288517222aa --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyTemplateOptions model. + */ +public class DeletePolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeletePolicyTemplateOptions() throws Throwable { + DeletePolicyTemplateOptions deletePolicyTemplateOptionsModel = new DeletePolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .build(); + assertEquals(deletePolicyTemplateOptionsModel.policyTemplateId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyTemplateOptionsError() throws Throwable { + new DeletePolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..7b1c6cffa1d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyTemplateVersionOptions model. + */ +public class DeletePolicyTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeletePolicyTemplateVersionOptions() throws Throwable { + DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptionsModel = new DeletePolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + assertEquals(deletePolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); + assertEquals(deletePolicyTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyTemplateVersionOptionsError() throws Throwable { + new DeletePolicyTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java new file mode 100644 index 00000000000..7f9b614304f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleAssignmentOptions model. + */ +public class DeleteRoleAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteRoleAssignmentOptions() throws Throwable { + DeleteRoleAssignmentOptions deleteRoleAssignmentOptionsModel = new DeleteRoleAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(deleteRoleAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleAssignmentOptionsError() throws Throwable { + new DeleteRoleAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java new file mode 100644 index 00000000000..9c6690cda7b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleOptions model. + */ +public class DeleteRoleOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteRoleOptions() throws Throwable { + DeleteRoleOptions deleteRoleOptionsModel = new DeleteRoleOptions.Builder() + .roleId("testString") + .build(); + assertEquals(deleteRoleOptionsModel.roleId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleOptionsError() throws Throwable { + new DeleteRoleOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..3fc04286ed3 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleTemplateOptions model. + */ +public class DeleteRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteRoleTemplateOptions() throws Throwable { + DeleteRoleTemplateOptions deleteRoleTemplateOptionsModel = new DeleteRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .build(); + assertEquals(deleteRoleTemplateOptionsModel.roleTemplateId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleTemplateOptionsError() throws Throwable { + new DeleteRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..ff652fa335c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleTemplateVersionOptions model. + */ +public class DeleteRoleTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteRoleTemplateVersionOptions() throws Throwable { + DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptionsModel = new DeleteRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + assertEquals(deleteRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); + assertEquals(deleteRoleTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleTemplateVersionOptionsError() throws Throwable { + new DeleteRoleTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java new file mode 100644 index 00000000000..6a33aa8f116 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteV2PolicyOptions model. + */ +public class DeleteV2PolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteV2PolicyOptions() throws Throwable { + DeleteV2PolicyOptions deleteV2PolicyOptionsModel = new DeleteV2PolicyOptions.Builder() + .id("testString") + .build(); + assertEquals(deleteV2PolicyOptionsModel.id(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteV2PolicyOptionsError() throws Throwable { + new DeleteV2PolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java new file mode 100644 index 00000000000..104a5210ed9 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.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 EnrichedRoles model. + */ +public class EnrichedRolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testEnrichedRoles() throws Throwable { + EnrichedRoles enrichedRolesModel = new EnrichedRoles(); + assertNull(enrichedRolesModel.getRoleId()); + assertNull(enrichedRolesModel.getActions()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java new file mode 100644 index 00000000000..460b37f8105 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.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 ErrorDetails model. + */ +public class ErrorDetailsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testErrorDetails() throws Throwable { + ErrorDetails errorDetailsModel = new ErrorDetails(); + assertNull(errorDetailsModel.getConflictsWith()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java new file mode 100644 index 00000000000..e7f7f9afbfc --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.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 ErrorObject model. + */ +public class ErrorObjectTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testErrorObject() throws Throwable { + ErrorObject errorObjectModel = new ErrorObject(); + assertNull(errorObjectModel.getCode()); + assertNull(errorObjectModel.getMessage()); + assertNull(errorObjectModel.getDetails()); + assertNull(errorObjectModel.getMoreInfo()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java new file mode 100644 index 00000000000..90c91c8fcaf --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; +import com.ibm.cloud.platform_services.iam_policy_management.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 ExternalAccountIdentityInteractionPatch model. + */ +public class ExternalAccountIdentityInteractionPatchTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testExternalAccountIdentityInteractionPatch() throws Throwable { + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + assertEquals(identityTypesBaseModel.state(), "enabled"); + assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); + + IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() + .user(identityTypesBaseModel) + .serviceId(identityTypesBaseModel) + .service(identityTypesBaseModel) + .build(); + assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); + + ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() + .identityTypes(identityTypesPatchModel) + .build(); + assertEquals(externalAccountIdentityInteractionPatchModel.identityTypes(), identityTypesPatchModel); + + String json = TestUtilities.serialize(externalAccountIdentityInteractionPatchModel); + + ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModelNew = TestUtilities.deserialize(json, ExternalAccountIdentityInteractionPatch.class); + assertTrue(externalAccountIdentityInteractionPatchModelNew instanceof ExternalAccountIdentityInteractionPatch); + assertEquals(externalAccountIdentityInteractionPatchModelNew.identityTypes().toString(), identityTypesPatchModel.toString()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java new file mode 100644 index 00000000000..2e4aaef7e07 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.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 ExternalAccountIdentityInteraction model. + */ +public class ExternalAccountIdentityInteractionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testExternalAccountIdentityInteraction() throws Throwable { + ExternalAccountIdentityInteraction externalAccountIdentityInteractionModel = new ExternalAccountIdentityInteraction(); + assertNull(externalAccountIdentityInteractionModel.getIdentityTypes()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java new file mode 100644 index 00000000000..b4d68673091 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java @@ -0,0 +1,36 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.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 First model. + */ +public class FirstTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testFirst() throws Throwable { + First firstModel = new First(); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java new file mode 100644 index 00000000000..73e66a5a756 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlAssignmentOptions model. + */ +public class GetActionControlAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetActionControlAssignmentOptions() throws Throwable { + GetActionControlAssignmentOptions getActionControlAssignmentOptionsModel = new GetActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(getActionControlAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlAssignmentOptionsError() throws Throwable { + new GetActionControlAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..d6e66ce6939 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlTemplateOptions model. + */ +public class GetActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetActionControlTemplateOptions() throws Throwable { + GetActionControlTemplateOptions getActionControlTemplateOptionsModel = new GetActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .build(); + assertEquals(getActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(getActionControlTemplateOptionsModel.state(), "active"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlTemplateOptionsError() throws Throwable { + new GetActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..ac8e17fe083 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlTemplateVersionOptions model. + */ +public class GetActionControlTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetActionControlTemplateVersionOptions() throws Throwable { + GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptionsModel = new GetActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + assertEquals(getActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(getActionControlTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlTemplateVersionOptionsError() throws Throwable { + new GetActionControlTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java new file mode 100644 index 00000000000..6b2a479c37d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyAssignmentOptions model. + */ +public class GetPolicyAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetPolicyAssignmentOptions() throws Throwable { + GetPolicyAssignmentOptions getPolicyAssignmentOptionsModel = new GetPolicyAssignmentOptions.Builder() + .assignmentId("testString") + .version("1.0") + .build(); + assertEquals(getPolicyAssignmentOptionsModel.assignmentId(), "testString"); + assertEquals(getPolicyAssignmentOptionsModel.version(), "1.0"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyAssignmentOptionsError() throws Throwable { + new GetPolicyAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java new file mode 100644 index 00000000000..2a7348c2c2d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyOptions model. + */ +public class GetPolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetPolicyOptions() throws Throwable { + GetPolicyOptions getPolicyOptionsModel = new GetPolicyOptions.Builder() + .policyId("testString") + .build(); + assertEquals(getPolicyOptionsModel.policyId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyOptionsError() throws Throwable { + new GetPolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..06535ed77ed --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyTemplateOptions model. + */ +public class GetPolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetPolicyTemplateOptions() throws Throwable { + GetPolicyTemplateOptions getPolicyTemplateOptionsModel = new GetPolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .state("active") + .build(); + assertEquals(getPolicyTemplateOptionsModel.policyTemplateId(), "testString"); + assertEquals(getPolicyTemplateOptionsModel.state(), "active"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyTemplateOptionsError() throws Throwable { + new GetPolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..264b5db4912 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyTemplateVersionOptions model. + */ +public class GetPolicyTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetPolicyTemplateVersionOptions() throws Throwable { + GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptionsModel = new GetPolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + assertEquals(getPolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); + assertEquals(getPolicyTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyTemplateVersionOptionsError() throws Throwable { + new GetPolicyTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java new file mode 100644 index 00000000000..0c1f6b2bb5a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleAssignmentOptions model. + */ +public class GetRoleAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetRoleAssignmentOptions() throws Throwable { + GetRoleAssignmentOptions getRoleAssignmentOptionsModel = new GetRoleAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(getRoleAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleAssignmentOptionsError() throws Throwable { + new GetRoleAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java new file mode 100644 index 00000000000..e589b8d1285 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleOptions model. + */ +public class GetRoleOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetRoleOptions() throws Throwable { + GetRoleOptions getRoleOptionsModel = new GetRoleOptions.Builder() + .roleId("testString") + .build(); + assertEquals(getRoleOptionsModel.roleId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleOptionsError() throws Throwable { + new GetRoleOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..3c10b5207dc --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleTemplateOptions model. + */ +public class GetRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetRoleTemplateOptions() throws Throwable { + GetRoleTemplateOptions getRoleTemplateOptionsModel = new GetRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .state("active") + .build(); + assertEquals(getRoleTemplateOptionsModel.roleTemplateId(), "testString"); + assertEquals(getRoleTemplateOptionsModel.state(), "active"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleTemplateOptionsError() throws Throwable { + new GetRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..3bd5d278630 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleTemplateVersionOptions model. + */ +public class GetRoleTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetRoleTemplateVersionOptions() throws Throwable { + GetRoleTemplateVersionOptions getRoleTemplateVersionOptionsModel = new GetRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + assertEquals(getRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); + assertEquals(getRoleTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleTemplateVersionOptionsError() throws Throwable { + new GetRoleTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java new file mode 100644 index 00000000000..00f780c4153 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetSettingsOptions model. + */ +public class GetSettingsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetSettingsOptions() throws Throwable { + GetSettingsOptions getSettingsOptionsModel = new GetSettingsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .build(); + assertEquals(getSettingsOptionsModel.accountId(), "testString"); + assertEquals(getSettingsOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetSettingsOptionsError() throws Throwable { + new GetSettingsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java new file mode 100644 index 00000000000..ebad7af7371 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetV2PolicyOptions model. + */ +public class GetV2PolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetV2PolicyOptions() throws Throwable { + GetV2PolicyOptions getV2PolicyOptionsModel = new GetV2PolicyOptions.Builder() + .id("testString") + .format("include_last_permit") + .build(); + assertEquals(getV2PolicyOptionsModel.id(), "testString"); + assertEquals(getV2PolicyOptionsModel.format(), "include_last_permit"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetV2PolicyOptionsError() throws Throwable { + new GetV2PolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java new file mode 100644 index 00000000000..f627a54ecc2 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 Grant model. + */ +public class GrantTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGrant() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + + String json = TestUtilities.serialize(grantModel); + + Grant grantModelNew = TestUtilities.deserialize(json, Grant.class); + assertTrue(grantModelNew instanceof Grant); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGrantError() throws Throwable { + new Grant.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java new file mode 100644 index 00000000000..f86af34fab8 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.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 GrantWithEnrichedRoles model. + */ +public class GrantWithEnrichedRolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGrantWithEnrichedRoles() throws Throwable { + GrantWithEnrichedRoles grantWithEnrichedRolesModel = new GrantWithEnrichedRoles(); + assertNull(grantWithEnrichedRolesModel.getRoles()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java new file mode 100644 index 00000000000..2a4d38de51a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypesBase model. + */ +public class IdentityTypesBaseTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testIdentityTypesBase() throws Throwable { + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + assertEquals(identityTypesBaseModel.state(), "enabled"); + assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(identityTypesBaseModel); + + IdentityTypesBase identityTypesBaseModelNew = TestUtilities.deserialize(json, IdentityTypesBase.class); + assertTrue(identityTypesBaseModelNew instanceof IdentityTypesBase); + assertEquals(identityTypesBaseModelNew.state(), "enabled"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testIdentityTypesBaseError() throws Throwable { + new IdentityTypesBase.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java new file mode 100644 index 00000000000..3e762536695 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java @@ -0,0 +1,59 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; +import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypesPatch model. + */ +public class IdentityTypesPatchTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testIdentityTypesPatch() throws Throwable { + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + assertEquals(identityTypesBaseModel.state(), "enabled"); + assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); + + IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() + .user(identityTypesBaseModel) + .serviceId(identityTypesBaseModel) + .service(identityTypesBaseModel) + .build(); + assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); + + String json = TestUtilities.serialize(identityTypesPatchModel); + + IdentityTypesPatch identityTypesPatchModelNew = TestUtilities.deserialize(json, IdentityTypesPatch.class); + assertTrue(identityTypesPatchModelNew instanceof IdentityTypesPatch); + assertEquals(identityTypesPatchModelNew.user().toString(), identityTypesBaseModel.toString()); + assertEquals(identityTypesPatchModelNew.serviceId().toString(), identityTypesBaseModel.toString()); + assertEquals(identityTypesPatchModelNew.service().toString(), identityTypesBaseModel.toString()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java new file mode 100644 index 00000000000..e2b6c77338f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypes model. + */ +public class IdentityTypesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testIdentityTypes() throws Throwable { + IdentityTypes identityTypesModel = new IdentityTypes(); + assertNull(identityTypesModel.getUser()); + assertNull(identityTypesModel.getServiceId()); + assertNull(identityTypesModel.getService()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java new file mode 100644 index 00000000000..c3f51516e25 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java @@ -0,0 +1,36 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; +import com.ibm.cloud.platform_services.iam_policy_management.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 LimitData model. + */ +public class LimitDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testLimitData() throws Throwable { + LimitData limitDataModel = new LimitData(); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java new file mode 100644 index 00000000000..0d64653d829 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlAssignmentsOptions model. + */ +public class ListActionControlAssignmentsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListActionControlAssignmentsOptions() throws Throwable { + ListActionControlAssignmentsOptions listActionControlAssignmentsOptionsModel = new ListActionControlAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listActionControlAssignmentsOptionsModel.accountId(), "testString"); + assertEquals(listActionControlAssignmentsOptionsModel.acceptLanguage(), "default"); + assertEquals(listActionControlAssignmentsOptionsModel.templateId(), "testString"); + assertEquals(listActionControlAssignmentsOptionsModel.templateVersion(), "testString"); + assertEquals(listActionControlAssignmentsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listActionControlAssignmentsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlAssignmentsOptionsError() throws Throwable { + new ListActionControlAssignmentsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java new file mode 100644 index 00000000000..dfe91662d83 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlTemplateVersionsOptions model. + */ +public class ListActionControlTemplateVersionsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListActionControlTemplateVersionsOptions() throws Throwable { + ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptionsModel = new ListActionControlTemplateVersionsOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listActionControlTemplateVersionsOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(listActionControlTemplateVersionsOptionsModel.state(), "active"); + assertEquals(listActionControlTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listActionControlTemplateVersionsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlTemplateVersionsOptionsError() throws Throwable { + new ListActionControlTemplateVersionsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java new file mode 100644 index 00000000000..9e2e6a18158 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlTemplatesOptions model. + */ +public class ListActionControlTemplatesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListActionControlTemplatesOptions() throws Throwable { + ListActionControlTemplatesOptions listActionControlTemplatesOptionsModel = new ListActionControlTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listActionControlTemplatesOptionsModel.accountId(), "testString"); + assertEquals(listActionControlTemplatesOptionsModel.acceptLanguage(), "default"); + assertEquals(listActionControlTemplatesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listActionControlTemplatesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlTemplatesOptionsError() throws Throwable { + new ListActionControlTemplatesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java new file mode 100644 index 00000000000..8bfe5000355 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListPoliciesOptions model. + */ +public class ListPoliciesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListPoliciesOptions() throws Throwable { + ListPoliciesOptions listPoliciesOptionsModel = new ListPoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .tagName("testString") + .tagValue("testString") + .sort("id") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listPoliciesOptionsModel.accountId(), "testString"); + assertEquals(listPoliciesOptionsModel.acceptLanguage(), "default"); + assertEquals(listPoliciesOptionsModel.iamId(), "testString"); + assertEquals(listPoliciesOptionsModel.accessGroupId(), "testString"); + assertEquals(listPoliciesOptionsModel.type(), "access"); + assertEquals(listPoliciesOptionsModel.serviceType(), "service"); + assertEquals(listPoliciesOptionsModel.tagName(), "testString"); + assertEquals(listPoliciesOptionsModel.tagValue(), "testString"); + assertEquals(listPoliciesOptionsModel.sort(), "id"); + assertEquals(listPoliciesOptionsModel.format(), "include_last_permit"); + assertEquals(listPoliciesOptionsModel.state(), "active"); + assertEquals(listPoliciesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listPoliciesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPoliciesOptionsError() throws Throwable { + new ListPoliciesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java new file mode 100644 index 00000000000..32729befeda --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyAssignmentsOptions model. + */ +public class ListPolicyAssignmentsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListPolicyAssignmentsOptions() throws Throwable { + ListPolicyAssignmentsOptions listPolicyAssignmentsOptionsModel = new ListPolicyAssignmentsOptions.Builder() + .version("1.0") + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listPolicyAssignmentsOptionsModel.version(), "1.0"); + assertEquals(listPolicyAssignmentsOptionsModel.accountId(), "testString"); + assertEquals(listPolicyAssignmentsOptionsModel.acceptLanguage(), "default"); + assertEquals(listPolicyAssignmentsOptionsModel.templateId(), "testString"); + assertEquals(listPolicyAssignmentsOptionsModel.templateVersion(), "testString"); + assertEquals(listPolicyAssignmentsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listPolicyAssignmentsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyAssignmentsOptionsError() throws Throwable { + new ListPolicyAssignmentsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java new file mode 100644 index 00000000000..1053d41b84b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyTemplateVersionsOptions model. + */ +public class ListPolicyTemplateVersionsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListPolicyTemplateVersionsOptions() throws Throwable { + ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptionsModel = new ListPolicyTemplateVersionsOptions.Builder() + .policyTemplateId("testString") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listPolicyTemplateVersionsOptionsModel.policyTemplateId(), "testString"); + assertEquals(listPolicyTemplateVersionsOptionsModel.state(), "active"); + assertEquals(listPolicyTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listPolicyTemplateVersionsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyTemplateVersionsOptionsError() throws Throwable { + new ListPolicyTemplateVersionsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java new file mode 100644 index 00000000000..5065a9d9495 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyTemplatesOptions model. + */ +public class ListPolicyTemplatesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListPolicyTemplatesOptions() throws Throwable { + ListPolicyTemplatesOptions listPolicyTemplatesOptionsModel = new ListPolicyTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .state("active") + .name("testString") + .policyServiceType("service") + .policyServiceName("testString") + .policyServiceGroupId("testString") + .policyType("access") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listPolicyTemplatesOptionsModel.accountId(), "testString"); + assertEquals(listPolicyTemplatesOptionsModel.acceptLanguage(), "default"); + assertEquals(listPolicyTemplatesOptionsModel.state(), "active"); + assertEquals(listPolicyTemplatesOptionsModel.name(), "testString"); + assertEquals(listPolicyTemplatesOptionsModel.policyServiceType(), "service"); + assertEquals(listPolicyTemplatesOptionsModel.policyServiceName(), "testString"); + assertEquals(listPolicyTemplatesOptionsModel.policyServiceGroupId(), "testString"); + assertEquals(listPolicyTemplatesOptionsModel.policyType(), "access"); + assertEquals(listPolicyTemplatesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listPolicyTemplatesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyTemplatesOptionsError() throws Throwable { + new ListPolicyTemplatesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java new file mode 100644 index 00000000000..bd82df9bfd5 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleAssignmentsOptions model. + */ +public class ListRoleAssignmentsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListRoleAssignmentsOptions() throws Throwable { + ListRoleAssignmentsOptions listRoleAssignmentsOptionsModel = new ListRoleAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listRoleAssignmentsOptionsModel.accountId(), "testString"); + assertEquals(listRoleAssignmentsOptionsModel.acceptLanguage(), "default"); + assertEquals(listRoleAssignmentsOptionsModel.templateId(), "testString"); + assertEquals(listRoleAssignmentsOptionsModel.templateVersion(), "testString"); + assertEquals(listRoleAssignmentsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listRoleAssignmentsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleAssignmentsOptionsError() throws Throwable { + new ListRoleAssignmentsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java new file mode 100644 index 00000000000..2e89527b653 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleTemplateVersionsOptions model. + */ +public class ListRoleTemplateVersionsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListRoleTemplateVersionsOptions() throws Throwable { + ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptionsModel = new ListRoleTemplateVersionsOptions.Builder() + .roleTemplateId("testString") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listRoleTemplateVersionsOptionsModel.roleTemplateId(), "testString"); + assertEquals(listRoleTemplateVersionsOptionsModel.state(), "active"); + assertEquals(listRoleTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listRoleTemplateVersionsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleTemplateVersionsOptionsError() throws Throwable { + new ListRoleTemplateVersionsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java new file mode 100644 index 00000000000..21d23a7be0f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java @@ -0,0 +1,59 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleTemplatesOptions model. + */ +public class ListRoleTemplatesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListRoleTemplatesOptions() throws Throwable { + ListRoleTemplatesOptions listRoleTemplatesOptionsModel = new ListRoleTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .name("testString") + .roleName("testString") + .roleServiceName("testString") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listRoleTemplatesOptionsModel.accountId(), "testString"); + assertEquals(listRoleTemplatesOptionsModel.acceptLanguage(), "default"); + assertEquals(listRoleTemplatesOptionsModel.name(), "testString"); + assertEquals(listRoleTemplatesOptionsModel.roleName(), "testString"); + assertEquals(listRoleTemplatesOptionsModel.roleServiceName(), "testString"); + assertEquals(listRoleTemplatesOptionsModel.state(), "active"); + assertEquals(listRoleTemplatesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listRoleTemplatesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleTemplatesOptionsError() throws Throwable { + new ListRoleTemplatesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java new file mode 100644 index 00000000000..4fb97c7fc9a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListRolesOptions model. + */ +public class ListRolesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListRolesOptions() throws Throwable { + ListRolesOptions listRolesOptionsModel = new ListRolesOptions.Builder() + .acceptLanguage("default") + .accountId("testString") + .serviceName("iam-groups") + .sourceServiceName("iam-groups") + .policyType("authorization") + .serviceGroupId("IAM") + .build(); + assertEquals(listRolesOptionsModel.acceptLanguage(), "default"); + assertEquals(listRolesOptionsModel.accountId(), "testString"); + assertEquals(listRolesOptionsModel.serviceName(), "iam-groups"); + assertEquals(listRolesOptionsModel.sourceServiceName(), "iam-groups"); + assertEquals(listRolesOptionsModel.policyType(), "authorization"); + assertEquals(listRolesOptionsModel.serviceGroupId(), "IAM"); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java new file mode 100644 index 00000000000..8c72945373b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListV2PoliciesOptions model. + */ +public class ListV2PoliciesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListV2PoliciesOptions() throws Throwable { + ListV2PoliciesOptions listV2PoliciesOptionsModel = new ListV2PoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .serviceName("testString") + .serviceGroupId("testString") + .sort("testString") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listV2PoliciesOptionsModel.accountId(), "testString"); + assertEquals(listV2PoliciesOptionsModel.acceptLanguage(), "default"); + assertEquals(listV2PoliciesOptionsModel.iamId(), "testString"); + assertEquals(listV2PoliciesOptionsModel.accessGroupId(), "testString"); + assertEquals(listV2PoliciesOptionsModel.type(), "access"); + assertEquals(listV2PoliciesOptionsModel.serviceType(), "service"); + assertEquals(listV2PoliciesOptionsModel.serviceName(), "testString"); + assertEquals(listV2PoliciesOptionsModel.serviceGroupId(), "testString"); + assertEquals(listV2PoliciesOptionsModel.sort(), "testString"); + assertEquals(listV2PoliciesOptionsModel.format(), "include_last_permit"); + assertEquals(listV2PoliciesOptionsModel.state(), "active"); + assertEquals(listV2PoliciesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listV2PoliciesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListV2PoliciesOptionsError() throws Throwable { + new ListV2PoliciesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java new file mode 100644 index 00000000000..0661d4245a2 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 NestedConditionRuleAttribute model. + */ +public class NestedConditionRuleAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testNestedConditionRuleAttribute() throws Throwable { + NestedConditionRuleAttribute nestedConditionRuleAttributeModel = new NestedConditionRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(nestedConditionRuleAttributeModel.key(), "testString"); + assertEquals(nestedConditionRuleAttributeModel.operator(), "stringEquals"); + assertEquals(nestedConditionRuleAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(nestedConditionRuleAttributeModel); + + NestedConditionRuleAttribute nestedConditionRuleAttributeModelNew = TestUtilities.deserialize(json, NestedConditionRuleAttribute.class); + assertTrue(nestedConditionRuleAttributeModelNew instanceof NestedConditionRuleAttribute); + assertEquals(nestedConditionRuleAttributeModelNew.key(), "testString"); + assertEquals(nestedConditionRuleAttributeModelNew.operator(), "stringEquals"); + assertEquals(nestedConditionRuleAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testNestedConditionRuleAttributeError() throws Throwable { + new NestedConditionRuleAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java new file mode 100644 index 00000000000..1ba394dbb7d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleWithConditions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 NestedConditionRuleWithConditions model. + */ +public class NestedConditionRuleWithConditionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testNestedConditionRuleWithConditions() throws Throwable { + RuleAttribute ruleAttributeModel = new RuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(ruleAttributeModel.key(), "testString"); + assertEquals(ruleAttributeModel.operator(), "stringEquals"); + assertEquals(ruleAttributeModel.value(), "testString"); + + NestedConditionRuleWithConditions nestedConditionRuleWithConditionsModel = new NestedConditionRuleWithConditions.Builder() + .operator("and") + .conditions(java.util.Arrays.asList(ruleAttributeModel)) + .build(); + assertEquals(nestedConditionRuleWithConditionsModel.operator(), "and"); + assertEquals(nestedConditionRuleWithConditionsModel.conditions(), java.util.Arrays.asList(ruleAttributeModel)); + + String json = TestUtilities.serialize(nestedConditionRuleWithConditionsModel); + + NestedConditionRuleWithConditions nestedConditionRuleWithConditionsModelNew = TestUtilities.deserialize(json, NestedConditionRuleWithConditions.class); + assertTrue(nestedConditionRuleWithConditionsModelNew instanceof NestedConditionRuleWithConditions); + assertEquals(nestedConditionRuleWithConditionsModelNew.operator(), "and"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testNestedConditionRuleWithConditionsError() throws Throwable { + new NestedConditionRuleWithConditions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java new file mode 100644 index 00000000000..4956eea2675 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedCondition; +import com.ibm.cloud.platform_services.iam_policy_management.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 NestedCondition model. + */ +public class NestedConditionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testNestedCondition() throws Throwable { + NestedCondition nestedConditionModel = new NestedCondition(); + assertNotNull(nestedConditionModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java new file mode 100644 index 00000000000..c5e084a44d5 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.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 Next model. + */ +public class NextTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testNext() throws Throwable { + Next nextModel = new Next(); + assertNull(nextModel.getStart()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java new file mode 100644 index 00000000000..d5b05ede760 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentResourcePolicy model. + */ +public class PolicyAssignmentResourcePolicyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentResourcePolicy() throws Throwable { + PolicyAssignmentResourcePolicy policyAssignmentResourcePolicyModel = new PolicyAssignmentResourcePolicy(); + assertNull(policyAssignmentResourcePolicyModel.getResourceCreated()); + assertNull(policyAssignmentResourcePolicyModel.getStatus()); + assertNull(policyAssignmentResourcePolicyModel.getErrorMessage()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java new file mode 100644 index 00000000000..8b146425617 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentResources model. + */ +public class PolicyAssignmentResourcesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentResources() throws Throwable { + PolicyAssignmentResources policyAssignmentResourcesModel = new PolicyAssignmentResources(); + assertNull(policyAssignmentResourcesModel.getTarget()); + assertNull(policyAssignmentResourcesModel.getPolicy()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java new file mode 100644 index 00000000000..8a3a6b67703 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Collection model. + */ +public class PolicyAssignmentV1CollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentV1Collection() throws Throwable { + PolicyAssignmentV1Collection policyAssignmentV1CollectionModel = new PolicyAssignmentV1Collection(); + assertNull(policyAssignmentV1CollectionModel.getLimit()); + assertNull(policyAssignmentV1CollectionModel.getFirst()); + assertNull(policyAssignmentV1CollectionModel.getNext()); + assertNull(policyAssignmentV1CollectionModel.getPrevious()); + assertNull(policyAssignmentV1CollectionModel.getAssignments()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java new file mode 100644 index 00000000000..56c843a232e --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Resources model. + */ +public class PolicyAssignmentV1ResourcesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentV1Resources() throws Throwable { + PolicyAssignmentV1Resources policyAssignmentV1ResourcesModel = new PolicyAssignmentV1Resources(); + assertNull(policyAssignmentV1ResourcesModel.getTarget()); + assertNull(policyAssignmentV1ResourcesModel.getPolicy()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java new file mode 100644 index 00000000000..f5d14b29447 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java @@ -0,0 +1,36 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Subject model. + */ +public class PolicyAssignmentV1SubjectTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentV1Subject() throws Throwable { + PolicyAssignmentV1Subject policyAssignmentV1SubjectModel = new PolicyAssignmentV1Subject(); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java new file mode 100644 index 00000000000..d9889483421 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1 model. + */ +public class PolicyAssignmentV1Test { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentV1() throws Throwable { + PolicyAssignmentV1 policyAssignmentV1Model = new PolicyAssignmentV1(); + assertNull(policyAssignmentV1Model.getTarget()); + assertNull(policyAssignmentV1Model.getResources()); + assertNull(policyAssignmentV1Model.getSubject()); + assertNull(policyAssignmentV1Model.getTemplate()); + assertNull(policyAssignmentV1Model.getStatus()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java new file mode 100644 index 00000000000..3d372dfaf20 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java @@ -0,0 +1,52 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyCollection model. + */ +public class PolicyCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyCollection() throws Throwable { + PolicyCollection policyCollectionModel = new PolicyCollection(); + assertNull(policyCollectionModel.getLimit()); + assertNull(policyCollectionModel.getFirst()); + assertNull(policyCollectionModel.getNext()); + assertNull(policyCollectionModel.getPrevious()); + assertNull(policyCollectionModel.getPolicies()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java new file mode 100644 index 00000000000..cb2f203a5c3 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java @@ -0,0 +1,72 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyResource model. + */ +public class PolicyResourceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyResource() throws Throwable { + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceAttributeModel.name(), "testString"); + assertEquals(resourceAttributeModel.value(), "testString"); + assertEquals(resourceAttributeModel.operator(), "testString"); + + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceTagModel.name(), "testString"); + assertEquals(resourceTagModel.value(), "testString"); + assertEquals(resourceTagModel.operator(), "testString"); + + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); + assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); + + String json = TestUtilities.serialize(policyResourceModel); + + PolicyResource policyResourceModelNew = TestUtilities.deserialize(json, PolicyResource.class); + assertTrue(policyResourceModelNew instanceof PolicyResource); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPolicyResourceError() throws Throwable { + new PolicyResource.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java new file mode 100644 index 00000000000..299e15b1fd4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyRole model. + */ +public class PolicyRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyRole() throws Throwable { + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + assertEquals(policyRoleModel.roleId(), "testString"); + + String json = TestUtilities.serialize(policyRoleModel); + + PolicyRole policyRoleModelNew = TestUtilities.deserialize(json, PolicyRole.class); + assertTrue(policyRoleModelNew instanceof PolicyRole); + assertEquals(policyRoleModelNew.roleId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPolicyRoleError() throws Throwable { + new PolicyRole.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java new file mode 100644 index 00000000000..6d0a937bd53 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java @@ -0,0 +1,58 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicySubject model. + */ +public class PolicySubjectTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicySubject() throws Throwable { + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(subjectAttributeModel.name(), "testString"); + assertEquals(subjectAttributeModel.value(), "testString"); + + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); + + String json = TestUtilities.serialize(policySubjectModel); + + PolicySubject policySubjectModelNew = TestUtilities.deserialize(json, PolicySubject.class); + assertTrue(policySubjectModelNew instanceof PolicySubject); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPolicySubjectError() throws Throwable { + new PolicySubject.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java new file mode 100644 index 00000000000..8cb98be3d32 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentCollection model. + */ +public class PolicyTemplateAssignmentCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateAssignmentCollection() throws Throwable { + PolicyTemplateAssignmentCollection policyTemplateAssignmentCollectionModel = new PolicyTemplateAssignmentCollection(); + assertNull(policyTemplateAssignmentCollectionModel.getLimit()); + assertNull(policyTemplateAssignmentCollectionModel.getFirst()); + assertNull(policyTemplateAssignmentCollectionModel.getNext()); + assertNull(policyTemplateAssignmentCollectionModel.getPrevious()); + assertNull(policyTemplateAssignmentCollectionModel.getAssignments()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java new file mode 100644 index 00000000000..fded12633d2 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItemsPolicyAssignment model. + */ +public class PolicyTemplateAssignmentItemsPolicyAssignmentTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateAssignmentItemsPolicyAssignment() throws Throwable { + PolicyTemplateAssignmentItemsPolicyAssignment policyTemplateAssignmentItemsPolicyAssignmentModel = new PolicyTemplateAssignmentItemsPolicyAssignment(); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTemplateId()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTemplateVersion()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getAssignmentId()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTargetType()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTarget()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getResources()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getStatus()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java new file mode 100644 index 00000000000..6b74125d238 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItemsPolicyAssignmentV1 model. + */ +public class PolicyTemplateAssignmentItemsPolicyAssignmentV1Test { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateAssignmentItemsPolicyAssignmentV1() throws Throwable { + PolicyTemplateAssignmentItemsPolicyAssignmentV1 policyTemplateAssignmentItemsPolicyAssignmentV1Model = new PolicyTemplateAssignmentItemsPolicyAssignmentV1(); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getTarget()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getResources()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getSubject()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getTemplate()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getStatus()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java new file mode 100644 index 00000000000..05b400e91c1 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java @@ -0,0 +1,48 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItems model. + */ +public class PolicyTemplateAssignmentItemsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testPolicyTemplateAssignmentItems() throws Throwable { + PolicyTemplateAssignmentItems policyTemplateAssignmentItemsModel = new PolicyTemplateAssignmentItems(); + assertNotNull(policyTemplateAssignmentItemsModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java new file mode 100644 index 00000000000..52041b1a6a3 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateCollection model. + */ +public class PolicyTemplateCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateCollection() throws Throwable { + PolicyTemplateCollection policyTemplateCollectionModel = new PolicyTemplateCollection(); + assertNull(policyTemplateCollectionModel.getLimit()); + assertNull(policyTemplateCollectionModel.getFirst()); + assertNull(policyTemplateCollectionModel.getNext()); + assertNull(policyTemplateCollectionModel.getPrevious()); + assertNull(policyTemplateCollectionModel.getPolicyTemplates()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java new file mode 100644 index 00000000000..b6ee06990a2 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateLimitData model. + */ +public class PolicyTemplateLimitDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateLimitData() throws Throwable { + PolicyTemplateLimitData policyTemplateLimitDataModel = new PolicyTemplateLimitData(); + assertNull(policyTemplateLimitDataModel.getName()); + assertNull(policyTemplateLimitDataModel.getDescription()); + assertNull(policyTemplateLimitDataModel.getAccountId()); + assertNull(policyTemplateLimitDataModel.getVersion()); + assertNull(policyTemplateLimitDataModel.isCommitted()); + assertNull(policyTemplateLimitDataModel.getPolicy()); + assertNull(policyTemplateLimitDataModel.getState()); + assertNull(policyTemplateLimitDataModel.getCounts()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java new file mode 100644 index 00000000000..edeb45c4d96 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateMetaData model. + */ +public class PolicyTemplateMetaDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateMetaData() throws Throwable { + PolicyTemplateMetaData policyTemplateMetaDataModel = new PolicyTemplateMetaData(); + assertNull(policyTemplateMetaDataModel.getType()); + assertNull(policyTemplateMetaDataModel.getDescription()); + assertNull(policyTemplateMetaDataModel.getSubjects()); + assertNull(policyTemplateMetaDataModel.getRoles()); + assertNull(policyTemplateMetaDataModel.getResources()); + assertNull(policyTemplateMetaDataModel.getState()); + assertNull(policyTemplateMetaDataModel.getTemplate()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java new file mode 100644 index 00000000000..c349e4a3415 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplate model. + */ +public class PolicyTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplate() throws Throwable { + PolicyTemplate policyTemplateModel = new PolicyTemplate(); + assertNull(policyTemplateModel.getName()); + assertNull(policyTemplateModel.getDescription()); + assertNull(policyTemplateModel.getAccountId()); + assertNull(policyTemplateModel.getVersion()); + assertNull(policyTemplateModel.isCommitted()); + assertNull(policyTemplateModel.getPolicy()); + assertNull(policyTemplateModel.getState()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java new file mode 100644 index 00000000000..da651956461 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateVersionsCollection model. + */ +public class PolicyTemplateVersionsCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateVersionsCollection() throws Throwable { + PolicyTemplateVersionsCollection policyTemplateVersionsCollectionModel = new PolicyTemplateVersionsCollection(); + assertNull(policyTemplateVersionsCollectionModel.getLimit()); + assertNull(policyTemplateVersionsCollectionModel.getFirst()); + assertNull(policyTemplateVersionsCollectionModel.getNext()); + assertNull(policyTemplateVersionsCollectionModel.getPrevious()); + assertNull(policyTemplateVersionsCollectionModel.getVersions()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java new file mode 100644 index 00000000000..28eba4f9a85 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java @@ -0,0 +1,48 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 Policy model. + */ +public class PolicyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicy() throws Throwable { + Policy policyModel = new Policy(); + assertNull(policyModel.getType()); + assertNull(policyModel.getDescription()); + assertNull(policyModel.getSubjects()); + assertNull(policyModel.getRoles()); + assertNull(policyModel.getResources()); + assertNull(policyModel.getState()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java new file mode 100644 index 00000000000..e3788c51212 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.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 Previous model. + */ +public class PreviousTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPrevious() throws Throwable { + Previous previousModel = new Previous(); + assertNull(previousModel.getStart()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..430f5f63764 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java @@ -0,0 +1,67 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceActionControlTemplateOptions model. + */ +public class ReplaceActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplaceActionControlTemplateOptions() throws Throwable { + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateActionControlModel.serviceName(), "testString"); + assertEquals(templateActionControlModel.description(), "testString"); + assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); + + ReplaceActionControlTemplateOptions replaceActionControlTemplateOptionsModel = new ReplaceActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .actionControl(templateActionControlModel) + .committed(true) + .build(); + assertEquals(replaceActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.version(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.ifMatch(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.name(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.description(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.actionControl(), templateActionControlModel); + assertEquals(replaceActionControlTemplateOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceActionControlTemplateOptionsError() throws Throwable { + new ReplaceActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java new file mode 100644 index 00000000000..2f20b05f37c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java @@ -0,0 +1,105 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplacePolicyOptions model. + */ +public class ReplacePolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplacePolicyOptions() throws Throwable { + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(subjectAttributeModel.name(), "testString"); + assertEquals(subjectAttributeModel.value(), "testString"); + + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); + + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + assertEquals(policyRoleModel.roleId(), "testString"); + + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceAttributeModel.name(), "testString"); + assertEquals(resourceAttributeModel.value(), "testString"); + assertEquals(resourceAttributeModel.operator(), "testString"); + + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceTagModel.name(), "testString"); + assertEquals(resourceTagModel.value(), "testString"); + assertEquals(resourceTagModel.operator(), "testString"); + + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); + assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); + + ReplacePolicyOptions replacePolicyOptionsModel = new ReplacePolicyOptions.Builder() + .policyId("testString") + .ifMatch("testString") + .type("testString") + .subjects(java.util.Arrays.asList(policySubjectModel)) + .roles(java.util.Arrays.asList(policyRoleModel)) + .resources(java.util.Arrays.asList(policyResourceModel)) + .description("testString") + .build(); + assertEquals(replacePolicyOptionsModel.policyId(), "testString"); + assertEquals(replacePolicyOptionsModel.ifMatch(), "testString"); + assertEquals(replacePolicyOptionsModel.type(), "testString"); + assertEquals(replacePolicyOptionsModel.subjects(), java.util.Arrays.asList(policySubjectModel)); + assertEquals(replacePolicyOptionsModel.roles(), java.util.Arrays.asList(policyRoleModel)); + assertEquals(replacePolicyOptionsModel.resources(), java.util.Arrays.asList(policyResourceModel)); + assertEquals(replacePolicyOptionsModel.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplacePolicyOptionsError() throws Throwable { + new ReplacePolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..2dc2430daca --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java @@ -0,0 +1,147 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplacePolicyTemplateOptions model. + */ +public class ReplacePolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplacePolicyTemplateOptions() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + assertEquals(templatePolicyModel.type(), "access"); + assertEquals(templatePolicyModel.description(), "testString"); + assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); + assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); + assertEquals(templatePolicyModel.pattern(), "testString"); + assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); + assertEquals(templatePolicyModel.control(), templateControlModel); + + ReplacePolicyTemplateOptions replacePolicyTemplateOptionsModel = new ReplacePolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .ifMatch("testString") + .policy(templatePolicyModel) + .name("testString") + .description("testString") + .committed(true) + .build(); + assertEquals(replacePolicyTemplateOptionsModel.policyTemplateId(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.version(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.ifMatch(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.policy(), templatePolicyModel); + assertEquals(replacePolicyTemplateOptionsModel.name(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.description(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplacePolicyTemplateOptionsError() throws Throwable { + new ReplacePolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java new file mode 100644 index 00000000000..9900abb2543 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceRoleOptions model. + */ +public class ReplaceRoleOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplaceRoleOptions() throws Throwable { + ReplaceRoleOptions replaceRoleOptionsModel = new ReplaceRoleOptions.Builder() + .roleId("testString") + .ifMatch("testString") + .displayName("testString") + .actions(java.util.Arrays.asList("testString")) + .description("testString") + .build(); + assertEquals(replaceRoleOptionsModel.roleId(), "testString"); + assertEquals(replaceRoleOptionsModel.ifMatch(), "testString"); + assertEquals(replaceRoleOptionsModel.displayName(), "testString"); + assertEquals(replaceRoleOptionsModel.actions(), java.util.Arrays.asList("testString")); + assertEquals(replaceRoleOptionsModel.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceRoleOptionsError() throws Throwable { + new ReplaceRoleOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..2f731aea7d4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceRoleTemplateOptions model. + */ +public class ReplaceRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplaceRoleTemplateOptions() throws Throwable { + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateRoleModel.displayName(), "testString"); + assertEquals(templateRoleModel.serviceName(), "testString"); + assertEquals(templateRoleModel.description(), "testString"); + assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); + + ReplaceRoleTemplateOptions replaceRoleTemplateOptionsModel = new ReplaceRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .role(templateRoleModel) + .committed(true) + .build(); + assertEquals(replaceRoleTemplateOptionsModel.roleTemplateId(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.version(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.ifMatch(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.name(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.description(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.role(), templateRoleModel); + assertEquals(replaceRoleTemplateOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceRoleTemplateOptionsError() throws Throwable { + new ReplaceRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java new file mode 100644 index 00000000000..23690eda780 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java @@ -0,0 +1,133 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceV2PolicyOptions model. + */ +public class ReplaceV2PolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplaceV2PolicyOptions() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + assertEquals(controlModel.grant(), grantModel); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + ReplaceV2PolicyOptions replaceV2PolicyOptionsModel = new ReplaceV2PolicyOptions.Builder() + .id("testString") + .ifMatch("testString") + .control(controlModel) + .type("access") + .description("testString") + .subject(v2PolicySubjectModel) + .resource(v2PolicyResourceModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .build(); + assertEquals(replaceV2PolicyOptionsModel.id(), "testString"); + assertEquals(replaceV2PolicyOptionsModel.ifMatch(), "testString"); + assertEquals(replaceV2PolicyOptionsModel.control(), controlModel); + assertEquals(replaceV2PolicyOptionsModel.type(), "access"); + assertEquals(replaceV2PolicyOptionsModel.description(), "testString"); + assertEquals(replaceV2PolicyOptionsModel.subject(), v2PolicySubjectModel); + assertEquals(replaceV2PolicyOptionsModel.resource(), v2PolicyResourceModel); + assertEquals(replaceV2PolicyOptionsModel.pattern(), "testString"); + assertEquals(replaceV2PolicyOptionsModel.rule(), v2PolicyRuleModel); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceV2PolicyOptionsError() throws Throwable { + new ReplaceV2PolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java new file mode 100644 index 00000000000..bd50b514f43 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 ResourceAttribute model. + */ +public class ResourceAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testResourceAttribute() throws Throwable { + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceAttributeModel.name(), "testString"); + assertEquals(resourceAttributeModel.value(), "testString"); + assertEquals(resourceAttributeModel.operator(), "testString"); + + String json = TestUtilities.serialize(resourceAttributeModel); + + ResourceAttribute resourceAttributeModelNew = TestUtilities.deserialize(json, ResourceAttribute.class); + assertTrue(resourceAttributeModelNew instanceof ResourceAttribute); + assertEquals(resourceAttributeModelNew.name(), "testString"); + assertEquals(resourceAttributeModelNew.value(), "testString"); + assertEquals(resourceAttributeModelNew.operator(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testResourceAttributeError() throws Throwable { + new ResourceAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java new file mode 100644 index 00000000000..88a1eb5d5b6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.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 ResourceTag model. + */ +public class ResourceTagTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testResourceTag() throws Throwable { + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceTagModel.name(), "testString"); + assertEquals(resourceTagModel.value(), "testString"); + assertEquals(resourceTagModel.operator(), "testString"); + + String json = TestUtilities.serialize(resourceTagModel); + + ResourceTag resourceTagModelNew = TestUtilities.deserialize(json, ResourceTag.class); + assertTrue(resourceTagModelNew instanceof ResourceTag); + assertEquals(resourceTagModelNew.name(), "testString"); + assertEquals(resourceTagModelNew.value(), "testString"); + assertEquals(resourceTagModelNew.operator(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testResourceTagError() throws Throwable { + new ResourceTag.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java new file mode 100644 index 00000000000..e4c0bcc6f92 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAction model. + */ +public class RoleActionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAction() throws Throwable { + RoleAction roleActionModel = new RoleAction(); + assertNull(roleActionModel.getId()); + assertNull(roleActionModel.getDisplayName()); + assertNull(roleActionModel.getDescription()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java new file mode 100644 index 00000000000..42801bc7771 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentCollection model. + */ +public class RoleAssignmentCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentCollection() throws Throwable { + RoleAssignmentCollection roleAssignmentCollectionModel = new RoleAssignmentCollection(); + assertNull(roleAssignmentCollectionModel.getLimit()); + assertNull(roleAssignmentCollectionModel.getFirst()); + assertNull(roleAssignmentCollectionModel.getNext()); + assertNull(roleAssignmentCollectionModel.getPrevious()); + assertNull(roleAssignmentCollectionModel.getAssignments()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java new file mode 100644 index 00000000000..bef8b71b0fa --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResourceCreated model. + */ +public class RoleAssignmentResourceCreatedTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentResourceCreated() throws Throwable { + RoleAssignmentResourceCreated roleAssignmentResourceCreatedModel = new RoleAssignmentResourceCreated(); + assertNull(roleAssignmentResourceCreatedModel.getId()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java new file mode 100644 index 00000000000..c346ca0f48f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java @@ -0,0 +1,43 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResourceRole model. + */ +public class RoleAssignmentResourceRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentResourceRole() throws Throwable { + RoleAssignmentResourceRole roleAssignmentResourceRoleModel = new RoleAssignmentResourceRole(); + assertNull(roleAssignmentResourceRoleModel.getResourceCreated()); + assertNull(roleAssignmentResourceRoleModel.getErrorMessage()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java new file mode 100644 index 00000000000..4fca1b25b5b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResource model. + */ +public class RoleAssignmentResourceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentResource() throws Throwable { + RoleAssignmentResource roleAssignmentResourceModel = new RoleAssignmentResource(); + assertNull(roleAssignmentResourceModel.getTarget()); + assertNull(roleAssignmentResourceModel.getRole()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java new file mode 100644 index 00000000000..4f2e3a37200 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentTemplate model. + */ +public class RoleAssignmentTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentTemplate() throws Throwable { + RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleAssignmentTemplateModel.id(), "testString"); + assertEquals(roleAssignmentTemplateModel.version(), "testString"); + + String json = TestUtilities.serialize(roleAssignmentTemplateModel); + + RoleAssignmentTemplate roleAssignmentTemplateModelNew = TestUtilities.deserialize(json, RoleAssignmentTemplate.class); + assertTrue(roleAssignmentTemplateModelNew instanceof RoleAssignmentTemplate); + assertEquals(roleAssignmentTemplateModelNew.id(), "testString"); + assertEquals(roleAssignmentTemplateModelNew.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRoleAssignmentTemplateError() throws Throwable { + new RoleAssignmentTemplate.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java new file mode 100644 index 00000000000..bd3bda7ce24 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignment model. + */ +public class RoleAssignmentTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignment() throws Throwable { + RoleAssignment roleAssignmentModel = new RoleAssignment(); + assertNull(roleAssignmentModel.getTemplate()); + assertNull(roleAssignmentModel.getTarget()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java new file mode 100644 index 00000000000..812c2dcb131 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java @@ -0,0 +1,41 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleCollection model. + */ +public class RoleCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleCollection() throws Throwable { + RoleCollection roleCollectionModel = new RoleCollection(); + assertNull(roleCollectionModel.getCustomRoles()); + assertNull(roleCollectionModel.getServiceRoles()); + assertNull(roleCollectionModel.getSystemRoles()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java new file mode 100644 index 00000000000..fde4d11ff4c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java @@ -0,0 +1,46 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateCollection model. + */ +public class RoleTemplateCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplateCollection() throws Throwable { + RoleTemplateCollection roleTemplateCollectionModel = new RoleTemplateCollection(); + assertNull(roleTemplateCollectionModel.getLimit()); + assertNull(roleTemplateCollectionModel.getFirst()); + assertNull(roleTemplateCollectionModel.getNext()); + assertNull(roleTemplateCollectionModel.getPrevious()); + assertNull(roleTemplateCollectionModel.getRoleTemplates()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java new file mode 100644 index 00000000000..6c208e1c38f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java @@ -0,0 +1,62 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplatePrototypeRole model. + */ +public class RoleTemplatePrototypeRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplatePrototypeRole() throws Throwable { + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() + .name("testString") + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(roleTemplatePrototypeRoleModel.name(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.displayName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.serviceName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.description(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.actions(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(roleTemplatePrototypeRoleModel); + + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModelNew = TestUtilities.deserialize(json, RoleTemplatePrototypeRole.class); + assertTrue(roleTemplatePrototypeRoleModelNew instanceof RoleTemplatePrototypeRole); + assertEquals(roleTemplatePrototypeRoleModelNew.name(), "testString"); + assertEquals(roleTemplatePrototypeRoleModelNew.displayName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModelNew.serviceName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModelNew.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRoleTemplatePrototypeRoleError() throws Throwable { + new RoleTemplatePrototypeRole.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java new file mode 100644 index 00000000000..af9de718e23 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateReferencesItem model. + */ +public class RoleTemplateReferencesItemTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplateReferencesItem() throws Throwable { + RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleTemplateReferencesItemModel.id(), "testString"); + assertEquals(roleTemplateReferencesItemModel.version(), "testString"); + + String json = TestUtilities.serialize(roleTemplateReferencesItemModel); + + RoleTemplateReferencesItem roleTemplateReferencesItemModelNew = TestUtilities.deserialize(json, RoleTemplateReferencesItem.class); + assertTrue(roleTemplateReferencesItemModelNew instanceof RoleTemplateReferencesItem); + assertEquals(roleTemplateReferencesItemModelNew.id(), "testString"); + assertEquals(roleTemplateReferencesItemModelNew.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRoleTemplateReferencesItemError() throws Throwable { + new RoleTemplateReferencesItem.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java new file mode 100644 index 00000000000..8bb27d8dd62 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplate model. + */ +public class RoleTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplate() throws Throwable { + RoleTemplate roleTemplateModel = new RoleTemplate(); + assertNull(roleTemplateModel.getName()); + assertNull(roleTemplateModel.getDescription()); + assertNull(roleTemplateModel.getAccountId()); + assertNull(roleTemplateModel.isCommitted()); + assertNull(roleTemplateModel.getRole()); + assertNull(roleTemplateModel.getVersion()); + assertNull(roleTemplateModel.getState()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java new file mode 100644 index 00000000000..068cf309bd6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java @@ -0,0 +1,46 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateVersionsCollection model. + */ +public class RoleTemplateVersionsCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplateVersionsCollection() throws Throwable { + RoleTemplateVersionsCollection roleTemplateVersionsCollectionModel = new RoleTemplateVersionsCollection(); + assertNull(roleTemplateVersionsCollectionModel.getLimit()); + assertNull(roleTemplateVersionsCollectionModel.getFirst()); + assertNull(roleTemplateVersionsCollectionModel.getNext()); + assertNull(roleTemplateVersionsCollectionModel.getPrevious()); + assertNull(roleTemplateVersionsCollectionModel.getVersions()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java new file mode 100644 index 00000000000..a632e63587f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; +import com.ibm.cloud.platform_services.iam_policy_management.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 Role model. + */ +public class RoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRole() throws Throwable { + Role roleModel = new Role.Builder() + .displayName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(roleModel.displayName(), "testString"); + assertEquals(roleModel.description(), "testString"); + assertEquals(roleModel.actions(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(roleModel); + + Role roleModelNew = TestUtilities.deserialize(json, Role.class); + assertTrue(roleModelNew instanceof Role); + assertEquals(roleModelNew.displayName(), "testString"); + assertEquals(roleModelNew.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRoleError() throws Throwable { + new Role.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java new file mode 100644 index 00000000000..8383ef794a9 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 Roles model. + */ +public class RolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoles() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + String json = TestUtilities.serialize(rolesModel); + + Roles rolesModelNew = TestUtilities.deserialize(json, Roles.class); + assertTrue(rolesModelNew instanceof Roles); + assertEquals(rolesModelNew.roleId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRolesError() throws Throwable { + new Roles.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java new file mode 100644 index 00000000000..a05e5ee8704 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 RuleAttribute model. + */ +public class RuleAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRuleAttribute() throws Throwable { + RuleAttribute ruleAttributeModel = new RuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(ruleAttributeModel.key(), "testString"); + assertEquals(ruleAttributeModel.operator(), "stringEquals"); + assertEquals(ruleAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(ruleAttributeModel); + + RuleAttribute ruleAttributeModelNew = TestUtilities.deserialize(json, RuleAttribute.class); + assertTrue(ruleAttributeModelNew instanceof RuleAttribute); + assertEquals(ruleAttributeModelNew.key(), "testString"); + assertEquals(ruleAttributeModelNew.operator(), "stringEquals"); + assertEquals(ruleAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRuleAttributeError() throws Throwable { + new RuleAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java new file mode 100644 index 00000000000..7bae03a42e0 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 SubjectAttribute model. + */ +public class SubjectAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testSubjectAttribute() throws Throwable { + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(subjectAttributeModel.name(), "testString"); + assertEquals(subjectAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(subjectAttributeModel); + + SubjectAttribute subjectAttributeModelNew = TestUtilities.deserialize(json, SubjectAttribute.class); + assertTrue(subjectAttributeModelNew instanceof SubjectAttribute); + assertEquals(subjectAttributeModelNew.name(), "testString"); + assertEquals(subjectAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testSubjectAttributeError() throws Throwable { + new SubjectAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java new file mode 100644 index 00000000000..d3a6d4ef53a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateActionControl model. + */ +public class TemplateActionControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateActionControl() throws Throwable { + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateActionControlModel.serviceName(), "testString"); + assertEquals(templateActionControlModel.description(), "testString"); + assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(templateActionControlModel); + + TemplateActionControl templateActionControlModelNew = TestUtilities.deserialize(json, TemplateActionControl.class); + assertTrue(templateActionControlModelNew instanceof TemplateActionControl); + assertEquals(templateActionControlModelNew.serviceName(), "testString"); + assertEquals(templateActionControlModelNew.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateActionControlError() throws Throwable { + new TemplateActionControl.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java new file mode 100644 index 00000000000..fba96e64cef --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateControl model. + */ +public class TemplateControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateControl() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + String json = TestUtilities.serialize(templateControlModel); + + TemplateControl templateControlModelNew = TestUtilities.deserialize(json, TemplateControl.class); + assertTrue(templateControlModelNew instanceof TemplateControl); + assertEquals(templateControlModelNew.grant().toString(), templateGrantModel.toString()); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateControlError() throws Throwable { + new TemplateControl.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java new file mode 100644 index 00000000000..b440cf19100 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateCountData model. + */ +public class TemplateCountDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateCountData() throws Throwable { + TemplateCountData templateCountDataModel = new TemplateCountData(); + assertNull(templateCountDataModel.getTemplate()); + assertNull(templateCountDataModel.getVersion()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java new file mode 100644 index 00000000000..e7759eacc21 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java @@ -0,0 +1,58 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoleReferences; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrantRoleReferences model. + */ +public class TemplateGrantRoleReferencesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateGrantRoleReferences() throws Throwable { + RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleTemplateReferencesItemModel.id(), "testString"); + assertEquals(roleTemplateReferencesItemModel.version(), "testString"); + + TemplateGrantRoleReferences templateGrantRoleReferencesModel = new TemplateGrantRoleReferences.Builder() + .roleTemplateReferences(java.util.Arrays.asList(roleTemplateReferencesItemModel)) + .build(); + assertEquals(templateGrantRoleReferencesModel.roleTemplateReferences(), java.util.Arrays.asList(roleTemplateReferencesItemModel)); + + String json = TestUtilities.serialize(templateGrantRoleReferencesModel); + + TemplateGrantRoleReferences templateGrantRoleReferencesModelNew = TestUtilities.deserialize(json, TemplateGrantRoleReferences.class); + assertTrue(templateGrantRoleReferencesModelNew instanceof TemplateGrantRoleReferences); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateGrantRoleReferencesError() throws Throwable { + new TemplateGrantRoleReferences.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java new file mode 100644 index 00000000000..8cddc6f9a19 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrantRoles model. + */ +public class TemplateGrantRolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateGrantRoles() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantRolesModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantRolesModel.roles(), java.util.Arrays.asList(rolesModel)); + + String json = TestUtilities.serialize(templateGrantRolesModel); + + TemplateGrantRoles templateGrantRolesModelNew = TestUtilities.deserialize(json, TemplateGrantRoles.class); + assertTrue(templateGrantRolesModelNew instanceof TemplateGrantRoles); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateGrantRolesError() throws Throwable { + new TemplateGrantRoles.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java new file mode 100644 index 00000000000..90e6fdc2b9f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrant model. + */ +public class TemplateGrantTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testTemplateGrant() throws Throwable { + TemplateGrant templateGrantModel = new TemplateGrant(); + assertNotNull(templateGrantModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java new file mode 100644 index 00000000000..c2688232e2b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java @@ -0,0 +1,41 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateMetadata model. + */ +public class TemplateMetadataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateMetadata() throws Throwable { + TemplateMetadata templateMetadataModel = new TemplateMetadata(); + assertNull(templateMetadataModel.getId()); + assertNull(templateMetadataModel.getVersion()); + assertNull(templateMetadataModel.getAssignmentId()); + assertNull(templateMetadataModel.getRootId()); + assertNull(templateMetadataModel.getRootVersion()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java new file mode 100644 index 00000000000..0e256ffd599 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplatePolicy model. + */ +public class TemplatePolicyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplatePolicy() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + assertEquals(templatePolicyModel.type(), "access"); + assertEquals(templatePolicyModel.description(), "testString"); + assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); + assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); + assertEquals(templatePolicyModel.pattern(), "testString"); + assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); + assertEquals(templatePolicyModel.control(), templateControlModel); + + String json = TestUtilities.serialize(templatePolicyModel); + + TemplatePolicy templatePolicyModelNew = TestUtilities.deserialize(json, TemplatePolicy.class); + assertTrue(templatePolicyModelNew instanceof TemplatePolicy); + assertEquals(templatePolicyModelNew.type(), "access"); + assertEquals(templatePolicyModelNew.description(), "testString"); + assertEquals(templatePolicyModelNew.resource().toString(), v2PolicyResourceModel.toString()); + assertEquals(templatePolicyModelNew.subject().toString(), v2PolicySubjectModel.toString()); + assertEquals(templatePolicyModelNew.pattern(), "testString"); + assertEquals(templatePolicyModelNew.rule().toString(), v2PolicyRuleModel.toString()); + assertEquals(templatePolicyModelNew.control().toString(), templateControlModel.toString()); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplatePolicyError() throws Throwable { + new TemplatePolicy.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java new file mode 100644 index 00000000000..1735364bc85 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java @@ -0,0 +1,59 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateRole model. + */ +public class TemplateRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateRole() throws Throwable { + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateRoleModel.displayName(), "testString"); + assertEquals(templateRoleModel.serviceName(), "testString"); + assertEquals(templateRoleModel.description(), "testString"); + assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(templateRoleModel); + + TemplateRole templateRoleModelNew = TestUtilities.deserialize(json, TemplateRole.class); + assertTrue(templateRoleModelNew instanceof TemplateRole); + assertEquals(templateRoleModelNew.displayName(), "testString"); + assertEquals(templateRoleModelNew.serviceName(), "testString"); + assertEquals(templateRoleModelNew.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateRoleError() throws Throwable { + new TemplateRole.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java new file mode 100644 index 00000000000..df7a09c2829 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateActionControlAssignmentOptions model. + */ +public class UpdateActionControlAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateActionControlAssignmentOptions() throws Throwable { + UpdateActionControlAssignmentOptions updateActionControlAssignmentOptionsModel = new UpdateActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .ifMatch("testString") + .templateVersion("testString") + .build(); + assertEquals(updateActionControlAssignmentOptionsModel.assignmentId(), "testString"); + assertEquals(updateActionControlAssignmentOptionsModel.ifMatch(), "testString"); + assertEquals(updateActionControlAssignmentOptionsModel.templateVersion(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateActionControlAssignmentOptionsError() throws Throwable { + new UpdateActionControlAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java new file mode 100644 index 00000000000..0008325ffcf --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdatePolicyAssignmentOptions model. + */ +public class UpdatePolicyAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdatePolicyAssignmentOptions() throws Throwable { + UpdatePolicyAssignmentOptions updatePolicyAssignmentOptionsModel = new UpdatePolicyAssignmentOptions.Builder() + .assignmentId("testString") + .version("1.0") + .ifMatch("testString") + .templateVersion("testString") + .build(); + assertEquals(updatePolicyAssignmentOptionsModel.assignmentId(), "testString"); + assertEquals(updatePolicyAssignmentOptionsModel.version(), "1.0"); + assertEquals(updatePolicyAssignmentOptionsModel.ifMatch(), "testString"); + assertEquals(updatePolicyAssignmentOptionsModel.templateVersion(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdatePolicyAssignmentOptionsError() throws Throwable { + new UpdatePolicyAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java new file mode 100644 index 00000000000..de000e8c745 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdatePolicyStateOptions model. + */ +public class UpdatePolicyStateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdatePolicyStateOptions() throws Throwable { + UpdatePolicyStateOptions updatePolicyStateOptionsModel = new UpdatePolicyStateOptions.Builder() + .policyId("testString") + .ifMatch("testString") + .state("active") + .build(); + assertEquals(updatePolicyStateOptionsModel.policyId(), "testString"); + assertEquals(updatePolicyStateOptionsModel.ifMatch(), "testString"); + assertEquals(updatePolicyStateOptionsModel.state(), "active"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdatePolicyStateOptionsError() throws Throwable { + new UpdatePolicyStateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java new file mode 100644 index 00000000000..879c3d5f456 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateRoleAssignmentOptions model. + */ +public class UpdateRoleAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateRoleAssignmentOptions() throws Throwable { + UpdateRoleAssignmentOptions updateRoleAssignmentOptionsModel = new UpdateRoleAssignmentOptions.Builder() + .assignmentId("testString") + .ifMatch("testString") + .templateVersion("testString") + .build(); + assertEquals(updateRoleAssignmentOptionsModel.assignmentId(), "testString"); + assertEquals(updateRoleAssignmentOptionsModel.ifMatch(), "testString"); + assertEquals(updateRoleAssignmentOptionsModel.templateVersion(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateRoleAssignmentOptionsError() throws Throwable { + new UpdateRoleAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java new file mode 100644 index 00000000000..1d69d016781 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java @@ -0,0 +1,75 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateSettingsOptions model. + */ +public class UpdateSettingsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateSettingsOptions() throws Throwable { + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + assertEquals(identityTypesBaseModel.state(), "enabled"); + assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); + + IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() + .user(identityTypesBaseModel) + .serviceId(identityTypesBaseModel) + .service(identityTypesBaseModel) + .build(); + assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); + + ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() + .identityTypes(identityTypesPatchModel) + .build(); + assertEquals(externalAccountIdentityInteractionPatchModel.identityTypes(), identityTypesPatchModel); + + UpdateSettingsOptions updateSettingsOptionsModel = new UpdateSettingsOptions.Builder() + .accountId("testString") + .ifMatch("testString") + .externalAccountIdentityInteraction(externalAccountIdentityInteractionPatchModel) + .acceptLanguage("default") + .build(); + assertEquals(updateSettingsOptionsModel.accountId(), "testString"); + assertEquals(updateSettingsOptionsModel.ifMatch(), "testString"); + assertEquals(updateSettingsOptionsModel.externalAccountIdentityInteraction(), externalAccountIdentityInteractionPatchModel); + assertEquals(updateSettingsOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateSettingsOptionsError() throws Throwable { + new UpdateSettingsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java new file mode 100644 index 00000000000..aff020c8985 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyCollection model. + */ +public class V2PolicyCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyCollection() throws Throwable { + V2PolicyCollection v2PolicyCollectionModel = new V2PolicyCollection(); + assertNull(v2PolicyCollectionModel.getLimit()); + assertNull(v2PolicyCollectionModel.getFirst()); + assertNull(v2PolicyCollectionModel.getNext()); + assertNull(v2PolicyCollectionModel.getPrevious()); + assertNull(v2PolicyCollectionModel.getPolicies()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java new file mode 100644 index 00000000000..407eaadb155 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResourceAttribute model. + */ +public class V2PolicyResourceAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyResourceAttribute() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(v2PolicyResourceAttributeModel); + + V2PolicyResourceAttribute v2PolicyResourceAttributeModelNew = TestUtilities.deserialize(json, V2PolicyResourceAttribute.class); + assertTrue(v2PolicyResourceAttributeModelNew instanceof V2PolicyResourceAttribute); + assertEquals(v2PolicyResourceAttributeModelNew.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModelNew.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyResourceAttributeError() throws Throwable { + new V2PolicyResourceAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java new file mode 100644 index 00000000000..97c9c813216 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResourceTag model. + */ +public class V2PolicyResourceTagTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyResourceTag() throws Throwable { + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + String json = TestUtilities.serialize(v2PolicyResourceTagModel); + + V2PolicyResourceTag v2PolicyResourceTagModelNew = TestUtilities.deserialize(json, V2PolicyResourceTag.class); + assertTrue(v2PolicyResourceTagModelNew instanceof V2PolicyResourceTag); + assertEquals(v2PolicyResourceTagModelNew.key(), "testString"); + assertEquals(v2PolicyResourceTagModelNew.value(), "testString"); + assertEquals(v2PolicyResourceTagModelNew.operator(), "stringEquals"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyResourceTagError() throws Throwable { + new V2PolicyResourceTag.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java new file mode 100644 index 00000000000..d153fd97be6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java @@ -0,0 +1,72 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResource model. + */ +public class V2PolicyResourceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyResource() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + String json = TestUtilities.serialize(v2PolicyResourceModel); + + V2PolicyResource v2PolicyResourceModelNew = TestUtilities.deserialize(json, V2PolicyResource.class); + assertTrue(v2PolicyResourceModelNew instanceof V2PolicyResource); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyResourceError() throws Throwable { + new V2PolicyResource.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java new file mode 100644 index 00000000000..6d6da85f2b4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRuleRuleAttribute model. + */ +public class V2PolicyRuleRuleAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyRuleRuleAttribute() throws Throwable { + V2PolicyRuleRuleAttribute v2PolicyRuleRuleAttributeModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleRuleAttributeModel.key(), "testString"); + assertEquals(v2PolicyRuleRuleAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleRuleAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(v2PolicyRuleRuleAttributeModel); + + V2PolicyRuleRuleAttribute v2PolicyRuleRuleAttributeModelNew = TestUtilities.deserialize(json, V2PolicyRuleRuleAttribute.class); + assertTrue(v2PolicyRuleRuleAttributeModelNew instanceof V2PolicyRuleRuleAttribute); + assertEquals(v2PolicyRuleRuleAttributeModelNew.key(), "testString"); + assertEquals(v2PolicyRuleRuleAttributeModelNew.operator(), "stringEquals"); + assertEquals(v2PolicyRuleRuleAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyRuleRuleAttributeError() throws Throwable { + new V2PolicyRuleRuleAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java new file mode 100644 index 00000000000..fdf25669ef7 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleWithNestedConditions; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRuleRuleWithNestedConditions model. + */ +public class V2PolicyRuleRuleWithNestedConditionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyRuleRuleWithNestedConditions() throws Throwable { + NestedConditionRuleAttribute nestedConditionModel = new NestedConditionRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(nestedConditionModel.key(), "testString"); + assertEquals(nestedConditionModel.operator(), "stringEquals"); + assertEquals(nestedConditionModel.value(), "testString"); + + V2PolicyRuleRuleWithNestedConditions v2PolicyRuleRuleWithNestedConditionsModel = new V2PolicyRuleRuleWithNestedConditions.Builder() + .operator("and") + .conditions(java.util.Arrays.asList(nestedConditionModel)) + .build(); + assertEquals(v2PolicyRuleRuleWithNestedConditionsModel.operator(), "and"); + assertEquals(v2PolicyRuleRuleWithNestedConditionsModel.conditions(), java.util.Arrays.asList(nestedConditionModel)); + + String json = TestUtilities.serialize(v2PolicyRuleRuleWithNestedConditionsModel); + + V2PolicyRuleRuleWithNestedConditions v2PolicyRuleRuleWithNestedConditionsModelNew = TestUtilities.deserialize(json, V2PolicyRuleRuleWithNestedConditions.class); + assertTrue(v2PolicyRuleRuleWithNestedConditionsModelNew instanceof V2PolicyRuleRuleWithNestedConditions); + assertEquals(v2PolicyRuleRuleWithNestedConditionsModelNew.operator(), "and"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyRuleRuleWithNestedConditionsError() throws Throwable { + new V2PolicyRuleRuleWithNestedConditions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java new file mode 100644 index 00000000000..e0af599840c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRule; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRule model. + */ +public class V2PolicyRuleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testV2PolicyRule() throws Throwable { + V2PolicyRule v2PolicyRuleModel = new V2PolicyRule(); + assertNotNull(v2PolicyRuleModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java new file mode 100644 index 00000000000..a6e8f9d8922 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicySubjectAttribute model. + */ +public class V2PolicySubjectAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicySubjectAttribute() throws Throwable { + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(v2PolicySubjectAttributeModel); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModelNew = TestUtilities.deserialize(json, V2PolicySubjectAttribute.class); + assertTrue(v2PolicySubjectAttributeModelNew instanceof V2PolicySubjectAttribute); + assertEquals(v2PolicySubjectAttributeModelNew.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModelNew.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicySubjectAttributeError() throws Throwable { + new V2PolicySubjectAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java new file mode 100644 index 00000000000..37adbaff5df --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java @@ -0,0 +1,60 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicySubject model. + */ +public class V2PolicySubjectTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicySubject() throws Throwable { + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + String json = TestUtilities.serialize(v2PolicySubjectModel); + + V2PolicySubject v2PolicySubjectModelNew = TestUtilities.deserialize(json, V2PolicySubject.class); + assertTrue(v2PolicySubjectModelNew instanceof V2PolicySubject); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicySubjectError() throws Throwable { + new V2PolicySubject.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java new file mode 100644 index 00000000000..2ffbe45575b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyTemplateMetaData model. + */ +public class V2PolicyTemplateMetaDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyTemplateMetaData() throws Throwable { + V2PolicyTemplateMetaData v2PolicyTemplateMetaDataModel = new V2PolicyTemplateMetaData(); + assertNull(v2PolicyTemplateMetaDataModel.getType()); + assertNull(v2PolicyTemplateMetaDataModel.getDescription()); + assertNull(v2PolicyTemplateMetaDataModel.getSubject()); + assertNull(v2PolicyTemplateMetaDataModel.getResource()); + assertNull(v2PolicyTemplateMetaDataModel.getPattern()); + assertNull(v2PolicyTemplateMetaDataModel.getRule()); + assertNull(v2PolicyTemplateMetaDataModel.getControl()); + assertNull(v2PolicyTemplateMetaDataModel.getState()); + assertNull(v2PolicyTemplateMetaDataModel.getLastPermitAt()); + assertNull(v2PolicyTemplateMetaDataModel.getLastPermitFrequency()); + assertNull(v2PolicyTemplateMetaDataModel.getTemplate()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java new file mode 100644 index 00000000000..1630201062c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2Policy model. + */ +public class V2PolicyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2Policy() throws Throwable { + V2Policy v2PolicyModel = new V2Policy(); + assertNull(v2PolicyModel.getType()); + assertNull(v2PolicyModel.getDescription()); + assertNull(v2PolicyModel.getSubject()); + assertNull(v2PolicyModel.getResource()); + assertNull(v2PolicyModel.getPattern()); + assertNull(v2PolicyModel.getRule()); + assertNull(v2PolicyModel.getControl()); + assertNull(v2PolicyModel.getState()); + assertNull(v2PolicyModel.getLastPermitAt()); + assertNull(v2PolicyModel.getLastPermitFrequency()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java new file mode 100644 index 00000000000..04aaecc16ae --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java @@ -0,0 +1,131 @@ +/* + * (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_policy_management.v1.utils; + +import java.util.Base64; +import java.util.Map; +import java.util.Set; +import java.util.List; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.io.InputStream; +import java.io.ByteArrayInputStream; + +import okhttp3.mockwebserver.RecordedRequest; +import okhttp3.HttpUrl; +import com.ibm.cloud.sdk.core.util.DateUtils; +import com.ibm.cloud.sdk.core.util.GsonSingleton; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; + +/** + * A class used by the unit tests containing utility functions. + */ +public class TestUtilities { + public static Map createMockMap() { + Map mockMap = new HashMap<>(); + mockMap.put("foo", "bar"); + return mockMap; + } + + public static HashMap createMockStreamMap() { + return new HashMap() { + { put("key1", createMockStream("This is a mock file.")); } + }; + } + + public static Map parseQueryString(RecordedRequest req) { + Map queryMap = new HashMap<>(); + + try { + HttpUrl requestUrl = req.getRequestUrl(); + + if (requestUrl != null) { + Set queryParamsNames = requestUrl.queryParameterNames(); + // map the parameter name to its corresponding value + for (String p : queryParamsNames) { + // get the corresponding value for the parameter (p) + List val = requestUrl.queryParameterValues(p); + if (val != null && !val.isEmpty()) { + String joinedQuery = String.join(",", val); + queryMap.put(p, joinedQuery); + } + } + } + if (queryMap.isEmpty()) { + return null; + } + } catch (Exception e) { + return null; + } + + return queryMap; + } + + public static String parseReqPath(RecordedRequest req) { + String parsedPath = null; + + try { + String fullPath = req.getPath(); + if (fullPath != null && !fullPath.isEmpty()) { + // retrieve the path segment before the query parameter + parsedPath = fullPath.split("\\?", 2)[0]; + } + if (parsedPath.isEmpty() || parsedPath == null) { + return null; + } + + } catch (Exception e) { + return null; + } + + return parsedPath; + } + + public static String serialize(Object obj) { + return GsonSingleton.getGson().toJson(obj); + } + + public static T deserialize(String json, Class clazz) { + return GsonSingleton.getGson().fromJson(json, clazz); + } + + public static InputStream createMockStream(String s) { + return new ByteArrayInputStream(s.getBytes()); + } + + public static List creatMockListFileWithMetadata() { + List list = new ArrayList(); + byte[] fileBytes = {(byte) 0xde, (byte) 0xad, (byte) 0xbe, (byte) 0xef}; + InputStream inputStream = new ByteArrayInputStream(fileBytes); + FileWithMetadata.Builder builder = new FileWithMetadata.Builder(); + builder.data(inputStream); + FileWithMetadata fileWithMetadata = builder.build(); + list.add(fileWithMetadata); + + return list; + } + + public static byte[] createMockByteArray(String encodedString) throws Exception { + return Base64.getDecoder().decode(encodedString); + } + + public static Date createMockDate(String date) throws Exception { + return DateUtils.parseAsDate(date); + } + + public static Date createMockDateTime(String date) throws Exception { + return DateUtils.parseAsDateTime(date); + } +} \ No newline at end of file From 15f80096757f5e8cc0e147e748b90c65a28be63f Mon Sep 17 00:00:00 2001 From: Bhavana Bellamgari Date: Wed, 10 Dec 2025 15:31:51 +0530 Subject: [PATCH 11/13] Removed the wrongly generated code Signed-off-by: Bhavana Bellamgari Signed-off-by: Bhavana Bellamgari --- .../v1/IamPolicyManagement.java | 2566 --------- .../AccountSettingsAccessManagement.java | 40 - .../v1/model/ActionControlAssignment.java | 207 - .../ActionControlAssignmentCollection.java | 88 - .../ActionControlAssignmentResource.java | 52 - ...ontrolAssignmentResourceActionControl.java | 53 - ...ctionControlAssignmentResourceCreated.java | 38 - .../ActionControlAssignmentTemplate.java | 134 - .../model/ActionControlAssignmentsPager.java | 108 - .../v1/model/ActionControlTemplate.java | 203 - .../ActionControlTemplateCollection.java | 90 - ...tionControlTemplateVersionsCollection.java | 88 - .../ActionControlTemplateVersionsPager.java | 108 - .../v1/model/ActionControlTemplatesPager.java | 108 - .../v1/model/AssignmentResourceCreated.java | 38 - .../v1/model/AssignmentResourceError.java | 88 - .../v1/model/AssignmentTargetDetails.java | 142 - .../v1/model/AssignmentTemplateDetails.java | 119 - .../CommitActionControlTemplateOptions.java | 134 - .../v1/model/CommitPolicyTemplateOptions.java | 134 - .../v1/model/CommitRoleTemplateOptions.java | 134 - .../v1/model/ConflictsWith.java | 62 - .../v1/model/Control.java | 104 - .../v1/model/ControlResponse.java | 42 - .../v1/model/ControlResponseControl.java | 24 - ...ntrolResponseControlWithEnrichedRoles.java | 24 - ...ctionControlTemplateAssignmentOptions.java | 191 - .../CreateActionControlTemplateOptions.java | 251 - ...teActionControlTemplateVersionOptions.java | 211 - .../v1/model/CreatePolicyOptions.java | 311 - ...CreatePolicyTemplateAssignmentOptions.java | 221 - .../v1/model/CreatePolicyTemplateOptions.java | 255 - .../CreatePolicyTemplateVersionOptions.java | 214 - .../v1/model/CreateRoleOptions.java | 308 - .../CreateRoleTemplateAssignmentOptions.java | 191 - .../v1/model/CreateRoleTemplateOptions.java | 251 - .../CreateRoleTemplateVersionOptions.java | 211 - .../v1/model/CreateV2PolicyOptions.java | 312 - .../v1/model/CustomRole.java | 195 - .../DeleteActionControlAssignmentOptions.java | 104 - .../DeleteActionControlTemplateOptions.java | 104 - ...teActionControlTemplateVersionOptions.java | 134 - .../model/DeletePolicyAssignmentOptions.java | 104 - .../v1/model/DeletePolicyOptions.java | 104 - .../v1/model/DeletePolicyTemplateOptions.java | 104 - .../DeletePolicyTemplateVersionOptions.java | 134 - .../v1/model/DeleteRoleAssignmentOptions.java | 104 - .../v1/model/DeleteRoleOptions.java | 104 - .../v1/model/DeleteRoleTemplateOptions.java | 104 - .../DeleteRoleTemplateVersionOptions.java | 134 - .../v1/model/DeleteV2PolicyOptions.java | 104 - .../v1/model/EnrichedRoles.java | 81 - .../v1/model/ErrorDetails.java | 40 - .../v1/model/ErrorObject.java | 128 - .../ExternalAccountIdentityInteraction.java | 40 - ...ternalAccountIdentityInteractionPatch.java | 95 - .../iam_policy_management/v1/model/First.java | 38 - .../GetActionControlAssignmentOptions.java | 104 - .../GetActionControlTemplateOptions.java | 140 - ...etActionControlTemplateVersionOptions.java | 134 - .../v1/model/GetPolicyAssignmentOptions.java | 134 - .../v1/model/GetPolicyOptions.java | 104 - .../v1/model/GetPolicyTemplateOptions.java | 140 - .../GetPolicyTemplateVersionOptions.java | 134 - .../v1/model/GetRoleAssignmentOptions.java | 104 - .../v1/model/GetRoleOptions.java | 104 - .../v1/model/GetRoleTemplateOptions.java | 140 - .../model/GetRoleTemplateVersionOptions.java | 134 - .../v1/model/GetSettingsOptions.java | 141 - .../v1/model/GetV2PolicyOptions.java | 148 - .../iam_policy_management/v1/model/Grant.java | 124 - .../v1/model/GrantWithEnrichedRoles.java | 40 - .../v1/model/IdentityTypes.java | 64 - .../v1/model/IdentityTypesBase.java | 168 - .../v1/model/IdentityTypesPatch.java | 147 - .../v1/model/LimitData.java | 50 - .../ListActionControlAssignmentsOptions.java | 245 - ...tActionControlTemplateVersionsOptions.java | 192 - .../ListActionControlTemplatesOptions.java | 193 - .../v1/model/ListPoliciesOptions.java | 501 -- .../model/ListPolicyAssignmentsOptions.java | 275 - .../ListPolicyTemplateVersionsOptions.java | 192 - .../v1/model/ListPolicyTemplatesOptions.java | 379 -- .../v1/model/ListRoleAssignmentsOptions.java | 245 - .../ListRoleTemplateVersionsOptions.java | 192 - .../v1/model/ListRoleTemplatesOptions.java | 307 - .../v1/model/ListRolesOptions.java | 234 - .../v1/model/ListV2PoliciesOptions.java | 492 -- .../v1/model/NestedCondition.java | 126 - .../model/NestedConditionRuleAttribute.java | 170 - .../NestedConditionRuleWithConditions.java | 139 - .../iam_policy_management/v1/model/Next.java | 50 - .../v1/model/PoliciesPager.java | 108 - .../v1/model/Policy.java | 188 - .../model/PolicyAssignmentResourcePolicy.java | 65 - .../v1/model/PolicyAssignmentResources.java | 50 - .../v1/model/PolicyAssignmentV1.java | 193 - .../model/PolicyAssignmentV1Collection.java | 88 - .../v1/model/PolicyAssignmentV1Resources.java | 50 - .../v1/model/PolicyAssignmentV1Subject.java | 60 - .../v1/model/PolicyAssignmentsPager.java | 108 - .../v1/model/PolicyCollection.java | 88 - .../v1/model/PolicyResource.java | 167 - .../v1/model/PolicyRole.java | 131 - .../v1/model/PolicySubject.java | 124 - .../v1/model/PolicyTemplate.java | 202 - .../PolicyTemplateAssignmentCollection.java | 88 - .../model/PolicyTemplateAssignmentItems.java | 261 - ...mplateAssignmentItemsPolicyAssignment.java | 50 - ...lateAssignmentItemsPolicyAssignmentV1.java | 38 - .../v1/model/PolicyTemplateCollection.java | 90 - .../v1/model/PolicyTemplateLimitData.java | 214 - .../v1/model/PolicyTemplateMetaData.java | 201 - .../PolicyTemplateVersionsCollection.java | 88 - .../v1/model/PolicyTemplateVersionsPager.java | 108 - .../v1/model/PolicyTemplatesPager.java | 108 - .../v1/model/Previous.java | 50 - .../ReplaceActionControlTemplateOptions.java | 273 - .../v1/model/ReplacePolicyOptions.java | 335 -- .../model/ReplacePolicyTemplateOptions.java | 276 - .../v1/model/ReplaceRoleOptions.java | 255 - .../v1/model/ReplaceRoleTemplateOptions.java | 273 - .../v1/model/ReplaceV2PolicyOptions.java | 336 -- .../v1/model/ResourceAttribute.java | 160 - .../v1/model/ResourceTag.java | 160 - .../iam_policy_management/v1/model/Role.java | 196 - .../v1/model/RoleAction.java | 64 - .../v1/model/RoleAssignment.java | 207 - .../v1/model/RoleAssignmentCollection.java | 88 - .../v1/model/RoleAssignmentResource.java | 50 - .../model/RoleAssignmentResourceCreated.java | 38 - .../v1/model/RoleAssignmentResourceRole.java | 53 - .../v1/model/RoleAssignmentTemplate.java | 134 - .../v1/model/RoleAssignmentsPager.java | 108 - .../v1/model/RoleCollection.java | 68 - .../v1/model/RoleTemplate.java | 202 - .../v1/model/RoleTemplateCollection.java | 90 - .../v1/model/RoleTemplatePrototypeRole.java | 239 - .../v1/model/RoleTemplateReferencesItem.java | 134 - .../model/RoleTemplateVersionsCollection.java | 88 - .../v1/model/RoleTemplateVersionsPager.java | 108 - .../v1/model/RoleTemplatesPager.java | 108 - .../iam_policy_management/v1/model/Roles.java | 106 - .../v1/model/RuleAttribute.java | 209 - .../v1/model/SubjectAttribute.java | 134 - .../v1/model/TemplateActionControl.java | 182 - .../v1/model/TemplateControl.java | 104 - .../v1/model/TemplateCountData.java | 50 - .../v1/model/TemplateGrant.java | 58 - .../v1/model/TemplateGrantRoleReferences.java | 110 - .../v1/model/TemplateGrantRoles.java | 110 - .../v1/model/TemplateMetadata.java | 91 - .../v1/model/TemplatePolicy.java | 272 - .../v1/model/TemplateRole.java | 209 - .../UpdateActionControlAssignmentOptions.java | 166 - .../model/UpdatePolicyAssignmentOptions.java | 196 - .../v1/model/UpdatePolicyStateOptions.java | 171 - .../v1/model/UpdateRoleAssignmentOptions.java | 166 - .../v1/model/UpdateSettingsOptions.java | 199 - .../v1/model/V2PoliciesPager.java | 108 - .../v1/model/V2Policy.java | 247 - .../v1/model/V2PolicyCollection.java | 88 - .../v1/model/V2PolicyResource.java | 167 - .../v1/model/V2PolicyResourceAttribute.java | 181 - .../v1/model/V2PolicyResourceTag.java | 174 - .../v1/model/V2PolicyRule.java | 126 - .../v1/model/V2PolicyRuleRuleAttribute.java | 170 - .../V2PolicyRuleRuleWithNestedConditions.java | 139 - .../v1/model/V2PolicySubject.java | 124 - .../v1/model/V2PolicySubjectAttribute.java | 175 - .../v1/model/V2PolicyTemplateMetaData.java | 260 - .../v1/package-info.java | 17 - .../v1/IamPolicyManagementTest.java | 5007 ----------------- .../AccountSettingsAccessManagementTest.java | 40 - ...ActionControlAssignmentCollectionTest.java | 47 - ...olAssignmentResourceActionControlTest.java | 43 - ...nControlAssignmentResourceCreatedTest.java | 37 - .../ActionControlAssignmentResourceTest.java | 45 - .../ActionControlAssignmentTemplateTest.java | 54 - .../v1/model/ActionControlAssignmentTest.java | 40 - .../ActionControlTemplateCollectionTest.java | 46 - .../v1/model/ActionControlTemplateTest.java | 44 - ...ControlTemplateVersionsCollectionTest.java | 46 - .../model/AssignmentResourceCreatedTest.java | 37 - .../v1/model/AssignmentResourceErrorTest.java | 44 - .../v1/model/AssignmentTargetDetailsTest.java | 54 - .../model/AssignmentTemplateDetailsTest.java | 48 - ...ommitActionControlTemplateOptionsTest.java | 47 - .../CommitPolicyTemplateOptionsTest.java | 47 - .../model/CommitRoleTemplateOptionsTest.java | 47 - .../v1/model/ConflictsWithTest.java | 39 - .../v1/model/ControlResponseControlTest.java | 39 - ...lResponseControlWithEnrichedRolesTest.java | 40 - .../v1/model/ControlResponseTest.java | 40 - .../v1/model/ControlTest.java | 63 - ...nControlTemplateAssignmentOptionsTest.java | 65 - ...reateActionControlTemplateOptionsTest.java | 65 - ...tionControlTemplateVersionOptionsTest.java | 63 - .../v1/model/CreatePolicyOptionsTest.java | 103 - ...tePolicyTemplateAssignmentOptionsTest.java | 67 - .../CreatePolicyTemplateOptionsTest.java | 145 - ...reatePolicyTemplateVersionOptionsTest.java | 143 - .../v1/model/CreateRoleOptionsTest.java | 57 - ...eateRoleTemplateAssignmentOptionsTest.java | 65 - .../model/CreateRoleTemplateOptionsTest.java | 69 - .../CreateRoleTemplateVersionOptionsTest.java | 65 - .../v1/model/CreateV2PolicyOptionsTest.java | 131 - .../v1/model/CustomRoleTest.java | 42 - ...eteActionControlAssignmentOptionsTest.java | 45 - ...eleteActionControlTemplateOptionsTest.java | 45 - ...tionControlTemplateVersionOptionsTest.java | 47 - .../DeletePolicyAssignmentOptionsTest.java | 45 - .../v1/model/DeletePolicyOptionsTest.java | 45 - .../DeletePolicyTemplateOptionsTest.java | 45 - ...eletePolicyTemplateVersionOptionsTest.java | 47 - .../DeleteRoleAssignmentOptionsTest.java | 45 - .../v1/model/DeleteRoleOptionsTest.java | 45 - .../model/DeleteRoleTemplateOptionsTest.java | 45 - .../DeleteRoleTemplateVersionOptionsTest.java | 47 - .../v1/model/DeleteV2PolicyOptionsTest.java | 45 - .../v1/model/EnrichedRolesTest.java | 39 - .../v1/model/ErrorDetailsTest.java | 38 - .../v1/model/ErrorObjectTest.java | 42 - ...alAccountIdentityInteractionPatchTest.java | 63 - ...xternalAccountIdentityInteractionTest.java | 39 - .../v1/model/FirstTest.java | 36 - ...GetActionControlAssignmentOptionsTest.java | 45 - .../GetActionControlTemplateOptionsTest.java | 47 - ...tionControlTemplateVersionOptionsTest.java | 47 - .../model/GetPolicyAssignmentOptionsTest.java | 47 - .../v1/model/GetPolicyOptionsTest.java | 45 - .../model/GetPolicyTemplateOptionsTest.java | 47 - .../GetPolicyTemplateVersionOptionsTest.java | 47 - .../model/GetRoleAssignmentOptionsTest.java | 45 - .../v1/model/GetRoleOptionsTest.java | 45 - .../v1/model/GetRoleTemplateOptionsTest.java | 47 - .../GetRoleTemplateVersionOptionsTest.java | 47 - .../v1/model/GetSettingsOptionsTest.java | 47 - .../v1/model/GetV2PolicyOptionsTest.java | 47 - .../v1/model/GrantTest.java | 56 - .../v1/model/GrantWithEnrichedRolesTest.java | 39 - .../v1/model/IdentityTypesBaseTest.java | 53 - .../v1/model/IdentityTypesPatchTest.java | 59 - .../v1/model/IdentityTypesTest.java | 40 - .../v1/model/LimitDataTest.java | 36 - ...stActionControlAssignmentsOptionsTest.java | 55 - ...ionControlTemplateVersionsOptionsTest.java | 51 - ...ListActionControlTemplatesOptionsTest.java | 51 - .../v1/model/ListPoliciesOptionsTest.java | 69 - .../ListPolicyAssignmentsOptionsTest.java | 57 - ...ListPolicyTemplateVersionsOptionsTest.java | 51 - .../model/ListPolicyTemplatesOptionsTest.java | 63 - .../model/ListRoleAssignmentsOptionsTest.java | 55 - .../ListRoleTemplateVersionsOptionsTest.java | 51 - .../model/ListRoleTemplatesOptionsTest.java | 59 - .../v1/model/ListRolesOptionsTest.java | 49 - .../v1/model/ListV2PoliciesOptionsTest.java | 69 - .../NestedConditionRuleAttributeTest.java | 57 - ...NestedConditionRuleWithConditionsTest.java | 63 - .../v1/model/NestedConditionTest.java | 38 - .../v1/model/NextTest.java | 37 - .../PolicyAssignmentResourcePolicyTest.java | 44 - .../model/PolicyAssignmentResourcesTest.java | 44 - .../PolicyAssignmentV1CollectionTest.java | 55 - .../PolicyAssignmentV1ResourcesTest.java | 45 - .../model/PolicyAssignmentV1SubjectTest.java | 36 - .../v1/model/PolicyAssignmentV1Test.java | 51 - .../v1/model/PolicyCollectionTest.java | 52 - .../v1/model/PolicyResourceTest.java | 72 - .../v1/model/PolicyRoleTest.java | 51 - .../v1/model/PolicySubjectTest.java | 58 - ...olicyTemplateAssignmentCollectionTest.java | 55 - ...teAssignmentItemsPolicyAssignmentTest.java | 50 - ...AssignmentItemsPolicyAssignmentV1Test.java | 51 - .../PolicyTemplateAssignmentItemsTest.java | 48 - .../model/PolicyTemplateCollectionTest.java | 55 - .../v1/model/PolicyTemplateLimitDataTest.java | 56 - .../v1/model/PolicyTemplateMetaDataTest.java | 50 - .../v1/model/PolicyTemplateTest.java | 53 - .../PolicyTemplateVersionsCollectionTest.java | 55 - .../v1/model/PolicyTest.java | 48 - .../v1/model/PreviousTest.java | 37 - ...placeActionControlTemplateOptionsTest.java | 67 - .../v1/model/ReplacePolicyOptionsTest.java | 105 - .../ReplacePolicyTemplateOptionsTest.java | 147 - .../v1/model/ReplaceRoleOptionsTest.java | 53 - .../model/ReplaceRoleTemplateOptionsTest.java | 69 - .../v1/model/ReplaceV2PolicyOptionsTest.java | 133 - .../v1/model/ResourceAttributeTest.java | 57 - .../v1/model/ResourceTagTest.java | 57 - .../v1/model/RoleActionTest.java | 39 - .../model/RoleAssignmentCollectionTest.java | 47 - .../RoleAssignmentResourceCreatedTest.java | 37 - .../model/RoleAssignmentResourceRoleTest.java | 43 - .../v1/model/RoleAssignmentResourceTest.java | 45 - .../v1/model/RoleAssignmentTemplateTest.java | 54 - .../v1/model/RoleAssignmentTest.java | 40 - .../v1/model/RoleCollectionTest.java | 41 - .../v1/model/RoleTemplateCollectionTest.java | 46 - .../model/RoleTemplatePrototypeRoleTest.java | 62 - .../model/RoleTemplateReferencesItemTest.java | 54 - .../v1/model/RoleTemplateTest.java | 44 - .../RoleTemplateVersionsCollectionTest.java | 46 - .../v1/model/RoleTest.java | 56 - .../v1/model/RolesTest.java | 51 - .../v1/model/RuleAttributeTest.java | 57 - .../v1/model/SubjectAttributeTest.java | 54 - .../v1/model/TemplateActionControlTest.java | 56 - .../v1/model/TemplateControlTest.java | 63 - .../v1/model/TemplateCountDataTest.java | 39 - .../TemplateGrantRoleReferencesTest.java | 58 - .../v1/model/TemplateGrantRolesTest.java | 56 - .../v1/model/TemplateGrantTest.java | 39 - .../v1/model/TemplateMetadataTest.java | 41 - .../v1/model/TemplatePolicyTest.java | 141 - .../v1/model/TemplateRoleTest.java | 59 - ...ateActionControlAssignmentOptionsTest.java | 49 - .../UpdatePolicyAssignmentOptionsTest.java | 51 - .../model/UpdatePolicyStateOptionsTest.java | 49 - .../UpdateRoleAssignmentOptionsTest.java | 49 - .../v1/model/UpdateSettingsOptionsTest.java | 75 - .../v1/model/V2PolicyCollectionTest.java | 55 - .../model/V2PolicyResourceAttributeTest.java | 57 - .../v1/model/V2PolicyResourceTagTest.java | 57 - .../v1/model/V2PolicyResourceTest.java | 72 - .../model/V2PolicyRuleRuleAttributeTest.java | 57 - ...olicyRuleRuleWithNestedConditionsTest.java | 63 - .../v1/model/V2PolicyRuleTest.java | 38 - .../model/V2PolicySubjectAttributeTest.java | 57 - .../v1/model/V2PolicySubjectTest.java | 60 - .../model/V2PolicyTemplateMetaDataTest.java | 57 - .../v1/model/V2PolicyTest.java | 55 - .../v1/utils/TestUtilities.java | 131 - 333 files changed, 41258 deletions(-) delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java deleted file mode 100644 index 2abe3baea4e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java +++ /dev/null @@ -1,2566 +0,0 @@ -/* - * (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. - */ - -/* - * IBM OpenAPI SDK Code Generator Version: 3.107.1-41b0fbd0-20250825-080732 - */ - -package com.ibm.cloud.platform_services.iam_policy_management.v1; - -import com.google.gson.JsonObject; -import com.ibm.cloud.platform_services.common.SdkCommon; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; -import com.ibm.cloud.sdk.core.http.RequestBuilder; -import com.ibm.cloud.sdk.core.http.ResponseConverter; -import com.ibm.cloud.sdk.core.http.ServiceCall; -import com.ibm.cloud.sdk.core.security.Authenticator; -import com.ibm.cloud.sdk.core.security.ConfigBasedAuthenticatorFactory; -import com.ibm.cloud.sdk.core.service.BaseService; -import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -/** - * IAM Policy Management API. - * - * API Version: 1.0.1 - */ -public class IamPolicyManagement extends BaseService { - - /** - * Default service name used when configuring the `IamPolicyManagement` client. - */ - public static final String DEFAULT_SERVICE_NAME = "iam_policy_management"; - - /** - * Default service endpoint URL. - */ - public static final String DEFAULT_SERVICE_URL = "https://iam.cloud.ibm.com"; - - /** - * Class method which constructs an instance of the `IamPolicyManagement` client. - * The default service name is used to configure the client instance. - * - * @return an instance of the `IamPolicyManagement` client using external configuration - */ - public static IamPolicyManagement newInstance() { - return newInstance(DEFAULT_SERVICE_NAME); - } - - /** - * Class method which constructs an instance of the `IamPolicyManagement` client. - * The specified service name is used to configure the client instance. - * - * @param serviceName the service name to be used when configuring the client instance - * @return an instance of the `IamPolicyManagement` client using external configuration - */ - public static IamPolicyManagement newInstance(String serviceName) { - Authenticator authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(serviceName); - IamPolicyManagement service = new IamPolicyManagement(serviceName, authenticator); - service.configureService(serviceName); - return service; - } - - /** - * Constructs an instance of the `IamPolicyManagement` client. - * The specified service name and authenticator are used to configure the client instance. - * - * @param serviceName the service name to be used when configuring the client instance - * @param authenticator the {@link Authenticator} instance to be configured for this client - */ - public IamPolicyManagement(String serviceName, Authenticator authenticator) { - super(serviceName, authenticator); - setServiceUrl(DEFAULT_SERVICE_URL); - } - - /** - * Get policies by attributes. - * - * Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account - * and filter by attribute values. This can be done through query parameters. The following attributes are supported: - * account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query - * parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If - * the caller does not have read access to any policies an empty array is returned. - * - * @param listPoliciesOptions the {@link ListPoliciesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyCollection} - */ - public ServiceCall listPolicies(ListPoliciesOptions listPoliciesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listPoliciesOptions, - "listPoliciesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicies"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listPoliciesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listPoliciesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listPoliciesOptions.accountId())); - if (listPoliciesOptions.iamId() != null) { - builder.query("iam_id", String.valueOf(listPoliciesOptions.iamId())); - } - if (listPoliciesOptions.accessGroupId() != null) { - builder.query("access_group_id", String.valueOf(listPoliciesOptions.accessGroupId())); - } - if (listPoliciesOptions.type() != null) { - builder.query("type", String.valueOf(listPoliciesOptions.type())); - } - if (listPoliciesOptions.serviceType() != null) { - builder.query("service_type", String.valueOf(listPoliciesOptions.serviceType())); - } - if (listPoliciesOptions.tagName() != null) { - builder.query("tag_name", String.valueOf(listPoliciesOptions.tagName())); - } - if (listPoliciesOptions.tagValue() != null) { - builder.query("tag_value", String.valueOf(listPoliciesOptions.tagValue())); - } - if (listPoliciesOptions.sort() != null) { - builder.query("sort", String.valueOf(listPoliciesOptions.sort())); - } - if (listPoliciesOptions.format() != null) { - builder.query("format", String.valueOf(listPoliciesOptions.format())); - } - if (listPoliciesOptions.state() != null) { - builder.query("state", String.valueOf(listPoliciesOptions.state())); - } - if (listPoliciesOptions.limit() != null) { - builder.query("limit", String.valueOf(listPoliciesOptions.limit())); - } - if (listPoliciesOptions.start() != null) { - builder.query("start", String.valueOf(listPoliciesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a policy. - * - * Creates a policy to grant access between a subject and a resource. There are two types of policies: **access** and - * **authorization**. A policy administrator might want to create an access policy which grants access to a user, - * service-id, or an access group. They might also want to create an authorization policy and setup access between - * services. - * - * ### Access - * - * To create an access policy, use **`"type": "access"`** in the body. The possible subject attributes are - * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or - * service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. Assign roles - * that are supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or - * **`service_group_id`** attribute and the **`accountId`** attribute. The IAM Services group (`IAM`) is a subset of - * account management services that includes the IAM platform services IAM Identity, IAM Access Management, IAM Users - * Management, IAM Groups, and future IAM services. If the subject is a locked service-id, the request will fail. - * - * ### Authorization - * - * Authorization policies are supported by services on a case by case basis. Refer to service documentation to verify - * their support of authorization policies. To create an authorization policy, use **`"type": "authorization"`** in - * the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject - * attributes might be provided. The following attributes are supported: - * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are - * supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access - * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject - * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. - * - * ### Attribute Operators - * - * Currently, only the `stringEquals` and the `stringMatch` operators are available. Resource attributes may support - * one or both operators. For more information, see [Assigning access by using wildcard - * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). - * - * ### Attribute Validations - * - * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like - * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated - * against Global Catalog locations. - * - * @param createPolicyOptions the {@link CreatePolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Policy} - */ - public ServiceCall createPolicy(CreatePolicyOptions createPolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyOptions, - "createPolicyOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createPolicyOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createPolicyOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("type", createPolicyOptions.type()); - contentJson.add("subjects", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.subjects())); - contentJson.add("roles", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.roles())); - contentJson.add("resources", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.resources())); - if (createPolicyOptions.description() != null) { - contentJson.addProperty("description", createPolicyOptions.description()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a policy. - * - * Update a policy to grant access between a subject and a resource. A policy administrator might want to update an - * existing policy. The policy type cannot be changed (You cannot change an access policy to an authorization policy). - * - * ### Access - * - * To update an access policy, use **`"type": "access"`** in the body. The possible subject attributes are - * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or - * service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. Assign roles - * that are supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * The policy resource must include either the **`serviceType`**, **`serviceName`**, or **`resourceGroupId`** - * attribute and the **`accountId`** attribute.` If the subject is a locked service-id, the request will fail. - * - * ### Authorization - * - * To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match - * the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following - * attributes are supported: - * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are - * supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access - * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject - * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. - * - * ### Attribute Operators - * - * Currently, only the `stringEquals` and the `stringMatch` operators are available. Resource attributes might support - * one or both operators. For more information, see [Assigning access by using wildcard - * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). - * - * ### Attribute Validations - * - * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like - * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated - * against Global Catalog locations. - * - * @param replacePolicyOptions the {@link ReplacePolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Policy} - */ - public ServiceCall replacePolicy(ReplacePolicyOptions replacePolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replacePolicyOptions, - "replacePolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_id", replacePolicyOptions.policyId()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replacePolicy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replacePolicyOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("type", replacePolicyOptions.type()); - contentJson.add("subjects", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.subjects())); - contentJson.add("roles", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.roles())); - contentJson.add("resources", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.resources())); - if (replacePolicyOptions.description() != null) { - contentJson.addProperty("description", replacePolicyOptions.description()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a policy by ID. - * - * Retrieve a policy by providing a policy ID. - * - * @param getPolicyOptions the {@link GetPolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateMetaData} - */ - public ServiceCall getPolicy(GetPolicyOptions getPolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyOptions, - "getPolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_id", getPolicyOptions.policyId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicy"); - 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); - } - - /** - * Delete a policy by ID. - * - * Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service - * ID. If the subject of the policy is a locked service-id, the request will fail. - * - * @param deletePolicyOptions the {@link DeletePolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deletePolicy(DeletePolicyOptions deletePolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyOptions, - "deletePolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_id", deletePolicyOptions.policyId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Restore a deleted policy by ID. - * - * Restore a policy that has recently been deleted. A policy administrator might want to restore a deleted policy. To - * restore a policy, use **`"state": "active"`** in the body. - * - * @param updatePolicyStateOptions the {@link UpdatePolicyStateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Policy} - */ - public ServiceCall updatePolicyState(UpdatePolicyStateOptions updatePolicyStateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updatePolicyStateOptions, - "updatePolicyStateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_id", updatePolicyStateOptions.policyId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updatePolicyState"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updatePolicyStateOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - if (updatePolicyStateOptions.state() != null) { - contentJson.addProperty("state", updatePolicyStateOptions.state()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get roles by filters. - * - * Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can - * be done through query parameters. Currently, we only support the following attributes: account_id, service_name, - * service_group_id, source_service_name and policy_type. Both service_name and service_group_id attributes are - * mutually exclusive. Only roles that match the filter and that the caller has read access to are returned. If the - * caller does not have read access to any roles an empty array is returned. - * - * @param listRolesOptions the {@link ListRolesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleCollection} - */ - public ServiceCall listRoles(ListRolesOptions listRolesOptions) { - if (listRolesOptions == null) { - listRolesOptions = new ListRolesOptions.Builder().build(); - } - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoles"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listRolesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listRolesOptions.acceptLanguage()); - } - if (listRolesOptions.accountId() != null) { - builder.query("account_id", String.valueOf(listRolesOptions.accountId())); - } - if (listRolesOptions.serviceName() != null) { - builder.query("service_name", String.valueOf(listRolesOptions.serviceName())); - } - if (listRolesOptions.sourceServiceName() != null) { - builder.query("source_service_name", String.valueOf(listRolesOptions.sourceServiceName())); - } - if (listRolesOptions.policyType() != null) { - builder.query("policy_type", String.valueOf(listRolesOptions.policyType())); - } - if (listRolesOptions.serviceGroupId() != null) { - builder.query("service_group_id", String.valueOf(listRolesOptions.serviceGroupId())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get roles by filters. - * - * Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can - * be done through query parameters. Currently, we only support the following attributes: account_id, service_name, - * service_group_id, source_service_name and policy_type. Both service_name and service_group_id attributes are - * mutually exclusive. Only roles that match the filter and that the caller has read access to are returned. If the - * caller does not have read access to any roles an empty array is returned. - * - * @return a {@link ServiceCall} with a result of type {@link RoleCollection} - */ - public ServiceCall listRoles() { - return listRoles(null); - } - - /** - * Create a role. - * - * Creates a custom role for a specific service within the account. An account owner or a user assigned the - * Administrator role on the Role management service can create a custom role. Any number of actions for a single - * service can be mapped to the new role, but there must be at least one service-defined action to successfully create - * the new role. - * - * @param createRoleOptions the {@link CreateRoleOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link CustomRole} - */ - public ServiceCall createRole(CreateRoleOptions createRoleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleOptions, - "createRoleOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRole"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createRoleOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createRoleOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("display_name", createRoleOptions.displayName()); - contentJson.add("actions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleOptions.actions())); - contentJson.addProperty("name", createRoleOptions.name()); - contentJson.addProperty("account_id", createRoleOptions.accountId()); - contentJson.addProperty("service_name", createRoleOptions.serviceName()); - if (createRoleOptions.description() != null) { - contentJson.addProperty("description", createRoleOptions.description()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a role. - * - * Update a custom role. A role administrator might want to update an existing role by updating the display name, - * description, or the actions that are mapped to the role. The name, account_id, and service_name can't be changed. - * - * @param replaceRoleOptions the {@link ReplaceRoleOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link CustomRole} - */ - public ServiceCall replaceRole(ReplaceRoleOptions replaceRoleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceRoleOptions, - "replaceRoleOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_id", replaceRoleOptions.roleId()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceRole"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replaceRoleOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("display_name", replaceRoleOptions.displayName()); - contentJson.add("actions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRoleOptions.actions())); - if (replaceRoleOptions.description() != null) { - contentJson.addProperty("description", replaceRoleOptions.description()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a role by ID. - * - * Retrieve a role by providing a role ID. - * - * @param getRoleOptions the {@link GetRoleOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link CustomRole} - */ - public ServiceCall getRole(GetRoleOptions getRoleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleOptions, - "getRoleOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_id", getRoleOptions.roleId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRole"); - 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); - } - - /** - * Delete a role by ID. - * - * Delete a role by providing a role ID. - * - * @param deleteRoleOptions the {@link DeleteRoleOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteRole(DeleteRoleOptions deleteRoleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleOptions, - "deleteRoleOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_id", deleteRoleOptions.roleId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRole"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get policies by attributes. - * - * Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account - * and filter by attribute values. This can be done through query parameters. The following attributes are supported: - * account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query - * parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If - * the caller does not have read access to any policies an empty array is returned. - * - * @param listV2PoliciesOptions the {@link ListV2PoliciesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link V2PolicyCollection} - */ - public ServiceCall listV2Policies(ListV2PoliciesOptions listV2PoliciesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listV2PoliciesOptions, - "listV2PoliciesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listV2Policies"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listV2PoliciesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listV2PoliciesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listV2PoliciesOptions.accountId())); - if (listV2PoliciesOptions.iamId() != null) { - builder.query("iam_id", String.valueOf(listV2PoliciesOptions.iamId())); - } - if (listV2PoliciesOptions.accessGroupId() != null) { - builder.query("access_group_id", String.valueOf(listV2PoliciesOptions.accessGroupId())); - } - if (listV2PoliciesOptions.type() != null) { - builder.query("type", String.valueOf(listV2PoliciesOptions.type())); - } - if (listV2PoliciesOptions.serviceType() != null) { - builder.query("service_type", String.valueOf(listV2PoliciesOptions.serviceType())); - } - if (listV2PoliciesOptions.serviceName() != null) { - builder.query("service_name", String.valueOf(listV2PoliciesOptions.serviceName())); - } - if (listV2PoliciesOptions.serviceGroupId() != null) { - builder.query("service_group_id", String.valueOf(listV2PoliciesOptions.serviceGroupId())); - } - if (listV2PoliciesOptions.sort() != null) { - builder.query("sort", String.valueOf(listV2PoliciesOptions.sort())); - } - if (listV2PoliciesOptions.format() != null) { - builder.query("format", String.valueOf(listV2PoliciesOptions.format())); - } - if (listV2PoliciesOptions.state() != null) { - builder.query("state", String.valueOf(listV2PoliciesOptions.state())); - } - if (listV2PoliciesOptions.limit() != null) { - builder.query("limit", String.valueOf(listV2PoliciesOptions.limit())); - } - if (listV2PoliciesOptions.start() != null) { - builder.query("start", String.valueOf(listV2PoliciesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a policy. - * - * Creates a policy to grant access between a subject and a resource. Currently, there is one type of a v2/policy: - * **access**. A policy administrator might want to create an access policy that grants access to a user, service-id, - * or an access group. - * - * ### Access - * - * To create an access policy, use **`"type": "access"`** in the body. The supported subject attributes are - * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute to assign access to a user or - * service-id. Use the **`access_group_id`** subject attribute to assign access to an access group. Assign roles that - * are supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or - * **`service_group_id`** attribute and the **`accountId`** attribute. In the rule field, you can specify a single - * condition by using **`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`** with a - * combination **`operator`**. The possible combination operators are **`and`** and **`or`**. - * - * Currently, we support two types of patterns: - * - * 1. `time-based`: Used to specify a time-based restriction - * - * Combine conditions to specify a time-based restriction (e.g., access only during business hours, during the - * Monday-Friday work week). For example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following - * rule: - * ```json - * "rule": { - * "operator": "and", - * "conditions": [{ - * "key": "{{environment.attributes.day_of_week}}", - * "operator": "dayOfWeekAnyOf", - * "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] - * }, - * "key": "{{environment.attributes.current_time}}", - * "operator": "timeGreaterThanOrEquals", - * "value": "09:00:00+00:00" - * }, - * "key": "{{environment.attributes.current_time}}", - * "operator": "timeLessThanOrEquals", - * "value": "17:00:00+00:00" - * }] - * } - * ``` You can use the following operators in the **`key`** and **`value`** pair: - * ``` - * 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', - * 'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan', 'dateGreaterThanOrEquals', - * 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', - * 'dayOfWeekEquals', 'dayOfWeekAnyOf' - * ``` - * - * The pattern field that matches the rule is required when rule is provided. For the business hour rule example - * above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions - * operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) and - * [Limiting access with time-based conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the - * subject is a locked service-id, the request will fail. - * - * 2. `attribute-based`: Used to specify a combination of OR/AND based conditions applied on resource attributes. - * - * Combine conditions to specify an attribute-based condition using AND/OR-based operators. - * - * For example, a policy can grant access based on multiple conditions applied on the resource attributes below: - * ```json - * "pattern": "attribute-based-condition:resource:literal-and-wildcard" - * "rule": { - * "operator": "or", - * "conditions": [ - * { - * "operator": "and", - * "conditions": [ - * { - * "key": "{{resource.attributes.prefix}}", - * "operator": "stringEquals", - * "value": "home/test" - * }, - * { - * "key": "{{environment.attributes.delimiter}}", - * "operator": "stringEquals", - * "value": "/" - * } - * ] - * }, - * { - * "key": "{{resource.attributes.path}}", - * "operator": "stringMatch", - * "value": "home/David/_*" - * } - * ] - * } - * ``` - * - * In addition to satisfying the `resources` section, the policy grants permission only if either the `path` begins - * with `home/David/` **OR** the `prefix` is `home/test` and the `delimiter` is `/`. This mechanism helps you - * consolidate multiple policies in to a single policy, making policies easier to administer and stay within the - * policy limit for an account. View the list of operators that can be used in the condition - * [here](/docs/account?topic=account-wildcard#string-comparisons). - * - * ### Authorization - * - * Authorization policies are supported by services on a case by case basis. Refer to service documentation to verify - * their support of authorization policies. To create an authorization policy, use **`"type": "authorization"`** in - * the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject - * attributes might be provided. The following attributes are supported: - * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are - * supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access - * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject - * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. - * - * ### Attribute Operators - * - * Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators are available. For more - * information, see [Assigning access by using wildcard - * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). - * - * ### Attribute Validations - * - * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like - * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated - * against Global Catalog locations. - * - * @param createV2PolicyOptions the {@link CreateV2PolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link V2Policy} - */ - public ServiceCall createV2Policy(CreateV2PolicyOptions createV2PolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createV2PolicyOptions, - "createV2PolicyOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createV2Policy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createV2PolicyOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createV2PolicyOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.add("control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.control())); - contentJson.addProperty("type", createV2PolicyOptions.type()); - if (createV2PolicyOptions.description() != null) { - contentJson.addProperty("description", createV2PolicyOptions.description()); - } - if (createV2PolicyOptions.subject() != null) { - contentJson.add("subject", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.subject())); - } - if (createV2PolicyOptions.resource() != null) { - contentJson.add("resource", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.resource())); - } - if (createV2PolicyOptions.pattern() != null) { - contentJson.addProperty("pattern", createV2PolicyOptions.pattern()); - } - if (createV2PolicyOptions.rule() != null) { - contentJson.add("rule", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.rule())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a policy. - * - * Update a policy to grant access between a subject and a resource. A policy administrator might want to update an - * existing policy. - * - * ### Access - * - * To update an access policy, use **`"type": "access"`** in the body. The supported subject attributes are - * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute to assign access to a user or - * service-id. Use the **`access_group_id`** subject attribute to assign access to an access group. Assign roles that - * are supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or - * **`service_group_id`** attribute and the **`accountId`** attribute. In the rule field, you can specify a single - * condition by using **`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`** with a - * combination **`operator`**. The possible combination operators are **`and`** and **`or`**. - * - * Currently, we support two types of patterns: - * - * 1. `time-based`: Used to specify a time-based restriction - * - * Combine conditions to specify a time-based restriction (e.g., access only during business hours, during the - * Monday-Friday work week). For example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following - * rule: - * ```json - * "rule": { - * "operator": "and", - * "conditions": [{ - * "key": "{{environment.attributes.day_of_week}}", - * "operator": "dayOfWeekAnyOf", - * "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] - * }, - * "key": "{{environment.attributes.current_time}}", - * "operator": "timeGreaterThanOrEquals", - * "value": "09:00:00+00:00" - * }, - * "key": "{{environment.attributes.current_time}}", - * "operator": "timeLessThanOrEquals", - * "value": "17:00:00+00:00" - * }] - * } - * ``` You can use the following operators in the **`key`** and **`value`** pair: - * ``` - * 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', - * 'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan', 'dateGreaterThanOrEquals', - * 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', - * 'dayOfWeekEquals', 'dayOfWeekAnyOf' - * ``` The pattern field that matches the rule is required when rule is provided. For the business hour rule example - * above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions - * operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) and - * [Limiting access with time-based conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the - * subject is a locked service-id, the request will fail. - * - * 2. `attribute-based`: Used to specify a combination of OR/AND based conditions applied on resource attributes. - * - * Combine conditions to specify an attribute-based condition using AND/OR-based operators. - * - * For example, a policy can grant access based on multiple conditions applied on the resource attributes below: - * ```json - * "pattern": "attribute-based-condition:resource:literal-and-wildcard" - * "rule": { - * "operator": "or", - * "conditions": [ - * { - * "operator": "and", - * "conditions": [ - * { - * "key": "{{resource.attributes.prefix}}", - * "operator": "stringEquals", - * "value": "home/test" - * }, - * { - * "key": "{{environment.attributes.delimiter}}", - * "operator": "stringEquals", - * "value": "/" - * } - * ] - * }, - * { - * "key": "{{resource.attributes.path}}", - * "operator": "stringMatch", - * "value": "home/David/_*" - * } - * ] - * } - * ``` - * - * In addition to satisfying the `resources` section, the policy grants permission only if either the `path` begins - * with `home/David/` **OR** the `prefix` is `home/test` and the `delimiter` is `/`. This mechanism helps you - * consolidate multiple policies in to a single policy, making policies easier to administer and stay within the - * policy limit for an account. View the list of operators that can be used in the condition - * [here](/docs/account?topic=account-wildcard#string-comparisons). - * - * ### Authorization - * - * To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match - * the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following - * attributes are supported: - * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are - * supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access - * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject - * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. - * - * ### Attribute Operators - * - * Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators are available. For more - * information, see [Assigning access by using wildcard - * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). - * - * ### Attribute Validations - * - * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like - * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated - * against Global Catalog locations. - * - * @param replaceV2PolicyOptions the {@link ReplaceV2PolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link V2Policy} - */ - public ServiceCall replaceV2Policy(ReplaceV2PolicyOptions replaceV2PolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceV2PolicyOptions, - "replaceV2PolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", replaceV2PolicyOptions.id()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceV2Policy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replaceV2PolicyOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.add("control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.control())); - contentJson.addProperty("type", replaceV2PolicyOptions.type()); - if (replaceV2PolicyOptions.description() != null) { - contentJson.addProperty("description", replaceV2PolicyOptions.description()); - } - if (replaceV2PolicyOptions.subject() != null) { - contentJson.add("subject", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.subject())); - } - if (replaceV2PolicyOptions.resource() != null) { - contentJson.add("resource", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.resource())); - } - if (replaceV2PolicyOptions.pattern() != null) { - contentJson.addProperty("pattern", replaceV2PolicyOptions.pattern()); - } - if (replaceV2PolicyOptions.rule() != null) { - contentJson.add("rule", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.rule())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a policy by ID. - * - * Retrieve a policy by providing a policy ID. - * - * @param getV2PolicyOptions the {@link GetV2PolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link V2PolicyTemplateMetaData} - */ - public ServiceCall getV2Policy(GetV2PolicyOptions getV2PolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getV2PolicyOptions, - "getV2PolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", getV2PolicyOptions.id()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getV2Policy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getV2PolicyOptions.format() != null) { - builder.query("format", String.valueOf(getV2PolicyOptions.format())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a policy by ID. - * - * Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service - * ID. If the subject of the policy is a locked service-id, the request will fail. - * - * @param deleteV2PolicyOptions the {@link DeleteV2PolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteV2Policy(DeleteV2PolicyOptions deleteV2PolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteV2PolicyOptions, - "deleteV2PolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", deleteV2PolicyOptions.id()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteV2Policy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List policy templates by attributes. - * - * List policy templates and filter by attributes by using query parameters. The following attributes are supported: - * `account_id`, `policy_service_name`, `policy_service_type`, `policy_service_group_id` and `policy_type`. - * `account_id` is a required query parameter. These attributes `policy_service_name`, `policy_service_type` and - * `policy_service_group_id` are mutually exclusive. Only policy templates that have the specified attributes and that - * the caller has read access to are returned. If the caller does not have read access to any policy templates an - * empty array is returned. - * - * @param listPolicyTemplatesOptions the {@link ListPolicyTemplatesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateCollection} - */ - public ServiceCall listPolicyTemplates(ListPolicyTemplatesOptions listPolicyTemplatesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyTemplatesOptions, - "listPolicyTemplatesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyTemplates"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listPolicyTemplatesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listPolicyTemplatesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listPolicyTemplatesOptions.accountId())); - if (listPolicyTemplatesOptions.state() != null) { - builder.query("state", String.valueOf(listPolicyTemplatesOptions.state())); - } - if (listPolicyTemplatesOptions.name() != null) { - builder.query("name", String.valueOf(listPolicyTemplatesOptions.name())); - } - if (listPolicyTemplatesOptions.policyServiceType() != null) { - builder.query("policy_service_type", String.valueOf(listPolicyTemplatesOptions.policyServiceType())); - } - if (listPolicyTemplatesOptions.policyServiceName() != null) { - builder.query("policy_service_name", String.valueOf(listPolicyTemplatesOptions.policyServiceName())); - } - if (listPolicyTemplatesOptions.policyServiceGroupId() != null) { - builder.query("policy_service_group_id", String.valueOf(listPolicyTemplatesOptions.policyServiceGroupId())); - } - if (listPolicyTemplatesOptions.policyType() != null) { - builder.query("policy_type", String.valueOf(listPolicyTemplatesOptions.policyType())); - } - if (listPolicyTemplatesOptions.limit() != null) { - builder.query("limit", String.valueOf(listPolicyTemplatesOptions.limit())); - } - if (listPolicyTemplatesOptions.start() != null) { - builder.query("start", String.valueOf(listPolicyTemplatesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a policy template. - * - * Create a policy template. Policy templates define a policy without requiring a subject, and you can use them to - * grant access to multiple subjects. - * - * @param createPolicyTemplateOptions the {@link CreatePolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateLimitData} - */ - public ServiceCall createPolicyTemplate(CreatePolicyTemplateOptions createPolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateOptions, - "createPolicyTemplateOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createPolicyTemplateOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createPolicyTemplateOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("name", createPolicyTemplateOptions.name()); - contentJson.addProperty("account_id", createPolicyTemplateOptions.accountId()); - contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateOptions.policy())); - if (createPolicyTemplateOptions.description() != null) { - contentJson.addProperty("description", createPolicyTemplateOptions.description()); - } - if (createPolicyTemplateOptions.committed() != null) { - contentJson.addProperty("committed", createPolicyTemplateOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve latest version of a policy template. - * - * Retrieve the latest version of a policy template by providing a policy template ID. - * - * @param getPolicyTemplateOptions the {@link GetPolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} - */ - public ServiceCall getPolicyTemplate(GetPolicyTemplateOptions getPolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyTemplateOptions, - "getPolicyTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", getPolicyTemplateOptions.policyTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getPolicyTemplateOptions.state() != null) { - builder.query("state", String.valueOf(getPolicyTemplateOptions.state())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a policy template. - * - * Delete a policy template by providing the policy template ID. This deletes all versions of this template. A policy - * template can't be deleted if any version of the template is assigned to one or more child accounts. You must remove - * the policy assignments first. - * - * @param deletePolicyTemplateOptions the {@link DeletePolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deletePolicyTemplate(DeletePolicyTemplateOptions deletePolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyTemplateOptions, - "deletePolicyTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", deletePolicyTemplateOptions.policyTemplateId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a new policy template version. - * - * Create a new version of a policy template. Use this if you need to make updates to a policy template that is - * committed. - * - * @param createPolicyTemplateVersionOptions the {@link CreatePolicyTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateLimitData} - */ - public ServiceCall createPolicyTemplateVersion(CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateVersionOptions, - "createPolicyTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", createPolicyTemplateVersionOptions.policyTemplateId()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - final JsonObject contentJson = new JsonObject(); - contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateVersionOptions.policy())); - if (createPolicyTemplateVersionOptions.name() != null) { - contentJson.addProperty("name", createPolicyTemplateVersionOptions.name()); - } - if (createPolicyTemplateVersionOptions.description() != null) { - contentJson.addProperty("description", createPolicyTemplateVersionOptions.description()); - } - if (createPolicyTemplateVersionOptions.committed() != null) { - contentJson.addProperty("committed", createPolicyTemplateVersionOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve policy template versions. - * - * Retrieve the versions of a policy template by providing a policy template ID. - * - * @param listPolicyTemplateVersionsOptions the {@link ListPolicyTemplateVersionsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateVersionsCollection} - */ - public ServiceCall listPolicyTemplateVersions(ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyTemplateVersionsOptions, - "listPolicyTemplateVersionsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", listPolicyTemplateVersionsOptions.policyTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyTemplateVersions"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listPolicyTemplateVersionsOptions.state() != null) { - builder.query("state", String.valueOf(listPolicyTemplateVersionsOptions.state())); - } - if (listPolicyTemplateVersionsOptions.limit() != null) { - builder.query("limit", String.valueOf(listPolicyTemplateVersionsOptions.limit())); - } - if (listPolicyTemplateVersionsOptions.start() != null) { - builder.query("start", String.valueOf(listPolicyTemplateVersionsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a policy template version. - * - * Update a specific version of a policy template. You can use this only if the version isn't committed. - * - * @param replacePolicyTemplateOptions the {@link ReplacePolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} - */ - public ServiceCall replacePolicyTemplate(ReplacePolicyTemplateOptions replacePolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replacePolicyTemplateOptions, - "replacePolicyTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", replacePolicyTemplateOptions.policyTemplateId()); - pathParamsMap.put("version", replacePolicyTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replacePolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replacePolicyTemplateOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyTemplateOptions.policy())); - if (replacePolicyTemplateOptions.name() != null) { - contentJson.addProperty("name", replacePolicyTemplateOptions.name()); - } - if (replacePolicyTemplateOptions.description() != null) { - contentJson.addProperty("description", replacePolicyTemplateOptions.description()); - } - if (replacePolicyTemplateOptions.committed() != null) { - contentJson.addProperty("committed", replacePolicyTemplateOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a policy template version. - * - * Delete a specific version of a policy template by providing a policy template ID and version number. You can't - * delete a policy template version that is assigned to one or more child accounts. You must remove the policy - * assignments first. - * - * @param deletePolicyTemplateVersionOptions the {@link DeletePolicyTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deletePolicyTemplateVersion(DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyTemplateVersionOptions, - "deletePolicyTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", deletePolicyTemplateVersionOptions.policyTemplateId()); - pathParamsMap.put("version", deletePolicyTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a policy template version. - * - * Retrieve a policy template by providing a policy template ID and version number. - * - * @param getPolicyTemplateVersionOptions the {@link GetPolicyTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} - */ - public ServiceCall getPolicyTemplateVersion(GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyTemplateVersionOptions, - "getPolicyTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", getPolicyTemplateVersionOptions.policyTemplateId()); - pathParamsMap.put("version", getPolicyTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyTemplateVersion"); - 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); - } - - /** - * Commit a policy template version. - * - * Commit a policy template version. You can make no further changes to the policy template once it's committed. If - * you need to make updates after committing a version, create a new version. - * - * @param commitPolicyTemplateOptions the {@link CommitPolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall commitPolicyTemplate(CommitPolicyTemplateOptions commitPolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(commitPolicyTemplateOptions, - "commitPolicyTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", commitPolicyTemplateOptions.policyTemplateId()); - pathParamsMap.put("version", commitPolicyTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}/commit", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitPolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get policy template assignments. - * - * Get policy template assignments by attributes. The following attributes are supported: - * `account_id`, `template_id`, `template_version`, `sort`. - * `account_id` is a required query parameter. Only policy template assignments that have the specified attributes and - * that the caller has read access to are returned. If the caller does not have read access to any policy template - * assignments an empty array is returned. - * - * @param listPolicyAssignmentsOptions the {@link ListPolicyAssignmentsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateAssignmentCollection} - */ - public ServiceCall listPolicyAssignments(ListPolicyAssignmentsOptions listPolicyAssignmentsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyAssignmentsOptions, - "listPolicyAssignmentsOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyAssignments"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listPolicyAssignmentsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listPolicyAssignmentsOptions.acceptLanguage()); - } - builder.query("version", String.valueOf(listPolicyAssignmentsOptions.version())); - builder.query("account_id", String.valueOf(listPolicyAssignmentsOptions.accountId())); - if (listPolicyAssignmentsOptions.templateId() != null) { - builder.query("template_id", String.valueOf(listPolicyAssignmentsOptions.templateId())); - } - if (listPolicyAssignmentsOptions.templateVersion() != null) { - builder.query("template_version", String.valueOf(listPolicyAssignmentsOptions.templateVersion())); - } - if (listPolicyAssignmentsOptions.limit() != null) { - builder.query("limit", String.valueOf(listPolicyAssignmentsOptions.limit())); - } - if (listPolicyAssignmentsOptions.start() != null) { - builder.query("start", String.valueOf(listPolicyAssignmentsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a policy authorization template assignment. - * - * Assign a policy template to child accounts and account groups. This creates the policy in the accounts and account - * groups that you specify. - * - * @param createPolicyTemplateAssignmentOptions the {@link CreatePolicyTemplateAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyAssignmentV1Collection} - */ - public ServiceCall createPolicyTemplateAssignment(CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateAssignmentOptions, - "createPolicyTemplateAssignmentOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplateAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createPolicyTemplateAssignmentOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createPolicyTemplateAssignmentOptions.acceptLanguage()); - } - builder.query("version", String.valueOf(createPolicyTemplateAssignmentOptions.version())); - final JsonObject contentJson = new JsonObject(); - contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateAssignmentOptions.target())); - contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateAssignmentOptions.templates())); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a policy assignment. - * - * Retrieve a policy template assignment by providing a policy assignment ID. - * - * @param getPolicyAssignmentOptions the {@link GetPolicyAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateAssignmentItems} - */ - public ServiceCall getPolicyAssignment(GetPolicyAssignmentOptions getPolicyAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyAssignmentOptions, - "getPolicyAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", getPolicyAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(getPolicyAssignmentOptions.version())); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a policy authorization type assignment. - * - * Update a policy assignment by providing a policy assignment ID. - * - * @param updatePolicyAssignmentOptions the {@link UpdatePolicyAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyAssignmentV1} - */ - public ServiceCall updatePolicyAssignment(UpdatePolicyAssignmentOptions updatePolicyAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updatePolicyAssignmentOptions, - "updatePolicyAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", updatePolicyAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updatePolicyAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updatePolicyAssignmentOptions.ifMatch()); - builder.query("version", String.valueOf(updatePolicyAssignmentOptions.version())); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("template_version", updatePolicyAssignmentOptions.templateVersion()); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Remove a policy assignment. - * - * Remove a policy template assignment by providing a policy assignment ID. You can't delete a policy assignment if - * the status is "in_progress". - * - * @param deletePolicyAssignmentOptions the {@link DeletePolicyAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deletePolicyAssignment(DeletePolicyAssignmentOptions deletePolicyAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyAssignmentOptions, - "deletePolicyAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", deletePolicyAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve Access Management account settings by account ID. - * - * Retrieve Access Management settings for an account by providing the account ID. - * - * @param getSettingsOptions the {@link GetSettingsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AccountSettingsAccessManagement} - */ - public ServiceCall getSettings(GetSettingsOptions getSettingsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getSettingsOptions, - "getSettingsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", getSettingsOptions.accountId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/settings/access_management", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getSettings"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getSettingsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", getSettingsOptions.acceptLanguage()); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update Access Management account settings by account ID. - * - * Update access management settings for an account. - * - * ### External Account Identity Interaction - * - * Update the way identities within an external account are allowed to interact with the requested account by - * providing: - * * the `account_id` as a parameter - * * one or more external account ID(s) and state for the specific identity in the request body - * - * External account identity interaction includes the following `identity_types`: `user` (user identities that are - * defined as [IBMid's](https://cloud.ibm.com/docs/account?topic=account-identity-overview#users-bestpract)), - * `service_id` (defined as [IAM - * ServiceIds](https://cloud.ibm.com/docs/account?topic=account-identity-overview#serviceid-bestpract)), `service` - * (defined by a service’s [CRN](https://cloud.ibm.com/docs/account?topic=account-crn)). To update an Identity’s - * setting, the `state` and `external_allowed_accounts` fields are required. - * - * Different identity states are: - * * "enabled": An identity type is allowed to access resources in the account provided it has access policies on - * those resources. - * * "limited": An identity type is allowed to access resources in the account provided it has access policies on - * those resources AND it is associated with either the account the resources are in or one of the allowed accounts. - * This setting uses the "external_allowed_accounts" list. - * * "monitor": It has no direct impact on an Identity’s access. Instead, it creates AT events for access decisions as - * if the account were in a limited “state”. - * - * **Note**: The state "enabled" is a special case. In this case, access is given to all accounts and there is no need - * to specify a particular list. Therefore, when updating "state" to "enabled" for an identity type - * "external_allowed_accounts" should be left empty. - * - * @param updateSettingsOptions the {@link UpdateSettingsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AccountSettingsAccessManagement} - */ - public ServiceCall updateSettings(UpdateSettingsOptions updateSettingsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateSettingsOptions, - "updateSettingsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", updateSettingsOptions.accountId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/settings/access_management", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateSettings"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updateSettingsOptions.ifMatch()); - if (updateSettingsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", updateSettingsOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - if (updateSettingsOptions.externalAccountIdentityInteraction() != null) { - contentJson.add("external_account_identity_interaction", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateSettingsOptions.externalAccountIdentityInteraction())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List action control templates by attributes. - * - * List action control templates and filter by attributes by using query parameters. The following attributes are - * supported: - * `account_id` - * `account_id` is a required query parameter. Only action control templates that have the specified attributes and - * that the caller has read access to are returned. If the caller does not have read access to any action control - * templates an empty array is returned. - * - * @param listActionControlTemplatesOptions the {@link ListActionControlTemplatesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplateCollection} - */ - public ServiceCall listActionControlTemplates(ListActionControlTemplatesOptions listActionControlTemplatesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlTemplatesOptions, - "listActionControlTemplatesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlTemplates"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listActionControlTemplatesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listActionControlTemplatesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listActionControlTemplatesOptions.accountId())); - if (listActionControlTemplatesOptions.limit() != null) { - builder.query("limit", String.valueOf(listActionControlTemplatesOptions.limit())); - } - if (listActionControlTemplatesOptions.start() != null) { - builder.query("start", String.valueOf(listActionControlTemplatesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create an action control template. - * - * Create an action control template. Action control templates define a service action control. - * - * @param createActionControlTemplateOptions the {@link CreateActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall createActionControlTemplate(CreateActionControlTemplateOptions createActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateOptions, - "createActionControlTemplateOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createActionControlTemplateOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createActionControlTemplateOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("name", createActionControlTemplateOptions.name()); - contentJson.addProperty("account_id", createActionControlTemplateOptions.accountId()); - if (createActionControlTemplateOptions.description() != null) { - contentJson.addProperty("description", createActionControlTemplateOptions.description()); - } - if (createActionControlTemplateOptions.committed() != null) { - contentJson.addProperty("committed", createActionControlTemplateOptions.committed()); - } - if (createActionControlTemplateOptions.actionControl() != null) { - contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateOptions.actionControl())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve the latest version of an action control template. - * - * Retrieve the latest version of an action control template by providing an action control template ID. - * - * @param getActionControlTemplateOptions the {@link GetActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall getActionControlTemplate(GetActionControlTemplateOptions getActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlTemplateOptions, - "getActionControlTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", getActionControlTemplateOptions.actionControlTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getActionControlTemplateOptions.state() != null) { - builder.query("state", String.valueOf(getActionControlTemplateOptions.state())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete an action control template. - * - * Delete an action control template by providing the action control template ID. This deletes all versions of this - * template. An action control template can't be deleted if any version of the template is assigned to one or more - * child accounts. You must remove the action control assignments first. - * - * @param deleteActionControlTemplateOptions the {@link DeleteActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteActionControlTemplate(DeleteActionControlTemplateOptions deleteActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlTemplateOptions, - "deleteActionControlTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", deleteActionControlTemplateOptions.actionControlTemplateId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a new action control template version. - * - * Create a new version of an action control template. Use this if you need to make updates to an action control - * template that is committed. - * - * @param createActionControlTemplateVersionOptions the {@link CreateActionControlTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall createActionControlTemplateVersion(CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateVersionOptions, - "createActionControlTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", createActionControlTemplateVersionOptions.actionControlTemplateId()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - final JsonObject contentJson = new JsonObject(); - if (createActionControlTemplateVersionOptions.name() != null) { - contentJson.addProperty("name", createActionControlTemplateVersionOptions.name()); - } - if (createActionControlTemplateVersionOptions.description() != null) { - contentJson.addProperty("description", createActionControlTemplateVersionOptions.description()); - } - if (createActionControlTemplateVersionOptions.actionControl() != null) { - contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateVersionOptions.actionControl())); - } - if (createActionControlTemplateVersionOptions.committed() != null) { - contentJson.addProperty("committed", createActionControlTemplateVersionOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve action control template versions. - * - * Retrieve the versions of an action control template by providing an action control template ID. - * - * @param listActionControlTemplateVersionsOptions the {@link ListActionControlTemplateVersionsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplateVersionsCollection} - */ - public ServiceCall listActionControlTemplateVersions(ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlTemplateVersionsOptions, - "listActionControlTemplateVersionsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", listActionControlTemplateVersionsOptions.actionControlTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlTemplateVersions"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listActionControlTemplateVersionsOptions.state() != null) { - builder.query("state", String.valueOf(listActionControlTemplateVersionsOptions.state())); - } - if (listActionControlTemplateVersionsOptions.limit() != null) { - builder.query("limit", String.valueOf(listActionControlTemplateVersionsOptions.limit())); - } - if (listActionControlTemplateVersionsOptions.start() != null) { - builder.query("start", String.valueOf(listActionControlTemplateVersionsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update an action control template version. - * - * Update a specific version of an action control template. You can use this only if the version isn't committed. - * - * @param replaceActionControlTemplateOptions the {@link ReplaceActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall replaceActionControlTemplate(ReplaceActionControlTemplateOptions replaceActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceActionControlTemplateOptions, - "replaceActionControlTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", replaceActionControlTemplateOptions.actionControlTemplateId()); - pathParamsMap.put("version", replaceActionControlTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replaceActionControlTemplateOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - if (replaceActionControlTemplateOptions.name() != null) { - contentJson.addProperty("name", replaceActionControlTemplateOptions.name()); - } - if (replaceActionControlTemplateOptions.description() != null) { - contentJson.addProperty("description", replaceActionControlTemplateOptions.description()); - } - if (replaceActionControlTemplateOptions.actionControl() != null) { - contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceActionControlTemplateOptions.actionControl())); - } - if (replaceActionControlTemplateOptions.committed() != null) { - contentJson.addProperty("committed", replaceActionControlTemplateOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete an action control template version. - * - * Delete a specific version of an action control template by providing an action control template ID and version - * number. You can't delete an action control template version that is assigned to one or more child accounts. You - * must remove the action control assignments first. - * - * @param deleteActionControlTemplateVersionOptions the {@link DeleteActionControlTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteActionControlTemplateVersion(DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlTemplateVersionOptions, - "deleteActionControlTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", deleteActionControlTemplateVersionOptions.actionControlTemplateId()); - pathParamsMap.put("version", deleteActionControlTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve an action control template version. - * - * Retrieve an action control template by providing an action control template ID and version number. - * - * @param getActionControlTemplateVersionOptions the {@link GetActionControlTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall getActionControlTemplateVersion(GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlTemplateVersionOptions, - "getActionControlTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", getActionControlTemplateVersionOptions.actionControlTemplateId()); - pathParamsMap.put("version", getActionControlTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlTemplateVersion"); - 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); - } - - /** - * Commit an action control template version. - * - * Commit an action control template version. You cannot make any further changes to the action control template once - * it's committed. If you have to make updates after committing a version, create a new version. - * - * @param commitActionControlTemplateOptions the {@link CommitActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall commitActionControlTemplate(CommitActionControlTemplateOptions commitActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(commitActionControlTemplateOptions, - "commitActionControlTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", commitActionControlTemplateOptions.actionControlTemplateId()); - pathParamsMap.put("version", commitActionControlTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}/commit", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get action control template assignments. - * - * Get action control template assignments by attributes. The following attributes are supported: - * `account_id`, `template_id`, `template_version`, `sort`. - * `account_id` is a required query parameter. Only action control template assignments with the specified attributes - * and accessible by the caller are returned. If the caller does not have read access to any action control template - * assignments, an empty array is returned. - * - * @param listActionControlAssignmentsOptions the {@link ListActionControlAssignmentsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignmentCollection} - */ - public ServiceCall listActionControlAssignments(ListActionControlAssignmentsOptions listActionControlAssignmentsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlAssignmentsOptions, - "listActionControlAssignmentsOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlAssignments"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listActionControlAssignmentsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listActionControlAssignmentsOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listActionControlAssignmentsOptions.accountId())); - if (listActionControlAssignmentsOptions.templateId() != null) { - builder.query("template_id", String.valueOf(listActionControlAssignmentsOptions.templateId())); - } - if (listActionControlAssignmentsOptions.templateVersion() != null) { - builder.query("template_version", String.valueOf(listActionControlAssignmentsOptions.templateVersion())); - } - if (listActionControlAssignmentsOptions.limit() != null) { - builder.query("limit", String.valueOf(listActionControlAssignmentsOptions.limit())); - } - if (listActionControlAssignmentsOptions.start() != null) { - builder.query("start", String.valueOf(listActionControlAssignmentsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create an action control template assignment. - * - * Assign an action control template to child accounts and account groups. This creates the action control in the - * accounts and account groups that you specify. - * - * @param createActionControlTemplateAssignmentOptions the {@link CreateActionControlTemplateAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignmentCollection} - */ - public ServiceCall createActionControlTemplateAssignment(CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateAssignmentOptions, - "createActionControlTemplateAssignmentOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplateAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createActionControlTemplateAssignmentOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createActionControlTemplateAssignmentOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateAssignmentOptions.target())); - contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateAssignmentOptions.templates())); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve an action control assignment. - * - * Retrieve an action control template assignment by providing an action control assignment ID. - * - * @param getActionControlAssignmentOptions the {@link GetActionControlAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignment} - */ - public ServiceCall getActionControlAssignment(GetActionControlAssignmentOptions getActionControlAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlAssignmentOptions, - "getActionControlAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", getActionControlAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlAssignment"); - 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 an action control assignment. - * - * Update an action control assignment by providing an action control assignment ID. - * - * @param updateActionControlAssignmentOptions the {@link UpdateActionControlAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignment} - */ - public ServiceCall updateActionControlAssignment(UpdateActionControlAssignmentOptions updateActionControlAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateActionControlAssignmentOptions, - "updateActionControlAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", updateActionControlAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateActionControlAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updateActionControlAssignmentOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("template_version", updateActionControlAssignmentOptions.templateVersion()); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Remove an action control assignment. - * - * Remove an action control template assignment by providing an action control assignment ID. You can't delete an - * action control assignment if the status is "in_progress". - * - * @param deleteActionControlAssignmentOptions the {@link DeleteActionControlAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteActionControlAssignment(DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlAssignmentOptions, - "deleteActionControlAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", deleteActionControlAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List role templates by attributes. - * - * List role templates and filter by attributes by using query parameters. The following attributes are supported: - * `account_id`, `name`, `role_name`, `role_service_name`, `state`, `limit`, `start`. - * `account_id` is a required query parameter. Only role templates that have the specified attributes and that the - * caller has read access to are returned. If the caller does not have read access to any role templates an empty - * array is returned. - * - * @param listRoleTemplatesOptions the {@link ListRoleTemplatesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplateCollection} - */ - public ServiceCall listRoleTemplates(ListRoleTemplatesOptions listRoleTemplatesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleTemplatesOptions, - "listRoleTemplatesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleTemplates"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listRoleTemplatesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listRoleTemplatesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listRoleTemplatesOptions.accountId())); - if (listRoleTemplatesOptions.name() != null) { - builder.query("name", String.valueOf(listRoleTemplatesOptions.name())); - } - if (listRoleTemplatesOptions.roleName() != null) { - builder.query("role_name", String.valueOf(listRoleTemplatesOptions.roleName())); - } - if (listRoleTemplatesOptions.roleServiceName() != null) { - builder.query("role_service_name", String.valueOf(listRoleTemplatesOptions.roleServiceName())); - } - if (listRoleTemplatesOptions.state() != null) { - builder.query("state", String.valueOf(listRoleTemplatesOptions.state())); - } - if (listRoleTemplatesOptions.limit() != null) { - builder.query("limit", String.valueOf(listRoleTemplatesOptions.limit())); - } - if (listRoleTemplatesOptions.start() != null) { - builder.query("start", String.valueOf(listRoleTemplatesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create role template. - * - * Create a role template. Role templates define roles from an existing system or service defined role. - * - * @param createRoleTemplateOptions the {@link CreateRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall createRoleTemplate(CreateRoleTemplateOptions createRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateOptions, - "createRoleTemplateOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createRoleTemplateOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createRoleTemplateOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("name", createRoleTemplateOptions.name()); - contentJson.addProperty("account_id", createRoleTemplateOptions.accountId()); - if (createRoleTemplateOptions.description() != null) { - contentJson.addProperty("description", createRoleTemplateOptions.description()); - } - if (createRoleTemplateOptions.committed() != null) { - contentJson.addProperty("committed", createRoleTemplateOptions.committed()); - } - if (createRoleTemplateOptions.role() != null) { - contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateOptions.role())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve the latest version of a role template. - * - * Retrieve the latest version of a role template by providing a role template ID. - * - * @param getRoleTemplateOptions the {@link GetRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall getRoleTemplate(GetRoleTemplateOptions getRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleTemplateOptions, - "getRoleTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", getRoleTemplateOptions.roleTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getRoleTemplateOptions.state() != null) { - builder.query("state", String.valueOf(getRoleTemplateOptions.state())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a Role template. - * - * Delete a role template by providing the role template ID. This deletes all versions of this template. A role - * template can't be deleted if any version of the template is assigned to one or more child accounts. You must remove - * the role assignments first. - * - * @param deleteRoleTemplateOptions the {@link DeleteRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteRoleTemplate(DeleteRoleTemplateOptions deleteRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleTemplateOptions, - "deleteRoleTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", deleteRoleTemplateOptions.roleTemplateId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a new role template version. - * - * Create a new version of a role template. Use this if you need to make updates to a role template that is committed. - * - * @param createRoleTemplateVersionOptions the {@link CreateRoleTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall createRoleTemplateVersion(CreateRoleTemplateVersionOptions createRoleTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateVersionOptions, - "createRoleTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", createRoleTemplateVersionOptions.roleTemplateId()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - final JsonObject contentJson = new JsonObject(); - if (createRoleTemplateVersionOptions.name() != null) { - contentJson.addProperty("name", createRoleTemplateVersionOptions.name()); - } - if (createRoleTemplateVersionOptions.description() != null) { - contentJson.addProperty("description", createRoleTemplateVersionOptions.description()); - } - if (createRoleTemplateVersionOptions.role() != null) { - contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateVersionOptions.role())); - } - if (createRoleTemplateVersionOptions.committed() != null) { - contentJson.addProperty("committed", createRoleTemplateVersionOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve role template versions. - * - * Retrieve the versions of a role template by providing a role template ID. - * - * @param listRoleTemplateVersionsOptions the {@link ListRoleTemplateVersionsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplateVersionsCollection} - */ - public ServiceCall listRoleTemplateVersions(ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleTemplateVersionsOptions, - "listRoleTemplateVersionsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", listRoleTemplateVersionsOptions.roleTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleTemplateVersions"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listRoleTemplateVersionsOptions.state() != null) { - builder.query("state", String.valueOf(listRoleTemplateVersionsOptions.state())); - } - if (listRoleTemplateVersionsOptions.limit() != null) { - builder.query("limit", String.valueOf(listRoleTemplateVersionsOptions.limit())); - } - if (listRoleTemplateVersionsOptions.start() != null) { - builder.query("start", String.valueOf(listRoleTemplateVersionsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a role template version. - * - * Update a specific version of a role template. You can use this only if the version isn't committed. - * - * @param replaceRoleTemplateOptions the {@link ReplaceRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall replaceRoleTemplate(ReplaceRoleTemplateOptions replaceRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceRoleTemplateOptions, - "replaceRoleTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", replaceRoleTemplateOptions.roleTemplateId()); - pathParamsMap.put("version", replaceRoleTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replaceRoleTemplateOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - if (replaceRoleTemplateOptions.name() != null) { - contentJson.addProperty("name", replaceRoleTemplateOptions.name()); - } - if (replaceRoleTemplateOptions.description() != null) { - contentJson.addProperty("description", replaceRoleTemplateOptions.description()); - } - if (replaceRoleTemplateOptions.role() != null) { - contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRoleTemplateOptions.role())); - } - if (replaceRoleTemplateOptions.committed() != null) { - contentJson.addProperty("committed", replaceRoleTemplateOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a role template version. - * - * Delete a specific version of a role template by providing a role template ID and version number. You can't delete a - * role template version that is assigned to one or more child accounts. You must remove the role assignments first. - * - * @param deleteRoleTemplateVersionOptions the {@link DeleteRoleTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteRoleTemplateVersion(DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleTemplateVersionOptions, - "deleteRoleTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", deleteRoleTemplateVersionOptions.roleTemplateId()); - pathParamsMap.put("version", deleteRoleTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a role template version. - * - * Retrieve a role template by providing a role template ID and version number. - * - * @param getRoleTemplateVersionOptions the {@link GetRoleTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall getRoleTemplateVersion(GetRoleTemplateVersionOptions getRoleTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleTemplateVersionOptions, - "getRoleTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", getRoleTemplateVersionOptions.roleTemplateId()); - pathParamsMap.put("version", getRoleTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleTemplateVersion"); - 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); - } - - /** - * Commit a role template version. - * - * Commit a role template version. You cannot make any further changes to the role template once it's committed. If - * you have to make updates after committing a version, create a new version. - * - * @param commitRoleTemplateOptions the {@link CommitRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall commitRoleTemplate(CommitRoleTemplateOptions commitRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(commitRoleTemplateOptions, - "commitRoleTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", commitRoleTemplateOptions.roleTemplateId()); - pathParamsMap.put("version", commitRoleTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}/commit", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get role template assignments. - * - * Get role template assignments by attributes. The following attributes are supported: - * `account_id`, `template_id`, `template_version`, `target`, `target_type`, `limit`, `start`. - * `account_id` is a required query parameter. Only role template assignments with the specified attributes and - * accessible by the caller are returned. If the caller does not have read access to any role template assignments, an - * empty array is returned. - * - * @param listRoleAssignmentsOptions the {@link ListRoleAssignmentsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleAssignmentCollection} - */ - public ServiceCall listRoleAssignments(ListRoleAssignmentsOptions listRoleAssignmentsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleAssignmentsOptions, - "listRoleAssignmentsOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleAssignments"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listRoleAssignmentsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listRoleAssignmentsOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listRoleAssignmentsOptions.accountId())); - if (listRoleAssignmentsOptions.templateId() != null) { - builder.query("template_id", String.valueOf(listRoleAssignmentsOptions.templateId())); - } - if (listRoleAssignmentsOptions.templateVersion() != null) { - builder.query("template_version", String.valueOf(listRoleAssignmentsOptions.templateVersion())); - } - if (listRoleAssignmentsOptions.limit() != null) { - builder.query("limit", String.valueOf(listRoleAssignmentsOptions.limit())); - } - if (listRoleAssignmentsOptions.start() != null) { - builder.query("start", String.valueOf(listRoleAssignmentsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a role template assignment. - * - * Assign a role template to child accounts and account groups. This creates the role in the accounts and account - * groups that you specify. - * - * @param createRoleTemplateAssignmentOptions the {@link CreateRoleTemplateAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleAssignmentCollection} - */ - public ServiceCall createRoleTemplateAssignment(CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateAssignmentOptions, - "createRoleTemplateAssignmentOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplateAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createRoleTemplateAssignmentOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createRoleTemplateAssignmentOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateAssignmentOptions.target())); - contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateAssignmentOptions.templates())); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a role assignment. - * - * Retrieve a role template assignment by providing a role assignment ID. - * - * @param getRoleAssignmentOptions the {@link GetRoleAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleAssignment} - */ - public ServiceCall getRoleAssignment(GetRoleAssignmentOptions getRoleAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleAssignmentOptions, - "getRoleAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", getRoleAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleAssignment"); - 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 a role assignment. - * - * Update a role assignment by providing a role assignment ID. - * - * @param updateRoleAssignmentOptions the {@link UpdateRoleAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleAssignment} - */ - public ServiceCall updateRoleAssignment(UpdateRoleAssignmentOptions updateRoleAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateRoleAssignmentOptions, - "updateRoleAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", updateRoleAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateRoleAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updateRoleAssignmentOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("template_version", updateRoleAssignmentOptions.templateVersion()); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Remove a role assignment. - * - * Remove a role template assignment by providing a role assignment ID. You can't delete a role assignment if the - * status is "in_progress". - * - * @param deleteRoleAssignmentOptions the {@link DeleteRoleAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteRoleAssignment(DeleteRoleAssignmentOptions deleteRoleAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleAssignmentOptions, - "deleteRoleAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", deleteRoleAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java deleted file mode 100644 index af82ea2abe8..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The Access Management Account Settings that are currently set for the requested account. - */ -public class AccountSettingsAccessManagement extends GenericModel { - - @SerializedName("external_account_identity_interaction") - protected ExternalAccountIdentityInteraction externalAccountIdentityInteraction; - - protected AccountSettingsAccessManagement() { } - - /** - * Gets the externalAccountIdentityInteraction. - * - * How external accounts can interact in relation to the requested account. - * - * @return the externalAccountIdentityInteraction - */ - public ExternalAccountIdentityInteraction getExternalAccountIdentityInteraction() { - return externalAccountIdentityInteraction; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java deleted file mode 100644 index ea230f57263..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the assigned action control template. - */ -public class ActionControlAssignment extends GenericModel { - - /** - * The current operation of the action control assignment. - */ - public interface Operation { - /** create. */ - String CREATE = "create"; - /** apply. */ - String APPLY = "apply"; - /** update. */ - String UPDATE = "update"; - /** remove. */ - String REMOVE = "remove"; - } - - /** - * The action control assignment status. - */ - public interface Status { - /** accepted. */ - String ACCEPTED = "accepted"; - /** failure. */ - String FAILURE = "failure"; - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** superseded. */ - String SUPERSEDED = "superseded"; - } - - protected String id; - @SerializedName("account_id") - protected String accountId; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String operation; - protected List resources; - protected ActionControlAssignmentTemplate template; - protected AssignmentTargetDetails target; - protected String status; - - protected ActionControlAssignment() { } - - /** - * Gets the id. - * - * Action control assignment ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the accountId. - * - * The account GUID that the action control assignments belong to. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the href. - * - * The href URL that links to the action control assignments API by action control assignment ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the action control assignment was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the action control assignment. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the action control assignment was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the action control assignment. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the operation. - * - * The current operation of the action control assignment. - * - * @return the operation - */ - public String getOperation() { - return operation; - } - - /** - * Gets the resources. - * - * Resources created when action control template is assigned. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the template. - * - * The action control template id and version that will be assigned. - * - * @return the template - */ - public ActionControlAssignmentTemplate getTemplate() { - return template; - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the status. - * - * The action control assignment status. - * - * @return the status - */ - public String getStatus() { - return status; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java deleted file mode 100644 index a9d6b28ce39..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of action control assignments. - */ -public class ActionControlAssignmentCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List assignments; - - protected ActionControlAssignmentCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the assignments. - * - * List of action control assignments. - * - * @return the assignments - */ - public List getAssignments() { - return assignments; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java deleted file mode 100644 index 122d3c8277b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The action control assignment resources and target where the template is assigned. - */ -public class ActionControlAssignmentResource extends GenericModel { - - protected AssignmentTargetDetails target; - @SerializedName("action_control") - protected ActionControlAssignmentResourceActionControl actionControl; - - protected ActionControlAssignmentResource() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the actionControl. - * - * Set of properties of the assigned resource or error message if assignment failed. - * - * @return the actionControl - */ - public ActionControlAssignmentResourceActionControl getActionControl() { - return actionControl; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java deleted file mode 100644 index 0e5550eb4da..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Set of properties of the assigned resource or error message if assignment failed. - */ -public class ActionControlAssignmentResourceActionControl extends GenericModel { - - @SerializedName("resource_created") - protected ActionControlAssignmentResourceCreated resourceCreated; - @SerializedName("error_message") - protected AssignmentResourceError errorMessage; - - protected ActionControlAssignmentResourceActionControl() { } - - /** - * Gets the resourceCreated. - * - * On success, it includes the action control assigned. - * - * @return the resourceCreated - */ - public ActionControlAssignmentResourceCreated getResourceCreated() { - return resourceCreated; - } - - /** - * Gets the errorMessage. - * - * Body parameters for assignment error. - * - * @return the errorMessage - */ - public AssignmentResourceError getErrorMessage() { - return errorMessage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java deleted file mode 100644 index 6ecbd23392a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * On success, it includes the action control assigned. - */ -public class ActionControlAssignmentResourceCreated extends GenericModel { - - protected String id; - - protected ActionControlAssignmentResourceCreated() { } - - /** - * Gets the id. - * - * action control id. - * - * @return the id - */ - public String getId() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java deleted file mode 100644 index 4e6d2543e18..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The action control template id and version that will be assigned. - */ -public class ActionControlAssignmentTemplate extends GenericModel { - - protected String id; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String version; - - /** - * Instantiates a new Builder from an existing ActionControlAssignmentTemplate instance. - * - * @param actionControlAssignmentTemplate the instance to initialize the Builder with - */ - private Builder(ActionControlAssignmentTemplate actionControlAssignmentTemplate) { - this.id = actionControlAssignmentTemplate.id; - this.version = actionControlAssignmentTemplate.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param id the id - * @param version the version - */ - public Builder(String id, String version) { - this.id = id; - this.version = version; - } - - /** - * Builds a ActionControlAssignmentTemplate. - * - * @return the new ActionControlAssignmentTemplate instance - */ - public ActionControlAssignmentTemplate build() { - return new ActionControlAssignmentTemplate(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the ActionControlAssignmentTemplate builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the ActionControlAssignmentTemplate builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected ActionControlAssignmentTemplate() { } - - protected ActionControlAssignmentTemplate(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - id = builder.id; - version = builder.version; - } - - /** - * New builder. - * - * @return a ActionControlAssignmentTemplate builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * Action control template ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java deleted file mode 100644 index 78b6d56be6d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * ActionControlAssignmentsPager can be used to simplify the use of the "listActionControlAssignments" method. - */ -public class ActionControlAssignmentsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListActionControlAssignmentsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected ActionControlAssignmentsPager() { } - - /** - * Constructs a new ActionControlAssignmentsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlAssignments" method - * @param options the ListActionControlAssignmentsOptions instance to be used to invoke the "listActionControlAssignments" method - */ - public ActionControlAssignmentsPager(IamPolicyManagement client, ListActionControlAssignmentsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<ActionControlAssignment> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListActionControlAssignmentsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - ActionControlAssignmentCollection result = client.listActionControlAssignments(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getAssignments(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<ActionControlAssignment> containing all results returned by the "listActionControlAssignments" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java deleted file mode 100644 index 157c9f6a390..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the action control template. - */ -public class ActionControlTemplate extends GenericModel { - - /** - * State of action control template. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String name; - protected String description; - @SerializedName("account_id") - protected String accountId; - protected Boolean committed; - @SerializedName("action_control") - protected TemplateActionControl actionControl; - protected String id; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String version; - protected String state; - - protected ActionControlTemplate() { } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the description. - * - * Description of the action control template. This is shown to users in the enterprise account. Use this to describe - * the purpose or context of the action control for enterprise users managing IAM templates. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the committed. - * - * Committed status of the template. If committed is set to true, then the template version can no longer be updated. - * - * @return the committed - */ - public Boolean isCommitted() { - return committed; - } - - /** - * Gets the actionControl. - * - * The action control properties that are created in an action resource when the template is assigned. - * - * @return the actionControl - */ - public TemplateActionControl getActionControl() { - return actionControl; - } - - /** - * Gets the id. - * - * The action control template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the action control templates API by action control template ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the action control template was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the action control template. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the action control template was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the action control template. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the version. - * - * The version number of the template used to identify different versions of same template. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the state. - * - * State of action control template. - * - * @return the state - */ - public String getState() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java deleted file mode 100644 index e7536d2c9ae..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of action control templates. - */ -public class ActionControlTemplateCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - @SerializedName("action_control_templates") - protected List actionControlTemplates; - - protected ActionControlTemplateCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the actionControlTemplates. - * - * List of action control templates. - * - * @return the actionControlTemplates - */ - public List getActionControlTemplates() { - return actionControlTemplates; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java deleted file mode 100644 index 5e26f45cf46..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of versions for a specific action control template. - */ -public class ActionControlTemplateVersionsCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List versions; - - protected ActionControlTemplateVersionsCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the versions. - * - * List of action control templates versions. - * - * @return the versions - */ - public List getVersions() { - return versions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java deleted file mode 100644 index 660aefe11ba..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * ActionControlTemplateVersionsPager can be used to simplify the use of the "listActionControlTemplateVersions" method. - */ -public class ActionControlTemplateVersionsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListActionControlTemplateVersionsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected ActionControlTemplateVersionsPager() { } - - /** - * Constructs a new ActionControlTemplateVersionsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlTemplateVersions" method - * @param options the ListActionControlTemplateVersionsOptions instance to be used to invoke the "listActionControlTemplateVersions" method - */ - public ActionControlTemplateVersionsPager(IamPolicyManagement client, ListActionControlTemplateVersionsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<ActionControlTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListActionControlTemplateVersionsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - ActionControlTemplateVersionsCollection result = client.listActionControlTemplateVersions(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getVersions(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<ActionControlTemplate> containing all results returned by the "listActionControlTemplateVersions" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java deleted file mode 100644 index bd326c8d7ec..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * ActionControlTemplatesPager can be used to simplify the use of the "listActionControlTemplates" method. - */ -public class ActionControlTemplatesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListActionControlTemplatesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected ActionControlTemplatesPager() { } - - /** - * Constructs a new ActionControlTemplatesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlTemplates" method - * @param options the ListActionControlTemplatesOptions instance to be used to invoke the "listActionControlTemplates" method - */ - public ActionControlTemplatesPager(IamPolicyManagement client, ListActionControlTemplatesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<ActionControlTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListActionControlTemplatesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - ActionControlTemplateCollection result = client.listActionControlTemplates(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getActionControlTemplates(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<ActionControlTemplate> containing all results returned by the "listActionControlTemplates" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java deleted file mode 100644 index c454c7a3ef5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * On success, includes the policy that is assigned. - */ -public class AssignmentResourceCreated extends GenericModel { - - protected String id; - - protected AssignmentResourceCreated() { } - - /** - * Gets the id. - * - * Policy id. - * - * @return the id - */ - public String getId() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java deleted file mode 100644 index e74dbe58b3a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Body parameters for assignment error. - */ -public class AssignmentResourceError extends GenericModel { - - protected String name; - protected String errorCode; - protected String message; - protected String code; - protected List errors; - - protected AssignmentResourceError() { } - - /** - * Gets the name. - * - * Name of the error. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the errorCode. - * - * error code. - * - * @return the errorCode - */ - public String getErrorCode() { - return errorCode; - } - - /** - * Gets the message. - * - * Error message detailing the nature of the error. - * - * @return the message - */ - public String getMessage() { - return message; - } - - /** - * Gets the code. - * - * Internal status code for the error. - * - * @return the code - */ - public String getCode() { - return code; - } - - /** - * Gets the errors. - * - * The errors encountered during the response. - * - * @return the errors - */ - public List getErrors() { - return errors; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java deleted file mode 100644 index 893d528604c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * assignment target account and type. - */ -public class AssignmentTargetDetails extends GenericModel { - - /** - * Assignment target type. - */ - public interface Type { - /** Account. */ - String ACCOUNT = "Account"; - } - - protected String type; - protected String id; - - /** - * Builder. - */ - public static class Builder { - private String type; - private String id; - - /** - * Instantiates a new Builder from an existing AssignmentTargetDetails instance. - * - * @param assignmentTargetDetails the instance to initialize the Builder with - */ - private Builder(AssignmentTargetDetails assignmentTargetDetails) { - this.type = assignmentTargetDetails.type; - this.id = assignmentTargetDetails.id; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param type the type - * @param id the id - */ - public Builder(String type, String id) { - this.type = type; - this.id = id; - } - - /** - * Builds a AssignmentTargetDetails. - * - * @return the new AssignmentTargetDetails instance - */ - public AssignmentTargetDetails build() { - return new AssignmentTargetDetails(this); - } - - /** - * Set the type. - * - * @param type the type - * @return the AssignmentTargetDetails builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the id. - * - * @param id the id - * @return the AssignmentTargetDetails builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - } - - protected AssignmentTargetDetails() { } - - protected AssignmentTargetDetails(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - type = builder.type; - id = builder.id; - } - - /** - * New builder. - * - * @return a AssignmentTargetDetails builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the type. - * - * Assignment target type. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the id. - * - * ID of the target account. - * - * @return the id - */ - public String id() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java deleted file mode 100644 index b8025e305a9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * policy template details. - */ -public class AssignmentTemplateDetails extends GenericModel { - - protected String id; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String version; - - /** - * Instantiates a new Builder from an existing AssignmentTemplateDetails instance. - * - * @param assignmentTemplateDetails the instance to initialize the Builder with - */ - private Builder(AssignmentTemplateDetails assignmentTemplateDetails) { - this.id = assignmentTemplateDetails.id; - this.version = assignmentTemplateDetails.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a AssignmentTemplateDetails. - * - * @return the new AssignmentTemplateDetails instance - */ - public AssignmentTemplateDetails build() { - return new AssignmentTemplateDetails(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the AssignmentTemplateDetails builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the AssignmentTemplateDetails builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected AssignmentTemplateDetails() { } - - protected AssignmentTemplateDetails(Builder builder) { - id = builder.id; - version = builder.version; - } - - /** - * New builder. - * - * @return a AssignmentTemplateDetails builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * Policy template ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the version. - * - * Policy template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java deleted file mode 100644 index 78291e6c2c5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The commitActionControlTemplate options. - */ -public class CommitActionControlTemplateOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing CommitActionControlTemplateOptions instance. - * - * @param commitActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(CommitActionControlTemplateOptions commitActionControlTemplateOptions) { - this.actionControlTemplateId = commitActionControlTemplateOptions.actionControlTemplateId; - this.version = commitActionControlTemplateOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - * @param version the version - */ - public Builder(String actionControlTemplateId, String version) { - this.actionControlTemplateId = actionControlTemplateId; - this.version = version; - } - - /** - * Builds a CommitActionControlTemplateOptions. - * - * @return the new CommitActionControlTemplateOptions instance - */ - public CommitActionControlTemplateOptions build() { - return new CommitActionControlTemplateOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the CommitActionControlTemplateOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the CommitActionControlTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected CommitActionControlTemplateOptions() { } - - protected CommitActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a CommitActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the version. - * - * The action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java deleted file mode 100644 index 61283194c44..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The commitPolicyTemplate options. - */ -public class CommitPolicyTemplateOptions extends GenericModel { - - protected String policyTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing CommitPolicyTemplateOptions instance. - * - * @param commitPolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(CommitPolicyTemplateOptions commitPolicyTemplateOptions) { - this.policyTemplateId = commitPolicyTemplateOptions.policyTemplateId; - this.version = commitPolicyTemplateOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param version the version - */ - public Builder(String policyTemplateId, String version) { - this.policyTemplateId = policyTemplateId; - this.version = version; - } - - /** - * Builds a CommitPolicyTemplateOptions. - * - * @return the new CommitPolicyTemplateOptions instance - */ - public CommitPolicyTemplateOptions build() { - return new CommitPolicyTemplateOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the CommitPolicyTemplateOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the CommitPolicyTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected CommitPolicyTemplateOptions() { } - - protected CommitPolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - policyTemplateId = builder.policyTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a CommitPolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the version. - * - * The policy template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java deleted file mode 100644 index 7e93c92fb0b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The commitRoleTemplate options. - */ -public class CommitRoleTemplateOptions extends GenericModel { - - protected String roleTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing CommitRoleTemplateOptions instance. - * - * @param commitRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(CommitRoleTemplateOptions commitRoleTemplateOptions) { - this.roleTemplateId = commitRoleTemplateOptions.roleTemplateId; - this.version = commitRoleTemplateOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - * @param version the version - */ - public Builder(String roleTemplateId, String version) { - this.roleTemplateId = roleTemplateId; - this.version = version; - } - - /** - * Builds a CommitRoleTemplateOptions. - * - * @return the new CommitRoleTemplateOptions instance - */ - public CommitRoleTemplateOptions build() { - return new CommitRoleTemplateOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the CommitRoleTemplateOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the CommitRoleTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected CommitRoleTemplateOptions() { } - - protected CommitRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - roleTemplateId = builder.roleTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a CommitRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the version. - * - * The role template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java deleted file mode 100644 index be0c3d0aa98..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Details of conflicting resource. - */ -public class ConflictsWith extends GenericModel { - - protected String etag; - protected String role; - protected String policy; - - protected ConflictsWith() { } - - /** - * Gets the etag. - * - * The revision number of the resource. - * - * @return the etag - */ - public String getEtag() { - return etag; - } - - /** - * Gets the role. - * - * The conflicting role of ID. - * - * @return the role - */ - public String getRole() { - return role; - } - - /** - * Gets the policy. - * - * The conflicting policy ID. - * - * @return the policy - */ - public String getPolicy() { - return policy; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java deleted file mode 100644 index 15e502ac214..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Specifies the type of access that is granted by the policy. - */ -public class Control extends GenericModel { - - protected Grant grant; - - /** - * Builder. - */ - public static class Builder { - private Grant grant; - - /** - * Instantiates a new Builder from an existing Control instance. - * - * @param control the instance to initialize the Builder with - */ - private Builder(Control control) { - this.grant = control.grant; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param grant the grant - */ - public Builder(Grant grant) { - this.grant = grant; - } - - /** - * Builds a Control. - * - * @return the new Control instance - */ - public Control build() { - return new Control(this); - } - - /** - * Set the grant. - * - * @param grant the grant - * @return the Control builder - */ - public Builder grant(Grant grant) { - this.grant = grant; - return this; - } - } - - protected Control() { } - - protected Control(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.grant, - "grant cannot be null"); - grant = builder.grant; - } - - /** - * New builder. - * - * @return a Control builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the grant. - * - * Permission is granted by the policy. - * - * @return the grant - */ - public Grant grant() { - return grant; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java deleted file mode 100644 index 5055d290c80..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * ControlResponse. - * - * Classes which extend this class: - * - ControlResponseControl - * - ControlResponseControlWithEnrichedRoles - */ -public class ControlResponse extends GenericModel { - - protected Grant grant; - - protected ControlResponse() { } - - /** - * Gets the grant. - * - * Permission is granted by the policy. - * - * @return the grant - */ - public Grant getGrant() { - return grant; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java deleted file mode 100644 index 5934ebf7c76..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * Specifies the type of access that is granted by the policy. - */ -public class ControlResponseControl extends ControlResponse { - - - protected ControlResponseControl() { } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java deleted file mode 100644 index 8b3c73d73c0..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * Specifies the type of access that is granted by the policy with additional role information. - */ -public class ControlResponseControlWithEnrichedRoles extends ControlResponse { - - - protected ControlResponseControlWithEnrichedRoles() { } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java deleted file mode 100644 index 1ccd3f8b4dd..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createActionControlTemplateAssignment options. - */ -public class CreateActionControlTemplateAssignmentOptions extends GenericModel { - - protected AssignmentTargetDetails target; - protected List templates; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private AssignmentTargetDetails target; - private List templates; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateActionControlTemplateAssignmentOptions instance. - * - * @param createActionControlTemplateAssignmentOptions the instance to initialize the Builder with - */ - private Builder(CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptions) { - this.target = createActionControlTemplateAssignmentOptions.target; - this.templates = createActionControlTemplateAssignmentOptions.templates; - this.acceptLanguage = createActionControlTemplateAssignmentOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param target the target - * @param templates the templates - */ - public Builder(AssignmentTargetDetails target, List templates) { - this.target = target; - this.templates = templates; - } - - /** - * Builds a CreateActionControlTemplateAssignmentOptions. - * - * @return the new CreateActionControlTemplateAssignmentOptions instance - */ - public CreateActionControlTemplateAssignmentOptions build() { - return new CreateActionControlTemplateAssignmentOptions(this); - } - - /** - * Adds a new element to templates. - * - * @param templates the new element to be added - * @return the CreateActionControlTemplateAssignmentOptions builder - */ - public Builder addTemplates(ActionControlAssignmentTemplate templates) { - com.ibm.cloud.sdk.core.util.Validator.notNull(templates, - "templates cannot be null"); - if (this.templates == null) { - this.templates = new ArrayList(); - } - this.templates.add(templates); - return this; - } - - /** - * Set the target. - * - * @param target the target - * @return the CreateActionControlTemplateAssignmentOptions builder - */ - public Builder target(AssignmentTargetDetails target) { - this.target = target; - return this; - } - - /** - * Set the templates. - * Existing templates will be replaced. - * - * @param templates the templates - * @return the CreateActionControlTemplateAssignmentOptions builder - */ - public Builder templates(List templates) { - this.templates = templates; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateActionControlTemplateAssignmentOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateActionControlTemplateAssignmentOptions() { } - - protected CreateActionControlTemplateAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, - "target cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, - "templates cannot be null"); - target = builder.target; - templates = builder.templates; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateActionControlTemplateAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails target() { - return target; - } - - /** - * Gets the templates. - * - * List of action control template details for action control assignment. - * - * @return the templates - */ - public List templates() { - return templates; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java deleted file mode 100644 index 37594a7a440..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createActionControlTemplate options. - */ -public class CreateActionControlTemplateOptions extends GenericModel { - - protected String name; - protected String accountId; - protected String description; - protected Boolean committed; - protected TemplateActionControl actionControl; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String accountId; - private String description; - private Boolean committed; - private TemplateActionControl actionControl; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateActionControlTemplateOptions instance. - * - * @param createActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(CreateActionControlTemplateOptions createActionControlTemplateOptions) { - this.name = createActionControlTemplateOptions.name; - this.accountId = createActionControlTemplateOptions.accountId; - this.description = createActionControlTemplateOptions.description; - this.committed = createActionControlTemplateOptions.committed; - this.actionControl = createActionControlTemplateOptions.actionControl; - this.acceptLanguage = createActionControlTemplateOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param accountId the accountId - */ - public Builder(String name, String accountId) { - this.name = name; - this.accountId = accountId; - } - - /** - * Builds a CreateActionControlTemplateOptions. - * - * @return the new CreateActionControlTemplateOptions instance - */ - public CreateActionControlTemplateOptions build() { - return new CreateActionControlTemplateOptions(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateActionControlTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the CreateActionControlTemplateOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateActionControlTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreateActionControlTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - - /** - * Set the actionControl. - * - * @param actionControl the actionControl - * @return the CreateActionControlTemplateOptions builder - */ - public Builder actionControl(TemplateActionControl actionControl) { - this.actionControl = actionControl; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateActionControlTemplateOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateActionControlTemplateOptions() { } - - protected CreateActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - name = builder.name; - accountId = builder.accountId; - description = builder.description; - committed = builder.committed; - actionControl = builder.actionControl; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the description. - * - * Description of the action control template. This is shown to users in the enterprise account. Use this to describe - * the purpose or context of the action control for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template. If committed is set to true, then the template version can no longer be updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } - - /** - * Gets the actionControl. - * - * The action control properties that are created in an action resource when the template is assigned. - * - * @return the actionControl - */ - public TemplateActionControl actionControl() { - return actionControl; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java deleted file mode 100644 index 13ce1a8e60f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createActionControlTemplateVersion options. - */ -public class CreateActionControlTemplateVersionOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String name; - protected String description; - protected TemplateActionControl actionControl; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String name; - private String description; - private TemplateActionControl actionControl; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing CreateActionControlTemplateVersionOptions instance. - * - * @param createActionControlTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptions) { - this.actionControlTemplateId = createActionControlTemplateVersionOptions.actionControlTemplateId; - this.name = createActionControlTemplateVersionOptions.name; - this.description = createActionControlTemplateVersionOptions.description; - this.actionControl = createActionControlTemplateVersionOptions.actionControl; - this.committed = createActionControlTemplateVersionOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - */ - public Builder(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - } - - /** - * Builds a CreateActionControlTemplateVersionOptions. - * - * @return the new CreateActionControlTemplateVersionOptions instance - */ - public CreateActionControlTemplateVersionOptions build() { - return new CreateActionControlTemplateVersionOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actionControl. - * - * @param actionControl the actionControl - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder actionControl(TemplateActionControl actionControl) { - this.actionControl = actionControl; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected CreateActionControlTemplateVersionOptions() { } - - protected CreateActionControlTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - name = builder.name; - description = builder.description; - actionControl = builder.actionControl; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a CreateActionControlTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * The action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will - * change the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the action control template. This is shown to users in the enterprise account. Use this to describe - * the purpose or context of the action control for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actionControl. - * - * The action control properties that are created in an action resource when the template is assigned. - * - * @return the actionControl - */ - public TemplateActionControl actionControl() { - return actionControl; - } - - /** - * Gets the committed. - * - * Committed status of the template version. If committed is set to true, then the template version can no longer be - * updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java deleted file mode 100644 index b6ec9f78c02..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java +++ /dev/null @@ -1,311 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createPolicy options. - */ -public class CreatePolicyOptions extends GenericModel { - - protected String type; - protected List subjects; - protected List roles; - protected List resources; - protected String description; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String type; - private List subjects; - private List roles; - private List resources; - private String description; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreatePolicyOptions instance. - * - * @param createPolicyOptions the instance to initialize the Builder with - */ - private Builder(CreatePolicyOptions createPolicyOptions) { - this.type = createPolicyOptions.type; - this.subjects = createPolicyOptions.subjects; - this.roles = createPolicyOptions.roles; - this.resources = createPolicyOptions.resources; - this.description = createPolicyOptions.description; - this.acceptLanguage = createPolicyOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param type the type - * @param subjects the subjects - * @param roles the roles - * @param resources the resources - */ - public Builder(String type, List subjects, List roles, List resources) { - this.type = type; - this.subjects = subjects; - this.roles = roles; - this.resources = resources; - } - - /** - * Builds a CreatePolicyOptions. - * - * @return the new CreatePolicyOptions instance - */ - public CreatePolicyOptions build() { - return new CreatePolicyOptions(this); - } - - /** - * Adds a new element to subjects. - * - * @param subjects the new element to be added - * @return the CreatePolicyOptions builder - */ - public Builder addSubjects(PolicySubject subjects) { - com.ibm.cloud.sdk.core.util.Validator.notNull(subjects, - "subjects cannot be null"); - if (this.subjects == null) { - this.subjects = new ArrayList(); - } - this.subjects.add(subjects); - return this; - } - - /** - * Adds a new element to roles. - * - * @param roles the new element to be added - * @return the CreatePolicyOptions builder - */ - public Builder addRoles(PolicyRole roles) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roles, - "roles cannot be null"); - if (this.roles == null) { - this.roles = new ArrayList(); - } - this.roles.add(roles); - return this; - } - - /** - * Adds a new element to resources. - * - * @param resources the new element to be added - * @return the CreatePolicyOptions builder - */ - public Builder addResources(PolicyResource resources) { - com.ibm.cloud.sdk.core.util.Validator.notNull(resources, - "resources cannot be null"); - if (this.resources == null) { - this.resources = new ArrayList(); - } - this.resources.add(resources); - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the CreatePolicyOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the subjects. - * Existing subjects will be replaced. - * - * @param subjects the subjects - * @return the CreatePolicyOptions builder - */ - public Builder subjects(List subjects) { - this.subjects = subjects; - return this; - } - - /** - * Set the roles. - * Existing roles will be replaced. - * - * @param roles the roles - * @return the CreatePolicyOptions builder - */ - public Builder roles(List roles) { - this.roles = roles; - return this; - } - - /** - * Set the resources. - * Existing resources will be replaced. - * - * @param resources the resources - * @return the CreatePolicyOptions builder - */ - public Builder resources(List resources) { - this.resources = resources; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreatePolicyOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreatePolicyOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreatePolicyOptions() { } - - protected CreatePolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subjects, - "subjects cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, - "roles cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resources, - "resources cannot be null"); - type = builder.type; - subjects = builder.subjects; - roles = builder.roles; - resources = builder.resources; - description = builder.description; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreatePolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the subjects. - * - * The subjects associated with a policy. - * - * @return the subjects - */ - public List subjects() { - return subjects; - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List roles() { - return roles; - } - - /** - * Gets the resources. - * - * The resources associated with a policy. - * - * @return the resources - */ - public List resources() { - return resources; - } - - /** - * Gets the description. - * - * Customer-defined description. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java deleted file mode 100644 index b71ca393f11..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createPolicyTemplateAssignment options. - */ -public class CreatePolicyTemplateAssignmentOptions extends GenericModel { - - protected String version; - protected AssignmentTargetDetails target; - protected List templates; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String version; - private AssignmentTargetDetails target; - private List templates; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreatePolicyTemplateAssignmentOptions instance. - * - * @param createPolicyTemplateAssignmentOptions the instance to initialize the Builder with - */ - private Builder(CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptions) { - this.version = createPolicyTemplateAssignmentOptions.version; - this.target = createPolicyTemplateAssignmentOptions.target; - this.templates = createPolicyTemplateAssignmentOptions.templates; - this.acceptLanguage = createPolicyTemplateAssignmentOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param version the version - * @param target the target - * @param templates the templates - */ - public Builder(String version, AssignmentTargetDetails target, List templates) { - this.version = version; - this.target = target; - this.templates = templates; - } - - /** - * Builds a CreatePolicyTemplateAssignmentOptions. - * - * @return the new CreatePolicyTemplateAssignmentOptions instance - */ - public CreatePolicyTemplateAssignmentOptions build() { - return new CreatePolicyTemplateAssignmentOptions(this); - } - - /** - * Adds a new element to templates. - * - * @param templates the new element to be added - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder addTemplates(AssignmentTemplateDetails templates) { - com.ibm.cloud.sdk.core.util.Validator.notNull(templates, - "templates cannot be null"); - if (this.templates == null) { - this.templates = new ArrayList(); - } - this.templates.add(templates); - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the target. - * - * @param target the target - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder target(AssignmentTargetDetails target) { - this.target = target; - return this; - } - - /** - * Set the templates. - * Existing templates will be replaced. - * - * @param templates the templates - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder templates(List templates) { - this.templates = templates; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreatePolicyTemplateAssignmentOptions() { } - - protected CreatePolicyTemplateAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, - "target cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, - "templates cannot be null"); - version = builder.version; - target = builder.target; - templates = builder.templates; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreatePolicyTemplateAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the version. - * - * specify version of response body format. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails target() { - return target; - } - - /** - * Gets the templates. - * - * List of template details for policy assignment. - * - * @return the templates - */ - public List templates() { - return templates; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java deleted file mode 100644 index 72944308428..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java +++ /dev/null @@ -1,255 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createPolicyTemplate options. - */ -public class CreatePolicyTemplateOptions extends GenericModel { - - protected String name; - protected String accountId; - protected TemplatePolicy policy; - protected String description; - protected Boolean committed; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String accountId; - private TemplatePolicy policy; - private String description; - private Boolean committed; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreatePolicyTemplateOptions instance. - * - * @param createPolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(CreatePolicyTemplateOptions createPolicyTemplateOptions) { - this.name = createPolicyTemplateOptions.name; - this.accountId = createPolicyTemplateOptions.accountId; - this.policy = createPolicyTemplateOptions.policy; - this.description = createPolicyTemplateOptions.description; - this.committed = createPolicyTemplateOptions.committed; - this.acceptLanguage = createPolicyTemplateOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param accountId the accountId - * @param policy the policy - */ - public Builder(String name, String accountId, TemplatePolicy policy) { - this.name = name; - this.accountId = accountId; - this.policy = policy; - } - - /** - * Builds a CreatePolicyTemplateOptions. - * - * @return the new CreatePolicyTemplateOptions instance - */ - public CreatePolicyTemplateOptions build() { - return new CreatePolicyTemplateOptions(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the CreatePolicyTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the CreatePolicyTemplateOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the policy. - * - * @param policy the policy - * @return the CreatePolicyTemplateOptions builder - */ - public Builder policy(TemplatePolicy policy) { - this.policy = policy; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreatePolicyTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreatePolicyTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreatePolicyTemplateOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreatePolicyTemplateOptions() { } - - protected CreatePolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.policy, - "policy cannot be null"); - name = builder.name; - accountId = builder.accountId; - policy = builder.policy; - description = builder.description; - committed = builder.committed; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreatePolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy policy() { - return policy; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java deleted file mode 100644 index 6903774c335..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createPolicyTemplateVersion options. - */ -public class CreatePolicyTemplateVersionOptions extends GenericModel { - - protected String policyTemplateId; - protected TemplatePolicy policy; - protected String name; - protected String description; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private TemplatePolicy policy; - private String name; - private String description; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing CreatePolicyTemplateVersionOptions instance. - * - * @param createPolicyTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptions) { - this.policyTemplateId = createPolicyTemplateVersionOptions.policyTemplateId; - this.policy = createPolicyTemplateVersionOptions.policy; - this.name = createPolicyTemplateVersionOptions.name; - this.description = createPolicyTemplateVersionOptions.description; - this.committed = createPolicyTemplateVersionOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param policy the policy - */ - public Builder(String policyTemplateId, TemplatePolicy policy) { - this.policyTemplateId = policyTemplateId; - this.policy = policy; - } - - /** - * Builds a CreatePolicyTemplateVersionOptions. - * - * @return the new CreatePolicyTemplateVersionOptions instance - */ - public CreatePolicyTemplateVersionOptions build() { - return new CreatePolicyTemplateVersionOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the policy. - * - * @param policy the policy - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder policy(TemplatePolicy policy) { - this.policy = policy; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected CreatePolicyTemplateVersionOptions() { } - - protected CreatePolicyTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.policy, - "policy cannot be null"); - policyTemplateId = builder.policyTemplateId; - policy = builder.policy; - name = builder.name; - description = builder.description; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a CreatePolicyTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy policy() { - return policy; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template version. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java deleted file mode 100644 index 725ec5d8a53..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java +++ /dev/null @@ -1,308 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createRole options. - */ -public class CreateRoleOptions extends GenericModel { - - protected String displayName; - protected List actions; - protected String name; - protected String accountId; - protected String serviceName; - protected String description; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String displayName; - private List actions; - private String name; - private String accountId; - private String serviceName; - private String description; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateRoleOptions instance. - * - * @param createRoleOptions the instance to initialize the Builder with - */ - private Builder(CreateRoleOptions createRoleOptions) { - this.displayName = createRoleOptions.displayName; - this.actions = createRoleOptions.actions; - this.name = createRoleOptions.name; - this.accountId = createRoleOptions.accountId; - this.serviceName = createRoleOptions.serviceName; - this.description = createRoleOptions.description; - this.acceptLanguage = createRoleOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param displayName the displayName - * @param actions the actions - * @param name the name - * @param accountId the accountId - * @param serviceName the serviceName - */ - public Builder(String displayName, List actions, String name, String accountId, String serviceName) { - this.displayName = displayName; - this.actions = actions; - this.name = name; - this.accountId = accountId; - this.serviceName = serviceName; - } - - /** - * Builds a CreateRoleOptions. - * - * @return the new CreateRoleOptions instance - */ - public CreateRoleOptions build() { - return new CreateRoleOptions(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the CreateRoleOptions builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the CreateRoleOptions builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the CreateRoleOptions builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateRoleOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the CreateRoleOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the CreateRoleOptions builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateRoleOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateRoleOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateRoleOptions() { } - - protected CreateRoleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, - "serviceName cannot be null"); - displayName = builder.displayName; - actions = builder.actions; - name = builder.name; - accountId = builder.accountId; - serviceName = builder.serviceName; - description = builder.description; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateRoleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List actions() { - return actions; - } - - /** - * Gets the name. - * - * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the accountId. - * - * The account GUID. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the serviceName. - * - * The service name. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java deleted file mode 100644 index c9bef88e703..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createRoleTemplateAssignment options. - */ -public class CreateRoleTemplateAssignmentOptions extends GenericModel { - - protected AssignmentTargetDetails target; - protected List templates; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private AssignmentTargetDetails target; - private List templates; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateRoleTemplateAssignmentOptions instance. - * - * @param createRoleTemplateAssignmentOptions the instance to initialize the Builder with - */ - private Builder(CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptions) { - this.target = createRoleTemplateAssignmentOptions.target; - this.templates = createRoleTemplateAssignmentOptions.templates; - this.acceptLanguage = createRoleTemplateAssignmentOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param target the target - * @param templates the templates - */ - public Builder(AssignmentTargetDetails target, List templates) { - this.target = target; - this.templates = templates; - } - - /** - * Builds a CreateRoleTemplateAssignmentOptions. - * - * @return the new CreateRoleTemplateAssignmentOptions instance - */ - public CreateRoleTemplateAssignmentOptions build() { - return new CreateRoleTemplateAssignmentOptions(this); - } - - /** - * Adds a new element to templates. - * - * @param templates the new element to be added - * @return the CreateRoleTemplateAssignmentOptions builder - */ - public Builder addTemplates(RoleAssignmentTemplate templates) { - com.ibm.cloud.sdk.core.util.Validator.notNull(templates, - "templates cannot be null"); - if (this.templates == null) { - this.templates = new ArrayList(); - } - this.templates.add(templates); - return this; - } - - /** - * Set the target. - * - * @param target the target - * @return the CreateRoleTemplateAssignmentOptions builder - */ - public Builder target(AssignmentTargetDetails target) { - this.target = target; - return this; - } - - /** - * Set the templates. - * Existing templates will be replaced. - * - * @param templates the templates - * @return the CreateRoleTemplateAssignmentOptions builder - */ - public Builder templates(List templates) { - this.templates = templates; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateRoleTemplateAssignmentOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateRoleTemplateAssignmentOptions() { } - - protected CreateRoleTemplateAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, - "target cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, - "templates cannot be null"); - target = builder.target; - templates = builder.templates; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateRoleTemplateAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails target() { - return target; - } - - /** - * Gets the templates. - * - * List of role template details for role assignment. - * - * @return the templates - */ - public List templates() { - return templates; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java deleted file mode 100644 index baf82e17961..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createRoleTemplate options. - */ -public class CreateRoleTemplateOptions extends GenericModel { - - protected String name; - protected String accountId; - protected String description; - protected Boolean committed; - protected RoleTemplatePrototypeRole role; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String accountId; - private String description; - private Boolean committed; - private RoleTemplatePrototypeRole role; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateRoleTemplateOptions instance. - * - * @param createRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(CreateRoleTemplateOptions createRoleTemplateOptions) { - this.name = createRoleTemplateOptions.name; - this.accountId = createRoleTemplateOptions.accountId; - this.description = createRoleTemplateOptions.description; - this.committed = createRoleTemplateOptions.committed; - this.role = createRoleTemplateOptions.role; - this.acceptLanguage = createRoleTemplateOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param accountId the accountId - */ - public Builder(String name, String accountId) { - this.name = name; - this.accountId = accountId; - } - - /** - * Builds a CreateRoleTemplateOptions. - * - * @return the new CreateRoleTemplateOptions instance - */ - public CreateRoleTemplateOptions build() { - return new CreateRoleTemplateOptions(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateRoleTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the CreateRoleTemplateOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateRoleTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreateRoleTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - - /** - * Set the role. - * - * @param role the role - * @return the CreateRoleTemplateOptions builder - */ - public Builder role(RoleTemplatePrototypeRole role) { - this.role = role; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateRoleTemplateOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateRoleTemplateOptions() { } - - protected CreateRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - name = builder.name; - accountId = builder.accountId; - description = builder.description; - committed = builder.committed; - role = builder.role; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the description. - * - * Description of the role template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the role for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template. If committed is set to true, then the template version can no longer be updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } - - /** - * Gets the role. - * - * The role properties that are created in an action resource when the template is assigned. - * - * @return the role - */ - public RoleTemplatePrototypeRole role() { - return role; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java deleted file mode 100644 index c322c5a332d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createRoleTemplateVersion options. - */ -public class CreateRoleTemplateVersionOptions extends GenericModel { - - protected String roleTemplateId; - protected String name; - protected String description; - protected TemplateRole role; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String name; - private String description; - private TemplateRole role; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing CreateRoleTemplateVersionOptions instance. - * - * @param createRoleTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(CreateRoleTemplateVersionOptions createRoleTemplateVersionOptions) { - this.roleTemplateId = createRoleTemplateVersionOptions.roleTemplateId; - this.name = createRoleTemplateVersionOptions.name; - this.description = createRoleTemplateVersionOptions.description; - this.role = createRoleTemplateVersionOptions.role; - this.committed = createRoleTemplateVersionOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - */ - public Builder(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - } - - /** - * Builds a CreateRoleTemplateVersionOptions. - * - * @return the new CreateRoleTemplateVersionOptions instance - */ - public CreateRoleTemplateVersionOptions build() { - return new CreateRoleTemplateVersionOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the role. - * - * @param role the role - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder role(TemplateRole role) { - this.role = role; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected CreateRoleTemplateVersionOptions() { } - - protected CreateRoleTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - roleTemplateId = builder.roleTemplateId; - name = builder.name; - description = builder.description; - role = builder.role; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a CreateRoleTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * The role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will - * change the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the role template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the role for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the role. - * - * The role properties that are created in an action resource when the template is assigned. - * - * @return the role - */ - public TemplateRole role() { - return role; - } - - /** - * Gets the committed. - * - * Committed status of the template version. If committed is set to true, then the template version can no longer be - * updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java deleted file mode 100644 index 59ccb4b908a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java +++ /dev/null @@ -1,312 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createV2Policy options. - */ -public class CreateV2PolicyOptions extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - protected Control control; - protected String type; - protected String description; - protected V2PolicySubject subject; - protected V2PolicyResource resource; - protected String pattern; - protected V2PolicyRule rule; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private Control control; - private String type; - private String description; - private V2PolicySubject subject; - private V2PolicyResource resource; - private String pattern; - private V2PolicyRule rule; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateV2PolicyOptions instance. - * - * @param createV2PolicyOptions the instance to initialize the Builder with - */ - private Builder(CreateV2PolicyOptions createV2PolicyOptions) { - this.control = createV2PolicyOptions.control; - this.type = createV2PolicyOptions.type; - this.description = createV2PolicyOptions.description; - this.subject = createV2PolicyOptions.subject; - this.resource = createV2PolicyOptions.resource; - this.pattern = createV2PolicyOptions.pattern; - this.rule = createV2PolicyOptions.rule; - this.acceptLanguage = createV2PolicyOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param control the control - * @param type the type - */ - public Builder(Control control, String type) { - this.control = control; - this.type = type; - } - - /** - * Builds a CreateV2PolicyOptions. - * - * @return the new CreateV2PolicyOptions instance - */ - public CreateV2PolicyOptions build() { - return new CreateV2PolicyOptions(this); - } - - /** - * Set the control. - * - * @param control the control - * @return the CreateV2PolicyOptions builder - */ - public Builder control(Control control) { - this.control = control; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the CreateV2PolicyOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateV2PolicyOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the subject. - * - * @param subject the subject - * @return the CreateV2PolicyOptions builder - */ - public Builder subject(V2PolicySubject subject) { - this.subject = subject; - return this; - } - - /** - * Set the resource. - * - * @param resource the resource - * @return the CreateV2PolicyOptions builder - */ - public Builder resource(V2PolicyResource resource) { - this.resource = resource; - return this; - } - - /** - * Set the pattern. - * - * @param pattern the pattern - * @return the CreateV2PolicyOptions builder - */ - public Builder pattern(String pattern) { - this.pattern = pattern; - return this; - } - - /** - * Set the rule. - * - * @param rule the rule - * @return the CreateV2PolicyOptions builder - */ - public Builder rule(V2PolicyRule rule) { - this.rule = rule; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateV2PolicyOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateV2PolicyOptions() { } - - protected CreateV2PolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.control, - "control cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - control = builder.control; - type = builder.type; - description = builder.description; - subject = builder.subject; - resource = builder.resource; - pattern = builder.pattern; - rule = builder.rule; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateV2PolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the control. - * - * Specifies the type of access that is granted by the policy. - * - * @return the control - */ - public Control control() { - return control; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject subject() { - return subject; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource resource() { - return resource; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String pattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule rule() { - return rule; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java deleted file mode 100644 index f5e35c13d9f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * An additional set of properties associated with a role. - */ -public class CustomRole extends GenericModel { - - protected String id; - @SerializedName("display_name") - protected String displayName; - protected String description; - protected List actions; - protected String crn; - protected String name; - @SerializedName("account_id") - protected String accountId; - @SerializedName("service_name") - protected String serviceName; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String href; - - protected CustomRole() { } - - /** - * Gets the id. - * - * The role ID. Composed of hexadecimal characters. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String getDisplayName() { - return displayName; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List getActions() { - return actions; - } - - /** - * Gets the crn. - * - * The role Cloud Resource Name (CRN). Example CRN: - * 'crn:v1:ibmcloud:public:iam-access-management::a/exampleAccountId::customRole:ExampleRoleName'. - * - * @return the crn - */ - public String getCrn() { - return crn; - } - - /** - * Gets the name. - * - * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the accountId. - * - * The account GUID. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the serviceName. - * - * The service name. - * - * @return the serviceName - */ - public String getServiceName() { - return serviceName; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the role was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the role. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the role was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the href. - * - * The href links back to the role. - * - * @return the href - */ - public String getHref() { - return href; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java deleted file mode 100644 index f71d2c2ab9d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteActionControlAssignment options. - */ -public class DeleteActionControlAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing DeleteActionControlAssignmentOptions instance. - * - * @param deleteActionControlAssignmentOptions the instance to initialize the Builder with - */ - private Builder(DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptions) { - this.assignmentId = deleteActionControlAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a DeleteActionControlAssignmentOptions. - * - * @return the new DeleteActionControlAssignmentOptions instance - */ - public DeleteActionControlAssignmentOptions build() { - return new DeleteActionControlAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the DeleteActionControlAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected DeleteActionControlAssignmentOptions() { } - - protected DeleteActionControlAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a DeleteActionControlAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Action control template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java deleted file mode 100644 index 6ff35d83603..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteActionControlTemplate options. - */ -public class DeleteActionControlTemplateOptions extends GenericModel { - - protected String actionControlTemplateId; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - - /** - * Instantiates a new Builder from an existing DeleteActionControlTemplateOptions instance. - * - * @param deleteActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(DeleteActionControlTemplateOptions deleteActionControlTemplateOptions) { - this.actionControlTemplateId = deleteActionControlTemplateOptions.actionControlTemplateId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - */ - public Builder(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - } - - /** - * Builds a DeleteActionControlTemplateOptions. - * - * @return the new DeleteActionControlTemplateOptions instance - */ - public DeleteActionControlTemplateOptions build() { - return new DeleteActionControlTemplateOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the DeleteActionControlTemplateOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - } - - protected DeleteActionControlTemplateOptions() { } - - protected DeleteActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - } - - /** - * New builder. - * - * @return a DeleteActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java deleted file mode 100644 index 69aca0555a1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteActionControlTemplateVersion options. - */ -public class DeleteActionControlTemplateVersionOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing DeleteActionControlTemplateVersionOptions instance. - * - * @param deleteActionControlTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptions) { - this.actionControlTemplateId = deleteActionControlTemplateVersionOptions.actionControlTemplateId; - this.version = deleteActionControlTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - * @param version the version - */ - public Builder(String actionControlTemplateId, String version) { - this.actionControlTemplateId = actionControlTemplateId; - this.version = version; - } - - /** - * Builds a DeleteActionControlTemplateVersionOptions. - * - * @return the new DeleteActionControlTemplateVersionOptions instance - */ - public DeleteActionControlTemplateVersionOptions build() { - return new DeleteActionControlTemplateVersionOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the DeleteActionControlTemplateVersionOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the DeleteActionControlTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected DeleteActionControlTemplateVersionOptions() { } - - protected DeleteActionControlTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a DeleteActionControlTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java deleted file mode 100644 index 3ab2cf17469..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deletePolicyAssignment options. - */ -public class DeletePolicyAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing DeletePolicyAssignmentOptions instance. - * - * @param deletePolicyAssignmentOptions the instance to initialize the Builder with - */ - private Builder(DeletePolicyAssignmentOptions deletePolicyAssignmentOptions) { - this.assignmentId = deletePolicyAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a DeletePolicyAssignmentOptions. - * - * @return the new DeletePolicyAssignmentOptions instance - */ - public DeletePolicyAssignmentOptions build() { - return new DeletePolicyAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the DeletePolicyAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected DeletePolicyAssignmentOptions() { } - - protected DeletePolicyAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a DeletePolicyAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * The policy template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java deleted file mode 100644 index fe070b2064a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deletePolicy options. - */ -public class DeletePolicyOptions extends GenericModel { - - protected String policyId; - - /** - * Builder. - */ - public static class Builder { - private String policyId; - - /** - * Instantiates a new Builder from an existing DeletePolicyOptions instance. - * - * @param deletePolicyOptions the instance to initialize the Builder with - */ - private Builder(DeletePolicyOptions deletePolicyOptions) { - this.policyId = deletePolicyOptions.policyId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyId the policyId - */ - public Builder(String policyId) { - this.policyId = policyId; - } - - /** - * Builds a DeletePolicyOptions. - * - * @return the new DeletePolicyOptions instance - */ - public DeletePolicyOptions build() { - return new DeletePolicyOptions(this); - } - - /** - * Set the policyId. - * - * @param policyId the policyId - * @return the DeletePolicyOptions builder - */ - public Builder policyId(String policyId) { - this.policyId = policyId; - return this; - } - } - - protected DeletePolicyOptions() { } - - protected DeletePolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, - "policyId cannot be empty"); - policyId = builder.policyId; - } - - /** - * New builder. - * - * @return a DeletePolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyId. - * - * The policy ID. - * - * @return the policyId - */ - public String policyId() { - return policyId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java deleted file mode 100644 index bb70b0d6727..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deletePolicyTemplate options. - */ -public class DeletePolicyTemplateOptions extends GenericModel { - - protected String policyTemplateId; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - - /** - * Instantiates a new Builder from an existing DeletePolicyTemplateOptions instance. - * - * @param deletePolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(DeletePolicyTemplateOptions deletePolicyTemplateOptions) { - this.policyTemplateId = deletePolicyTemplateOptions.policyTemplateId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - */ - public Builder(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - } - - /** - * Builds a DeletePolicyTemplateOptions. - * - * @return the new DeletePolicyTemplateOptions instance - */ - public DeletePolicyTemplateOptions build() { - return new DeletePolicyTemplateOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the DeletePolicyTemplateOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - } - - protected DeletePolicyTemplateOptions() { } - - protected DeletePolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - policyTemplateId = builder.policyTemplateId; - } - - /** - * New builder. - * - * @return a DeletePolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java deleted file mode 100644 index 9a04a5157b6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deletePolicyTemplateVersion options. - */ -public class DeletePolicyTemplateVersionOptions extends GenericModel { - - protected String policyTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing DeletePolicyTemplateVersionOptions instance. - * - * @param deletePolicyTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptions) { - this.policyTemplateId = deletePolicyTemplateVersionOptions.policyTemplateId; - this.version = deletePolicyTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param version the version - */ - public Builder(String policyTemplateId, String version) { - this.policyTemplateId = policyTemplateId; - this.version = version; - } - - /** - * Builds a DeletePolicyTemplateVersionOptions. - * - * @return the new DeletePolicyTemplateVersionOptions instance - */ - public DeletePolicyTemplateVersionOptions build() { - return new DeletePolicyTemplateVersionOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the DeletePolicyTemplateVersionOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the DeletePolicyTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected DeletePolicyTemplateVersionOptions() { } - - protected DeletePolicyTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - policyTemplateId = builder.policyTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a DeletePolicyTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the version. - * - * The policy template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java deleted file mode 100644 index b9341a9f414..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteRoleAssignment options. - */ -public class DeleteRoleAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing DeleteRoleAssignmentOptions instance. - * - * @param deleteRoleAssignmentOptions the instance to initialize the Builder with - */ - private Builder(DeleteRoleAssignmentOptions deleteRoleAssignmentOptions) { - this.assignmentId = deleteRoleAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a DeleteRoleAssignmentOptions. - * - * @return the new DeleteRoleAssignmentOptions instance - */ - public DeleteRoleAssignmentOptions build() { - return new DeleteRoleAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the DeleteRoleAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected DeleteRoleAssignmentOptions() { } - - protected DeleteRoleAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a DeleteRoleAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Role template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java deleted file mode 100644 index 8675777719e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteRole options. - */ -public class DeleteRoleOptions extends GenericModel { - - protected String roleId; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - - /** - * Instantiates a new Builder from an existing DeleteRoleOptions instance. - * - * @param deleteRoleOptions the instance to initialize the Builder with - */ - private Builder(DeleteRoleOptions deleteRoleOptions) { - this.roleId = deleteRoleOptions.roleId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - */ - public Builder(String roleId) { - this.roleId = roleId; - } - - /** - * Builds a DeleteRoleOptions. - * - * @return the new DeleteRoleOptions instance - */ - public DeleteRoleOptions build() { - return new DeleteRoleOptions(this); - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the DeleteRoleOptions builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - } - - protected DeleteRoleOptions() { } - - protected DeleteRoleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, - "roleId cannot be empty"); - roleId = builder.roleId; - } - - /** - * New builder. - * - * @return a DeleteRoleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role ID. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java deleted file mode 100644 index c76bf3bfda4..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteRoleTemplate options. - */ -public class DeleteRoleTemplateOptions extends GenericModel { - - protected String roleTemplateId; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - - /** - * Instantiates a new Builder from an existing DeleteRoleTemplateOptions instance. - * - * @param deleteRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(DeleteRoleTemplateOptions deleteRoleTemplateOptions) { - this.roleTemplateId = deleteRoleTemplateOptions.roleTemplateId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - */ - public Builder(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - } - - /** - * Builds a DeleteRoleTemplateOptions. - * - * @return the new DeleteRoleTemplateOptions instance - */ - public DeleteRoleTemplateOptions build() { - return new DeleteRoleTemplateOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the DeleteRoleTemplateOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - } - - protected DeleteRoleTemplateOptions() { } - - protected DeleteRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - roleTemplateId = builder.roleTemplateId; - } - - /** - * New builder. - * - * @return a DeleteRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java deleted file mode 100644 index 9f974213165..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteRoleTemplateVersion options. - */ -public class DeleteRoleTemplateVersionOptions extends GenericModel { - - protected String roleTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing DeleteRoleTemplateVersionOptions instance. - * - * @param deleteRoleTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptions) { - this.roleTemplateId = deleteRoleTemplateVersionOptions.roleTemplateId; - this.version = deleteRoleTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - * @param version the version - */ - public Builder(String roleTemplateId, String version) { - this.roleTemplateId = roleTemplateId; - this.version = version; - } - - /** - * Builds a DeleteRoleTemplateVersionOptions. - * - * @return the new DeleteRoleTemplateVersionOptions instance - */ - public DeleteRoleTemplateVersionOptions build() { - return new DeleteRoleTemplateVersionOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the DeleteRoleTemplateVersionOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the DeleteRoleTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected DeleteRoleTemplateVersionOptions() { } - - protected DeleteRoleTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - roleTemplateId = builder.roleTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a DeleteRoleTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the version. - * - * Role template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java deleted file mode 100644 index 92c1caaa34c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteV2Policy options. - */ -public class DeleteV2PolicyOptions extends GenericModel { - - protected String id; - - /** - * Builder. - */ - public static class Builder { - private String id; - - /** - * Instantiates a new Builder from an existing DeleteV2PolicyOptions instance. - * - * @param deleteV2PolicyOptions the instance to initialize the Builder with - */ - private Builder(DeleteV2PolicyOptions deleteV2PolicyOptions) { - this.id = deleteV2PolicyOptions.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 DeleteV2PolicyOptions. - * - * @return the new DeleteV2PolicyOptions instance - */ - public DeleteV2PolicyOptions build() { - return new DeleteV2PolicyOptions(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the DeleteV2PolicyOptions builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - } - - protected DeleteV2PolicyOptions() { } - - protected DeleteV2PolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, - "id cannot be empty"); - id = builder.id; - } - - /** - * New builder. - * - * @return a DeleteV2PolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String id() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java deleted file mode 100644 index 0978eb1040b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role associated with a policy with additional information (display_name, description, actions) when - * `format=display`. - */ -public class EnrichedRoles extends GenericModel { - - @SerializedName("role_id") - protected String roleId; - @SerializedName("display_name") - protected String displayName; - protected String description; - protected List actions; - - protected EnrichedRoles() { } - - /** - * Gets the roleId. - * - * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. - * - * @return the roleId - */ - public String getRoleId() { - return roleId; - } - - /** - * Gets the displayName. - * - * The display name of the role, either service-defined or user-defined for custom roles. - * - * @return the displayName - */ - public String getDisplayName() { - return displayName; - } - - /** - * Gets the description. - * - * The role description, either service-defined or user-defined for custom roles. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List getActions() { - return actions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java deleted file mode 100644 index e99ea48f5f6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Additional error details. - */ -public class ErrorDetails extends GenericModel { - - @SerializedName("conflicts_with") - protected ConflictsWith conflictsWith; - - protected ErrorDetails() { } - - /** - * Gets the conflictsWith. - * - * Details of conflicting resource. - * - * @return the conflictsWith - */ - public ConflictsWith getConflictsWith() { - return conflictsWith; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java deleted file mode 100644 index b5411a7bb36..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * ErrorObject. - */ -public class ErrorObject extends GenericModel { - - /** - * The API error code for the error. - */ - public interface Code { - /** insufficent_permissions. */ - String INSUFFICENT_PERMISSIONS = "insufficent_permissions"; - /** invalid_body. */ - String INVALID_BODY = "invalid_body"; - /** invalid_token. */ - String INVALID_TOKEN = "invalid_token"; - /** missing_required_query_parameter. */ - String MISSING_REQUIRED_QUERY_PARAMETER = "missing_required_query_parameter"; - /** not_found. */ - String NOT_FOUND = "not_found"; - /** policy_conflict_error. */ - String POLICY_CONFLICT_ERROR = "policy_conflict_error"; - /** policy_not_found. */ - String POLICY_NOT_FOUND = "policy_not_found"; - /** request_not_processed. */ - String REQUEST_NOT_PROCESSED = "request_not_processed"; - /** role_conflict_error. */ - String ROLE_CONFLICT_ERROR = "role_conflict_error"; - /** role_not_found. */ - String ROLE_NOT_FOUND = "role_not_found"; - /** too_many_requests. */ - String TOO_MANY_REQUESTS = "too_many_requests"; - /** unable_to_process. */ - String UNABLE_TO_PROCESS = "unable_to_process"; - /** unsupported_content_type. */ - String UNSUPPORTED_CONTENT_TYPE = "unsupported_content_type"; - /** policy_template_conflict_error. */ - String POLICY_TEMPLATE_CONFLICT_ERROR = "policy_template_conflict_error"; - /** policy_template_not_found. */ - String POLICY_TEMPLATE_NOT_FOUND = "policy_template_not_found"; - /** policy_assignment_not_found. */ - String POLICY_ASSIGNMENT_NOT_FOUND = "policy_assignment_not_found"; - /** policy_assignment_conflict_error. */ - String POLICY_ASSIGNMENT_CONFLICT_ERROR = "policy_assignment_conflict_error"; - /** resource_not_found. */ - String RESOURCE_NOT_FOUND = "resource_not_found"; - /** action_control_template_not_found. */ - String ACTION_CONTROL_TEMPLATE_NOT_FOUND = "action_control_template_not_found"; - /** action_control_assignment_not_found. */ - String ACTION_CONTROL_ASSIGNMENT_NOT_FOUND = "action_control_assignment_not_found"; - /** role_template_conflict_error. */ - String ROLE_TEMPLATE_CONFLICT_ERROR = "role_template_conflict_error"; - /** role_template_not_found. */ - String ROLE_TEMPLATE_NOT_FOUND = "role_template_not_found"; - /** role_assignment_not_found. */ - String ROLE_ASSIGNMENT_NOT_FOUND = "role_assignment_not_found"; - } - - protected String code; - protected String message; - protected ErrorDetails details; - @SerializedName("more_info") - protected String moreInfo; - - protected ErrorObject() { } - - /** - * Gets the code. - * - * The API error code for the error. - * - * @return the code - */ - public String getCode() { - return code; - } - - /** - * Gets the message. - * - * The error message returned by the API. - * - * @return the message - */ - public String getMessage() { - return message; - } - - /** - * Gets the details. - * - * Additional error details. - * - * @return the details - */ - public ErrorDetails getDetails() { - return details; - } - - /** - * Gets the moreInfo. - * - * Additional info for error. - * - * @return the moreInfo - */ - public String getMoreInfo() { - return moreInfo; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java deleted file mode 100644 index 5c1c9a9fad6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * How external accounts can interact in relation to the requested account. - */ -public class ExternalAccountIdentityInteraction extends GenericModel { - - @SerializedName("identity_types") - protected IdentityTypes identityTypes; - - protected ExternalAccountIdentityInteraction() { } - - /** - * Gets the identityTypes. - * - * The settings for each identity type. - * - * @return the identityTypes - */ - public IdentityTypes getIdentityTypes() { - return identityTypes; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java deleted file mode 100644 index 1efd0673e9d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Update to how external accounts can interact in relation to the requested account. - */ -public class ExternalAccountIdentityInteractionPatch extends GenericModel { - - @SerializedName("identity_types") - protected IdentityTypesPatch identityTypes; - - /** - * Builder. - */ - public static class Builder { - private IdentityTypesPatch identityTypes; - - /** - * Instantiates a new Builder from an existing ExternalAccountIdentityInteractionPatch instance. - * - * @param externalAccountIdentityInteractionPatch the instance to initialize the Builder with - */ - private Builder(ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatch) { - this.identityTypes = externalAccountIdentityInteractionPatch.identityTypes; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a ExternalAccountIdentityInteractionPatch. - * - * @return the new ExternalAccountIdentityInteractionPatch instance - */ - public ExternalAccountIdentityInteractionPatch build() { - return new ExternalAccountIdentityInteractionPatch(this); - } - - /** - * Set the identityTypes. - * - * @param identityTypes the identityTypes - * @return the ExternalAccountIdentityInteractionPatch builder - */ - public Builder identityTypes(IdentityTypesPatch identityTypes) { - this.identityTypes = identityTypes; - return this; - } - } - - protected ExternalAccountIdentityInteractionPatch() { } - - protected ExternalAccountIdentityInteractionPatch(Builder builder) { - identityTypes = builder.identityTypes; - } - - /** - * New builder. - * - * @return a ExternalAccountIdentityInteractionPatch builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the identityTypes. - * - * The settings to apply for each identity type for a request. - * - * @return the identityTypes - */ - public IdentityTypesPatch identityTypes() { - return identityTypes; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java deleted file mode 100644 index 83cd67d33c9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Details with linking href to first page of requested collection. - */ -public class First extends GenericModel { - - protected String href; - - protected First() { } - - /** - * Gets the href. - * - * The href linking to the page of requested collection. - * - * @return the href - */ - public String getHref() { - return href; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java deleted file mode 100644 index f87e7d741a4..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getActionControlAssignment options. - */ -public class GetActionControlAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing GetActionControlAssignmentOptions instance. - * - * @param getActionControlAssignmentOptions the instance to initialize the Builder with - */ - private Builder(GetActionControlAssignmentOptions getActionControlAssignmentOptions) { - this.assignmentId = getActionControlAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a GetActionControlAssignmentOptions. - * - * @return the new GetActionControlAssignmentOptions instance - */ - public GetActionControlAssignmentOptions build() { - return new GetActionControlAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the GetActionControlAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected GetActionControlAssignmentOptions() { } - - protected GetActionControlAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a GetActionControlAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Action control template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java deleted file mode 100644 index 963c68e8876..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getActionControlTemplate options. - */ -public class GetActionControlTemplateOptions extends GenericModel { - - /** - * The action control template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String actionControlTemplateId; - protected String state; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String state; - - /** - * Instantiates a new Builder from an existing GetActionControlTemplateOptions instance. - * - * @param getActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(GetActionControlTemplateOptions getActionControlTemplateOptions) { - this.actionControlTemplateId = getActionControlTemplateOptions.actionControlTemplateId; - this.state = getActionControlTemplateOptions.state; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - */ - public Builder(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - } - - /** - * Builds a GetActionControlTemplateOptions. - * - * @return the new GetActionControlTemplateOptions instance - */ - public GetActionControlTemplateOptions build() { - return new GetActionControlTemplateOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the GetActionControlTemplateOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the GetActionControlTemplateOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - } - - protected GetActionControlTemplateOptions() { } - - protected GetActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - state = builder.state; - } - - /** - * New builder. - * - * @return a GetActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the state. - * - * The action control template state. - * - * @return the state - */ - public String state() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java deleted file mode 100644 index 95bc94950bb..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getActionControlTemplateVersion options. - */ -public class GetActionControlTemplateVersionOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing GetActionControlTemplateVersionOptions instance. - * - * @param getActionControlTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptions) { - this.actionControlTemplateId = getActionControlTemplateVersionOptions.actionControlTemplateId; - this.version = getActionControlTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - * @param version the version - */ - public Builder(String actionControlTemplateId, String version) { - this.actionControlTemplateId = actionControlTemplateId; - this.version = version; - } - - /** - * Builds a GetActionControlTemplateVersionOptions. - * - * @return the new GetActionControlTemplateVersionOptions instance - */ - public GetActionControlTemplateVersionOptions build() { - return new GetActionControlTemplateVersionOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the GetActionControlTemplateVersionOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the GetActionControlTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected GetActionControlTemplateVersionOptions() { } - - protected GetActionControlTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a GetActionControlTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java deleted file mode 100644 index d1c7c359003..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getPolicyAssignment options. - */ -public class GetPolicyAssignmentOptions extends GenericModel { - - protected String assignmentId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - private String version; - - /** - * Instantiates a new Builder from an existing GetPolicyAssignmentOptions instance. - * - * @param getPolicyAssignmentOptions the instance to initialize the Builder with - */ - private Builder(GetPolicyAssignmentOptions getPolicyAssignmentOptions) { - this.assignmentId = getPolicyAssignmentOptions.assignmentId; - this.version = getPolicyAssignmentOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - * @param version the version - */ - public Builder(String assignmentId, String version) { - this.assignmentId = assignmentId; - this.version = version; - } - - /** - * Builds a GetPolicyAssignmentOptions. - * - * @return the new GetPolicyAssignmentOptions instance - */ - public GetPolicyAssignmentOptions build() { - return new GetPolicyAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the GetPolicyAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the GetPolicyAssignmentOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected GetPolicyAssignmentOptions() { } - - protected GetPolicyAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - assignmentId = builder.assignmentId; - version = builder.version; - } - - /** - * New builder. - * - * @return a GetPolicyAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * The policy template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } - - /** - * Gets the version. - * - * specify version of response body format. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java deleted file mode 100644 index e780ac06896..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getPolicy options. - */ -public class GetPolicyOptions extends GenericModel { - - protected String policyId; - - /** - * Builder. - */ - public static class Builder { - private String policyId; - - /** - * Instantiates a new Builder from an existing GetPolicyOptions instance. - * - * @param getPolicyOptions the instance to initialize the Builder with - */ - private Builder(GetPolicyOptions getPolicyOptions) { - this.policyId = getPolicyOptions.policyId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyId the policyId - */ - public Builder(String policyId) { - this.policyId = policyId; - } - - /** - * Builds a GetPolicyOptions. - * - * @return the new GetPolicyOptions instance - */ - public GetPolicyOptions build() { - return new GetPolicyOptions(this); - } - - /** - * Set the policyId. - * - * @param policyId the policyId - * @return the GetPolicyOptions builder - */ - public Builder policyId(String policyId) { - this.policyId = policyId; - return this; - } - } - - protected GetPolicyOptions() { } - - protected GetPolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, - "policyId cannot be empty"); - policyId = builder.policyId; - } - - /** - * New builder. - * - * @return a GetPolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyId. - * - * The policy ID. - * - * @return the policyId - */ - public String policyId() { - return policyId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java deleted file mode 100644 index ee604554a85..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getPolicyTemplate options. - */ -public class GetPolicyTemplateOptions extends GenericModel { - - /** - * The policy template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String policyTemplateId; - protected String state; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String state; - - /** - * Instantiates a new Builder from an existing GetPolicyTemplateOptions instance. - * - * @param getPolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(GetPolicyTemplateOptions getPolicyTemplateOptions) { - this.policyTemplateId = getPolicyTemplateOptions.policyTemplateId; - this.state = getPolicyTemplateOptions.state; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - */ - public Builder(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - } - - /** - * Builds a GetPolicyTemplateOptions. - * - * @return the new GetPolicyTemplateOptions instance - */ - public GetPolicyTemplateOptions build() { - return new GetPolicyTemplateOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the GetPolicyTemplateOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the GetPolicyTemplateOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - } - - protected GetPolicyTemplateOptions() { } - - protected GetPolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - policyTemplateId = builder.policyTemplateId; - state = builder.state; - } - - /** - * New builder. - * - * @return a GetPolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the state. - * - * The policy template state. - * - * @return the state - */ - public String state() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java deleted file mode 100644 index 8741f83357d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getPolicyTemplateVersion options. - */ -public class GetPolicyTemplateVersionOptions extends GenericModel { - - protected String policyTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing GetPolicyTemplateVersionOptions instance. - * - * @param getPolicyTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptions) { - this.policyTemplateId = getPolicyTemplateVersionOptions.policyTemplateId; - this.version = getPolicyTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param version the version - */ - public Builder(String policyTemplateId, String version) { - this.policyTemplateId = policyTemplateId; - this.version = version; - } - - /** - * Builds a GetPolicyTemplateVersionOptions. - * - * @return the new GetPolicyTemplateVersionOptions instance - */ - public GetPolicyTemplateVersionOptions build() { - return new GetPolicyTemplateVersionOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the GetPolicyTemplateVersionOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the GetPolicyTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected GetPolicyTemplateVersionOptions() { } - - protected GetPolicyTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - policyTemplateId = builder.policyTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a GetPolicyTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the version. - * - * The policy template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java deleted file mode 100644 index 35313b9b746..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getRoleAssignment options. - */ -public class GetRoleAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing GetRoleAssignmentOptions instance. - * - * @param getRoleAssignmentOptions the instance to initialize the Builder with - */ - private Builder(GetRoleAssignmentOptions getRoleAssignmentOptions) { - this.assignmentId = getRoleAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a GetRoleAssignmentOptions. - * - * @return the new GetRoleAssignmentOptions instance - */ - public GetRoleAssignmentOptions build() { - return new GetRoleAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the GetRoleAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected GetRoleAssignmentOptions() { } - - protected GetRoleAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a GetRoleAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Role template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java deleted file mode 100644 index 8c56ac7f58a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getRole options. - */ -public class GetRoleOptions extends GenericModel { - - protected String roleId; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - - /** - * Instantiates a new Builder from an existing GetRoleOptions instance. - * - * @param getRoleOptions the instance to initialize the Builder with - */ - private Builder(GetRoleOptions getRoleOptions) { - this.roleId = getRoleOptions.roleId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - */ - public Builder(String roleId) { - this.roleId = roleId; - } - - /** - * Builds a GetRoleOptions. - * - * @return the new GetRoleOptions instance - */ - public GetRoleOptions build() { - return new GetRoleOptions(this); - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the GetRoleOptions builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - } - - protected GetRoleOptions() { } - - protected GetRoleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, - "roleId cannot be empty"); - roleId = builder.roleId; - } - - /** - * New builder. - * - * @return a GetRoleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role ID. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java deleted file mode 100644 index e33fcf29b32..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getRoleTemplate options. - */ -public class GetRoleTemplateOptions extends GenericModel { - - /** - * The role template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String roleTemplateId; - protected String state; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String state; - - /** - * Instantiates a new Builder from an existing GetRoleTemplateOptions instance. - * - * @param getRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(GetRoleTemplateOptions getRoleTemplateOptions) { - this.roleTemplateId = getRoleTemplateOptions.roleTemplateId; - this.state = getRoleTemplateOptions.state; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - */ - public Builder(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - } - - /** - * Builds a GetRoleTemplateOptions. - * - * @return the new GetRoleTemplateOptions instance - */ - public GetRoleTemplateOptions build() { - return new GetRoleTemplateOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the GetRoleTemplateOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the GetRoleTemplateOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - } - - protected GetRoleTemplateOptions() { } - - protected GetRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - roleTemplateId = builder.roleTemplateId; - state = builder.state; - } - - /** - * New builder. - * - * @return a GetRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the state. - * - * The role template state. - * - * @return the state - */ - public String state() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java deleted file mode 100644 index 4757484f969..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getRoleTemplateVersion options. - */ -public class GetRoleTemplateVersionOptions extends GenericModel { - - protected String roleTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing GetRoleTemplateVersionOptions instance. - * - * @param getRoleTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(GetRoleTemplateVersionOptions getRoleTemplateVersionOptions) { - this.roleTemplateId = getRoleTemplateVersionOptions.roleTemplateId; - this.version = getRoleTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - * @param version the version - */ - public Builder(String roleTemplateId, String version) { - this.roleTemplateId = roleTemplateId; - this.version = version; - } - - /** - * Builds a GetRoleTemplateVersionOptions. - * - * @return the new GetRoleTemplateVersionOptions instance - */ - public GetRoleTemplateVersionOptions build() { - return new GetRoleTemplateVersionOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the GetRoleTemplateVersionOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the GetRoleTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected GetRoleTemplateVersionOptions() { } - - protected GetRoleTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - roleTemplateId = builder.roleTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a GetRoleTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the version. - * - * Role template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java deleted file mode 100644 index ebc88bbf45c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getSettings options. - */ -public class GetSettingsOptions extends GenericModel { - - protected String accountId; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing GetSettingsOptions instance. - * - * @param getSettingsOptions the instance to initialize the Builder with - */ - private Builder(GetSettingsOptions getSettingsOptions) { - this.accountId = getSettingsOptions.accountId; - this.acceptLanguage = getSettingsOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a GetSettingsOptions. - * - * @return the new GetSettingsOptions instance - */ - public GetSettingsOptions build() { - return new GetSettingsOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the GetSettingsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the GetSettingsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected GetSettingsOptions() { } - - protected GetSettingsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.accountId, - "accountId cannot be empty"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a GetSettingsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the settings belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java deleted file mode 100644 index 23a950cc815..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getV2Policy options. - */ -public class GetV2PolicyOptions extends GenericModel { - - /** - * Include additional data for policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles and translations for all - * relevant fields. - */ - public interface Format { - /** include_last_permit. */ - String INCLUDE_LAST_PERMIT = "include_last_permit"; - /** display. */ - String DISPLAY = "display"; - } - - protected String id; - protected String format; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String format; - - /** - * Instantiates a new Builder from an existing GetV2PolicyOptions instance. - * - * @param getV2PolicyOptions the instance to initialize the Builder with - */ - private Builder(GetV2PolicyOptions getV2PolicyOptions) { - this.id = getV2PolicyOptions.id; - this.format = getV2PolicyOptions.format; - } - - /** - * 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 GetV2PolicyOptions. - * - * @return the new GetV2PolicyOptions instance - */ - public GetV2PolicyOptions build() { - return new GetV2PolicyOptions(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the GetV2PolicyOptions builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the format. - * - * @param format the format - * @return the GetV2PolicyOptions builder - */ - public Builder format(String format) { - this.format = format; - return this; - } - } - - protected GetV2PolicyOptions() { } - - protected GetV2PolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, - "id cannot be empty"); - id = builder.id; - format = builder.format; - } - - /** - * New builder. - * - * @return a GetV2PolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the format. - * - * Include additional data for policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles and translations for all - * relevant fields. - * - * @return the format - */ - public String format() { - return format; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java deleted file mode 100644 index d8439c9d6f7..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Permission is granted by the policy. - */ -public class Grant extends GenericModel { - - protected List roles; - - /** - * Builder. - */ - public static class Builder { - private List roles; - - /** - * Instantiates a new Builder from an existing Grant instance. - * - * @param grant the instance to initialize the Builder with - */ - private Builder(Grant grant) { - this.roles = grant.roles; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roles the roles - */ - public Builder(List roles) { - this.roles = roles; - } - - /** - * Builds a Grant. - * - * @return the new Grant instance - */ - public Grant build() { - return new Grant(this); - } - - /** - * Adds a new element to roles. - * - * @param roles the new element to be added - * @return the Grant builder - */ - public Builder addRoles(Roles roles) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roles, - "roles cannot be null"); - if (this.roles == null) { - this.roles = new ArrayList(); - } - this.roles.add(roles); - return this; - } - - /** - * Set the roles. - * Existing roles will be replaced. - * - * @param roles the roles - * @return the Grant builder - */ - public Builder roles(List roles) { - this.roles = roles; - return this; - } - } - - protected Grant() { } - - protected Grant(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, - "roles cannot be null"); - roles = builder.roles; - } - - /** - * New builder. - * - * @return a Grant builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List roles() { - return roles; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java deleted file mode 100644 index 1dbc53fefb6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Permission granted by the policy with translated roles and additional role information. - */ -public class GrantWithEnrichedRoles extends GenericModel { - - protected List roles; - - protected GrantWithEnrichedRoles() { } - - /** - * Gets the roles. - * - * A set of roles granted by the policy. - * - * @return the roles - */ - public List getRoles() { - return roles; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java deleted file mode 100644 index 0ac71d8192b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The settings for each identity type. - */ -public class IdentityTypes extends GenericModel { - - protected IdentityTypesBase user; - @SerializedName("service_id") - protected IdentityTypesBase serviceId; - protected IdentityTypesBase service; - - protected IdentityTypes() { } - - /** - * Gets the user. - * - * The core set of properties associated with an identity type. - * - * @return the user - */ - public IdentityTypesBase getUser() { - return user; - } - - /** - * Gets the serviceId. - * - * The core set of properties associated with an identity type. - * - * @return the serviceId - */ - public IdentityTypesBase getServiceId() { - return serviceId; - } - - /** - * Gets the service. - * - * The core set of properties associated with an identity type. - * - * @return the service - */ - public IdentityTypesBase getService() { - return service; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java deleted file mode 100644 index e8df91a1e5d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with an identity type. - */ -public class IdentityTypesBase extends GenericModel { - - /** - * The state of the identity type. - */ - public interface State { - /** enabled. */ - String ENABLED = "enabled"; - /** monitor. */ - String MONITOR = "monitor"; - /** limited. */ - String LIMITED = "limited"; - } - - protected String state; - @SerializedName("external_allowed_accounts") - protected List externalAllowedAccounts; - - /** - * Builder. - */ - public static class Builder { - private String state; - private List externalAllowedAccounts; - - /** - * Instantiates a new Builder from an existing IdentityTypesBase instance. - * - * @param identityTypesBase the instance to initialize the Builder with - */ - private Builder(IdentityTypesBase identityTypesBase) { - this.state = identityTypesBase.state; - this.externalAllowedAccounts = identityTypesBase.externalAllowedAccounts; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param state the state - * @param externalAllowedAccounts the externalAllowedAccounts - */ - public Builder(String state, List externalAllowedAccounts) { - this.state = state; - this.externalAllowedAccounts = externalAllowedAccounts; - } - - /** - * Builds a IdentityTypesBase. - * - * @return the new IdentityTypesBase instance - */ - public IdentityTypesBase build() { - return new IdentityTypesBase(this); - } - - /** - * Adds a new element to externalAllowedAccounts. - * - * @param externalAllowedAccounts the new element to be added - * @return the IdentityTypesBase builder - */ - public Builder addExternalAllowedAccounts(String externalAllowedAccounts) { - com.ibm.cloud.sdk.core.util.Validator.notNull(externalAllowedAccounts, - "externalAllowedAccounts cannot be null"); - if (this.externalAllowedAccounts == null) { - this.externalAllowedAccounts = new ArrayList(); - } - this.externalAllowedAccounts.add(externalAllowedAccounts); - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the IdentityTypesBase builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the externalAllowedAccounts. - * Existing externalAllowedAccounts will be replaced. - * - * @param externalAllowedAccounts the externalAllowedAccounts - * @return the IdentityTypesBase builder - */ - public Builder externalAllowedAccounts(List externalAllowedAccounts) { - this.externalAllowedAccounts = externalAllowedAccounts; - return this; - } - } - - protected IdentityTypesBase() { } - - protected IdentityTypesBase(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.state, - "state cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.externalAllowedAccounts, - "externalAllowedAccounts cannot be null"); - state = builder.state; - externalAllowedAccounts = builder.externalAllowedAccounts; - } - - /** - * New builder. - * - * @return a IdentityTypesBase builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the state. - * - * The state of the identity type. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the externalAllowedAccounts. - * - * List of accounts that the state applies to for a given identity. - * - * @return the externalAllowedAccounts - */ - public List externalAllowedAccounts() { - return externalAllowedAccounts; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java deleted file mode 100644 index 77aa5a26366..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The settings to apply for each identity type for a request. - */ -public class IdentityTypesPatch extends GenericModel { - - protected IdentityTypesBase user; - @SerializedName("service_id") - protected IdentityTypesBase serviceId; - protected IdentityTypesBase service; - - /** - * Builder. - */ - public static class Builder { - private IdentityTypesBase user; - private IdentityTypesBase serviceId; - private IdentityTypesBase service; - - /** - * Instantiates a new Builder from an existing IdentityTypesPatch instance. - * - * @param identityTypesPatch the instance to initialize the Builder with - */ - private Builder(IdentityTypesPatch identityTypesPatch) { - this.user = identityTypesPatch.user; - this.serviceId = identityTypesPatch.serviceId; - this.service = identityTypesPatch.service; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a IdentityTypesPatch. - * - * @return the new IdentityTypesPatch instance - */ - public IdentityTypesPatch build() { - return new IdentityTypesPatch(this); - } - - /** - * Set the user. - * - * @param user the user - * @return the IdentityTypesPatch builder - */ - public Builder user(IdentityTypesBase user) { - this.user = user; - return this; - } - - /** - * Set the serviceId. - * - * @param serviceId the serviceId - * @return the IdentityTypesPatch builder - */ - public Builder serviceId(IdentityTypesBase serviceId) { - this.serviceId = serviceId; - return this; - } - - /** - * Set the service. - * - * @param service the service - * @return the IdentityTypesPatch builder - */ - public Builder service(IdentityTypesBase service) { - this.service = service; - return this; - } - } - - protected IdentityTypesPatch() { } - - protected IdentityTypesPatch(Builder builder) { - user = builder.user; - serviceId = builder.serviceId; - service = builder.service; - } - - /** - * New builder. - * - * @return a IdentityTypesPatch builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the user. - * - * The core set of properties associated with an identity type. - * - * @return the user - */ - public IdentityTypesBase user() { - return user; - } - - /** - * Gets the serviceId. - * - * The core set of properties associated with an identity type. - * - * @return the serviceId - */ - public IdentityTypesBase serviceId() { - return serviceId; - } - - /** - * Gets the service. - * - * The core set of properties associated with an identity type. - * - * @return the service - */ - public IdentityTypesBase service() { - return service; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java deleted file mode 100644 index 5aa0b39573b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * policy template current and limit details with in an account. - */ -public class LimitData extends GenericModel { - - protected Long current; - protected Long limit; - - protected LimitData() { } - - /** - * Gets the current. - * - * policy template current count. - * - * @return the current - */ - public Long getCurrent() { - return current; - } - - /** - * Gets the limit. - * - * policy template limit count. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java deleted file mode 100644 index 6835f5afccc..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listActionControlAssignments options. - */ -public class ListActionControlAssignmentsOptions extends GenericModel { - - protected String accountId; - protected String acceptLanguage; - protected String templateId; - protected String templateVersion; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String templateId; - private String templateVersion; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListActionControlAssignmentsOptions instance. - * - * @param listActionControlAssignmentsOptions the instance to initialize the Builder with - */ - private Builder(ListActionControlAssignmentsOptions listActionControlAssignmentsOptions) { - this.accountId = listActionControlAssignmentsOptions.accountId; - this.acceptLanguage = listActionControlAssignmentsOptions.acceptLanguage; - this.templateId = listActionControlAssignmentsOptions.templateId; - this.templateVersion = listActionControlAssignmentsOptions.templateVersion; - this.limit = listActionControlAssignmentsOptions.limit; - this.start = listActionControlAssignmentsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListActionControlAssignmentsOptions. - * - * @return the new ListActionControlAssignmentsOptions instance - */ - public ListActionControlAssignmentsOptions build() { - return new ListActionControlAssignmentsOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the templateId. - * - * @param templateId the templateId - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder templateId(String templateId) { - this.templateId = templateId; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListActionControlAssignmentsOptions() { } - - protected ListActionControlAssignmentsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - templateId = builder.templateId; - templateVersion = builder.templateVersion; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListActionControlAssignmentsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID in which the action control assignment belongs to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the templateId. - * - * Optional template ID. - * - * @return the templateId - */ - public String templateId() { - return templateId; - } - - /** - * Gets the templateVersion. - * - * Optional action control template version. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java deleted file mode 100644 index 984d1060c83..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listActionControlTemplateVersions options. - */ -public class ListActionControlTemplateVersionsOptions extends GenericModel { - - /** - * Action control template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String actionControlTemplateId; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListActionControlTemplateVersionsOptions instance. - * - * @param listActionControlTemplateVersionsOptions the instance to initialize the Builder with - */ - private Builder(ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions) { - this.actionControlTemplateId = listActionControlTemplateVersionsOptions.actionControlTemplateId; - this.state = listActionControlTemplateVersionsOptions.state; - this.limit = listActionControlTemplateVersionsOptions.limit; - this.start = listActionControlTemplateVersionsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - */ - public Builder(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - } - - /** - * Builds a ListActionControlTemplateVersionsOptions. - * - * @return the new ListActionControlTemplateVersionsOptions instance - */ - public ListActionControlTemplateVersionsOptions build() { - return new ListActionControlTemplateVersionsOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the ListActionControlTemplateVersionsOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListActionControlTemplateVersionsOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListActionControlTemplateVersionsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListActionControlTemplateVersionsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListActionControlTemplateVersionsOptions() { } - - protected ListActionControlTemplateVersionsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListActionControlTemplateVersionsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * The action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the state. - * - * Action control template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java deleted file mode 100644 index d019db6119f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listActionControlTemplates options. - */ -public class ListActionControlTemplatesOptions extends GenericModel { - - protected String accountId; - protected String acceptLanguage; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListActionControlTemplatesOptions instance. - * - * @param listActionControlTemplatesOptions the instance to initialize the Builder with - */ - private Builder(ListActionControlTemplatesOptions listActionControlTemplatesOptions) { - this.accountId = listActionControlTemplatesOptions.accountId; - this.acceptLanguage = listActionControlTemplatesOptions.acceptLanguage; - this.limit = listActionControlTemplatesOptions.limit; - this.start = listActionControlTemplatesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListActionControlTemplatesOptions. - * - * @return the new ListActionControlTemplatesOptions instance - */ - public ListActionControlTemplatesOptions build() { - return new ListActionControlTemplatesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListActionControlTemplatesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListActionControlTemplatesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListActionControlTemplatesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListActionControlTemplatesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListActionControlTemplatesOptions() { } - - protected ListActionControlTemplatesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListActionControlTemplatesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the action control templates belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java deleted file mode 100644 index 90ecb352c37..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java +++ /dev/null @@ -1,501 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listPolicies options. - */ -public class ListPoliciesOptions extends GenericModel { - - /** - * Optional type of policy. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - /** - * Optional type of service. - */ - public interface ServiceType { - /** service. */ - String SERVICE = "service"; - /** platform_service. */ - String PLATFORM_SERVICE = "platform_service"; - } - - /** - * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending - * '-' to field. Example '-last_modified_at'. - */ - public interface Sort { - /** id. */ - String ID = "id"; - /** type. */ - String TYPE = "type"; - /** href. */ - String HREF = "href"; - /** created_at. */ - String CREATED_AT = "created_at"; - /** created_by_id. */ - String CREATED_BY_ID = "created_by_id"; - /** last_modified_at. */ - String LAST_MODIFIED_AT = "last_modified_at"; - /** last_modified_by_id. */ - String LAST_MODIFIED_BY_ID = "last_modified_by_id"; - /** state. */ - String STATE = "state"; - } - - /** - * Include additional data per policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles. - */ - public interface Format { - /** include_last_permit. */ - String INCLUDE_LAST_PERMIT = "include_last_permit"; - /** display. */ - String DISPLAY = "display"; - } - - /** - * The state of the policy. - * * `active` - returns active policies - * * `deleted` - returns non-active policies. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String accountId; - protected String acceptLanguage; - protected String iamId; - protected String accessGroupId; - protected String type; - protected String serviceType; - protected String tagName; - protected String tagValue; - protected String sort; - protected String format; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String iamId; - private String accessGroupId; - private String type; - private String serviceType; - private String tagName; - private String tagValue; - private String sort; - private String format; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListPoliciesOptions instance. - * - * @param listPoliciesOptions the instance to initialize the Builder with - */ - private Builder(ListPoliciesOptions listPoliciesOptions) { - this.accountId = listPoliciesOptions.accountId; - this.acceptLanguage = listPoliciesOptions.acceptLanguage; - this.iamId = listPoliciesOptions.iamId; - this.accessGroupId = listPoliciesOptions.accessGroupId; - this.type = listPoliciesOptions.type; - this.serviceType = listPoliciesOptions.serviceType; - this.tagName = listPoliciesOptions.tagName; - this.tagValue = listPoliciesOptions.tagValue; - this.sort = listPoliciesOptions.sort; - this.format = listPoliciesOptions.format; - this.state = listPoliciesOptions.state; - this.limit = listPoliciesOptions.limit; - this.start = listPoliciesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListPoliciesOptions. - * - * @return the new ListPoliciesOptions instance - */ - public ListPoliciesOptions build() { - return new ListPoliciesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListPoliciesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListPoliciesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the iamId. - * - * @param iamId the iamId - * @return the ListPoliciesOptions builder - */ - public Builder iamId(String iamId) { - this.iamId = iamId; - return this; - } - - /** - * Set the accessGroupId. - * - * @param accessGroupId the accessGroupId - * @return the ListPoliciesOptions builder - */ - public Builder accessGroupId(String accessGroupId) { - this.accessGroupId = accessGroupId; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the ListPoliciesOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the serviceType. - * - * @param serviceType the serviceType - * @return the ListPoliciesOptions builder - */ - public Builder serviceType(String serviceType) { - this.serviceType = serviceType; - return this; - } - - /** - * Set the tagName. - * - * @param tagName the tagName - * @return the ListPoliciesOptions builder - */ - public Builder tagName(String tagName) { - this.tagName = tagName; - return this; - } - - /** - * Set the tagValue. - * - * @param tagValue the tagValue - * @return the ListPoliciesOptions builder - */ - public Builder tagValue(String tagValue) { - this.tagValue = tagValue; - return this; - } - - /** - * Set the sort. - * - * @param sort the sort - * @return the ListPoliciesOptions builder - */ - public Builder sort(String sort) { - this.sort = sort; - return this; - } - - /** - * Set the format. - * - * @param format the format - * @return the ListPoliciesOptions builder - */ - public Builder format(String format) { - this.format = format; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListPoliciesOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListPoliciesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListPoliciesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListPoliciesOptions() { } - - protected ListPoliciesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - iamId = builder.iamId; - accessGroupId = builder.accessGroupId; - type = builder.type; - serviceType = builder.serviceType; - tagName = builder.tagName; - tagValue = builder.tagValue; - sort = builder.sort; - format = builder.format; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListPoliciesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the policies belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the iamId. - * - * Optional IAM ID used to identify the subject. - * - * @return the iamId - */ - public String iamId() { - return iamId; - } - - /** - * Gets the accessGroupId. - * - * Optional access group id. - * - * @return the accessGroupId - */ - public String accessGroupId() { - return accessGroupId; - } - - /** - * Gets the type. - * - * Optional type of policy. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the serviceType. - * - * Optional type of service. - * - * @return the serviceType - */ - public String serviceType() { - return serviceType; - } - - /** - * Gets the tagName. - * - * Optional name of the access tag in the policy. - * - * @return the tagName - */ - public String tagName() { - return tagName; - } - - /** - * Gets the tagValue. - * - * Optional value of the access tag in the policy. - * - * @return the tagValue - */ - public String tagValue() { - return tagValue; - } - - /** - * Gets the sort. - * - * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending - * '-' to field. Example '-last_modified_at'. - * - * @return the sort - */ - public String sort() { - return sort; - } - - /** - * Gets the format. - * - * Include additional data per policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles. - * - * @return the format - */ - public String format() { - return format; - } - - /** - * Gets the state. - * - * The state of the policy. - * * `active` - returns active policies - * * `deleted` - returns non-active policies. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java deleted file mode 100644 index 9362749c670..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java +++ /dev/null @@ -1,275 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listPolicyAssignments options. - */ -public class ListPolicyAssignmentsOptions extends GenericModel { - - protected String version; - protected String accountId; - protected String acceptLanguage; - protected String templateId; - protected String templateVersion; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String version; - private String accountId; - private String acceptLanguage; - private String templateId; - private String templateVersion; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListPolicyAssignmentsOptions instance. - * - * @param listPolicyAssignmentsOptions the instance to initialize the Builder with - */ - private Builder(ListPolicyAssignmentsOptions listPolicyAssignmentsOptions) { - this.version = listPolicyAssignmentsOptions.version; - this.accountId = listPolicyAssignmentsOptions.accountId; - this.acceptLanguage = listPolicyAssignmentsOptions.acceptLanguage; - this.templateId = listPolicyAssignmentsOptions.templateId; - this.templateVersion = listPolicyAssignmentsOptions.templateVersion; - this.limit = listPolicyAssignmentsOptions.limit; - this.start = listPolicyAssignmentsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param version the version - * @param accountId the accountId - */ - public Builder(String version, String accountId) { - this.version = version; - this.accountId = accountId; - } - - /** - * Builds a ListPolicyAssignmentsOptions. - * - * @return the new ListPolicyAssignmentsOptions instance - */ - public ListPolicyAssignmentsOptions build() { - return new ListPolicyAssignmentsOptions(this); - } - - /** - * Set the version. - * - * @param version the version - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the templateId. - * - * @param templateId the templateId - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder templateId(String templateId) { - this.templateId = templateId; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListPolicyAssignmentsOptions() { } - - protected ListPolicyAssignmentsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - version = builder.version; - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - templateId = builder.templateId; - templateVersion = builder.templateVersion; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListPolicyAssignmentsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the version. - * - * specify version of response body format. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the accountId. - * - * The account GUID in which the policies belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the templateId. - * - * Optional template id. - * - * @return the templateId - */ - public String templateId() { - return templateId; - } - - /** - * Gets the templateVersion. - * - * Optional policy template version. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java deleted file mode 100644 index c7965ba6c31..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listPolicyTemplateVersions options. - */ -public class ListPolicyTemplateVersionsOptions extends GenericModel { - - /** - * The policy template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String policyTemplateId; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListPolicyTemplateVersionsOptions instance. - * - * @param listPolicyTemplateVersionsOptions the instance to initialize the Builder with - */ - private Builder(ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions) { - this.policyTemplateId = listPolicyTemplateVersionsOptions.policyTemplateId; - this.state = listPolicyTemplateVersionsOptions.state; - this.limit = listPolicyTemplateVersionsOptions.limit; - this.start = listPolicyTemplateVersionsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - */ - public Builder(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - } - - /** - * Builds a ListPolicyTemplateVersionsOptions. - * - * @return the new ListPolicyTemplateVersionsOptions instance - */ - public ListPolicyTemplateVersionsOptions build() { - return new ListPolicyTemplateVersionsOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the ListPolicyTemplateVersionsOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListPolicyTemplateVersionsOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListPolicyTemplateVersionsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListPolicyTemplateVersionsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListPolicyTemplateVersionsOptions() { } - - protected ListPolicyTemplateVersionsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - policyTemplateId = builder.policyTemplateId; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListPolicyTemplateVersionsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the state. - * - * The policy template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java deleted file mode 100644 index f230c9bd549..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java +++ /dev/null @@ -1,379 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listPolicyTemplates options. - */ -public class ListPolicyTemplatesOptions extends GenericModel { - - /** - * The policy template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - /** - * Service type, Optional. - */ - public interface PolicyServiceType { - /** service. */ - String SERVICE = "service"; - /** platform_service. */ - String PLATFORM_SERVICE = "platform_service"; - } - - /** - * Policy type, Optional. - */ - public interface PolicyType { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - protected String accountId; - protected String acceptLanguage; - protected String state; - protected String name; - protected String policyServiceType; - protected String policyServiceName; - protected String policyServiceGroupId; - protected String policyType; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String state; - private String name; - private String policyServiceType; - private String policyServiceName; - private String policyServiceGroupId; - private String policyType; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListPolicyTemplatesOptions instance. - * - * @param listPolicyTemplatesOptions the instance to initialize the Builder with - */ - private Builder(ListPolicyTemplatesOptions listPolicyTemplatesOptions) { - this.accountId = listPolicyTemplatesOptions.accountId; - this.acceptLanguage = listPolicyTemplatesOptions.acceptLanguage; - this.state = listPolicyTemplatesOptions.state; - this.name = listPolicyTemplatesOptions.name; - this.policyServiceType = listPolicyTemplatesOptions.policyServiceType; - this.policyServiceName = listPolicyTemplatesOptions.policyServiceName; - this.policyServiceGroupId = listPolicyTemplatesOptions.policyServiceGroupId; - this.policyType = listPolicyTemplatesOptions.policyType; - this.limit = listPolicyTemplatesOptions.limit; - this.start = listPolicyTemplatesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListPolicyTemplatesOptions. - * - * @return the new ListPolicyTemplatesOptions instance - */ - public ListPolicyTemplatesOptions build() { - return new ListPolicyTemplatesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListPolicyTemplatesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListPolicyTemplatesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListPolicyTemplatesOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ListPolicyTemplatesOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the policyServiceType. - * - * @param policyServiceType the policyServiceType - * @return the ListPolicyTemplatesOptions builder - */ - public Builder policyServiceType(String policyServiceType) { - this.policyServiceType = policyServiceType; - return this; - } - - /** - * Set the policyServiceName. - * - * @param policyServiceName the policyServiceName - * @return the ListPolicyTemplatesOptions builder - */ - public Builder policyServiceName(String policyServiceName) { - this.policyServiceName = policyServiceName; - return this; - } - - /** - * Set the policyServiceGroupId. - * - * @param policyServiceGroupId the policyServiceGroupId - * @return the ListPolicyTemplatesOptions builder - */ - public Builder policyServiceGroupId(String policyServiceGroupId) { - this.policyServiceGroupId = policyServiceGroupId; - return this; - } - - /** - * Set the policyType. - * - * @param policyType the policyType - * @return the ListPolicyTemplatesOptions builder - */ - public Builder policyType(String policyType) { - this.policyType = policyType; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListPolicyTemplatesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListPolicyTemplatesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListPolicyTemplatesOptions() { } - - protected ListPolicyTemplatesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - state = builder.state; - name = builder.name; - policyServiceType = builder.policyServiceType; - policyServiceName = builder.policyServiceName; - policyServiceGroupId = builder.policyServiceGroupId; - policyType = builder.policyType; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListPolicyTemplatesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the policy templates belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the state. - * - * The policy template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the name. - * - * The policy template name. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the policyServiceType. - * - * Service type, Optional. - * - * @return the policyServiceType - */ - public String policyServiceType() { - return policyServiceType; - } - - /** - * Gets the policyServiceName. - * - * Service name, Optional. - * - * @return the policyServiceName - */ - public String policyServiceName() { - return policyServiceName; - } - - /** - * Gets the policyServiceGroupId. - * - * Service group id, Optional. - * - * @return the policyServiceGroupId - */ - public String policyServiceGroupId() { - return policyServiceGroupId; - } - - /** - * Gets the policyType. - * - * Policy type, Optional. - * - * @return the policyType - */ - public String policyType() { - return policyType; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java deleted file mode 100644 index adcb3f0cc90..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listRoleAssignments options. - */ -public class ListRoleAssignmentsOptions extends GenericModel { - - protected String accountId; - protected String acceptLanguage; - protected String templateId; - protected String templateVersion; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String templateId; - private String templateVersion; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListRoleAssignmentsOptions instance. - * - * @param listRoleAssignmentsOptions the instance to initialize the Builder with - */ - private Builder(ListRoleAssignmentsOptions listRoleAssignmentsOptions) { - this.accountId = listRoleAssignmentsOptions.accountId; - this.acceptLanguage = listRoleAssignmentsOptions.acceptLanguage; - this.templateId = listRoleAssignmentsOptions.templateId; - this.templateVersion = listRoleAssignmentsOptions.templateVersion; - this.limit = listRoleAssignmentsOptions.limit; - this.start = listRoleAssignmentsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListRoleAssignmentsOptions. - * - * @return the new ListRoleAssignmentsOptions instance - */ - public ListRoleAssignmentsOptions build() { - return new ListRoleAssignmentsOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListRoleAssignmentsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListRoleAssignmentsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the templateId. - * - * @param templateId the templateId - * @return the ListRoleAssignmentsOptions builder - */ - public Builder templateId(String templateId) { - this.templateId = templateId; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the ListRoleAssignmentsOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListRoleAssignmentsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListRoleAssignmentsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListRoleAssignmentsOptions() { } - - protected ListRoleAssignmentsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - templateId = builder.templateId; - templateVersion = builder.templateVersion; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListRoleAssignmentsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID in which the role assignment belongs to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the templateId. - * - * Optional template ID. - * - * @return the templateId - */ - public String templateId() { - return templateId; - } - - /** - * Gets the templateVersion. - * - * Optional role template version. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java deleted file mode 100644 index e22751433e5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listRoleTemplateVersions options. - */ -public class ListRoleTemplateVersionsOptions extends GenericModel { - - /** - * Role template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String roleTemplateId; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListRoleTemplateVersionsOptions instance. - * - * @param listRoleTemplateVersionsOptions the instance to initialize the Builder with - */ - private Builder(ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions) { - this.roleTemplateId = listRoleTemplateVersionsOptions.roleTemplateId; - this.state = listRoleTemplateVersionsOptions.state; - this.limit = listRoleTemplateVersionsOptions.limit; - this.start = listRoleTemplateVersionsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - */ - public Builder(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - } - - /** - * Builds a ListRoleTemplateVersionsOptions. - * - * @return the new ListRoleTemplateVersionsOptions instance - */ - public ListRoleTemplateVersionsOptions build() { - return new ListRoleTemplateVersionsOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the ListRoleTemplateVersionsOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListRoleTemplateVersionsOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListRoleTemplateVersionsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListRoleTemplateVersionsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListRoleTemplateVersionsOptions() { } - - protected ListRoleTemplateVersionsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - roleTemplateId = builder.roleTemplateId; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListRoleTemplateVersionsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * The role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the state. - * - * Role template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java deleted file mode 100644 index 8f889bdce96..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java +++ /dev/null @@ -1,307 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listRoleTemplates options. - */ -public class ListRoleTemplatesOptions extends GenericModel { - - /** - * The role template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String accountId; - protected String acceptLanguage; - protected String name; - protected String roleName; - protected String roleServiceName; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String name; - private String roleName; - private String roleServiceName; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListRoleTemplatesOptions instance. - * - * @param listRoleTemplatesOptions the instance to initialize the Builder with - */ - private Builder(ListRoleTemplatesOptions listRoleTemplatesOptions) { - this.accountId = listRoleTemplatesOptions.accountId; - this.acceptLanguage = listRoleTemplatesOptions.acceptLanguage; - this.name = listRoleTemplatesOptions.name; - this.roleName = listRoleTemplatesOptions.roleName; - this.roleServiceName = listRoleTemplatesOptions.roleServiceName; - this.state = listRoleTemplatesOptions.state; - this.limit = listRoleTemplatesOptions.limit; - this.start = listRoleTemplatesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListRoleTemplatesOptions. - * - * @return the new ListRoleTemplatesOptions instance - */ - public ListRoleTemplatesOptions build() { - return new ListRoleTemplatesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListRoleTemplatesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListRoleTemplatesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ListRoleTemplatesOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the roleName. - * - * @param roleName the roleName - * @return the ListRoleTemplatesOptions builder - */ - public Builder roleName(String roleName) { - this.roleName = roleName; - return this; - } - - /** - * Set the roleServiceName. - * - * @param roleServiceName the roleServiceName - * @return the ListRoleTemplatesOptions builder - */ - public Builder roleServiceName(String roleServiceName) { - this.roleServiceName = roleServiceName; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListRoleTemplatesOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListRoleTemplatesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListRoleTemplatesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListRoleTemplatesOptions() { } - - protected ListRoleTemplatesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - name = builder.name; - roleName = builder.roleName; - roleServiceName = builder.roleServiceName; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListRoleTemplatesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the role templates belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the name. - * - * The role template name. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the roleName. - * - * The template role name. - * - * @return the roleName - */ - public String roleName() { - return roleName; - } - - /** - * Gets the roleServiceName. - * - * The template role service name. - * - * @return the roleServiceName - */ - public String roleServiceName() { - return roleServiceName; - } - - /** - * Gets the state. - * - * The role template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java deleted file mode 100644 index 2ca364c53a3..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listRoles options. - */ -public class ListRolesOptions extends GenericModel { - - protected String acceptLanguage; - protected String accountId; - protected String serviceName; - protected String sourceServiceName; - protected String policyType; - protected String serviceGroupId; - - /** - * Builder. - */ - public static class Builder { - private String acceptLanguage; - private String accountId; - private String serviceName; - private String sourceServiceName; - private String policyType; - private String serviceGroupId; - - /** - * Instantiates a new Builder from an existing ListRolesOptions instance. - * - * @param listRolesOptions the instance to initialize the Builder with - */ - private Builder(ListRolesOptions listRolesOptions) { - this.acceptLanguage = listRolesOptions.acceptLanguage; - this.accountId = listRolesOptions.accountId; - this.serviceName = listRolesOptions.serviceName; - this.sourceServiceName = listRolesOptions.sourceServiceName; - this.policyType = listRolesOptions.policyType; - this.serviceGroupId = listRolesOptions.serviceGroupId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a ListRolesOptions. - * - * @return the new ListRolesOptions instance - */ - public ListRolesOptions build() { - return new ListRolesOptions(this); - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListRolesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListRolesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the ListRolesOptions builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the sourceServiceName. - * - * @param sourceServiceName the sourceServiceName - * @return the ListRolesOptions builder - */ - public Builder sourceServiceName(String sourceServiceName) { - this.sourceServiceName = sourceServiceName; - return this; - } - - /** - * Set the policyType. - * - * @param policyType the policyType - * @return the ListRolesOptions builder - */ - public Builder policyType(String policyType) { - this.policyType = policyType; - return this; - } - - /** - * Set the serviceGroupId. - * - * @param serviceGroupId the serviceGroupId - * @return the ListRolesOptions builder - */ - public Builder serviceGroupId(String serviceGroupId) { - this.serviceGroupId = serviceGroupId; - return this; - } - } - - protected ListRolesOptions() { } - - protected ListRolesOptions(Builder builder) { - acceptLanguage = builder.acceptLanguage; - accountId = builder.accountId; - serviceName = builder.serviceName; - sourceServiceName = builder.sourceServiceName; - policyType = builder.policyType; - serviceGroupId = builder.serviceGroupId; - } - - /** - * New builder. - * - * @return a ListRolesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the accountId. - * - * Optional account GUID in which the roles belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the serviceName. - * - * Optional name of IAM enabled service. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the sourceServiceName. - * - * Optional name of source IAM enabled service. - * - * @return the sourceServiceName - */ - public String sourceServiceName() { - return sourceServiceName; - } - - /** - * Gets the policyType. - * - * Optional Policy Type. - * - * @return the policyType - */ - public String policyType() { - return policyType; - } - - /** - * Gets the serviceGroupId. - * - * Optional id of service group. - * - * @return the serviceGroupId - */ - public String serviceGroupId() { - return serviceGroupId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java deleted file mode 100644 index 65849c3d9a6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java +++ /dev/null @@ -1,492 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listV2Policies options. - */ -public class ListV2PoliciesOptions extends GenericModel { - - /** - * Optional type of policy. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - /** - * Optional type of service. - */ - public interface ServiceType { - /** service. */ - String SERVICE = "service"; - /** platform_service. */ - String PLATFORM_SERVICE = "platform_service"; - } - - /** - * Include additional data per policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles and translations for all - * relevant fields. - */ - public interface Format { - /** include_last_permit. */ - String INCLUDE_LAST_PERMIT = "include_last_permit"; - /** display. */ - String DISPLAY = "display"; - } - - /** - * The state of the policy. - * * `active` - returns active policies - * * `deleted` - returns non-active policies. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String accountId; - protected String acceptLanguage; - protected String iamId; - protected String accessGroupId; - protected String type; - protected String serviceType; - protected String serviceName; - protected String serviceGroupId; - protected String sort; - protected String format; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String iamId; - private String accessGroupId; - private String type; - private String serviceType; - private String serviceName; - private String serviceGroupId; - private String sort; - private String format; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListV2PoliciesOptions instance. - * - * @param listV2PoliciesOptions the instance to initialize the Builder with - */ - private Builder(ListV2PoliciesOptions listV2PoliciesOptions) { - this.accountId = listV2PoliciesOptions.accountId; - this.acceptLanguage = listV2PoliciesOptions.acceptLanguage; - this.iamId = listV2PoliciesOptions.iamId; - this.accessGroupId = listV2PoliciesOptions.accessGroupId; - this.type = listV2PoliciesOptions.type; - this.serviceType = listV2PoliciesOptions.serviceType; - this.serviceName = listV2PoliciesOptions.serviceName; - this.serviceGroupId = listV2PoliciesOptions.serviceGroupId; - this.sort = listV2PoliciesOptions.sort; - this.format = listV2PoliciesOptions.format; - this.state = listV2PoliciesOptions.state; - this.limit = listV2PoliciesOptions.limit; - this.start = listV2PoliciesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListV2PoliciesOptions. - * - * @return the new ListV2PoliciesOptions instance - */ - public ListV2PoliciesOptions build() { - return new ListV2PoliciesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListV2PoliciesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListV2PoliciesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the iamId. - * - * @param iamId the iamId - * @return the ListV2PoliciesOptions builder - */ - public Builder iamId(String iamId) { - this.iamId = iamId; - return this; - } - - /** - * Set the accessGroupId. - * - * @param accessGroupId the accessGroupId - * @return the ListV2PoliciesOptions builder - */ - public Builder accessGroupId(String accessGroupId) { - this.accessGroupId = accessGroupId; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the ListV2PoliciesOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the serviceType. - * - * @param serviceType the serviceType - * @return the ListV2PoliciesOptions builder - */ - public Builder serviceType(String serviceType) { - this.serviceType = serviceType; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the ListV2PoliciesOptions builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the serviceGroupId. - * - * @param serviceGroupId the serviceGroupId - * @return the ListV2PoliciesOptions builder - */ - public Builder serviceGroupId(String serviceGroupId) { - this.serviceGroupId = serviceGroupId; - return this; - } - - /** - * Set the sort. - * - * @param sort the sort - * @return the ListV2PoliciesOptions builder - */ - public Builder sort(String sort) { - this.sort = sort; - return this; - } - - /** - * Set the format. - * - * @param format the format - * @return the ListV2PoliciesOptions builder - */ - public Builder format(String format) { - this.format = format; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListV2PoliciesOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListV2PoliciesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListV2PoliciesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListV2PoliciesOptions() { } - - protected ListV2PoliciesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - iamId = builder.iamId; - accessGroupId = builder.accessGroupId; - type = builder.type; - serviceType = builder.serviceType; - serviceName = builder.serviceName; - serviceGroupId = builder.serviceGroupId; - sort = builder.sort; - format = builder.format; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListV2PoliciesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID in which the policies belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the iamId. - * - * Optional IAM ID used to identify the subject. - * - * @return the iamId - */ - public String iamId() { - return iamId; - } - - /** - * Gets the accessGroupId. - * - * Optional access group id. - * - * @return the accessGroupId - */ - public String accessGroupId() { - return accessGroupId; - } - - /** - * Gets the type. - * - * Optional type of policy. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the serviceType. - * - * Optional type of service. - * - * @return the serviceType - */ - public String serviceType() { - return serviceType; - } - - /** - * Gets the serviceName. - * - * Optional name of service. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the serviceGroupId. - * - * Optional ID of service group. - * - * @return the serviceGroupId - */ - public String serviceGroupId() { - return serviceGroupId; - } - - /** - * Gets the sort. - * - * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending - * '-' to field, for example, '-last_modified_at'. Note that last permit information is only included when - * 'format=include_last_permit', for example, "format=include_last_permit&sort=last_permit_at" Example fields that - * can be sorted on: - * - 'id' - * - 'type' - * - 'href' - * - 'created_at' - * - 'created_by_id' - * - 'last_modified_at' - * - 'last_modified_by_id' - * - 'state' - * - 'last_permit_at' - * - 'last_permit_frequency'. - * - * @return the sort - */ - public String sort() { - return sort; - } - - /** - * Gets the format. - * - * Include additional data per policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles and translations for all - * relevant fields. - * - * @return the format - */ - public String format() { - return format; - } - - /** - * Gets the state. - * - * The state of the policy. - * * `active` - returns active policies - * * `deleted` - returns non-active policies. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java deleted file mode 100644 index 4d43d84dbba..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Condition that specifies additional conditions or RuleAttribute to grant access. - * - * Classes which extend this class: - * - NestedConditionRuleAttribute - * - NestedConditionRuleWithConditions - */ -public class NestedCondition extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - protected String key; - protected String operator; - protected Object value; - protected List conditions; - - protected NestedCondition() { } - - /** - * Gets the key. - * - * The name of an attribute. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } - - /** - * Gets the conditions. - * - * List of conditions associated with a policy. For example, time-based conditions that grant access over a certain - * time period. - * - * @return the conditions - */ - public List conditions() { - return conditions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java deleted file mode 100644 index b1d44da3f6b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * Rule that specifies additional access that is granted (For example, time-based condition). - */ -public class NestedConditionRuleAttribute extends NestedCondition { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing NestedConditionRuleAttribute instance. - * - * @param nestedConditionRuleAttribute the instance to initialize the Builder with - */ - public Builder(NestedCondition nestedConditionRuleAttribute) { - this.key = nestedConditionRuleAttribute.key; - this.operator = nestedConditionRuleAttribute.operator; - this.value = nestedConditionRuleAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a NestedConditionRuleAttribute. - * - * @return the new NestedConditionRuleAttribute instance - */ - public NestedConditionRuleAttribute build() { - return new NestedConditionRuleAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the NestedConditionRuleAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the NestedConditionRuleAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the NestedConditionRuleAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected NestedConditionRuleAttribute() { } - - protected NestedConditionRuleAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a NestedConditionRuleAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java deleted file mode 100644 index 20d0faac795..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * Rule that specifies additional access that is granted (for example, time-based condition) accross multiple - * conditions. - */ -public class NestedConditionRuleWithConditions extends NestedCondition { - - /** - * Operator to evaluate conditions. - */ - public interface Operator { - /** and. */ - String AND = "and"; - /** or. */ - String OR = "or"; - } - - - /** - * Builder. - */ - public static class Builder { - private String operator; - private List conditions; - - /** - * Instantiates a new Builder from an existing NestedConditionRuleWithConditions instance. - * - * @param nestedConditionRuleWithConditions the instance to initialize the Builder with - */ - public Builder(NestedCondition nestedConditionRuleWithConditions) { - this.operator = nestedConditionRuleWithConditions.operator; - this.conditions = nestedConditionRuleWithConditions.conditions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param operator the operator - * @param conditions the conditions - */ - public Builder(String operator, List conditions) { - this.operator = operator; - this.conditions = conditions; - } - - /** - * Builds a NestedConditionRuleWithConditions. - * - * @return the new NestedConditionRuleWithConditions instance - */ - public NestedConditionRuleWithConditions build() { - return new NestedConditionRuleWithConditions(this); - } - - /** - * Adds a new element to conditions. - * - * @param conditions the new element to be added - * @return the NestedConditionRuleWithConditions builder - */ - public Builder addConditions(RuleAttribute conditions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(conditions, - "conditions cannot be null"); - if (this.conditions == null) { - this.conditions = new ArrayList(); - } - this.conditions.add(conditions); - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the NestedConditionRuleWithConditions builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the conditions. - * Existing conditions will be replaced. - * - * @param conditions the conditions - * @return the NestedConditionRuleWithConditions builder - */ - public Builder conditions(List conditions) { - this.conditions = conditions; - return this; - } - } - - protected NestedConditionRuleWithConditions() { } - - protected NestedConditionRuleWithConditions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.conditions, - "conditions cannot be null"); - operator = builder.operator; - conditions = builder.conditions; - } - - /** - * New builder. - * - * @return a NestedConditionRuleWithConditions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java deleted file mode 100644 index b0442f902bc..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Details with href linking to the following page of requested collection. - */ -public class Next extends GenericModel { - - protected String href; - protected String start; - - protected Next() { } - - /** - * Gets the href. - * - * The href linking to the page of requested collection. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection. - * - * @return the start - */ - public String getStart() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java deleted file mode 100644 index 8f12053c72e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * PoliciesPager can be used to simplify the use of the "listPolicies" method. - */ -public class PoliciesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListPoliciesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected PoliciesPager() { } - - /** - * Constructs a new PoliciesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listPolicies" method - * @param options the ListPoliciesOptions instance to be used to invoke the "listPolicies" method - */ - public PoliciesPager(IamPolicyManagement client, ListPoliciesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<PolicyTemplateMetaData> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListPoliciesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - PolicyCollection result = client.listPolicies(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getPolicies(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<PolicyTemplateMetaData> containing all results returned by the "listPolicies" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java deleted file mode 100644 index af852b7cd74..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with a policy. - */ -public class Policy extends GenericModel { - - /** - * The policy state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String id; - protected String type; - protected String description; - protected List subjects; - protected List roles; - protected List resources; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String state; - - protected Policy() { } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Gets the description. - * - * Customer-defined description. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the subjects. - * - * The subjects associated with a policy. - * - * @return the subjects - */ - public List getSubjects() { - return subjects; - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List getRoles() { - return roles; - } - - /** - * Gets the resources. - * - * The resources associated with a policy. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the href. - * - * The href links back to the policy. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the state. - * - * The policy state. - * - * @return the state - */ - public String getState() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java deleted file mode 100644 index 3e566ce7bdf..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Set of properties for the assigned resource. - */ -public class PolicyAssignmentResourcePolicy extends GenericModel { - - @SerializedName("resource_created") - protected AssignmentResourceCreated resourceCreated; - protected String status; - @SerializedName("error_message") - protected AssignmentResourceError errorMessage; - - protected PolicyAssignmentResourcePolicy() { } - - /** - * Gets the resourceCreated. - * - * On success, includes the policy that is assigned. - * - * @return the resourceCreated - */ - public AssignmentResourceCreated getResourceCreated() { - return resourceCreated; - } - - /** - * Gets the status. - * - * policy status. - * - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * Gets the errorMessage. - * - * Body parameters for assignment error. - * - * @return the errorMessage - */ - public AssignmentResourceError getErrorMessage() { - return errorMessage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java deleted file mode 100644 index ad944536b0d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The policy assignment resources. - */ -public class PolicyAssignmentResources extends GenericModel { - - protected String target; - protected PolicyAssignmentResourcePolicy policy; - - protected PolicyAssignmentResources() { } - - /** - * Gets the target. - * - * Account ID where resources are assigned. - * - * @return the target - */ - public String getTarget() { - return target; - } - - /** - * Gets the policy. - * - * Set of properties for the assigned resource. - * - * @return the policy - */ - public PolicyAssignmentResourcePolicy getPolicy() { - return policy; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java deleted file mode 100644 index f1ea295713c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the policy template assignment. - */ -public class PolicyAssignmentV1 extends GenericModel { - - /** - * The policy assignment status. - */ - public interface Status { - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** succeeded. */ - String SUCCEEDED = "succeeded"; - /** succeed_with_errors. */ - String SUCCEED_WITH_ERRORS = "succeed_with_errors"; - /** failed. */ - String FAILED = "failed"; - } - - protected AssignmentTargetDetails target; - protected String id; - @SerializedName("account_id") - protected String accountId; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected List resources; - protected PolicyAssignmentV1Subject subject; - protected AssignmentTemplateDetails template; - protected String status; - - protected PolicyAssignmentV1() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the id. - * - * Policy assignment ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the accountId. - * - * The account GUID that the policies assignments belong to. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the href. - * - * The href URL that links to the policies assignments API by policy assignment ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy assignment was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy assignment. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy assignment was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy assignment. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the resources. - * - * Object for each account assigned. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the subject. - * - * Subject details of access type assignment. - * - * @return the subject - */ - public PolicyAssignmentV1Subject getSubject() { - return subject; - } - - /** - * Gets the template. - * - * policy template details. - * - * @return the template - */ - public AssignmentTemplateDetails getTemplate() { - return template; - } - - /** - * Gets the status. - * - * The policy assignment status. - * - * @return the status - */ - public String getStatus() { - return status; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java deleted file mode 100644 index 7331ee5a854..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Policy assignment response. - */ -public class PolicyAssignmentV1Collection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List assignments; - - protected PolicyAssignmentV1Collection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the assignments. - * - * Response of policy assignments. - * - * @return the assignments - */ - public List getAssignments() { - return assignments; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java deleted file mode 100644 index c05eb90816b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The policy assignment resources. - */ -public class PolicyAssignmentV1Resources extends GenericModel { - - protected AssignmentTargetDetails target; - protected PolicyAssignmentResourcePolicy policy; - - protected PolicyAssignmentV1Resources() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the policy. - * - * Set of properties for the assigned resource. - * - * @return the policy - */ - public PolicyAssignmentResourcePolicy getPolicy() { - return policy; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java deleted file mode 100644 index 58b2cd240ba..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Subject details of access type assignment. - */ -public class PolicyAssignmentV1Subject extends GenericModel { - - /** - * The identity type of the subject of the assignment. - */ - public interface Type { - /** iam_id. */ - String IAM_ID = "iam_id"; - /** access_group_id. */ - String ACCESS_GROUP_ID = "access_group_id"; - } - - protected String id; - protected String type; - - protected PolicyAssignmentV1Subject() { } - - /** - * Gets the id. - * - * The unique identifier of the subject of the assignment. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the type. - * - * The identity type of the subject of the assignment. - * - * @return the type - */ - public String getType() { - return type; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java deleted file mode 100644 index 931769daed5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * PolicyAssignmentsPager can be used to simplify the use of the "listPolicyAssignments" method. - */ -public class PolicyAssignmentsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListPolicyAssignmentsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected PolicyAssignmentsPager() { } - - /** - * Constructs a new PolicyAssignmentsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyAssignments" method - * @param options the ListPolicyAssignmentsOptions instance to be used to invoke the "listPolicyAssignments" method - */ - public PolicyAssignmentsPager(IamPolicyManagement client, ListPolicyAssignmentsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<PolicyTemplateAssignmentItems> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListPolicyAssignmentsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - PolicyTemplateAssignmentCollection result = client.listPolicyAssignments(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getAssignments(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<PolicyTemplateAssignmentItems> containing all results returned by the "listPolicyAssignments" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java deleted file mode 100644 index 25062dd0a52..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of policies. - */ -public class PolicyCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List policies; - - protected PolicyCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the policies. - * - * List of policies. - * - * @return the policies - */ - public List getPolicies() { - return policies; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java deleted file mode 100644 index 4033f2dbc9d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The attributes of the resource. Note that only one resource is allowed in a policy. - */ -public class PolicyResource extends GenericModel { - - protected List attributes; - protected List tags; - - /** - * Builder. - */ - public static class Builder { - private List attributes; - private List tags; - - /** - * Instantiates a new Builder from an existing PolicyResource instance. - * - * @param policyResource the instance to initialize the Builder with - */ - private Builder(PolicyResource policyResource) { - this.attributes = policyResource.attributes; - this.tags = policyResource.tags; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param attributes the attributes - */ - public Builder(List attributes) { - this.attributes = attributes; - } - - /** - * Builds a PolicyResource. - * - * @return the new PolicyResource instance - */ - public PolicyResource build() { - return new PolicyResource(this); - } - - /** - * Adds a new element to attributes. - * - * @param attributes the new element to be added - * @return the PolicyResource builder - */ - public Builder addAttributes(ResourceAttribute attributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, - "attributes cannot be null"); - if (this.attributes == null) { - this.attributes = new ArrayList(); - } - this.attributes.add(attributes); - return this; - } - - /** - * Adds a new element to tags. - * - * @param tags the new element to be added - * @return the PolicyResource builder - */ - public Builder addTags(ResourceTag tags) { - com.ibm.cloud.sdk.core.util.Validator.notNull(tags, - "tags cannot be null"); - if (this.tags == null) { - this.tags = new ArrayList(); - } - this.tags.add(tags); - return this; - } - - /** - * Set the attributes. - * Existing attributes will be replaced. - * - * @param attributes the attributes - * @return the PolicyResource builder - */ - public Builder attributes(List attributes) { - this.attributes = attributes; - return this; - } - - /** - * Set the tags. - * Existing tags will be replaced. - * - * @param tags the tags - * @return the PolicyResource builder - */ - public Builder tags(List tags) { - this.tags = tags; - return this; - } - } - - protected PolicyResource() { } - - protected PolicyResource(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, - "attributes cannot be null"); - attributes = builder.attributes; - tags = builder.tags; - } - - /** - * New builder. - * - * @return a PolicyResource builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the attributes. - * - * List of resource attributes. - * - * @return the attributes - */ - public List attributes() { - return attributes; - } - - /** - * Gets the tags. - * - * List of access management tags. - * - * @return the tags - */ - public List tags() { - return tags; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java deleted file mode 100644 index 7319eabce7b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role associated with a policy. - */ -public class PolicyRole extends GenericModel { - - @SerializedName("role_id") - protected String roleId; - @SerializedName("display_name") - protected String displayName; - protected String description; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - - /** - * Instantiates a new Builder from an existing PolicyRole instance. - * - * @param policyRole the instance to initialize the Builder with - */ - private Builder(PolicyRole policyRole) { - this.roleId = policyRole.roleId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - */ - public Builder(String roleId) { - this.roleId = roleId; - } - - /** - * Builds a PolicyRole. - * - * @return the new PolicyRole instance - */ - public PolicyRole build() { - return new PolicyRole(this); - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the PolicyRole builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - } - - protected PolicyRole() { } - - protected PolicyRole(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleId, - "roleId cannot be null"); - roleId = builder.roleId; - } - - /** - * New builder. - * - * @return a PolicyRole builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } - - /** - * Gets the displayName. - * - * The display name of the role. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String description() { - return description; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java deleted file mode 100644 index bf1b035a6b7..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The subject attribute values that must match in order for this policy to apply in a permission decision. - */ -public class PolicySubject extends GenericModel { - - protected List attributes; - - /** - * Builder. - */ - public static class Builder { - private List attributes; - - /** - * Instantiates a new Builder from an existing PolicySubject instance. - * - * @param policySubject the instance to initialize the Builder with - */ - private Builder(PolicySubject policySubject) { - this.attributes = policySubject.attributes; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param attributes the attributes - */ - public Builder(List attributes) { - this.attributes = attributes; - } - - /** - * Builds a PolicySubject. - * - * @return the new PolicySubject instance - */ - public PolicySubject build() { - return new PolicySubject(this); - } - - /** - * Adds a new element to attributes. - * - * @param attributes the new element to be added - * @return the PolicySubject builder - */ - public Builder addAttributes(SubjectAttribute attributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, - "attributes cannot be null"); - if (this.attributes == null) { - this.attributes = new ArrayList(); - } - this.attributes.add(attributes); - return this; - } - - /** - * Set the attributes. - * Existing attributes will be replaced. - * - * @param attributes the attributes - * @return the PolicySubject builder - */ - public Builder attributes(List attributes) { - this.attributes = attributes; - return this; - } - } - - protected PolicySubject() { } - - protected PolicySubject(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, - "attributes cannot be null"); - attributes = builder.attributes; - } - - /** - * New builder. - * - * @return a PolicySubject builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the attributes. - * - * List of subject attributes. - * - * @return the attributes - */ - public List attributes() { - return attributes; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java deleted file mode 100644 index bdffbe98c10..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the policy template. - */ -public class PolicyTemplate extends GenericModel { - - /** - * State of policy template. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String name; - protected String description; - @SerializedName("account_id") - protected String accountId; - protected String version; - protected Boolean committed; - protected TemplatePolicy policy; - protected String state; - protected String id; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - - protected PolicyTemplate() { } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the version. - * - * Template version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the committed. - * - * Committed status of the template version. - * - * @return the committed - */ - public Boolean isCommitted() { - return committed; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy getPolicy() { - return policy; - } - - /** - * Gets the state. - * - * State of policy template. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the id. - * - * The policy template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the policy templates API by policy template ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy template was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy template. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy template was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy template. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java deleted file mode 100644 index 54727eadf4d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of policies assignments. - */ -public class PolicyTemplateAssignmentCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List assignments; - - protected PolicyTemplateAssignmentCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the assignments. - * - * List of policy assignments. - * - * @return the assignments - */ - public List getAssignments() { - return assignments; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java deleted file mode 100644 index 2c8e82df441..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * PolicyTemplateAssignmentItems. - * - * Classes which extend this class: - * - PolicyTemplateAssignmentItemsPolicyAssignmentV1 - * - PolicyTemplateAssignmentItemsPolicyAssignment - */ -public class PolicyTemplateAssignmentItems extends GenericModel { - - /** - * The policy assignment status. - */ - public interface Status { - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** succeeded. */ - String SUCCEEDED = "succeeded"; - /** succeed_with_errors. */ - String SUCCEED_WITH_ERRORS = "succeed_with_errors"; - /** failed. */ - String FAILED = "failed"; - } - - /** - * Assignment target type. - */ - public interface TargetType { - /** Account. */ - String ACCOUNT = "Account"; - /** AccountGroup. */ - String ACCOUNTGROUP = "AccountGroup"; - /** Enterprise. */ - String ENTERPRISE = "Enterprise"; - } - - protected AssignmentTargetDetails target; - protected String id; - @SerializedName("account_id") - protected String accountId; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected List resources; - protected PolicyAssignmentV1Subject subject; - protected AssignmentTemplateDetails template; - protected String status; - @SerializedName("template_id") - protected String templateId; - @SerializedName("template_version") - protected String templateVersion; - @SerializedName("assignment_id") - protected String assignmentId; - @SerializedName("target_type") - protected String targetType; - - protected PolicyTemplateAssignmentItems() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the id. - * - * Policy assignment ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the accountId. - * - * The account GUID that the policies assignments belong to. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the href. - * - * The href URL that links to the policies assignments API by policy assignment ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy assignment was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy assignment. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy assignment was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy assignment. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the resources. - * - * Object for each account assigned. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the subject. - * - * Subject details of access type assignment. - * - * @return the subject - */ - public PolicyAssignmentV1Subject getSubject() { - return subject; - } - - /** - * Gets the template. - * - * policy template details. - * - * @return the template - */ - public AssignmentTemplateDetails getTemplate() { - return template; - } - - /** - * Gets the status. - * - * The policy assignment status. - * - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * Gets the templateId. - * - * policy template ID. - * - * @return the templateId - */ - public String getTemplateId() { - return templateId; - } - - /** - * Gets the templateVersion. - * - * policy template version. - * - * @return the templateVersion - */ - public String getTemplateVersion() { - return templateVersion; - } - - /** - * Gets the assignmentId. - * - * Passed in value to correlate with other assignments. - * - * @return the assignmentId - */ - public String getAssignmentId() { - return assignmentId; - } - - /** - * Gets the targetType. - * - * Assignment target type. - * - * @return the targetType - */ - public String getTargetType() { - return targetType; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java deleted file mode 100644 index ec9c32e5bdd..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * The set of properties associated with the policy template assignment. - */ -public class PolicyTemplateAssignmentItemsPolicyAssignment extends PolicyTemplateAssignmentItems { - - /** - * Assignment target type. - */ - public interface TargetType { - /** Account. */ - String ACCOUNT = "Account"; - /** AccountGroup. */ - String ACCOUNTGROUP = "AccountGroup"; - /** Enterprise. */ - String ENTERPRISE = "Enterprise"; - } - - /** - * The policy assignment status. - */ - public interface Status { - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** succeeded. */ - String SUCCEEDED = "succeeded"; - /** succeed_with_errors. */ - String SUCCEED_WITH_ERRORS = "succeed_with_errors"; - /** failed. */ - String FAILED = "failed"; - } - - - protected PolicyTemplateAssignmentItemsPolicyAssignment() { } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java deleted file mode 100644 index 4cebdbb17b1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * The set of properties associated with the policy template assignment. - */ -public class PolicyTemplateAssignmentItemsPolicyAssignmentV1 extends PolicyTemplateAssignmentItems { - - /** - * The policy assignment status. - */ - public interface Status { - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** succeeded. */ - String SUCCEEDED = "succeeded"; - /** succeed_with_errors. */ - String SUCCEED_WITH_ERRORS = "succeed_with_errors"; - /** failed. */ - String FAILED = "failed"; - } - - - protected PolicyTemplateAssignmentItemsPolicyAssignmentV1() { } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java deleted file mode 100644 index 2a262c584b5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of policy Templates. - */ -public class PolicyTemplateCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - @SerializedName("policy_templates") - protected List policyTemplates; - - protected PolicyTemplateCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the policyTemplates. - * - * List of policy templates. - * - * @return the policyTemplates - */ - public List getPolicyTemplates() { - return policyTemplates; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java deleted file mode 100644 index 5a2876dfe28..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the policy template. - */ -public class PolicyTemplateLimitData extends GenericModel { - - /** - * State of policy template. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String name; - protected String description; - @SerializedName("account_id") - protected String accountId; - protected String version; - protected Boolean committed; - protected TemplatePolicy policy; - protected String state; - protected String id; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected TemplateCountData counts; - - protected PolicyTemplateLimitData() { } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the version. - * - * Template version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the committed. - * - * Committed status of the template version. - * - * @return the committed - */ - public Boolean isCommitted() { - return committed; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy getPolicy() { - return policy; - } - - /** - * Gets the state. - * - * State of policy template. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the id. - * - * The policy template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the policy templates API by policy template ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy template was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy template. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy template was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy template. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the counts. - * - * policy template count details. - * - * @return the counts - */ - public TemplateCountData getCounts() { - return counts; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java deleted file mode 100644 index 07effc5b3ad..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with a policy. - */ -public class PolicyTemplateMetaData extends GenericModel { - - /** - * The policy state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String id; - protected String type; - protected String description; - protected List subjects; - protected List roles; - protected List resources; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String state; - protected TemplateMetadata template; - - protected PolicyTemplateMetaData() { } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Gets the description. - * - * Customer-defined description. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the subjects. - * - * The subjects associated with a policy. - * - * @return the subjects - */ - public List getSubjects() { - return subjects; - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List getRoles() { - return roles; - } - - /** - * Gets the resources. - * - * The resources associated with a policy. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the href. - * - * The href links back to the policy. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the state. - * - * The policy state. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the template. - * - * The details of the IAM template that was used to create an enterprise-managed policy in your account. When - * returned, this indicates that the policy is created from and managed by a template in the root enterprise account. - * - * @return the template - */ - public TemplateMetadata getTemplate() { - return template; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java deleted file mode 100644 index a4f95bc6562..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of versions for a specific policy template. - */ -public class PolicyTemplateVersionsCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List versions; - - protected PolicyTemplateVersionsCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the versions. - * - * List of policy templates versions. - * - * @return the versions - */ - public List getVersions() { - return versions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java deleted file mode 100644 index f6a2496cf91..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * PolicyTemplateVersionsPager can be used to simplify the use of the "listPolicyTemplateVersions" method. - */ -public class PolicyTemplateVersionsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListPolicyTemplateVersionsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected PolicyTemplateVersionsPager() { } - - /** - * Constructs a new PolicyTemplateVersionsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyTemplateVersions" method - * @param options the ListPolicyTemplateVersionsOptions instance to be used to invoke the "listPolicyTemplateVersions" method - */ - public PolicyTemplateVersionsPager(IamPolicyManagement client, ListPolicyTemplateVersionsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<PolicyTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListPolicyTemplateVersionsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - PolicyTemplateVersionsCollection result = client.listPolicyTemplateVersions(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getVersions(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<PolicyTemplate> containing all results returned by the "listPolicyTemplateVersions" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java deleted file mode 100644 index eba6e6c8fad..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * PolicyTemplatesPager can be used to simplify the use of the "listPolicyTemplates" method. - */ -public class PolicyTemplatesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListPolicyTemplatesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected PolicyTemplatesPager() { } - - /** - * Constructs a new PolicyTemplatesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyTemplates" method - * @param options the ListPolicyTemplatesOptions instance to be used to invoke the "listPolicyTemplates" method - */ - public PolicyTemplatesPager(IamPolicyManagement client, ListPolicyTemplatesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<PolicyTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListPolicyTemplatesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - PolicyTemplateCollection result = client.listPolicyTemplates(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getPolicyTemplates(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<PolicyTemplate> containing all results returned by the "listPolicyTemplates" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java deleted file mode 100644 index 2656f3fb790..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Details with linking href to previous page of requested collection. - */ -public class Previous extends GenericModel { - - protected String href; - protected String start; - - protected Previous() { } - - /** - * Gets the href. - * - * The href linking to the page of requested collection. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection. - * - * @return the start - */ - public String getStart() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java deleted file mode 100644 index 151a77e8cb9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java +++ /dev/null @@ -1,273 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replaceActionControlTemplate options. - */ -public class ReplaceActionControlTemplateOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String version; - protected String ifMatch; - protected String name; - protected String description; - protected TemplateActionControl actionControl; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String version; - private String ifMatch; - private String name; - private String description; - private TemplateActionControl actionControl; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing ReplaceActionControlTemplateOptions instance. - * - * @param replaceActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(ReplaceActionControlTemplateOptions replaceActionControlTemplateOptions) { - this.actionControlTemplateId = replaceActionControlTemplateOptions.actionControlTemplateId; - this.version = replaceActionControlTemplateOptions.version; - this.ifMatch = replaceActionControlTemplateOptions.ifMatch; - this.name = replaceActionControlTemplateOptions.name; - this.description = replaceActionControlTemplateOptions.description; - this.actionControl = replaceActionControlTemplateOptions.actionControl; - this.committed = replaceActionControlTemplateOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - * @param version the version - * @param ifMatch the ifMatch - */ - public Builder(String actionControlTemplateId, String version, String ifMatch) { - this.actionControlTemplateId = actionControlTemplateId; - this.version = version; - this.ifMatch = ifMatch; - } - - /** - * Builds a ReplaceActionControlTemplateOptions. - * - * @return the new ReplaceActionControlTemplateOptions instance - */ - public ReplaceActionControlTemplateOptions build() { - return new ReplaceActionControlTemplateOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actionControl. - * - * @param actionControl the actionControl - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder actionControl(TemplateActionControl actionControl) { - this.actionControl = actionControl; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected ReplaceActionControlTemplateOptions() { } - - protected ReplaceActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - actionControlTemplateId = builder.actionControlTemplateId; - version = builder.version; - ifMatch = builder.ifMatch; - name = builder.name; - description = builder.description; - actionControl = builder.actionControl; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a ReplaceActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating an action control template version must match the Etag value of the existing - * action control template version. The Etag can be retrieved using the GET - * /v1/action_control_templates/{template_id}/versions/{version} API and looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will - * change the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the action control template. This is shown to users in the enterprise account. Use this to describe - * the purpose or context of the action control for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actionControl. - * - * The action control properties that are created in an action resource when the template is assigned. - * - * @return the actionControl - */ - public TemplateActionControl actionControl() { - return actionControl; - } - - /** - * Gets the committed. - * - * Committed status of the template version. If committed is set to true, then the template version can no longer be - * updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java deleted file mode 100644 index 80cbe9e4c79..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java +++ /dev/null @@ -1,335 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replacePolicy options. - */ -public class ReplacePolicyOptions extends GenericModel { - - protected String policyId; - protected String ifMatch; - protected String type; - protected List subjects; - protected List roles; - protected List resources; - protected String description; - - /** - * Builder. - */ - public static class Builder { - private String policyId; - private String ifMatch; - private String type; - private List subjects; - private List roles; - private List resources; - private String description; - - /** - * Instantiates a new Builder from an existing ReplacePolicyOptions instance. - * - * @param replacePolicyOptions the instance to initialize the Builder with - */ - private Builder(ReplacePolicyOptions replacePolicyOptions) { - this.policyId = replacePolicyOptions.policyId; - this.ifMatch = replacePolicyOptions.ifMatch; - this.type = replacePolicyOptions.type; - this.subjects = replacePolicyOptions.subjects; - this.roles = replacePolicyOptions.roles; - this.resources = replacePolicyOptions.resources; - this.description = replacePolicyOptions.description; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyId the policyId - * @param ifMatch the ifMatch - * @param type the type - * @param subjects the subjects - * @param roles the roles - * @param resources the resources - */ - public Builder(String policyId, String ifMatch, String type, List subjects, List roles, List resources) { - this.policyId = policyId; - this.ifMatch = ifMatch; - this.type = type; - this.subjects = subjects; - this.roles = roles; - this.resources = resources; - } - - /** - * Builds a ReplacePolicyOptions. - * - * @return the new ReplacePolicyOptions instance - */ - public ReplacePolicyOptions build() { - return new ReplacePolicyOptions(this); - } - - /** - * Adds a new element to subjects. - * - * @param subjects the new element to be added - * @return the ReplacePolicyOptions builder - */ - public Builder addSubjects(PolicySubject subjects) { - com.ibm.cloud.sdk.core.util.Validator.notNull(subjects, - "subjects cannot be null"); - if (this.subjects == null) { - this.subjects = new ArrayList(); - } - this.subjects.add(subjects); - return this; - } - - /** - * Adds a new element to roles. - * - * @param roles the new element to be added - * @return the ReplacePolicyOptions builder - */ - public Builder addRoles(PolicyRole roles) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roles, - "roles cannot be null"); - if (this.roles == null) { - this.roles = new ArrayList(); - } - this.roles.add(roles); - return this; - } - - /** - * Adds a new element to resources. - * - * @param resources the new element to be added - * @return the ReplacePolicyOptions builder - */ - public Builder addResources(PolicyResource resources) { - com.ibm.cloud.sdk.core.util.Validator.notNull(resources, - "resources cannot be null"); - if (this.resources == null) { - this.resources = new ArrayList(); - } - this.resources.add(resources); - return this; - } - - /** - * Set the policyId. - * - * @param policyId the policyId - * @return the ReplacePolicyOptions builder - */ - public Builder policyId(String policyId) { - this.policyId = policyId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplacePolicyOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the ReplacePolicyOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the subjects. - * Existing subjects will be replaced. - * - * @param subjects the subjects - * @return the ReplacePolicyOptions builder - */ - public Builder subjects(List subjects) { - this.subjects = subjects; - return this; - } - - /** - * Set the roles. - * Existing roles will be replaced. - * - * @param roles the roles - * @return the ReplacePolicyOptions builder - */ - public Builder roles(List roles) { - this.roles = roles; - return this; - } - - /** - * Set the resources. - * Existing resources will be replaced. - * - * @param resources the resources - * @return the ReplacePolicyOptions builder - */ - public Builder resources(List resources) { - this.resources = resources; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplacePolicyOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - } - - protected ReplacePolicyOptions() { } - - protected ReplacePolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, - "policyId 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.type, - "type cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subjects, - "subjects cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, - "roles cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resources, - "resources cannot be null"); - policyId = builder.policyId; - ifMatch = builder.ifMatch; - type = builder.type; - subjects = builder.subjects; - roles = builder.roles; - resources = builder.resources; - description = builder.description; - } - - /** - * New builder. - * - * @return a ReplacePolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyId. - * - * The policy ID. - * - * @return the policyId - */ - public String policyId() { - return policyId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be - * retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the subjects. - * - * The subjects associated with a policy. - * - * @return the subjects - */ - public List subjects() { - return subjects; - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List roles() { - return roles; - } - - /** - * Gets the resources. - * - * The resources associated with a policy. - * - * @return the resources - */ - public List resources() { - return resources; - } - - /** - * Gets the description. - * - * Customer-defined description. - * - * @return the description - */ - public String description() { - return description; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java deleted file mode 100644 index 5a55c4898e5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replacePolicyTemplate options. - */ -public class ReplacePolicyTemplateOptions extends GenericModel { - - protected String policyTemplateId; - protected String version; - protected String ifMatch; - protected TemplatePolicy policy; - protected String name; - protected String description; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String version; - private String ifMatch; - private TemplatePolicy policy; - private String name; - private String description; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing ReplacePolicyTemplateOptions instance. - * - * @param replacePolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(ReplacePolicyTemplateOptions replacePolicyTemplateOptions) { - this.policyTemplateId = replacePolicyTemplateOptions.policyTemplateId; - this.version = replacePolicyTemplateOptions.version; - this.ifMatch = replacePolicyTemplateOptions.ifMatch; - this.policy = replacePolicyTemplateOptions.policy; - this.name = replacePolicyTemplateOptions.name; - this.description = replacePolicyTemplateOptions.description; - this.committed = replacePolicyTemplateOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param version the version - * @param ifMatch the ifMatch - * @param policy the policy - */ - public Builder(String policyTemplateId, String version, String ifMatch, TemplatePolicy policy) { - this.policyTemplateId = policyTemplateId; - this.version = version; - this.ifMatch = ifMatch; - this.policy = policy; - } - - /** - * Builds a ReplacePolicyTemplateOptions. - * - * @return the new ReplacePolicyTemplateOptions instance - */ - public ReplacePolicyTemplateOptions build() { - return new ReplacePolicyTemplateOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the policy. - * - * @param policy the policy - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder policy(TemplatePolicy policy) { - this.policy = policy; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected ReplacePolicyTemplateOptions() { } - - protected ReplacePolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version 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.policy, - "policy cannot be null"); - policyTemplateId = builder.policyTemplateId; - version = builder.version; - ifMatch = builder.ifMatch; - policy = builder.policy; - name = builder.name; - description = builder.description; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a ReplacePolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the version. - * - * The policy template version. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy template version and must match the Etag value of the existing policy - * template version. The Etag can be retrieved using the GET - * /v1/policy_templates/{policy_template_id}/versions/{version} API and looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy policy() { - return policy; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template version. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java deleted file mode 100644 index fc4b536103d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java +++ /dev/null @@ -1,255 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replaceRole options. - */ -public class ReplaceRoleOptions extends GenericModel { - - protected String roleId; - protected String ifMatch; - protected String displayName; - protected List actions; - protected String description; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - private String ifMatch; - private String displayName; - private List actions; - private String description; - - /** - * Instantiates a new Builder from an existing ReplaceRoleOptions instance. - * - * @param replaceRoleOptions the instance to initialize the Builder with - */ - private Builder(ReplaceRoleOptions replaceRoleOptions) { - this.roleId = replaceRoleOptions.roleId; - this.ifMatch = replaceRoleOptions.ifMatch; - this.displayName = replaceRoleOptions.displayName; - this.actions = replaceRoleOptions.actions; - this.description = replaceRoleOptions.description; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - * @param ifMatch the ifMatch - * @param displayName the displayName - * @param actions the actions - */ - public Builder(String roleId, String ifMatch, String displayName, List actions) { - this.roleId = roleId; - this.ifMatch = ifMatch; - this.displayName = displayName; - this.actions = actions; - } - - /** - * Builds a ReplaceRoleOptions. - * - * @return the new ReplaceRoleOptions instance - */ - public ReplaceRoleOptions build() { - return new ReplaceRoleOptions(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the ReplaceRoleOptions builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the ReplaceRoleOptions builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplaceRoleOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the ReplaceRoleOptions builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the ReplaceRoleOptions builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplaceRoleOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the role. - * - * @param role the role - * @return the ReplaceRoleOptions builder - */ - public Builder role(Role role) { - this.displayName = role.displayName(); - this.actions = role.actions(); - this.description = role.description(); - return this; - } - } - - protected ReplaceRoleOptions() { } - - protected ReplaceRoleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, - "roleId 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.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - roleId = builder.roleId; - ifMatch = builder.ifMatch; - displayName = builder.displayName; - actions = builder.actions; - description = builder.description; - } - - /** - * New builder. - * - * @return a ReplaceRoleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role ID. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a role and must match the ETag value of the existing role. The Etag can be - * retrieved using the GET /v2/roles/{role_id} API and looking at the ETag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List actions() { - return actions; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String description() { - return description; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java deleted file mode 100644 index 9a69b13326c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java +++ /dev/null @@ -1,273 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replaceRoleTemplate options. - */ -public class ReplaceRoleTemplateOptions extends GenericModel { - - protected String roleTemplateId; - protected String version; - protected String ifMatch; - protected String name; - protected String description; - protected TemplateRole role; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String version; - private String ifMatch; - private String name; - private String description; - private TemplateRole role; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing ReplaceRoleTemplateOptions instance. - * - * @param replaceRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(ReplaceRoleTemplateOptions replaceRoleTemplateOptions) { - this.roleTemplateId = replaceRoleTemplateOptions.roleTemplateId; - this.version = replaceRoleTemplateOptions.version; - this.ifMatch = replaceRoleTemplateOptions.ifMatch; - this.name = replaceRoleTemplateOptions.name; - this.description = replaceRoleTemplateOptions.description; - this.role = replaceRoleTemplateOptions.role; - this.committed = replaceRoleTemplateOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - * @param version the version - * @param ifMatch the ifMatch - */ - public Builder(String roleTemplateId, String version, String ifMatch) { - this.roleTemplateId = roleTemplateId; - this.version = version; - this.ifMatch = ifMatch; - } - - /** - * Builds a ReplaceRoleTemplateOptions. - * - * @return the new ReplaceRoleTemplateOptions instance - */ - public ReplaceRoleTemplateOptions build() { - return new ReplaceRoleTemplateOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the role. - * - * @param role the role - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder role(TemplateRole role) { - this.role = role; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected ReplaceRoleTemplateOptions() { } - - protected ReplaceRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - roleTemplateId = builder.roleTemplateId; - version = builder.version; - ifMatch = builder.ifMatch; - name = builder.name; - description = builder.description; - role = builder.role; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a ReplaceRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the version. - * - * Role template version. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a role template version must match the Etag value of the existing role template - * version. The Etag can be retrieved using the GET /v1/role_templates/{template_id}/versions/{version} API and - * looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will - * change the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the role template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the role for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the role. - * - * The role properties that are created in an action resource when the template is assigned. - * - * @return the role - */ - public TemplateRole role() { - return role; - } - - /** - * Gets the committed. - * - * Committed status of the template version. If committed is set to true, then the template version can no longer be - * updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java deleted file mode 100644 index 960f4782635..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java +++ /dev/null @@ -1,336 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replaceV2Policy options. - */ -public class ReplaceV2PolicyOptions extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - protected String id; - protected String ifMatch; - protected Control control; - protected String type; - protected String description; - protected V2PolicySubject subject; - protected V2PolicyResource resource; - protected String pattern; - protected V2PolicyRule rule; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String ifMatch; - private Control control; - private String type; - private String description; - private V2PolicySubject subject; - private V2PolicyResource resource; - private String pattern; - private V2PolicyRule rule; - - /** - * Instantiates a new Builder from an existing ReplaceV2PolicyOptions instance. - * - * @param replaceV2PolicyOptions the instance to initialize the Builder with - */ - private Builder(ReplaceV2PolicyOptions replaceV2PolicyOptions) { - this.id = replaceV2PolicyOptions.id; - this.ifMatch = replaceV2PolicyOptions.ifMatch; - this.control = replaceV2PolicyOptions.control; - this.type = replaceV2PolicyOptions.type; - this.description = replaceV2PolicyOptions.description; - this.subject = replaceV2PolicyOptions.subject; - this.resource = replaceV2PolicyOptions.resource; - this.pattern = replaceV2PolicyOptions.pattern; - this.rule = replaceV2PolicyOptions.rule; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param id the id - * @param ifMatch the ifMatch - * @param control the control - * @param type the type - */ - public Builder(String id, String ifMatch, Control control, String type) { - this.id = id; - this.ifMatch = ifMatch; - this.control = control; - this.type = type; - } - - /** - * Builds a ReplaceV2PolicyOptions. - * - * @return the new ReplaceV2PolicyOptions instance - */ - public ReplaceV2PolicyOptions build() { - return new ReplaceV2PolicyOptions(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the ReplaceV2PolicyOptions builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplaceV2PolicyOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the control. - * - * @param control the control - * @return the ReplaceV2PolicyOptions builder - */ - public Builder control(Control control) { - this.control = control; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the ReplaceV2PolicyOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplaceV2PolicyOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the subject. - * - * @param subject the subject - * @return the ReplaceV2PolicyOptions builder - */ - public Builder subject(V2PolicySubject subject) { - this.subject = subject; - return this; - } - - /** - * Set the resource. - * - * @param resource the resource - * @return the ReplaceV2PolicyOptions builder - */ - public Builder resource(V2PolicyResource resource) { - this.resource = resource; - return this; - } - - /** - * Set the pattern. - * - * @param pattern the pattern - * @return the ReplaceV2PolicyOptions builder - */ - public Builder pattern(String pattern) { - this.pattern = pattern; - return this; - } - - /** - * Set the rule. - * - * @param rule the rule - * @return the ReplaceV2PolicyOptions builder - */ - public Builder rule(V2PolicyRule rule) { - this.rule = rule; - return this; - } - } - - protected ReplaceV2PolicyOptions() { } - - protected ReplaceV2PolicyOptions(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.control, - "control cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - id = builder.id; - ifMatch = builder.ifMatch; - control = builder.control; - type = builder.type; - description = builder.description; - subject = builder.subject; - resource = builder.resource; - pattern = builder.pattern; - rule = builder.rule; - } - - /** - * New builder. - * - * @return a ReplaceV2PolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be - * retrieved using the GET /v2/policies/{id} API and looking at the ETag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the control. - * - * Specifies the type of access that is granted by the policy. - * - * @return the control - */ - public Control control() { - return control; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject subject() { - return subject; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource resource() { - return resource; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String pattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule rule() { - return rule; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java deleted file mode 100644 index 3a8b7e87b9e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * An attribute associated with a resource. - */ -public class ResourceAttribute extends GenericModel { - - protected String name; - protected String value; - protected String operator; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String value; - private String operator; - - /** - * Instantiates a new Builder from an existing ResourceAttribute instance. - * - * @param resourceAttribute the instance to initialize the Builder with - */ - private Builder(ResourceAttribute resourceAttribute) { - this.name = resourceAttribute.name; - this.value = resourceAttribute.value; - this.operator = resourceAttribute.operator; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param value the value - */ - public Builder(String name, String value) { - this.name = name; - this.value = value; - } - - /** - * Builds a ResourceAttribute. - * - * @return the new ResourceAttribute instance - */ - public ResourceAttribute build() { - return new ResourceAttribute(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the ResourceAttribute builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the ResourceAttribute builder - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the ResourceAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - } - - protected ResourceAttribute() { } - - protected ResourceAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - name = builder.name; - value = builder.value; - operator = builder.operator; - } - - /** - * New builder. - * - * @return a ResourceAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * The name of an attribute. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the value. - * - * The value of an attribute. - * - * @return the value - */ - public String value() { - return value; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java deleted file mode 100644 index 7da4cffee56..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A tag associated with a resource. - */ -public class ResourceTag extends GenericModel { - - protected String name; - protected String value; - protected String operator; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String value; - private String operator; - - /** - * Instantiates a new Builder from an existing ResourceTag instance. - * - * @param resourceTag the instance to initialize the Builder with - */ - private Builder(ResourceTag resourceTag) { - this.name = resourceTag.name; - this.value = resourceTag.value; - this.operator = resourceTag.operator; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param value the value - */ - public Builder(String name, String value) { - this.name = name; - this.value = value; - } - - /** - * Builds a ResourceTag. - * - * @return the new ResourceTag instance - */ - public ResourceTag build() { - return new ResourceTag(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the ResourceTag builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the ResourceTag builder - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the ResourceTag builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - } - - protected ResourceTag() { } - - protected ResourceTag(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - name = builder.name; - value = builder.value; - operator = builder.operator; - } - - /** - * New builder. - * - * @return a ResourceTag builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * The name of an access management tag. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the value. - * - * The value of an access management tag. - * - * @return the value - */ - public String value() { - return value; - } - - /** - * Gets the operator. - * - * The operator of an access management tag. - * - * @return the operator - */ - public String operator() { - return operator; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java deleted file mode 100644 index 24b99c9bd08..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role resource. - */ -public class Role extends GenericModel { - - @SerializedName("display_name") - protected String displayName; - protected String description; - protected List actions; - protected String crn; - - /** - * Builder. - */ - public static class Builder { - private String displayName; - private String description; - private List actions; - - /** - * Instantiates a new Builder from an existing Role instance. - * - * @param role the instance to initialize the Builder with - */ - private Builder(Role role) { - this.displayName = role.displayName; - this.description = role.description; - this.actions = role.actions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param displayName the displayName - * @param actions the actions - */ - public Builder(String displayName, List actions) { - this.displayName = displayName; - this.actions = actions; - } - - /** - * Builds a Role. - * - * @return the new Role instance - */ - public Role build() { - return new Role(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the Role builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the Role builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the Role builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the Role builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - } - - protected Role() { } - - protected Role(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - displayName = builder.displayName; - description = builder.description; - actions = builder.actions; - } - - /** - * New builder. - * - * @return a Role builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List actions() { - return actions; - } - - /** - * Gets the crn. - * - * The role Cloud Resource Name (CRN). Example CRN: - * 'crn:v1:ibmcloud:public:iam-access-management::a/exampleAccountId::customRole:ExampleRoleName'. - * - * @return the crn - */ - public String crn() { - return crn; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java deleted file mode 100644 index 9169fc88572..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * An action that can be performed by the policy subject when assigned a role. - */ -public class RoleAction extends GenericModel { - - protected String id; - @SerializedName("display_name") - protected String displayName; - protected String description; - - protected RoleAction() { } - - /** - * Gets the id. - * - * Unique identifier for action with structure service.resource.action. For example, cbr.rule.read. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the displayName. - * - * Services defined display name for action. - * - * @return the displayName - */ - public String getDisplayName() { - return displayName; - } - - /** - * Gets the description. - * - * Service defined description for action. - * - * @return the description - */ - public String getDescription() { - return description; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java deleted file mode 100644 index 23bb4b65c6f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the assigned role template. - */ -public class RoleAssignment extends GenericModel { - - /** - * The current operation of the role assignment. - */ - public interface Operation { - /** create. */ - String CREATE = "create"; - /** apply. */ - String APPLY = "apply"; - /** update. */ - String UPDATE = "update"; - /** remove. */ - String REMOVE = "remove"; - } - - /** - * The role assignment status. - */ - public interface Status { - /** accepted. */ - String ACCEPTED = "accepted"; - /** failure. */ - String FAILURE = "failure"; - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** superseded. */ - String SUPERSEDED = "superseded"; - } - - protected String id; - @SerializedName("account_id") - protected String accountId; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String operation; - protected List resources; - protected RoleAssignmentTemplate template; - protected AssignmentTargetDetails target; - protected String status; - - protected RoleAssignment() { } - - /** - * Gets the id. - * - * Action control assignment ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the accountId. - * - * The account GUID that the role assignments belong to. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the href. - * - * The href URL that links to the role assignments API by role assignment ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the role assignment was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the role assignment. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the role assignment was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the role assignment. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the operation. - * - * The current operation of the role assignment. - * - * @return the operation - */ - public String getOperation() { - return operation; - } - - /** - * Gets the resources. - * - * Resources created when role template is assigned. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the template. - * - * The role template id and version that will be assigned. - * - * @return the template - */ - public RoleAssignmentTemplate getTemplate() { - return template; - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the status. - * - * The role assignment status. - * - * @return the status - */ - public String getStatus() { - return status; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java deleted file mode 100644 index 658ac5b8c99..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of role assignments. - */ -public class RoleAssignmentCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List assignments; - - protected RoleAssignmentCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the assignments. - * - * List of role assignments. - * - * @return the assignments - */ - public List getAssignments() { - return assignments; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java deleted file mode 100644 index 60d7a02d604..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The role assignment resources and target where the template is assigned. - */ -public class RoleAssignmentResource extends GenericModel { - - protected AssignmentTargetDetails target; - protected RoleAssignmentResourceRole role; - - protected RoleAssignmentResource() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the role. - * - * Set of properties of the assigned resource or error message if assignment failed. - * - * @return the role - */ - public RoleAssignmentResourceRole getRole() { - return role; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java deleted file mode 100644 index 9ea359d63fb..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * On success, it includes the role assigned. - */ -public class RoleAssignmentResourceCreated extends GenericModel { - - protected String id; - - protected RoleAssignmentResourceCreated() { } - - /** - * Gets the id. - * - * role id. - * - * @return the id - */ - public String getId() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java deleted file mode 100644 index 22d40bdaef4..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Set of properties of the assigned resource or error message if assignment failed. - */ -public class RoleAssignmentResourceRole extends GenericModel { - - @SerializedName("resource_created") - protected RoleAssignmentResourceCreated resourceCreated; - @SerializedName("error_message") - protected AssignmentResourceError errorMessage; - - protected RoleAssignmentResourceRole() { } - - /** - * Gets the resourceCreated. - * - * On success, it includes the role assigned. - * - * @return the resourceCreated - */ - public RoleAssignmentResourceCreated getResourceCreated() { - return resourceCreated; - } - - /** - * Gets the errorMessage. - * - * Body parameters for assignment error. - * - * @return the errorMessage - */ - public AssignmentResourceError getErrorMessage() { - return errorMessage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java deleted file mode 100644 index 3524b91f4d5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The role template id and version that will be assigned. - */ -public class RoleAssignmentTemplate extends GenericModel { - - protected String id; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String version; - - /** - * Instantiates a new Builder from an existing RoleAssignmentTemplate instance. - * - * @param roleAssignmentTemplate the instance to initialize the Builder with - */ - private Builder(RoleAssignmentTemplate roleAssignmentTemplate) { - this.id = roleAssignmentTemplate.id; - this.version = roleAssignmentTemplate.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param id the id - * @param version the version - */ - public Builder(String id, String version) { - this.id = id; - this.version = version; - } - - /** - * Builds a RoleAssignmentTemplate. - * - * @return the new RoleAssignmentTemplate instance - */ - public RoleAssignmentTemplate build() { - return new RoleAssignmentTemplate(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the RoleAssignmentTemplate builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the RoleAssignmentTemplate builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected RoleAssignmentTemplate() { } - - protected RoleAssignmentTemplate(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - id = builder.id; - version = builder.version; - } - - /** - * New builder. - * - * @return a RoleAssignmentTemplate builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * Action control template ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java deleted file mode 100644 index 16296a82e40..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * RoleAssignmentsPager can be used to simplify the use of the "listRoleAssignments" method. - */ -public class RoleAssignmentsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListRoleAssignmentsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected RoleAssignmentsPager() { } - - /** - * Constructs a new RoleAssignmentsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listRoleAssignments" method - * @param options the ListRoleAssignmentsOptions instance to be used to invoke the "listRoleAssignments" method - */ - public RoleAssignmentsPager(IamPolicyManagement client, ListRoleAssignmentsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<RoleAssignment> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListRoleAssignmentsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - RoleAssignmentCollection result = client.listRoleAssignments(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getAssignments(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<RoleAssignment> containing all results returned by the "listRoleAssignments" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java deleted file mode 100644 index 282730a2dfc..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of roles returned by the 'list roles' operation. - */ -public class RoleCollection extends GenericModel { - - @SerializedName("custom_roles") - protected List customRoles; - @SerializedName("service_roles") - protected List serviceRoles; - @SerializedName("system_roles") - protected List systemRoles; - - protected RoleCollection() { } - - /** - * Gets the customRoles. - * - * List of custom roles. - * - * @return the customRoles - */ - public List getCustomRoles() { - return customRoles; - } - - /** - * Gets the serviceRoles. - * - * List of service roles. - * - * @return the serviceRoles - */ - public List getServiceRoles() { - return serviceRoles; - } - - /** - * Gets the systemRoles. - * - * List of system roles. - * - * @return the systemRoles - */ - public List getSystemRoles() { - return systemRoles; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java deleted file mode 100644 index 663d0f7f1d0..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the role template. - */ -public class RoleTemplate extends GenericModel { - - /** - * State of role template. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String name; - protected String description; - @SerializedName("account_id") - protected String accountId; - protected Boolean committed; - protected RoleTemplatePrototypeRole role; - protected String id; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String version; - protected String state; - - protected RoleTemplate() { } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the description. - * - * Description of the role template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the role for enterprise users managing IAM templates. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the committed. - * - * Committed status of the template. If committed is set to true, then the template version can no longer be updated. - * - * @return the committed - */ - public Boolean isCommitted() { - return committed; - } - - /** - * Gets the role. - * - * The role properties that are created in an action resource when the template is assigned. - * - * @return the role - */ - public RoleTemplatePrototypeRole getRole() { - return role; - } - - /** - * Gets the id. - * - * The role template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the role templates API by role template ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the role template was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the role template. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the role template was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the role template. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the version. - * - * The version number of the template used to identify different versions of same template. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the state. - * - * State of role template. - * - * @return the state - */ - public String getState() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java deleted file mode 100644 index 22a739b4a58..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of role templates. - */ -public class RoleTemplateCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - @SerializedName("role_templates") - protected List roleTemplates; - - protected RoleTemplateCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the roleTemplates. - * - * List of role templates. - * - * @return the roleTemplates - */ - public List getRoleTemplates() { - return roleTemplates; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java deleted file mode 100644 index 43197620689..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java +++ /dev/null @@ -1,239 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The role properties that are created in an action resource when the template is assigned. - */ -public class RoleTemplatePrototypeRole extends GenericModel { - - protected String name; - @SerializedName("display_name") - protected String displayName; - @SerializedName("service_name") - protected String serviceName; - protected String description; - protected List actions; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String displayName; - private String serviceName; - private String description; - private List actions; - - /** - * Instantiates a new Builder from an existing RoleTemplatePrototypeRole instance. - * - * @param roleTemplatePrototypeRole the instance to initialize the Builder with - */ - private Builder(RoleTemplatePrototypeRole roleTemplatePrototypeRole) { - this.name = roleTemplatePrototypeRole.name; - this.displayName = roleTemplatePrototypeRole.displayName; - this.serviceName = roleTemplatePrototypeRole.serviceName; - this.description = roleTemplatePrototypeRole.description; - this.actions = roleTemplatePrototypeRole.actions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param displayName the displayName - * @param actions the actions - */ - public Builder(String name, String displayName, List actions) { - this.name = name; - this.displayName = displayName; - this.actions = actions; - } - - /** - * Builds a RoleTemplatePrototypeRole. - * - * @return the new RoleTemplatePrototypeRole instance - */ - public RoleTemplatePrototypeRole build() { - return new RoleTemplatePrototypeRole(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the RoleTemplatePrototypeRole builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the RoleTemplatePrototypeRole builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the RoleTemplatePrototypeRole builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the RoleTemplatePrototypeRole builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the RoleTemplatePrototypeRole builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the RoleTemplatePrototypeRole builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - } - - protected RoleTemplatePrototypeRole() { } - - protected RoleTemplatePrototypeRole(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - name = builder.name; - displayName = builder.displayName; - serviceName = builder.serviceName; - description = builder.description; - actions = builder.actions; - } - - /** - * New builder. - * - * @return a RoleTemplatePrototypeRole builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the serviceName. - * - * The service name that the role refers. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the description. - * - * Description of the role. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. - * - * @return the actions - */ - public List actions() { - return actions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java deleted file mode 100644 index 673ff7f9750..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role template reference associated with a policy template. - */ -public class RoleTemplateReferencesItem extends GenericModel { - - protected String id; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String version; - - /** - * Instantiates a new Builder from an existing RoleTemplateReferencesItem instance. - * - * @param roleTemplateReferencesItem the instance to initialize the Builder with - */ - private Builder(RoleTemplateReferencesItem roleTemplateReferencesItem) { - this.id = roleTemplateReferencesItem.id; - this.version = roleTemplateReferencesItem.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param id the id - * @param version the version - */ - public Builder(String id, String version) { - this.id = id; - this.version = version; - } - - /** - * Builds a RoleTemplateReferencesItem. - * - * @return the new RoleTemplateReferencesItem instance - */ - public RoleTemplateReferencesItem build() { - return new RoleTemplateReferencesItem(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the RoleTemplateReferencesItem builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the RoleTemplateReferencesItem builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected RoleTemplateReferencesItem() { } - - protected RoleTemplateReferencesItem(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - id = builder.id; - version = builder.version; - } - - /** - * New builder. - * - * @return a RoleTemplateReferencesItem builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * The role template ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the version. - * - * Role template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java deleted file mode 100644 index a983208afe3..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of versions for a specific role template. - */ -public class RoleTemplateVersionsCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List versions; - - protected RoleTemplateVersionsCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the versions. - * - * List of role templates versions. - * - * @return the versions - */ - public List getVersions() { - return versions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java deleted file mode 100644 index 7af200cd72f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * RoleTemplateVersionsPager can be used to simplify the use of the "listRoleTemplateVersions" method. - */ -public class RoleTemplateVersionsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListRoleTemplateVersionsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected RoleTemplateVersionsPager() { } - - /** - * Constructs a new RoleTemplateVersionsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listRoleTemplateVersions" method - * @param options the ListRoleTemplateVersionsOptions instance to be used to invoke the "listRoleTemplateVersions" method - */ - public RoleTemplateVersionsPager(IamPolicyManagement client, ListRoleTemplateVersionsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<RoleTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListRoleTemplateVersionsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - RoleTemplateVersionsCollection result = client.listRoleTemplateVersions(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getVersions(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<RoleTemplate> containing all results returned by the "listRoleTemplateVersions" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java deleted file mode 100644 index 3654e0757ba..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * RoleTemplatesPager can be used to simplify the use of the "listRoleTemplates" method. - */ -public class RoleTemplatesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListRoleTemplatesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected RoleTemplatesPager() { } - - /** - * Constructs a new RoleTemplatesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listRoleTemplates" method - * @param options the ListRoleTemplatesOptions instance to be used to invoke the "listRoleTemplates" method - */ - public RoleTemplatesPager(IamPolicyManagement client, ListRoleTemplatesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<RoleTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListRoleTemplatesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - RoleTemplateCollection result = client.listRoleTemplates(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getRoleTemplates(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<RoleTemplate> containing all results returned by the "listRoleTemplates" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java deleted file mode 100644 index 03b6ff75eb1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role associated with a policy. - */ -public class Roles extends GenericModel { - - @SerializedName("role_id") - protected String roleId; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - - /** - * Instantiates a new Builder from an existing Roles instance. - * - * @param roles the instance to initialize the Builder with - */ - private Builder(Roles roles) { - this.roleId = roles.roleId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - */ - public Builder(String roleId) { - this.roleId = roleId; - } - - /** - * Builds a Roles. - * - * @return the new Roles instance - */ - public Roles build() { - return new Roles(this); - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the Roles builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - } - - protected Roles() { } - - protected Roles(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleId, - "roleId cannot be null"); - roleId = builder.roleId; - } - - /** - * New builder. - * - * @return a Roles builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java deleted file mode 100644 index fbf66d53ae1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Rule that specifies additional access that is granted (For example, time-based condition). - */ -public class RuleAttribute extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - protected String key; - protected String operator; - protected Object value; - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing RuleAttribute instance. - * - * @param ruleAttribute the instance to initialize the Builder with - */ - private Builder(RuleAttribute ruleAttribute) { - this.key = ruleAttribute.key; - this.operator = ruleAttribute.operator; - this.value = ruleAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a RuleAttribute. - * - * @return the new RuleAttribute instance - */ - public RuleAttribute build() { - return new RuleAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the RuleAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the RuleAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the RuleAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected RuleAttribute() { } - - protected RuleAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a RuleAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the key. - * - * The name of an attribute. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java deleted file mode 100644 index d7e54e112c5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * An attribute associated with a subject. - */ -public class SubjectAttribute extends GenericModel { - - protected String name; - protected String value; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String value; - - /** - * Instantiates a new Builder from an existing SubjectAttribute instance. - * - * @param subjectAttribute the instance to initialize the Builder with - */ - private Builder(SubjectAttribute subjectAttribute) { - this.name = subjectAttribute.name; - this.value = subjectAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param value the value - */ - public Builder(String name, String value) { - this.name = name; - this.value = value; - } - - /** - * Builds a SubjectAttribute. - * - * @return the new SubjectAttribute instance - */ - public SubjectAttribute build() { - return new SubjectAttribute(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the SubjectAttribute builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the SubjectAttribute builder - */ - public Builder value(String value) { - this.value = value; - return this; - } - } - - protected SubjectAttribute() { } - - protected SubjectAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - name = builder.name; - value = builder.value; - } - - /** - * New builder. - * - * @return a SubjectAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * The name of an attribute. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the value. - * - * The value of an attribute. - * - * @return the value - */ - public String value() { - return value; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java deleted file mode 100644 index 62f4bd77f87..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The action control properties that are created in an action resource when the template is assigned. - */ -public class TemplateActionControl extends GenericModel { - - @SerializedName("service_name") - protected String serviceName; - protected String description; - protected List actions; - - /** - * Builder. - */ - public static class Builder { - private String serviceName; - private String description; - private List actions; - - /** - * Instantiates a new Builder from an existing TemplateActionControl instance. - * - * @param templateActionControl the instance to initialize the Builder with - */ - private Builder(TemplateActionControl templateActionControl) { - this.serviceName = templateActionControl.serviceName; - this.description = templateActionControl.description; - this.actions = templateActionControl.actions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param serviceName the serviceName - * @param actions the actions - */ - public Builder(String serviceName, List actions) { - this.serviceName = serviceName; - this.actions = actions; - } - - /** - * Builds a TemplateActionControl. - * - * @return the new TemplateActionControl instance - */ - public TemplateActionControl build() { - return new TemplateActionControl(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the TemplateActionControl builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the TemplateActionControl builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the TemplateActionControl builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the TemplateActionControl builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - } - - protected TemplateActionControl() { } - - protected TemplateActionControl(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, - "serviceName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - serviceName = builder.serviceName; - description = builder.description; - actions = builder.actions; - } - - /** - * New builder. - * - * @return a TemplateActionControl builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the serviceName. - * - * The service name that the action control refers. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the description. - * - * Description of the action control. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actions. - * - * List of actions to control access. - * - * @return the actions - */ - public List actions() { - return actions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java deleted file mode 100644 index c74a77d9b6d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Specifies the type of access that is granted by the policy. - */ -public class TemplateControl extends GenericModel { - - protected TemplateGrant grant; - - /** - * Builder. - */ - public static class Builder { - private TemplateGrant grant; - - /** - * Instantiates a new Builder from an existing TemplateControl instance. - * - * @param templateControl the instance to initialize the Builder with - */ - private Builder(TemplateControl templateControl) { - this.grant = templateControl.grant; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param grant the grant - */ - public Builder(TemplateGrant grant) { - this.grant = grant; - } - - /** - * Builds a TemplateControl. - * - * @return the new TemplateControl instance - */ - public TemplateControl build() { - return new TemplateControl(this); - } - - /** - * Set the grant. - * - * @param grant the grant - * @return the TemplateControl builder - */ - public Builder grant(TemplateGrant grant) { - this.grant = grant; - return this; - } - } - - protected TemplateControl() { } - - protected TemplateControl(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.grant, - "grant cannot be null"); - grant = builder.grant; - } - - /** - * New builder. - * - * @return a TemplateControl builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the grant. - * - * Permission is granted by the policy. - * - * @return the grant - */ - public TemplateGrant grant() { - return grant; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java deleted file mode 100644 index edb134e1270..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * policy template count details. - */ -public class TemplateCountData extends GenericModel { - - protected LimitData template; - protected LimitData version; - - protected TemplateCountData() { } - - /** - * Gets the template. - * - * policy template current and limit details with in an account. - * - * @return the template - */ - public LimitData getTemplate() { - return template; - } - - /** - * Gets the version. - * - * policy template current and limit details with in an account. - * - * @return the version - */ - public LimitData getVersion() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java deleted file mode 100644 index fd0daff9665..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Permission is granted by the policy. - * - * Classes which extend this class: - * - TemplateGrantRoles - * - TemplateGrantRoleReferences - */ -public class TemplateGrant extends GenericModel { - - protected List roles; - @SerializedName("role_template_references") - protected List roleTemplateReferences; - - protected TemplateGrant() { } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List roles() { - return roles; - } - - /** - * Gets the roleTemplateReferences. - * - * A set of role template reference IDs granted by the policy. - * - * @return the roleTemplateReferences - */ - public List roleTemplateReferences() { - return roleTemplateReferences; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java deleted file mode 100644 index 248eb121b72..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * TemplateGrantRoleReferences. - */ -public class TemplateGrantRoleReferences extends TemplateGrant { - - - /** - * Builder. - */ - public static class Builder { - private List roleTemplateReferences; - - /** - * Instantiates a new Builder from an existing TemplateGrantRoleReferences instance. - * - * @param templateGrantRoleReferences the instance to initialize the Builder with - */ - public Builder(TemplateGrant templateGrantRoleReferences) { - this.roleTemplateReferences = templateGrantRoleReferences.roleTemplateReferences; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateReferences the roleTemplateReferences - */ - public Builder(List roleTemplateReferences) { - this.roleTemplateReferences = roleTemplateReferences; - } - - /** - * Builds a TemplateGrantRoleReferences. - * - * @return the new TemplateGrantRoleReferences instance - */ - public TemplateGrantRoleReferences build() { - return new TemplateGrantRoleReferences(this); - } - - /** - * Adds a new element to roleTemplateReferences. - * - * @param roleTemplateReferences the new element to be added - * @return the TemplateGrantRoleReferences builder - */ - public Builder addRoleTemplateReferences(RoleTemplateReferencesItem roleTemplateReferences) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roleTemplateReferences, - "roleTemplateReferences cannot be null"); - if (this.roleTemplateReferences == null) { - this.roleTemplateReferences = new ArrayList(); - } - this.roleTemplateReferences.add(roleTemplateReferences); - return this; - } - - /** - * Set the roleTemplateReferences. - * Existing roleTemplateReferences will be replaced. - * - * @param roleTemplateReferences the roleTemplateReferences - * @return the TemplateGrantRoleReferences builder - */ - public Builder roleTemplateReferences(List roleTemplateReferences) { - this.roleTemplateReferences = roleTemplateReferences; - return this; - } - } - - protected TemplateGrantRoleReferences() { } - - protected TemplateGrantRoleReferences(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleTemplateReferences, - "roleTemplateReferences cannot be null"); - roleTemplateReferences = builder.roleTemplateReferences; - } - - /** - * New builder. - * - * @return a TemplateGrantRoleReferences builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java deleted file mode 100644 index 6524b3645eb..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * TemplateGrantRoles. - */ -public class TemplateGrantRoles extends TemplateGrant { - - - /** - * Builder. - */ - public static class Builder { - private List roles; - - /** - * Instantiates a new Builder from an existing TemplateGrantRoles instance. - * - * @param templateGrantRoles the instance to initialize the Builder with - */ - public Builder(TemplateGrant templateGrantRoles) { - this.roles = templateGrantRoles.roles; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roles the roles - */ - public Builder(List roles) { - this.roles = roles; - } - - /** - * Builds a TemplateGrantRoles. - * - * @return the new TemplateGrantRoles instance - */ - public TemplateGrantRoles build() { - return new TemplateGrantRoles(this); - } - - /** - * Adds a new element to roles. - * - * @param roles the new element to be added - * @return the TemplateGrantRoles builder - */ - public Builder addRoles(Roles roles) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roles, - "roles cannot be null"); - if (this.roles == null) { - this.roles = new ArrayList(); - } - this.roles.add(roles); - return this; - } - - /** - * Set the roles. - * Existing roles will be replaced. - * - * @param roles the roles - * @return the TemplateGrantRoles builder - */ - public Builder roles(List roles) { - this.roles = roles; - return this; - } - } - - protected TemplateGrantRoles() { } - - protected TemplateGrantRoles(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, - "roles cannot be null"); - roles = builder.roles; - } - - /** - * New builder. - * - * @return a TemplateGrantRoles builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java deleted file mode 100644 index 41f112312cd..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The details of the IAM template that was used to create an enterprise-managed policy in your account. When returned, - * this indicates that the policy is created from and managed by a template in the root enterprise account. - */ -public class TemplateMetadata extends GenericModel { - - protected String id; - protected String version; - @SerializedName("assignment_id") - protected String assignmentId; - @SerializedName("root_id") - protected String rootId; - @SerializedName("root_version") - protected String rootVersion; - - protected TemplateMetadata() { } - - /** - * Gets the id. - * - * The policy template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the version. - * - * Template version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the assignmentId. - * - * Policy assignment ID. - * - * @return the assignmentId - */ - public String getAssignmentId() { - return assignmentId; - } - - /** - * Gets the rootId. - * - * Orchestrator template ID. - * - * @return the rootId - */ - public String getRootId() { - return rootId; - } - - /** - * Gets the rootVersion. - * - * Orchestrator template version. - * - * @return the rootVersion - */ - public String getRootVersion() { - return rootVersion; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java deleted file mode 100644 index 496b2e70e40..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java +++ /dev/null @@ -1,272 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the template's policy object. - */ -public class TemplatePolicy extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - protected String type; - protected String description; - protected V2PolicyResource resource; - protected V2PolicySubject subject; - protected String pattern; - protected V2PolicyRule rule; - protected TemplateControl control; - - /** - * Builder. - */ - public static class Builder { - private String type; - private String description; - private V2PolicyResource resource; - private V2PolicySubject subject; - private String pattern; - private V2PolicyRule rule; - private TemplateControl control; - - /** - * Instantiates a new Builder from an existing TemplatePolicy instance. - * - * @param templatePolicy the instance to initialize the Builder with - */ - private Builder(TemplatePolicy templatePolicy) { - this.type = templatePolicy.type; - this.description = templatePolicy.description; - this.resource = templatePolicy.resource; - this.subject = templatePolicy.subject; - this.pattern = templatePolicy.pattern; - this.rule = templatePolicy.rule; - this.control = templatePolicy.control; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param type the type - */ - public Builder(String type) { - this.type = type; - } - - /** - * Builds a TemplatePolicy. - * - * @return the new TemplatePolicy instance - */ - public TemplatePolicy build() { - return new TemplatePolicy(this); - } - - /** - * Set the type. - * - * @param type the type - * @return the TemplatePolicy builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the TemplatePolicy builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the resource. - * - * @param resource the resource - * @return the TemplatePolicy builder - */ - public Builder resource(V2PolicyResource resource) { - this.resource = resource; - return this; - } - - /** - * Set the subject. - * - * @param subject the subject - * @return the TemplatePolicy builder - */ - public Builder subject(V2PolicySubject subject) { - this.subject = subject; - return this; - } - - /** - * Set the pattern. - * - * @param pattern the pattern - * @return the TemplatePolicy builder - */ - public Builder pattern(String pattern) { - this.pattern = pattern; - return this; - } - - /** - * Set the rule. - * - * @param rule the rule - * @return the TemplatePolicy builder - */ - public Builder rule(V2PolicyRule rule) { - this.rule = rule; - return this; - } - - /** - * Set the control. - * - * @param control the control - * @return the TemplatePolicy builder - */ - public Builder control(TemplateControl control) { - this.control = control; - return this; - } - } - - protected TemplatePolicy() { } - - protected TemplatePolicy(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - type = builder.type; - description = builder.description; - resource = builder.resource; - subject = builder.subject; - pattern = builder.pattern; - rule = builder.rule; - control = builder.control; - } - - /** - * New builder. - * - * @return a TemplatePolicy builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. This is shown in child accounts when an access group or trusted profile template uses - * the policy template to assign access. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource resource() { - return resource; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject subject() { - return subject; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String pattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule rule() { - return rule; - } - - /** - * Gets the control. - * - * Specifies the type of access that is granted by the policy. - * - * @return the control - */ - public TemplateControl control() { - return control; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java deleted file mode 100644 index b76beb3bddb..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The role properties that are created in an action resource when the template is assigned. - */ -public class TemplateRole extends GenericModel { - - @SerializedName("display_name") - protected String displayName; - @SerializedName("service_name") - protected String serviceName; - protected String description; - protected List actions; - - /** - * Builder. - */ - public static class Builder { - private String displayName; - private String serviceName; - private String description; - private List actions; - - /** - * Instantiates a new Builder from an existing TemplateRole instance. - * - * @param templateRole the instance to initialize the Builder with - */ - private Builder(TemplateRole templateRole) { - this.displayName = templateRole.displayName; - this.serviceName = templateRole.serviceName; - this.description = templateRole.description; - this.actions = templateRole.actions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param displayName the displayName - * @param actions the actions - */ - public Builder(String displayName, List actions) { - this.displayName = displayName; - this.actions = actions; - } - - /** - * Builds a TemplateRole. - * - * @return the new TemplateRole instance - */ - public TemplateRole build() { - return new TemplateRole(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the TemplateRole builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the TemplateRole builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the TemplateRole builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the TemplateRole builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the TemplateRole builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - } - - protected TemplateRole() { } - - protected TemplateRole(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - displayName = builder.displayName; - serviceName = builder.serviceName; - description = builder.description; - actions = builder.actions; - } - - /** - * New builder. - * - * @return a TemplateRole builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the serviceName. - * - * The service name that the role refers. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the description. - * - * Description of the role. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. - * - * @return the actions - */ - public List actions() { - return actions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java deleted file mode 100644 index caf2f737b55..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updateActionControlAssignment options. - */ -public class UpdateActionControlAssignmentOptions extends GenericModel { - - protected String assignmentId; - protected String ifMatch; - protected String templateVersion; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - private String ifMatch; - private String templateVersion; - - /** - * Instantiates a new Builder from an existing UpdateActionControlAssignmentOptions instance. - * - * @param updateActionControlAssignmentOptions the instance to initialize the Builder with - */ - private Builder(UpdateActionControlAssignmentOptions updateActionControlAssignmentOptions) { - this.assignmentId = updateActionControlAssignmentOptions.assignmentId; - this.ifMatch = updateActionControlAssignmentOptions.ifMatch; - this.templateVersion = updateActionControlAssignmentOptions.templateVersion; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - * @param ifMatch the ifMatch - * @param templateVersion the templateVersion - */ - public Builder(String assignmentId, String ifMatch, String templateVersion) { - this.assignmentId = assignmentId; - this.ifMatch = ifMatch; - this.templateVersion = templateVersion; - } - - /** - * Builds a UpdateActionControlAssignmentOptions. - * - * @return the new UpdateActionControlAssignmentOptions instance - */ - public UpdateActionControlAssignmentOptions build() { - return new UpdateActionControlAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the UpdateActionControlAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdateActionControlAssignmentOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the UpdateActionControlAssignmentOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - } - - protected UpdateActionControlAssignmentOptions() { } - - protected UpdateActionControlAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId 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.templateVersion, - "templateVersion cannot be null"); - assignmentId = builder.assignmentId; - ifMatch = builder.ifMatch; - templateVersion = builder.templateVersion; - } - - /** - * New builder. - * - * @return a UpdateActionControlAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Action control template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating an action control assignment and must match the Etag value of the existing action - * control assignment. The Etag can be retrieved using the GET /v1/action_control_assignments/{assignment_id} API and - * looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the templateVersion. - * - * The version number of the template used to identify different versions of same template. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java deleted file mode 100644 index 869eb357802..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updatePolicyAssignment options. - */ -public class UpdatePolicyAssignmentOptions extends GenericModel { - - protected String assignmentId; - protected String version; - protected String ifMatch; - protected String templateVersion; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - private String version; - private String ifMatch; - private String templateVersion; - - /** - * Instantiates a new Builder from an existing UpdatePolicyAssignmentOptions instance. - * - * @param updatePolicyAssignmentOptions the instance to initialize the Builder with - */ - private Builder(UpdatePolicyAssignmentOptions updatePolicyAssignmentOptions) { - this.assignmentId = updatePolicyAssignmentOptions.assignmentId; - this.version = updatePolicyAssignmentOptions.version; - this.ifMatch = updatePolicyAssignmentOptions.ifMatch; - this.templateVersion = updatePolicyAssignmentOptions.templateVersion; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - * @param version the version - * @param ifMatch the ifMatch - * @param templateVersion the templateVersion - */ - public Builder(String assignmentId, String version, String ifMatch, String templateVersion) { - this.assignmentId = assignmentId; - this.version = version; - this.ifMatch = ifMatch; - this.templateVersion = templateVersion; - } - - /** - * Builds a UpdatePolicyAssignmentOptions. - * - * @return the new UpdatePolicyAssignmentOptions instance - */ - public UpdatePolicyAssignmentOptions build() { - return new UpdatePolicyAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the UpdatePolicyAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the UpdatePolicyAssignmentOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdatePolicyAssignmentOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the UpdatePolicyAssignmentOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - } - - protected UpdatePolicyAssignmentOptions() { } - - protected UpdatePolicyAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templateVersion, - "templateVersion cannot be null"); - assignmentId = builder.assignmentId; - version = builder.version; - ifMatch = builder.ifMatch; - templateVersion = builder.templateVersion; - } - - /** - * New builder. - * - * @return a UpdatePolicyAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * The policy template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } - - /** - * Gets the version. - * - * specify version of response body format. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy assignment and must match the Etag value of the existing policy - * assignment. The Etag can be retrieved using the GET /v1/policy_assignments/{assignment_id} API and looking at the - * Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the templateVersion. - * - * The policy template version to update to. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java deleted file mode 100644 index a28b357641f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updatePolicyState options. - */ -public class UpdatePolicyStateOptions extends GenericModel { - - /** - * The policy state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String policyId; - protected String ifMatch; - protected String state; - - /** - * Builder. - */ - public static class Builder { - private String policyId; - private String ifMatch; - private String state; - - /** - * Instantiates a new Builder from an existing UpdatePolicyStateOptions instance. - * - * @param updatePolicyStateOptions the instance to initialize the Builder with - */ - private Builder(UpdatePolicyStateOptions updatePolicyStateOptions) { - this.policyId = updatePolicyStateOptions.policyId; - this.ifMatch = updatePolicyStateOptions.ifMatch; - this.state = updatePolicyStateOptions.state; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyId the policyId - * @param ifMatch the ifMatch - */ - public Builder(String policyId, String ifMatch) { - this.policyId = policyId; - this.ifMatch = ifMatch; - } - - /** - * Builds a UpdatePolicyStateOptions. - * - * @return the new UpdatePolicyStateOptions instance - */ - public UpdatePolicyStateOptions build() { - return new UpdatePolicyStateOptions(this); - } - - /** - * Set the policyId. - * - * @param policyId the policyId - * @return the UpdatePolicyStateOptions builder - */ - public Builder policyId(String policyId) { - this.policyId = policyId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdatePolicyStateOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the UpdatePolicyStateOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - } - - protected UpdatePolicyStateOptions() { } - - protected UpdatePolicyStateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, - "policyId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - policyId = builder.policyId; - ifMatch = builder.ifMatch; - state = builder.state; - } - - /** - * New builder. - * - * @return a UpdatePolicyStateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyId. - * - * The policy ID. - * - * @return the policyId - */ - public String policyId() { - return policyId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be - * retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the state. - * - * The policy state. - * - * @return the state - */ - public String state() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java deleted file mode 100644 index f10cba5fe93..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updateRoleAssignment options. - */ -public class UpdateRoleAssignmentOptions extends GenericModel { - - protected String assignmentId; - protected String ifMatch; - protected String templateVersion; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - private String ifMatch; - private String templateVersion; - - /** - * Instantiates a new Builder from an existing UpdateRoleAssignmentOptions instance. - * - * @param updateRoleAssignmentOptions the instance to initialize the Builder with - */ - private Builder(UpdateRoleAssignmentOptions updateRoleAssignmentOptions) { - this.assignmentId = updateRoleAssignmentOptions.assignmentId; - this.ifMatch = updateRoleAssignmentOptions.ifMatch; - this.templateVersion = updateRoleAssignmentOptions.templateVersion; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - * @param ifMatch the ifMatch - * @param templateVersion the templateVersion - */ - public Builder(String assignmentId, String ifMatch, String templateVersion) { - this.assignmentId = assignmentId; - this.ifMatch = ifMatch; - this.templateVersion = templateVersion; - } - - /** - * Builds a UpdateRoleAssignmentOptions. - * - * @return the new UpdateRoleAssignmentOptions instance - */ - public UpdateRoleAssignmentOptions build() { - return new UpdateRoleAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the UpdateRoleAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdateRoleAssignmentOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the UpdateRoleAssignmentOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - } - - protected UpdateRoleAssignmentOptions() { } - - protected UpdateRoleAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId 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.templateVersion, - "templateVersion cannot be null"); - assignmentId = builder.assignmentId; - ifMatch = builder.ifMatch; - templateVersion = builder.templateVersion; - } - - /** - * New builder. - * - * @return a UpdateRoleAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Role template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a role assignment and must match the Etag value of the existing role assignment. - * The Etag can be retrieved using the GET /v1/role_assignments/{assignment_id} API and looking at the Etag response - * header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the templateVersion. - * - * The version number of the template used to identify different versions of same template. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java deleted file mode 100644 index 3d9dbb43fb3..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updateSettings options. - */ -public class UpdateSettingsOptions extends GenericModel { - - protected String accountId; - protected String ifMatch; - protected ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String ifMatch; - private ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing UpdateSettingsOptions instance. - * - * @param updateSettingsOptions the instance to initialize the Builder with - */ - private Builder(UpdateSettingsOptions updateSettingsOptions) { - this.accountId = updateSettingsOptions.accountId; - this.ifMatch = updateSettingsOptions.ifMatch; - this.externalAccountIdentityInteraction = updateSettingsOptions.externalAccountIdentityInteraction; - this.acceptLanguage = updateSettingsOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - * @param ifMatch the ifMatch - */ - public Builder(String accountId, String ifMatch) { - this.accountId = accountId; - this.ifMatch = ifMatch; - } - - /** - * Builds a UpdateSettingsOptions. - * - * @return the new UpdateSettingsOptions instance - */ - public UpdateSettingsOptions build() { - return new UpdateSettingsOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the UpdateSettingsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdateSettingsOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the externalAccountIdentityInteraction. - * - * @param externalAccountIdentityInteraction the externalAccountIdentityInteraction - * @return the UpdateSettingsOptions builder - */ - public Builder externalAccountIdentityInteraction(ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction) { - this.externalAccountIdentityInteraction = externalAccountIdentityInteraction; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the UpdateSettingsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected UpdateSettingsOptions() { } - - protected UpdateSettingsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.accountId, - "accountId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - accountId = builder.accountId; - ifMatch = builder.ifMatch; - externalAccountIdentityInteraction = builder.externalAccountIdentityInteraction; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a UpdateSettingsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the settings belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating Access Management Account Settings and must match the Etag value of the existing - * Access Management Account Settings. The Etag can be retrieved using the GET - * /v1/accounts/{account_id}/settings/access_management API and looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the externalAccountIdentityInteraction. - * - * Update to how external accounts can interact in relation to the requested account. - * - * @return the externalAccountIdentityInteraction - */ - public ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction() { - return externalAccountIdentityInteraction; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java deleted file mode 100644 index fdae9e28c12..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * V2PoliciesPager can be used to simplify the use of the "listV2Policies" method. - */ -public class V2PoliciesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListV2PoliciesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected V2PoliciesPager() { } - - /** - * Constructs a new V2PoliciesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listV2Policies" method - * @param options the ListV2PoliciesOptions instance to be used to invoke the "listV2Policies" method - */ - public V2PoliciesPager(IamPolicyManagement client, ListV2PoliciesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<V2PolicyTemplateMetaData> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListV2PoliciesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - V2PolicyCollection result = client.listV2Policies(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getPolicies(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<V2PolicyTemplateMetaData> containing all results returned by the "listV2Policies" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java deleted file mode 100644 index 842a354b7b1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java +++ /dev/null @@ -1,247 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the policy. - */ -public class V2Policy extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - /** - * The policy state, either 'deleted' or 'active'. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String type; - protected String description; - protected V2PolicySubject subject; - protected V2PolicyResource resource; - protected String pattern; - protected V2PolicyRule rule; - protected String id; - protected String href; - protected ControlResponse control; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String state; - @SerializedName("last_permit_at") - protected String lastPermitAt; - @SerializedName("last_permit_frequency") - protected Long lastPermitFrequency; - - protected V2Policy() { } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject getSubject() { - return subject; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource getResource() { - return resource; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String getPattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule getRule() { - return rule; - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the policies API by policy ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the control. - * - * @return the control - */ - public ControlResponse getControl() { - return control; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the state. - * - * The policy state, either 'deleted' or 'active'. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the lastPermitAt. - * - * The optional last permit time of policy, when passing query parameter format=include_last_permit. - * - * @return the lastPermitAt - */ - public String getLastPermitAt() { - return lastPermitAt; - } - - /** - * Gets the lastPermitFrequency. - * - * The optional count of times that policy has provided a permit, when passing query parameter - * format=include_last_permit. - * - * @return the lastPermitFrequency - */ - public Long getLastPermitFrequency() { - return lastPermitFrequency; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java deleted file mode 100644 index d392025f8d8..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of policies. - */ -public class V2PolicyCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List policies; - - protected V2PolicyCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the policies. - * - * List of policies. - * - * @return the policies - */ - public List getPolicies() { - return policies; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java deleted file mode 100644 index caf8dd522a9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The resource attributes to which the policy grants access. - */ -public class V2PolicyResource extends GenericModel { - - protected List attributes; - protected List tags; - - /** - * Builder. - */ - public static class Builder { - private List attributes; - private List tags; - - /** - * Instantiates a new Builder from an existing V2PolicyResource instance. - * - * @param v2PolicyResource the instance to initialize the Builder with - */ - private Builder(V2PolicyResource v2PolicyResource) { - this.attributes = v2PolicyResource.attributes; - this.tags = v2PolicyResource.tags; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param attributes the attributes - */ - public Builder(List attributes) { - this.attributes = attributes; - } - - /** - * Builds a V2PolicyResource. - * - * @return the new V2PolicyResource instance - */ - public V2PolicyResource build() { - return new V2PolicyResource(this); - } - - /** - * Adds a new element to attributes. - * - * @param attributes the new element to be added - * @return the V2PolicyResource builder - */ - public Builder addAttributes(V2PolicyResourceAttribute attributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, - "attributes cannot be null"); - if (this.attributes == null) { - this.attributes = new ArrayList(); - } - this.attributes.add(attributes); - return this; - } - - /** - * Adds a new element to tags. - * - * @param tags the new element to be added - * @return the V2PolicyResource builder - */ - public Builder addTags(V2PolicyResourceTag tags) { - com.ibm.cloud.sdk.core.util.Validator.notNull(tags, - "tags cannot be null"); - if (this.tags == null) { - this.tags = new ArrayList(); - } - this.tags.add(tags); - return this; - } - - /** - * Set the attributes. - * Existing attributes will be replaced. - * - * @param attributes the attributes - * @return the V2PolicyResource builder - */ - public Builder attributes(List attributes) { - this.attributes = attributes; - return this; - } - - /** - * Set the tags. - * Existing tags will be replaced. - * - * @param tags the tags - * @return the V2PolicyResource builder - */ - public Builder tags(List tags) { - this.tags = tags; - return this; - } - } - - protected V2PolicyResource() { } - - protected V2PolicyResource(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, - "attributes cannot be null"); - attributes = builder.attributes; - tags = builder.tags; - } - - /** - * New builder. - * - * @return a V2PolicyResource builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the attributes. - * - * List of resource attributes to which the policy grants access. - * - * @return the attributes - */ - public List attributes() { - return attributes; - } - - /** - * Gets the tags. - * - * Optional list of resource tags to which the policy grants access. - * - * @return the tags - */ - public List tags() { - return tags; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java deleted file mode 100644 index 73e7cedd55e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Resource attribute to which the policy grants access. - */ -public class V2PolicyResourceAttribute extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - } - - protected String key; - protected String operator; - protected Object value; - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing V2PolicyResourceAttribute instance. - * - * @param v2PolicyResourceAttribute the instance to initialize the Builder with - */ - private Builder(V2PolicyResourceAttribute v2PolicyResourceAttribute) { - this.key = v2PolicyResourceAttribute.key; - this.operator = v2PolicyResourceAttribute.operator; - this.value = v2PolicyResourceAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a V2PolicyResourceAttribute. - * - * @return the new V2PolicyResourceAttribute instance - */ - public V2PolicyResourceAttribute build() { - return new V2PolicyResourceAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the V2PolicyResourceAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicyResourceAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the V2PolicyResourceAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected V2PolicyResourceAttribute() { } - - protected V2PolicyResourceAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a V2PolicyResourceAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the key. - * - * The name of a resource attribute. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java deleted file mode 100644 index bb32772b8dc..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A tag associated with a resource. - */ -public class V2PolicyResourceTag extends GenericModel { - - /** - * The operator of an access management tag. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - } - - protected String key; - protected String value; - protected String operator; - - /** - * Builder. - */ - public static class Builder { - private String key; - private String value; - private String operator; - - /** - * Instantiates a new Builder from an existing V2PolicyResourceTag instance. - * - * @param v2PolicyResourceTag the instance to initialize the Builder with - */ - private Builder(V2PolicyResourceTag v2PolicyResourceTag) { - this.key = v2PolicyResourceTag.key; - this.value = v2PolicyResourceTag.value; - this.operator = v2PolicyResourceTag.operator; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param value the value - * @param operator the operator - */ - public Builder(String key, String value, String operator) { - this.key = key; - this.value = value; - this.operator = operator; - } - - /** - * Builds a V2PolicyResourceTag. - * - * @return the new V2PolicyResourceTag instance - */ - public V2PolicyResourceTag build() { - return new V2PolicyResourceTag(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the V2PolicyResourceTag builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the V2PolicyResourceTag builder - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicyResourceTag builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - } - - protected V2PolicyResourceTag() { } - - protected V2PolicyResourceTag(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - key = builder.key; - value = builder.value; - operator = builder.operator; - } - - /** - * New builder. - * - * @return a V2PolicyResourceTag builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the key. - * - * The name of an access management tag. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the value. - * - * The value of an access management tag. - * - * @return the value - */ - public String value() { - return value; - } - - /** - * Gets the operator. - * - * The operator of an access management tag. - * - * @return the operator - */ - public String operator() { - return operator; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java deleted file mode 100644 index 13a9f5fbd94..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Additional access conditions associated with the policy. - * - * Classes which extend this class: - * - V2PolicyRuleRuleAttribute - * - V2PolicyRuleRuleWithNestedConditions - */ -public class V2PolicyRule extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - protected String key; - protected String operator; - protected Object value; - protected List conditions; - - protected V2PolicyRule() { } - - /** - * Gets the key. - * - * The name of an attribute. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } - - /** - * Gets the conditions. - * - * List of conditions associated with a policy. For example, time-based conditions that grant access over a certain - * time period. - * - * @return the conditions - */ - public List conditions() { - return conditions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java deleted file mode 100644 index c20b3a8cb0c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * Rule that specifies additional access that is granted (For example, time-based condition). - */ -public class V2PolicyRuleRuleAttribute extends V2PolicyRule { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing V2PolicyRuleRuleAttribute instance. - * - * @param v2PolicyRuleRuleAttribute the instance to initialize the Builder with - */ - public Builder(V2PolicyRule v2PolicyRuleRuleAttribute) { - this.key = v2PolicyRuleRuleAttribute.key; - this.operator = v2PolicyRuleRuleAttribute.operator; - this.value = v2PolicyRuleRuleAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a V2PolicyRuleRuleAttribute. - * - * @return the new V2PolicyRuleRuleAttribute instance - */ - public V2PolicyRuleRuleAttribute build() { - return new V2PolicyRuleRuleAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the V2PolicyRuleRuleAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicyRuleRuleAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the V2PolicyRuleRuleAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected V2PolicyRuleRuleAttribute() { } - - protected V2PolicyRuleRuleAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a V2PolicyRuleRuleAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java deleted file mode 100644 index 8d6e57920f9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * Rule that specifies additional access that is granted (for example, time-based condition) accross multiple - * conditions. - */ -public class V2PolicyRuleRuleWithNestedConditions extends V2PolicyRule { - - /** - * Operator to evaluate conditions. - */ - public interface Operator { - /** and. */ - String AND = "and"; - /** or. */ - String OR = "or"; - } - - - /** - * Builder. - */ - public static class Builder { - private String operator; - private List conditions; - - /** - * Instantiates a new Builder from an existing V2PolicyRuleRuleWithNestedConditions instance. - * - * @param v2PolicyRuleRuleWithNestedConditions the instance to initialize the Builder with - */ - public Builder(V2PolicyRule v2PolicyRuleRuleWithNestedConditions) { - this.operator = v2PolicyRuleRuleWithNestedConditions.operator; - this.conditions = v2PolicyRuleRuleWithNestedConditions.conditions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param operator the operator - * @param conditions the conditions - */ - public Builder(String operator, List conditions) { - this.operator = operator; - this.conditions = conditions; - } - - /** - * Builds a V2PolicyRuleRuleWithNestedConditions. - * - * @return the new V2PolicyRuleRuleWithNestedConditions instance - */ - public V2PolicyRuleRuleWithNestedConditions build() { - return new V2PolicyRuleRuleWithNestedConditions(this); - } - - /** - * Adds a new element to conditions. - * - * @param conditions the new element to be added - * @return the V2PolicyRuleRuleWithNestedConditions builder - */ - public Builder addConditions(NestedCondition conditions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(conditions, - "conditions cannot be null"); - if (this.conditions == null) { - this.conditions = new ArrayList(); - } - this.conditions.add(conditions); - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicyRuleRuleWithNestedConditions builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the conditions. - * Existing conditions will be replaced. - * - * @param conditions the conditions - * @return the V2PolicyRuleRuleWithNestedConditions builder - */ - public Builder conditions(List conditions) { - this.conditions = conditions; - return this; - } - } - - protected V2PolicyRuleRuleWithNestedConditions() { } - - protected V2PolicyRuleRuleWithNestedConditions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.conditions, - "conditions cannot be null"); - operator = builder.operator; - conditions = builder.conditions; - } - - /** - * New builder. - * - * @return a V2PolicyRuleRuleWithNestedConditions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java deleted file mode 100644 index 891513fd45a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The subject attributes for whom the policy grants access. - */ -public class V2PolicySubject extends GenericModel { - - protected List attributes; - - /** - * Builder. - */ - public static class Builder { - private List attributes; - - /** - * Instantiates a new Builder from an existing V2PolicySubject instance. - * - * @param v2PolicySubject the instance to initialize the Builder with - */ - private Builder(V2PolicySubject v2PolicySubject) { - this.attributes = v2PolicySubject.attributes; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param attributes the attributes - */ - public Builder(List attributes) { - this.attributes = attributes; - } - - /** - * Builds a V2PolicySubject. - * - * @return the new V2PolicySubject instance - */ - public V2PolicySubject build() { - return new V2PolicySubject(this); - } - - /** - * Adds a new element to attributes. - * - * @param attributes the new element to be added - * @return the V2PolicySubject builder - */ - public Builder addAttributes(V2PolicySubjectAttribute attributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, - "attributes cannot be null"); - if (this.attributes == null) { - this.attributes = new ArrayList(); - } - this.attributes.add(attributes); - return this; - } - - /** - * Set the attributes. - * Existing attributes will be replaced. - * - * @param attributes the attributes - * @return the V2PolicySubject builder - */ - public Builder attributes(List attributes) { - this.attributes = attributes; - return this; - } - } - - protected V2PolicySubject() { } - - protected V2PolicySubject(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, - "attributes cannot be null"); - attributes = builder.attributes; - } - - /** - * New builder. - * - * @return a V2PolicySubject builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the attributes. - * - * List of subject attributes associated with policy. - * - * @return the attributes - */ - public List attributes() { - return attributes; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java deleted file mode 100644 index c90606429df..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Subject attribute for whom the policy grants access. - */ -public class V2PolicySubjectAttribute extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - } - - protected String key; - protected String operator; - protected Object value; - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing V2PolicySubjectAttribute instance. - * - * @param v2PolicySubjectAttribute the instance to initialize the Builder with - */ - private Builder(V2PolicySubjectAttribute v2PolicySubjectAttribute) { - this.key = v2PolicySubjectAttribute.key; - this.operator = v2PolicySubjectAttribute.operator; - this.value = v2PolicySubjectAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a V2PolicySubjectAttribute. - * - * @return the new V2PolicySubjectAttribute instance - */ - public V2PolicySubjectAttribute build() { - return new V2PolicySubjectAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the V2PolicySubjectAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicySubjectAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the V2PolicySubjectAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected V2PolicySubjectAttribute() { } - - protected V2PolicySubjectAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a V2PolicySubjectAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the key. - * - * The name of a subject attribute. For example, iam_id, access_group_id. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java deleted file mode 100644 index 720f7b57d4e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the policy. - */ -public class V2PolicyTemplateMetaData extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - /** - * The policy state, either 'deleted' or 'active'. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String type; - protected String description; - protected V2PolicySubject subject; - protected V2PolicyResource resource; - protected String pattern; - protected V2PolicyRule rule; - protected String id; - protected String href; - protected ControlResponse control; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String state; - @SerializedName("last_permit_at") - protected String lastPermitAt; - @SerializedName("last_permit_frequency") - protected Long lastPermitFrequency; - protected TemplateMetadata template; - - protected V2PolicyTemplateMetaData() { } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject getSubject() { - return subject; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource getResource() { - return resource; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String getPattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule getRule() { - return rule; - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the policies API by policy ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the control. - * - * @return the control - */ - public ControlResponse getControl() { - return control; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the state. - * - * The policy state, either 'deleted' or 'active'. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the lastPermitAt. - * - * The optional last permit time of policy, when passing query parameter format=include_last_permit. - * - * @return the lastPermitAt - */ - public String getLastPermitAt() { - return lastPermitAt; - } - - /** - * Gets the lastPermitFrequency. - * - * The optional count of times that policy has provided a permit, when passing query parameter - * format=include_last_permit. - * - * @return the lastPermitFrequency - */ - public Long getLastPermitFrequency() { - return lastPermitFrequency; - } - - /** - * Gets the template. - * - * The details of the IAM template that was used to create an enterprise-managed policy in your account. When - * returned, this indicates that the policy is created from and managed by a template in the root enterprise account. - * - * @return the template - */ - public TemplateMetadata getTemplate() { - return template; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java deleted file mode 100644 index 63a87389391..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * (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. - */ - -/** - * IAM Policy Management v1. - */ -package com.ibm.cloud.platform_services.iam_policy_management.v1; diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java deleted file mode 100644 index b38933306a6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java +++ /dev/null @@ -1,5007 +0,0 @@ -/* - * (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_policy_management.v1; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplatesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponse; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControlWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedCondition; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleWithConditions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PoliciesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplatesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoleReferences; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PoliciesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRule; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleWithNestedConditions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.utils.TestUtilities; -import com.ibm.cloud.sdk.core.http.Response; -import com.ibm.cloud.sdk.core.security.Authenticator; -import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import okhttp3.mockwebserver.MockResponse; -import okhttp3.mockwebserver.MockWebServer; -import okhttp3.mockwebserver.RecordedRequest; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; -import static org.testng.Assert.*; - -/** - * Unit test class for the IamPolicyManagement service. - */ -public class IamPolicyManagementTest { - - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - protected MockWebServer server; - protected IamPolicyManagement iamPolicyManagementService; - - // Construct the service with a null authenticator (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testConstructorWithNullAuthenticator() throws Throwable { - final String serviceName = "testService"; - new IamPolicyManagement(serviceName, null); - } - - // Test the listPolicies operation with a valid options model parameter - @Test - public void testListPoliciesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policies\": [{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}]}"; - String listPoliciesPath = "/v1/policies"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListPoliciesOptions model - ListPoliciesOptions listPoliciesOptionsModel = new ListPoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .tagName("testString") - .tagValue("testString") - .sort("id") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listPolicies() with a valid options model and verify the result - Response response = iamPolicyManagementService.listPolicies(listPoliciesOptionsModel).execute(); - assertNotNull(response); - PolicyCollection 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, listPoliciesPath); - // 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("access_group_id"), "testString"); - assertEquals(query.get("type"), "access"); - assertEquals(query.get("service_type"), "service"); - assertEquals(query.get("tag_name"), "testString"); - assertEquals(query.get("tag_value"), "testString"); - assertEquals(query.get("sort"), "id"); - assertEquals(query.get("format"), "include_last_permit"); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listPolicies operation with and without retries enabled - @Test - public void testListPoliciesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListPoliciesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListPoliciesWOptions(); - } - - // Test the listPolicies operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPoliciesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listPolicies(null).execute(); - } - - // Test the listPolicies operation using the PoliciesPager.getNext() method - @Test - public void testListPoliciesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPoliciesOptions listPoliciesOptions = new ListPoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .tagName("testString") - .tagValue("testString") - .sort("id") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - PoliciesPager pager = new PoliciesPager(iamPolicyManagementService, listPoliciesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listPolicies operation using the PoliciesPager.getAll() method - @Test - public void testListPoliciesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPoliciesOptions listPoliciesOptions = new ListPoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .tagName("testString") - .tagValue("testString") - .sort("id") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - PoliciesPager pager = new PoliciesPager(iamPolicyManagementService, listPoliciesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createPolicy operation with a valid options model parameter - @Test - public void testCreatePolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; - String createPolicyPath = "/v1/policies"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the SubjectAttribute model - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - - // Construct an instance of the PolicySubject model - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - - // Construct an instance of the PolicyRole model - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the ResourceAttribute model - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - - // Construct an instance of the ResourceTag model - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - - // Construct an instance of the PolicyResource model - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - - // Construct an instance of the CreatePolicyOptions model - CreatePolicyOptions createPolicyOptionsModel = new CreatePolicyOptions.Builder() - .type("testString") - .subjects(java.util.Arrays.asList(policySubjectModel)) - .roles(java.util.Arrays.asList(policyRoleModel)) - .resources(java.util.Arrays.asList(policyResourceModel)) - .description("testString") - .acceptLanguage("default") - .build(); - - // Invoke createPolicy() with a valid options model and verify the result - Response response = iamPolicyManagementService.createPolicy(createPolicyOptionsModel).execute(); - assertNotNull(response); - Policy 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createPolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createPolicy operation with and without retries enabled - @Test - public void testCreatePolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreatePolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreatePolicyWOptions(); - } - - // Test the createPolicy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createPolicy(null).execute(); - } - - // Test the replacePolicy operation with a valid options model parameter - @Test - public void testReplacePolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; - String replacePolicyPath = "/v1/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the SubjectAttribute model - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - - // Construct an instance of the PolicySubject model - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - - // Construct an instance of the PolicyRole model - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the ResourceAttribute model - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - - // Construct an instance of the ResourceTag model - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - - // Construct an instance of the PolicyResource model - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - - // Construct an instance of the ReplacePolicyOptions model - ReplacePolicyOptions replacePolicyOptionsModel = new ReplacePolicyOptions.Builder() - .policyId("testString") - .ifMatch("testString") - .type("testString") - .subjects(java.util.Arrays.asList(policySubjectModel)) - .roles(java.util.Arrays.asList(policyRoleModel)) - .resources(java.util.Arrays.asList(policyResourceModel)) - .description("testString") - .build(); - - // Invoke replacePolicy() with a valid options model and verify the result - Response response = iamPolicyManagementService.replacePolicy(replacePolicyOptionsModel).execute(); - assertNotNull(response); - Policy 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, replacePolicyPath); - // 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 replacePolicy operation with and without retries enabled - @Test - public void testReplacePolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplacePolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplacePolicyWOptions(); - } - - // Test the replacePolicy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplacePolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replacePolicy(null).execute(); - } - - // Test the getPolicy operation with a valid options model parameter - @Test - public void testGetPolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}"; - String getPolicyPath = "/v1/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetPolicyOptions model - GetPolicyOptions getPolicyOptionsModel = new GetPolicyOptions.Builder() - .policyId("testString") - .build(); - - // Invoke getPolicy() with a valid options model and verify the result - Response response = iamPolicyManagementService.getPolicy(getPolicyOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateMetaData 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, getPolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getPolicy operation with and without retries enabled - @Test - public void testGetPolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetPolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetPolicyWOptions(); - } - - // Test the getPolicy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getPolicy(null).execute(); - } - - // Test the deletePolicy operation with a valid options model parameter - @Test - public void testDeletePolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deletePolicyPath = "/v1/policies/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeletePolicyOptions model - DeletePolicyOptions deletePolicyOptionsModel = new DeletePolicyOptions.Builder() - .policyId("testString") - .build(); - - // Invoke deletePolicy() with a valid options model and verify the result - Response response = iamPolicyManagementService.deletePolicy(deletePolicyOptionsModel).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, deletePolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deletePolicy operation with and without retries enabled - @Test - public void testDeletePolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeletePolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeletePolicyWOptions(); - } - - // Test the deletePolicy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deletePolicy(null).execute(); - } - - // Test the updatePolicyState operation with a valid options model parameter - @Test - public void testUpdatePolicyStateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; - String updatePolicyStatePath = "/v1/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdatePolicyStateOptions model - UpdatePolicyStateOptions updatePolicyStateOptionsModel = new UpdatePolicyStateOptions.Builder() - .policyId("testString") - .ifMatch("testString") - .state("active") - .build(); - - // Invoke updatePolicyState() with a valid options model and verify the result - Response response = iamPolicyManagementService.updatePolicyState(updatePolicyStateOptionsModel).execute(); - assertNotNull(response); - Policy 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updatePolicyStatePath); - // 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 updatePolicyState operation with and without retries enabled - @Test - public void testUpdatePolicyStateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdatePolicyStateWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdatePolicyStateWOptions(); - } - - // Test the updatePolicyState operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdatePolicyStateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updatePolicyState(null).execute(); - } - - // Test the listRoles operation with a valid options model parameter - @Test - public void testListRolesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"custom_roles\": [{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}], \"service_roles\": [{\"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\"}], \"system_roles\": [{\"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\"}]}"; - String listRolesPath = "/v2/roles"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListRolesOptions model - ListRolesOptions listRolesOptionsModel = new ListRolesOptions.Builder() - .acceptLanguage("default") - .accountId("testString") - .serviceName("iam-groups") - .sourceServiceName("iam-groups") - .policyType("authorization") - .serviceGroupId("IAM") - .build(); - - // Invoke listRoles() with a valid options model and verify the result - Response response = iamPolicyManagementService.listRoles(listRolesOptionsModel).execute(); - assertNotNull(response); - RoleCollection 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, listRolesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("service_name"), "iam-groups"); - assertEquals(query.get("source_service_name"), "iam-groups"); - assertEquals(query.get("policy_type"), "authorization"); - assertEquals(query.get("service_group_id"), "IAM"); - } - - // Test the listRoles operation with and without retries enabled - @Test - public void testListRolesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListRolesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListRolesWOptions(); - } - - // Test the createRole operation with a valid options model parameter - @Test - public void testCreateRoleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; - String createRolePath = "/v2/roles"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the CreateRoleOptions model - CreateRoleOptions createRoleOptionsModel = new CreateRoleOptions.Builder() - .displayName("testString") - .actions(java.util.Arrays.asList("testString")) - .name("Developer") - .accountId("testString") - .serviceName("iam-groups") - .description("testString") - .acceptLanguage("default") - .build(); - - // Invoke createRole() with a valid options model and verify the result - Response response = iamPolicyManagementService.createRole(createRoleOptionsModel).execute(); - assertNotNull(response); - CustomRole 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createRolePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createRole operation with and without retries enabled - @Test - public void testCreateRoleWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateRoleWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateRoleWOptions(); - } - - // Test the createRole operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createRole(null).execute(); - } - - // Test the replaceRole operation with a valid options model parameter - @Test - public void testReplaceRoleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; - String replaceRolePath = "/v2/roles/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ReplaceRoleOptions model - ReplaceRoleOptions replaceRoleOptionsModel = new ReplaceRoleOptions.Builder() - .roleId("testString") - .ifMatch("testString") - .displayName("testString") - .actions(java.util.Arrays.asList("testString")) - .description("testString") - .build(); - - // Invoke replaceRole() with a valid options model and verify the result - Response response = iamPolicyManagementService.replaceRole(replaceRoleOptionsModel).execute(); - assertNotNull(response); - CustomRole 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, replaceRolePath); - // 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 replaceRole operation with and without retries enabled - @Test - public void testReplaceRoleWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplaceRoleWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplaceRoleWOptions(); - } - - // Test the replaceRole operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceRoleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replaceRole(null).execute(); - } - - // Test the getRole operation with a valid options model parameter - @Test - public void testGetRoleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; - String getRolePath = "/v2/roles/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetRoleOptions model - GetRoleOptions getRoleOptionsModel = new GetRoleOptions.Builder() - .roleId("testString") - .build(); - - // Invoke getRole() with a valid options model and verify the result - Response response = iamPolicyManagementService.getRole(getRoleOptionsModel).execute(); - assertNotNull(response); - CustomRole 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, getRolePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getRole operation with and without retries enabled - @Test - public void testGetRoleWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetRoleWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetRoleWOptions(); - } - - // Test the getRole operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getRole(null).execute(); - } - - // Test the deleteRole operation with a valid options model parameter - @Test - public void testDeleteRoleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteRolePath = "/v2/roles/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteRoleOptions model - DeleteRoleOptions deleteRoleOptionsModel = new DeleteRoleOptions.Builder() - .roleId("testString") - .build(); - - // Invoke deleteRole() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteRole(deleteRoleOptionsModel).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, deleteRolePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteRole operation with and without retries enabled - @Test - public void testDeleteRoleWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteRoleWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteRoleWOptions(); - } - - // Test the deleteRole operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteRole(null).execute(); - } - - // Test the listV2Policies operation with a valid options model parameter - @Test - public void testListV2PoliciesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policies\": [{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19, \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}]}"; - String listV2PoliciesPath = "/v2/policies"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListV2PoliciesOptions model - ListV2PoliciesOptions listV2PoliciesOptionsModel = new ListV2PoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .serviceName("testString") - .serviceGroupId("testString") - .sort("testString") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listV2Policies() with a valid options model and verify the result - Response response = iamPolicyManagementService.listV2Policies(listV2PoliciesOptionsModel).execute(); - assertNotNull(response); - V2PolicyCollection 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, listV2PoliciesPath); - // 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("access_group_id"), "testString"); - assertEquals(query.get("type"), "access"); - assertEquals(query.get("service_type"), "service"); - assertEquals(query.get("service_name"), "testString"); - assertEquals(query.get("service_group_id"), "testString"); - assertEquals(query.get("sort"), "testString"); - assertEquals(query.get("format"), "include_last_permit"); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listV2Policies operation with and without retries enabled - @Test - public void testListV2PoliciesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListV2PoliciesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListV2PoliciesWOptions(); - } - - // Test the listV2Policies operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListV2PoliciesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listV2Policies(null).execute(); - } - - // Test the listV2Policies operation using the V2PoliciesPager.getNext() method - @Test - public void testListV2PoliciesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListV2PoliciesOptions listV2PoliciesOptions = new ListV2PoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .serviceName("testString") - .serviceGroupId("testString") - .sort("testString") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - V2PoliciesPager pager = new V2PoliciesPager(iamPolicyManagementService, listV2PoliciesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listV2Policies operation using the V2PoliciesPager.getAll() method - @Test - public void testListV2PoliciesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListV2PoliciesOptions listV2PoliciesOptions = new ListV2PoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .serviceName("testString") - .serviceGroupId("testString") - .sort("testString") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - V2PoliciesPager pager = new V2PoliciesPager(iamPolicyManagementService, listV2PoliciesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createV2Policy operation with a valid options model parameter - @Test - public void testCreateV2PolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19}"; - String createV2PolicyPath = "/v2/policies"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the Grant model - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the Control model - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the CreateV2PolicyOptions model - CreateV2PolicyOptions createV2PolicyOptionsModel = new CreateV2PolicyOptions.Builder() - .control(controlModel) - .type("access") - .description("testString") - .subject(v2PolicySubjectModel) - .resource(v2PolicyResourceModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .acceptLanguage("default") - .build(); - - // Invoke createV2Policy() with a valid options model and verify the result - Response response = iamPolicyManagementService.createV2Policy(createV2PolicyOptionsModel).execute(); - assertNotNull(response); - V2Policy 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createV2PolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createV2Policy operation with and without retries enabled - @Test - public void testCreateV2PolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateV2PolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateV2PolicyWOptions(); - } - - // Test the createV2Policy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateV2PolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createV2Policy(null).execute(); - } - - // Test the replaceV2Policy operation with a valid options model parameter - @Test - public void testReplaceV2PolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19}"; - String replaceV2PolicyPath = "/v2/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the Grant model - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the Control model - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the ReplaceV2PolicyOptions model - ReplaceV2PolicyOptions replaceV2PolicyOptionsModel = new ReplaceV2PolicyOptions.Builder() - .id("testString") - .ifMatch("testString") - .control(controlModel) - .type("access") - .description("testString") - .subject(v2PolicySubjectModel) - .resource(v2PolicyResourceModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .build(); - - // Invoke replaceV2Policy() with a valid options model and verify the result - Response response = iamPolicyManagementService.replaceV2Policy(replaceV2PolicyOptionsModel).execute(); - assertNotNull(response); - V2Policy 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, replaceV2PolicyPath); - // 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 replaceV2Policy operation with and without retries enabled - @Test - public void testReplaceV2PolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplaceV2PolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplaceV2PolicyWOptions(); - } - - // Test the replaceV2Policy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceV2PolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replaceV2Policy(null).execute(); - } - - // Test the getV2Policy operation with a valid options model parameter - @Test - public void testGetV2PolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19, \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}"; - String getV2PolicyPath = "/v2/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetV2PolicyOptions model - GetV2PolicyOptions getV2PolicyOptionsModel = new GetV2PolicyOptions.Builder() - .id("testString") - .format("include_last_permit") - .build(); - - // Invoke getV2Policy() with a valid options model and verify the result - Response response = iamPolicyManagementService.getV2Policy(getV2PolicyOptionsModel).execute(); - assertNotNull(response); - V2PolicyTemplateMetaData 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, getV2PolicyPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("format"), "include_last_permit"); - } - - // Test the getV2Policy operation with and without retries enabled - @Test - public void testGetV2PolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetV2PolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetV2PolicyWOptions(); - } - - // Test the getV2Policy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetV2PolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getV2Policy(null).execute(); - } - - // Test the deleteV2Policy operation with a valid options model parameter - @Test - public void testDeleteV2PolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteV2PolicyPath = "/v2/policies/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteV2PolicyOptions model - DeleteV2PolicyOptions deleteV2PolicyOptionsModel = new DeleteV2PolicyOptions.Builder() - .id("testString") - .build(); - - // Invoke deleteV2Policy() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteV2Policy(deleteV2PolicyOptionsModel).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, deleteV2PolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteV2Policy operation with and without retries enabled - @Test - public void testDeleteV2PolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteV2PolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteV2PolicyWOptions(); - } - - // Test the deleteV2Policy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteV2PolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteV2Policy(null).execute(); - } - - // Test the listPolicyTemplates operation with a valid options model parameter - @Test - public void testListPolicyTemplatesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policy_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; - String listPolicyTemplatesPath = "/v1/policy_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListPolicyTemplatesOptions model - ListPolicyTemplatesOptions listPolicyTemplatesOptionsModel = new ListPolicyTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .state("active") - .name("testString") - .policyServiceType("service") - .policyServiceName("testString") - .policyServiceGroupId("testString") - .policyType("access") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listPolicyTemplates() with a valid options model and verify the result - Response response = iamPolicyManagementService.listPolicyTemplates(listPolicyTemplatesOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateCollection 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, listPolicyTemplatesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("state"), "active"); - assertEquals(query.get("name"), "testString"); - assertEquals(query.get("policy_service_type"), "service"); - assertEquals(query.get("policy_service_name"), "testString"); - assertEquals(query.get("policy_service_group_id"), "testString"); - assertEquals(query.get("policy_type"), "access"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listPolicyTemplates operation with and without retries enabled - @Test - public void testListPolicyTemplatesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListPolicyTemplatesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListPolicyTemplatesWOptions(); - } - - // Test the listPolicyTemplates operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyTemplatesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listPolicyTemplates(null).execute(); - } - - // Test the listPolicyTemplates operation using the PolicyTemplatesPager.getNext() method - @Test - public void testListPolicyTemplatesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyTemplatesOptions listPolicyTemplatesOptions = new ListPolicyTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .state("active") - .name("testString") - .policyServiceType("service") - .policyServiceName("testString") - .policyServiceGroupId("testString") - .policyType("access") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - PolicyTemplatesPager pager = new PolicyTemplatesPager(iamPolicyManagementService, listPolicyTemplatesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listPolicyTemplates operation using the PolicyTemplatesPager.getAll() method - @Test - public void testListPolicyTemplatesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyTemplatesOptions listPolicyTemplatesOptions = new ListPolicyTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .state("active") - .name("testString") - .policyServiceType("service") - .policyServiceName("testString") - .policyServiceGroupId("testString") - .policyType("access") - .limit(Long.valueOf("10")) - .build(); - - PolicyTemplatesPager pager = new PolicyTemplatesPager(iamPolicyManagementService, listPolicyTemplatesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createPolicyTemplate operation with a valid options model parameter - @Test - public void testCreatePolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; - String createPolicyTemplatePath = "/v1/policy_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the TemplateGrantRoles model - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the TemplateControl model - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - - // Construct an instance of the TemplatePolicy model - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - - // Construct an instance of the CreatePolicyTemplateOptions model - CreatePolicyTemplateOptions createPolicyTemplateOptionsModel = new CreatePolicyTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .policy(templatePolicyModel) - .description("testString") - .committed(true) - .acceptLanguage("default") - .build(); - - // Invoke createPolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.createPolicyTemplate(createPolicyTemplateOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateLimitData 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createPolicyTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createPolicyTemplate operation with and without retries enabled - @Test - public void testCreatePolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreatePolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreatePolicyTemplateWOptions(); - } - - // Test the createPolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createPolicyTemplate(null).execute(); - } - - // Test the getPolicyTemplate operation with a valid options model parameter - @Test - public void testGetPolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String getPolicyTemplatePath = "/v1/policy_templates/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetPolicyTemplateOptions model - GetPolicyTemplateOptions getPolicyTemplateOptionsModel = new GetPolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .state("active") - .build(); - - // Invoke getPolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.getPolicyTemplate(getPolicyTemplateOptionsModel).execute(); - assertNotNull(response); - PolicyTemplate 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, getPolicyTemplatePath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - } - - // Test the getPolicyTemplate operation with and without retries enabled - @Test - public void testGetPolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetPolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetPolicyTemplateWOptions(); - } - - // Test the getPolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getPolicyTemplate(null).execute(); - } - - // Test the deletePolicyTemplate operation with a valid options model parameter - @Test - public void testDeletePolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deletePolicyTemplatePath = "/v1/policy_templates/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeletePolicyTemplateOptions model - DeletePolicyTemplateOptions deletePolicyTemplateOptionsModel = new DeletePolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .build(); - - // Invoke deletePolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.deletePolicyTemplate(deletePolicyTemplateOptionsModel).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, deletePolicyTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deletePolicyTemplate operation with and without retries enabled - @Test - public void testDeletePolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeletePolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeletePolicyTemplateWOptions(); - } - - // Test the deletePolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deletePolicyTemplate(null).execute(); - } - - // Test the createPolicyTemplateVersion operation with a valid options model parameter - @Test - public void testCreatePolicyTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; - String createPolicyTemplateVersionPath = "/v1/policy_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the TemplateGrantRoles model - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the TemplateControl model - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - - // Construct an instance of the TemplatePolicy model - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - - // Construct an instance of the CreatePolicyTemplateVersionOptions model - CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptionsModel = new CreatePolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .policy(templatePolicyModel) - .name("testString") - .description("testString") - .committed(true) - .build(); - - // Invoke createPolicyTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.createPolicyTemplateVersion(createPolicyTemplateVersionOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateLimitData 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createPolicyTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createPolicyTemplateVersion operation with and without retries enabled - @Test - public void testCreatePolicyTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreatePolicyTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreatePolicyTemplateVersionWOptions(); - } - - // Test the createPolicyTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createPolicyTemplateVersion(null).execute(); - } - - // Test the listPolicyTemplateVersions operation with a valid options model parameter - @Test - public void testListPolicyTemplateVersionsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; - String listPolicyTemplateVersionsPath = "/v1/policy_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListPolicyTemplateVersionsOptions model - ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptionsModel = new ListPolicyTemplateVersionsOptions.Builder() - .policyTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listPolicyTemplateVersions() with a valid options model and verify the result - Response response = iamPolicyManagementService.listPolicyTemplateVersions(listPolicyTemplateVersionsOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateVersionsCollection 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, listPolicyTemplateVersionsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listPolicyTemplateVersions operation with and without retries enabled - @Test - public void testListPolicyTemplateVersionsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListPolicyTemplateVersionsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListPolicyTemplateVersionsWOptions(); - } - - // Test the listPolicyTemplateVersions operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyTemplateVersionsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listPolicyTemplateVersions(null).execute(); - } - - // Test the listPolicyTemplateVersions operation using the PolicyTemplateVersionsPager.getNext() method - @Test - public void testListPolicyTemplateVersionsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions = new ListPolicyTemplateVersionsOptions.Builder() - .policyTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - PolicyTemplateVersionsPager pager = new PolicyTemplateVersionsPager(iamPolicyManagementService, listPolicyTemplateVersionsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listPolicyTemplateVersions operation using the PolicyTemplateVersionsPager.getAll() method - @Test - public void testListPolicyTemplateVersionsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions = new ListPolicyTemplateVersionsOptions.Builder() - .policyTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - PolicyTemplateVersionsPager pager = new PolicyTemplateVersionsPager(iamPolicyManagementService, listPolicyTemplateVersionsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the replacePolicyTemplate operation with a valid options model parameter - @Test - public void testReplacePolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String replacePolicyTemplatePath = "/v1/policy_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the TemplateGrantRoles model - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the TemplateControl model - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - - // Construct an instance of the TemplatePolicy model - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - - // Construct an instance of the ReplacePolicyTemplateOptions model - ReplacePolicyTemplateOptions replacePolicyTemplateOptionsModel = new ReplacePolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .ifMatch("testString") - .policy(templatePolicyModel) - .name("testString") - .description("testString") - .committed(true) - .build(); - - // Invoke replacePolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.replacePolicyTemplate(replacePolicyTemplateOptionsModel).execute(); - assertNotNull(response); - PolicyTemplate 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, replacePolicyTemplatePath); - // 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 replacePolicyTemplate operation with and without retries enabled - @Test - public void testReplacePolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplacePolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplacePolicyTemplateWOptions(); - } - - // Test the replacePolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplacePolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replacePolicyTemplate(null).execute(); - } - - // Test the deletePolicyTemplateVersion operation with a valid options model parameter - @Test - public void testDeletePolicyTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deletePolicyTemplateVersionPath = "/v1/policy_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeletePolicyTemplateVersionOptions model - DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptionsModel = new DeletePolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - - // Invoke deletePolicyTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.deletePolicyTemplateVersion(deletePolicyTemplateVersionOptionsModel).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, deletePolicyTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deletePolicyTemplateVersion operation with and without retries enabled - @Test - public void testDeletePolicyTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeletePolicyTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeletePolicyTemplateVersionWOptions(); - } - - // Test the deletePolicyTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deletePolicyTemplateVersion(null).execute(); - } - - // Test the getPolicyTemplateVersion operation with a valid options model parameter - @Test - public void testGetPolicyTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String getPolicyTemplateVersionPath = "/v1/policy_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetPolicyTemplateVersionOptions model - GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptionsModel = new GetPolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - - // Invoke getPolicyTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.getPolicyTemplateVersion(getPolicyTemplateVersionOptionsModel).execute(); - assertNotNull(response); - PolicyTemplate 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, getPolicyTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getPolicyTemplateVersion operation with and without retries enabled - @Test - public void testGetPolicyTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetPolicyTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetPolicyTemplateVersionWOptions(); - } - - // Test the getPolicyTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getPolicyTemplateVersion(null).execute(); - } - - // Test the commitPolicyTemplate operation with a valid options model parameter - @Test - public void testCommitPolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String commitPolicyTemplatePath = "/v1/policy_templates/testString/versions/testString/commit"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the CommitPolicyTemplateOptions model - CommitPolicyTemplateOptions commitPolicyTemplateOptionsModel = new CommitPolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - - // Invoke commitPolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.commitPolicyTemplate(commitPolicyTemplateOptionsModel).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, commitPolicyTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the commitPolicyTemplate operation with and without retries enabled - @Test - public void testCommitPolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCommitPolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCommitPolicyTemplateWOptions(); - } - - // Test the commitPolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitPolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.commitPolicyTemplate(null).execute(); - } - - // Test the listPolicyAssignments operation with a valid options model parameter - @Test - public void testListPolicyAssignmentsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}]}"; - String listPolicyAssignmentsPath = "/v1/policy_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListPolicyAssignmentsOptions model - ListPolicyAssignmentsOptions listPolicyAssignmentsOptionsModel = new ListPolicyAssignmentsOptions.Builder() - .version("1.0") - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listPolicyAssignments() with a valid options model and verify the result - Response response = iamPolicyManagementService.listPolicyAssignments(listPolicyAssignmentsOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateAssignmentCollection 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, listPolicyAssignmentsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "1.0"); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("template_id"), "testString"); - assertEquals(query.get("template_version"), "testString"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listPolicyAssignments operation with and without retries enabled - @Test - public void testListPolicyAssignmentsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListPolicyAssignmentsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListPolicyAssignmentsWOptions(); - } - - // Test the listPolicyAssignments operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyAssignmentsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listPolicyAssignments(null).execute(); - } - - // Test the listPolicyAssignments operation using the PolicyAssignmentsPager.getNext() method - @Test - public void testListPolicyAssignmentsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyAssignmentsOptions listPolicyAssignmentsOptions = new ListPolicyAssignmentsOptions.Builder() - .version("1.0") - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - PolicyAssignmentsPager pager = new PolicyAssignmentsPager(iamPolicyManagementService, listPolicyAssignmentsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listPolicyAssignments operation using the PolicyAssignmentsPager.getAll() method - @Test - public void testListPolicyAssignmentsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyAssignmentsOptions listPolicyAssignmentsOptions = new ListPolicyAssignmentsOptions.Builder() - .version("1.0") - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - PolicyAssignmentsPager pager = new PolicyAssignmentsPager(iamPolicyManagementService, listPolicyAssignmentsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createPolicyTemplateAssignment operation with a valid options model parameter - @Test - public void testCreatePolicyTemplateAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}]}"; - String createPolicyTemplateAssignmentPath = "/v1/policy_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the AssignmentTargetDetails model - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - - // Construct an instance of the AssignmentTemplateDetails model - AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() - .id("testString") - .version("testString") - .build(); - - // Construct an instance of the CreatePolicyTemplateAssignmentOptions model - CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptionsModel = new CreatePolicyTemplateAssignmentOptions.Builder() - .version("1.0") - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(assignmentTemplateDetailsModel)) - .acceptLanguage("default") - .build(); - - // Invoke createPolicyTemplateAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.createPolicyTemplateAssignment(createPolicyTemplateAssignmentOptionsModel).execute(); - assertNotNull(response); - PolicyAssignmentV1Collection 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createPolicyTemplateAssignmentPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "1.0"); - } - - // Test the createPolicyTemplateAssignment operation with and without retries enabled - @Test - public void testCreatePolicyTemplateAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreatePolicyTemplateAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreatePolicyTemplateAssignmentWOptions(); - } - - // Test the createPolicyTemplateAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createPolicyTemplateAssignment(null).execute(); - } - - // Test the getPolicyAssignment operation with a valid options model parameter - @Test - public void testGetPolicyAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}"; - String getPolicyAssignmentPath = "/v1/policy_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetPolicyAssignmentOptions model - GetPolicyAssignmentOptions getPolicyAssignmentOptionsModel = new GetPolicyAssignmentOptions.Builder() - .assignmentId("testString") - .version("1.0") - .build(); - - // Invoke getPolicyAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.getPolicyAssignment(getPolicyAssignmentOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateAssignmentItems 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, getPolicyAssignmentPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "1.0"); - } - - // Test the getPolicyAssignment operation with and without retries enabled - @Test - public void testGetPolicyAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetPolicyAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetPolicyAssignmentWOptions(); - } - - // Test the getPolicyAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getPolicyAssignment(null).execute(); - } - - // Test the updatePolicyAssignment operation with a valid options model parameter - @Test - public void testUpdatePolicyAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}"; - String updatePolicyAssignmentPath = "/v1/policy_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdatePolicyAssignmentOptions model - UpdatePolicyAssignmentOptions updatePolicyAssignmentOptionsModel = new UpdatePolicyAssignmentOptions.Builder() - .assignmentId("testString") - .version("1.0") - .ifMatch("testString") - .templateVersion("testString") - .build(); - - // Invoke updatePolicyAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.updatePolicyAssignment(updatePolicyAssignmentOptionsModel).execute(); - assertNotNull(response); - PolicyAssignmentV1 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updatePolicyAssignmentPath); - // Verify header parameters - assertEquals(request.getHeader("If-Match"), "testString"); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "1.0"); - } - - // Test the updatePolicyAssignment operation with and without retries enabled - @Test - public void testUpdatePolicyAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdatePolicyAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdatePolicyAssignmentWOptions(); - } - - // Test the updatePolicyAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdatePolicyAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updatePolicyAssignment(null).execute(); - } - - // Test the deletePolicyAssignment operation with a valid options model parameter - @Test - public void testDeletePolicyAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deletePolicyAssignmentPath = "/v1/policy_assignments/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeletePolicyAssignmentOptions model - DeletePolicyAssignmentOptions deletePolicyAssignmentOptionsModel = new DeletePolicyAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke deletePolicyAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.deletePolicyAssignment(deletePolicyAssignmentOptionsModel).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, deletePolicyAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deletePolicyAssignment operation with and without retries enabled - @Test - public void testDeletePolicyAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeletePolicyAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeletePolicyAssignmentWOptions(); - } - - // Test the deletePolicyAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deletePolicyAssignment(null).execute(); - } - - // Test the getSettings operation with a valid options model parameter - @Test - public void testGetSettingsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"external_account_identity_interaction\": {\"identity_types\": {\"user\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service_id\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}}}}"; - String getSettingsPath = "/v1/accounts/testString/settings/access_management"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetSettingsOptions model - GetSettingsOptions getSettingsOptionsModel = new GetSettingsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .build(); - - // Invoke getSettings() with a valid options model and verify the result - Response response = iamPolicyManagementService.getSettings(getSettingsOptionsModel).execute(); - assertNotNull(response); - AccountSettingsAccessManagement 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, getSettingsPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getSettings operation with and without retries enabled - @Test - public void testGetSettingsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetSettingsWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetSettingsWOptions(); - } - - // Test the getSettings operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetSettingsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getSettings(null).execute(); - } - - // Test the updateSettings operation with a valid options model parameter - @Test - public void testUpdateSettingsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"external_account_identity_interaction\": {\"identity_types\": {\"user\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service_id\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}}}}"; - String updateSettingsPath = "/v1/accounts/testString/settings/access_management"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the IdentityTypesBase model - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the IdentityTypesPatch model - IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() - .user(identityTypesBaseModel) - .serviceId(identityTypesBaseModel) - .service(identityTypesBaseModel) - .build(); - - // Construct an instance of the ExternalAccountIdentityInteractionPatch model - ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() - .identityTypes(identityTypesPatchModel) - .build(); - - // Construct an instance of the UpdateSettingsOptions model - UpdateSettingsOptions updateSettingsOptionsModel = new UpdateSettingsOptions.Builder() - .accountId("testString") - .ifMatch("testString") - .externalAccountIdentityInteraction(externalAccountIdentityInteractionPatchModel) - .acceptLanguage("default") - .build(); - - // Invoke updateSettings() with a valid options model and verify the result - Response response = iamPolicyManagementService.updateSettings(updateSettingsOptionsModel).execute(); - assertNotNull(response); - AccountSettingsAccessManagement 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateSettingsPath); - // 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 updateSettings operation with and without retries enabled - @Test - public void testUpdateSettingsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdateSettingsWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdateSettingsWOptions(); - } - - // Test the updateSettings operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateSettingsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updateSettings(null).execute(); - } - - // Test the listActionControlTemplates operation with a valid options model parameter - @Test - public void testListActionControlTemplatesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"action_control_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; - String listActionControlTemplatesPath = "/v1/action_control_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListActionControlTemplatesOptions model - ListActionControlTemplatesOptions listActionControlTemplatesOptionsModel = new ListActionControlTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listActionControlTemplates() with a valid options model and verify the result - Response response = iamPolicyManagementService.listActionControlTemplates(listActionControlTemplatesOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplateCollection 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, listActionControlTemplatesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listActionControlTemplates operation with and without retries enabled - @Test - public void testListActionControlTemplatesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListActionControlTemplatesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListActionControlTemplatesWOptions(); - } - - // Test the listActionControlTemplates operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlTemplatesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listActionControlTemplates(null).execute(); - } - - // Test the listActionControlTemplates operation using the ActionControlTemplatesPager.getNext() method - @Test - public void testListActionControlTemplatesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlTemplatesOptions listActionControlTemplatesOptions = new ListActionControlTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - ActionControlTemplatesPager pager = new ActionControlTemplatesPager(iamPolicyManagementService, listActionControlTemplatesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listActionControlTemplates operation using the ActionControlTemplatesPager.getAll() method - @Test - public void testListActionControlTemplatesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlTemplatesOptions listActionControlTemplatesOptions = new ListActionControlTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .limit(Long.valueOf("10")) - .build(); - - ActionControlTemplatesPager pager = new ActionControlTemplatesPager(iamPolicyManagementService, listActionControlTemplatesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createActionControlTemplate operation with a valid options model parameter - @Test - public void testCreateActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String createActionControlTemplatePath = "/v1/action_control_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateActionControl model - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the CreateActionControlTemplateOptions model - CreateActionControlTemplateOptions createActionControlTemplateOptionsModel = new CreateActionControlTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .description("testString") - .committed(true) - .actionControl(templateActionControlModel) - .acceptLanguage("default") - .build(); - - // Invoke createActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.createActionControlTemplate(createActionControlTemplateOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createActionControlTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createActionControlTemplate operation with and without retries enabled - @Test - public void testCreateActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateActionControlTemplateWOptions(); - } - - // Test the createActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createActionControlTemplate(null).execute(); - } - - // Test the getActionControlTemplate operation with a valid options model parameter - @Test - public void testGetActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String getActionControlTemplatePath = "/v1/action_control_templates/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetActionControlTemplateOptions model - GetActionControlTemplateOptions getActionControlTemplateOptionsModel = new GetActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .build(); - - // Invoke getActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.getActionControlTemplate(getActionControlTemplateOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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, getActionControlTemplatePath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - } - - // Test the getActionControlTemplate operation with and without retries enabled - @Test - public void testGetActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetActionControlTemplateWOptions(); - } - - // Test the getActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getActionControlTemplate(null).execute(); - } - - // Test the deleteActionControlTemplate operation with a valid options model parameter - @Test - public void testDeleteActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteActionControlTemplatePath = "/v1/action_control_templates/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteActionControlTemplateOptions model - DeleteActionControlTemplateOptions deleteActionControlTemplateOptionsModel = new DeleteActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .build(); - - // Invoke deleteActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteActionControlTemplate(deleteActionControlTemplateOptionsModel).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, deleteActionControlTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteActionControlTemplate operation with and without retries enabled - @Test - public void testDeleteActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteActionControlTemplateWOptions(); - } - - // Test the deleteActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteActionControlTemplate(null).execute(); - } - - // Test the createActionControlTemplateVersion operation with a valid options model parameter - @Test - public void testCreateActionControlTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String createActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateActionControl model - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the CreateActionControlTemplateVersionOptions model - CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptionsModel = new CreateActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .name("testString") - .description("testString") - .actionControl(templateActionControlModel) - .committed(true) - .build(); - - // Invoke createActionControlTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.createActionControlTemplateVersion(createActionControlTemplateVersionOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createActionControlTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createActionControlTemplateVersion operation with and without retries enabled - @Test - public void testCreateActionControlTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateActionControlTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateActionControlTemplateVersionWOptions(); - } - - // Test the createActionControlTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createActionControlTemplateVersion(null).execute(); - } - - // Test the listActionControlTemplateVersions operation with a valid options model parameter - @Test - public void testListActionControlTemplateVersionsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; - String listActionControlTemplateVersionsPath = "/v1/action_control_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListActionControlTemplateVersionsOptions model - ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptionsModel = new ListActionControlTemplateVersionsOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listActionControlTemplateVersions() with a valid options model and verify the result - Response response = iamPolicyManagementService.listActionControlTemplateVersions(listActionControlTemplateVersionsOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplateVersionsCollection 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, listActionControlTemplateVersionsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listActionControlTemplateVersions operation with and without retries enabled - @Test - public void testListActionControlTemplateVersionsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListActionControlTemplateVersionsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListActionControlTemplateVersionsWOptions(); - } - - // Test the listActionControlTemplateVersions operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlTemplateVersionsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listActionControlTemplateVersions(null).execute(); - } - - // Test the listActionControlTemplateVersions operation using the ActionControlTemplateVersionsPager.getNext() method - @Test - public void testListActionControlTemplateVersionsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions = new ListActionControlTemplateVersionsOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - ActionControlTemplateVersionsPager pager = new ActionControlTemplateVersionsPager(iamPolicyManagementService, listActionControlTemplateVersionsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listActionControlTemplateVersions operation using the ActionControlTemplateVersionsPager.getAll() method - @Test - public void testListActionControlTemplateVersionsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions = new ListActionControlTemplateVersionsOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - ActionControlTemplateVersionsPager pager = new ActionControlTemplateVersionsPager(iamPolicyManagementService, listActionControlTemplateVersionsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the replaceActionControlTemplate operation with a valid options model parameter - @Test - public void testReplaceActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String replaceActionControlTemplatePath = "/v1/action_control_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateActionControl model - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the ReplaceActionControlTemplateOptions model - ReplaceActionControlTemplateOptions replaceActionControlTemplateOptionsModel = new ReplaceActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .ifMatch("testString") - .name("testString") - .description("testString") - .actionControl(templateActionControlModel) - .committed(true) - .build(); - - // Invoke replaceActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.replaceActionControlTemplate(replaceActionControlTemplateOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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, replaceActionControlTemplatePath); - // 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 replaceActionControlTemplate operation with and without retries enabled - @Test - public void testReplaceActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplaceActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplaceActionControlTemplateWOptions(); - } - - // Test the replaceActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replaceActionControlTemplate(null).execute(); - } - - // Test the deleteActionControlTemplateVersion operation with a valid options model parameter - @Test - public void testDeleteActionControlTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteActionControlTemplateVersionOptions model - DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptionsModel = new DeleteActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - - // Invoke deleteActionControlTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteActionControlTemplateVersion(deleteActionControlTemplateVersionOptionsModel).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, deleteActionControlTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteActionControlTemplateVersion operation with and without retries enabled - @Test - public void testDeleteActionControlTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteActionControlTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteActionControlTemplateVersionWOptions(); - } - - // Test the deleteActionControlTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteActionControlTemplateVersion(null).execute(); - } - - // Test the getActionControlTemplateVersion operation with a valid options model parameter - @Test - public void testGetActionControlTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String getActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetActionControlTemplateVersionOptions model - GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptionsModel = new GetActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - - // Invoke getActionControlTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.getActionControlTemplateVersion(getActionControlTemplateVersionOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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, getActionControlTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getActionControlTemplateVersion operation with and without retries enabled - @Test - public void testGetActionControlTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetActionControlTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetActionControlTemplateVersionWOptions(); - } - - // Test the getActionControlTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getActionControlTemplateVersion(null).execute(); - } - - // Test the commitActionControlTemplate operation with a valid options model parameter - @Test - public void testCommitActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String commitActionControlTemplatePath = "/v1/action_control_templates/testString/versions/testString/commit"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the CommitActionControlTemplateOptions model - CommitActionControlTemplateOptions commitActionControlTemplateOptionsModel = new CommitActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - - // Invoke commitActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.commitActionControlTemplate(commitActionControlTemplateOptionsModel).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, commitActionControlTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the commitActionControlTemplate operation with and without retries enabled - @Test - public void testCommitActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCommitActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCommitActionControlTemplateWOptions(); - } - - // Test the commitActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.commitActionControlTemplate(null).execute(); - } - - // Test the listActionControlAssignments operation with a valid options model parameter - @Test - public void testListActionControlAssignmentsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; - String listActionControlAssignmentsPath = "/v1/action_control_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListActionControlAssignmentsOptions model - ListActionControlAssignmentsOptions listActionControlAssignmentsOptionsModel = new ListActionControlAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listActionControlAssignments() with a valid options model and verify the result - Response response = iamPolicyManagementService.listActionControlAssignments(listActionControlAssignmentsOptionsModel).execute(); - assertNotNull(response); - ActionControlAssignmentCollection 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, listActionControlAssignmentsPath); - // 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(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listActionControlAssignments operation with and without retries enabled - @Test - public void testListActionControlAssignmentsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListActionControlAssignmentsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListActionControlAssignmentsWOptions(); - } - - // Test the listActionControlAssignments operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlAssignmentsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listActionControlAssignments(null).execute(); - } - - // Test the listActionControlAssignments operation using the ActionControlAssignmentsPager.getNext() method - @Test - public void testListActionControlAssignmentsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlAssignmentsOptions listActionControlAssignmentsOptions = new ListActionControlAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - ActionControlAssignmentsPager pager = new ActionControlAssignmentsPager(iamPolicyManagementService, listActionControlAssignmentsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listActionControlAssignments operation using the ActionControlAssignmentsPager.getAll() method - @Test - public void testListActionControlAssignmentsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlAssignmentsOptions listActionControlAssignmentsOptions = new ListActionControlAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - ActionControlAssignmentsPager pager = new ActionControlAssignmentsPager(iamPolicyManagementService, listActionControlAssignmentsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createActionControlTemplateAssignment operation with a valid options model parameter - @Test - public void testCreateActionControlTemplateAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; - String createActionControlTemplateAssignmentPath = "/v1/action_control_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the AssignmentTargetDetails model - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - - // Construct an instance of the ActionControlAssignmentTemplate model - ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - - // Construct an instance of the CreateActionControlTemplateAssignmentOptions model - CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptionsModel = new CreateActionControlTemplateAssignmentOptions.Builder() - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(actionControlAssignmentTemplateModel)) - .acceptLanguage("default") - .build(); - - // Invoke createActionControlTemplateAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.createActionControlTemplateAssignment(createActionControlTemplateAssignmentOptionsModel).execute(); - assertNotNull(response); - ActionControlAssignmentCollection 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createActionControlTemplateAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createActionControlTemplateAssignment operation with and without retries enabled - @Test - public void testCreateActionControlTemplateAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateActionControlTemplateAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateActionControlTemplateAssignmentWOptions(); - } - - // Test the createActionControlTemplateAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createActionControlTemplateAssignment(null).execute(); - } - - // Test the getActionControlAssignment operation with a valid options model parameter - @Test - public void testGetActionControlAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; - String getActionControlAssignmentPath = "/v1/action_control_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetActionControlAssignmentOptions model - GetActionControlAssignmentOptions getActionControlAssignmentOptionsModel = new GetActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke getActionControlAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.getActionControlAssignment(getActionControlAssignmentOptionsModel).execute(); - assertNotNull(response); - ActionControlAssignment 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, getActionControlAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getActionControlAssignment operation with and without retries enabled - @Test - public void testGetActionControlAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetActionControlAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetActionControlAssignmentWOptions(); - } - - // Test the getActionControlAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getActionControlAssignment(null).execute(); - } - - // Test the updateActionControlAssignment operation with a valid options model parameter - @Test - public void testUpdateActionControlAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; - String updateActionControlAssignmentPath = "/v1/action_control_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdateActionControlAssignmentOptions model - UpdateActionControlAssignmentOptions updateActionControlAssignmentOptionsModel = new UpdateActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .ifMatch("testString") - .templateVersion("testString") - .build(); - - // Invoke updateActionControlAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.updateActionControlAssignment(updateActionControlAssignmentOptionsModel).execute(); - assertNotNull(response); - ActionControlAssignment 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateActionControlAssignmentPath); - // 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 updateActionControlAssignment operation with and without retries enabled - @Test - public void testUpdateActionControlAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdateActionControlAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdateActionControlAssignmentWOptions(); - } - - // Test the updateActionControlAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateActionControlAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updateActionControlAssignment(null).execute(); - } - - // Test the deleteActionControlAssignment operation with a valid options model parameter - @Test - public void testDeleteActionControlAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteActionControlAssignmentPath = "/v1/action_control_assignments/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteActionControlAssignmentOptions model - DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptionsModel = new DeleteActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke deleteActionControlAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteActionControlAssignment(deleteActionControlAssignmentOptionsModel).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, deleteActionControlAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteActionControlAssignment operation with and without retries enabled - @Test - public void testDeleteActionControlAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteActionControlAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteActionControlAssignmentWOptions(); - } - - // Test the deleteActionControlAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteActionControlAssignment(null).execute(); - } - - // Test the listRoleTemplates operation with a valid options model parameter - @Test - public void testListRoleTemplatesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"role_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; - String listRoleTemplatesPath = "/v1/role_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListRoleTemplatesOptions model - ListRoleTemplatesOptions listRoleTemplatesOptionsModel = new ListRoleTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .name("testString") - .roleName("testString") - .roleServiceName("testString") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listRoleTemplates() with a valid options model and verify the result - Response response = iamPolicyManagementService.listRoleTemplates(listRoleTemplatesOptionsModel).execute(); - assertNotNull(response); - RoleTemplateCollection 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, listRoleTemplatesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("name"), "testString"); - assertEquals(query.get("role_name"), "testString"); - assertEquals(query.get("role_service_name"), "testString"); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listRoleTemplates operation with and without retries enabled - @Test - public void testListRoleTemplatesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListRoleTemplatesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListRoleTemplatesWOptions(); - } - - // Test the listRoleTemplates operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleTemplatesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listRoleTemplates(null).execute(); - } - - // Test the listRoleTemplates operation using the RoleTemplatesPager.getNext() method - @Test - public void testListRoleTemplatesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleTemplatesOptions listRoleTemplatesOptions = new ListRoleTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .name("testString") - .roleName("testString") - .roleServiceName("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - RoleTemplatesPager pager = new RoleTemplatesPager(iamPolicyManagementService, listRoleTemplatesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listRoleTemplates operation using the RoleTemplatesPager.getAll() method - @Test - public void testListRoleTemplatesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleTemplatesOptions listRoleTemplatesOptions = new ListRoleTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .name("testString") - .roleName("testString") - .roleServiceName("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - RoleTemplatesPager pager = new RoleTemplatesPager(iamPolicyManagementService, listRoleTemplatesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createRoleTemplate operation with a valid options model parameter - @Test - public void testCreateRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String createRoleTemplatePath = "/v1/role_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the RoleTemplatePrototypeRole model - RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() - .name("testString") - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the CreateRoleTemplateOptions model - CreateRoleTemplateOptions createRoleTemplateOptionsModel = new CreateRoleTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .description("testString") - .committed(true) - .role(roleTemplatePrototypeRoleModel) - .acceptLanguage("default") - .build(); - - // Invoke createRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.createRoleTemplate(createRoleTemplateOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createRoleTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createRoleTemplate operation with and without retries enabled - @Test - public void testCreateRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateRoleTemplateWOptions(); - } - - // Test the createRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createRoleTemplate(null).execute(); - } - - // Test the getRoleTemplate operation with a valid options model parameter - @Test - public void testGetRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String getRoleTemplatePath = "/v1/role_templates/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetRoleTemplateOptions model - GetRoleTemplateOptions getRoleTemplateOptionsModel = new GetRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .state("active") - .build(); - - // Invoke getRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.getRoleTemplate(getRoleTemplateOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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, getRoleTemplatePath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - } - - // Test the getRoleTemplate operation with and without retries enabled - @Test - public void testGetRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetRoleTemplateWOptions(); - } - - // Test the getRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getRoleTemplate(null).execute(); - } - - // Test the deleteRoleTemplate operation with a valid options model parameter - @Test - public void testDeleteRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteRoleTemplatePath = "/v1/role_templates/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteRoleTemplateOptions model - DeleteRoleTemplateOptions deleteRoleTemplateOptionsModel = new DeleteRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .build(); - - // Invoke deleteRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteRoleTemplate(deleteRoleTemplateOptionsModel).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, deleteRoleTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteRoleTemplate operation with and without retries enabled - @Test - public void testDeleteRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteRoleTemplateWOptions(); - } - - // Test the deleteRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteRoleTemplate(null).execute(); - } - - // Test the createRoleTemplateVersion operation with a valid options model parameter - @Test - public void testCreateRoleTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String createRoleTemplateVersionPath = "/v1/role_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateRole model - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the CreateRoleTemplateVersionOptions model - CreateRoleTemplateVersionOptions createRoleTemplateVersionOptionsModel = new CreateRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .name("testString") - .description("testString") - .role(templateRoleModel) - .committed(true) - .build(); - - // Invoke createRoleTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.createRoleTemplateVersion(createRoleTemplateVersionOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createRoleTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createRoleTemplateVersion operation with and without retries enabled - @Test - public void testCreateRoleTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateRoleTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateRoleTemplateVersionWOptions(); - } - - // Test the createRoleTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createRoleTemplateVersion(null).execute(); - } - - // Test the listRoleTemplateVersions operation with a valid options model parameter - @Test - public void testListRoleTemplateVersionsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; - String listRoleTemplateVersionsPath = "/v1/role_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListRoleTemplateVersionsOptions model - ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptionsModel = new ListRoleTemplateVersionsOptions.Builder() - .roleTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listRoleTemplateVersions() with a valid options model and verify the result - Response response = iamPolicyManagementService.listRoleTemplateVersions(listRoleTemplateVersionsOptionsModel).execute(); - assertNotNull(response); - RoleTemplateVersionsCollection 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, listRoleTemplateVersionsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listRoleTemplateVersions operation with and without retries enabled - @Test - public void testListRoleTemplateVersionsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListRoleTemplateVersionsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListRoleTemplateVersionsWOptions(); - } - - // Test the listRoleTemplateVersions operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleTemplateVersionsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listRoleTemplateVersions(null).execute(); - } - - // Test the listRoleTemplateVersions operation using the RoleTemplateVersionsPager.getNext() method - @Test - public void testListRoleTemplateVersionsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions = new ListRoleTemplateVersionsOptions.Builder() - .roleTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - RoleTemplateVersionsPager pager = new RoleTemplateVersionsPager(iamPolicyManagementService, listRoleTemplateVersionsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listRoleTemplateVersions operation using the RoleTemplateVersionsPager.getAll() method - @Test - public void testListRoleTemplateVersionsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions = new ListRoleTemplateVersionsOptions.Builder() - .roleTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - RoleTemplateVersionsPager pager = new RoleTemplateVersionsPager(iamPolicyManagementService, listRoleTemplateVersionsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the replaceRoleTemplate operation with a valid options model parameter - @Test - public void testReplaceRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String replaceRoleTemplatePath = "/v1/role_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateRole model - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the ReplaceRoleTemplateOptions model - ReplaceRoleTemplateOptions replaceRoleTemplateOptionsModel = new ReplaceRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .ifMatch("testString") - .name("testString") - .description("testString") - .role(templateRoleModel) - .committed(true) - .build(); - - // Invoke replaceRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.replaceRoleTemplate(replaceRoleTemplateOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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, replaceRoleTemplatePath); - // 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 replaceRoleTemplate operation with and without retries enabled - @Test - public void testReplaceRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplaceRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplaceRoleTemplateWOptions(); - } - - // Test the replaceRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replaceRoleTemplate(null).execute(); - } - - // Test the deleteRoleTemplateVersion operation with a valid options model parameter - @Test - public void testDeleteRoleTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteRoleTemplateVersionPath = "/v1/role_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteRoleTemplateVersionOptions model - DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptionsModel = new DeleteRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - - // Invoke deleteRoleTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteRoleTemplateVersion(deleteRoleTemplateVersionOptionsModel).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, deleteRoleTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteRoleTemplateVersion operation with and without retries enabled - @Test - public void testDeleteRoleTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteRoleTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteRoleTemplateVersionWOptions(); - } - - // Test the deleteRoleTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteRoleTemplateVersion(null).execute(); - } - - // Test the getRoleTemplateVersion operation with a valid options model parameter - @Test - public void testGetRoleTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String getRoleTemplateVersionPath = "/v1/role_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetRoleTemplateVersionOptions model - GetRoleTemplateVersionOptions getRoleTemplateVersionOptionsModel = new GetRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - - // Invoke getRoleTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.getRoleTemplateVersion(getRoleTemplateVersionOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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, getRoleTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getRoleTemplateVersion operation with and without retries enabled - @Test - public void testGetRoleTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetRoleTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetRoleTemplateVersionWOptions(); - } - - // Test the getRoleTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getRoleTemplateVersion(null).execute(); - } - - // Test the commitRoleTemplate operation with a valid options model parameter - @Test - public void testCommitRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String commitRoleTemplatePath = "/v1/role_templates/testString/versions/testString/commit"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the CommitRoleTemplateOptions model - CommitRoleTemplateOptions commitRoleTemplateOptionsModel = new CommitRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - - // Invoke commitRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.commitRoleTemplate(commitRoleTemplateOptionsModel).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, commitRoleTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the commitRoleTemplate operation with and without retries enabled - @Test - public void testCommitRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCommitRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCommitRoleTemplateWOptions(); - } - - // Test the commitRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.commitRoleTemplate(null).execute(); - } - - // Test the listRoleAssignments operation with a valid options model parameter - @Test - public void testListRoleAssignmentsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; - String listRoleAssignmentsPath = "/v1/role_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListRoleAssignmentsOptions model - ListRoleAssignmentsOptions listRoleAssignmentsOptionsModel = new ListRoleAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listRoleAssignments() with a valid options model and verify the result - Response response = iamPolicyManagementService.listRoleAssignments(listRoleAssignmentsOptionsModel).execute(); - assertNotNull(response); - RoleAssignmentCollection 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, listRoleAssignmentsPath); - // 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(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listRoleAssignments operation with and without retries enabled - @Test - public void testListRoleAssignmentsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListRoleAssignmentsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListRoleAssignmentsWOptions(); - } - - // Test the listRoleAssignments operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleAssignmentsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listRoleAssignments(null).execute(); - } - - // Test the listRoleAssignments operation using the RoleAssignmentsPager.getNext() method - @Test - public void testListRoleAssignmentsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleAssignmentsOptions listRoleAssignmentsOptions = new ListRoleAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - RoleAssignmentsPager pager = new RoleAssignmentsPager(iamPolicyManagementService, listRoleAssignmentsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listRoleAssignments operation using the RoleAssignmentsPager.getAll() method - @Test - public void testListRoleAssignmentsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleAssignmentsOptions listRoleAssignmentsOptions = new ListRoleAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - RoleAssignmentsPager pager = new RoleAssignmentsPager(iamPolicyManagementService, listRoleAssignmentsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createRoleTemplateAssignment operation with a valid options model parameter - @Test - public void testCreateRoleTemplateAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; - String createRoleTemplateAssignmentPath = "/v1/role_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the AssignmentTargetDetails model - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - - // Construct an instance of the RoleAssignmentTemplate model - RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - - // Construct an instance of the CreateRoleTemplateAssignmentOptions model - CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptionsModel = new CreateRoleTemplateAssignmentOptions.Builder() - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(roleAssignmentTemplateModel)) - .acceptLanguage("default") - .build(); - - // Invoke createRoleTemplateAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.createRoleTemplateAssignment(createRoleTemplateAssignmentOptionsModel).execute(); - assertNotNull(response); - RoleAssignmentCollection 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createRoleTemplateAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createRoleTemplateAssignment operation with and without retries enabled - @Test - public void testCreateRoleTemplateAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateRoleTemplateAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateRoleTemplateAssignmentWOptions(); - } - - // Test the createRoleTemplateAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createRoleTemplateAssignment(null).execute(); - } - - // Test the getRoleAssignment operation with a valid options model parameter - @Test - public void testGetRoleAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; - String getRoleAssignmentPath = "/v1/role_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetRoleAssignmentOptions model - GetRoleAssignmentOptions getRoleAssignmentOptionsModel = new GetRoleAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke getRoleAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.getRoleAssignment(getRoleAssignmentOptionsModel).execute(); - assertNotNull(response); - RoleAssignment 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, getRoleAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getRoleAssignment operation with and without retries enabled - @Test - public void testGetRoleAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetRoleAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetRoleAssignmentWOptions(); - } - - // Test the getRoleAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getRoleAssignment(null).execute(); - } - - // Test the updateRoleAssignment operation with a valid options model parameter - @Test - public void testUpdateRoleAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; - String updateRoleAssignmentPath = "/v1/role_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdateRoleAssignmentOptions model - UpdateRoleAssignmentOptions updateRoleAssignmentOptionsModel = new UpdateRoleAssignmentOptions.Builder() - .assignmentId("testString") - .ifMatch("testString") - .templateVersion("testString") - .build(); - - // Invoke updateRoleAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.updateRoleAssignment(updateRoleAssignmentOptionsModel).execute(); - assertNotNull(response); - RoleAssignment 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateRoleAssignmentPath); - // 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 updateRoleAssignment operation with and without retries enabled - @Test - public void testUpdateRoleAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdateRoleAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdateRoleAssignmentWOptions(); - } - - // Test the updateRoleAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateRoleAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updateRoleAssignment(null).execute(); - } - - // Test the deleteRoleAssignment operation with a valid options model parameter - @Test - public void testDeleteRoleAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteRoleAssignmentPath = "/v1/role_assignments/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteRoleAssignmentOptions model - DeleteRoleAssignmentOptions deleteRoleAssignmentOptionsModel = new DeleteRoleAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke deleteRoleAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteRoleAssignment(deleteRoleAssignmentOptionsModel).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, deleteRoleAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteRoleAssignment operation with and without retries enabled - @Test - public void testDeleteRoleAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteRoleAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteRoleAssignmentWOptions(); - } - - // Test the deleteRoleAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteRoleAssignment(null).execute(); - } - - // Perform setup needed before each test method - @BeforeMethod - public void beforeEachTest() { - // Start the mock server. - try { - server = new MockWebServer(); - server.start(); - } catch (IOException err) { - fail("Failed to instantiate mock web server"); - } - - // Construct an instance of the service - constructClientService(); - } - - // Perform tear down after each test method - @AfterMethod - public void afterEachTest() throws IOException { - server.shutdown(); - iamPolicyManagementService = null; - } - - // Constructs an instance of the service to be used by the tests - public void constructClientService() { - System.setProperty("TESTSERVICE_AUTH_TYPE", "noAuth"); - final String serviceName = "testService"; - - iamPolicyManagementService = IamPolicyManagement.newInstance(serviceName); - String url = server.url("/").toString(); - iamPolicyManagementService.setServiceUrl(url); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java deleted file mode 100644 index 5630ccb0c03..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.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 AccountSettingsAccessManagement model. - */ -public class AccountSettingsAccessManagementTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAccountSettingsAccessManagement() throws Throwable { - AccountSettingsAccessManagement accountSettingsAccessManagementModel = new AccountSettingsAccessManagement(); - assertNull(accountSettingsAccessManagementModel.getExternalAccountIdentityInteraction()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java deleted file mode 100644 index d4dfc8863c6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentCollection model. - */ -public class ActionControlAssignmentCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentCollection() throws Throwable { - ActionControlAssignmentCollection actionControlAssignmentCollectionModel = new ActionControlAssignmentCollection(); - assertNull(actionControlAssignmentCollectionModel.getLimit()); - assertNull(actionControlAssignmentCollectionModel.getFirst()); - assertNull(actionControlAssignmentCollectionModel.getNext()); - assertNull(actionControlAssignmentCollectionModel.getPrevious()); - assertNull(actionControlAssignmentCollectionModel.getAssignments()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java deleted file mode 100644 index cb53bc44d1c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResourceActionControl model. - */ -public class ActionControlAssignmentResourceActionControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentResourceActionControl() throws Throwable { - ActionControlAssignmentResourceActionControl actionControlAssignmentResourceActionControlModel = new ActionControlAssignmentResourceActionControl(); - assertNull(actionControlAssignmentResourceActionControlModel.getResourceCreated()); - assertNull(actionControlAssignmentResourceActionControlModel.getErrorMessage()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java deleted file mode 100644 index 284ec17a0f0..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResourceCreated model. - */ -public class ActionControlAssignmentResourceCreatedTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentResourceCreated() throws Throwable { - ActionControlAssignmentResourceCreated actionControlAssignmentResourceCreatedModel = new ActionControlAssignmentResourceCreated(); - assertNull(actionControlAssignmentResourceCreatedModel.getId()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java deleted file mode 100644 index eaa560dce78..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResource model. - */ -public class ActionControlAssignmentResourceTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentResource() throws Throwable { - ActionControlAssignmentResource actionControlAssignmentResourceModel = new ActionControlAssignmentResource(); - assertNull(actionControlAssignmentResourceModel.getTarget()); - assertNull(actionControlAssignmentResourceModel.getActionControl()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java deleted file mode 100644 index 262a74bea45..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentTemplate model. - */ -public class ActionControlAssignmentTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentTemplate() throws Throwable { - ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(actionControlAssignmentTemplateModel.id(), "testString"); - assertEquals(actionControlAssignmentTemplateModel.version(), "testString"); - - String json = TestUtilities.serialize(actionControlAssignmentTemplateModel); - - ActionControlAssignmentTemplate actionControlAssignmentTemplateModelNew = TestUtilities.deserialize(json, ActionControlAssignmentTemplate.class); - assertTrue(actionControlAssignmentTemplateModelNew instanceof ActionControlAssignmentTemplate); - assertEquals(actionControlAssignmentTemplateModelNew.id(), "testString"); - assertEquals(actionControlAssignmentTemplateModelNew.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testActionControlAssignmentTemplateError() throws Throwable { - new ActionControlAssignmentTemplate.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java deleted file mode 100644 index c5173f940c4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignment model. - */ -public class ActionControlAssignmentTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignment() throws Throwable { - ActionControlAssignment actionControlAssignmentModel = new ActionControlAssignment(); - assertNull(actionControlAssignmentModel.getTemplate()); - assertNull(actionControlAssignmentModel.getTarget()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java deleted file mode 100644 index 58155ee1e7e..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplateCollection model. - */ -public class ActionControlTemplateCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlTemplateCollection() throws Throwable { - ActionControlTemplateCollection actionControlTemplateCollectionModel = new ActionControlTemplateCollection(); - assertNull(actionControlTemplateCollectionModel.getLimit()); - assertNull(actionControlTemplateCollectionModel.getFirst()); - assertNull(actionControlTemplateCollectionModel.getNext()); - assertNull(actionControlTemplateCollectionModel.getPrevious()); - assertNull(actionControlTemplateCollectionModel.getActionControlTemplates()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java deleted file mode 100644 index a086106a57e..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplate model. - */ -public class ActionControlTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlTemplate() throws Throwable { - ActionControlTemplate actionControlTemplateModel = new ActionControlTemplate(); - assertNull(actionControlTemplateModel.getName()); - assertNull(actionControlTemplateModel.getDescription()); - assertNull(actionControlTemplateModel.getAccountId()); - assertNull(actionControlTemplateModel.isCommitted()); - assertNull(actionControlTemplateModel.getActionControl()); - assertNull(actionControlTemplateModel.getVersion()); - assertNull(actionControlTemplateModel.getState()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java deleted file mode 100644 index 7b6bf014357..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplateVersionsCollection model. - */ -public class ActionControlTemplateVersionsCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlTemplateVersionsCollection() throws Throwable { - ActionControlTemplateVersionsCollection actionControlTemplateVersionsCollectionModel = new ActionControlTemplateVersionsCollection(); - assertNull(actionControlTemplateVersionsCollectionModel.getLimit()); - assertNull(actionControlTemplateVersionsCollectionModel.getFirst()); - assertNull(actionControlTemplateVersionsCollectionModel.getNext()); - assertNull(actionControlTemplateVersionsCollectionModel.getPrevious()); - assertNull(actionControlTemplateVersionsCollectionModel.getVersions()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java deleted file mode 100644 index 4038d52606c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentResourceCreated model. - */ -public class AssignmentResourceCreatedTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAssignmentResourceCreated() throws Throwable { - AssignmentResourceCreated assignmentResourceCreatedModel = new AssignmentResourceCreated(); - assertNull(assignmentResourceCreatedModel.getId()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java deleted file mode 100644 index 81e3799a42c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentResourceError model. - */ -public class AssignmentResourceErrorTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAssignmentResourceError() throws Throwable { - AssignmentResourceError assignmentResourceErrorModel = new AssignmentResourceError(); - assertNull(assignmentResourceErrorModel.getName()); - assertNull(assignmentResourceErrorModel.getErrorCode()); - assertNull(assignmentResourceErrorModel.getMessage()); - assertNull(assignmentResourceErrorModel.getCode()); - assertNull(assignmentResourceErrorModel.getErrors()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java deleted file mode 100644 index 48e4a605cbb..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentTargetDetails model. - */ -public class AssignmentTargetDetailsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAssignmentTargetDetails() throws Throwable { - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - assertEquals(assignmentTargetDetailsModel.type(), "Account"); - assertEquals(assignmentTargetDetailsModel.id(), "testString"); - - String json = TestUtilities.serialize(assignmentTargetDetailsModel); - - AssignmentTargetDetails assignmentTargetDetailsModelNew = TestUtilities.deserialize(json, AssignmentTargetDetails.class); - assertTrue(assignmentTargetDetailsModelNew instanceof AssignmentTargetDetails); - assertEquals(assignmentTargetDetailsModelNew.type(), "Account"); - assertEquals(assignmentTargetDetailsModelNew.id(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testAssignmentTargetDetailsError() throws Throwable { - new AssignmentTargetDetails.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java deleted file mode 100644 index bcecf27ed27..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentTemplateDetails model. - */ -public class AssignmentTemplateDetailsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAssignmentTemplateDetails() throws Throwable { - AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(assignmentTemplateDetailsModel.id(), "testString"); - assertEquals(assignmentTemplateDetailsModel.version(), "testString"); - - String json = TestUtilities.serialize(assignmentTemplateDetailsModel); - - AssignmentTemplateDetails assignmentTemplateDetailsModelNew = TestUtilities.deserialize(json, AssignmentTemplateDetails.class); - assertTrue(assignmentTemplateDetailsModelNew instanceof AssignmentTemplateDetails); - assertEquals(assignmentTemplateDetailsModelNew.id(), "testString"); - assertEquals(assignmentTemplateDetailsModelNew.version(), "testString"); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java deleted file mode 100644 index 2b5ed42c76a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CommitActionControlTemplateOptions model. - */ -public class CommitActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCommitActionControlTemplateOptions() throws Throwable { - CommitActionControlTemplateOptions commitActionControlTemplateOptionsModel = new CommitActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - assertEquals(commitActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(commitActionControlTemplateOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitActionControlTemplateOptionsError() throws Throwable { - new CommitActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java deleted file mode 100644 index 66cdca59588..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CommitPolicyTemplateOptions model. - */ -public class CommitPolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCommitPolicyTemplateOptions() throws Throwable { - CommitPolicyTemplateOptions commitPolicyTemplateOptionsModel = new CommitPolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - assertEquals(commitPolicyTemplateOptionsModel.policyTemplateId(), "testString"); - assertEquals(commitPolicyTemplateOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitPolicyTemplateOptionsError() throws Throwable { - new CommitPolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java deleted file mode 100644 index 09c48b8e80e..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CommitRoleTemplateOptions model. - */ -public class CommitRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCommitRoleTemplateOptions() throws Throwable { - CommitRoleTemplateOptions commitRoleTemplateOptionsModel = new CommitRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - assertEquals(commitRoleTemplateOptionsModel.roleTemplateId(), "testString"); - assertEquals(commitRoleTemplateOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitRoleTemplateOptionsError() throws Throwable { - new CommitRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java deleted file mode 100644 index 94ef6ce21e8..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.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 ConflictsWith model. - */ -public class ConflictsWithTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testConflictsWith() throws Throwable { - ConflictsWith conflictsWithModel = new ConflictsWith(); - assertNull(conflictsWithModel.getEtag()); - assertNull(conflictsWithModel.getRole()); - assertNull(conflictsWithModel.getPolicy()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java deleted file mode 100644 index bbe19a7b9b1..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponseControl model. - */ -public class ControlResponseControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testControlResponseControl() throws Throwable { - ControlResponseControl controlResponseControlModel = new ControlResponseControl(); - assertNull(controlResponseControlModel.getGrant()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java deleted file mode 100644 index 7b2fbfae90d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControlWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponseControlWithEnrichedRoles model. - */ -public class ControlResponseControlWithEnrichedRolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testControlResponseControlWithEnrichedRoles() throws Throwable { - ControlResponseControlWithEnrichedRoles controlResponseControlWithEnrichedRolesModel = new ControlResponseControlWithEnrichedRoles(); - assertNull(controlResponseControlWithEnrichedRolesModel.getGrant()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java deleted file mode 100644 index f42cbc0a2d8..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponse; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponse model. - */ -public class ControlResponseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testControlResponse() throws Throwable { - ControlResponse controlResponseModel = new ControlResponse(); - assertNotNull(controlResponseModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java deleted file mode 100644 index c8b1e3000f9..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 Control model. - */ -public class ControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testControl() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); - - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - assertEquals(controlModel.grant(), grantModel); - - String json = TestUtilities.serialize(controlModel); - - Control controlModelNew = TestUtilities.deserialize(json, Control.class); - assertTrue(controlModelNew instanceof Control); - assertEquals(controlModelNew.grant().toString(), grantModel.toString()); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testControlError() throws Throwable { - new Control.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java deleted file mode 100644 index f2557c8f64f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateAssignmentOptions model. - */ -public class CreateActionControlTemplateAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateActionControlTemplateAssignmentOptions() throws Throwable { - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - assertEquals(assignmentTargetDetailsModel.type(), "Account"); - assertEquals(assignmentTargetDetailsModel.id(), "testString"); - - ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(actionControlAssignmentTemplateModel.id(), "testString"); - assertEquals(actionControlAssignmentTemplateModel.version(), "testString"); - - CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptionsModel = new CreateActionControlTemplateAssignmentOptions.Builder() - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(actionControlAssignmentTemplateModel)) - .acceptLanguage("default") - .build(); - assertEquals(createActionControlTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); - assertEquals(createActionControlTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(actionControlAssignmentTemplateModel)); - assertEquals(createActionControlTemplateAssignmentOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateAssignmentOptionsError() throws Throwable { - new CreateActionControlTemplateAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java deleted file mode 100644 index 2508072a03c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateOptions model. - */ -public class CreateActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateActionControlTemplateOptions() throws Throwable { - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateActionControlModel.serviceName(), "testString"); - assertEquals(templateActionControlModel.description(), "testString"); - assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); - - CreateActionControlTemplateOptions createActionControlTemplateOptionsModel = new CreateActionControlTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .description("testString") - .committed(true) - .actionControl(templateActionControlModel) - .acceptLanguage("default") - .build(); - assertEquals(createActionControlTemplateOptionsModel.name(), "testString"); - assertEquals(createActionControlTemplateOptionsModel.accountId(), "testString"); - assertEquals(createActionControlTemplateOptionsModel.description(), "testString"); - assertEquals(createActionControlTemplateOptionsModel.committed(), Boolean.valueOf(true)); - assertEquals(createActionControlTemplateOptionsModel.actionControl(), templateActionControlModel); - assertEquals(createActionControlTemplateOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateOptionsError() throws Throwable { - new CreateActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java deleted file mode 100644 index d5070249115..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateVersionOptions model. - */ -public class CreateActionControlTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateActionControlTemplateVersionOptions() throws Throwable { - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateActionControlModel.serviceName(), "testString"); - assertEquals(templateActionControlModel.description(), "testString"); - assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); - - CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptionsModel = new CreateActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .name("testString") - .description("testString") - .actionControl(templateActionControlModel) - .committed(true) - .build(); - assertEquals(createActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(createActionControlTemplateVersionOptionsModel.name(), "testString"); - assertEquals(createActionControlTemplateVersionOptionsModel.description(), "testString"); - assertEquals(createActionControlTemplateVersionOptionsModel.actionControl(), templateActionControlModel); - assertEquals(createActionControlTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateVersionOptionsError() throws Throwable { - new CreateActionControlTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java deleted file mode 100644 index c2dd24fd213..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyOptions model. - */ -public class CreatePolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreatePolicyOptions() throws Throwable { - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - assertEquals(subjectAttributeModel.name(), "testString"); - assertEquals(subjectAttributeModel.value(), "testString"); - - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); - - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - assertEquals(policyRoleModel.roleId(), "testString"); - - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceAttributeModel.name(), "testString"); - assertEquals(resourceAttributeModel.value(), "testString"); - assertEquals(resourceAttributeModel.operator(), "testString"); - - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceTagModel.name(), "testString"); - assertEquals(resourceTagModel.value(), "testString"); - assertEquals(resourceTagModel.operator(), "testString"); - - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); - assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); - - CreatePolicyOptions createPolicyOptionsModel = new CreatePolicyOptions.Builder() - .type("testString") - .subjects(java.util.Arrays.asList(policySubjectModel)) - .roles(java.util.Arrays.asList(policyRoleModel)) - .resources(java.util.Arrays.asList(policyResourceModel)) - .description("testString") - .acceptLanguage("default") - .build(); - assertEquals(createPolicyOptionsModel.type(), "testString"); - assertEquals(createPolicyOptionsModel.subjects(), java.util.Arrays.asList(policySubjectModel)); - assertEquals(createPolicyOptionsModel.roles(), java.util.Arrays.asList(policyRoleModel)); - assertEquals(createPolicyOptionsModel.resources(), java.util.Arrays.asList(policyResourceModel)); - assertEquals(createPolicyOptionsModel.description(), "testString"); - assertEquals(createPolicyOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyOptionsError() throws Throwable { - new CreatePolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java deleted file mode 100644 index 5b08b4b398a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateAssignmentOptions model. - */ -public class CreatePolicyTemplateAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreatePolicyTemplateAssignmentOptions() throws Throwable { - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - assertEquals(assignmentTargetDetailsModel.type(), "Account"); - assertEquals(assignmentTargetDetailsModel.id(), "testString"); - - AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(assignmentTemplateDetailsModel.id(), "testString"); - assertEquals(assignmentTemplateDetailsModel.version(), "testString"); - - CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptionsModel = new CreatePolicyTemplateAssignmentOptions.Builder() - .version("1.0") - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(assignmentTemplateDetailsModel)) - .acceptLanguage("default") - .build(); - assertEquals(createPolicyTemplateAssignmentOptionsModel.version(), "1.0"); - assertEquals(createPolicyTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); - assertEquals(createPolicyTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(assignmentTemplateDetailsModel)); - assertEquals(createPolicyTemplateAssignmentOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateAssignmentOptionsError() throws Throwable { - new CreatePolicyTemplateAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java deleted file mode 100644 index 68617451831..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateOptions model. - */ -public class CreatePolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreatePolicyTemplateOptions() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - assertEquals(templatePolicyModel.type(), "access"); - assertEquals(templatePolicyModel.description(), "testString"); - assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); - assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); - assertEquals(templatePolicyModel.pattern(), "testString"); - assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), templateControlModel); - - CreatePolicyTemplateOptions createPolicyTemplateOptionsModel = new CreatePolicyTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .policy(templatePolicyModel) - .description("testString") - .committed(true) - .acceptLanguage("default") - .build(); - assertEquals(createPolicyTemplateOptionsModel.name(), "testString"); - assertEquals(createPolicyTemplateOptionsModel.accountId(), "testString"); - assertEquals(createPolicyTemplateOptionsModel.policy(), templatePolicyModel); - assertEquals(createPolicyTemplateOptionsModel.description(), "testString"); - assertEquals(createPolicyTemplateOptionsModel.committed(), Boolean.valueOf(true)); - assertEquals(createPolicyTemplateOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateOptionsError() throws Throwable { - new CreatePolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java deleted file mode 100644 index d6919e6e1b9..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateVersionOptions model. - */ -public class CreatePolicyTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreatePolicyTemplateVersionOptions() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - assertEquals(templatePolicyModel.type(), "access"); - assertEquals(templatePolicyModel.description(), "testString"); - assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); - assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); - assertEquals(templatePolicyModel.pattern(), "testString"); - assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), templateControlModel); - - CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptionsModel = new CreatePolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .policy(templatePolicyModel) - .name("testString") - .description("testString") - .committed(true) - .build(); - assertEquals(createPolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); - assertEquals(createPolicyTemplateVersionOptionsModel.policy(), templatePolicyModel); - assertEquals(createPolicyTemplateVersionOptionsModel.name(), "testString"); - assertEquals(createPolicyTemplateVersionOptionsModel.description(), "testString"); - assertEquals(createPolicyTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateVersionOptionsError() throws Throwable { - new CreatePolicyTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java deleted file mode 100644 index 849512f2bda..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleOptions model. - */ -public class CreateRoleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateRoleOptions() throws Throwable { - CreateRoleOptions createRoleOptionsModel = new CreateRoleOptions.Builder() - .displayName("testString") - .actions(java.util.Arrays.asList("testString")) - .name("Developer") - .accountId("testString") - .serviceName("iam-groups") - .description("testString") - .acceptLanguage("default") - .build(); - assertEquals(createRoleOptionsModel.displayName(), "testString"); - assertEquals(createRoleOptionsModel.actions(), java.util.Arrays.asList("testString")); - assertEquals(createRoleOptionsModel.name(), "Developer"); - assertEquals(createRoleOptionsModel.accountId(), "testString"); - assertEquals(createRoleOptionsModel.serviceName(), "iam-groups"); - assertEquals(createRoleOptionsModel.description(), "testString"); - assertEquals(createRoleOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleOptionsError() throws Throwable { - new CreateRoleOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java deleted file mode 100644 index bff414389a5..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateAssignmentOptions model. - */ -public class CreateRoleTemplateAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateRoleTemplateAssignmentOptions() throws Throwable { - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - assertEquals(assignmentTargetDetailsModel.type(), "Account"); - assertEquals(assignmentTargetDetailsModel.id(), "testString"); - - RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(roleAssignmentTemplateModel.id(), "testString"); - assertEquals(roleAssignmentTemplateModel.version(), "testString"); - - CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptionsModel = new CreateRoleTemplateAssignmentOptions.Builder() - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(roleAssignmentTemplateModel)) - .acceptLanguage("default") - .build(); - assertEquals(createRoleTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); - assertEquals(createRoleTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(roleAssignmentTemplateModel)); - assertEquals(createRoleTemplateAssignmentOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateAssignmentOptionsError() throws Throwable { - new CreateRoleTemplateAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java deleted file mode 100644 index 799743ddbf4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateOptions model. - */ -public class CreateRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateRoleTemplateOptions() throws Throwable { - RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() - .name("testString") - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(roleTemplatePrototypeRoleModel.name(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.displayName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.serviceName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.description(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.actions(), java.util.Arrays.asList("testString")); - - CreateRoleTemplateOptions createRoleTemplateOptionsModel = new CreateRoleTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .description("testString") - .committed(true) - .role(roleTemplatePrototypeRoleModel) - .acceptLanguage("default") - .build(); - assertEquals(createRoleTemplateOptionsModel.name(), "testString"); - assertEquals(createRoleTemplateOptionsModel.accountId(), "testString"); - assertEquals(createRoleTemplateOptionsModel.description(), "testString"); - assertEquals(createRoleTemplateOptionsModel.committed(), Boolean.valueOf(true)); - assertEquals(createRoleTemplateOptionsModel.role(), roleTemplatePrototypeRoleModel); - assertEquals(createRoleTemplateOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateOptionsError() throws Throwable { - new CreateRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java deleted file mode 100644 index a7d2d312afa..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateVersionOptions model. - */ -public class CreateRoleTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateRoleTemplateVersionOptions() throws Throwable { - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateRoleModel.displayName(), "testString"); - assertEquals(templateRoleModel.serviceName(), "testString"); - assertEquals(templateRoleModel.description(), "testString"); - assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); - - CreateRoleTemplateVersionOptions createRoleTemplateVersionOptionsModel = new CreateRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .name("testString") - .description("testString") - .role(templateRoleModel) - .committed(true) - .build(); - assertEquals(createRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); - assertEquals(createRoleTemplateVersionOptionsModel.name(), "testString"); - assertEquals(createRoleTemplateVersionOptionsModel.description(), "testString"); - assertEquals(createRoleTemplateVersionOptionsModel.role(), templateRoleModel); - assertEquals(createRoleTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateVersionOptionsError() throws Throwable { - new CreateRoleTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java deleted file mode 100644 index acce8b7b537..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateV2PolicyOptions model. - */ -public class CreateV2PolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateV2PolicyOptions() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); - - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - assertEquals(controlModel.grant(), grantModel); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - CreateV2PolicyOptions createV2PolicyOptionsModel = new CreateV2PolicyOptions.Builder() - .control(controlModel) - .type("access") - .description("testString") - .subject(v2PolicySubjectModel) - .resource(v2PolicyResourceModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .acceptLanguage("default") - .build(); - assertEquals(createV2PolicyOptionsModel.control(), controlModel); - assertEquals(createV2PolicyOptionsModel.type(), "access"); - assertEquals(createV2PolicyOptionsModel.description(), "testString"); - assertEquals(createV2PolicyOptionsModel.subject(), v2PolicySubjectModel); - assertEquals(createV2PolicyOptionsModel.resource(), v2PolicyResourceModel); - assertEquals(createV2PolicyOptionsModel.pattern(), "testString"); - assertEquals(createV2PolicyOptionsModel.rule(), v2PolicyRuleModel); - assertEquals(createV2PolicyOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateV2PolicyOptionsError() throws Throwable { - new CreateV2PolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java deleted file mode 100644 index acc0dc0a3c1..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 CustomRole model. - */ -public class CustomRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCustomRole() throws Throwable { - CustomRole customRoleModel = new CustomRole(); - assertNull(customRoleModel.getDisplayName()); - assertNull(customRoleModel.getDescription()); - assertNull(customRoleModel.getActions()); - assertNull(customRoleModel.getName()); - assertNull(customRoleModel.getAccountId()); - assertNull(customRoleModel.getServiceName()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java deleted file mode 100644 index 1a38606ede5..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlAssignmentOptions model. - */ -public class DeleteActionControlAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteActionControlAssignmentOptions() throws Throwable { - DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptionsModel = new DeleteActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(deleteActionControlAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlAssignmentOptionsError() throws Throwable { - new DeleteActionControlAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java deleted file mode 100644 index 75b111e9214..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlTemplateOptions model. - */ -public class DeleteActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteActionControlTemplateOptions() throws Throwable { - DeleteActionControlTemplateOptions deleteActionControlTemplateOptionsModel = new DeleteActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .build(); - assertEquals(deleteActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlTemplateOptionsError() throws Throwable { - new DeleteActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java deleted file mode 100644 index 64fb5790244..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlTemplateVersionOptions model. - */ -public class DeleteActionControlTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteActionControlTemplateVersionOptions() throws Throwable { - DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptionsModel = new DeleteActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - assertEquals(deleteActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(deleteActionControlTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlTemplateVersionOptionsError() throws Throwable { - new DeleteActionControlTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java deleted file mode 100644 index 75aed905222..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyAssignmentOptions model. - */ -public class DeletePolicyAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeletePolicyAssignmentOptions() throws Throwable { - DeletePolicyAssignmentOptions deletePolicyAssignmentOptionsModel = new DeletePolicyAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(deletePolicyAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyAssignmentOptionsError() throws Throwable { - new DeletePolicyAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java deleted file mode 100644 index 1b130eb0f79..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyOptions model. - */ -public class DeletePolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeletePolicyOptions() throws Throwable { - DeletePolicyOptions deletePolicyOptionsModel = new DeletePolicyOptions.Builder() - .policyId("testString") - .build(); - assertEquals(deletePolicyOptionsModel.policyId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyOptionsError() throws Throwable { - new DeletePolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java deleted file mode 100644 index 288517222aa..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyTemplateOptions model. - */ -public class DeletePolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeletePolicyTemplateOptions() throws Throwable { - DeletePolicyTemplateOptions deletePolicyTemplateOptionsModel = new DeletePolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .build(); - assertEquals(deletePolicyTemplateOptionsModel.policyTemplateId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyTemplateOptionsError() throws Throwable { - new DeletePolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java deleted file mode 100644 index 7b1c6cffa1d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyTemplateVersionOptions model. - */ -public class DeletePolicyTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeletePolicyTemplateVersionOptions() throws Throwable { - DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptionsModel = new DeletePolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - assertEquals(deletePolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); - assertEquals(deletePolicyTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyTemplateVersionOptionsError() throws Throwable { - new DeletePolicyTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java deleted file mode 100644 index 7f9b614304f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleAssignmentOptions model. - */ -public class DeleteRoleAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteRoleAssignmentOptions() throws Throwable { - DeleteRoleAssignmentOptions deleteRoleAssignmentOptionsModel = new DeleteRoleAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(deleteRoleAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleAssignmentOptionsError() throws Throwable { - new DeleteRoleAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java deleted file mode 100644 index 9c6690cda7b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleOptions model. - */ -public class DeleteRoleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteRoleOptions() throws Throwable { - DeleteRoleOptions deleteRoleOptionsModel = new DeleteRoleOptions.Builder() - .roleId("testString") - .build(); - assertEquals(deleteRoleOptionsModel.roleId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleOptionsError() throws Throwable { - new DeleteRoleOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java deleted file mode 100644 index 3fc04286ed3..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleTemplateOptions model. - */ -public class DeleteRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteRoleTemplateOptions() throws Throwable { - DeleteRoleTemplateOptions deleteRoleTemplateOptionsModel = new DeleteRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .build(); - assertEquals(deleteRoleTemplateOptionsModel.roleTemplateId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleTemplateOptionsError() throws Throwable { - new DeleteRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java deleted file mode 100644 index ff652fa335c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleTemplateVersionOptions model. - */ -public class DeleteRoleTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteRoleTemplateVersionOptions() throws Throwable { - DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptionsModel = new DeleteRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - assertEquals(deleteRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); - assertEquals(deleteRoleTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleTemplateVersionOptionsError() throws Throwable { - new DeleteRoleTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java deleted file mode 100644 index 6a33aa8f116..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteV2PolicyOptions model. - */ -public class DeleteV2PolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteV2PolicyOptions() throws Throwable { - DeleteV2PolicyOptions deleteV2PolicyOptionsModel = new DeleteV2PolicyOptions.Builder() - .id("testString") - .build(); - assertEquals(deleteV2PolicyOptionsModel.id(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteV2PolicyOptionsError() throws Throwable { - new DeleteV2PolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java deleted file mode 100644 index 104a5210ed9..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.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 EnrichedRoles model. - */ -public class EnrichedRolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testEnrichedRoles() throws Throwable { - EnrichedRoles enrichedRolesModel = new EnrichedRoles(); - assertNull(enrichedRolesModel.getRoleId()); - assertNull(enrichedRolesModel.getActions()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java deleted file mode 100644 index 460b37f8105..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.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 ErrorDetails model. - */ -public class ErrorDetailsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testErrorDetails() throws Throwable { - ErrorDetails errorDetailsModel = new ErrorDetails(); - assertNull(errorDetailsModel.getConflictsWith()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java deleted file mode 100644 index e7f7f9afbfc..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.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 ErrorObject model. - */ -public class ErrorObjectTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testErrorObject() throws Throwable { - ErrorObject errorObjectModel = new ErrorObject(); - assertNull(errorObjectModel.getCode()); - assertNull(errorObjectModel.getMessage()); - assertNull(errorObjectModel.getDetails()); - assertNull(errorObjectModel.getMoreInfo()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java deleted file mode 100644 index 90c91c8fcaf..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; -import com.ibm.cloud.platform_services.iam_policy_management.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 ExternalAccountIdentityInteractionPatch model. - */ -public class ExternalAccountIdentityInteractionPatchTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testExternalAccountIdentityInteractionPatch() throws Throwable { - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - assertEquals(identityTypesBaseModel.state(), "enabled"); - assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); - - IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() - .user(identityTypesBaseModel) - .serviceId(identityTypesBaseModel) - .service(identityTypesBaseModel) - .build(); - assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); - - ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() - .identityTypes(identityTypesPatchModel) - .build(); - assertEquals(externalAccountIdentityInteractionPatchModel.identityTypes(), identityTypesPatchModel); - - String json = TestUtilities.serialize(externalAccountIdentityInteractionPatchModel); - - ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModelNew = TestUtilities.deserialize(json, ExternalAccountIdentityInteractionPatch.class); - assertTrue(externalAccountIdentityInteractionPatchModelNew instanceof ExternalAccountIdentityInteractionPatch); - assertEquals(externalAccountIdentityInteractionPatchModelNew.identityTypes().toString(), identityTypesPatchModel.toString()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java deleted file mode 100644 index 2e4aaef7e07..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.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 ExternalAccountIdentityInteraction model. - */ -public class ExternalAccountIdentityInteractionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testExternalAccountIdentityInteraction() throws Throwable { - ExternalAccountIdentityInteraction externalAccountIdentityInteractionModel = new ExternalAccountIdentityInteraction(); - assertNull(externalAccountIdentityInteractionModel.getIdentityTypes()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java deleted file mode 100644 index b4d68673091..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.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 First model. - */ -public class FirstTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testFirst() throws Throwable { - First firstModel = new First(); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java deleted file mode 100644 index 73e66a5a756..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlAssignmentOptions model. - */ -public class GetActionControlAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetActionControlAssignmentOptions() throws Throwable { - GetActionControlAssignmentOptions getActionControlAssignmentOptionsModel = new GetActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(getActionControlAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlAssignmentOptionsError() throws Throwable { - new GetActionControlAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java deleted file mode 100644 index d6e66ce6939..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlTemplateOptions model. - */ -public class GetActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetActionControlTemplateOptions() throws Throwable { - GetActionControlTemplateOptions getActionControlTemplateOptionsModel = new GetActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .build(); - assertEquals(getActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(getActionControlTemplateOptionsModel.state(), "active"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlTemplateOptionsError() throws Throwable { - new GetActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java deleted file mode 100644 index ac8e17fe083..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlTemplateVersionOptions model. - */ -public class GetActionControlTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetActionControlTemplateVersionOptions() throws Throwable { - GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptionsModel = new GetActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - assertEquals(getActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(getActionControlTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlTemplateVersionOptionsError() throws Throwable { - new GetActionControlTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java deleted file mode 100644 index 6b2a479c37d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyAssignmentOptions model. - */ -public class GetPolicyAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetPolicyAssignmentOptions() throws Throwable { - GetPolicyAssignmentOptions getPolicyAssignmentOptionsModel = new GetPolicyAssignmentOptions.Builder() - .assignmentId("testString") - .version("1.0") - .build(); - assertEquals(getPolicyAssignmentOptionsModel.assignmentId(), "testString"); - assertEquals(getPolicyAssignmentOptionsModel.version(), "1.0"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyAssignmentOptionsError() throws Throwable { - new GetPolicyAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java deleted file mode 100644 index 2a7348c2c2d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyOptions model. - */ -public class GetPolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetPolicyOptions() throws Throwable { - GetPolicyOptions getPolicyOptionsModel = new GetPolicyOptions.Builder() - .policyId("testString") - .build(); - assertEquals(getPolicyOptionsModel.policyId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyOptionsError() throws Throwable { - new GetPolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java deleted file mode 100644 index 06535ed77ed..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyTemplateOptions model. - */ -public class GetPolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetPolicyTemplateOptions() throws Throwable { - GetPolicyTemplateOptions getPolicyTemplateOptionsModel = new GetPolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .state("active") - .build(); - assertEquals(getPolicyTemplateOptionsModel.policyTemplateId(), "testString"); - assertEquals(getPolicyTemplateOptionsModel.state(), "active"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyTemplateOptionsError() throws Throwable { - new GetPolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java deleted file mode 100644 index 264b5db4912..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyTemplateVersionOptions model. - */ -public class GetPolicyTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetPolicyTemplateVersionOptions() throws Throwable { - GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptionsModel = new GetPolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - assertEquals(getPolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); - assertEquals(getPolicyTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyTemplateVersionOptionsError() throws Throwable { - new GetPolicyTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java deleted file mode 100644 index 0c1f6b2bb5a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleAssignmentOptions model. - */ -public class GetRoleAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetRoleAssignmentOptions() throws Throwable { - GetRoleAssignmentOptions getRoleAssignmentOptionsModel = new GetRoleAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(getRoleAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleAssignmentOptionsError() throws Throwable { - new GetRoleAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java deleted file mode 100644 index e589b8d1285..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleOptions model. - */ -public class GetRoleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetRoleOptions() throws Throwable { - GetRoleOptions getRoleOptionsModel = new GetRoleOptions.Builder() - .roleId("testString") - .build(); - assertEquals(getRoleOptionsModel.roleId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleOptionsError() throws Throwable { - new GetRoleOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java deleted file mode 100644 index 3c10b5207dc..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleTemplateOptions model. - */ -public class GetRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetRoleTemplateOptions() throws Throwable { - GetRoleTemplateOptions getRoleTemplateOptionsModel = new GetRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .state("active") - .build(); - assertEquals(getRoleTemplateOptionsModel.roleTemplateId(), "testString"); - assertEquals(getRoleTemplateOptionsModel.state(), "active"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleTemplateOptionsError() throws Throwable { - new GetRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java deleted file mode 100644 index 3bd5d278630..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleTemplateVersionOptions model. - */ -public class GetRoleTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetRoleTemplateVersionOptions() throws Throwable { - GetRoleTemplateVersionOptions getRoleTemplateVersionOptionsModel = new GetRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - assertEquals(getRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); - assertEquals(getRoleTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleTemplateVersionOptionsError() throws Throwable { - new GetRoleTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java deleted file mode 100644 index 00f780c4153..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetSettingsOptions model. - */ -public class GetSettingsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetSettingsOptions() throws Throwable { - GetSettingsOptions getSettingsOptionsModel = new GetSettingsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .build(); - assertEquals(getSettingsOptionsModel.accountId(), "testString"); - assertEquals(getSettingsOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetSettingsOptionsError() throws Throwable { - new GetSettingsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java deleted file mode 100644 index ebad7af7371..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetV2PolicyOptions model. - */ -public class GetV2PolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetV2PolicyOptions() throws Throwable { - GetV2PolicyOptions getV2PolicyOptionsModel = new GetV2PolicyOptions.Builder() - .id("testString") - .format("include_last_permit") - .build(); - assertEquals(getV2PolicyOptionsModel.id(), "testString"); - assertEquals(getV2PolicyOptionsModel.format(), "include_last_permit"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetV2PolicyOptionsError() throws Throwable { - new GetV2PolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java deleted file mode 100644 index f627a54ecc2..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 Grant model. - */ -public class GrantTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGrant() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); - - String json = TestUtilities.serialize(grantModel); - - Grant grantModelNew = TestUtilities.deserialize(json, Grant.class); - assertTrue(grantModelNew instanceof Grant); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGrantError() throws Throwable { - new Grant.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java deleted file mode 100644 index f86af34fab8..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.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 GrantWithEnrichedRoles model. - */ -public class GrantWithEnrichedRolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGrantWithEnrichedRoles() throws Throwable { - GrantWithEnrichedRoles grantWithEnrichedRolesModel = new GrantWithEnrichedRoles(); - assertNull(grantWithEnrichedRolesModel.getRoles()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java deleted file mode 100644 index 2a4d38de51a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypesBase model. - */ -public class IdentityTypesBaseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testIdentityTypesBase() throws Throwable { - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - assertEquals(identityTypesBaseModel.state(), "enabled"); - assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(identityTypesBaseModel); - - IdentityTypesBase identityTypesBaseModelNew = TestUtilities.deserialize(json, IdentityTypesBase.class); - assertTrue(identityTypesBaseModelNew instanceof IdentityTypesBase); - assertEquals(identityTypesBaseModelNew.state(), "enabled"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testIdentityTypesBaseError() throws Throwable { - new IdentityTypesBase.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java deleted file mode 100644 index 3e762536695..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; -import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypesPatch model. - */ -public class IdentityTypesPatchTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testIdentityTypesPatch() throws Throwable { - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - assertEquals(identityTypesBaseModel.state(), "enabled"); - assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); - - IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() - .user(identityTypesBaseModel) - .serviceId(identityTypesBaseModel) - .service(identityTypesBaseModel) - .build(); - assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); - - String json = TestUtilities.serialize(identityTypesPatchModel); - - IdentityTypesPatch identityTypesPatchModelNew = TestUtilities.deserialize(json, IdentityTypesPatch.class); - assertTrue(identityTypesPatchModelNew instanceof IdentityTypesPatch); - assertEquals(identityTypesPatchModelNew.user().toString(), identityTypesBaseModel.toString()); - assertEquals(identityTypesPatchModelNew.serviceId().toString(), identityTypesBaseModel.toString()); - assertEquals(identityTypesPatchModelNew.service().toString(), identityTypesBaseModel.toString()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java deleted file mode 100644 index e2b6c77338f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypes model. - */ -public class IdentityTypesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testIdentityTypes() throws Throwable { - IdentityTypes identityTypesModel = new IdentityTypes(); - assertNull(identityTypesModel.getUser()); - assertNull(identityTypesModel.getServiceId()); - assertNull(identityTypesModel.getService()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java deleted file mode 100644 index c3f51516e25..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; -import com.ibm.cloud.platform_services.iam_policy_management.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 LimitData model. - */ -public class LimitDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testLimitData() throws Throwable { - LimitData limitDataModel = new LimitData(); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java deleted file mode 100644 index 0d64653d829..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlAssignmentsOptions model. - */ -public class ListActionControlAssignmentsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListActionControlAssignmentsOptions() throws Throwable { - ListActionControlAssignmentsOptions listActionControlAssignmentsOptionsModel = new ListActionControlAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listActionControlAssignmentsOptionsModel.accountId(), "testString"); - assertEquals(listActionControlAssignmentsOptionsModel.acceptLanguage(), "default"); - assertEquals(listActionControlAssignmentsOptionsModel.templateId(), "testString"); - assertEquals(listActionControlAssignmentsOptionsModel.templateVersion(), "testString"); - assertEquals(listActionControlAssignmentsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listActionControlAssignmentsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlAssignmentsOptionsError() throws Throwable { - new ListActionControlAssignmentsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java deleted file mode 100644 index dfe91662d83..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlTemplateVersionsOptions model. - */ -public class ListActionControlTemplateVersionsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListActionControlTemplateVersionsOptions() throws Throwable { - ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptionsModel = new ListActionControlTemplateVersionsOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listActionControlTemplateVersionsOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(listActionControlTemplateVersionsOptionsModel.state(), "active"); - assertEquals(listActionControlTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listActionControlTemplateVersionsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlTemplateVersionsOptionsError() throws Throwable { - new ListActionControlTemplateVersionsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java deleted file mode 100644 index 9e2e6a18158..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlTemplatesOptions model. - */ -public class ListActionControlTemplatesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListActionControlTemplatesOptions() throws Throwable { - ListActionControlTemplatesOptions listActionControlTemplatesOptionsModel = new ListActionControlTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listActionControlTemplatesOptionsModel.accountId(), "testString"); - assertEquals(listActionControlTemplatesOptionsModel.acceptLanguage(), "default"); - assertEquals(listActionControlTemplatesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listActionControlTemplatesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlTemplatesOptionsError() throws Throwable { - new ListActionControlTemplatesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java deleted file mode 100644 index 8bfe5000355..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListPoliciesOptions model. - */ -public class ListPoliciesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListPoliciesOptions() throws Throwable { - ListPoliciesOptions listPoliciesOptionsModel = new ListPoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .tagName("testString") - .tagValue("testString") - .sort("id") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listPoliciesOptionsModel.accountId(), "testString"); - assertEquals(listPoliciesOptionsModel.acceptLanguage(), "default"); - assertEquals(listPoliciesOptionsModel.iamId(), "testString"); - assertEquals(listPoliciesOptionsModel.accessGroupId(), "testString"); - assertEquals(listPoliciesOptionsModel.type(), "access"); - assertEquals(listPoliciesOptionsModel.serviceType(), "service"); - assertEquals(listPoliciesOptionsModel.tagName(), "testString"); - assertEquals(listPoliciesOptionsModel.tagValue(), "testString"); - assertEquals(listPoliciesOptionsModel.sort(), "id"); - assertEquals(listPoliciesOptionsModel.format(), "include_last_permit"); - assertEquals(listPoliciesOptionsModel.state(), "active"); - assertEquals(listPoliciesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listPoliciesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPoliciesOptionsError() throws Throwable { - new ListPoliciesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java deleted file mode 100644 index 32729befeda..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyAssignmentsOptions model. - */ -public class ListPolicyAssignmentsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListPolicyAssignmentsOptions() throws Throwable { - ListPolicyAssignmentsOptions listPolicyAssignmentsOptionsModel = new ListPolicyAssignmentsOptions.Builder() - .version("1.0") - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listPolicyAssignmentsOptionsModel.version(), "1.0"); - assertEquals(listPolicyAssignmentsOptionsModel.accountId(), "testString"); - assertEquals(listPolicyAssignmentsOptionsModel.acceptLanguage(), "default"); - assertEquals(listPolicyAssignmentsOptionsModel.templateId(), "testString"); - assertEquals(listPolicyAssignmentsOptionsModel.templateVersion(), "testString"); - assertEquals(listPolicyAssignmentsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listPolicyAssignmentsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyAssignmentsOptionsError() throws Throwable { - new ListPolicyAssignmentsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java deleted file mode 100644 index 1053d41b84b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyTemplateVersionsOptions model. - */ -public class ListPolicyTemplateVersionsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListPolicyTemplateVersionsOptions() throws Throwable { - ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptionsModel = new ListPolicyTemplateVersionsOptions.Builder() - .policyTemplateId("testString") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listPolicyTemplateVersionsOptionsModel.policyTemplateId(), "testString"); - assertEquals(listPolicyTemplateVersionsOptionsModel.state(), "active"); - assertEquals(listPolicyTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listPolicyTemplateVersionsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyTemplateVersionsOptionsError() throws Throwable { - new ListPolicyTemplateVersionsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java deleted file mode 100644 index 5065a9d9495..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyTemplatesOptions model. - */ -public class ListPolicyTemplatesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListPolicyTemplatesOptions() throws Throwable { - ListPolicyTemplatesOptions listPolicyTemplatesOptionsModel = new ListPolicyTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .state("active") - .name("testString") - .policyServiceType("service") - .policyServiceName("testString") - .policyServiceGroupId("testString") - .policyType("access") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listPolicyTemplatesOptionsModel.accountId(), "testString"); - assertEquals(listPolicyTemplatesOptionsModel.acceptLanguage(), "default"); - assertEquals(listPolicyTemplatesOptionsModel.state(), "active"); - assertEquals(listPolicyTemplatesOptionsModel.name(), "testString"); - assertEquals(listPolicyTemplatesOptionsModel.policyServiceType(), "service"); - assertEquals(listPolicyTemplatesOptionsModel.policyServiceName(), "testString"); - assertEquals(listPolicyTemplatesOptionsModel.policyServiceGroupId(), "testString"); - assertEquals(listPolicyTemplatesOptionsModel.policyType(), "access"); - assertEquals(listPolicyTemplatesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listPolicyTemplatesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyTemplatesOptionsError() throws Throwable { - new ListPolicyTemplatesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java deleted file mode 100644 index bd82df9bfd5..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleAssignmentsOptions model. - */ -public class ListRoleAssignmentsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListRoleAssignmentsOptions() throws Throwable { - ListRoleAssignmentsOptions listRoleAssignmentsOptionsModel = new ListRoleAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listRoleAssignmentsOptionsModel.accountId(), "testString"); - assertEquals(listRoleAssignmentsOptionsModel.acceptLanguage(), "default"); - assertEquals(listRoleAssignmentsOptionsModel.templateId(), "testString"); - assertEquals(listRoleAssignmentsOptionsModel.templateVersion(), "testString"); - assertEquals(listRoleAssignmentsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listRoleAssignmentsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleAssignmentsOptionsError() throws Throwable { - new ListRoleAssignmentsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java deleted file mode 100644 index 2e89527b653..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleTemplateVersionsOptions model. - */ -public class ListRoleTemplateVersionsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListRoleTemplateVersionsOptions() throws Throwable { - ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptionsModel = new ListRoleTemplateVersionsOptions.Builder() - .roleTemplateId("testString") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listRoleTemplateVersionsOptionsModel.roleTemplateId(), "testString"); - assertEquals(listRoleTemplateVersionsOptionsModel.state(), "active"); - assertEquals(listRoleTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listRoleTemplateVersionsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleTemplateVersionsOptionsError() throws Throwable { - new ListRoleTemplateVersionsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java deleted file mode 100644 index 21d23a7be0f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleTemplatesOptions model. - */ -public class ListRoleTemplatesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListRoleTemplatesOptions() throws Throwable { - ListRoleTemplatesOptions listRoleTemplatesOptionsModel = new ListRoleTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .name("testString") - .roleName("testString") - .roleServiceName("testString") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listRoleTemplatesOptionsModel.accountId(), "testString"); - assertEquals(listRoleTemplatesOptionsModel.acceptLanguage(), "default"); - assertEquals(listRoleTemplatesOptionsModel.name(), "testString"); - assertEquals(listRoleTemplatesOptionsModel.roleName(), "testString"); - assertEquals(listRoleTemplatesOptionsModel.roleServiceName(), "testString"); - assertEquals(listRoleTemplatesOptionsModel.state(), "active"); - assertEquals(listRoleTemplatesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listRoleTemplatesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleTemplatesOptionsError() throws Throwable { - new ListRoleTemplatesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java deleted file mode 100644 index 4fb97c7fc9a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListRolesOptions model. - */ -public class ListRolesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListRolesOptions() throws Throwable { - ListRolesOptions listRolesOptionsModel = new ListRolesOptions.Builder() - .acceptLanguage("default") - .accountId("testString") - .serviceName("iam-groups") - .sourceServiceName("iam-groups") - .policyType("authorization") - .serviceGroupId("IAM") - .build(); - assertEquals(listRolesOptionsModel.acceptLanguage(), "default"); - assertEquals(listRolesOptionsModel.accountId(), "testString"); - assertEquals(listRolesOptionsModel.serviceName(), "iam-groups"); - assertEquals(listRolesOptionsModel.sourceServiceName(), "iam-groups"); - assertEquals(listRolesOptionsModel.policyType(), "authorization"); - assertEquals(listRolesOptionsModel.serviceGroupId(), "IAM"); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java deleted file mode 100644 index 8c72945373b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListV2PoliciesOptions model. - */ -public class ListV2PoliciesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListV2PoliciesOptions() throws Throwable { - ListV2PoliciesOptions listV2PoliciesOptionsModel = new ListV2PoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .serviceName("testString") - .serviceGroupId("testString") - .sort("testString") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listV2PoliciesOptionsModel.accountId(), "testString"); - assertEquals(listV2PoliciesOptionsModel.acceptLanguage(), "default"); - assertEquals(listV2PoliciesOptionsModel.iamId(), "testString"); - assertEquals(listV2PoliciesOptionsModel.accessGroupId(), "testString"); - assertEquals(listV2PoliciesOptionsModel.type(), "access"); - assertEquals(listV2PoliciesOptionsModel.serviceType(), "service"); - assertEquals(listV2PoliciesOptionsModel.serviceName(), "testString"); - assertEquals(listV2PoliciesOptionsModel.serviceGroupId(), "testString"); - assertEquals(listV2PoliciesOptionsModel.sort(), "testString"); - assertEquals(listV2PoliciesOptionsModel.format(), "include_last_permit"); - assertEquals(listV2PoliciesOptionsModel.state(), "active"); - assertEquals(listV2PoliciesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listV2PoliciesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListV2PoliciesOptionsError() throws Throwable { - new ListV2PoliciesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java deleted file mode 100644 index 0661d4245a2..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 NestedConditionRuleAttribute model. - */ -public class NestedConditionRuleAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNestedConditionRuleAttribute() throws Throwable { - NestedConditionRuleAttribute nestedConditionRuleAttributeModel = new NestedConditionRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(nestedConditionRuleAttributeModel.key(), "testString"); - assertEquals(nestedConditionRuleAttributeModel.operator(), "stringEquals"); - assertEquals(nestedConditionRuleAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(nestedConditionRuleAttributeModel); - - NestedConditionRuleAttribute nestedConditionRuleAttributeModelNew = TestUtilities.deserialize(json, NestedConditionRuleAttribute.class); - assertTrue(nestedConditionRuleAttributeModelNew instanceof NestedConditionRuleAttribute); - assertEquals(nestedConditionRuleAttributeModelNew.key(), "testString"); - assertEquals(nestedConditionRuleAttributeModelNew.operator(), "stringEquals"); - assertEquals(nestedConditionRuleAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testNestedConditionRuleAttributeError() throws Throwable { - new NestedConditionRuleAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java deleted file mode 100644 index 1ba394dbb7d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleWithConditions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 NestedConditionRuleWithConditions model. - */ -public class NestedConditionRuleWithConditionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNestedConditionRuleWithConditions() throws Throwable { - RuleAttribute ruleAttributeModel = new RuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(ruleAttributeModel.key(), "testString"); - assertEquals(ruleAttributeModel.operator(), "stringEquals"); - assertEquals(ruleAttributeModel.value(), "testString"); - - NestedConditionRuleWithConditions nestedConditionRuleWithConditionsModel = new NestedConditionRuleWithConditions.Builder() - .operator("and") - .conditions(java.util.Arrays.asList(ruleAttributeModel)) - .build(); - assertEquals(nestedConditionRuleWithConditionsModel.operator(), "and"); - assertEquals(nestedConditionRuleWithConditionsModel.conditions(), java.util.Arrays.asList(ruleAttributeModel)); - - String json = TestUtilities.serialize(nestedConditionRuleWithConditionsModel); - - NestedConditionRuleWithConditions nestedConditionRuleWithConditionsModelNew = TestUtilities.deserialize(json, NestedConditionRuleWithConditions.class); - assertTrue(nestedConditionRuleWithConditionsModelNew instanceof NestedConditionRuleWithConditions); - assertEquals(nestedConditionRuleWithConditionsModelNew.operator(), "and"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testNestedConditionRuleWithConditionsError() throws Throwable { - new NestedConditionRuleWithConditions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java deleted file mode 100644 index 4956eea2675..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedCondition; -import com.ibm.cloud.platform_services.iam_policy_management.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 NestedCondition model. - */ -public class NestedConditionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testNestedCondition() throws Throwable { - NestedCondition nestedConditionModel = new NestedCondition(); - assertNotNull(nestedConditionModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java deleted file mode 100644 index c5e084a44d5..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.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 Next model. - */ -public class NextTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNext() throws Throwable { - Next nextModel = new Next(); - assertNull(nextModel.getStart()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java deleted file mode 100644 index d5b05ede760..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentResourcePolicy model. - */ -public class PolicyAssignmentResourcePolicyTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentResourcePolicy() throws Throwable { - PolicyAssignmentResourcePolicy policyAssignmentResourcePolicyModel = new PolicyAssignmentResourcePolicy(); - assertNull(policyAssignmentResourcePolicyModel.getResourceCreated()); - assertNull(policyAssignmentResourcePolicyModel.getStatus()); - assertNull(policyAssignmentResourcePolicyModel.getErrorMessage()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java deleted file mode 100644 index 8b146425617..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentResources model. - */ -public class PolicyAssignmentResourcesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentResources() throws Throwable { - PolicyAssignmentResources policyAssignmentResourcesModel = new PolicyAssignmentResources(); - assertNull(policyAssignmentResourcesModel.getTarget()); - assertNull(policyAssignmentResourcesModel.getPolicy()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java deleted file mode 100644 index 8a3a6b67703..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Collection model. - */ -public class PolicyAssignmentV1CollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentV1Collection() throws Throwable { - PolicyAssignmentV1Collection policyAssignmentV1CollectionModel = new PolicyAssignmentV1Collection(); - assertNull(policyAssignmentV1CollectionModel.getLimit()); - assertNull(policyAssignmentV1CollectionModel.getFirst()); - assertNull(policyAssignmentV1CollectionModel.getNext()); - assertNull(policyAssignmentV1CollectionModel.getPrevious()); - assertNull(policyAssignmentV1CollectionModel.getAssignments()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java deleted file mode 100644 index 56c843a232e..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Resources model. - */ -public class PolicyAssignmentV1ResourcesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentV1Resources() throws Throwable { - PolicyAssignmentV1Resources policyAssignmentV1ResourcesModel = new PolicyAssignmentV1Resources(); - assertNull(policyAssignmentV1ResourcesModel.getTarget()); - assertNull(policyAssignmentV1ResourcesModel.getPolicy()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java deleted file mode 100644 index f5d14b29447..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Subject model. - */ -public class PolicyAssignmentV1SubjectTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentV1Subject() throws Throwable { - PolicyAssignmentV1Subject policyAssignmentV1SubjectModel = new PolicyAssignmentV1Subject(); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java deleted file mode 100644 index d9889483421..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1 model. - */ -public class PolicyAssignmentV1Test { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentV1() throws Throwable { - PolicyAssignmentV1 policyAssignmentV1Model = new PolicyAssignmentV1(); - assertNull(policyAssignmentV1Model.getTarget()); - assertNull(policyAssignmentV1Model.getResources()); - assertNull(policyAssignmentV1Model.getSubject()); - assertNull(policyAssignmentV1Model.getTemplate()); - assertNull(policyAssignmentV1Model.getStatus()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java deleted file mode 100644 index 3d372dfaf20..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyCollection model. - */ -public class PolicyCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyCollection() throws Throwable { - PolicyCollection policyCollectionModel = new PolicyCollection(); - assertNull(policyCollectionModel.getLimit()); - assertNull(policyCollectionModel.getFirst()); - assertNull(policyCollectionModel.getNext()); - assertNull(policyCollectionModel.getPrevious()); - assertNull(policyCollectionModel.getPolicies()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java deleted file mode 100644 index cb2f203a5c3..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyResource model. - */ -public class PolicyResourceTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyResource() throws Throwable { - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceAttributeModel.name(), "testString"); - assertEquals(resourceAttributeModel.value(), "testString"); - assertEquals(resourceAttributeModel.operator(), "testString"); - - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceTagModel.name(), "testString"); - assertEquals(resourceTagModel.value(), "testString"); - assertEquals(resourceTagModel.operator(), "testString"); - - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); - assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); - - String json = TestUtilities.serialize(policyResourceModel); - - PolicyResource policyResourceModelNew = TestUtilities.deserialize(json, PolicyResource.class); - assertTrue(policyResourceModelNew instanceof PolicyResource); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testPolicyResourceError() throws Throwable { - new PolicyResource.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java deleted file mode 100644 index 299e15b1fd4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyRole model. - */ -public class PolicyRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyRole() throws Throwable { - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - assertEquals(policyRoleModel.roleId(), "testString"); - - String json = TestUtilities.serialize(policyRoleModel); - - PolicyRole policyRoleModelNew = TestUtilities.deserialize(json, PolicyRole.class); - assertTrue(policyRoleModelNew instanceof PolicyRole); - assertEquals(policyRoleModelNew.roleId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testPolicyRoleError() throws Throwable { - new PolicyRole.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java deleted file mode 100644 index 6d0a937bd53..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicySubject model. - */ -public class PolicySubjectTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicySubject() throws Throwable { - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - assertEquals(subjectAttributeModel.name(), "testString"); - assertEquals(subjectAttributeModel.value(), "testString"); - - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); - - String json = TestUtilities.serialize(policySubjectModel); - - PolicySubject policySubjectModelNew = TestUtilities.deserialize(json, PolicySubject.class); - assertTrue(policySubjectModelNew instanceof PolicySubject); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testPolicySubjectError() throws Throwable { - new PolicySubject.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java deleted file mode 100644 index 8cb98be3d32..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentCollection model. - */ -public class PolicyTemplateAssignmentCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateAssignmentCollection() throws Throwable { - PolicyTemplateAssignmentCollection policyTemplateAssignmentCollectionModel = new PolicyTemplateAssignmentCollection(); - assertNull(policyTemplateAssignmentCollectionModel.getLimit()); - assertNull(policyTemplateAssignmentCollectionModel.getFirst()); - assertNull(policyTemplateAssignmentCollectionModel.getNext()); - assertNull(policyTemplateAssignmentCollectionModel.getPrevious()); - assertNull(policyTemplateAssignmentCollectionModel.getAssignments()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java deleted file mode 100644 index fded12633d2..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItemsPolicyAssignment model. - */ -public class PolicyTemplateAssignmentItemsPolicyAssignmentTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateAssignmentItemsPolicyAssignment() throws Throwable { - PolicyTemplateAssignmentItemsPolicyAssignment policyTemplateAssignmentItemsPolicyAssignmentModel = new PolicyTemplateAssignmentItemsPolicyAssignment(); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTemplateId()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTemplateVersion()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getAssignmentId()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTargetType()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTarget()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getResources()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getStatus()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java deleted file mode 100644 index 6b74125d238..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItemsPolicyAssignmentV1 model. - */ -public class PolicyTemplateAssignmentItemsPolicyAssignmentV1Test { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateAssignmentItemsPolicyAssignmentV1() throws Throwable { - PolicyTemplateAssignmentItemsPolicyAssignmentV1 policyTemplateAssignmentItemsPolicyAssignmentV1Model = new PolicyTemplateAssignmentItemsPolicyAssignmentV1(); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getTarget()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getResources()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getSubject()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getTemplate()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getStatus()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java deleted file mode 100644 index 05b400e91c1..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItems model. - */ -public class PolicyTemplateAssignmentItemsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testPolicyTemplateAssignmentItems() throws Throwable { - PolicyTemplateAssignmentItems policyTemplateAssignmentItemsModel = new PolicyTemplateAssignmentItems(); - assertNotNull(policyTemplateAssignmentItemsModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java deleted file mode 100644 index 52041b1a6a3..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateCollection model. - */ -public class PolicyTemplateCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateCollection() throws Throwable { - PolicyTemplateCollection policyTemplateCollectionModel = new PolicyTemplateCollection(); - assertNull(policyTemplateCollectionModel.getLimit()); - assertNull(policyTemplateCollectionModel.getFirst()); - assertNull(policyTemplateCollectionModel.getNext()); - assertNull(policyTemplateCollectionModel.getPrevious()); - assertNull(policyTemplateCollectionModel.getPolicyTemplates()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java deleted file mode 100644 index b6ee06990a2..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateLimitData model. - */ -public class PolicyTemplateLimitDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateLimitData() throws Throwable { - PolicyTemplateLimitData policyTemplateLimitDataModel = new PolicyTemplateLimitData(); - assertNull(policyTemplateLimitDataModel.getName()); - assertNull(policyTemplateLimitDataModel.getDescription()); - assertNull(policyTemplateLimitDataModel.getAccountId()); - assertNull(policyTemplateLimitDataModel.getVersion()); - assertNull(policyTemplateLimitDataModel.isCommitted()); - assertNull(policyTemplateLimitDataModel.getPolicy()); - assertNull(policyTemplateLimitDataModel.getState()); - assertNull(policyTemplateLimitDataModel.getCounts()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java deleted file mode 100644 index edeb45c4d96..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateMetaData model. - */ -public class PolicyTemplateMetaDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateMetaData() throws Throwable { - PolicyTemplateMetaData policyTemplateMetaDataModel = new PolicyTemplateMetaData(); - assertNull(policyTemplateMetaDataModel.getType()); - assertNull(policyTemplateMetaDataModel.getDescription()); - assertNull(policyTemplateMetaDataModel.getSubjects()); - assertNull(policyTemplateMetaDataModel.getRoles()); - assertNull(policyTemplateMetaDataModel.getResources()); - assertNull(policyTemplateMetaDataModel.getState()); - assertNull(policyTemplateMetaDataModel.getTemplate()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java deleted file mode 100644 index c349e4a3415..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplate model. - */ -public class PolicyTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplate() throws Throwable { - PolicyTemplate policyTemplateModel = new PolicyTemplate(); - assertNull(policyTemplateModel.getName()); - assertNull(policyTemplateModel.getDescription()); - assertNull(policyTemplateModel.getAccountId()); - assertNull(policyTemplateModel.getVersion()); - assertNull(policyTemplateModel.isCommitted()); - assertNull(policyTemplateModel.getPolicy()); - assertNull(policyTemplateModel.getState()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java deleted file mode 100644 index da651956461..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateVersionsCollection model. - */ -public class PolicyTemplateVersionsCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateVersionsCollection() throws Throwable { - PolicyTemplateVersionsCollection policyTemplateVersionsCollectionModel = new PolicyTemplateVersionsCollection(); - assertNull(policyTemplateVersionsCollectionModel.getLimit()); - assertNull(policyTemplateVersionsCollectionModel.getFirst()); - assertNull(policyTemplateVersionsCollectionModel.getNext()); - assertNull(policyTemplateVersionsCollectionModel.getPrevious()); - assertNull(policyTemplateVersionsCollectionModel.getVersions()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java deleted file mode 100644 index 28eba4f9a85..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 Policy model. - */ -public class PolicyTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicy() throws Throwable { - Policy policyModel = new Policy(); - assertNull(policyModel.getType()); - assertNull(policyModel.getDescription()); - assertNull(policyModel.getSubjects()); - assertNull(policyModel.getRoles()); - assertNull(policyModel.getResources()); - assertNull(policyModel.getState()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java deleted file mode 100644 index e3788c51212..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.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 Previous model. - */ -public class PreviousTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPrevious() throws Throwable { - Previous previousModel = new Previous(); - assertNull(previousModel.getStart()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java deleted file mode 100644 index 430f5f63764..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceActionControlTemplateOptions model. - */ -public class ReplaceActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplaceActionControlTemplateOptions() throws Throwable { - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateActionControlModel.serviceName(), "testString"); - assertEquals(templateActionControlModel.description(), "testString"); - assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); - - ReplaceActionControlTemplateOptions replaceActionControlTemplateOptionsModel = new ReplaceActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .ifMatch("testString") - .name("testString") - .description("testString") - .actionControl(templateActionControlModel) - .committed(true) - .build(); - assertEquals(replaceActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.version(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.ifMatch(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.name(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.description(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.actionControl(), templateActionControlModel); - assertEquals(replaceActionControlTemplateOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceActionControlTemplateOptionsError() throws Throwable { - new ReplaceActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java deleted file mode 100644 index 2f20b05f37c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplacePolicyOptions model. - */ -public class ReplacePolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplacePolicyOptions() throws Throwable { - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - assertEquals(subjectAttributeModel.name(), "testString"); - assertEquals(subjectAttributeModel.value(), "testString"); - - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); - - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - assertEquals(policyRoleModel.roleId(), "testString"); - - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceAttributeModel.name(), "testString"); - assertEquals(resourceAttributeModel.value(), "testString"); - assertEquals(resourceAttributeModel.operator(), "testString"); - - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceTagModel.name(), "testString"); - assertEquals(resourceTagModel.value(), "testString"); - assertEquals(resourceTagModel.operator(), "testString"); - - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); - assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); - - ReplacePolicyOptions replacePolicyOptionsModel = new ReplacePolicyOptions.Builder() - .policyId("testString") - .ifMatch("testString") - .type("testString") - .subjects(java.util.Arrays.asList(policySubjectModel)) - .roles(java.util.Arrays.asList(policyRoleModel)) - .resources(java.util.Arrays.asList(policyResourceModel)) - .description("testString") - .build(); - assertEquals(replacePolicyOptionsModel.policyId(), "testString"); - assertEquals(replacePolicyOptionsModel.ifMatch(), "testString"); - assertEquals(replacePolicyOptionsModel.type(), "testString"); - assertEquals(replacePolicyOptionsModel.subjects(), java.util.Arrays.asList(policySubjectModel)); - assertEquals(replacePolicyOptionsModel.roles(), java.util.Arrays.asList(policyRoleModel)); - assertEquals(replacePolicyOptionsModel.resources(), java.util.Arrays.asList(policyResourceModel)); - assertEquals(replacePolicyOptionsModel.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplacePolicyOptionsError() throws Throwable { - new ReplacePolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java deleted file mode 100644 index 2dc2430daca..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplacePolicyTemplateOptions model. - */ -public class ReplacePolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplacePolicyTemplateOptions() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - assertEquals(templatePolicyModel.type(), "access"); - assertEquals(templatePolicyModel.description(), "testString"); - assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); - assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); - assertEquals(templatePolicyModel.pattern(), "testString"); - assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), templateControlModel); - - ReplacePolicyTemplateOptions replacePolicyTemplateOptionsModel = new ReplacePolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .ifMatch("testString") - .policy(templatePolicyModel) - .name("testString") - .description("testString") - .committed(true) - .build(); - assertEquals(replacePolicyTemplateOptionsModel.policyTemplateId(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.version(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.ifMatch(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.policy(), templatePolicyModel); - assertEquals(replacePolicyTemplateOptionsModel.name(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.description(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplacePolicyTemplateOptionsError() throws Throwable { - new ReplacePolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java deleted file mode 100644 index 9900abb2543..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceRoleOptions model. - */ -public class ReplaceRoleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplaceRoleOptions() throws Throwable { - ReplaceRoleOptions replaceRoleOptionsModel = new ReplaceRoleOptions.Builder() - .roleId("testString") - .ifMatch("testString") - .displayName("testString") - .actions(java.util.Arrays.asList("testString")) - .description("testString") - .build(); - assertEquals(replaceRoleOptionsModel.roleId(), "testString"); - assertEquals(replaceRoleOptionsModel.ifMatch(), "testString"); - assertEquals(replaceRoleOptionsModel.displayName(), "testString"); - assertEquals(replaceRoleOptionsModel.actions(), java.util.Arrays.asList("testString")); - assertEquals(replaceRoleOptionsModel.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceRoleOptionsError() throws Throwable { - new ReplaceRoleOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java deleted file mode 100644 index 2f731aea7d4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceRoleTemplateOptions model. - */ -public class ReplaceRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplaceRoleTemplateOptions() throws Throwable { - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateRoleModel.displayName(), "testString"); - assertEquals(templateRoleModel.serviceName(), "testString"); - assertEquals(templateRoleModel.description(), "testString"); - assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); - - ReplaceRoleTemplateOptions replaceRoleTemplateOptionsModel = new ReplaceRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .ifMatch("testString") - .name("testString") - .description("testString") - .role(templateRoleModel) - .committed(true) - .build(); - assertEquals(replaceRoleTemplateOptionsModel.roleTemplateId(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.version(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.ifMatch(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.name(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.description(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.role(), templateRoleModel); - assertEquals(replaceRoleTemplateOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceRoleTemplateOptionsError() throws Throwable { - new ReplaceRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java deleted file mode 100644 index 23690eda780..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceV2PolicyOptions model. - */ -public class ReplaceV2PolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplaceV2PolicyOptions() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); - - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - assertEquals(controlModel.grant(), grantModel); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - ReplaceV2PolicyOptions replaceV2PolicyOptionsModel = new ReplaceV2PolicyOptions.Builder() - .id("testString") - .ifMatch("testString") - .control(controlModel) - .type("access") - .description("testString") - .subject(v2PolicySubjectModel) - .resource(v2PolicyResourceModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .build(); - assertEquals(replaceV2PolicyOptionsModel.id(), "testString"); - assertEquals(replaceV2PolicyOptionsModel.ifMatch(), "testString"); - assertEquals(replaceV2PolicyOptionsModel.control(), controlModel); - assertEquals(replaceV2PolicyOptionsModel.type(), "access"); - assertEquals(replaceV2PolicyOptionsModel.description(), "testString"); - assertEquals(replaceV2PolicyOptionsModel.subject(), v2PolicySubjectModel); - assertEquals(replaceV2PolicyOptionsModel.resource(), v2PolicyResourceModel); - assertEquals(replaceV2PolicyOptionsModel.pattern(), "testString"); - assertEquals(replaceV2PolicyOptionsModel.rule(), v2PolicyRuleModel); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceV2PolicyOptionsError() throws Throwable { - new ReplaceV2PolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java deleted file mode 100644 index bd50b514f43..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 ResourceAttribute model. - */ -public class ResourceAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testResourceAttribute() throws Throwable { - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceAttributeModel.name(), "testString"); - assertEquals(resourceAttributeModel.value(), "testString"); - assertEquals(resourceAttributeModel.operator(), "testString"); - - String json = TestUtilities.serialize(resourceAttributeModel); - - ResourceAttribute resourceAttributeModelNew = TestUtilities.deserialize(json, ResourceAttribute.class); - assertTrue(resourceAttributeModelNew instanceof ResourceAttribute); - assertEquals(resourceAttributeModelNew.name(), "testString"); - assertEquals(resourceAttributeModelNew.value(), "testString"); - assertEquals(resourceAttributeModelNew.operator(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testResourceAttributeError() throws Throwable { - new ResourceAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java deleted file mode 100644 index 88a1eb5d5b6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.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 ResourceTag model. - */ -public class ResourceTagTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testResourceTag() throws Throwable { - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceTagModel.name(), "testString"); - assertEquals(resourceTagModel.value(), "testString"); - assertEquals(resourceTagModel.operator(), "testString"); - - String json = TestUtilities.serialize(resourceTagModel); - - ResourceTag resourceTagModelNew = TestUtilities.deserialize(json, ResourceTag.class); - assertTrue(resourceTagModelNew instanceof ResourceTag); - assertEquals(resourceTagModelNew.name(), "testString"); - assertEquals(resourceTagModelNew.value(), "testString"); - assertEquals(resourceTagModelNew.operator(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testResourceTagError() throws Throwable { - new ResourceTag.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java deleted file mode 100644 index e4c0bcc6f92..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAction model. - */ -public class RoleActionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAction() throws Throwable { - RoleAction roleActionModel = new RoleAction(); - assertNull(roleActionModel.getId()); - assertNull(roleActionModel.getDisplayName()); - assertNull(roleActionModel.getDescription()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java deleted file mode 100644 index 42801bc7771..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentCollection model. - */ -public class RoleAssignmentCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentCollection() throws Throwable { - RoleAssignmentCollection roleAssignmentCollectionModel = new RoleAssignmentCollection(); - assertNull(roleAssignmentCollectionModel.getLimit()); - assertNull(roleAssignmentCollectionModel.getFirst()); - assertNull(roleAssignmentCollectionModel.getNext()); - assertNull(roleAssignmentCollectionModel.getPrevious()); - assertNull(roleAssignmentCollectionModel.getAssignments()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java deleted file mode 100644 index bef8b71b0fa..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResourceCreated model. - */ -public class RoleAssignmentResourceCreatedTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentResourceCreated() throws Throwable { - RoleAssignmentResourceCreated roleAssignmentResourceCreatedModel = new RoleAssignmentResourceCreated(); - assertNull(roleAssignmentResourceCreatedModel.getId()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java deleted file mode 100644 index c346ca0f48f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResourceRole model. - */ -public class RoleAssignmentResourceRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentResourceRole() throws Throwable { - RoleAssignmentResourceRole roleAssignmentResourceRoleModel = new RoleAssignmentResourceRole(); - assertNull(roleAssignmentResourceRoleModel.getResourceCreated()); - assertNull(roleAssignmentResourceRoleModel.getErrorMessage()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java deleted file mode 100644 index 4fca1b25b5b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResource model. - */ -public class RoleAssignmentResourceTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentResource() throws Throwable { - RoleAssignmentResource roleAssignmentResourceModel = new RoleAssignmentResource(); - assertNull(roleAssignmentResourceModel.getTarget()); - assertNull(roleAssignmentResourceModel.getRole()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java deleted file mode 100644 index 4f2e3a37200..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentTemplate model. - */ -public class RoleAssignmentTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentTemplate() throws Throwable { - RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(roleAssignmentTemplateModel.id(), "testString"); - assertEquals(roleAssignmentTemplateModel.version(), "testString"); - - String json = TestUtilities.serialize(roleAssignmentTemplateModel); - - RoleAssignmentTemplate roleAssignmentTemplateModelNew = TestUtilities.deserialize(json, RoleAssignmentTemplate.class); - assertTrue(roleAssignmentTemplateModelNew instanceof RoleAssignmentTemplate); - assertEquals(roleAssignmentTemplateModelNew.id(), "testString"); - assertEquals(roleAssignmentTemplateModelNew.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRoleAssignmentTemplateError() throws Throwable { - new RoleAssignmentTemplate.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java deleted file mode 100644 index bd3bda7ce24..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignment model. - */ -public class RoleAssignmentTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignment() throws Throwable { - RoleAssignment roleAssignmentModel = new RoleAssignment(); - assertNull(roleAssignmentModel.getTemplate()); - assertNull(roleAssignmentModel.getTarget()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java deleted file mode 100644 index 812c2dcb131..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleCollection model. - */ -public class RoleCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleCollection() throws Throwable { - RoleCollection roleCollectionModel = new RoleCollection(); - assertNull(roleCollectionModel.getCustomRoles()); - assertNull(roleCollectionModel.getServiceRoles()); - assertNull(roleCollectionModel.getSystemRoles()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java deleted file mode 100644 index fde4d11ff4c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateCollection model. - */ -public class RoleTemplateCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplateCollection() throws Throwable { - RoleTemplateCollection roleTemplateCollectionModel = new RoleTemplateCollection(); - assertNull(roleTemplateCollectionModel.getLimit()); - assertNull(roleTemplateCollectionModel.getFirst()); - assertNull(roleTemplateCollectionModel.getNext()); - assertNull(roleTemplateCollectionModel.getPrevious()); - assertNull(roleTemplateCollectionModel.getRoleTemplates()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java deleted file mode 100644 index 6c208e1c38f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplatePrototypeRole model. - */ -public class RoleTemplatePrototypeRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplatePrototypeRole() throws Throwable { - RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() - .name("testString") - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(roleTemplatePrototypeRoleModel.name(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.displayName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.serviceName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.description(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.actions(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(roleTemplatePrototypeRoleModel); - - RoleTemplatePrototypeRole roleTemplatePrototypeRoleModelNew = TestUtilities.deserialize(json, RoleTemplatePrototypeRole.class); - assertTrue(roleTemplatePrototypeRoleModelNew instanceof RoleTemplatePrototypeRole); - assertEquals(roleTemplatePrototypeRoleModelNew.name(), "testString"); - assertEquals(roleTemplatePrototypeRoleModelNew.displayName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModelNew.serviceName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModelNew.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRoleTemplatePrototypeRoleError() throws Throwable { - new RoleTemplatePrototypeRole.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java deleted file mode 100644 index af9de718e23..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateReferencesItem model. - */ -public class RoleTemplateReferencesItemTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplateReferencesItem() throws Throwable { - RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(roleTemplateReferencesItemModel.id(), "testString"); - assertEquals(roleTemplateReferencesItemModel.version(), "testString"); - - String json = TestUtilities.serialize(roleTemplateReferencesItemModel); - - RoleTemplateReferencesItem roleTemplateReferencesItemModelNew = TestUtilities.deserialize(json, RoleTemplateReferencesItem.class); - assertTrue(roleTemplateReferencesItemModelNew instanceof RoleTemplateReferencesItem); - assertEquals(roleTemplateReferencesItemModelNew.id(), "testString"); - assertEquals(roleTemplateReferencesItemModelNew.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRoleTemplateReferencesItemError() throws Throwable { - new RoleTemplateReferencesItem.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java deleted file mode 100644 index 8bb27d8dd62..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplate model. - */ -public class RoleTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplate() throws Throwable { - RoleTemplate roleTemplateModel = new RoleTemplate(); - assertNull(roleTemplateModel.getName()); - assertNull(roleTemplateModel.getDescription()); - assertNull(roleTemplateModel.getAccountId()); - assertNull(roleTemplateModel.isCommitted()); - assertNull(roleTemplateModel.getRole()); - assertNull(roleTemplateModel.getVersion()); - assertNull(roleTemplateModel.getState()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java deleted file mode 100644 index 068cf309bd6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateVersionsCollection model. - */ -public class RoleTemplateVersionsCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplateVersionsCollection() throws Throwable { - RoleTemplateVersionsCollection roleTemplateVersionsCollectionModel = new RoleTemplateVersionsCollection(); - assertNull(roleTemplateVersionsCollectionModel.getLimit()); - assertNull(roleTemplateVersionsCollectionModel.getFirst()); - assertNull(roleTemplateVersionsCollectionModel.getNext()); - assertNull(roleTemplateVersionsCollectionModel.getPrevious()); - assertNull(roleTemplateVersionsCollectionModel.getVersions()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java deleted file mode 100644 index a632e63587f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; -import com.ibm.cloud.platform_services.iam_policy_management.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 Role model. - */ -public class RoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRole() throws Throwable { - Role roleModel = new Role.Builder() - .displayName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(roleModel.displayName(), "testString"); - assertEquals(roleModel.description(), "testString"); - assertEquals(roleModel.actions(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(roleModel); - - Role roleModelNew = TestUtilities.deserialize(json, Role.class); - assertTrue(roleModelNew instanceof Role); - assertEquals(roleModelNew.displayName(), "testString"); - assertEquals(roleModelNew.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRoleError() throws Throwable { - new Role.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java deleted file mode 100644 index 8383ef794a9..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 Roles model. - */ -public class RolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoles() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - String json = TestUtilities.serialize(rolesModel); - - Roles rolesModelNew = TestUtilities.deserialize(json, Roles.class); - assertTrue(rolesModelNew instanceof Roles); - assertEquals(rolesModelNew.roleId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRolesError() throws Throwable { - new Roles.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java deleted file mode 100644 index a05e5ee8704..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 RuleAttribute model. - */ -public class RuleAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRuleAttribute() throws Throwable { - RuleAttribute ruleAttributeModel = new RuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(ruleAttributeModel.key(), "testString"); - assertEquals(ruleAttributeModel.operator(), "stringEquals"); - assertEquals(ruleAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(ruleAttributeModel); - - RuleAttribute ruleAttributeModelNew = TestUtilities.deserialize(json, RuleAttribute.class); - assertTrue(ruleAttributeModelNew instanceof RuleAttribute); - assertEquals(ruleAttributeModelNew.key(), "testString"); - assertEquals(ruleAttributeModelNew.operator(), "stringEquals"); - assertEquals(ruleAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRuleAttributeError() throws Throwable { - new RuleAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java deleted file mode 100644 index 7bae03a42e0..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 SubjectAttribute model. - */ -public class SubjectAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testSubjectAttribute() throws Throwable { - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - assertEquals(subjectAttributeModel.name(), "testString"); - assertEquals(subjectAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(subjectAttributeModel); - - SubjectAttribute subjectAttributeModelNew = TestUtilities.deserialize(json, SubjectAttribute.class); - assertTrue(subjectAttributeModelNew instanceof SubjectAttribute); - assertEquals(subjectAttributeModelNew.name(), "testString"); - assertEquals(subjectAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testSubjectAttributeError() throws Throwable { - new SubjectAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java deleted file mode 100644 index d3a6d4ef53a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateActionControl model. - */ -public class TemplateActionControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateActionControl() throws Throwable { - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateActionControlModel.serviceName(), "testString"); - assertEquals(templateActionControlModel.description(), "testString"); - assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(templateActionControlModel); - - TemplateActionControl templateActionControlModelNew = TestUtilities.deserialize(json, TemplateActionControl.class); - assertTrue(templateActionControlModelNew instanceof TemplateActionControl); - assertEquals(templateActionControlModelNew.serviceName(), "testString"); - assertEquals(templateActionControlModelNew.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateActionControlError() throws Throwable { - new TemplateActionControl.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java deleted file mode 100644 index fba96e64cef..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateControl model. - */ -public class TemplateControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateControl() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - String json = TestUtilities.serialize(templateControlModel); - - TemplateControl templateControlModelNew = TestUtilities.deserialize(json, TemplateControl.class); - assertTrue(templateControlModelNew instanceof TemplateControl); - assertEquals(templateControlModelNew.grant().toString(), templateGrantModel.toString()); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateControlError() throws Throwable { - new TemplateControl.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java deleted file mode 100644 index b440cf19100..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateCountData model. - */ -public class TemplateCountDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateCountData() throws Throwable { - TemplateCountData templateCountDataModel = new TemplateCountData(); - assertNull(templateCountDataModel.getTemplate()); - assertNull(templateCountDataModel.getVersion()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java deleted file mode 100644 index e7759eacc21..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoleReferences; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrantRoleReferences model. - */ -public class TemplateGrantRoleReferencesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateGrantRoleReferences() throws Throwable { - RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(roleTemplateReferencesItemModel.id(), "testString"); - assertEquals(roleTemplateReferencesItemModel.version(), "testString"); - - TemplateGrantRoleReferences templateGrantRoleReferencesModel = new TemplateGrantRoleReferences.Builder() - .roleTemplateReferences(java.util.Arrays.asList(roleTemplateReferencesItemModel)) - .build(); - assertEquals(templateGrantRoleReferencesModel.roleTemplateReferences(), java.util.Arrays.asList(roleTemplateReferencesItemModel)); - - String json = TestUtilities.serialize(templateGrantRoleReferencesModel); - - TemplateGrantRoleReferences templateGrantRoleReferencesModelNew = TestUtilities.deserialize(json, TemplateGrantRoleReferences.class); - assertTrue(templateGrantRoleReferencesModelNew instanceof TemplateGrantRoleReferences); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateGrantRoleReferencesError() throws Throwable { - new TemplateGrantRoleReferences.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java deleted file mode 100644 index 8cddc6f9a19..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrantRoles model. - */ -public class TemplateGrantRolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateGrantRoles() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantRolesModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantRolesModel.roles(), java.util.Arrays.asList(rolesModel)); - - String json = TestUtilities.serialize(templateGrantRolesModel); - - TemplateGrantRoles templateGrantRolesModelNew = TestUtilities.deserialize(json, TemplateGrantRoles.class); - assertTrue(templateGrantRolesModelNew instanceof TemplateGrantRoles); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateGrantRolesError() throws Throwable { - new TemplateGrantRoles.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java deleted file mode 100644 index 90e6fdc2b9f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrant model. - */ -public class TemplateGrantTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testTemplateGrant() throws Throwable { - TemplateGrant templateGrantModel = new TemplateGrant(); - assertNotNull(templateGrantModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java deleted file mode 100644 index c2688232e2b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateMetadata model. - */ -public class TemplateMetadataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateMetadata() throws Throwable { - TemplateMetadata templateMetadataModel = new TemplateMetadata(); - assertNull(templateMetadataModel.getId()); - assertNull(templateMetadataModel.getVersion()); - assertNull(templateMetadataModel.getAssignmentId()); - assertNull(templateMetadataModel.getRootId()); - assertNull(templateMetadataModel.getRootVersion()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java deleted file mode 100644 index 0e256ffd599..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplatePolicy model. - */ -public class TemplatePolicyTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplatePolicy() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - assertEquals(templatePolicyModel.type(), "access"); - assertEquals(templatePolicyModel.description(), "testString"); - assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); - assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); - assertEquals(templatePolicyModel.pattern(), "testString"); - assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), templateControlModel); - - String json = TestUtilities.serialize(templatePolicyModel); - - TemplatePolicy templatePolicyModelNew = TestUtilities.deserialize(json, TemplatePolicy.class); - assertTrue(templatePolicyModelNew instanceof TemplatePolicy); - assertEquals(templatePolicyModelNew.type(), "access"); - assertEquals(templatePolicyModelNew.description(), "testString"); - assertEquals(templatePolicyModelNew.resource().toString(), v2PolicyResourceModel.toString()); - assertEquals(templatePolicyModelNew.subject().toString(), v2PolicySubjectModel.toString()); - assertEquals(templatePolicyModelNew.pattern(), "testString"); - assertEquals(templatePolicyModelNew.rule().toString(), v2PolicyRuleModel.toString()); - assertEquals(templatePolicyModelNew.control().toString(), templateControlModel.toString()); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplatePolicyError() throws Throwable { - new TemplatePolicy.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java deleted file mode 100644 index 1735364bc85..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateRole model. - */ -public class TemplateRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateRole() throws Throwable { - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateRoleModel.displayName(), "testString"); - assertEquals(templateRoleModel.serviceName(), "testString"); - assertEquals(templateRoleModel.description(), "testString"); - assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(templateRoleModel); - - TemplateRole templateRoleModelNew = TestUtilities.deserialize(json, TemplateRole.class); - assertTrue(templateRoleModelNew instanceof TemplateRole); - assertEquals(templateRoleModelNew.displayName(), "testString"); - assertEquals(templateRoleModelNew.serviceName(), "testString"); - assertEquals(templateRoleModelNew.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateRoleError() throws Throwable { - new TemplateRole.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java deleted file mode 100644 index df7a09c2829..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateActionControlAssignmentOptions model. - */ -public class UpdateActionControlAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdateActionControlAssignmentOptions() throws Throwable { - UpdateActionControlAssignmentOptions updateActionControlAssignmentOptionsModel = new UpdateActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .ifMatch("testString") - .templateVersion("testString") - .build(); - assertEquals(updateActionControlAssignmentOptionsModel.assignmentId(), "testString"); - assertEquals(updateActionControlAssignmentOptionsModel.ifMatch(), "testString"); - assertEquals(updateActionControlAssignmentOptionsModel.templateVersion(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateActionControlAssignmentOptionsError() throws Throwable { - new UpdateActionControlAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java deleted file mode 100644 index 0008325ffcf..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdatePolicyAssignmentOptions model. - */ -public class UpdatePolicyAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdatePolicyAssignmentOptions() throws Throwable { - UpdatePolicyAssignmentOptions updatePolicyAssignmentOptionsModel = new UpdatePolicyAssignmentOptions.Builder() - .assignmentId("testString") - .version("1.0") - .ifMatch("testString") - .templateVersion("testString") - .build(); - assertEquals(updatePolicyAssignmentOptionsModel.assignmentId(), "testString"); - assertEquals(updatePolicyAssignmentOptionsModel.version(), "1.0"); - assertEquals(updatePolicyAssignmentOptionsModel.ifMatch(), "testString"); - assertEquals(updatePolicyAssignmentOptionsModel.templateVersion(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdatePolicyAssignmentOptionsError() throws Throwable { - new UpdatePolicyAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java deleted file mode 100644 index de000e8c745..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdatePolicyStateOptions model. - */ -public class UpdatePolicyStateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdatePolicyStateOptions() throws Throwable { - UpdatePolicyStateOptions updatePolicyStateOptionsModel = new UpdatePolicyStateOptions.Builder() - .policyId("testString") - .ifMatch("testString") - .state("active") - .build(); - assertEquals(updatePolicyStateOptionsModel.policyId(), "testString"); - assertEquals(updatePolicyStateOptionsModel.ifMatch(), "testString"); - assertEquals(updatePolicyStateOptionsModel.state(), "active"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdatePolicyStateOptionsError() throws Throwable { - new UpdatePolicyStateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java deleted file mode 100644 index 879c3d5f456..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateRoleAssignmentOptions model. - */ -public class UpdateRoleAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdateRoleAssignmentOptions() throws Throwable { - UpdateRoleAssignmentOptions updateRoleAssignmentOptionsModel = new UpdateRoleAssignmentOptions.Builder() - .assignmentId("testString") - .ifMatch("testString") - .templateVersion("testString") - .build(); - assertEquals(updateRoleAssignmentOptionsModel.assignmentId(), "testString"); - assertEquals(updateRoleAssignmentOptionsModel.ifMatch(), "testString"); - assertEquals(updateRoleAssignmentOptionsModel.templateVersion(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateRoleAssignmentOptionsError() throws Throwable { - new UpdateRoleAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java deleted file mode 100644 index 1d69d016781..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateSettingsOptions model. - */ -public class UpdateSettingsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdateSettingsOptions() throws Throwable { - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - assertEquals(identityTypesBaseModel.state(), "enabled"); - assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); - - IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() - .user(identityTypesBaseModel) - .serviceId(identityTypesBaseModel) - .service(identityTypesBaseModel) - .build(); - assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); - - ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() - .identityTypes(identityTypesPatchModel) - .build(); - assertEquals(externalAccountIdentityInteractionPatchModel.identityTypes(), identityTypesPatchModel); - - UpdateSettingsOptions updateSettingsOptionsModel = new UpdateSettingsOptions.Builder() - .accountId("testString") - .ifMatch("testString") - .externalAccountIdentityInteraction(externalAccountIdentityInteractionPatchModel) - .acceptLanguage("default") - .build(); - assertEquals(updateSettingsOptionsModel.accountId(), "testString"); - assertEquals(updateSettingsOptionsModel.ifMatch(), "testString"); - assertEquals(updateSettingsOptionsModel.externalAccountIdentityInteraction(), externalAccountIdentityInteractionPatchModel); - assertEquals(updateSettingsOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateSettingsOptionsError() throws Throwable { - new UpdateSettingsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java deleted file mode 100644 index aff020c8985..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyCollection model. - */ -public class V2PolicyCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyCollection() throws Throwable { - V2PolicyCollection v2PolicyCollectionModel = new V2PolicyCollection(); - assertNull(v2PolicyCollectionModel.getLimit()); - assertNull(v2PolicyCollectionModel.getFirst()); - assertNull(v2PolicyCollectionModel.getNext()); - assertNull(v2PolicyCollectionModel.getPrevious()); - assertNull(v2PolicyCollectionModel.getPolicies()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java deleted file mode 100644 index 407eaadb155..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResourceAttribute model. - */ -public class V2PolicyResourceAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyResourceAttribute() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(v2PolicyResourceAttributeModel); - - V2PolicyResourceAttribute v2PolicyResourceAttributeModelNew = TestUtilities.deserialize(json, V2PolicyResourceAttribute.class); - assertTrue(v2PolicyResourceAttributeModelNew instanceof V2PolicyResourceAttribute); - assertEquals(v2PolicyResourceAttributeModelNew.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModelNew.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyResourceAttributeError() throws Throwable { - new V2PolicyResourceAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java deleted file mode 100644 index 97c9c813216..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResourceTag model. - */ -public class V2PolicyResourceTagTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyResourceTag() throws Throwable { - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - String json = TestUtilities.serialize(v2PolicyResourceTagModel); - - V2PolicyResourceTag v2PolicyResourceTagModelNew = TestUtilities.deserialize(json, V2PolicyResourceTag.class); - assertTrue(v2PolicyResourceTagModelNew instanceof V2PolicyResourceTag); - assertEquals(v2PolicyResourceTagModelNew.key(), "testString"); - assertEquals(v2PolicyResourceTagModelNew.value(), "testString"); - assertEquals(v2PolicyResourceTagModelNew.operator(), "stringEquals"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyResourceTagError() throws Throwable { - new V2PolicyResourceTag.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java deleted file mode 100644 index d153fd97be6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResource model. - */ -public class V2PolicyResourceTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyResource() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - String json = TestUtilities.serialize(v2PolicyResourceModel); - - V2PolicyResource v2PolicyResourceModelNew = TestUtilities.deserialize(json, V2PolicyResource.class); - assertTrue(v2PolicyResourceModelNew instanceof V2PolicyResource); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyResourceError() throws Throwable { - new V2PolicyResource.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java deleted file mode 100644 index 6d6da85f2b4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRuleRuleAttribute model. - */ -public class V2PolicyRuleRuleAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyRuleRuleAttribute() throws Throwable { - V2PolicyRuleRuleAttribute v2PolicyRuleRuleAttributeModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleRuleAttributeModel.key(), "testString"); - assertEquals(v2PolicyRuleRuleAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleRuleAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(v2PolicyRuleRuleAttributeModel); - - V2PolicyRuleRuleAttribute v2PolicyRuleRuleAttributeModelNew = TestUtilities.deserialize(json, V2PolicyRuleRuleAttribute.class); - assertTrue(v2PolicyRuleRuleAttributeModelNew instanceof V2PolicyRuleRuleAttribute); - assertEquals(v2PolicyRuleRuleAttributeModelNew.key(), "testString"); - assertEquals(v2PolicyRuleRuleAttributeModelNew.operator(), "stringEquals"); - assertEquals(v2PolicyRuleRuleAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyRuleRuleAttributeError() throws Throwable { - new V2PolicyRuleRuleAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java deleted file mode 100644 index fdf25669ef7..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleWithNestedConditions; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRuleRuleWithNestedConditions model. - */ -public class V2PolicyRuleRuleWithNestedConditionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyRuleRuleWithNestedConditions() throws Throwable { - NestedConditionRuleAttribute nestedConditionModel = new NestedConditionRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(nestedConditionModel.key(), "testString"); - assertEquals(nestedConditionModel.operator(), "stringEquals"); - assertEquals(nestedConditionModel.value(), "testString"); - - V2PolicyRuleRuleWithNestedConditions v2PolicyRuleRuleWithNestedConditionsModel = new V2PolicyRuleRuleWithNestedConditions.Builder() - .operator("and") - .conditions(java.util.Arrays.asList(nestedConditionModel)) - .build(); - assertEquals(v2PolicyRuleRuleWithNestedConditionsModel.operator(), "and"); - assertEquals(v2PolicyRuleRuleWithNestedConditionsModel.conditions(), java.util.Arrays.asList(nestedConditionModel)); - - String json = TestUtilities.serialize(v2PolicyRuleRuleWithNestedConditionsModel); - - V2PolicyRuleRuleWithNestedConditions v2PolicyRuleRuleWithNestedConditionsModelNew = TestUtilities.deserialize(json, V2PolicyRuleRuleWithNestedConditions.class); - assertTrue(v2PolicyRuleRuleWithNestedConditionsModelNew instanceof V2PolicyRuleRuleWithNestedConditions); - assertEquals(v2PolicyRuleRuleWithNestedConditionsModelNew.operator(), "and"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyRuleRuleWithNestedConditionsError() throws Throwable { - new V2PolicyRuleRuleWithNestedConditions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java deleted file mode 100644 index e0af599840c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRule; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRule model. - */ -public class V2PolicyRuleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testV2PolicyRule() throws Throwable { - V2PolicyRule v2PolicyRuleModel = new V2PolicyRule(); - assertNotNull(v2PolicyRuleModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java deleted file mode 100644 index a6e8f9d8922..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicySubjectAttribute model. - */ -public class V2PolicySubjectAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicySubjectAttribute() throws Throwable { - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(v2PolicySubjectAttributeModel); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModelNew = TestUtilities.deserialize(json, V2PolicySubjectAttribute.class); - assertTrue(v2PolicySubjectAttributeModelNew instanceof V2PolicySubjectAttribute); - assertEquals(v2PolicySubjectAttributeModelNew.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModelNew.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicySubjectAttributeError() throws Throwable { - new V2PolicySubjectAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java deleted file mode 100644 index 37adbaff5df..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicySubject model. - */ -public class V2PolicySubjectTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicySubject() throws Throwable { - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - String json = TestUtilities.serialize(v2PolicySubjectModel); - - V2PolicySubject v2PolicySubjectModelNew = TestUtilities.deserialize(json, V2PolicySubject.class); - assertTrue(v2PolicySubjectModelNew instanceof V2PolicySubject); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicySubjectError() throws Throwable { - new V2PolicySubject.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java deleted file mode 100644 index 2ffbe45575b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyTemplateMetaData model. - */ -public class V2PolicyTemplateMetaDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyTemplateMetaData() throws Throwable { - V2PolicyTemplateMetaData v2PolicyTemplateMetaDataModel = new V2PolicyTemplateMetaData(); - assertNull(v2PolicyTemplateMetaDataModel.getType()); - assertNull(v2PolicyTemplateMetaDataModel.getDescription()); - assertNull(v2PolicyTemplateMetaDataModel.getSubject()); - assertNull(v2PolicyTemplateMetaDataModel.getResource()); - assertNull(v2PolicyTemplateMetaDataModel.getPattern()); - assertNull(v2PolicyTemplateMetaDataModel.getRule()); - assertNull(v2PolicyTemplateMetaDataModel.getControl()); - assertNull(v2PolicyTemplateMetaDataModel.getState()); - assertNull(v2PolicyTemplateMetaDataModel.getLastPermitAt()); - assertNull(v2PolicyTemplateMetaDataModel.getLastPermitFrequency()); - assertNull(v2PolicyTemplateMetaDataModel.getTemplate()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java deleted file mode 100644 index 1630201062c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2Policy model. - */ -public class V2PolicyTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2Policy() throws Throwable { - V2Policy v2PolicyModel = new V2Policy(); - assertNull(v2PolicyModel.getType()); - assertNull(v2PolicyModel.getDescription()); - assertNull(v2PolicyModel.getSubject()); - assertNull(v2PolicyModel.getResource()); - assertNull(v2PolicyModel.getPattern()); - assertNull(v2PolicyModel.getRule()); - assertNull(v2PolicyModel.getControl()); - assertNull(v2PolicyModel.getState()); - assertNull(v2PolicyModel.getLastPermitAt()); - assertNull(v2PolicyModel.getLastPermitFrequency()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java deleted file mode 100644 index 04aaecc16ae..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * (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_policy_management.v1.utils; - -import java.util.Base64; -import java.util.Map; -import java.util.Set; -import java.util.List; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.io.InputStream; -import java.io.ByteArrayInputStream; - -import okhttp3.mockwebserver.RecordedRequest; -import okhttp3.HttpUrl; -import com.ibm.cloud.sdk.core.util.DateUtils; -import com.ibm.cloud.sdk.core.util.GsonSingleton; -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; - -/** - * A class used by the unit tests containing utility functions. - */ -public class TestUtilities { - public static Map createMockMap() { - Map mockMap = new HashMap<>(); - mockMap.put("foo", "bar"); - return mockMap; - } - - public static HashMap createMockStreamMap() { - return new HashMap() { - { put("key1", createMockStream("This is a mock file.")); } - }; - } - - public static Map parseQueryString(RecordedRequest req) { - Map queryMap = new HashMap<>(); - - try { - HttpUrl requestUrl = req.getRequestUrl(); - - if (requestUrl != null) { - Set queryParamsNames = requestUrl.queryParameterNames(); - // map the parameter name to its corresponding value - for (String p : queryParamsNames) { - // get the corresponding value for the parameter (p) - List val = requestUrl.queryParameterValues(p); - if (val != null && !val.isEmpty()) { - String joinedQuery = String.join(",", val); - queryMap.put(p, joinedQuery); - } - } - } - if (queryMap.isEmpty()) { - return null; - } - } catch (Exception e) { - return null; - } - - return queryMap; - } - - public static String parseReqPath(RecordedRequest req) { - String parsedPath = null; - - try { - String fullPath = req.getPath(); - if (fullPath != null && !fullPath.isEmpty()) { - // retrieve the path segment before the query parameter - parsedPath = fullPath.split("\\?", 2)[0]; - } - if (parsedPath.isEmpty() || parsedPath == null) { - return null; - } - - } catch (Exception e) { - return null; - } - - return parsedPath; - } - - public static String serialize(Object obj) { - return GsonSingleton.getGson().toJson(obj); - } - - public static T deserialize(String json, Class clazz) { - return GsonSingleton.getGson().fromJson(json, clazz); - } - - public static InputStream createMockStream(String s) { - return new ByteArrayInputStream(s.getBytes()); - } - - public static List creatMockListFileWithMetadata() { - List list = new ArrayList(); - byte[] fileBytes = {(byte) 0xde, (byte) 0xad, (byte) 0xbe, (byte) 0xef}; - InputStream inputStream = new ByteArrayInputStream(fileBytes); - FileWithMetadata.Builder builder = new FileWithMetadata.Builder(); - builder.data(inputStream); - FileWithMetadata fileWithMetadata = builder.build(); - list.add(fileWithMetadata); - - return list; - } - - public static byte[] createMockByteArray(String encodedString) throws Exception { - return Base64.getDecoder().decode(encodedString); - } - - public static Date createMockDate(String date) throws Exception { - return DateUtils.parseAsDate(date); - } - - public static Date createMockDateTime(String date) throws Exception { - return DateUtils.parseAsDateTime(date); - } -} \ No newline at end of file From c574da32060340e54dd873e373f1d6ac981fba6d Mon Sep 17 00:00:00 2001 From: Bhavana Bellamgari Date: Wed, 10 Dec 2025 15:31:53 +0530 Subject: [PATCH 12/13] Updated template grant schema Signed-off-by: Bhavana Bellamgari Signed-off-by: Bhavana Bellamgari --- .../v1/IamPolicyManagement.java | 2566 +++++++++ .../AccountSettingsAccessManagement.java | 40 + .../v1/model/ActionControlAssignment.java | 207 + .../ActionControlAssignmentCollection.java | 88 + .../ActionControlAssignmentResource.java | 52 + ...ontrolAssignmentResourceActionControl.java | 53 + ...ctionControlAssignmentResourceCreated.java | 38 + .../ActionControlAssignmentTemplate.java | 134 + .../model/ActionControlAssignmentsPager.java | 108 + .../v1/model/ActionControlTemplate.java | 203 + .../ActionControlTemplateCollection.java | 90 + ...tionControlTemplateVersionsCollection.java | 88 + .../ActionControlTemplateVersionsPager.java | 108 + .../v1/model/ActionControlTemplatesPager.java | 108 + .../v1/model/AssignmentResourceCreated.java | 38 + .../v1/model/AssignmentResourceError.java | 88 + .../v1/model/AssignmentTargetDetails.java | 142 + .../v1/model/AssignmentTemplateDetails.java | 119 + .../CommitActionControlTemplateOptions.java | 134 + .../v1/model/CommitPolicyTemplateOptions.java | 134 + .../v1/model/CommitRoleTemplateOptions.java | 134 + .../v1/model/ConflictsWith.java | 62 + .../v1/model/Control.java | 104 + .../v1/model/ControlResponse.java | 42 + .../v1/model/ControlResponseControl.java | 24 + ...ntrolResponseControlWithEnrichedRoles.java | 24 + ...ctionControlTemplateAssignmentOptions.java | 191 + .../CreateActionControlTemplateOptions.java | 251 + ...teActionControlTemplateVersionOptions.java | 211 + .../v1/model/CreatePolicyOptions.java | 311 + ...CreatePolicyTemplateAssignmentOptions.java | 221 + .../v1/model/CreatePolicyTemplateOptions.java | 255 + .../CreatePolicyTemplateVersionOptions.java | 214 + .../v1/model/CreateRoleOptions.java | 308 + .../CreateRoleTemplateAssignmentOptions.java | 191 + .../v1/model/CreateRoleTemplateOptions.java | 251 + .../CreateRoleTemplateVersionOptions.java | 211 + .../v1/model/CreateV2PolicyOptions.java | 312 + .../v1/model/CustomRole.java | 195 + .../DeleteActionControlAssignmentOptions.java | 104 + .../DeleteActionControlTemplateOptions.java | 104 + ...teActionControlTemplateVersionOptions.java | 134 + .../model/DeletePolicyAssignmentOptions.java | 104 + .../v1/model/DeletePolicyOptions.java | 104 + .../v1/model/DeletePolicyTemplateOptions.java | 104 + .../DeletePolicyTemplateVersionOptions.java | 134 + .../v1/model/DeleteRoleAssignmentOptions.java | 104 + .../v1/model/DeleteRoleOptions.java | 104 + .../v1/model/DeleteRoleTemplateOptions.java | 104 + .../DeleteRoleTemplateVersionOptions.java | 134 + .../v1/model/DeleteV2PolicyOptions.java | 104 + .../v1/model/EnrichedRoles.java | 81 + .../v1/model/ErrorDetails.java | 40 + .../v1/model/ErrorObject.java | 128 + .../ExternalAccountIdentityInteraction.java | 40 + ...ternalAccountIdentityInteractionPatch.java | 95 + .../iam_policy_management/v1/model/First.java | 38 + .../GetActionControlAssignmentOptions.java | 104 + .../GetActionControlTemplateOptions.java | 140 + ...etActionControlTemplateVersionOptions.java | 134 + .../v1/model/GetPolicyAssignmentOptions.java | 134 + .../v1/model/GetPolicyOptions.java | 104 + .../v1/model/GetPolicyTemplateOptions.java | 140 + .../GetPolicyTemplateVersionOptions.java | 134 + .../v1/model/GetRoleAssignmentOptions.java | 104 + .../v1/model/GetRoleOptions.java | 104 + .../v1/model/GetRoleTemplateOptions.java | 140 + .../model/GetRoleTemplateVersionOptions.java | 134 + .../v1/model/GetSettingsOptions.java | 141 + .../v1/model/GetV2PolicyOptions.java | 148 + .../iam_policy_management/v1/model/Grant.java | 124 + .../v1/model/GrantWithEnrichedRoles.java | 40 + .../v1/model/IdentityTypes.java | 64 + .../v1/model/IdentityTypesBase.java | 168 + .../v1/model/IdentityTypesPatch.java | 147 + .../v1/model/LimitData.java | 50 + .../ListActionControlAssignmentsOptions.java | 245 + ...tActionControlTemplateVersionsOptions.java | 192 + .../ListActionControlTemplatesOptions.java | 193 + .../v1/model/ListPoliciesOptions.java | 501 ++ .../model/ListPolicyAssignmentsOptions.java | 275 + .../ListPolicyTemplateVersionsOptions.java | 192 + .../v1/model/ListPolicyTemplatesOptions.java | 379 ++ .../v1/model/ListRoleAssignmentsOptions.java | 245 + .../ListRoleTemplateVersionsOptions.java | 192 + .../v1/model/ListRoleTemplatesOptions.java | 307 + .../v1/model/ListRolesOptions.java | 234 + .../v1/model/ListV2PoliciesOptions.java | 492 ++ .../v1/model/NestedCondition.java | 126 + .../model/NestedConditionRuleAttribute.java | 170 + .../NestedConditionRuleWithConditions.java | 139 + .../iam_policy_management/v1/model/Next.java | 50 + .../v1/model/PoliciesPager.java | 108 + .../v1/model/Policy.java | 188 + .../model/PolicyAssignmentResourcePolicy.java | 65 + .../v1/model/PolicyAssignmentResources.java | 50 + .../v1/model/PolicyAssignmentV1.java | 193 + .../model/PolicyAssignmentV1Collection.java | 88 + .../v1/model/PolicyAssignmentV1Resources.java | 50 + .../v1/model/PolicyAssignmentV1Subject.java | 60 + .../v1/model/PolicyAssignmentsPager.java | 108 + .../v1/model/PolicyCollection.java | 88 + .../v1/model/PolicyResource.java | 167 + .../v1/model/PolicyRole.java | 131 + .../v1/model/PolicySubject.java | 124 + .../v1/model/PolicyTemplate.java | 202 + .../PolicyTemplateAssignmentCollection.java | 88 + .../model/PolicyTemplateAssignmentItems.java | 261 + ...mplateAssignmentItemsPolicyAssignment.java | 50 + ...lateAssignmentItemsPolicyAssignmentV1.java | 38 + .../v1/model/PolicyTemplateCollection.java | 90 + .../v1/model/PolicyTemplateLimitData.java | 214 + .../v1/model/PolicyTemplateMetaData.java | 201 + .../PolicyTemplateVersionsCollection.java | 88 + .../v1/model/PolicyTemplateVersionsPager.java | 108 + .../v1/model/PolicyTemplatesPager.java | 108 + .../v1/model/Previous.java | 50 + .../ReplaceActionControlTemplateOptions.java | 273 + .../v1/model/ReplacePolicyOptions.java | 335 ++ .../model/ReplacePolicyTemplateOptions.java | 276 + .../v1/model/ReplaceRoleOptions.java | 255 + .../v1/model/ReplaceRoleTemplateOptions.java | 273 + .../v1/model/ReplaceV2PolicyOptions.java | 336 ++ .../v1/model/ResourceAttribute.java | 160 + .../v1/model/ResourceTag.java | 160 + .../iam_policy_management/v1/model/Role.java | 196 + .../v1/model/RoleAction.java | 64 + .../v1/model/RoleAssignment.java | 207 + .../v1/model/RoleAssignmentCollection.java | 88 + .../v1/model/RoleAssignmentResource.java | 50 + .../model/RoleAssignmentResourceCreated.java | 38 + .../v1/model/RoleAssignmentResourceRole.java | 53 + .../v1/model/RoleAssignmentTemplate.java | 134 + .../v1/model/RoleAssignmentsPager.java | 108 + .../v1/model/RoleCollection.java | 68 + .../v1/model/RoleTemplate.java | 202 + .../v1/model/RoleTemplateCollection.java | 90 + .../v1/model/RoleTemplatePrototypeRole.java | 239 + .../v1/model/RoleTemplateReferencesItem.java | 134 + .../model/RoleTemplateVersionsCollection.java | 88 + .../v1/model/RoleTemplateVersionsPager.java | 108 + .../v1/model/RoleTemplatesPager.java | 108 + .../iam_policy_management/v1/model/Roles.java | 106 + .../v1/model/RuleAttribute.java | 209 + .../v1/model/SubjectAttribute.java | 134 + .../v1/model/TemplateActionControl.java | 182 + .../v1/model/TemplateControl.java | 104 + .../v1/model/TemplateCountData.java | 50 + .../v1/model/TemplateGrant.java | 58 + .../v1/model/TemplateGrantRoleReferences.java | 110 + .../v1/model/TemplateGrantRoles.java | 110 + .../v1/model/TemplateMetadata.java | 91 + .../v1/model/TemplatePolicy.java | 272 + .../v1/model/TemplateRole.java | 209 + .../UpdateActionControlAssignmentOptions.java | 166 + .../model/UpdatePolicyAssignmentOptions.java | 196 + .../v1/model/UpdatePolicyStateOptions.java | 171 + .../v1/model/UpdateRoleAssignmentOptions.java | 166 + .../v1/model/UpdateSettingsOptions.java | 199 + .../v1/model/V2PoliciesPager.java | 108 + .../v1/model/V2Policy.java | 247 + .../v1/model/V2PolicyCollection.java | 88 + .../v1/model/V2PolicyResource.java | 167 + .../v1/model/V2PolicyResourceAttribute.java | 181 + .../v1/model/V2PolicyResourceTag.java | 174 + .../v1/model/V2PolicyRule.java | 126 + .../v1/model/V2PolicyRuleRuleAttribute.java | 170 + .../V2PolicyRuleRuleWithNestedConditions.java | 139 + .../v1/model/V2PolicySubject.java | 124 + .../v1/model/V2PolicySubjectAttribute.java | 175 + .../v1/model/V2PolicyTemplateMetaData.java | 260 + .../v1/package-info.java | 17 + .../v1/IamPolicyManagementTest.java | 5007 +++++++++++++++++ .../AccountSettingsAccessManagementTest.java | 40 + ...ActionControlAssignmentCollectionTest.java | 47 + ...olAssignmentResourceActionControlTest.java | 43 + ...nControlAssignmentResourceCreatedTest.java | 37 + .../ActionControlAssignmentResourceTest.java | 45 + .../ActionControlAssignmentTemplateTest.java | 54 + .../v1/model/ActionControlAssignmentTest.java | 40 + .../ActionControlTemplateCollectionTest.java | 46 + .../v1/model/ActionControlTemplateTest.java | 44 + ...ControlTemplateVersionsCollectionTest.java | 46 + .../model/AssignmentResourceCreatedTest.java | 37 + .../v1/model/AssignmentResourceErrorTest.java | 44 + .../v1/model/AssignmentTargetDetailsTest.java | 54 + .../model/AssignmentTemplateDetailsTest.java | 48 + ...ommitActionControlTemplateOptionsTest.java | 47 + .../CommitPolicyTemplateOptionsTest.java | 47 + .../model/CommitRoleTemplateOptionsTest.java | 47 + .../v1/model/ConflictsWithTest.java | 39 + .../v1/model/ControlResponseControlTest.java | 39 + ...lResponseControlWithEnrichedRolesTest.java | 40 + .../v1/model/ControlResponseTest.java | 40 + .../v1/model/ControlTest.java | 63 + ...nControlTemplateAssignmentOptionsTest.java | 65 + ...reateActionControlTemplateOptionsTest.java | 65 + ...tionControlTemplateVersionOptionsTest.java | 63 + .../v1/model/CreatePolicyOptionsTest.java | 103 + ...tePolicyTemplateAssignmentOptionsTest.java | 67 + .../CreatePolicyTemplateOptionsTest.java | 145 + ...reatePolicyTemplateVersionOptionsTest.java | 143 + .../v1/model/CreateRoleOptionsTest.java | 57 + ...eateRoleTemplateAssignmentOptionsTest.java | 65 + .../model/CreateRoleTemplateOptionsTest.java | 69 + .../CreateRoleTemplateVersionOptionsTest.java | 65 + .../v1/model/CreateV2PolicyOptionsTest.java | 131 + .../v1/model/CustomRoleTest.java | 42 + ...eteActionControlAssignmentOptionsTest.java | 45 + ...eleteActionControlTemplateOptionsTest.java | 45 + ...tionControlTemplateVersionOptionsTest.java | 47 + .../DeletePolicyAssignmentOptionsTest.java | 45 + .../v1/model/DeletePolicyOptionsTest.java | 45 + .../DeletePolicyTemplateOptionsTest.java | 45 + ...eletePolicyTemplateVersionOptionsTest.java | 47 + .../DeleteRoleAssignmentOptionsTest.java | 45 + .../v1/model/DeleteRoleOptionsTest.java | 45 + .../model/DeleteRoleTemplateOptionsTest.java | 45 + .../DeleteRoleTemplateVersionOptionsTest.java | 47 + .../v1/model/DeleteV2PolicyOptionsTest.java | 45 + .../v1/model/EnrichedRolesTest.java | 39 + .../v1/model/ErrorDetailsTest.java | 38 + .../v1/model/ErrorObjectTest.java | 42 + ...alAccountIdentityInteractionPatchTest.java | 63 + ...xternalAccountIdentityInteractionTest.java | 39 + .../v1/model/FirstTest.java | 36 + ...GetActionControlAssignmentOptionsTest.java | 45 + .../GetActionControlTemplateOptionsTest.java | 47 + ...tionControlTemplateVersionOptionsTest.java | 47 + .../model/GetPolicyAssignmentOptionsTest.java | 47 + .../v1/model/GetPolicyOptionsTest.java | 45 + .../model/GetPolicyTemplateOptionsTest.java | 47 + .../GetPolicyTemplateVersionOptionsTest.java | 47 + .../model/GetRoleAssignmentOptionsTest.java | 45 + .../v1/model/GetRoleOptionsTest.java | 45 + .../v1/model/GetRoleTemplateOptionsTest.java | 47 + .../GetRoleTemplateVersionOptionsTest.java | 47 + .../v1/model/GetSettingsOptionsTest.java | 47 + .../v1/model/GetV2PolicyOptionsTest.java | 47 + .../v1/model/GrantTest.java | 56 + .../v1/model/GrantWithEnrichedRolesTest.java | 39 + .../v1/model/IdentityTypesBaseTest.java | 53 + .../v1/model/IdentityTypesPatchTest.java | 59 + .../v1/model/IdentityTypesTest.java | 40 + .../v1/model/LimitDataTest.java | 36 + ...stActionControlAssignmentsOptionsTest.java | 55 + ...ionControlTemplateVersionsOptionsTest.java | 51 + ...ListActionControlTemplatesOptionsTest.java | 51 + .../v1/model/ListPoliciesOptionsTest.java | 69 + .../ListPolicyAssignmentsOptionsTest.java | 57 + ...ListPolicyTemplateVersionsOptionsTest.java | 51 + .../model/ListPolicyTemplatesOptionsTest.java | 63 + .../model/ListRoleAssignmentsOptionsTest.java | 55 + .../ListRoleTemplateVersionsOptionsTest.java | 51 + .../model/ListRoleTemplatesOptionsTest.java | 59 + .../v1/model/ListRolesOptionsTest.java | 49 + .../v1/model/ListV2PoliciesOptionsTest.java | 69 + .../NestedConditionRuleAttributeTest.java | 57 + ...NestedConditionRuleWithConditionsTest.java | 63 + .../v1/model/NestedConditionTest.java | 38 + .../v1/model/NextTest.java | 37 + .../PolicyAssignmentResourcePolicyTest.java | 44 + .../model/PolicyAssignmentResourcesTest.java | 44 + .../PolicyAssignmentV1CollectionTest.java | 55 + .../PolicyAssignmentV1ResourcesTest.java | 45 + .../model/PolicyAssignmentV1SubjectTest.java | 36 + .../v1/model/PolicyAssignmentV1Test.java | 51 + .../v1/model/PolicyCollectionTest.java | 52 + .../v1/model/PolicyResourceTest.java | 72 + .../v1/model/PolicyRoleTest.java | 51 + .../v1/model/PolicySubjectTest.java | 58 + ...olicyTemplateAssignmentCollectionTest.java | 55 + ...teAssignmentItemsPolicyAssignmentTest.java | 50 + ...AssignmentItemsPolicyAssignmentV1Test.java | 51 + .../PolicyTemplateAssignmentItemsTest.java | 48 + .../model/PolicyTemplateCollectionTest.java | 55 + .../v1/model/PolicyTemplateLimitDataTest.java | 56 + .../v1/model/PolicyTemplateMetaDataTest.java | 50 + .../v1/model/PolicyTemplateTest.java | 53 + .../PolicyTemplateVersionsCollectionTest.java | 55 + .../v1/model/PolicyTest.java | 48 + .../v1/model/PreviousTest.java | 37 + ...placeActionControlTemplateOptionsTest.java | 67 + .../v1/model/ReplacePolicyOptionsTest.java | 105 + .../ReplacePolicyTemplateOptionsTest.java | 147 + .../v1/model/ReplaceRoleOptionsTest.java | 53 + .../model/ReplaceRoleTemplateOptionsTest.java | 69 + .../v1/model/ReplaceV2PolicyOptionsTest.java | 133 + .../v1/model/ResourceAttributeTest.java | 57 + .../v1/model/ResourceTagTest.java | 57 + .../v1/model/RoleActionTest.java | 39 + .../model/RoleAssignmentCollectionTest.java | 47 + .../RoleAssignmentResourceCreatedTest.java | 37 + .../model/RoleAssignmentResourceRoleTest.java | 43 + .../v1/model/RoleAssignmentResourceTest.java | 45 + .../v1/model/RoleAssignmentTemplateTest.java | 54 + .../v1/model/RoleAssignmentTest.java | 40 + .../v1/model/RoleCollectionTest.java | 41 + .../v1/model/RoleTemplateCollectionTest.java | 46 + .../model/RoleTemplatePrototypeRoleTest.java | 62 + .../model/RoleTemplateReferencesItemTest.java | 54 + .../v1/model/RoleTemplateTest.java | 44 + .../RoleTemplateVersionsCollectionTest.java | 46 + .../v1/model/RoleTest.java | 56 + .../v1/model/RolesTest.java | 51 + .../v1/model/RuleAttributeTest.java | 57 + .../v1/model/SubjectAttributeTest.java | 54 + .../v1/model/TemplateActionControlTest.java | 56 + .../v1/model/TemplateControlTest.java | 63 + .../v1/model/TemplateCountDataTest.java | 39 + .../TemplateGrantRoleReferencesTest.java | 58 + .../v1/model/TemplateGrantRolesTest.java | 56 + .../v1/model/TemplateGrantTest.java | 39 + .../v1/model/TemplateMetadataTest.java | 41 + .../v1/model/TemplatePolicyTest.java | 141 + .../v1/model/TemplateRoleTest.java | 59 + ...ateActionControlAssignmentOptionsTest.java | 49 + .../UpdatePolicyAssignmentOptionsTest.java | 51 + .../model/UpdatePolicyStateOptionsTest.java | 49 + .../UpdateRoleAssignmentOptionsTest.java | 49 + .../v1/model/UpdateSettingsOptionsTest.java | 75 + .../v1/model/V2PolicyCollectionTest.java | 55 + .../model/V2PolicyResourceAttributeTest.java | 57 + .../v1/model/V2PolicyResourceTagTest.java | 57 + .../v1/model/V2PolicyResourceTest.java | 72 + .../model/V2PolicyRuleRuleAttributeTest.java | 57 + ...olicyRuleRuleWithNestedConditionsTest.java | 63 + .../v1/model/V2PolicyRuleTest.java | 38 + .../model/V2PolicySubjectAttributeTest.java | 57 + .../v1/model/V2PolicySubjectTest.java | 60 + .../model/V2PolicyTemplateMetaDataTest.java | 57 + .../v1/model/V2PolicyTest.java | 55 + .../v1/utils/TestUtilities.java | 131 + 333 files changed, 41258 insertions(+) create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java create mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java create mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java new file mode 100644 index 00000000000..2abe3baea4e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java @@ -0,0 +1,2566 @@ +/* + * (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. + */ + +/* + * IBM OpenAPI SDK Code Generator Version: 3.107.1-41b0fbd0-20250825-080732 + */ + +package com.ibm.cloud.platform_services.iam_policy_management.v1; + +import com.google.gson.JsonObject; +import com.ibm.cloud.platform_services.common.SdkCommon; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; +import com.ibm.cloud.sdk.core.http.RequestBuilder; +import com.ibm.cloud.sdk.core.http.ResponseConverter; +import com.ibm.cloud.sdk.core.http.ServiceCall; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.ConfigBasedAuthenticatorFactory; +import com.ibm.cloud.sdk.core.service.BaseService; +import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; + +/** + * IAM Policy Management API. + * + * API Version: 1.0.1 + */ +public class IamPolicyManagement extends BaseService { + + /** + * Default service name used when configuring the `IamPolicyManagement` client. + */ + public static final String DEFAULT_SERVICE_NAME = "iam_policy_management"; + + /** + * Default service endpoint URL. + */ + public static final String DEFAULT_SERVICE_URL = "https://iam.cloud.ibm.com"; + + /** + * Class method which constructs an instance of the `IamPolicyManagement` client. + * The default service name is used to configure the client instance. + * + * @return an instance of the `IamPolicyManagement` client using external configuration + */ + public static IamPolicyManagement newInstance() { + return newInstance(DEFAULT_SERVICE_NAME); + } + + /** + * Class method which constructs an instance of the `IamPolicyManagement` client. + * The specified service name is used to configure the client instance. + * + * @param serviceName the service name to be used when configuring the client instance + * @return an instance of the `IamPolicyManagement` client using external configuration + */ + public static IamPolicyManagement newInstance(String serviceName) { + Authenticator authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(serviceName); + IamPolicyManagement service = new IamPolicyManagement(serviceName, authenticator); + service.configureService(serviceName); + return service; + } + + /** + * Constructs an instance of the `IamPolicyManagement` client. + * The specified service name and authenticator are used to configure the client instance. + * + * @param serviceName the service name to be used when configuring the client instance + * @param authenticator the {@link Authenticator} instance to be configured for this client + */ + public IamPolicyManagement(String serviceName, Authenticator authenticator) { + super(serviceName, authenticator); + setServiceUrl(DEFAULT_SERVICE_URL); + } + + /** + * Get policies by attributes. + * + * Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account + * and filter by attribute values. This can be done through query parameters. The following attributes are supported: + * account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query + * parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If + * the caller does not have read access to any policies an empty array is returned. + * + * @param listPoliciesOptions the {@link ListPoliciesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyCollection} + */ + public ServiceCall listPolicies(ListPoliciesOptions listPoliciesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listPoliciesOptions, + "listPoliciesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicies"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listPoliciesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listPoliciesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listPoliciesOptions.accountId())); + if (listPoliciesOptions.iamId() != null) { + builder.query("iam_id", String.valueOf(listPoliciesOptions.iamId())); + } + if (listPoliciesOptions.accessGroupId() != null) { + builder.query("access_group_id", String.valueOf(listPoliciesOptions.accessGroupId())); + } + if (listPoliciesOptions.type() != null) { + builder.query("type", String.valueOf(listPoliciesOptions.type())); + } + if (listPoliciesOptions.serviceType() != null) { + builder.query("service_type", String.valueOf(listPoliciesOptions.serviceType())); + } + if (listPoliciesOptions.tagName() != null) { + builder.query("tag_name", String.valueOf(listPoliciesOptions.tagName())); + } + if (listPoliciesOptions.tagValue() != null) { + builder.query("tag_value", String.valueOf(listPoliciesOptions.tagValue())); + } + if (listPoliciesOptions.sort() != null) { + builder.query("sort", String.valueOf(listPoliciesOptions.sort())); + } + if (listPoliciesOptions.format() != null) { + builder.query("format", String.valueOf(listPoliciesOptions.format())); + } + if (listPoliciesOptions.state() != null) { + builder.query("state", String.valueOf(listPoliciesOptions.state())); + } + if (listPoliciesOptions.limit() != null) { + builder.query("limit", String.valueOf(listPoliciesOptions.limit())); + } + if (listPoliciesOptions.start() != null) { + builder.query("start", String.valueOf(listPoliciesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a policy. + * + * Creates a policy to grant access between a subject and a resource. There are two types of policies: **access** and + * **authorization**. A policy administrator might want to create an access policy which grants access to a user, + * service-id, or an access group. They might also want to create an authorization policy and setup access between + * services. + * + * ### Access + * + * To create an access policy, use **`"type": "access"`** in the body. The possible subject attributes are + * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or + * service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. Assign roles + * that are supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or + * **`service_group_id`** attribute and the **`accountId`** attribute. The IAM Services group (`IAM`) is a subset of + * account management services that includes the IAM platform services IAM Identity, IAM Access Management, IAM Users + * Management, IAM Groups, and future IAM services. If the subject is a locked service-id, the request will fail. + * + * ### Authorization + * + * Authorization policies are supported by services on a case by case basis. Refer to service documentation to verify + * their support of authorization policies. To create an authorization policy, use **`"type": "authorization"`** in + * the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject + * attributes might be provided. The following attributes are supported: + * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are + * supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access + * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject + * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. + * + * ### Attribute Operators + * + * Currently, only the `stringEquals` and the `stringMatch` operators are available. Resource attributes may support + * one or both operators. For more information, see [Assigning access by using wildcard + * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). + * + * ### Attribute Validations + * + * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like + * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated + * against Global Catalog locations. + * + * @param createPolicyOptions the {@link CreatePolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Policy} + */ + public ServiceCall createPolicy(CreatePolicyOptions createPolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyOptions, + "createPolicyOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createPolicyOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createPolicyOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("type", createPolicyOptions.type()); + contentJson.add("subjects", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.subjects())); + contentJson.add("roles", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.roles())); + contentJson.add("resources", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.resources())); + if (createPolicyOptions.description() != null) { + contentJson.addProperty("description", createPolicyOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a policy. + * + * Update a policy to grant access between a subject and a resource. A policy administrator might want to update an + * existing policy. The policy type cannot be changed (You cannot change an access policy to an authorization policy). + * + * ### Access + * + * To update an access policy, use **`"type": "access"`** in the body. The possible subject attributes are + * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or + * service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. Assign roles + * that are supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * The policy resource must include either the **`serviceType`**, **`serviceName`**, or **`resourceGroupId`** + * attribute and the **`accountId`** attribute.` If the subject is a locked service-id, the request will fail. + * + * ### Authorization + * + * To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match + * the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following + * attributes are supported: + * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are + * supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access + * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject + * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. + * + * ### Attribute Operators + * + * Currently, only the `stringEquals` and the `stringMatch` operators are available. Resource attributes might support + * one or both operators. For more information, see [Assigning access by using wildcard + * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). + * + * ### Attribute Validations + * + * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like + * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated + * against Global Catalog locations. + * + * @param replacePolicyOptions the {@link ReplacePolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Policy} + */ + public ServiceCall replacePolicy(ReplacePolicyOptions replacePolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replacePolicyOptions, + "replacePolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_id", replacePolicyOptions.policyId()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replacePolicy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replacePolicyOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("type", replacePolicyOptions.type()); + contentJson.add("subjects", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.subjects())); + contentJson.add("roles", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.roles())); + contentJson.add("resources", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.resources())); + if (replacePolicyOptions.description() != null) { + contentJson.addProperty("description", replacePolicyOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a policy by ID. + * + * Retrieve a policy by providing a policy ID. + * + * @param getPolicyOptions the {@link GetPolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateMetaData} + */ + public ServiceCall getPolicy(GetPolicyOptions getPolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyOptions, + "getPolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_id", getPolicyOptions.policyId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicy"); + 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); + } + + /** + * Delete a policy by ID. + * + * Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service + * ID. If the subject of the policy is a locked service-id, the request will fail. + * + * @param deletePolicyOptions the {@link DeletePolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deletePolicy(DeletePolicyOptions deletePolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyOptions, + "deletePolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_id", deletePolicyOptions.policyId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Restore a deleted policy by ID. + * + * Restore a policy that has recently been deleted. A policy administrator might want to restore a deleted policy. To + * restore a policy, use **`"state": "active"`** in the body. + * + * @param updatePolicyStateOptions the {@link UpdatePolicyStateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Policy} + */ + public ServiceCall updatePolicyState(UpdatePolicyStateOptions updatePolicyStateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updatePolicyStateOptions, + "updatePolicyStateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_id", updatePolicyStateOptions.policyId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updatePolicyState"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updatePolicyStateOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + if (updatePolicyStateOptions.state() != null) { + contentJson.addProperty("state", updatePolicyStateOptions.state()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get roles by filters. + * + * Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can + * be done through query parameters. Currently, we only support the following attributes: account_id, service_name, + * service_group_id, source_service_name and policy_type. Both service_name and service_group_id attributes are + * mutually exclusive. Only roles that match the filter and that the caller has read access to are returned. If the + * caller does not have read access to any roles an empty array is returned. + * + * @param listRolesOptions the {@link ListRolesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleCollection} + */ + public ServiceCall listRoles(ListRolesOptions listRolesOptions) { + if (listRolesOptions == null) { + listRolesOptions = new ListRolesOptions.Builder().build(); + } + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoles"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listRolesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listRolesOptions.acceptLanguage()); + } + if (listRolesOptions.accountId() != null) { + builder.query("account_id", String.valueOf(listRolesOptions.accountId())); + } + if (listRolesOptions.serviceName() != null) { + builder.query("service_name", String.valueOf(listRolesOptions.serviceName())); + } + if (listRolesOptions.sourceServiceName() != null) { + builder.query("source_service_name", String.valueOf(listRolesOptions.sourceServiceName())); + } + if (listRolesOptions.policyType() != null) { + builder.query("policy_type", String.valueOf(listRolesOptions.policyType())); + } + if (listRolesOptions.serviceGroupId() != null) { + builder.query("service_group_id", String.valueOf(listRolesOptions.serviceGroupId())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get roles by filters. + * + * Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can + * be done through query parameters. Currently, we only support the following attributes: account_id, service_name, + * service_group_id, source_service_name and policy_type. Both service_name and service_group_id attributes are + * mutually exclusive. Only roles that match the filter and that the caller has read access to are returned. If the + * caller does not have read access to any roles an empty array is returned. + * + * @return a {@link ServiceCall} with a result of type {@link RoleCollection} + */ + public ServiceCall listRoles() { + return listRoles(null); + } + + /** + * Create a role. + * + * Creates a custom role for a specific service within the account. An account owner or a user assigned the + * Administrator role on the Role management service can create a custom role. Any number of actions for a single + * service can be mapped to the new role, but there must be at least one service-defined action to successfully create + * the new role. + * + * @param createRoleOptions the {@link CreateRoleOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link CustomRole} + */ + public ServiceCall createRole(CreateRoleOptions createRoleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleOptions, + "createRoleOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRole"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createRoleOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createRoleOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("display_name", createRoleOptions.displayName()); + contentJson.add("actions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleOptions.actions())); + contentJson.addProperty("name", createRoleOptions.name()); + contentJson.addProperty("account_id", createRoleOptions.accountId()); + contentJson.addProperty("service_name", createRoleOptions.serviceName()); + if (createRoleOptions.description() != null) { + contentJson.addProperty("description", createRoleOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a role. + * + * Update a custom role. A role administrator might want to update an existing role by updating the display name, + * description, or the actions that are mapped to the role. The name, account_id, and service_name can't be changed. + * + * @param replaceRoleOptions the {@link ReplaceRoleOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link CustomRole} + */ + public ServiceCall replaceRole(ReplaceRoleOptions replaceRoleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceRoleOptions, + "replaceRoleOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_id", replaceRoleOptions.roleId()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceRole"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replaceRoleOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("display_name", replaceRoleOptions.displayName()); + contentJson.add("actions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRoleOptions.actions())); + if (replaceRoleOptions.description() != null) { + contentJson.addProperty("description", replaceRoleOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a role by ID. + * + * Retrieve a role by providing a role ID. + * + * @param getRoleOptions the {@link GetRoleOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link CustomRole} + */ + public ServiceCall getRole(GetRoleOptions getRoleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleOptions, + "getRoleOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_id", getRoleOptions.roleId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRole"); + 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); + } + + /** + * Delete a role by ID. + * + * Delete a role by providing a role ID. + * + * @param deleteRoleOptions the {@link DeleteRoleOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteRole(DeleteRoleOptions deleteRoleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleOptions, + "deleteRoleOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_id", deleteRoleOptions.roleId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRole"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get policies by attributes. + * + * Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account + * and filter by attribute values. This can be done through query parameters. The following attributes are supported: + * account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query + * parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If + * the caller does not have read access to any policies an empty array is returned. + * + * @param listV2PoliciesOptions the {@link ListV2PoliciesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link V2PolicyCollection} + */ + public ServiceCall listV2Policies(ListV2PoliciesOptions listV2PoliciesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listV2PoliciesOptions, + "listV2PoliciesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listV2Policies"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listV2PoliciesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listV2PoliciesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listV2PoliciesOptions.accountId())); + if (listV2PoliciesOptions.iamId() != null) { + builder.query("iam_id", String.valueOf(listV2PoliciesOptions.iamId())); + } + if (listV2PoliciesOptions.accessGroupId() != null) { + builder.query("access_group_id", String.valueOf(listV2PoliciesOptions.accessGroupId())); + } + if (listV2PoliciesOptions.type() != null) { + builder.query("type", String.valueOf(listV2PoliciesOptions.type())); + } + if (listV2PoliciesOptions.serviceType() != null) { + builder.query("service_type", String.valueOf(listV2PoliciesOptions.serviceType())); + } + if (listV2PoliciesOptions.serviceName() != null) { + builder.query("service_name", String.valueOf(listV2PoliciesOptions.serviceName())); + } + if (listV2PoliciesOptions.serviceGroupId() != null) { + builder.query("service_group_id", String.valueOf(listV2PoliciesOptions.serviceGroupId())); + } + if (listV2PoliciesOptions.sort() != null) { + builder.query("sort", String.valueOf(listV2PoliciesOptions.sort())); + } + if (listV2PoliciesOptions.format() != null) { + builder.query("format", String.valueOf(listV2PoliciesOptions.format())); + } + if (listV2PoliciesOptions.state() != null) { + builder.query("state", String.valueOf(listV2PoliciesOptions.state())); + } + if (listV2PoliciesOptions.limit() != null) { + builder.query("limit", String.valueOf(listV2PoliciesOptions.limit())); + } + if (listV2PoliciesOptions.start() != null) { + builder.query("start", String.valueOf(listV2PoliciesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a policy. + * + * Creates a policy to grant access between a subject and a resource. Currently, there is one type of a v2/policy: + * **access**. A policy administrator might want to create an access policy that grants access to a user, service-id, + * or an access group. + * + * ### Access + * + * To create an access policy, use **`"type": "access"`** in the body. The supported subject attributes are + * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute to assign access to a user or + * service-id. Use the **`access_group_id`** subject attribute to assign access to an access group. Assign roles that + * are supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or + * **`service_group_id`** attribute and the **`accountId`** attribute. In the rule field, you can specify a single + * condition by using **`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`** with a + * combination **`operator`**. The possible combination operators are **`and`** and **`or`**. + * + * Currently, we support two types of patterns: + * + * 1. `time-based`: Used to specify a time-based restriction + * + * Combine conditions to specify a time-based restriction (e.g., access only during business hours, during the + * Monday-Friday work week). For example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following + * rule: + * ```json + * "rule": { + * "operator": "and", + * "conditions": [{ + * "key": "{{environment.attributes.day_of_week}}", + * "operator": "dayOfWeekAnyOf", + * "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] + * }, + * "key": "{{environment.attributes.current_time}}", + * "operator": "timeGreaterThanOrEquals", + * "value": "09:00:00+00:00" + * }, + * "key": "{{environment.attributes.current_time}}", + * "operator": "timeLessThanOrEquals", + * "value": "17:00:00+00:00" + * }] + * } + * ``` You can use the following operators in the **`key`** and **`value`** pair: + * ``` + * 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', + * 'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan', 'dateGreaterThanOrEquals', + * 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', + * 'dayOfWeekEquals', 'dayOfWeekAnyOf' + * ``` + * + * The pattern field that matches the rule is required when rule is provided. For the business hour rule example + * above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions + * operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) and + * [Limiting access with time-based conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the + * subject is a locked service-id, the request will fail. + * + * 2. `attribute-based`: Used to specify a combination of OR/AND based conditions applied on resource attributes. + * + * Combine conditions to specify an attribute-based condition using AND/OR-based operators. + * + * For example, a policy can grant access based on multiple conditions applied on the resource attributes below: + * ```json + * "pattern": "attribute-based-condition:resource:literal-and-wildcard" + * "rule": { + * "operator": "or", + * "conditions": [ + * { + * "operator": "and", + * "conditions": [ + * { + * "key": "{{resource.attributes.prefix}}", + * "operator": "stringEquals", + * "value": "home/test" + * }, + * { + * "key": "{{environment.attributes.delimiter}}", + * "operator": "stringEquals", + * "value": "/" + * } + * ] + * }, + * { + * "key": "{{resource.attributes.path}}", + * "operator": "stringMatch", + * "value": "home/David/_*" + * } + * ] + * } + * ``` + * + * In addition to satisfying the `resources` section, the policy grants permission only if either the `path` begins + * with `home/David/` **OR** the `prefix` is `home/test` and the `delimiter` is `/`. This mechanism helps you + * consolidate multiple policies in to a single policy, making policies easier to administer and stay within the + * policy limit for an account. View the list of operators that can be used in the condition + * [here](/docs/account?topic=account-wildcard#string-comparisons). + * + * ### Authorization + * + * Authorization policies are supported by services on a case by case basis. Refer to service documentation to verify + * their support of authorization policies. To create an authorization policy, use **`"type": "authorization"`** in + * the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject + * attributes might be provided. The following attributes are supported: + * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are + * supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access + * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject + * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. + * + * ### Attribute Operators + * + * Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators are available. For more + * information, see [Assigning access by using wildcard + * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). + * + * ### Attribute Validations + * + * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like + * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated + * against Global Catalog locations. + * + * @param createV2PolicyOptions the {@link CreateV2PolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link V2Policy} + */ + public ServiceCall createV2Policy(CreateV2PolicyOptions createV2PolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createV2PolicyOptions, + "createV2PolicyOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createV2Policy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createV2PolicyOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createV2PolicyOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.add("control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.control())); + contentJson.addProperty("type", createV2PolicyOptions.type()); + if (createV2PolicyOptions.description() != null) { + contentJson.addProperty("description", createV2PolicyOptions.description()); + } + if (createV2PolicyOptions.subject() != null) { + contentJson.add("subject", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.subject())); + } + if (createV2PolicyOptions.resource() != null) { + contentJson.add("resource", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.resource())); + } + if (createV2PolicyOptions.pattern() != null) { + contentJson.addProperty("pattern", createV2PolicyOptions.pattern()); + } + if (createV2PolicyOptions.rule() != null) { + contentJson.add("rule", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.rule())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a policy. + * + * Update a policy to grant access between a subject and a resource. A policy administrator might want to update an + * existing policy. + * + * ### Access + * + * To update an access policy, use **`"type": "access"`** in the body. The supported subject attributes are + * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute to assign access to a user or + * service-id. Use the **`access_group_id`** subject attribute to assign access to an access group. Assign roles that + * are supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or + * **`service_group_id`** attribute and the **`accountId`** attribute. In the rule field, you can specify a single + * condition by using **`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`** with a + * combination **`operator`**. The possible combination operators are **`and`** and **`or`**. + * + * Currently, we support two types of patterns: + * + * 1. `time-based`: Used to specify a time-based restriction + * + * Combine conditions to specify a time-based restriction (e.g., access only during business hours, during the + * Monday-Friday work week). For example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following + * rule: + * ```json + * "rule": { + * "operator": "and", + * "conditions": [{ + * "key": "{{environment.attributes.day_of_week}}", + * "operator": "dayOfWeekAnyOf", + * "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] + * }, + * "key": "{{environment.attributes.current_time}}", + * "operator": "timeGreaterThanOrEquals", + * "value": "09:00:00+00:00" + * }, + * "key": "{{environment.attributes.current_time}}", + * "operator": "timeLessThanOrEquals", + * "value": "17:00:00+00:00" + * }] + * } + * ``` You can use the following operators in the **`key`** and **`value`** pair: + * ``` + * 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', + * 'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan', 'dateGreaterThanOrEquals', + * 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', + * 'dayOfWeekEquals', 'dayOfWeekAnyOf' + * ``` The pattern field that matches the rule is required when rule is provided. For the business hour rule example + * above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions + * operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) and + * [Limiting access with time-based conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the + * subject is a locked service-id, the request will fail. + * + * 2. `attribute-based`: Used to specify a combination of OR/AND based conditions applied on resource attributes. + * + * Combine conditions to specify an attribute-based condition using AND/OR-based operators. + * + * For example, a policy can grant access based on multiple conditions applied on the resource attributes below: + * ```json + * "pattern": "attribute-based-condition:resource:literal-and-wildcard" + * "rule": { + * "operator": "or", + * "conditions": [ + * { + * "operator": "and", + * "conditions": [ + * { + * "key": "{{resource.attributes.prefix}}", + * "operator": "stringEquals", + * "value": "home/test" + * }, + * { + * "key": "{{environment.attributes.delimiter}}", + * "operator": "stringEquals", + * "value": "/" + * } + * ] + * }, + * { + * "key": "{{resource.attributes.path}}", + * "operator": "stringMatch", + * "value": "home/David/_*" + * } + * ] + * } + * ``` + * + * In addition to satisfying the `resources` section, the policy grants permission only if either the `path` begins + * with `home/David/` **OR** the `prefix` is `home/test` and the `delimiter` is `/`. This mechanism helps you + * consolidate multiple policies in to a single policy, making policies easier to administer and stay within the + * policy limit for an account. View the list of operators that can be used in the condition + * [here](/docs/account?topic=account-wildcard#string-comparisons). + * + * ### Authorization + * + * To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match + * the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following + * attributes are supported: + * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are + * supported by the service or platform roles. For more information, see [IAM roles and + * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access + * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the + * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). + * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject + * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. + * + * ### Attribute Operators + * + * Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators are available. For more + * information, see [Assigning access by using wildcard + * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). + * + * ### Attribute Validations + * + * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like + * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated + * against Global Catalog locations. + * + * @param replaceV2PolicyOptions the {@link ReplaceV2PolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link V2Policy} + */ + public ServiceCall replaceV2Policy(ReplaceV2PolicyOptions replaceV2PolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceV2PolicyOptions, + "replaceV2PolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("id", replaceV2PolicyOptions.id()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceV2Policy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replaceV2PolicyOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.add("control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.control())); + contentJson.addProperty("type", replaceV2PolicyOptions.type()); + if (replaceV2PolicyOptions.description() != null) { + contentJson.addProperty("description", replaceV2PolicyOptions.description()); + } + if (replaceV2PolicyOptions.subject() != null) { + contentJson.add("subject", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.subject())); + } + if (replaceV2PolicyOptions.resource() != null) { + contentJson.add("resource", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.resource())); + } + if (replaceV2PolicyOptions.pattern() != null) { + contentJson.addProperty("pattern", replaceV2PolicyOptions.pattern()); + } + if (replaceV2PolicyOptions.rule() != null) { + contentJson.add("rule", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.rule())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a policy by ID. + * + * Retrieve a policy by providing a policy ID. + * + * @param getV2PolicyOptions the {@link GetV2PolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link V2PolicyTemplateMetaData} + */ + public ServiceCall getV2Policy(GetV2PolicyOptions getV2PolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getV2PolicyOptions, + "getV2PolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("id", getV2PolicyOptions.id()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getV2Policy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getV2PolicyOptions.format() != null) { + builder.query("format", String.valueOf(getV2PolicyOptions.format())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a policy by ID. + * + * Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service + * ID. If the subject of the policy is a locked service-id, the request will fail. + * + * @param deleteV2PolicyOptions the {@link DeleteV2PolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteV2Policy(DeleteV2PolicyOptions deleteV2PolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteV2PolicyOptions, + "deleteV2PolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("id", deleteV2PolicyOptions.id()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteV2Policy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * List policy templates by attributes. + * + * List policy templates and filter by attributes by using query parameters. The following attributes are supported: + * `account_id`, `policy_service_name`, `policy_service_type`, `policy_service_group_id` and `policy_type`. + * `account_id` is a required query parameter. These attributes `policy_service_name`, `policy_service_type` and + * `policy_service_group_id` are mutually exclusive. Only policy templates that have the specified attributes and that + * the caller has read access to are returned. If the caller does not have read access to any policy templates an + * empty array is returned. + * + * @param listPolicyTemplatesOptions the {@link ListPolicyTemplatesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateCollection} + */ + public ServiceCall listPolicyTemplates(ListPolicyTemplatesOptions listPolicyTemplatesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyTemplatesOptions, + "listPolicyTemplatesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyTemplates"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listPolicyTemplatesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listPolicyTemplatesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listPolicyTemplatesOptions.accountId())); + if (listPolicyTemplatesOptions.state() != null) { + builder.query("state", String.valueOf(listPolicyTemplatesOptions.state())); + } + if (listPolicyTemplatesOptions.name() != null) { + builder.query("name", String.valueOf(listPolicyTemplatesOptions.name())); + } + if (listPolicyTemplatesOptions.policyServiceType() != null) { + builder.query("policy_service_type", String.valueOf(listPolicyTemplatesOptions.policyServiceType())); + } + if (listPolicyTemplatesOptions.policyServiceName() != null) { + builder.query("policy_service_name", String.valueOf(listPolicyTemplatesOptions.policyServiceName())); + } + if (listPolicyTemplatesOptions.policyServiceGroupId() != null) { + builder.query("policy_service_group_id", String.valueOf(listPolicyTemplatesOptions.policyServiceGroupId())); + } + if (listPolicyTemplatesOptions.policyType() != null) { + builder.query("policy_type", String.valueOf(listPolicyTemplatesOptions.policyType())); + } + if (listPolicyTemplatesOptions.limit() != null) { + builder.query("limit", String.valueOf(listPolicyTemplatesOptions.limit())); + } + if (listPolicyTemplatesOptions.start() != null) { + builder.query("start", String.valueOf(listPolicyTemplatesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a policy template. + * + * Create a policy template. Policy templates define a policy without requiring a subject, and you can use them to + * grant access to multiple subjects. + * + * @param createPolicyTemplateOptions the {@link CreatePolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateLimitData} + */ + public ServiceCall createPolicyTemplate(CreatePolicyTemplateOptions createPolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateOptions, + "createPolicyTemplateOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createPolicyTemplateOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createPolicyTemplateOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("name", createPolicyTemplateOptions.name()); + contentJson.addProperty("account_id", createPolicyTemplateOptions.accountId()); + contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateOptions.policy())); + if (createPolicyTemplateOptions.description() != null) { + contentJson.addProperty("description", createPolicyTemplateOptions.description()); + } + if (createPolicyTemplateOptions.committed() != null) { + contentJson.addProperty("committed", createPolicyTemplateOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve latest version of a policy template. + * + * Retrieve the latest version of a policy template by providing a policy template ID. + * + * @param getPolicyTemplateOptions the {@link GetPolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} + */ + public ServiceCall getPolicyTemplate(GetPolicyTemplateOptions getPolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyTemplateOptions, + "getPolicyTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", getPolicyTemplateOptions.policyTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getPolicyTemplateOptions.state() != null) { + builder.query("state", String.valueOf(getPolicyTemplateOptions.state())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a policy template. + * + * Delete a policy template by providing the policy template ID. This deletes all versions of this template. A policy + * template can't be deleted if any version of the template is assigned to one or more child accounts. You must remove + * the policy assignments first. + * + * @param deletePolicyTemplateOptions the {@link DeletePolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deletePolicyTemplate(DeletePolicyTemplateOptions deletePolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyTemplateOptions, + "deletePolicyTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", deletePolicyTemplateOptions.policyTemplateId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a new policy template version. + * + * Create a new version of a policy template. Use this if you need to make updates to a policy template that is + * committed. + * + * @param createPolicyTemplateVersionOptions the {@link CreatePolicyTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateLimitData} + */ + public ServiceCall createPolicyTemplateVersion(CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateVersionOptions, + "createPolicyTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", createPolicyTemplateVersionOptions.policyTemplateId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateVersionOptions.policy())); + if (createPolicyTemplateVersionOptions.name() != null) { + contentJson.addProperty("name", createPolicyTemplateVersionOptions.name()); + } + if (createPolicyTemplateVersionOptions.description() != null) { + contentJson.addProperty("description", createPolicyTemplateVersionOptions.description()); + } + if (createPolicyTemplateVersionOptions.committed() != null) { + contentJson.addProperty("committed", createPolicyTemplateVersionOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve policy template versions. + * + * Retrieve the versions of a policy template by providing a policy template ID. + * + * @param listPolicyTemplateVersionsOptions the {@link ListPolicyTemplateVersionsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateVersionsCollection} + */ + public ServiceCall listPolicyTemplateVersions(ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyTemplateVersionsOptions, + "listPolicyTemplateVersionsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", listPolicyTemplateVersionsOptions.policyTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyTemplateVersions"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listPolicyTemplateVersionsOptions.state() != null) { + builder.query("state", String.valueOf(listPolicyTemplateVersionsOptions.state())); + } + if (listPolicyTemplateVersionsOptions.limit() != null) { + builder.query("limit", String.valueOf(listPolicyTemplateVersionsOptions.limit())); + } + if (listPolicyTemplateVersionsOptions.start() != null) { + builder.query("start", String.valueOf(listPolicyTemplateVersionsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a policy template version. + * + * Update a specific version of a policy template. You can use this only if the version isn't committed. + * + * @param replacePolicyTemplateOptions the {@link ReplacePolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} + */ + public ServiceCall replacePolicyTemplate(ReplacePolicyTemplateOptions replacePolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replacePolicyTemplateOptions, + "replacePolicyTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", replacePolicyTemplateOptions.policyTemplateId()); + pathParamsMap.put("version", replacePolicyTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replacePolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replacePolicyTemplateOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyTemplateOptions.policy())); + if (replacePolicyTemplateOptions.name() != null) { + contentJson.addProperty("name", replacePolicyTemplateOptions.name()); + } + if (replacePolicyTemplateOptions.description() != null) { + contentJson.addProperty("description", replacePolicyTemplateOptions.description()); + } + if (replacePolicyTemplateOptions.committed() != null) { + contentJson.addProperty("committed", replacePolicyTemplateOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a policy template version. + * + * Delete a specific version of a policy template by providing a policy template ID and version number. You can't + * delete a policy template version that is assigned to one or more child accounts. You must remove the policy + * assignments first. + * + * @param deletePolicyTemplateVersionOptions the {@link DeletePolicyTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deletePolicyTemplateVersion(DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyTemplateVersionOptions, + "deletePolicyTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", deletePolicyTemplateVersionOptions.policyTemplateId()); + pathParamsMap.put("version", deletePolicyTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a policy template version. + * + * Retrieve a policy template by providing a policy template ID and version number. + * + * @param getPolicyTemplateVersionOptions the {@link GetPolicyTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} + */ + public ServiceCall getPolicyTemplateVersion(GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyTemplateVersionOptions, + "getPolicyTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", getPolicyTemplateVersionOptions.policyTemplateId()); + pathParamsMap.put("version", getPolicyTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyTemplateVersion"); + 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); + } + + /** + * Commit a policy template version. + * + * Commit a policy template version. You can make no further changes to the policy template once it's committed. If + * you need to make updates after committing a version, create a new version. + * + * @param commitPolicyTemplateOptions the {@link CommitPolicyTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall commitPolicyTemplate(CommitPolicyTemplateOptions commitPolicyTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(commitPolicyTemplateOptions, + "commitPolicyTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("policy_template_id", commitPolicyTemplateOptions.policyTemplateId()); + pathParamsMap.put("version", commitPolicyTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}/commit", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitPolicyTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get policy template assignments. + * + * Get policy template assignments by attributes. The following attributes are supported: + * `account_id`, `template_id`, `template_version`, `sort`. + * `account_id` is a required query parameter. Only policy template assignments that have the specified attributes and + * that the caller has read access to are returned. If the caller does not have read access to any policy template + * assignments an empty array is returned. + * + * @param listPolicyAssignmentsOptions the {@link ListPolicyAssignmentsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateAssignmentCollection} + */ + public ServiceCall listPolicyAssignments(ListPolicyAssignmentsOptions listPolicyAssignmentsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyAssignmentsOptions, + "listPolicyAssignmentsOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyAssignments"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listPolicyAssignmentsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listPolicyAssignmentsOptions.acceptLanguage()); + } + builder.query("version", String.valueOf(listPolicyAssignmentsOptions.version())); + builder.query("account_id", String.valueOf(listPolicyAssignmentsOptions.accountId())); + if (listPolicyAssignmentsOptions.templateId() != null) { + builder.query("template_id", String.valueOf(listPolicyAssignmentsOptions.templateId())); + } + if (listPolicyAssignmentsOptions.templateVersion() != null) { + builder.query("template_version", String.valueOf(listPolicyAssignmentsOptions.templateVersion())); + } + if (listPolicyAssignmentsOptions.limit() != null) { + builder.query("limit", String.valueOf(listPolicyAssignmentsOptions.limit())); + } + if (listPolicyAssignmentsOptions.start() != null) { + builder.query("start", String.valueOf(listPolicyAssignmentsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a policy authorization template assignment. + * + * Assign a policy template to child accounts and account groups. This creates the policy in the accounts and account + * groups that you specify. + * + * @param createPolicyTemplateAssignmentOptions the {@link CreatePolicyTemplateAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyAssignmentV1Collection} + */ + public ServiceCall createPolicyTemplateAssignment(CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateAssignmentOptions, + "createPolicyTemplateAssignmentOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplateAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createPolicyTemplateAssignmentOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createPolicyTemplateAssignmentOptions.acceptLanguage()); + } + builder.query("version", String.valueOf(createPolicyTemplateAssignmentOptions.version())); + final JsonObject contentJson = new JsonObject(); + contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateAssignmentOptions.target())); + contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateAssignmentOptions.templates())); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a policy assignment. + * + * Retrieve a policy template assignment by providing a policy assignment ID. + * + * @param getPolicyAssignmentOptions the {@link GetPolicyAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateAssignmentItems} + */ + public ServiceCall getPolicyAssignment(GetPolicyAssignmentOptions getPolicyAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyAssignmentOptions, + "getPolicyAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", getPolicyAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.query("version", String.valueOf(getPolicyAssignmentOptions.version())); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a policy authorization type assignment. + * + * Update a policy assignment by providing a policy assignment ID. + * + * @param updatePolicyAssignmentOptions the {@link UpdatePolicyAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PolicyAssignmentV1} + */ + public ServiceCall updatePolicyAssignment(UpdatePolicyAssignmentOptions updatePolicyAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updatePolicyAssignmentOptions, + "updatePolicyAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", updatePolicyAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updatePolicyAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updatePolicyAssignmentOptions.ifMatch()); + builder.query("version", String.valueOf(updatePolicyAssignmentOptions.version())); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("template_version", updatePolicyAssignmentOptions.templateVersion()); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Remove a policy assignment. + * + * Remove a policy template assignment by providing a policy assignment ID. You can't delete a policy assignment if + * the status is "in_progress". + * + * @param deletePolicyAssignmentOptions the {@link DeletePolicyAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deletePolicyAssignment(DeletePolicyAssignmentOptions deletePolicyAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyAssignmentOptions, + "deletePolicyAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", deletePolicyAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve Access Management account settings by account ID. + * + * Retrieve Access Management settings for an account by providing the account ID. + * + * @param getSettingsOptions the {@link GetSettingsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccountSettingsAccessManagement} + */ + public ServiceCall getSettings(GetSettingsOptions getSettingsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getSettingsOptions, + "getSettingsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("account_id", getSettingsOptions.accountId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/settings/access_management", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getSettings"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getSettingsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", getSettingsOptions.acceptLanguage()); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update Access Management account settings by account ID. + * + * Update access management settings for an account. + * + * ### External Account Identity Interaction + * + * Update the way identities within an external account are allowed to interact with the requested account by + * providing: + * * the `account_id` as a parameter + * * one or more external account ID(s) and state for the specific identity in the request body + * + * External account identity interaction includes the following `identity_types`: `user` (user identities that are + * defined as [IBMid's](https://cloud.ibm.com/docs/account?topic=account-identity-overview#users-bestpract)), + * `service_id` (defined as [IAM + * ServiceIds](https://cloud.ibm.com/docs/account?topic=account-identity-overview#serviceid-bestpract)), `service` + * (defined by a service’s [CRN](https://cloud.ibm.com/docs/account?topic=account-crn)). To update an Identity’s + * setting, the `state` and `external_allowed_accounts` fields are required. + * + * Different identity states are: + * * "enabled": An identity type is allowed to access resources in the account provided it has access policies on + * those resources. + * * "limited": An identity type is allowed to access resources in the account provided it has access policies on + * those resources AND it is associated with either the account the resources are in or one of the allowed accounts. + * This setting uses the "external_allowed_accounts" list. + * * "monitor": It has no direct impact on an Identity’s access. Instead, it creates AT events for access decisions as + * if the account were in a limited “state”. + * + * **Note**: The state "enabled" is a special case. In this case, access is given to all accounts and there is no need + * to specify a particular list. Therefore, when updating "state" to "enabled" for an identity type + * "external_allowed_accounts" should be left empty. + * + * @param updateSettingsOptions the {@link UpdateSettingsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccountSettingsAccessManagement} + */ + public ServiceCall updateSettings(UpdateSettingsOptions updateSettingsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateSettingsOptions, + "updateSettingsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("account_id", updateSettingsOptions.accountId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/settings/access_management", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateSettings"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updateSettingsOptions.ifMatch()); + if (updateSettingsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", updateSettingsOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + if (updateSettingsOptions.externalAccountIdentityInteraction() != null) { + contentJson.add("external_account_identity_interaction", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateSettingsOptions.externalAccountIdentityInteraction())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * List action control templates by attributes. + * + * List action control templates and filter by attributes by using query parameters. The following attributes are + * supported: + * `account_id` + * `account_id` is a required query parameter. Only action control templates that have the specified attributes and + * that the caller has read access to are returned. If the caller does not have read access to any action control + * templates an empty array is returned. + * + * @param listActionControlTemplatesOptions the {@link ListActionControlTemplatesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplateCollection} + */ + public ServiceCall listActionControlTemplates(ListActionControlTemplatesOptions listActionControlTemplatesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlTemplatesOptions, + "listActionControlTemplatesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlTemplates"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listActionControlTemplatesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listActionControlTemplatesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listActionControlTemplatesOptions.accountId())); + if (listActionControlTemplatesOptions.limit() != null) { + builder.query("limit", String.valueOf(listActionControlTemplatesOptions.limit())); + } + if (listActionControlTemplatesOptions.start() != null) { + builder.query("start", String.valueOf(listActionControlTemplatesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create an action control template. + * + * Create an action control template. Action control templates define a service action control. + * + * @param createActionControlTemplateOptions the {@link CreateActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall createActionControlTemplate(CreateActionControlTemplateOptions createActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateOptions, + "createActionControlTemplateOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createActionControlTemplateOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createActionControlTemplateOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("name", createActionControlTemplateOptions.name()); + contentJson.addProperty("account_id", createActionControlTemplateOptions.accountId()); + if (createActionControlTemplateOptions.description() != null) { + contentJson.addProperty("description", createActionControlTemplateOptions.description()); + } + if (createActionControlTemplateOptions.committed() != null) { + contentJson.addProperty("committed", createActionControlTemplateOptions.committed()); + } + if (createActionControlTemplateOptions.actionControl() != null) { + contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateOptions.actionControl())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve the latest version of an action control template. + * + * Retrieve the latest version of an action control template by providing an action control template ID. + * + * @param getActionControlTemplateOptions the {@link GetActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall getActionControlTemplate(GetActionControlTemplateOptions getActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlTemplateOptions, + "getActionControlTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", getActionControlTemplateOptions.actionControlTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getActionControlTemplateOptions.state() != null) { + builder.query("state", String.valueOf(getActionControlTemplateOptions.state())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete an action control template. + * + * Delete an action control template by providing the action control template ID. This deletes all versions of this + * template. An action control template can't be deleted if any version of the template is assigned to one or more + * child accounts. You must remove the action control assignments first. + * + * @param deleteActionControlTemplateOptions the {@link DeleteActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteActionControlTemplate(DeleteActionControlTemplateOptions deleteActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlTemplateOptions, + "deleteActionControlTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", deleteActionControlTemplateOptions.actionControlTemplateId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a new action control template version. + * + * Create a new version of an action control template. Use this if you need to make updates to an action control + * template that is committed. + * + * @param createActionControlTemplateVersionOptions the {@link CreateActionControlTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall createActionControlTemplateVersion(CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateVersionOptions, + "createActionControlTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", createActionControlTemplateVersionOptions.actionControlTemplateId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + if (createActionControlTemplateVersionOptions.name() != null) { + contentJson.addProperty("name", createActionControlTemplateVersionOptions.name()); + } + if (createActionControlTemplateVersionOptions.description() != null) { + contentJson.addProperty("description", createActionControlTemplateVersionOptions.description()); + } + if (createActionControlTemplateVersionOptions.actionControl() != null) { + contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateVersionOptions.actionControl())); + } + if (createActionControlTemplateVersionOptions.committed() != null) { + contentJson.addProperty("committed", createActionControlTemplateVersionOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve action control template versions. + * + * Retrieve the versions of an action control template by providing an action control template ID. + * + * @param listActionControlTemplateVersionsOptions the {@link ListActionControlTemplateVersionsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplateVersionsCollection} + */ + public ServiceCall listActionControlTemplateVersions(ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlTemplateVersionsOptions, + "listActionControlTemplateVersionsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", listActionControlTemplateVersionsOptions.actionControlTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlTemplateVersions"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listActionControlTemplateVersionsOptions.state() != null) { + builder.query("state", String.valueOf(listActionControlTemplateVersionsOptions.state())); + } + if (listActionControlTemplateVersionsOptions.limit() != null) { + builder.query("limit", String.valueOf(listActionControlTemplateVersionsOptions.limit())); + } + if (listActionControlTemplateVersionsOptions.start() != null) { + builder.query("start", String.valueOf(listActionControlTemplateVersionsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update an action control template version. + * + * Update a specific version of an action control template. You can use this only if the version isn't committed. + * + * @param replaceActionControlTemplateOptions the {@link ReplaceActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall replaceActionControlTemplate(ReplaceActionControlTemplateOptions replaceActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceActionControlTemplateOptions, + "replaceActionControlTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", replaceActionControlTemplateOptions.actionControlTemplateId()); + pathParamsMap.put("version", replaceActionControlTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replaceActionControlTemplateOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + if (replaceActionControlTemplateOptions.name() != null) { + contentJson.addProperty("name", replaceActionControlTemplateOptions.name()); + } + if (replaceActionControlTemplateOptions.description() != null) { + contentJson.addProperty("description", replaceActionControlTemplateOptions.description()); + } + if (replaceActionControlTemplateOptions.actionControl() != null) { + contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceActionControlTemplateOptions.actionControl())); + } + if (replaceActionControlTemplateOptions.committed() != null) { + contentJson.addProperty("committed", replaceActionControlTemplateOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete an action control template version. + * + * Delete a specific version of an action control template by providing an action control template ID and version + * number. You can't delete an action control template version that is assigned to one or more child accounts. You + * must remove the action control assignments first. + * + * @param deleteActionControlTemplateVersionOptions the {@link DeleteActionControlTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteActionControlTemplateVersion(DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlTemplateVersionOptions, + "deleteActionControlTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", deleteActionControlTemplateVersionOptions.actionControlTemplateId()); + pathParamsMap.put("version", deleteActionControlTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve an action control template version. + * + * Retrieve an action control template by providing an action control template ID and version number. + * + * @param getActionControlTemplateVersionOptions the {@link GetActionControlTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} + */ + public ServiceCall getActionControlTemplateVersion(GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlTemplateVersionOptions, + "getActionControlTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", getActionControlTemplateVersionOptions.actionControlTemplateId()); + pathParamsMap.put("version", getActionControlTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlTemplateVersion"); + 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); + } + + /** + * Commit an action control template version. + * + * Commit an action control template version. You cannot make any further changes to the action control template once + * it's committed. If you have to make updates after committing a version, create a new version. + * + * @param commitActionControlTemplateOptions the {@link CommitActionControlTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall commitActionControlTemplate(CommitActionControlTemplateOptions commitActionControlTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(commitActionControlTemplateOptions, + "commitActionControlTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("action_control_template_id", commitActionControlTemplateOptions.actionControlTemplateId()); + pathParamsMap.put("version", commitActionControlTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}/commit", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitActionControlTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get action control template assignments. + * + * Get action control template assignments by attributes. The following attributes are supported: + * `account_id`, `template_id`, `template_version`, `sort`. + * `account_id` is a required query parameter. Only action control template assignments with the specified attributes + * and accessible by the caller are returned. If the caller does not have read access to any action control template + * assignments, an empty array is returned. + * + * @param listActionControlAssignmentsOptions the {@link ListActionControlAssignmentsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignmentCollection} + */ + public ServiceCall listActionControlAssignments(ListActionControlAssignmentsOptions listActionControlAssignmentsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlAssignmentsOptions, + "listActionControlAssignmentsOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlAssignments"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listActionControlAssignmentsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listActionControlAssignmentsOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listActionControlAssignmentsOptions.accountId())); + if (listActionControlAssignmentsOptions.templateId() != null) { + builder.query("template_id", String.valueOf(listActionControlAssignmentsOptions.templateId())); + } + if (listActionControlAssignmentsOptions.templateVersion() != null) { + builder.query("template_version", String.valueOf(listActionControlAssignmentsOptions.templateVersion())); + } + if (listActionControlAssignmentsOptions.limit() != null) { + builder.query("limit", String.valueOf(listActionControlAssignmentsOptions.limit())); + } + if (listActionControlAssignmentsOptions.start() != null) { + builder.query("start", String.valueOf(listActionControlAssignmentsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create an action control template assignment. + * + * Assign an action control template to child accounts and account groups. This creates the action control in the + * accounts and account groups that you specify. + * + * @param createActionControlTemplateAssignmentOptions the {@link CreateActionControlTemplateAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignmentCollection} + */ + public ServiceCall createActionControlTemplateAssignment(CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateAssignmentOptions, + "createActionControlTemplateAssignmentOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplateAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createActionControlTemplateAssignmentOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createActionControlTemplateAssignmentOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateAssignmentOptions.target())); + contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateAssignmentOptions.templates())); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve an action control assignment. + * + * Retrieve an action control template assignment by providing an action control assignment ID. + * + * @param getActionControlAssignmentOptions the {@link GetActionControlAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignment} + */ + public ServiceCall getActionControlAssignment(GetActionControlAssignmentOptions getActionControlAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlAssignmentOptions, + "getActionControlAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", getActionControlAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlAssignment"); + 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 an action control assignment. + * + * Update an action control assignment by providing an action control assignment ID. + * + * @param updateActionControlAssignmentOptions the {@link UpdateActionControlAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignment} + */ + public ServiceCall updateActionControlAssignment(UpdateActionControlAssignmentOptions updateActionControlAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateActionControlAssignmentOptions, + "updateActionControlAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", updateActionControlAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateActionControlAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updateActionControlAssignmentOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("template_version", updateActionControlAssignmentOptions.templateVersion()); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Remove an action control assignment. + * + * Remove an action control template assignment by providing an action control assignment ID. You can't delete an + * action control assignment if the status is "in_progress". + * + * @param deleteActionControlAssignmentOptions the {@link DeleteActionControlAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteActionControlAssignment(DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlAssignmentOptions, + "deleteActionControlAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", deleteActionControlAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * List role templates by attributes. + * + * List role templates and filter by attributes by using query parameters. The following attributes are supported: + * `account_id`, `name`, `role_name`, `role_service_name`, `state`, `limit`, `start`. + * `account_id` is a required query parameter. Only role templates that have the specified attributes and that the + * caller has read access to are returned. If the caller does not have read access to any role templates an empty + * array is returned. + * + * @param listRoleTemplatesOptions the {@link ListRoleTemplatesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplateCollection} + */ + public ServiceCall listRoleTemplates(ListRoleTemplatesOptions listRoleTemplatesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleTemplatesOptions, + "listRoleTemplatesOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleTemplates"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listRoleTemplatesOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listRoleTemplatesOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listRoleTemplatesOptions.accountId())); + if (listRoleTemplatesOptions.name() != null) { + builder.query("name", String.valueOf(listRoleTemplatesOptions.name())); + } + if (listRoleTemplatesOptions.roleName() != null) { + builder.query("role_name", String.valueOf(listRoleTemplatesOptions.roleName())); + } + if (listRoleTemplatesOptions.roleServiceName() != null) { + builder.query("role_service_name", String.valueOf(listRoleTemplatesOptions.roleServiceName())); + } + if (listRoleTemplatesOptions.state() != null) { + builder.query("state", String.valueOf(listRoleTemplatesOptions.state())); + } + if (listRoleTemplatesOptions.limit() != null) { + builder.query("limit", String.valueOf(listRoleTemplatesOptions.limit())); + } + if (listRoleTemplatesOptions.start() != null) { + builder.query("start", String.valueOf(listRoleTemplatesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create role template. + * + * Create a role template. Role templates define roles from an existing system or service defined role. + * + * @param createRoleTemplateOptions the {@link CreateRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall createRoleTemplate(CreateRoleTemplateOptions createRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateOptions, + "createRoleTemplateOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createRoleTemplateOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createRoleTemplateOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("name", createRoleTemplateOptions.name()); + contentJson.addProperty("account_id", createRoleTemplateOptions.accountId()); + if (createRoleTemplateOptions.description() != null) { + contentJson.addProperty("description", createRoleTemplateOptions.description()); + } + if (createRoleTemplateOptions.committed() != null) { + contentJson.addProperty("committed", createRoleTemplateOptions.committed()); + } + if (createRoleTemplateOptions.role() != null) { + contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateOptions.role())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve the latest version of a role template. + * + * Retrieve the latest version of a role template by providing a role template ID. + * + * @param getRoleTemplateOptions the {@link GetRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall getRoleTemplate(GetRoleTemplateOptions getRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleTemplateOptions, + "getRoleTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", getRoleTemplateOptions.roleTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getRoleTemplateOptions.state() != null) { + builder.query("state", String.valueOf(getRoleTemplateOptions.state())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a Role template. + * + * Delete a role template by providing the role template ID. This deletes all versions of this template. A role + * template can't be deleted if any version of the template is assigned to one or more child accounts. You must remove + * the role assignments first. + * + * @param deleteRoleTemplateOptions the {@link DeleteRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteRoleTemplate(DeleteRoleTemplateOptions deleteRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleTemplateOptions, + "deleteRoleTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", deleteRoleTemplateOptions.roleTemplateId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a new role template version. + * + * Create a new version of a role template. Use this if you need to make updates to a role template that is committed. + * + * @param createRoleTemplateVersionOptions the {@link CreateRoleTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall createRoleTemplateVersion(CreateRoleTemplateVersionOptions createRoleTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateVersionOptions, + "createRoleTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", createRoleTemplateVersionOptions.roleTemplateId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + if (createRoleTemplateVersionOptions.name() != null) { + contentJson.addProperty("name", createRoleTemplateVersionOptions.name()); + } + if (createRoleTemplateVersionOptions.description() != null) { + contentJson.addProperty("description", createRoleTemplateVersionOptions.description()); + } + if (createRoleTemplateVersionOptions.role() != null) { + contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateVersionOptions.role())); + } + if (createRoleTemplateVersionOptions.committed() != null) { + contentJson.addProperty("committed", createRoleTemplateVersionOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve role template versions. + * + * Retrieve the versions of a role template by providing a role template ID. + * + * @param listRoleTemplateVersionsOptions the {@link ListRoleTemplateVersionsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplateVersionsCollection} + */ + public ServiceCall listRoleTemplateVersions(ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleTemplateVersionsOptions, + "listRoleTemplateVersionsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", listRoleTemplateVersionsOptions.roleTemplateId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleTemplateVersions"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listRoleTemplateVersionsOptions.state() != null) { + builder.query("state", String.valueOf(listRoleTemplateVersionsOptions.state())); + } + if (listRoleTemplateVersionsOptions.limit() != null) { + builder.query("limit", String.valueOf(listRoleTemplateVersionsOptions.limit())); + } + if (listRoleTemplateVersionsOptions.start() != null) { + builder.query("start", String.valueOf(listRoleTemplateVersionsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a role template version. + * + * Update a specific version of a role template. You can use this only if the version isn't committed. + * + * @param replaceRoleTemplateOptions the {@link ReplaceRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall replaceRoleTemplate(ReplaceRoleTemplateOptions replaceRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceRoleTemplateOptions, + "replaceRoleTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", replaceRoleTemplateOptions.roleTemplateId()); + pathParamsMap.put("version", replaceRoleTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", replaceRoleTemplateOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + if (replaceRoleTemplateOptions.name() != null) { + contentJson.addProperty("name", replaceRoleTemplateOptions.name()); + } + if (replaceRoleTemplateOptions.description() != null) { + contentJson.addProperty("description", replaceRoleTemplateOptions.description()); + } + if (replaceRoleTemplateOptions.role() != null) { + contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRoleTemplateOptions.role())); + } + if (replaceRoleTemplateOptions.committed() != null) { + contentJson.addProperty("committed", replaceRoleTemplateOptions.committed()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a role template version. + * + * Delete a specific version of a role template by providing a role template ID and version number. You can't delete a + * role template version that is assigned to one or more child accounts. You must remove the role assignments first. + * + * @param deleteRoleTemplateVersionOptions the {@link DeleteRoleTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteRoleTemplateVersion(DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleTemplateVersionOptions, + "deleteRoleTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", deleteRoleTemplateVersionOptions.roleTemplateId()); + pathParamsMap.put("version", deleteRoleTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleTemplateVersion"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a role template version. + * + * Retrieve a role template by providing a role template ID and version number. + * + * @param getRoleTemplateVersionOptions the {@link GetRoleTemplateVersionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} + */ + public ServiceCall getRoleTemplateVersion(GetRoleTemplateVersionOptions getRoleTemplateVersionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleTemplateVersionOptions, + "getRoleTemplateVersionOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", getRoleTemplateVersionOptions.roleTemplateId()); + pathParamsMap.put("version", getRoleTemplateVersionOptions.version()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleTemplateVersion"); + 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); + } + + /** + * Commit a role template version. + * + * Commit a role template version. You cannot make any further changes to the role template once it's committed. If + * you have to make updates after committing a version, create a new version. + * + * @param commitRoleTemplateOptions the {@link CommitRoleTemplateOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall commitRoleTemplate(CommitRoleTemplateOptions commitRoleTemplateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(commitRoleTemplateOptions, + "commitRoleTemplateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("role_template_id", commitRoleTemplateOptions.roleTemplateId()); + pathParamsMap.put("version", commitRoleTemplateOptions.version()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}/commit", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitRoleTemplate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get role template assignments. + * + * Get role template assignments by attributes. The following attributes are supported: + * `account_id`, `template_id`, `template_version`, `target`, `target_type`, `limit`, `start`. + * `account_id` is a required query parameter. Only role template assignments with the specified attributes and + * accessible by the caller are returned. If the caller does not have read access to any role template assignments, an + * empty array is returned. + * + * @param listRoleAssignmentsOptions the {@link ListRoleAssignmentsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleAssignmentCollection} + */ + public ServiceCall listRoleAssignments(ListRoleAssignmentsOptions listRoleAssignmentsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleAssignmentsOptions, + "listRoleAssignmentsOptions cannot be null"); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleAssignments"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listRoleAssignmentsOptions.acceptLanguage() != null) { + builder.header("Accept-Language", listRoleAssignmentsOptions.acceptLanguage()); + } + builder.query("account_id", String.valueOf(listRoleAssignmentsOptions.accountId())); + if (listRoleAssignmentsOptions.templateId() != null) { + builder.query("template_id", String.valueOf(listRoleAssignmentsOptions.templateId())); + } + if (listRoleAssignmentsOptions.templateVersion() != null) { + builder.query("template_version", String.valueOf(listRoleAssignmentsOptions.templateVersion())); + } + if (listRoleAssignmentsOptions.limit() != null) { + builder.query("limit", String.valueOf(listRoleAssignmentsOptions.limit())); + } + if (listRoleAssignmentsOptions.start() != null) { + builder.query("start", String.valueOf(listRoleAssignmentsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a role template assignment. + * + * Assign a role template to child accounts and account groups. This creates the role in the accounts and account + * groups that you specify. + * + * @param createRoleTemplateAssignmentOptions the {@link CreateRoleTemplateAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleAssignmentCollection} + */ + public ServiceCall createRoleTemplateAssignment(CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateAssignmentOptions, + "createRoleTemplateAssignmentOptions cannot be null"); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments")); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplateAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createRoleTemplateAssignmentOptions.acceptLanguage() != null) { + builder.header("Accept-Language", createRoleTemplateAssignmentOptions.acceptLanguage()); + } + final JsonObject contentJson = new JsonObject(); + contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateAssignmentOptions.target())); + contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateAssignmentOptions.templates())); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Retrieve a role assignment. + * + * Retrieve a role template assignment by providing a role assignment ID. + * + * @param getRoleAssignmentOptions the {@link GetRoleAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleAssignment} + */ + public ServiceCall getRoleAssignment(GetRoleAssignmentOptions getRoleAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleAssignmentOptions, + "getRoleAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", getRoleAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleAssignment"); + 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 a role assignment. + * + * Update a role assignment by providing a role assignment ID. + * + * @param updateRoleAssignmentOptions the {@link UpdateRoleAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RoleAssignment} + */ + public ServiceCall updateRoleAssignment(UpdateRoleAssignmentOptions updateRoleAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateRoleAssignmentOptions, + "updateRoleAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", updateRoleAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateRoleAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.header("If-Match", updateRoleAssignmentOptions.ifMatch()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("template_version", updateRoleAssignmentOptions.templateVersion()); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Remove a role assignment. + * + * Remove a role template assignment by providing a role assignment ID. You can't delete a role assignment if the + * status is "in_progress". + * + * @param deleteRoleAssignmentOptions the {@link DeleteRoleAssignmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteRoleAssignment(DeleteRoleAssignmentOptions deleteRoleAssignmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleAssignmentOptions, + "deleteRoleAssignmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("assignment_id", deleteRoleAssignmentOptions.assignmentId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleAssignment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java new file mode 100644 index 00000000000..af82ea2abe8 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The Access Management Account Settings that are currently set for the requested account. + */ +public class AccountSettingsAccessManagement extends GenericModel { + + @SerializedName("external_account_identity_interaction") + protected ExternalAccountIdentityInteraction externalAccountIdentityInteraction; + + protected AccountSettingsAccessManagement() { } + + /** + * Gets the externalAccountIdentityInteraction. + * + * How external accounts can interact in relation to the requested account. + * + * @return the externalAccountIdentityInteraction + */ + public ExternalAccountIdentityInteraction getExternalAccountIdentityInteraction() { + return externalAccountIdentityInteraction; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java new file mode 100644 index 00000000000..ea230f57263 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java @@ -0,0 +1,207 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the assigned action control template. + */ +public class ActionControlAssignment extends GenericModel { + + /** + * The current operation of the action control assignment. + */ + public interface Operation { + /** create. */ + String CREATE = "create"; + /** apply. */ + String APPLY = "apply"; + /** update. */ + String UPDATE = "update"; + /** remove. */ + String REMOVE = "remove"; + } + + /** + * The action control assignment status. + */ + public interface Status { + /** accepted. */ + String ACCEPTED = "accepted"; + /** failure. */ + String FAILURE = "failure"; + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** superseded. */ + String SUPERSEDED = "superseded"; + } + + protected String id; + @SerializedName("account_id") + protected String accountId; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String operation; + protected List resources; + protected ActionControlAssignmentTemplate template; + protected AssignmentTargetDetails target; + protected String status; + + protected ActionControlAssignment() { } + + /** + * Gets the id. + * + * Action control assignment ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the accountId. + * + * The account GUID that the action control assignments belong to. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the href. + * + * The href URL that links to the action control assignments API by action control assignment ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the action control assignment was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the action control assignment. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the action control assignment was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the action control assignment. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the operation. + * + * The current operation of the action control assignment. + * + * @return the operation + */ + public String getOperation() { + return operation; + } + + /** + * Gets the resources. + * + * Resources created when action control template is assigned. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the template. + * + * The action control template id and version that will be assigned. + * + * @return the template + */ + public ActionControlAssignmentTemplate getTemplate() { + return template; + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the status. + * + * The action control assignment status. + * + * @return the status + */ + public String getStatus() { + return status; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java new file mode 100644 index 00000000000..a9d6b28ce39 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of action control assignments. + */ +public class ActionControlAssignmentCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List assignments; + + protected ActionControlAssignmentCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the assignments. + * + * List of action control assignments. + * + * @return the assignments + */ + public List getAssignments() { + return assignments; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java new file mode 100644 index 00000000000..122d3c8277b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java @@ -0,0 +1,52 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The action control assignment resources and target where the template is assigned. + */ +public class ActionControlAssignmentResource extends GenericModel { + + protected AssignmentTargetDetails target; + @SerializedName("action_control") + protected ActionControlAssignmentResourceActionControl actionControl; + + protected ActionControlAssignmentResource() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the actionControl. + * + * Set of properties of the assigned resource or error message if assignment failed. + * + * @return the actionControl + */ + public ActionControlAssignmentResourceActionControl getActionControl() { + return actionControl; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java new file mode 100644 index 00000000000..0e5550eb4da --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Set of properties of the assigned resource or error message if assignment failed. + */ +public class ActionControlAssignmentResourceActionControl extends GenericModel { + + @SerializedName("resource_created") + protected ActionControlAssignmentResourceCreated resourceCreated; + @SerializedName("error_message") + protected AssignmentResourceError errorMessage; + + protected ActionControlAssignmentResourceActionControl() { } + + /** + * Gets the resourceCreated. + * + * On success, it includes the action control assigned. + * + * @return the resourceCreated + */ + public ActionControlAssignmentResourceCreated getResourceCreated() { + return resourceCreated; + } + + /** + * Gets the errorMessage. + * + * Body parameters for assignment error. + * + * @return the errorMessage + */ + public AssignmentResourceError getErrorMessage() { + return errorMessage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java new file mode 100644 index 00000000000..6ecbd23392a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * On success, it includes the action control assigned. + */ +public class ActionControlAssignmentResourceCreated extends GenericModel { + + protected String id; + + protected ActionControlAssignmentResourceCreated() { } + + /** + * Gets the id. + * + * action control id. + * + * @return the id + */ + public String getId() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java new file mode 100644 index 00000000000..4e6d2543e18 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The action control template id and version that will be assigned. + */ +public class ActionControlAssignmentTemplate extends GenericModel { + + protected String id; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String version; + + /** + * Instantiates a new Builder from an existing ActionControlAssignmentTemplate instance. + * + * @param actionControlAssignmentTemplate the instance to initialize the Builder with + */ + private Builder(ActionControlAssignmentTemplate actionControlAssignmentTemplate) { + this.id = actionControlAssignmentTemplate.id; + this.version = actionControlAssignmentTemplate.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + * @param version the version + */ + public Builder(String id, String version) { + this.id = id; + this.version = version; + } + + /** + * Builds a ActionControlAssignmentTemplate. + * + * @return the new ActionControlAssignmentTemplate instance + */ + public ActionControlAssignmentTemplate build() { + return new ActionControlAssignmentTemplate(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the ActionControlAssignmentTemplate builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the ActionControlAssignmentTemplate builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected ActionControlAssignmentTemplate() { } + + protected ActionControlAssignmentTemplate(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, + "id cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + id = builder.id; + version = builder.version; + } + + /** + * New builder. + * + * @return a ActionControlAssignmentTemplate builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * Action control template ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java new file mode 100644 index 00000000000..78b6d56be6d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * ActionControlAssignmentsPager can be used to simplify the use of the "listActionControlAssignments" method. + */ +public class ActionControlAssignmentsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListActionControlAssignmentsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected ActionControlAssignmentsPager() { } + + /** + * Constructs a new ActionControlAssignmentsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlAssignments" method + * @param options the ListActionControlAssignmentsOptions instance to be used to invoke the "listActionControlAssignments" method + */ + public ActionControlAssignmentsPager(IamPolicyManagement client, ListActionControlAssignmentsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<ActionControlAssignment> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListActionControlAssignmentsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + ActionControlAssignmentCollection result = client.listActionControlAssignments(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getAssignments(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<ActionControlAssignment> containing all results returned by the "listActionControlAssignments" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java new file mode 100644 index 00000000000..157c9f6a390 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java @@ -0,0 +1,203 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the action control template. + */ +public class ActionControlTemplate extends GenericModel { + + /** + * State of action control template. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String name; + protected String description; + @SerializedName("account_id") + protected String accountId; + protected Boolean committed; + @SerializedName("action_control") + protected TemplateActionControl actionControl; + protected String id; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String version; + protected String state; + + protected ActionControlTemplate() { } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Description of the action control template. This is shown to users in the enterprise account. Use this to describe + * the purpose or context of the action control for enterprise users managing IAM templates. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the committed. + * + * Committed status of the template. If committed is set to true, then the template version can no longer be updated. + * + * @return the committed + */ + public Boolean isCommitted() { + return committed; + } + + /** + * Gets the actionControl. + * + * The action control properties that are created in an action resource when the template is assigned. + * + * @return the actionControl + */ + public TemplateActionControl getActionControl() { + return actionControl; + } + + /** + * Gets the id. + * + * The action control template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the action control templates API by action control template ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the action control template was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the action control template. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the action control template was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the action control template. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the version. + * + * The version number of the template used to identify different versions of same template. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the state. + * + * State of action control template. + * + * @return the state + */ + public String getState() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java new file mode 100644 index 00000000000..e7536d2c9ae --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java @@ -0,0 +1,90 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of action control templates. + */ +public class ActionControlTemplateCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + @SerializedName("action_control_templates") + protected List actionControlTemplates; + + protected ActionControlTemplateCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the actionControlTemplates. + * + * List of action control templates. + * + * @return the actionControlTemplates + */ + public List getActionControlTemplates() { + return actionControlTemplates; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java new file mode 100644 index 00000000000..5e26f45cf46 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of versions for a specific action control template. + */ +public class ActionControlTemplateVersionsCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List versions; + + protected ActionControlTemplateVersionsCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the versions. + * + * List of action control templates versions. + * + * @return the versions + */ + public List getVersions() { + return versions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java new file mode 100644 index 00000000000..660aefe11ba --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * ActionControlTemplateVersionsPager can be used to simplify the use of the "listActionControlTemplateVersions" method. + */ +public class ActionControlTemplateVersionsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListActionControlTemplateVersionsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected ActionControlTemplateVersionsPager() { } + + /** + * Constructs a new ActionControlTemplateVersionsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlTemplateVersions" method + * @param options the ListActionControlTemplateVersionsOptions instance to be used to invoke the "listActionControlTemplateVersions" method + */ + public ActionControlTemplateVersionsPager(IamPolicyManagement client, ListActionControlTemplateVersionsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<ActionControlTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListActionControlTemplateVersionsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + ActionControlTemplateVersionsCollection result = client.listActionControlTemplateVersions(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getVersions(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<ActionControlTemplate> containing all results returned by the "listActionControlTemplateVersions" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java new file mode 100644 index 00000000000..bd326c8d7ec --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * ActionControlTemplatesPager can be used to simplify the use of the "listActionControlTemplates" method. + */ +public class ActionControlTemplatesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListActionControlTemplatesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected ActionControlTemplatesPager() { } + + /** + * Constructs a new ActionControlTemplatesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlTemplates" method + * @param options the ListActionControlTemplatesOptions instance to be used to invoke the "listActionControlTemplates" method + */ + public ActionControlTemplatesPager(IamPolicyManagement client, ListActionControlTemplatesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<ActionControlTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListActionControlTemplatesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + ActionControlTemplateCollection result = client.listActionControlTemplates(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getActionControlTemplates(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<ActionControlTemplate> containing all results returned by the "listActionControlTemplates" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java new file mode 100644 index 00000000000..c454c7a3ef5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * On success, includes the policy that is assigned. + */ +public class AssignmentResourceCreated extends GenericModel { + + protected String id; + + protected AssignmentResourceCreated() { } + + /** + * Gets the id. + * + * Policy id. + * + * @return the id + */ + public String getId() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java new file mode 100644 index 00000000000..e74dbe58b3a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Body parameters for assignment error. + */ +public class AssignmentResourceError extends GenericModel { + + protected String name; + protected String errorCode; + protected String message; + protected String code; + protected List errors; + + protected AssignmentResourceError() { } + + /** + * Gets the name. + * + * Name of the error. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the errorCode. + * + * error code. + * + * @return the errorCode + */ + public String getErrorCode() { + return errorCode; + } + + /** + * Gets the message. + * + * Error message detailing the nature of the error. + * + * @return the message + */ + public String getMessage() { + return message; + } + + /** + * Gets the code. + * + * Internal status code for the error. + * + * @return the code + */ + public String getCode() { + return code; + } + + /** + * Gets the errors. + * + * The errors encountered during the response. + * + * @return the errors + */ + public List getErrors() { + return errors; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java new file mode 100644 index 00000000000..893d528604c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java @@ -0,0 +1,142 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * assignment target account and type. + */ +public class AssignmentTargetDetails extends GenericModel { + + /** + * Assignment target type. + */ + public interface Type { + /** Account. */ + String ACCOUNT = "Account"; + } + + protected String type; + protected String id; + + /** + * Builder. + */ + public static class Builder { + private String type; + private String id; + + /** + * Instantiates a new Builder from an existing AssignmentTargetDetails instance. + * + * @param assignmentTargetDetails the instance to initialize the Builder with + */ + private Builder(AssignmentTargetDetails assignmentTargetDetails) { + this.type = assignmentTargetDetails.type; + this.id = assignmentTargetDetails.id; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param type the type + * @param id the id + */ + public Builder(String type, String id) { + this.type = type; + this.id = id; + } + + /** + * Builds a AssignmentTargetDetails. + * + * @return the new AssignmentTargetDetails instance + */ + public AssignmentTargetDetails build() { + return new AssignmentTargetDetails(this); + } + + /** + * Set the type. + * + * @param type the type + * @return the AssignmentTargetDetails builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the id. + * + * @param id the id + * @return the AssignmentTargetDetails builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + } + + protected AssignmentTargetDetails() { } + + protected AssignmentTargetDetails(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, + "id cannot be null"); + type = builder.type; + id = builder.id; + } + + /** + * New builder. + * + * @return a AssignmentTargetDetails builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the type. + * + * Assignment target type. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the id. + * + * ID of the target account. + * + * @return the id + */ + public String id() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java new file mode 100644 index 00000000000..b8025e305a9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java @@ -0,0 +1,119 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * policy template details. + */ +public class AssignmentTemplateDetails extends GenericModel { + + protected String id; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String version; + + /** + * Instantiates a new Builder from an existing AssignmentTemplateDetails instance. + * + * @param assignmentTemplateDetails the instance to initialize the Builder with + */ + private Builder(AssignmentTemplateDetails assignmentTemplateDetails) { + this.id = assignmentTemplateDetails.id; + this.version = assignmentTemplateDetails.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a AssignmentTemplateDetails. + * + * @return the new AssignmentTemplateDetails instance + */ + public AssignmentTemplateDetails build() { + return new AssignmentTemplateDetails(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the AssignmentTemplateDetails builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the AssignmentTemplateDetails builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected AssignmentTemplateDetails() { } + + protected AssignmentTemplateDetails(Builder builder) { + id = builder.id; + version = builder.version; + } + + /** + * New builder. + * + * @return a AssignmentTemplateDetails builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * Policy template ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the version. + * + * Policy template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java new file mode 100644 index 00000000000..78291e6c2c5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The commitActionControlTemplate options. + */ +public class CommitActionControlTemplateOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing CommitActionControlTemplateOptions instance. + * + * @param commitActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(CommitActionControlTemplateOptions commitActionControlTemplateOptions) { + this.actionControlTemplateId = commitActionControlTemplateOptions.actionControlTemplateId; + this.version = commitActionControlTemplateOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + * @param version the version + */ + public Builder(String actionControlTemplateId, String version) { + this.actionControlTemplateId = actionControlTemplateId; + this.version = version; + } + + /** + * Builds a CommitActionControlTemplateOptions. + * + * @return the new CommitActionControlTemplateOptions instance + */ + public CommitActionControlTemplateOptions build() { + return new CommitActionControlTemplateOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the CommitActionControlTemplateOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the CommitActionControlTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected CommitActionControlTemplateOptions() { } + + protected CommitActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a CommitActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the version. + * + * The action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java new file mode 100644 index 00000000000..61283194c44 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The commitPolicyTemplate options. + */ +public class CommitPolicyTemplateOptions extends GenericModel { + + protected String policyTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing CommitPolicyTemplateOptions instance. + * + * @param commitPolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(CommitPolicyTemplateOptions commitPolicyTemplateOptions) { + this.policyTemplateId = commitPolicyTemplateOptions.policyTemplateId; + this.version = commitPolicyTemplateOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param version the version + */ + public Builder(String policyTemplateId, String version) { + this.policyTemplateId = policyTemplateId; + this.version = version; + } + + /** + * Builds a CommitPolicyTemplateOptions. + * + * @return the new CommitPolicyTemplateOptions instance + */ + public CommitPolicyTemplateOptions build() { + return new CommitPolicyTemplateOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the CommitPolicyTemplateOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the CommitPolicyTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected CommitPolicyTemplateOptions() { } + + protected CommitPolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + policyTemplateId = builder.policyTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a CommitPolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the version. + * + * The policy template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java new file mode 100644 index 00000000000..7e93c92fb0b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The commitRoleTemplate options. + */ +public class CommitRoleTemplateOptions extends GenericModel { + + protected String roleTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing CommitRoleTemplateOptions instance. + * + * @param commitRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(CommitRoleTemplateOptions commitRoleTemplateOptions) { + this.roleTemplateId = commitRoleTemplateOptions.roleTemplateId; + this.version = commitRoleTemplateOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + * @param version the version + */ + public Builder(String roleTemplateId, String version) { + this.roleTemplateId = roleTemplateId; + this.version = version; + } + + /** + * Builds a CommitRoleTemplateOptions. + * + * @return the new CommitRoleTemplateOptions instance + */ + public CommitRoleTemplateOptions build() { + return new CommitRoleTemplateOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the CommitRoleTemplateOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the CommitRoleTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected CommitRoleTemplateOptions() { } + + protected CommitRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + roleTemplateId = builder.roleTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a CommitRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the version. + * + * The role template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java new file mode 100644 index 00000000000..be0c3d0aa98 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java @@ -0,0 +1,62 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Details of conflicting resource. + */ +public class ConflictsWith extends GenericModel { + + protected String etag; + protected String role; + protected String policy; + + protected ConflictsWith() { } + + /** + * Gets the etag. + * + * The revision number of the resource. + * + * @return the etag + */ + public String getEtag() { + return etag; + } + + /** + * Gets the role. + * + * The conflicting role of ID. + * + * @return the role + */ + public String getRole() { + return role; + } + + /** + * Gets the policy. + * + * The conflicting policy ID. + * + * @return the policy + */ + public String getPolicy() { + return policy; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java new file mode 100644 index 00000000000..15e502ac214 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Specifies the type of access that is granted by the policy. + */ +public class Control extends GenericModel { + + protected Grant grant; + + /** + * Builder. + */ + public static class Builder { + private Grant grant; + + /** + * Instantiates a new Builder from an existing Control instance. + * + * @param control the instance to initialize the Builder with + */ + private Builder(Control control) { + this.grant = control.grant; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param grant the grant + */ + public Builder(Grant grant) { + this.grant = grant; + } + + /** + * Builds a Control. + * + * @return the new Control instance + */ + public Control build() { + return new Control(this); + } + + /** + * Set the grant. + * + * @param grant the grant + * @return the Control builder + */ + public Builder grant(Grant grant) { + this.grant = grant; + return this; + } + } + + protected Control() { } + + protected Control(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.grant, + "grant cannot be null"); + grant = builder.grant; + } + + /** + * New builder. + * + * @return a Control builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the grant. + * + * Permission is granted by the policy. + * + * @return the grant + */ + public Grant grant() { + return grant; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java new file mode 100644 index 00000000000..5055d290c80 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * ControlResponse. + * + * Classes which extend this class: + * - ControlResponseControl + * - ControlResponseControlWithEnrichedRoles + */ +public class ControlResponse extends GenericModel { + + protected Grant grant; + + protected ControlResponse() { } + + /** + * Gets the grant. + * + * Permission is granted by the policy. + * + * @return the grant + */ + public Grant getGrant() { + return grant; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java new file mode 100644 index 00000000000..5934ebf7c76 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java @@ -0,0 +1,24 @@ +/* + * (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_policy_management.v1.model; + +/** + * Specifies the type of access that is granted by the policy. + */ +public class ControlResponseControl extends ControlResponse { + + + protected ControlResponseControl() { } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java new file mode 100644 index 00000000000..8b3c73d73c0 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java @@ -0,0 +1,24 @@ +/* + * (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_policy_management.v1.model; + +/** + * Specifies the type of access that is granted by the policy with additional role information. + */ +public class ControlResponseControlWithEnrichedRoles extends ControlResponse { + + + protected ControlResponseControlWithEnrichedRoles() { } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java new file mode 100644 index 00000000000..1ccd3f8b4dd --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java @@ -0,0 +1,191 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createActionControlTemplateAssignment options. + */ +public class CreateActionControlTemplateAssignmentOptions extends GenericModel { + + protected AssignmentTargetDetails target; + protected List templates; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private AssignmentTargetDetails target; + private List templates; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateActionControlTemplateAssignmentOptions instance. + * + * @param createActionControlTemplateAssignmentOptions the instance to initialize the Builder with + */ + private Builder(CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptions) { + this.target = createActionControlTemplateAssignmentOptions.target; + this.templates = createActionControlTemplateAssignmentOptions.templates; + this.acceptLanguage = createActionControlTemplateAssignmentOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param target the target + * @param templates the templates + */ + public Builder(AssignmentTargetDetails target, List templates) { + this.target = target; + this.templates = templates; + } + + /** + * Builds a CreateActionControlTemplateAssignmentOptions. + * + * @return the new CreateActionControlTemplateAssignmentOptions instance + */ + public CreateActionControlTemplateAssignmentOptions build() { + return new CreateActionControlTemplateAssignmentOptions(this); + } + + /** + * Adds a new element to templates. + * + * @param templates the new element to be added + * @return the CreateActionControlTemplateAssignmentOptions builder + */ + public Builder addTemplates(ActionControlAssignmentTemplate templates) { + com.ibm.cloud.sdk.core.util.Validator.notNull(templates, + "templates cannot be null"); + if (this.templates == null) { + this.templates = new ArrayList(); + } + this.templates.add(templates); + return this; + } + + /** + * Set the target. + * + * @param target the target + * @return the CreateActionControlTemplateAssignmentOptions builder + */ + public Builder target(AssignmentTargetDetails target) { + this.target = target; + return this; + } + + /** + * Set the templates. + * Existing templates will be replaced. + * + * @param templates the templates + * @return the CreateActionControlTemplateAssignmentOptions builder + */ + public Builder templates(List templates) { + this.templates = templates; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateActionControlTemplateAssignmentOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateActionControlTemplateAssignmentOptions() { } + + protected CreateActionControlTemplateAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, + "target cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, + "templates cannot be null"); + target = builder.target; + templates = builder.templates; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateActionControlTemplateAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails target() { + return target; + } + + /** + * Gets the templates. + * + * List of action control template details for action control assignment. + * + * @return the templates + */ + public List templates() { + return templates; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java new file mode 100644 index 00000000000..37594a7a440 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java @@ -0,0 +1,251 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createActionControlTemplate options. + */ +public class CreateActionControlTemplateOptions extends GenericModel { + + protected String name; + protected String accountId; + protected String description; + protected Boolean committed; + protected TemplateActionControl actionControl; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String accountId; + private String description; + private Boolean committed; + private TemplateActionControl actionControl; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateActionControlTemplateOptions instance. + * + * @param createActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(CreateActionControlTemplateOptions createActionControlTemplateOptions) { + this.name = createActionControlTemplateOptions.name; + this.accountId = createActionControlTemplateOptions.accountId; + this.description = createActionControlTemplateOptions.description; + this.committed = createActionControlTemplateOptions.committed; + this.actionControl = createActionControlTemplateOptions.actionControl; + this.acceptLanguage = createActionControlTemplateOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param accountId the accountId + */ + public Builder(String name, String accountId) { + this.name = name; + this.accountId = accountId; + } + + /** + * Builds a CreateActionControlTemplateOptions. + * + * @return the new CreateActionControlTemplateOptions instance + */ + public CreateActionControlTemplateOptions build() { + return new CreateActionControlTemplateOptions(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateActionControlTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreateActionControlTemplateOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateActionControlTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreateActionControlTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + + /** + * Set the actionControl. + * + * @param actionControl the actionControl + * @return the CreateActionControlTemplateOptions builder + */ + public Builder actionControl(TemplateActionControl actionControl) { + this.actionControl = actionControl; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateActionControlTemplateOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateActionControlTemplateOptions() { } + + protected CreateActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + name = builder.name; + accountId = builder.accountId; + description = builder.description; + committed = builder.committed; + actionControl = builder.actionControl; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the description. + * + * Description of the action control template. This is shown to users in the enterprise account. Use this to describe + * the purpose or context of the action control for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template. If committed is set to true, then the template version can no longer be updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } + + /** + * Gets the actionControl. + * + * The action control properties that are created in an action resource when the template is assigned. + * + * @return the actionControl + */ + public TemplateActionControl actionControl() { + return actionControl; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java new file mode 100644 index 00000000000..13ce1a8e60f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java @@ -0,0 +1,211 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createActionControlTemplateVersion options. + */ +public class CreateActionControlTemplateVersionOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String name; + protected String description; + protected TemplateActionControl actionControl; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String name; + private String description; + private TemplateActionControl actionControl; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing CreateActionControlTemplateVersionOptions instance. + * + * @param createActionControlTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptions) { + this.actionControlTemplateId = createActionControlTemplateVersionOptions.actionControlTemplateId; + this.name = createActionControlTemplateVersionOptions.name; + this.description = createActionControlTemplateVersionOptions.description; + this.actionControl = createActionControlTemplateVersionOptions.actionControl; + this.committed = createActionControlTemplateVersionOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + */ + public Builder(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + } + + /** + * Builds a CreateActionControlTemplateVersionOptions. + * + * @return the new CreateActionControlTemplateVersionOptions instance + */ + public CreateActionControlTemplateVersionOptions build() { + return new CreateActionControlTemplateVersionOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actionControl. + * + * @param actionControl the actionControl + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder actionControl(TemplateActionControl actionControl) { + this.actionControl = actionControl; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreateActionControlTemplateVersionOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected CreateActionControlTemplateVersionOptions() { } + + protected CreateActionControlTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + name = builder.name; + description = builder.description; + actionControl = builder.actionControl; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a CreateActionControlTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * The action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will + * change the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the action control template. This is shown to users in the enterprise account. Use this to describe + * the purpose or context of the action control for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actionControl. + * + * The action control properties that are created in an action resource when the template is assigned. + * + * @return the actionControl + */ + public TemplateActionControl actionControl() { + return actionControl; + } + + /** + * Gets the committed. + * + * Committed status of the template version. If committed is set to true, then the template version can no longer be + * updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java new file mode 100644 index 00000000000..b6ec9f78c02 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java @@ -0,0 +1,311 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createPolicy options. + */ +public class CreatePolicyOptions extends GenericModel { + + protected String type; + protected List subjects; + protected List roles; + protected List resources; + protected String description; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String type; + private List subjects; + private List roles; + private List resources; + private String description; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreatePolicyOptions instance. + * + * @param createPolicyOptions the instance to initialize the Builder with + */ + private Builder(CreatePolicyOptions createPolicyOptions) { + this.type = createPolicyOptions.type; + this.subjects = createPolicyOptions.subjects; + this.roles = createPolicyOptions.roles; + this.resources = createPolicyOptions.resources; + this.description = createPolicyOptions.description; + this.acceptLanguage = createPolicyOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param type the type + * @param subjects the subjects + * @param roles the roles + * @param resources the resources + */ + public Builder(String type, List subjects, List roles, List resources) { + this.type = type; + this.subjects = subjects; + this.roles = roles; + this.resources = resources; + } + + /** + * Builds a CreatePolicyOptions. + * + * @return the new CreatePolicyOptions instance + */ + public CreatePolicyOptions build() { + return new CreatePolicyOptions(this); + } + + /** + * Adds a new element to subjects. + * + * @param subjects the new element to be added + * @return the CreatePolicyOptions builder + */ + public Builder addSubjects(PolicySubject subjects) { + com.ibm.cloud.sdk.core.util.Validator.notNull(subjects, + "subjects cannot be null"); + if (this.subjects == null) { + this.subjects = new ArrayList(); + } + this.subjects.add(subjects); + return this; + } + + /** + * Adds a new element to roles. + * + * @param roles the new element to be added + * @return the CreatePolicyOptions builder + */ + public Builder addRoles(PolicyRole roles) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roles, + "roles cannot be null"); + if (this.roles == null) { + this.roles = new ArrayList(); + } + this.roles.add(roles); + return this; + } + + /** + * Adds a new element to resources. + * + * @param resources the new element to be added + * @return the CreatePolicyOptions builder + */ + public Builder addResources(PolicyResource resources) { + com.ibm.cloud.sdk.core.util.Validator.notNull(resources, + "resources cannot be null"); + if (this.resources == null) { + this.resources = new ArrayList(); + } + this.resources.add(resources); + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the CreatePolicyOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the subjects. + * Existing subjects will be replaced. + * + * @param subjects the subjects + * @return the CreatePolicyOptions builder + */ + public Builder subjects(List subjects) { + this.subjects = subjects; + return this; + } + + /** + * Set the roles. + * Existing roles will be replaced. + * + * @param roles the roles + * @return the CreatePolicyOptions builder + */ + public Builder roles(List roles) { + this.roles = roles; + return this; + } + + /** + * Set the resources. + * Existing resources will be replaced. + * + * @param resources the resources + * @return the CreatePolicyOptions builder + */ + public Builder resources(List resources) { + this.resources = resources; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreatePolicyOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreatePolicyOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreatePolicyOptions() { } + + protected CreatePolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subjects, + "subjects cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, + "roles cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resources, + "resources cannot be null"); + type = builder.type; + subjects = builder.subjects; + roles = builder.roles; + resources = builder.resources; + description = builder.description; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreatePolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the subjects. + * + * The subjects associated with a policy. + * + * @return the subjects + */ + public List subjects() { + return subjects; + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List roles() { + return roles; + } + + /** + * Gets the resources. + * + * The resources associated with a policy. + * + * @return the resources + */ + public List resources() { + return resources; + } + + /** + * Gets the description. + * + * Customer-defined description. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java new file mode 100644 index 00000000000..b71ca393f11 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java @@ -0,0 +1,221 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createPolicyTemplateAssignment options. + */ +public class CreatePolicyTemplateAssignmentOptions extends GenericModel { + + protected String version; + protected AssignmentTargetDetails target; + protected List templates; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String version; + private AssignmentTargetDetails target; + private List templates; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreatePolicyTemplateAssignmentOptions instance. + * + * @param createPolicyTemplateAssignmentOptions the instance to initialize the Builder with + */ + private Builder(CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptions) { + this.version = createPolicyTemplateAssignmentOptions.version; + this.target = createPolicyTemplateAssignmentOptions.target; + this.templates = createPolicyTemplateAssignmentOptions.templates; + this.acceptLanguage = createPolicyTemplateAssignmentOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param version the version + * @param target the target + * @param templates the templates + */ + public Builder(String version, AssignmentTargetDetails target, List templates) { + this.version = version; + this.target = target; + this.templates = templates; + } + + /** + * Builds a CreatePolicyTemplateAssignmentOptions. + * + * @return the new CreatePolicyTemplateAssignmentOptions instance + */ + public CreatePolicyTemplateAssignmentOptions build() { + return new CreatePolicyTemplateAssignmentOptions(this); + } + + /** + * Adds a new element to templates. + * + * @param templates the new element to be added + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder addTemplates(AssignmentTemplateDetails templates) { + com.ibm.cloud.sdk.core.util.Validator.notNull(templates, + "templates cannot be null"); + if (this.templates == null) { + this.templates = new ArrayList(); + } + this.templates.add(templates); + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the target. + * + * @param target the target + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder target(AssignmentTargetDetails target) { + this.target = target; + return this; + } + + /** + * Set the templates. + * Existing templates will be replaced. + * + * @param templates the templates + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder templates(List templates) { + this.templates = templates; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreatePolicyTemplateAssignmentOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreatePolicyTemplateAssignmentOptions() { } + + protected CreatePolicyTemplateAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, + "target cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, + "templates cannot be null"); + version = builder.version; + target = builder.target; + templates = builder.templates; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreatePolicyTemplateAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the version. + * + * specify version of response body format. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails target() { + return target; + } + + /** + * Gets the templates. + * + * List of template details for policy assignment. + * + * @return the templates + */ + public List templates() { + return templates; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java new file mode 100644 index 00000000000..72944308428 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java @@ -0,0 +1,255 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createPolicyTemplate options. + */ +public class CreatePolicyTemplateOptions extends GenericModel { + + protected String name; + protected String accountId; + protected TemplatePolicy policy; + protected String description; + protected Boolean committed; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String accountId; + private TemplatePolicy policy; + private String description; + private Boolean committed; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreatePolicyTemplateOptions instance. + * + * @param createPolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(CreatePolicyTemplateOptions createPolicyTemplateOptions) { + this.name = createPolicyTemplateOptions.name; + this.accountId = createPolicyTemplateOptions.accountId; + this.policy = createPolicyTemplateOptions.policy; + this.description = createPolicyTemplateOptions.description; + this.committed = createPolicyTemplateOptions.committed; + this.acceptLanguage = createPolicyTemplateOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param accountId the accountId + * @param policy the policy + */ + public Builder(String name, String accountId, TemplatePolicy policy) { + this.name = name; + this.accountId = accountId; + this.policy = policy; + } + + /** + * Builds a CreatePolicyTemplateOptions. + * + * @return the new CreatePolicyTemplateOptions instance + */ + public CreatePolicyTemplateOptions build() { + return new CreatePolicyTemplateOptions(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the CreatePolicyTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreatePolicyTemplateOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the policy. + * + * @param policy the policy + * @return the CreatePolicyTemplateOptions builder + */ + public Builder policy(TemplatePolicy policy) { + this.policy = policy; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreatePolicyTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreatePolicyTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreatePolicyTemplateOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreatePolicyTemplateOptions() { } + + protected CreatePolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.policy, + "policy cannot be null"); + name = builder.name; + accountId = builder.accountId; + policy = builder.policy; + description = builder.description; + committed = builder.committed; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreatePolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy policy() { + return policy; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java new file mode 100644 index 00000000000..6903774c335 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java @@ -0,0 +1,214 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createPolicyTemplateVersion options. + */ +public class CreatePolicyTemplateVersionOptions extends GenericModel { + + protected String policyTemplateId; + protected TemplatePolicy policy; + protected String name; + protected String description; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private TemplatePolicy policy; + private String name; + private String description; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing CreatePolicyTemplateVersionOptions instance. + * + * @param createPolicyTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptions) { + this.policyTemplateId = createPolicyTemplateVersionOptions.policyTemplateId; + this.policy = createPolicyTemplateVersionOptions.policy; + this.name = createPolicyTemplateVersionOptions.name; + this.description = createPolicyTemplateVersionOptions.description; + this.committed = createPolicyTemplateVersionOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param policy the policy + */ + public Builder(String policyTemplateId, TemplatePolicy policy) { + this.policyTemplateId = policyTemplateId; + this.policy = policy; + } + + /** + * Builds a CreatePolicyTemplateVersionOptions. + * + * @return the new CreatePolicyTemplateVersionOptions instance + */ + public CreatePolicyTemplateVersionOptions build() { + return new CreatePolicyTemplateVersionOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the policy. + * + * @param policy the policy + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder policy(TemplatePolicy policy) { + this.policy = policy; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreatePolicyTemplateVersionOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected CreatePolicyTemplateVersionOptions() { } + + protected CreatePolicyTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.policy, + "policy cannot be null"); + policyTemplateId = builder.policyTemplateId; + policy = builder.policy; + name = builder.name; + description = builder.description; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a CreatePolicyTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy policy() { + return policy; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template version. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java new file mode 100644 index 00000000000..725ec5d8a53 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java @@ -0,0 +1,308 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createRole options. + */ +public class CreateRoleOptions extends GenericModel { + + protected String displayName; + protected List actions; + protected String name; + protected String accountId; + protected String serviceName; + protected String description; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String displayName; + private List actions; + private String name; + private String accountId; + private String serviceName; + private String description; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateRoleOptions instance. + * + * @param createRoleOptions the instance to initialize the Builder with + */ + private Builder(CreateRoleOptions createRoleOptions) { + this.displayName = createRoleOptions.displayName; + this.actions = createRoleOptions.actions; + this.name = createRoleOptions.name; + this.accountId = createRoleOptions.accountId; + this.serviceName = createRoleOptions.serviceName; + this.description = createRoleOptions.description; + this.acceptLanguage = createRoleOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param displayName the displayName + * @param actions the actions + * @param name the name + * @param accountId the accountId + * @param serviceName the serviceName + */ + public Builder(String displayName, List actions, String name, String accountId, String serviceName) { + this.displayName = displayName; + this.actions = actions; + this.name = name; + this.accountId = accountId; + this.serviceName = serviceName; + } + + /** + * Builds a CreateRoleOptions. + * + * @return the new CreateRoleOptions instance + */ + public CreateRoleOptions build() { + return new CreateRoleOptions(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the CreateRoleOptions builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the CreateRoleOptions builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the CreateRoleOptions builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateRoleOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreateRoleOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the CreateRoleOptions builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateRoleOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateRoleOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateRoleOptions() { } + + protected CreateRoleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, + "serviceName cannot be null"); + displayName = builder.displayName; + actions = builder.actions; + name = builder.name; + accountId = builder.accountId; + serviceName = builder.serviceName; + description = builder.description; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateRoleOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List actions() { + return actions; + } + + /** + * Gets the name. + * + * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the accountId. + * + * The account GUID. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the serviceName. + * + * The service name. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java new file mode 100644 index 00000000000..c9bef88e703 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java @@ -0,0 +1,191 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createRoleTemplateAssignment options. + */ +public class CreateRoleTemplateAssignmentOptions extends GenericModel { + + protected AssignmentTargetDetails target; + protected List templates; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private AssignmentTargetDetails target; + private List templates; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateRoleTemplateAssignmentOptions instance. + * + * @param createRoleTemplateAssignmentOptions the instance to initialize the Builder with + */ + private Builder(CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptions) { + this.target = createRoleTemplateAssignmentOptions.target; + this.templates = createRoleTemplateAssignmentOptions.templates; + this.acceptLanguage = createRoleTemplateAssignmentOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param target the target + * @param templates the templates + */ + public Builder(AssignmentTargetDetails target, List templates) { + this.target = target; + this.templates = templates; + } + + /** + * Builds a CreateRoleTemplateAssignmentOptions. + * + * @return the new CreateRoleTemplateAssignmentOptions instance + */ + public CreateRoleTemplateAssignmentOptions build() { + return new CreateRoleTemplateAssignmentOptions(this); + } + + /** + * Adds a new element to templates. + * + * @param templates the new element to be added + * @return the CreateRoleTemplateAssignmentOptions builder + */ + public Builder addTemplates(RoleAssignmentTemplate templates) { + com.ibm.cloud.sdk.core.util.Validator.notNull(templates, + "templates cannot be null"); + if (this.templates == null) { + this.templates = new ArrayList(); + } + this.templates.add(templates); + return this; + } + + /** + * Set the target. + * + * @param target the target + * @return the CreateRoleTemplateAssignmentOptions builder + */ + public Builder target(AssignmentTargetDetails target) { + this.target = target; + return this; + } + + /** + * Set the templates. + * Existing templates will be replaced. + * + * @param templates the templates + * @return the CreateRoleTemplateAssignmentOptions builder + */ + public Builder templates(List templates) { + this.templates = templates; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateRoleTemplateAssignmentOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateRoleTemplateAssignmentOptions() { } + + protected CreateRoleTemplateAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, + "target cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, + "templates cannot be null"); + target = builder.target; + templates = builder.templates; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateRoleTemplateAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails target() { + return target; + } + + /** + * Gets the templates. + * + * List of role template details for role assignment. + * + * @return the templates + */ + public List templates() { + return templates; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java new file mode 100644 index 00000000000..baf82e17961 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java @@ -0,0 +1,251 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createRoleTemplate options. + */ +public class CreateRoleTemplateOptions extends GenericModel { + + protected String name; + protected String accountId; + protected String description; + protected Boolean committed; + protected RoleTemplatePrototypeRole role; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String accountId; + private String description; + private Boolean committed; + private RoleTemplatePrototypeRole role; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateRoleTemplateOptions instance. + * + * @param createRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(CreateRoleTemplateOptions createRoleTemplateOptions) { + this.name = createRoleTemplateOptions.name; + this.accountId = createRoleTemplateOptions.accountId; + this.description = createRoleTemplateOptions.description; + this.committed = createRoleTemplateOptions.committed; + this.role = createRoleTemplateOptions.role; + this.acceptLanguage = createRoleTemplateOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param accountId the accountId + */ + public Builder(String name, String accountId) { + this.name = name; + this.accountId = accountId; + } + + /** + * Builds a CreateRoleTemplateOptions. + * + * @return the new CreateRoleTemplateOptions instance + */ + public CreateRoleTemplateOptions build() { + return new CreateRoleTemplateOptions(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateRoleTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreateRoleTemplateOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateRoleTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreateRoleTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + + /** + * Set the role. + * + * @param role the role + * @return the CreateRoleTemplateOptions builder + */ + public Builder role(RoleTemplatePrototypeRole role) { + this.role = role; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateRoleTemplateOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateRoleTemplateOptions() { } + + protected CreateRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + name = builder.name; + accountId = builder.accountId; + description = builder.description; + committed = builder.committed; + role = builder.role; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the description. + * + * Description of the role template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the role for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template. If committed is set to true, then the template version can no longer be updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } + + /** + * Gets the role. + * + * The role properties that are created in an action resource when the template is assigned. + * + * @return the role + */ + public RoleTemplatePrototypeRole role() { + return role; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java new file mode 100644 index 00000000000..c322c5a332d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java @@ -0,0 +1,211 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createRoleTemplateVersion options. + */ +public class CreateRoleTemplateVersionOptions extends GenericModel { + + protected String roleTemplateId; + protected String name; + protected String description; + protected TemplateRole role; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String name; + private String description; + private TemplateRole role; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing CreateRoleTemplateVersionOptions instance. + * + * @param createRoleTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(CreateRoleTemplateVersionOptions createRoleTemplateVersionOptions) { + this.roleTemplateId = createRoleTemplateVersionOptions.roleTemplateId; + this.name = createRoleTemplateVersionOptions.name; + this.description = createRoleTemplateVersionOptions.description; + this.role = createRoleTemplateVersionOptions.role; + this.committed = createRoleTemplateVersionOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + */ + public Builder(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + } + + /** + * Builds a CreateRoleTemplateVersionOptions. + * + * @return the new CreateRoleTemplateVersionOptions instance + */ + public CreateRoleTemplateVersionOptions build() { + return new CreateRoleTemplateVersionOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the role. + * + * @param role the role + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder role(TemplateRole role) { + this.role = role; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the CreateRoleTemplateVersionOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected CreateRoleTemplateVersionOptions() { } + + protected CreateRoleTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + roleTemplateId = builder.roleTemplateId; + name = builder.name; + description = builder.description; + role = builder.role; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a CreateRoleTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * The role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will + * change the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the role template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the role for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the role. + * + * The role properties that are created in an action resource when the template is assigned. + * + * @return the role + */ + public TemplateRole role() { + return role; + } + + /** + * Gets the committed. + * + * Committed status of the template version. If committed is set to true, then the template version can no longer be + * updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java new file mode 100644 index 00000000000..59ccb4b908a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java @@ -0,0 +1,312 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createV2Policy options. + */ +public class CreateV2PolicyOptions extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + protected Control control; + protected String type; + protected String description; + protected V2PolicySubject subject; + protected V2PolicyResource resource; + protected String pattern; + protected V2PolicyRule rule; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private Control control; + private String type; + private String description; + private V2PolicySubject subject; + private V2PolicyResource resource; + private String pattern; + private V2PolicyRule rule; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing CreateV2PolicyOptions instance. + * + * @param createV2PolicyOptions the instance to initialize the Builder with + */ + private Builder(CreateV2PolicyOptions createV2PolicyOptions) { + this.control = createV2PolicyOptions.control; + this.type = createV2PolicyOptions.type; + this.description = createV2PolicyOptions.description; + this.subject = createV2PolicyOptions.subject; + this.resource = createV2PolicyOptions.resource; + this.pattern = createV2PolicyOptions.pattern; + this.rule = createV2PolicyOptions.rule; + this.acceptLanguage = createV2PolicyOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param control the control + * @param type the type + */ + public Builder(Control control, String type) { + this.control = control; + this.type = type; + } + + /** + * Builds a CreateV2PolicyOptions. + * + * @return the new CreateV2PolicyOptions instance + */ + public CreateV2PolicyOptions build() { + return new CreateV2PolicyOptions(this); + } + + /** + * Set the control. + * + * @param control the control + * @return the CreateV2PolicyOptions builder + */ + public Builder control(Control control) { + this.control = control; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the CreateV2PolicyOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateV2PolicyOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the subject. + * + * @param subject the subject + * @return the CreateV2PolicyOptions builder + */ + public Builder subject(V2PolicySubject subject) { + this.subject = subject; + return this; + } + + /** + * Set the resource. + * + * @param resource the resource + * @return the CreateV2PolicyOptions builder + */ + public Builder resource(V2PolicyResource resource) { + this.resource = resource; + return this; + } + + /** + * Set the pattern. + * + * @param pattern the pattern + * @return the CreateV2PolicyOptions builder + */ + public Builder pattern(String pattern) { + this.pattern = pattern; + return this; + } + + /** + * Set the rule. + * + * @param rule the rule + * @return the CreateV2PolicyOptions builder + */ + public Builder rule(V2PolicyRule rule) { + this.rule = rule; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the CreateV2PolicyOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected CreateV2PolicyOptions() { } + + protected CreateV2PolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.control, + "control cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + control = builder.control; + type = builder.type; + description = builder.description; + subject = builder.subject; + resource = builder.resource; + pattern = builder.pattern; + rule = builder.rule; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a CreateV2PolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the control. + * + * Specifies the type of access that is granted by the policy. + * + * @return the control + */ + public Control control() { + return control; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject subject() { + return subject; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource resource() { + return resource; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String pattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule rule() { + return rule; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java new file mode 100644 index 00000000000..f5e35c13d9f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java @@ -0,0 +1,195 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * An additional set of properties associated with a role. + */ +public class CustomRole extends GenericModel { + + protected String id; + @SerializedName("display_name") + protected String displayName; + protected String description; + protected List actions; + protected String crn; + protected String name; + @SerializedName("account_id") + protected String accountId; + @SerializedName("service_name") + protected String serviceName; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String href; + + protected CustomRole() { } + + /** + * Gets the id. + * + * The role ID. Composed of hexadecimal characters. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String getDisplayName() { + return displayName; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List getActions() { + return actions; + } + + /** + * Gets the crn. + * + * The role Cloud Resource Name (CRN). Example CRN: + * 'crn:v1:ibmcloud:public:iam-access-management::a/exampleAccountId::customRole:ExampleRoleName'. + * + * @return the crn + */ + public String getCrn() { + return crn; + } + + /** + * Gets the name. + * + * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the accountId. + * + * The account GUID. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the serviceName. + * + * The service name. + * + * @return the serviceName + */ + public String getServiceName() { + return serviceName; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the role was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the role. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the role was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the href. + * + * The href links back to the role. + * + * @return the href + */ + public String getHref() { + return href; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java new file mode 100644 index 00000000000..f71d2c2ab9d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteActionControlAssignment options. + */ +public class DeleteActionControlAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing DeleteActionControlAssignmentOptions instance. + * + * @param deleteActionControlAssignmentOptions the instance to initialize the Builder with + */ + private Builder(DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptions) { + this.assignmentId = deleteActionControlAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a DeleteActionControlAssignmentOptions. + * + * @return the new DeleteActionControlAssignmentOptions instance + */ + public DeleteActionControlAssignmentOptions build() { + return new DeleteActionControlAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the DeleteActionControlAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected DeleteActionControlAssignmentOptions() { } + + protected DeleteActionControlAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a DeleteActionControlAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Action control template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java new file mode 100644 index 00000000000..6ff35d83603 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteActionControlTemplate options. + */ +public class DeleteActionControlTemplateOptions extends GenericModel { + + protected String actionControlTemplateId; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + + /** + * Instantiates a new Builder from an existing DeleteActionControlTemplateOptions instance. + * + * @param deleteActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(DeleteActionControlTemplateOptions deleteActionControlTemplateOptions) { + this.actionControlTemplateId = deleteActionControlTemplateOptions.actionControlTemplateId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + */ + public Builder(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + } + + /** + * Builds a DeleteActionControlTemplateOptions. + * + * @return the new DeleteActionControlTemplateOptions instance + */ + public DeleteActionControlTemplateOptions build() { + return new DeleteActionControlTemplateOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the DeleteActionControlTemplateOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + } + + protected DeleteActionControlTemplateOptions() { } + + protected DeleteActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + } + + /** + * New builder. + * + * @return a DeleteActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java new file mode 100644 index 00000000000..69aca0555a1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteActionControlTemplateVersion options. + */ +public class DeleteActionControlTemplateVersionOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing DeleteActionControlTemplateVersionOptions instance. + * + * @param deleteActionControlTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptions) { + this.actionControlTemplateId = deleteActionControlTemplateVersionOptions.actionControlTemplateId; + this.version = deleteActionControlTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + * @param version the version + */ + public Builder(String actionControlTemplateId, String version) { + this.actionControlTemplateId = actionControlTemplateId; + this.version = version; + } + + /** + * Builds a DeleteActionControlTemplateVersionOptions. + * + * @return the new DeleteActionControlTemplateVersionOptions instance + */ + public DeleteActionControlTemplateVersionOptions build() { + return new DeleteActionControlTemplateVersionOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the DeleteActionControlTemplateVersionOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the DeleteActionControlTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected DeleteActionControlTemplateVersionOptions() { } + + protected DeleteActionControlTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a DeleteActionControlTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java new file mode 100644 index 00000000000..3ab2cf17469 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deletePolicyAssignment options. + */ +public class DeletePolicyAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing DeletePolicyAssignmentOptions instance. + * + * @param deletePolicyAssignmentOptions the instance to initialize the Builder with + */ + private Builder(DeletePolicyAssignmentOptions deletePolicyAssignmentOptions) { + this.assignmentId = deletePolicyAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a DeletePolicyAssignmentOptions. + * + * @return the new DeletePolicyAssignmentOptions instance + */ + public DeletePolicyAssignmentOptions build() { + return new DeletePolicyAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the DeletePolicyAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected DeletePolicyAssignmentOptions() { } + + protected DeletePolicyAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a DeletePolicyAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * The policy template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java new file mode 100644 index 00000000000..fe070b2064a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deletePolicy options. + */ +public class DeletePolicyOptions extends GenericModel { + + protected String policyId; + + /** + * Builder. + */ + public static class Builder { + private String policyId; + + /** + * Instantiates a new Builder from an existing DeletePolicyOptions instance. + * + * @param deletePolicyOptions the instance to initialize the Builder with + */ + private Builder(DeletePolicyOptions deletePolicyOptions) { + this.policyId = deletePolicyOptions.policyId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyId the policyId + */ + public Builder(String policyId) { + this.policyId = policyId; + } + + /** + * Builds a DeletePolicyOptions. + * + * @return the new DeletePolicyOptions instance + */ + public DeletePolicyOptions build() { + return new DeletePolicyOptions(this); + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the DeletePolicyOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + } + + protected DeletePolicyOptions() { } + + protected DeletePolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId cannot be empty"); + policyId = builder.policyId; + } + + /** + * New builder. + * + * @return a DeletePolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyId. + * + * The policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java new file mode 100644 index 00000000000..bb70b0d6727 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deletePolicyTemplate options. + */ +public class DeletePolicyTemplateOptions extends GenericModel { + + protected String policyTemplateId; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + + /** + * Instantiates a new Builder from an existing DeletePolicyTemplateOptions instance. + * + * @param deletePolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(DeletePolicyTemplateOptions deletePolicyTemplateOptions) { + this.policyTemplateId = deletePolicyTemplateOptions.policyTemplateId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + */ + public Builder(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + } + + /** + * Builds a DeletePolicyTemplateOptions. + * + * @return the new DeletePolicyTemplateOptions instance + */ + public DeletePolicyTemplateOptions build() { + return new DeletePolicyTemplateOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the DeletePolicyTemplateOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + } + + protected DeletePolicyTemplateOptions() { } + + protected DeletePolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + policyTemplateId = builder.policyTemplateId; + } + + /** + * New builder. + * + * @return a DeletePolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java new file mode 100644 index 00000000000..9a04a5157b6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deletePolicyTemplateVersion options. + */ +public class DeletePolicyTemplateVersionOptions extends GenericModel { + + protected String policyTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing DeletePolicyTemplateVersionOptions instance. + * + * @param deletePolicyTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptions) { + this.policyTemplateId = deletePolicyTemplateVersionOptions.policyTemplateId; + this.version = deletePolicyTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param version the version + */ + public Builder(String policyTemplateId, String version) { + this.policyTemplateId = policyTemplateId; + this.version = version; + } + + /** + * Builds a DeletePolicyTemplateVersionOptions. + * + * @return the new DeletePolicyTemplateVersionOptions instance + */ + public DeletePolicyTemplateVersionOptions build() { + return new DeletePolicyTemplateVersionOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the DeletePolicyTemplateVersionOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the DeletePolicyTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected DeletePolicyTemplateVersionOptions() { } + + protected DeletePolicyTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + policyTemplateId = builder.policyTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a DeletePolicyTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the version. + * + * The policy template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java new file mode 100644 index 00000000000..b9341a9f414 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteRoleAssignment options. + */ +public class DeleteRoleAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing DeleteRoleAssignmentOptions instance. + * + * @param deleteRoleAssignmentOptions the instance to initialize the Builder with + */ + private Builder(DeleteRoleAssignmentOptions deleteRoleAssignmentOptions) { + this.assignmentId = deleteRoleAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a DeleteRoleAssignmentOptions. + * + * @return the new DeleteRoleAssignmentOptions instance + */ + public DeleteRoleAssignmentOptions build() { + return new DeleteRoleAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the DeleteRoleAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected DeleteRoleAssignmentOptions() { } + + protected DeleteRoleAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a DeleteRoleAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Role template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java new file mode 100644 index 00000000000..8675777719e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteRole options. + */ +public class DeleteRoleOptions extends GenericModel { + + protected String roleId; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + + /** + * Instantiates a new Builder from an existing DeleteRoleOptions instance. + * + * @param deleteRoleOptions the instance to initialize the Builder with + */ + private Builder(DeleteRoleOptions deleteRoleOptions) { + this.roleId = deleteRoleOptions.roleId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + */ + public Builder(String roleId) { + this.roleId = roleId; + } + + /** + * Builds a DeleteRoleOptions. + * + * @return the new DeleteRoleOptions instance + */ + public DeleteRoleOptions build() { + return new DeleteRoleOptions(this); + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the DeleteRoleOptions builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + } + + protected DeleteRoleOptions() { } + + protected DeleteRoleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, + "roleId cannot be empty"); + roleId = builder.roleId; + } + + /** + * New builder. + * + * @return a DeleteRoleOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role ID. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java new file mode 100644 index 00000000000..c76bf3bfda4 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteRoleTemplate options. + */ +public class DeleteRoleTemplateOptions extends GenericModel { + + protected String roleTemplateId; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + + /** + * Instantiates a new Builder from an existing DeleteRoleTemplateOptions instance. + * + * @param deleteRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(DeleteRoleTemplateOptions deleteRoleTemplateOptions) { + this.roleTemplateId = deleteRoleTemplateOptions.roleTemplateId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + */ + public Builder(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + } + + /** + * Builds a DeleteRoleTemplateOptions. + * + * @return the new DeleteRoleTemplateOptions instance + */ + public DeleteRoleTemplateOptions build() { + return new DeleteRoleTemplateOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the DeleteRoleTemplateOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + } + + protected DeleteRoleTemplateOptions() { } + + protected DeleteRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + roleTemplateId = builder.roleTemplateId; + } + + /** + * New builder. + * + * @return a DeleteRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java new file mode 100644 index 00000000000..9f974213165 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteRoleTemplateVersion options. + */ +public class DeleteRoleTemplateVersionOptions extends GenericModel { + + protected String roleTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing DeleteRoleTemplateVersionOptions instance. + * + * @param deleteRoleTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptions) { + this.roleTemplateId = deleteRoleTemplateVersionOptions.roleTemplateId; + this.version = deleteRoleTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + * @param version the version + */ + public Builder(String roleTemplateId, String version) { + this.roleTemplateId = roleTemplateId; + this.version = version; + } + + /** + * Builds a DeleteRoleTemplateVersionOptions. + * + * @return the new DeleteRoleTemplateVersionOptions instance + */ + public DeleteRoleTemplateVersionOptions build() { + return new DeleteRoleTemplateVersionOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the DeleteRoleTemplateVersionOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the DeleteRoleTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected DeleteRoleTemplateVersionOptions() { } + + protected DeleteRoleTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + roleTemplateId = builder.roleTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a DeleteRoleTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the version. + * + * Role template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java new file mode 100644 index 00000000000..92c1caaa34c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteV2Policy options. + */ +public class DeleteV2PolicyOptions extends GenericModel { + + protected String id; + + /** + * Builder. + */ + public static class Builder { + private String id; + + /** + * Instantiates a new Builder from an existing DeleteV2PolicyOptions instance. + * + * @param deleteV2PolicyOptions the instance to initialize the Builder with + */ + private Builder(DeleteV2PolicyOptions deleteV2PolicyOptions) { + this.id = deleteV2PolicyOptions.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 DeleteV2PolicyOptions. + * + * @return the new DeleteV2PolicyOptions instance + */ + public DeleteV2PolicyOptions build() { + return new DeleteV2PolicyOptions(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the DeleteV2PolicyOptions builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + } + + protected DeleteV2PolicyOptions() { } + + protected DeleteV2PolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, + "id cannot be empty"); + id = builder.id; + } + + /** + * New builder. + * + * @return a DeleteV2PolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String id() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java new file mode 100644 index 00000000000..0978eb1040b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java @@ -0,0 +1,81 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role associated with a policy with additional information (display_name, description, actions) when + * `format=display`. + */ +public class EnrichedRoles extends GenericModel { + + @SerializedName("role_id") + protected String roleId; + @SerializedName("display_name") + protected String displayName; + protected String description; + protected List actions; + + protected EnrichedRoles() { } + + /** + * Gets the roleId. + * + * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. + * + * @return the roleId + */ + public String getRoleId() { + return roleId; + } + + /** + * Gets the displayName. + * + * The display name of the role, either service-defined or user-defined for custom roles. + * + * @return the displayName + */ + public String getDisplayName() { + return displayName; + } + + /** + * Gets the description. + * + * The role description, either service-defined or user-defined for custom roles. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List getActions() { + return actions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java new file mode 100644 index 00000000000..e99ea48f5f6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Additional error details. + */ +public class ErrorDetails extends GenericModel { + + @SerializedName("conflicts_with") + protected ConflictsWith conflictsWith; + + protected ErrorDetails() { } + + /** + * Gets the conflictsWith. + * + * Details of conflicting resource. + * + * @return the conflictsWith + */ + public ConflictsWith getConflictsWith() { + return conflictsWith; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java new file mode 100644 index 00000000000..b5411a7bb36 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java @@ -0,0 +1,128 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * ErrorObject. + */ +public class ErrorObject extends GenericModel { + + /** + * The API error code for the error. + */ + public interface Code { + /** insufficent_permissions. */ + String INSUFFICENT_PERMISSIONS = "insufficent_permissions"; + /** invalid_body. */ + String INVALID_BODY = "invalid_body"; + /** invalid_token. */ + String INVALID_TOKEN = "invalid_token"; + /** missing_required_query_parameter. */ + String MISSING_REQUIRED_QUERY_PARAMETER = "missing_required_query_parameter"; + /** not_found. */ + String NOT_FOUND = "not_found"; + /** policy_conflict_error. */ + String POLICY_CONFLICT_ERROR = "policy_conflict_error"; + /** policy_not_found. */ + String POLICY_NOT_FOUND = "policy_not_found"; + /** request_not_processed. */ + String REQUEST_NOT_PROCESSED = "request_not_processed"; + /** role_conflict_error. */ + String ROLE_CONFLICT_ERROR = "role_conflict_error"; + /** role_not_found. */ + String ROLE_NOT_FOUND = "role_not_found"; + /** too_many_requests. */ + String TOO_MANY_REQUESTS = "too_many_requests"; + /** unable_to_process. */ + String UNABLE_TO_PROCESS = "unable_to_process"; + /** unsupported_content_type. */ + String UNSUPPORTED_CONTENT_TYPE = "unsupported_content_type"; + /** policy_template_conflict_error. */ + String POLICY_TEMPLATE_CONFLICT_ERROR = "policy_template_conflict_error"; + /** policy_template_not_found. */ + String POLICY_TEMPLATE_NOT_FOUND = "policy_template_not_found"; + /** policy_assignment_not_found. */ + String POLICY_ASSIGNMENT_NOT_FOUND = "policy_assignment_not_found"; + /** policy_assignment_conflict_error. */ + String POLICY_ASSIGNMENT_CONFLICT_ERROR = "policy_assignment_conflict_error"; + /** resource_not_found. */ + String RESOURCE_NOT_FOUND = "resource_not_found"; + /** action_control_template_not_found. */ + String ACTION_CONTROL_TEMPLATE_NOT_FOUND = "action_control_template_not_found"; + /** action_control_assignment_not_found. */ + String ACTION_CONTROL_ASSIGNMENT_NOT_FOUND = "action_control_assignment_not_found"; + /** role_template_conflict_error. */ + String ROLE_TEMPLATE_CONFLICT_ERROR = "role_template_conflict_error"; + /** role_template_not_found. */ + String ROLE_TEMPLATE_NOT_FOUND = "role_template_not_found"; + /** role_assignment_not_found. */ + String ROLE_ASSIGNMENT_NOT_FOUND = "role_assignment_not_found"; + } + + protected String code; + protected String message; + protected ErrorDetails details; + @SerializedName("more_info") + protected String moreInfo; + + protected ErrorObject() { } + + /** + * Gets the code. + * + * The API error code for the error. + * + * @return the code + */ + public String getCode() { + return code; + } + + /** + * Gets the message. + * + * The error message returned by the API. + * + * @return the message + */ + public String getMessage() { + return message; + } + + /** + * Gets the details. + * + * Additional error details. + * + * @return the details + */ + public ErrorDetails getDetails() { + return details; + } + + /** + * Gets the moreInfo. + * + * Additional info for error. + * + * @return the moreInfo + */ + public String getMoreInfo() { + return moreInfo; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java new file mode 100644 index 00000000000..5c1c9a9fad6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * How external accounts can interact in relation to the requested account. + */ +public class ExternalAccountIdentityInteraction extends GenericModel { + + @SerializedName("identity_types") + protected IdentityTypes identityTypes; + + protected ExternalAccountIdentityInteraction() { } + + /** + * Gets the identityTypes. + * + * The settings for each identity type. + * + * @return the identityTypes + */ + public IdentityTypes getIdentityTypes() { + return identityTypes; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java new file mode 100644 index 00000000000..1efd0673e9d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java @@ -0,0 +1,95 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Update to how external accounts can interact in relation to the requested account. + */ +public class ExternalAccountIdentityInteractionPatch extends GenericModel { + + @SerializedName("identity_types") + protected IdentityTypesPatch identityTypes; + + /** + * Builder. + */ + public static class Builder { + private IdentityTypesPatch identityTypes; + + /** + * Instantiates a new Builder from an existing ExternalAccountIdentityInteractionPatch instance. + * + * @param externalAccountIdentityInteractionPatch the instance to initialize the Builder with + */ + private Builder(ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatch) { + this.identityTypes = externalAccountIdentityInteractionPatch.identityTypes; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ExternalAccountIdentityInteractionPatch. + * + * @return the new ExternalAccountIdentityInteractionPatch instance + */ + public ExternalAccountIdentityInteractionPatch build() { + return new ExternalAccountIdentityInteractionPatch(this); + } + + /** + * Set the identityTypes. + * + * @param identityTypes the identityTypes + * @return the ExternalAccountIdentityInteractionPatch builder + */ + public Builder identityTypes(IdentityTypesPatch identityTypes) { + this.identityTypes = identityTypes; + return this; + } + } + + protected ExternalAccountIdentityInteractionPatch() { } + + protected ExternalAccountIdentityInteractionPatch(Builder builder) { + identityTypes = builder.identityTypes; + } + + /** + * New builder. + * + * @return a ExternalAccountIdentityInteractionPatch builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the identityTypes. + * + * The settings to apply for each identity type for a request. + * + * @return the identityTypes + */ + public IdentityTypesPatch identityTypes() { + return identityTypes; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java new file mode 100644 index 00000000000..83cd67d33c9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Details with linking href to first page of requested collection. + */ +public class First extends GenericModel { + + protected String href; + + protected First() { } + + /** + * Gets the href. + * + * The href linking to the page of requested collection. + * + * @return the href + */ + public String getHref() { + return href; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java new file mode 100644 index 00000000000..f87e7d741a4 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getActionControlAssignment options. + */ +public class GetActionControlAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing GetActionControlAssignmentOptions instance. + * + * @param getActionControlAssignmentOptions the instance to initialize the Builder with + */ + private Builder(GetActionControlAssignmentOptions getActionControlAssignmentOptions) { + this.assignmentId = getActionControlAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a GetActionControlAssignmentOptions. + * + * @return the new GetActionControlAssignmentOptions instance + */ + public GetActionControlAssignmentOptions build() { + return new GetActionControlAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the GetActionControlAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected GetActionControlAssignmentOptions() { } + + protected GetActionControlAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a GetActionControlAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Action control template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java new file mode 100644 index 00000000000..963c68e8876 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java @@ -0,0 +1,140 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getActionControlTemplate options. + */ +public class GetActionControlTemplateOptions extends GenericModel { + + /** + * The action control template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String actionControlTemplateId; + protected String state; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String state; + + /** + * Instantiates a new Builder from an existing GetActionControlTemplateOptions instance. + * + * @param getActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(GetActionControlTemplateOptions getActionControlTemplateOptions) { + this.actionControlTemplateId = getActionControlTemplateOptions.actionControlTemplateId; + this.state = getActionControlTemplateOptions.state; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + */ + public Builder(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + } + + /** + * Builds a GetActionControlTemplateOptions. + * + * @return the new GetActionControlTemplateOptions instance + */ + public GetActionControlTemplateOptions build() { + return new GetActionControlTemplateOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the GetActionControlTemplateOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the GetActionControlTemplateOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + } + + protected GetActionControlTemplateOptions() { } + + protected GetActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + state = builder.state; + } + + /** + * New builder. + * + * @return a GetActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the state. + * + * The action control template state. + * + * @return the state + */ + public String state() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java new file mode 100644 index 00000000000..95bc94950bb --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getActionControlTemplateVersion options. + */ +public class GetActionControlTemplateVersionOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing GetActionControlTemplateVersionOptions instance. + * + * @param getActionControlTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptions) { + this.actionControlTemplateId = getActionControlTemplateVersionOptions.actionControlTemplateId; + this.version = getActionControlTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + * @param version the version + */ + public Builder(String actionControlTemplateId, String version) { + this.actionControlTemplateId = actionControlTemplateId; + this.version = version; + } + + /** + * Builds a GetActionControlTemplateVersionOptions. + * + * @return the new GetActionControlTemplateVersionOptions instance + */ + public GetActionControlTemplateVersionOptions build() { + return new GetActionControlTemplateVersionOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the GetActionControlTemplateVersionOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the GetActionControlTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected GetActionControlTemplateVersionOptions() { } + + protected GetActionControlTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a GetActionControlTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java new file mode 100644 index 00000000000..d1c7c359003 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getPolicyAssignment options. + */ +public class GetPolicyAssignmentOptions extends GenericModel { + + protected String assignmentId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + private String version; + + /** + * Instantiates a new Builder from an existing GetPolicyAssignmentOptions instance. + * + * @param getPolicyAssignmentOptions the instance to initialize the Builder with + */ + private Builder(GetPolicyAssignmentOptions getPolicyAssignmentOptions) { + this.assignmentId = getPolicyAssignmentOptions.assignmentId; + this.version = getPolicyAssignmentOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + * @param version the version + */ + public Builder(String assignmentId, String version) { + this.assignmentId = assignmentId; + this.version = version; + } + + /** + * Builds a GetPolicyAssignmentOptions. + * + * @return the new GetPolicyAssignmentOptions instance + */ + public GetPolicyAssignmentOptions build() { + return new GetPolicyAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the GetPolicyAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the GetPolicyAssignmentOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected GetPolicyAssignmentOptions() { } + + protected GetPolicyAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + assignmentId = builder.assignmentId; + version = builder.version; + } + + /** + * New builder. + * + * @return a GetPolicyAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * The policy template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } + + /** + * Gets the version. + * + * specify version of response body format. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java new file mode 100644 index 00000000000..e780ac06896 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getPolicy options. + */ +public class GetPolicyOptions extends GenericModel { + + protected String policyId; + + /** + * Builder. + */ + public static class Builder { + private String policyId; + + /** + * Instantiates a new Builder from an existing GetPolicyOptions instance. + * + * @param getPolicyOptions the instance to initialize the Builder with + */ + private Builder(GetPolicyOptions getPolicyOptions) { + this.policyId = getPolicyOptions.policyId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyId the policyId + */ + public Builder(String policyId) { + this.policyId = policyId; + } + + /** + * Builds a GetPolicyOptions. + * + * @return the new GetPolicyOptions instance + */ + public GetPolicyOptions build() { + return new GetPolicyOptions(this); + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the GetPolicyOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + } + + protected GetPolicyOptions() { } + + protected GetPolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId cannot be empty"); + policyId = builder.policyId; + } + + /** + * New builder. + * + * @return a GetPolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyId. + * + * The policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java new file mode 100644 index 00000000000..ee604554a85 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java @@ -0,0 +1,140 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getPolicyTemplate options. + */ +public class GetPolicyTemplateOptions extends GenericModel { + + /** + * The policy template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String policyTemplateId; + protected String state; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String state; + + /** + * Instantiates a new Builder from an existing GetPolicyTemplateOptions instance. + * + * @param getPolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(GetPolicyTemplateOptions getPolicyTemplateOptions) { + this.policyTemplateId = getPolicyTemplateOptions.policyTemplateId; + this.state = getPolicyTemplateOptions.state; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + */ + public Builder(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + } + + /** + * Builds a GetPolicyTemplateOptions. + * + * @return the new GetPolicyTemplateOptions instance + */ + public GetPolicyTemplateOptions build() { + return new GetPolicyTemplateOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the GetPolicyTemplateOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the GetPolicyTemplateOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + } + + protected GetPolicyTemplateOptions() { } + + protected GetPolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + policyTemplateId = builder.policyTemplateId; + state = builder.state; + } + + /** + * New builder. + * + * @return a GetPolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the state. + * + * The policy template state. + * + * @return the state + */ + public String state() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java new file mode 100644 index 00000000000..8741f83357d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getPolicyTemplateVersion options. + */ +public class GetPolicyTemplateVersionOptions extends GenericModel { + + protected String policyTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing GetPolicyTemplateVersionOptions instance. + * + * @param getPolicyTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptions) { + this.policyTemplateId = getPolicyTemplateVersionOptions.policyTemplateId; + this.version = getPolicyTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param version the version + */ + public Builder(String policyTemplateId, String version) { + this.policyTemplateId = policyTemplateId; + this.version = version; + } + + /** + * Builds a GetPolicyTemplateVersionOptions. + * + * @return the new GetPolicyTemplateVersionOptions instance + */ + public GetPolicyTemplateVersionOptions build() { + return new GetPolicyTemplateVersionOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the GetPolicyTemplateVersionOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the GetPolicyTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected GetPolicyTemplateVersionOptions() { } + + protected GetPolicyTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + policyTemplateId = builder.policyTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a GetPolicyTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the version. + * + * The policy template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java new file mode 100644 index 00000000000..35313b9b746 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getRoleAssignment options. + */ +public class GetRoleAssignmentOptions extends GenericModel { + + protected String assignmentId; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + + /** + * Instantiates a new Builder from an existing GetRoleAssignmentOptions instance. + * + * @param getRoleAssignmentOptions the instance to initialize the Builder with + */ + private Builder(GetRoleAssignmentOptions getRoleAssignmentOptions) { + this.assignmentId = getRoleAssignmentOptions.assignmentId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + */ + public Builder(String assignmentId) { + this.assignmentId = assignmentId; + } + + /** + * Builds a GetRoleAssignmentOptions. + * + * @return the new GetRoleAssignmentOptions instance + */ + public GetRoleAssignmentOptions build() { + return new GetRoleAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the GetRoleAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + } + + protected GetRoleAssignmentOptions() { } + + protected GetRoleAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + assignmentId = builder.assignmentId; + } + + /** + * New builder. + * + * @return a GetRoleAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Role template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java new file mode 100644 index 00000000000..8c56ac7f58a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getRole options. + */ +public class GetRoleOptions extends GenericModel { + + protected String roleId; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + + /** + * Instantiates a new Builder from an existing GetRoleOptions instance. + * + * @param getRoleOptions the instance to initialize the Builder with + */ + private Builder(GetRoleOptions getRoleOptions) { + this.roleId = getRoleOptions.roleId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + */ + public Builder(String roleId) { + this.roleId = roleId; + } + + /** + * Builds a GetRoleOptions. + * + * @return the new GetRoleOptions instance + */ + public GetRoleOptions build() { + return new GetRoleOptions(this); + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the GetRoleOptions builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + } + + protected GetRoleOptions() { } + + protected GetRoleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, + "roleId cannot be empty"); + roleId = builder.roleId; + } + + /** + * New builder. + * + * @return a GetRoleOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role ID. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java new file mode 100644 index 00000000000..e33fcf29b32 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java @@ -0,0 +1,140 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getRoleTemplate options. + */ +public class GetRoleTemplateOptions extends GenericModel { + + /** + * The role template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String roleTemplateId; + protected String state; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String state; + + /** + * Instantiates a new Builder from an existing GetRoleTemplateOptions instance. + * + * @param getRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(GetRoleTemplateOptions getRoleTemplateOptions) { + this.roleTemplateId = getRoleTemplateOptions.roleTemplateId; + this.state = getRoleTemplateOptions.state; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + */ + public Builder(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + } + + /** + * Builds a GetRoleTemplateOptions. + * + * @return the new GetRoleTemplateOptions instance + */ + public GetRoleTemplateOptions build() { + return new GetRoleTemplateOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the GetRoleTemplateOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the GetRoleTemplateOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + } + + protected GetRoleTemplateOptions() { } + + protected GetRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + roleTemplateId = builder.roleTemplateId; + state = builder.state; + } + + /** + * New builder. + * + * @return a GetRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the state. + * + * The role template state. + * + * @return the state + */ + public String state() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java new file mode 100644 index 00000000000..4757484f969 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getRoleTemplateVersion options. + */ +public class GetRoleTemplateVersionOptions extends GenericModel { + + protected String roleTemplateId; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String version; + + /** + * Instantiates a new Builder from an existing GetRoleTemplateVersionOptions instance. + * + * @param getRoleTemplateVersionOptions the instance to initialize the Builder with + */ + private Builder(GetRoleTemplateVersionOptions getRoleTemplateVersionOptions) { + this.roleTemplateId = getRoleTemplateVersionOptions.roleTemplateId; + this.version = getRoleTemplateVersionOptions.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + * @param version the version + */ + public Builder(String roleTemplateId, String version) { + this.roleTemplateId = roleTemplateId; + this.version = version; + } + + /** + * Builds a GetRoleTemplateVersionOptions. + * + * @return the new GetRoleTemplateVersionOptions instance + */ + public GetRoleTemplateVersionOptions build() { + return new GetRoleTemplateVersionOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the GetRoleTemplateVersionOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the GetRoleTemplateVersionOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected GetRoleTemplateVersionOptions() { } + + protected GetRoleTemplateVersionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + roleTemplateId = builder.roleTemplateId; + version = builder.version; + } + + /** + * New builder. + * + * @return a GetRoleTemplateVersionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the version. + * + * Role template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java new file mode 100644 index 00000000000..ebc88bbf45c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getSettings options. + */ +public class GetSettingsOptions extends GenericModel { + + protected String accountId; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing GetSettingsOptions instance. + * + * @param getSettingsOptions the instance to initialize the Builder with + */ + private Builder(GetSettingsOptions getSettingsOptions) { + this.accountId = getSettingsOptions.accountId; + this.acceptLanguage = getSettingsOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a GetSettingsOptions. + * + * @return the new GetSettingsOptions instance + */ + public GetSettingsOptions build() { + return new GetSettingsOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the GetSettingsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the GetSettingsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected GetSettingsOptions() { } + + protected GetSettingsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.accountId, + "accountId cannot be empty"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a GetSettingsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the settings belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java new file mode 100644 index 00000000000..23a950cc815 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java @@ -0,0 +1,148 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getV2Policy options. + */ +public class GetV2PolicyOptions extends GenericModel { + + /** + * Include additional data for policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles and translations for all + * relevant fields. + */ + public interface Format { + /** include_last_permit. */ + String INCLUDE_LAST_PERMIT = "include_last_permit"; + /** display. */ + String DISPLAY = "display"; + } + + protected String id; + protected String format; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String format; + + /** + * Instantiates a new Builder from an existing GetV2PolicyOptions instance. + * + * @param getV2PolicyOptions the instance to initialize the Builder with + */ + private Builder(GetV2PolicyOptions getV2PolicyOptions) { + this.id = getV2PolicyOptions.id; + this.format = getV2PolicyOptions.format; + } + + /** + * 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 GetV2PolicyOptions. + * + * @return the new GetV2PolicyOptions instance + */ + public GetV2PolicyOptions build() { + return new GetV2PolicyOptions(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the GetV2PolicyOptions builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the format. + * + * @param format the format + * @return the GetV2PolicyOptions builder + */ + public Builder format(String format) { + this.format = format; + return this; + } + } + + protected GetV2PolicyOptions() { } + + protected GetV2PolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, + "id cannot be empty"); + id = builder.id; + format = builder.format; + } + + /** + * New builder. + * + * @return a GetV2PolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the format. + * + * Include additional data for policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles and translations for all + * relevant fields. + * + * @return the format + */ + public String format() { + return format; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java new file mode 100644 index 00000000000..d8439c9d6f7 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java @@ -0,0 +1,124 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Permission is granted by the policy. + */ +public class Grant extends GenericModel { + + protected List roles; + + /** + * Builder. + */ + public static class Builder { + private List roles; + + /** + * Instantiates a new Builder from an existing Grant instance. + * + * @param grant the instance to initialize the Builder with + */ + private Builder(Grant grant) { + this.roles = grant.roles; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roles the roles + */ + public Builder(List roles) { + this.roles = roles; + } + + /** + * Builds a Grant. + * + * @return the new Grant instance + */ + public Grant build() { + return new Grant(this); + } + + /** + * Adds a new element to roles. + * + * @param roles the new element to be added + * @return the Grant builder + */ + public Builder addRoles(Roles roles) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roles, + "roles cannot be null"); + if (this.roles == null) { + this.roles = new ArrayList(); + } + this.roles.add(roles); + return this; + } + + /** + * Set the roles. + * Existing roles will be replaced. + * + * @param roles the roles + * @return the Grant builder + */ + public Builder roles(List roles) { + this.roles = roles; + return this; + } + } + + protected Grant() { } + + protected Grant(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, + "roles cannot be null"); + roles = builder.roles; + } + + /** + * New builder. + * + * @return a Grant builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List roles() { + return roles; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java new file mode 100644 index 00000000000..1dbc53fefb6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Permission granted by the policy with translated roles and additional role information. + */ +public class GrantWithEnrichedRoles extends GenericModel { + + protected List roles; + + protected GrantWithEnrichedRoles() { } + + /** + * Gets the roles. + * + * A set of roles granted by the policy. + * + * @return the roles + */ + public List getRoles() { + return roles; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java new file mode 100644 index 00000000000..0ac71d8192b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java @@ -0,0 +1,64 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The settings for each identity type. + */ +public class IdentityTypes extends GenericModel { + + protected IdentityTypesBase user; + @SerializedName("service_id") + protected IdentityTypesBase serviceId; + protected IdentityTypesBase service; + + protected IdentityTypes() { } + + /** + * Gets the user. + * + * The core set of properties associated with an identity type. + * + * @return the user + */ + public IdentityTypesBase getUser() { + return user; + } + + /** + * Gets the serviceId. + * + * The core set of properties associated with an identity type. + * + * @return the serviceId + */ + public IdentityTypesBase getServiceId() { + return serviceId; + } + + /** + * Gets the service. + * + * The core set of properties associated with an identity type. + * + * @return the service + */ + public IdentityTypesBase getService() { + return service; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java new file mode 100644 index 00000000000..e8df91a1e5d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java @@ -0,0 +1,168 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with an identity type. + */ +public class IdentityTypesBase extends GenericModel { + + /** + * The state of the identity type. + */ + public interface State { + /** enabled. */ + String ENABLED = "enabled"; + /** monitor. */ + String MONITOR = "monitor"; + /** limited. */ + String LIMITED = "limited"; + } + + protected String state; + @SerializedName("external_allowed_accounts") + protected List externalAllowedAccounts; + + /** + * Builder. + */ + public static class Builder { + private String state; + private List externalAllowedAccounts; + + /** + * Instantiates a new Builder from an existing IdentityTypesBase instance. + * + * @param identityTypesBase the instance to initialize the Builder with + */ + private Builder(IdentityTypesBase identityTypesBase) { + this.state = identityTypesBase.state; + this.externalAllowedAccounts = identityTypesBase.externalAllowedAccounts; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param state the state + * @param externalAllowedAccounts the externalAllowedAccounts + */ + public Builder(String state, List externalAllowedAccounts) { + this.state = state; + this.externalAllowedAccounts = externalAllowedAccounts; + } + + /** + * Builds a IdentityTypesBase. + * + * @return the new IdentityTypesBase instance + */ + public IdentityTypesBase build() { + return new IdentityTypesBase(this); + } + + /** + * Adds a new element to externalAllowedAccounts. + * + * @param externalAllowedAccounts the new element to be added + * @return the IdentityTypesBase builder + */ + public Builder addExternalAllowedAccounts(String externalAllowedAccounts) { + com.ibm.cloud.sdk.core.util.Validator.notNull(externalAllowedAccounts, + "externalAllowedAccounts cannot be null"); + if (this.externalAllowedAccounts == null) { + this.externalAllowedAccounts = new ArrayList(); + } + this.externalAllowedAccounts.add(externalAllowedAccounts); + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the IdentityTypesBase builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the externalAllowedAccounts. + * Existing externalAllowedAccounts will be replaced. + * + * @param externalAllowedAccounts the externalAllowedAccounts + * @return the IdentityTypesBase builder + */ + public Builder externalAllowedAccounts(List externalAllowedAccounts) { + this.externalAllowedAccounts = externalAllowedAccounts; + return this; + } + } + + protected IdentityTypesBase() { } + + protected IdentityTypesBase(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.state, + "state cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.externalAllowedAccounts, + "externalAllowedAccounts cannot be null"); + state = builder.state; + externalAllowedAccounts = builder.externalAllowedAccounts; + } + + /** + * New builder. + * + * @return a IdentityTypesBase builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the state. + * + * The state of the identity type. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the externalAllowedAccounts. + * + * List of accounts that the state applies to for a given identity. + * + * @return the externalAllowedAccounts + */ + public List externalAllowedAccounts() { + return externalAllowedAccounts; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java new file mode 100644 index 00000000000..77aa5a26366 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java @@ -0,0 +1,147 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The settings to apply for each identity type for a request. + */ +public class IdentityTypesPatch extends GenericModel { + + protected IdentityTypesBase user; + @SerializedName("service_id") + protected IdentityTypesBase serviceId; + protected IdentityTypesBase service; + + /** + * Builder. + */ + public static class Builder { + private IdentityTypesBase user; + private IdentityTypesBase serviceId; + private IdentityTypesBase service; + + /** + * Instantiates a new Builder from an existing IdentityTypesPatch instance. + * + * @param identityTypesPatch the instance to initialize the Builder with + */ + private Builder(IdentityTypesPatch identityTypesPatch) { + this.user = identityTypesPatch.user; + this.serviceId = identityTypesPatch.serviceId; + this.service = identityTypesPatch.service; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a IdentityTypesPatch. + * + * @return the new IdentityTypesPatch instance + */ + public IdentityTypesPatch build() { + return new IdentityTypesPatch(this); + } + + /** + * Set the user. + * + * @param user the user + * @return the IdentityTypesPatch builder + */ + public Builder user(IdentityTypesBase user) { + this.user = user; + return this; + } + + /** + * Set the serviceId. + * + * @param serviceId the serviceId + * @return the IdentityTypesPatch builder + */ + public Builder serviceId(IdentityTypesBase serviceId) { + this.serviceId = serviceId; + return this; + } + + /** + * Set the service. + * + * @param service the service + * @return the IdentityTypesPatch builder + */ + public Builder service(IdentityTypesBase service) { + this.service = service; + return this; + } + } + + protected IdentityTypesPatch() { } + + protected IdentityTypesPatch(Builder builder) { + user = builder.user; + serviceId = builder.serviceId; + service = builder.service; + } + + /** + * New builder. + * + * @return a IdentityTypesPatch builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the user. + * + * The core set of properties associated with an identity type. + * + * @return the user + */ + public IdentityTypesBase user() { + return user; + } + + /** + * Gets the serviceId. + * + * The core set of properties associated with an identity type. + * + * @return the serviceId + */ + public IdentityTypesBase serviceId() { + return serviceId; + } + + /** + * Gets the service. + * + * The core set of properties associated with an identity type. + * + * @return the service + */ + public IdentityTypesBase service() { + return service; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java new file mode 100644 index 00000000000..5aa0b39573b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * policy template current and limit details with in an account. + */ +public class LimitData extends GenericModel { + + protected Long current; + protected Long limit; + + protected LimitData() { } + + /** + * Gets the current. + * + * policy template current count. + * + * @return the current + */ + public Long getCurrent() { + return current; + } + + /** + * Gets the limit. + * + * policy template limit count. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java new file mode 100644 index 00000000000..6835f5afccc --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java @@ -0,0 +1,245 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listActionControlAssignments options. + */ +public class ListActionControlAssignmentsOptions extends GenericModel { + + protected String accountId; + protected String acceptLanguage; + protected String templateId; + protected String templateVersion; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String templateId; + private String templateVersion; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListActionControlAssignmentsOptions instance. + * + * @param listActionControlAssignmentsOptions the instance to initialize the Builder with + */ + private Builder(ListActionControlAssignmentsOptions listActionControlAssignmentsOptions) { + this.accountId = listActionControlAssignmentsOptions.accountId; + this.acceptLanguage = listActionControlAssignmentsOptions.acceptLanguage; + this.templateId = listActionControlAssignmentsOptions.templateId; + this.templateVersion = listActionControlAssignmentsOptions.templateVersion; + this.limit = listActionControlAssignmentsOptions.limit; + this.start = listActionControlAssignmentsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListActionControlAssignmentsOptions. + * + * @return the new ListActionControlAssignmentsOptions instance + */ + public ListActionControlAssignmentsOptions build() { + return new ListActionControlAssignmentsOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the templateId. + * + * @param templateId the templateId + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder templateId(String templateId) { + this.templateId = templateId; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListActionControlAssignmentsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListActionControlAssignmentsOptions() { } + + protected ListActionControlAssignmentsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + templateId = builder.templateId; + templateVersion = builder.templateVersion; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListActionControlAssignmentsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID in which the action control assignment belongs to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the templateId. + * + * Optional template ID. + * + * @return the templateId + */ + public String templateId() { + return templateId; + } + + /** + * Gets the templateVersion. + * + * Optional action control template version. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java new file mode 100644 index 00000000000..984d1060c83 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listActionControlTemplateVersions options. + */ +public class ListActionControlTemplateVersionsOptions extends GenericModel { + + /** + * Action control template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String actionControlTemplateId; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListActionControlTemplateVersionsOptions instance. + * + * @param listActionControlTemplateVersionsOptions the instance to initialize the Builder with + */ + private Builder(ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions) { + this.actionControlTemplateId = listActionControlTemplateVersionsOptions.actionControlTemplateId; + this.state = listActionControlTemplateVersionsOptions.state; + this.limit = listActionControlTemplateVersionsOptions.limit; + this.start = listActionControlTemplateVersionsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + */ + public Builder(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + } + + /** + * Builds a ListActionControlTemplateVersionsOptions. + * + * @return the new ListActionControlTemplateVersionsOptions instance + */ + public ListActionControlTemplateVersionsOptions build() { + return new ListActionControlTemplateVersionsOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the ListActionControlTemplateVersionsOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListActionControlTemplateVersionsOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListActionControlTemplateVersionsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListActionControlTemplateVersionsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListActionControlTemplateVersionsOptions() { } + + protected ListActionControlTemplateVersionsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + actionControlTemplateId = builder.actionControlTemplateId; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListActionControlTemplateVersionsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * The action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the state. + * + * Action control template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java new file mode 100644 index 00000000000..d019db6119f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java @@ -0,0 +1,193 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listActionControlTemplates options. + */ +public class ListActionControlTemplatesOptions extends GenericModel { + + protected String accountId; + protected String acceptLanguage; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListActionControlTemplatesOptions instance. + * + * @param listActionControlTemplatesOptions the instance to initialize the Builder with + */ + private Builder(ListActionControlTemplatesOptions listActionControlTemplatesOptions) { + this.accountId = listActionControlTemplatesOptions.accountId; + this.acceptLanguage = listActionControlTemplatesOptions.acceptLanguage; + this.limit = listActionControlTemplatesOptions.limit; + this.start = listActionControlTemplatesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListActionControlTemplatesOptions. + * + * @return the new ListActionControlTemplatesOptions instance + */ + public ListActionControlTemplatesOptions build() { + return new ListActionControlTemplatesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListActionControlTemplatesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListActionControlTemplatesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListActionControlTemplatesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListActionControlTemplatesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListActionControlTemplatesOptions() { } + + protected ListActionControlTemplatesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListActionControlTemplatesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the action control templates belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java new file mode 100644 index 00000000000..90ecb352c37 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java @@ -0,0 +1,501 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listPolicies options. + */ +public class ListPoliciesOptions extends GenericModel { + + /** + * Optional type of policy. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + /** + * Optional type of service. + */ + public interface ServiceType { + /** service. */ + String SERVICE = "service"; + /** platform_service. */ + String PLATFORM_SERVICE = "platform_service"; + } + + /** + * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending + * '-' to field. Example '-last_modified_at'. + */ + public interface Sort { + /** id. */ + String ID = "id"; + /** type. */ + String TYPE = "type"; + /** href. */ + String HREF = "href"; + /** created_at. */ + String CREATED_AT = "created_at"; + /** created_by_id. */ + String CREATED_BY_ID = "created_by_id"; + /** last_modified_at. */ + String LAST_MODIFIED_AT = "last_modified_at"; + /** last_modified_by_id. */ + String LAST_MODIFIED_BY_ID = "last_modified_by_id"; + /** state. */ + String STATE = "state"; + } + + /** + * Include additional data per policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles. + */ + public interface Format { + /** include_last_permit. */ + String INCLUDE_LAST_PERMIT = "include_last_permit"; + /** display. */ + String DISPLAY = "display"; + } + + /** + * The state of the policy. + * * `active` - returns active policies + * * `deleted` - returns non-active policies. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String accountId; + protected String acceptLanguage; + protected String iamId; + protected String accessGroupId; + protected String type; + protected String serviceType; + protected String tagName; + protected String tagValue; + protected String sort; + protected String format; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String iamId; + private String accessGroupId; + private String type; + private String serviceType; + private String tagName; + private String tagValue; + private String sort; + private String format; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListPoliciesOptions instance. + * + * @param listPoliciesOptions the instance to initialize the Builder with + */ + private Builder(ListPoliciesOptions listPoliciesOptions) { + this.accountId = listPoliciesOptions.accountId; + this.acceptLanguage = listPoliciesOptions.acceptLanguage; + this.iamId = listPoliciesOptions.iamId; + this.accessGroupId = listPoliciesOptions.accessGroupId; + this.type = listPoliciesOptions.type; + this.serviceType = listPoliciesOptions.serviceType; + this.tagName = listPoliciesOptions.tagName; + this.tagValue = listPoliciesOptions.tagValue; + this.sort = listPoliciesOptions.sort; + this.format = listPoliciesOptions.format; + this.state = listPoliciesOptions.state; + this.limit = listPoliciesOptions.limit; + this.start = listPoliciesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListPoliciesOptions. + * + * @return the new ListPoliciesOptions instance + */ + public ListPoliciesOptions build() { + return new ListPoliciesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListPoliciesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListPoliciesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the iamId. + * + * @param iamId the iamId + * @return the ListPoliciesOptions builder + */ + public Builder iamId(String iamId) { + this.iamId = iamId; + return this; + } + + /** + * Set the accessGroupId. + * + * @param accessGroupId the accessGroupId + * @return the ListPoliciesOptions builder + */ + public Builder accessGroupId(String accessGroupId) { + this.accessGroupId = accessGroupId; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the ListPoliciesOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the serviceType. + * + * @param serviceType the serviceType + * @return the ListPoliciesOptions builder + */ + public Builder serviceType(String serviceType) { + this.serviceType = serviceType; + return this; + } + + /** + * Set the tagName. + * + * @param tagName the tagName + * @return the ListPoliciesOptions builder + */ + public Builder tagName(String tagName) { + this.tagName = tagName; + return this; + } + + /** + * Set the tagValue. + * + * @param tagValue the tagValue + * @return the ListPoliciesOptions builder + */ + public Builder tagValue(String tagValue) { + this.tagValue = tagValue; + return this; + } + + /** + * Set the sort. + * + * @param sort the sort + * @return the ListPoliciesOptions builder + */ + public Builder sort(String sort) { + this.sort = sort; + return this; + } + + /** + * Set the format. + * + * @param format the format + * @return the ListPoliciesOptions builder + */ + public Builder format(String format) { + this.format = format; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListPoliciesOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListPoliciesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListPoliciesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListPoliciesOptions() { } + + protected ListPoliciesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + iamId = builder.iamId; + accessGroupId = builder.accessGroupId; + type = builder.type; + serviceType = builder.serviceType; + tagName = builder.tagName; + tagValue = builder.tagValue; + sort = builder.sort; + format = builder.format; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListPoliciesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the policies belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the iamId. + * + * Optional IAM ID used to identify the subject. + * + * @return the iamId + */ + public String iamId() { + return iamId; + } + + /** + * Gets the accessGroupId. + * + * Optional access group id. + * + * @return the accessGroupId + */ + public String accessGroupId() { + return accessGroupId; + } + + /** + * Gets the type. + * + * Optional type of policy. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the serviceType. + * + * Optional type of service. + * + * @return the serviceType + */ + public String serviceType() { + return serviceType; + } + + /** + * Gets the tagName. + * + * Optional name of the access tag in the policy. + * + * @return the tagName + */ + public String tagName() { + return tagName; + } + + /** + * Gets the tagValue. + * + * Optional value of the access tag in the policy. + * + * @return the tagValue + */ + public String tagValue() { + return tagValue; + } + + /** + * Gets the sort. + * + * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending + * '-' to field. Example '-last_modified_at'. + * + * @return the sort + */ + public String sort() { + return sort; + } + + /** + * Gets the format. + * + * Include additional data per policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles. + * + * @return the format + */ + public String format() { + return format; + } + + /** + * Gets the state. + * + * The state of the policy. + * * `active` - returns active policies + * * `deleted` - returns non-active policies. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java new file mode 100644 index 00000000000..9362749c670 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java @@ -0,0 +1,275 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listPolicyAssignments options. + */ +public class ListPolicyAssignmentsOptions extends GenericModel { + + protected String version; + protected String accountId; + protected String acceptLanguage; + protected String templateId; + protected String templateVersion; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String version; + private String accountId; + private String acceptLanguage; + private String templateId; + private String templateVersion; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListPolicyAssignmentsOptions instance. + * + * @param listPolicyAssignmentsOptions the instance to initialize the Builder with + */ + private Builder(ListPolicyAssignmentsOptions listPolicyAssignmentsOptions) { + this.version = listPolicyAssignmentsOptions.version; + this.accountId = listPolicyAssignmentsOptions.accountId; + this.acceptLanguage = listPolicyAssignmentsOptions.acceptLanguage; + this.templateId = listPolicyAssignmentsOptions.templateId; + this.templateVersion = listPolicyAssignmentsOptions.templateVersion; + this.limit = listPolicyAssignmentsOptions.limit; + this.start = listPolicyAssignmentsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param version the version + * @param accountId the accountId + */ + public Builder(String version, String accountId) { + this.version = version; + this.accountId = accountId; + } + + /** + * Builds a ListPolicyAssignmentsOptions. + * + * @return the new ListPolicyAssignmentsOptions instance + */ + public ListPolicyAssignmentsOptions build() { + return new ListPolicyAssignmentsOptions(this); + } + + /** + * Set the version. + * + * @param version the version + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the templateId. + * + * @param templateId the templateId + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder templateId(String templateId) { + this.templateId = templateId; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListPolicyAssignmentsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListPolicyAssignmentsOptions() { } + + protected ListPolicyAssignmentsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + version = builder.version; + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + templateId = builder.templateId; + templateVersion = builder.templateVersion; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListPolicyAssignmentsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the version. + * + * specify version of response body format. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the accountId. + * + * The account GUID in which the policies belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the templateId. + * + * Optional template id. + * + * @return the templateId + */ + public String templateId() { + return templateId; + } + + /** + * Gets the templateVersion. + * + * Optional policy template version. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java new file mode 100644 index 00000000000..c7965ba6c31 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listPolicyTemplateVersions options. + */ +public class ListPolicyTemplateVersionsOptions extends GenericModel { + + /** + * The policy template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String policyTemplateId; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListPolicyTemplateVersionsOptions instance. + * + * @param listPolicyTemplateVersionsOptions the instance to initialize the Builder with + */ + private Builder(ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions) { + this.policyTemplateId = listPolicyTemplateVersionsOptions.policyTemplateId; + this.state = listPolicyTemplateVersionsOptions.state; + this.limit = listPolicyTemplateVersionsOptions.limit; + this.start = listPolicyTemplateVersionsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + */ + public Builder(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + } + + /** + * Builds a ListPolicyTemplateVersionsOptions. + * + * @return the new ListPolicyTemplateVersionsOptions instance + */ + public ListPolicyTemplateVersionsOptions build() { + return new ListPolicyTemplateVersionsOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the ListPolicyTemplateVersionsOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListPolicyTemplateVersionsOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListPolicyTemplateVersionsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListPolicyTemplateVersionsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListPolicyTemplateVersionsOptions() { } + + protected ListPolicyTemplateVersionsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + policyTemplateId = builder.policyTemplateId; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListPolicyTemplateVersionsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the state. + * + * The policy template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java new file mode 100644 index 00000000000..f230c9bd549 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java @@ -0,0 +1,379 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listPolicyTemplates options. + */ +public class ListPolicyTemplatesOptions extends GenericModel { + + /** + * The policy template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + /** + * Service type, Optional. + */ + public interface PolicyServiceType { + /** service. */ + String SERVICE = "service"; + /** platform_service. */ + String PLATFORM_SERVICE = "platform_service"; + } + + /** + * Policy type, Optional. + */ + public interface PolicyType { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + protected String accountId; + protected String acceptLanguage; + protected String state; + protected String name; + protected String policyServiceType; + protected String policyServiceName; + protected String policyServiceGroupId; + protected String policyType; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String state; + private String name; + private String policyServiceType; + private String policyServiceName; + private String policyServiceGroupId; + private String policyType; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListPolicyTemplatesOptions instance. + * + * @param listPolicyTemplatesOptions the instance to initialize the Builder with + */ + private Builder(ListPolicyTemplatesOptions listPolicyTemplatesOptions) { + this.accountId = listPolicyTemplatesOptions.accountId; + this.acceptLanguage = listPolicyTemplatesOptions.acceptLanguage; + this.state = listPolicyTemplatesOptions.state; + this.name = listPolicyTemplatesOptions.name; + this.policyServiceType = listPolicyTemplatesOptions.policyServiceType; + this.policyServiceName = listPolicyTemplatesOptions.policyServiceName; + this.policyServiceGroupId = listPolicyTemplatesOptions.policyServiceGroupId; + this.policyType = listPolicyTemplatesOptions.policyType; + this.limit = listPolicyTemplatesOptions.limit; + this.start = listPolicyTemplatesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListPolicyTemplatesOptions. + * + * @return the new ListPolicyTemplatesOptions instance + */ + public ListPolicyTemplatesOptions build() { + return new ListPolicyTemplatesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListPolicyTemplatesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListPolicyTemplatesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListPolicyTemplatesOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ListPolicyTemplatesOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the policyServiceType. + * + * @param policyServiceType the policyServiceType + * @return the ListPolicyTemplatesOptions builder + */ + public Builder policyServiceType(String policyServiceType) { + this.policyServiceType = policyServiceType; + return this; + } + + /** + * Set the policyServiceName. + * + * @param policyServiceName the policyServiceName + * @return the ListPolicyTemplatesOptions builder + */ + public Builder policyServiceName(String policyServiceName) { + this.policyServiceName = policyServiceName; + return this; + } + + /** + * Set the policyServiceGroupId. + * + * @param policyServiceGroupId the policyServiceGroupId + * @return the ListPolicyTemplatesOptions builder + */ + public Builder policyServiceGroupId(String policyServiceGroupId) { + this.policyServiceGroupId = policyServiceGroupId; + return this; + } + + /** + * Set the policyType. + * + * @param policyType the policyType + * @return the ListPolicyTemplatesOptions builder + */ + public Builder policyType(String policyType) { + this.policyType = policyType; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListPolicyTemplatesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListPolicyTemplatesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListPolicyTemplatesOptions() { } + + protected ListPolicyTemplatesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + state = builder.state; + name = builder.name; + policyServiceType = builder.policyServiceType; + policyServiceName = builder.policyServiceName; + policyServiceGroupId = builder.policyServiceGroupId; + policyType = builder.policyType; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListPolicyTemplatesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the policy templates belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the state. + * + * The policy template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the name. + * + * The policy template name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the policyServiceType. + * + * Service type, Optional. + * + * @return the policyServiceType + */ + public String policyServiceType() { + return policyServiceType; + } + + /** + * Gets the policyServiceName. + * + * Service name, Optional. + * + * @return the policyServiceName + */ + public String policyServiceName() { + return policyServiceName; + } + + /** + * Gets the policyServiceGroupId. + * + * Service group id, Optional. + * + * @return the policyServiceGroupId + */ + public String policyServiceGroupId() { + return policyServiceGroupId; + } + + /** + * Gets the policyType. + * + * Policy type, Optional. + * + * @return the policyType + */ + public String policyType() { + return policyType; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java new file mode 100644 index 00000000000..adcb3f0cc90 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java @@ -0,0 +1,245 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listRoleAssignments options. + */ +public class ListRoleAssignmentsOptions extends GenericModel { + + protected String accountId; + protected String acceptLanguage; + protected String templateId; + protected String templateVersion; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String templateId; + private String templateVersion; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListRoleAssignmentsOptions instance. + * + * @param listRoleAssignmentsOptions the instance to initialize the Builder with + */ + private Builder(ListRoleAssignmentsOptions listRoleAssignmentsOptions) { + this.accountId = listRoleAssignmentsOptions.accountId; + this.acceptLanguage = listRoleAssignmentsOptions.acceptLanguage; + this.templateId = listRoleAssignmentsOptions.templateId; + this.templateVersion = listRoleAssignmentsOptions.templateVersion; + this.limit = listRoleAssignmentsOptions.limit; + this.start = listRoleAssignmentsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListRoleAssignmentsOptions. + * + * @return the new ListRoleAssignmentsOptions instance + */ + public ListRoleAssignmentsOptions build() { + return new ListRoleAssignmentsOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListRoleAssignmentsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListRoleAssignmentsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the templateId. + * + * @param templateId the templateId + * @return the ListRoleAssignmentsOptions builder + */ + public Builder templateId(String templateId) { + this.templateId = templateId; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the ListRoleAssignmentsOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListRoleAssignmentsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListRoleAssignmentsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListRoleAssignmentsOptions() { } + + protected ListRoleAssignmentsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + templateId = builder.templateId; + templateVersion = builder.templateVersion; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListRoleAssignmentsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID in which the role assignment belongs to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the templateId. + * + * Optional template ID. + * + * @return the templateId + */ + public String templateId() { + return templateId; + } + + /** + * Gets the templateVersion. + * + * Optional role template version. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java new file mode 100644 index 00000000000..e22751433e5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listRoleTemplateVersions options. + */ +public class ListRoleTemplateVersionsOptions extends GenericModel { + + /** + * Role template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String roleTemplateId; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListRoleTemplateVersionsOptions instance. + * + * @param listRoleTemplateVersionsOptions the instance to initialize the Builder with + */ + private Builder(ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions) { + this.roleTemplateId = listRoleTemplateVersionsOptions.roleTemplateId; + this.state = listRoleTemplateVersionsOptions.state; + this.limit = listRoleTemplateVersionsOptions.limit; + this.start = listRoleTemplateVersionsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + */ + public Builder(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + } + + /** + * Builds a ListRoleTemplateVersionsOptions. + * + * @return the new ListRoleTemplateVersionsOptions instance + */ + public ListRoleTemplateVersionsOptions build() { + return new ListRoleTemplateVersionsOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the ListRoleTemplateVersionsOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListRoleTemplateVersionsOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListRoleTemplateVersionsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListRoleTemplateVersionsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListRoleTemplateVersionsOptions() { } + + protected ListRoleTemplateVersionsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + roleTemplateId = builder.roleTemplateId; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListRoleTemplateVersionsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * The role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the state. + * + * Role template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java new file mode 100644 index 00000000000..8f889bdce96 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java @@ -0,0 +1,307 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listRoleTemplates options. + */ +public class ListRoleTemplatesOptions extends GenericModel { + + /** + * The role template state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String accountId; + protected String acceptLanguage; + protected String name; + protected String roleName; + protected String roleServiceName; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String name; + private String roleName; + private String roleServiceName; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListRoleTemplatesOptions instance. + * + * @param listRoleTemplatesOptions the instance to initialize the Builder with + */ + private Builder(ListRoleTemplatesOptions listRoleTemplatesOptions) { + this.accountId = listRoleTemplatesOptions.accountId; + this.acceptLanguage = listRoleTemplatesOptions.acceptLanguage; + this.name = listRoleTemplatesOptions.name; + this.roleName = listRoleTemplatesOptions.roleName; + this.roleServiceName = listRoleTemplatesOptions.roleServiceName; + this.state = listRoleTemplatesOptions.state; + this.limit = listRoleTemplatesOptions.limit; + this.start = listRoleTemplatesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListRoleTemplatesOptions. + * + * @return the new ListRoleTemplatesOptions instance + */ + public ListRoleTemplatesOptions build() { + return new ListRoleTemplatesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListRoleTemplatesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListRoleTemplatesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ListRoleTemplatesOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the roleName. + * + * @param roleName the roleName + * @return the ListRoleTemplatesOptions builder + */ + public Builder roleName(String roleName) { + this.roleName = roleName; + return this; + } + + /** + * Set the roleServiceName. + * + * @param roleServiceName the roleServiceName + * @return the ListRoleTemplatesOptions builder + */ + public Builder roleServiceName(String roleServiceName) { + this.roleServiceName = roleServiceName; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListRoleTemplatesOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListRoleTemplatesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListRoleTemplatesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListRoleTemplatesOptions() { } + + protected ListRoleTemplatesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + name = builder.name; + roleName = builder.roleName; + roleServiceName = builder.roleServiceName; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListRoleTemplatesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the role templates belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the name. + * + * The role template name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the roleName. + * + * The template role name. + * + * @return the roleName + */ + public String roleName() { + return roleName; + } + + /** + * Gets the roleServiceName. + * + * The template role service name. + * + * @return the roleServiceName + */ + public String roleServiceName() { + return roleServiceName; + } + + /** + * Gets the state. + * + * The role template state. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java new file mode 100644 index 00000000000..2ca364c53a3 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java @@ -0,0 +1,234 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listRoles options. + */ +public class ListRolesOptions extends GenericModel { + + protected String acceptLanguage; + protected String accountId; + protected String serviceName; + protected String sourceServiceName; + protected String policyType; + protected String serviceGroupId; + + /** + * Builder. + */ + public static class Builder { + private String acceptLanguage; + private String accountId; + private String serviceName; + private String sourceServiceName; + private String policyType; + private String serviceGroupId; + + /** + * Instantiates a new Builder from an existing ListRolesOptions instance. + * + * @param listRolesOptions the instance to initialize the Builder with + */ + private Builder(ListRolesOptions listRolesOptions) { + this.acceptLanguage = listRolesOptions.acceptLanguage; + this.accountId = listRolesOptions.accountId; + this.serviceName = listRolesOptions.serviceName; + this.sourceServiceName = listRolesOptions.sourceServiceName; + this.policyType = listRolesOptions.policyType; + this.serviceGroupId = listRolesOptions.serviceGroupId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ListRolesOptions. + * + * @return the new ListRolesOptions instance + */ + public ListRolesOptions build() { + return new ListRolesOptions(this); + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListRolesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListRolesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the ListRolesOptions builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the sourceServiceName. + * + * @param sourceServiceName the sourceServiceName + * @return the ListRolesOptions builder + */ + public Builder sourceServiceName(String sourceServiceName) { + this.sourceServiceName = sourceServiceName; + return this; + } + + /** + * Set the policyType. + * + * @param policyType the policyType + * @return the ListRolesOptions builder + */ + public Builder policyType(String policyType) { + this.policyType = policyType; + return this; + } + + /** + * Set the serviceGroupId. + * + * @param serviceGroupId the serviceGroupId + * @return the ListRolesOptions builder + */ + public Builder serviceGroupId(String serviceGroupId) { + this.serviceGroupId = serviceGroupId; + return this; + } + } + + protected ListRolesOptions() { } + + protected ListRolesOptions(Builder builder) { + acceptLanguage = builder.acceptLanguage; + accountId = builder.accountId; + serviceName = builder.serviceName; + sourceServiceName = builder.sourceServiceName; + policyType = builder.policyType; + serviceGroupId = builder.serviceGroupId; + } + + /** + * New builder. + * + * @return a ListRolesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the accountId. + * + * Optional account GUID in which the roles belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the serviceName. + * + * Optional name of IAM enabled service. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the sourceServiceName. + * + * Optional name of source IAM enabled service. + * + * @return the sourceServiceName + */ + public String sourceServiceName() { + return sourceServiceName; + } + + /** + * Gets the policyType. + * + * Optional Policy Type. + * + * @return the policyType + */ + public String policyType() { + return policyType; + } + + /** + * Gets the serviceGroupId. + * + * Optional id of service group. + * + * @return the serviceGroupId + */ + public String serviceGroupId() { + return serviceGroupId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java new file mode 100644 index 00000000000..65849c3d9a6 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java @@ -0,0 +1,492 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listV2Policies options. + */ +public class ListV2PoliciesOptions extends GenericModel { + + /** + * Optional type of policy. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + /** + * Optional type of service. + */ + public interface ServiceType { + /** service. */ + String SERVICE = "service"; + /** platform_service. */ + String PLATFORM_SERVICE = "platform_service"; + } + + /** + * Include additional data per policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles and translations for all + * relevant fields. + */ + public interface Format { + /** include_last_permit. */ + String INCLUDE_LAST_PERMIT = "include_last_permit"; + /** display. */ + String DISPLAY = "display"; + } + + /** + * The state of the policy. + * * `active` - returns active policies + * * `deleted` - returns non-active policies. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String accountId; + protected String acceptLanguage; + protected String iamId; + protected String accessGroupId; + protected String type; + protected String serviceType; + protected String serviceName; + protected String serviceGroupId; + protected String sort; + protected String format; + protected String state; + protected Long limit; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String acceptLanguage; + private String iamId; + private String accessGroupId; + private String type; + private String serviceType; + private String serviceName; + private String serviceGroupId; + private String sort; + private String format; + private String state; + private Long limit; + private String start; + + /** + * Instantiates a new Builder from an existing ListV2PoliciesOptions instance. + * + * @param listV2PoliciesOptions the instance to initialize the Builder with + */ + private Builder(ListV2PoliciesOptions listV2PoliciesOptions) { + this.accountId = listV2PoliciesOptions.accountId; + this.acceptLanguage = listV2PoliciesOptions.acceptLanguage; + this.iamId = listV2PoliciesOptions.iamId; + this.accessGroupId = listV2PoliciesOptions.accessGroupId; + this.type = listV2PoliciesOptions.type; + this.serviceType = listV2PoliciesOptions.serviceType; + this.serviceName = listV2PoliciesOptions.serviceName; + this.serviceGroupId = listV2PoliciesOptions.serviceGroupId; + this.sort = listV2PoliciesOptions.sort; + this.format = listV2PoliciesOptions.format; + this.state = listV2PoliciesOptions.state; + this.limit = listV2PoliciesOptions.limit; + this.start = listV2PoliciesOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + */ + public Builder(String accountId) { + this.accountId = accountId; + } + + /** + * Builds a ListV2PoliciesOptions. + * + * @return the new ListV2PoliciesOptions instance + */ + public ListV2PoliciesOptions build() { + return new ListV2PoliciesOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListV2PoliciesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the ListV2PoliciesOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** + * Set the iamId. + * + * @param iamId the iamId + * @return the ListV2PoliciesOptions builder + */ + public Builder iamId(String iamId) { + this.iamId = iamId; + return this; + } + + /** + * Set the accessGroupId. + * + * @param accessGroupId the accessGroupId + * @return the ListV2PoliciesOptions builder + */ + public Builder accessGroupId(String accessGroupId) { + this.accessGroupId = accessGroupId; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the ListV2PoliciesOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the serviceType. + * + * @param serviceType the serviceType + * @return the ListV2PoliciesOptions builder + */ + public Builder serviceType(String serviceType) { + this.serviceType = serviceType; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the ListV2PoliciesOptions builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the serviceGroupId. + * + * @param serviceGroupId the serviceGroupId + * @return the ListV2PoliciesOptions builder + */ + public Builder serviceGroupId(String serviceGroupId) { + this.serviceGroupId = serviceGroupId; + return this; + } + + /** + * Set the sort. + * + * @param sort the sort + * @return the ListV2PoliciesOptions builder + */ + public Builder sort(String sort) { + this.sort = sort; + return this; + } + + /** + * Set the format. + * + * @param format the format + * @return the ListV2PoliciesOptions builder + */ + public Builder format(String format) { + this.format = format; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the ListV2PoliciesOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListV2PoliciesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListV2PoliciesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListV2PoliciesOptions() { } + + protected ListV2PoliciesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + accountId = builder.accountId; + acceptLanguage = builder.acceptLanguage; + iamId = builder.iamId; + accessGroupId = builder.accessGroupId; + type = builder.type; + serviceType = builder.serviceType; + serviceName = builder.serviceName; + serviceGroupId = builder.serviceGroupId; + sort = builder.sort; + format = builder.format; + state = builder.state; + limit = builder.limit; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListV2PoliciesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID in which the policies belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } + + /** + * Gets the iamId. + * + * Optional IAM ID used to identify the subject. + * + * @return the iamId + */ + public String iamId() { + return iamId; + } + + /** + * Gets the accessGroupId. + * + * Optional access group id. + * + * @return the accessGroupId + */ + public String accessGroupId() { + return accessGroupId; + } + + /** + * Gets the type. + * + * Optional type of policy. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the serviceType. + * + * Optional type of service. + * + * @return the serviceType + */ + public String serviceType() { + return serviceType; + } + + /** + * Gets the serviceName. + * + * Optional name of service. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the serviceGroupId. + * + * Optional ID of service group. + * + * @return the serviceGroupId + */ + public String serviceGroupId() { + return serviceGroupId; + } + + /** + * Gets the sort. + * + * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending + * '-' to field, for example, '-last_modified_at'. Note that last permit information is only included when + * 'format=include_last_permit', for example, "format=include_last_permit&sort=last_permit_at" Example fields that + * can be sorted on: + * - 'id' + * - 'type' + * - 'href' + * - 'created_at' + * - 'created_by_id' + * - 'last_modified_at' + * - 'last_modified_by_id' + * - 'state' + * - 'last_permit_at' + * - 'last_permit_frequency'. + * + * @return the sort + */ + public String sort() { + return sort; + } + + /** + * Gets the format. + * + * Include additional data per policy returned + * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times + * it has done so + * * `display` - returns the list of all actions included in each of the policy roles and translations for all + * relevant fields. + * + * @return the format + */ + public String format() { + return format; + } + + /** + * Gets the state. + * + * The state of the policy. + * * `active` - returns active policies + * * `deleted` - returns non-active policies. + * + * @return the state + */ + public String state() { + return state; + } + + /** + * Gets the limit. + * + * The number of documents to include in the collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection to return. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java new file mode 100644 index 00000000000..4d43d84dbba --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java @@ -0,0 +1,126 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Condition that specifies additional conditions or RuleAttribute to grant access. + * + * Classes which extend this class: + * - NestedConditionRuleAttribute + * - NestedConditionRuleWithConditions + */ +public class NestedCondition extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + protected String key; + protected String operator; + protected Object value; + protected List conditions; + + protected NestedCondition() { } + + /** + * Gets the key. + * + * The name of an attribute. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } + + /** + * Gets the conditions. + * + * List of conditions associated with a policy. For example, time-based conditions that grant access over a certain + * time period. + * + * @return the conditions + */ + public List conditions() { + return conditions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java new file mode 100644 index 00000000000..b1d44da3f6b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java @@ -0,0 +1,170 @@ +/* + * (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_policy_management.v1.model; + +/** + * Rule that specifies additional access that is granted (For example, time-based condition). + */ +public class NestedConditionRuleAttribute extends NestedCondition { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing NestedConditionRuleAttribute instance. + * + * @param nestedConditionRuleAttribute the instance to initialize the Builder with + */ + public Builder(NestedCondition nestedConditionRuleAttribute) { + this.key = nestedConditionRuleAttribute.key; + this.operator = nestedConditionRuleAttribute.operator; + this.value = nestedConditionRuleAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a NestedConditionRuleAttribute. + * + * @return the new NestedConditionRuleAttribute instance + */ + public NestedConditionRuleAttribute build() { + return new NestedConditionRuleAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the NestedConditionRuleAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the NestedConditionRuleAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the NestedConditionRuleAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected NestedConditionRuleAttribute() { } + + protected NestedConditionRuleAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a NestedConditionRuleAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java new file mode 100644 index 00000000000..20d0faac795 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java @@ -0,0 +1,139 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * Rule that specifies additional access that is granted (for example, time-based condition) accross multiple + * conditions. + */ +public class NestedConditionRuleWithConditions extends NestedCondition { + + /** + * Operator to evaluate conditions. + */ + public interface Operator { + /** and. */ + String AND = "and"; + /** or. */ + String OR = "or"; + } + + + /** + * Builder. + */ + public static class Builder { + private String operator; + private List conditions; + + /** + * Instantiates a new Builder from an existing NestedConditionRuleWithConditions instance. + * + * @param nestedConditionRuleWithConditions the instance to initialize the Builder with + */ + public Builder(NestedCondition nestedConditionRuleWithConditions) { + this.operator = nestedConditionRuleWithConditions.operator; + this.conditions = nestedConditionRuleWithConditions.conditions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param operator the operator + * @param conditions the conditions + */ + public Builder(String operator, List conditions) { + this.operator = operator; + this.conditions = conditions; + } + + /** + * Builds a NestedConditionRuleWithConditions. + * + * @return the new NestedConditionRuleWithConditions instance + */ + public NestedConditionRuleWithConditions build() { + return new NestedConditionRuleWithConditions(this); + } + + /** + * Adds a new element to conditions. + * + * @param conditions the new element to be added + * @return the NestedConditionRuleWithConditions builder + */ + public Builder addConditions(RuleAttribute conditions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(conditions, + "conditions cannot be null"); + if (this.conditions == null) { + this.conditions = new ArrayList(); + } + this.conditions.add(conditions); + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the NestedConditionRuleWithConditions builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the conditions. + * Existing conditions will be replaced. + * + * @param conditions the conditions + * @return the NestedConditionRuleWithConditions builder + */ + public Builder conditions(List conditions) { + this.conditions = conditions; + return this; + } + } + + protected NestedConditionRuleWithConditions() { } + + protected NestedConditionRuleWithConditions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.conditions, + "conditions cannot be null"); + operator = builder.operator; + conditions = builder.conditions; + } + + /** + * New builder. + * + * @return a NestedConditionRuleWithConditions builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java new file mode 100644 index 00000000000..b0442f902bc --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Details with href linking to the following page of requested collection. + */ +public class Next extends GenericModel { + + protected String href; + protected String start; + + protected Next() { } + + /** + * Gets the href. + * + * The href linking to the page of requested collection. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection. + * + * @return the start + */ + public String getStart() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java new file mode 100644 index 00000000000..8f12053c72e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * PoliciesPager can be used to simplify the use of the "listPolicies" method. + */ +public class PoliciesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListPoliciesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected PoliciesPager() { } + + /** + * Constructs a new PoliciesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listPolicies" method + * @param options the ListPoliciesOptions instance to be used to invoke the "listPolicies" method + */ + public PoliciesPager(IamPolicyManagement client, ListPoliciesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<PolicyTemplateMetaData> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListPoliciesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + PolicyCollection result = client.listPolicies(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getPolicies(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<PolicyTemplateMetaData> containing all results returned by the "listPolicies" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java new file mode 100644 index 00000000000..af852b7cd74 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java @@ -0,0 +1,188 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with a policy. + */ +public class Policy extends GenericModel { + + /** + * The policy state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String id; + protected String type; + protected String description; + protected List subjects; + protected List roles; + protected List resources; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String state; + + protected Policy() { } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the description. + * + * Customer-defined description. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the subjects. + * + * The subjects associated with a policy. + * + * @return the subjects + */ + public List getSubjects() { + return subjects; + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List getRoles() { + return roles; + } + + /** + * Gets the resources. + * + * The resources associated with a policy. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the href. + * + * The href links back to the policy. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the state. + * + * The policy state. + * + * @return the state + */ + public String getState() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java new file mode 100644 index 00000000000..3e566ce7bdf --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Set of properties for the assigned resource. + */ +public class PolicyAssignmentResourcePolicy extends GenericModel { + + @SerializedName("resource_created") + protected AssignmentResourceCreated resourceCreated; + protected String status; + @SerializedName("error_message") + protected AssignmentResourceError errorMessage; + + protected PolicyAssignmentResourcePolicy() { } + + /** + * Gets the resourceCreated. + * + * On success, includes the policy that is assigned. + * + * @return the resourceCreated + */ + public AssignmentResourceCreated getResourceCreated() { + return resourceCreated; + } + + /** + * Gets the status. + * + * policy status. + * + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * Gets the errorMessage. + * + * Body parameters for assignment error. + * + * @return the errorMessage + */ + public AssignmentResourceError getErrorMessage() { + return errorMessage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java new file mode 100644 index 00000000000..ad944536b0d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The policy assignment resources. + */ +public class PolicyAssignmentResources extends GenericModel { + + protected String target; + protected PolicyAssignmentResourcePolicy policy; + + protected PolicyAssignmentResources() { } + + /** + * Gets the target. + * + * Account ID where resources are assigned. + * + * @return the target + */ + public String getTarget() { + return target; + } + + /** + * Gets the policy. + * + * Set of properties for the assigned resource. + * + * @return the policy + */ + public PolicyAssignmentResourcePolicy getPolicy() { + return policy; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java new file mode 100644 index 00000000000..f1ea295713c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java @@ -0,0 +1,193 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the policy template assignment. + */ +public class PolicyAssignmentV1 extends GenericModel { + + /** + * The policy assignment status. + */ + public interface Status { + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** succeeded. */ + String SUCCEEDED = "succeeded"; + /** succeed_with_errors. */ + String SUCCEED_WITH_ERRORS = "succeed_with_errors"; + /** failed. */ + String FAILED = "failed"; + } + + protected AssignmentTargetDetails target; + protected String id; + @SerializedName("account_id") + protected String accountId; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected List resources; + protected PolicyAssignmentV1Subject subject; + protected AssignmentTemplateDetails template; + protected String status; + + protected PolicyAssignmentV1() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the id. + * + * Policy assignment ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the accountId. + * + * The account GUID that the policies assignments belong to. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the href. + * + * The href URL that links to the policies assignments API by policy assignment ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy assignment was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy assignment. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy assignment was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy assignment. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the resources. + * + * Object for each account assigned. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the subject. + * + * Subject details of access type assignment. + * + * @return the subject + */ + public PolicyAssignmentV1Subject getSubject() { + return subject; + } + + /** + * Gets the template. + * + * policy template details. + * + * @return the template + */ + public AssignmentTemplateDetails getTemplate() { + return template; + } + + /** + * Gets the status. + * + * The policy assignment status. + * + * @return the status + */ + public String getStatus() { + return status; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java new file mode 100644 index 00000000000..7331ee5a854 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Policy assignment response. + */ +public class PolicyAssignmentV1Collection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List assignments; + + protected PolicyAssignmentV1Collection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the assignments. + * + * Response of policy assignments. + * + * @return the assignments + */ + public List getAssignments() { + return assignments; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java new file mode 100644 index 00000000000..c05eb90816b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The policy assignment resources. + */ +public class PolicyAssignmentV1Resources extends GenericModel { + + protected AssignmentTargetDetails target; + protected PolicyAssignmentResourcePolicy policy; + + protected PolicyAssignmentV1Resources() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the policy. + * + * Set of properties for the assigned resource. + * + * @return the policy + */ + public PolicyAssignmentResourcePolicy getPolicy() { + return policy; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java new file mode 100644 index 00000000000..58b2cd240ba --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java @@ -0,0 +1,60 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Subject details of access type assignment. + */ +public class PolicyAssignmentV1Subject extends GenericModel { + + /** + * The identity type of the subject of the assignment. + */ + public interface Type { + /** iam_id. */ + String IAM_ID = "iam_id"; + /** access_group_id. */ + String ACCESS_GROUP_ID = "access_group_id"; + } + + protected String id; + protected String type; + + protected PolicyAssignmentV1Subject() { } + + /** + * Gets the id. + * + * The unique identifier of the subject of the assignment. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the type. + * + * The identity type of the subject of the assignment. + * + * @return the type + */ + public String getType() { + return type; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java new file mode 100644 index 00000000000..931769daed5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * PolicyAssignmentsPager can be used to simplify the use of the "listPolicyAssignments" method. + */ +public class PolicyAssignmentsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListPolicyAssignmentsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected PolicyAssignmentsPager() { } + + /** + * Constructs a new PolicyAssignmentsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyAssignments" method + * @param options the ListPolicyAssignmentsOptions instance to be used to invoke the "listPolicyAssignments" method + */ + public PolicyAssignmentsPager(IamPolicyManagement client, ListPolicyAssignmentsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<PolicyTemplateAssignmentItems> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListPolicyAssignmentsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + PolicyTemplateAssignmentCollection result = client.listPolicyAssignments(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getAssignments(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<PolicyTemplateAssignmentItems> containing all results returned by the "listPolicyAssignments" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java new file mode 100644 index 00000000000..25062dd0a52 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of policies. + */ +public class PolicyCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List policies; + + protected PolicyCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the policies. + * + * List of policies. + * + * @return the policies + */ + public List getPolicies() { + return policies; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java new file mode 100644 index 00000000000..4033f2dbc9d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java @@ -0,0 +1,167 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The attributes of the resource. Note that only one resource is allowed in a policy. + */ +public class PolicyResource extends GenericModel { + + protected List attributes; + protected List tags; + + /** + * Builder. + */ + public static class Builder { + private List attributes; + private List tags; + + /** + * Instantiates a new Builder from an existing PolicyResource instance. + * + * @param policyResource the instance to initialize the Builder with + */ + private Builder(PolicyResource policyResource) { + this.attributes = policyResource.attributes; + this.tags = policyResource.tags; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param attributes the attributes + */ + public Builder(List attributes) { + this.attributes = attributes; + } + + /** + * Builds a PolicyResource. + * + * @return the new PolicyResource instance + */ + public PolicyResource build() { + return new PolicyResource(this); + } + + /** + * Adds a new element to attributes. + * + * @param attributes the new element to be added + * @return the PolicyResource builder + */ + public Builder addAttributes(ResourceAttribute attributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, + "attributes cannot be null"); + if (this.attributes == null) { + this.attributes = new ArrayList(); + } + this.attributes.add(attributes); + return this; + } + + /** + * Adds a new element to tags. + * + * @param tags the new element to be added + * @return the PolicyResource builder + */ + public Builder addTags(ResourceTag tags) { + com.ibm.cloud.sdk.core.util.Validator.notNull(tags, + "tags cannot be null"); + if (this.tags == null) { + this.tags = new ArrayList(); + } + this.tags.add(tags); + return this; + } + + /** + * Set the attributes. + * Existing attributes will be replaced. + * + * @param attributes the attributes + * @return the PolicyResource builder + */ + public Builder attributes(List attributes) { + this.attributes = attributes; + return this; + } + + /** + * Set the tags. + * Existing tags will be replaced. + * + * @param tags the tags + * @return the PolicyResource builder + */ + public Builder tags(List tags) { + this.tags = tags; + return this; + } + } + + protected PolicyResource() { } + + protected PolicyResource(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, + "attributes cannot be null"); + attributes = builder.attributes; + tags = builder.tags; + } + + /** + * New builder. + * + * @return a PolicyResource builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the attributes. + * + * List of resource attributes. + * + * @return the attributes + */ + public List attributes() { + return attributes; + } + + /** + * Gets the tags. + * + * List of access management tags. + * + * @return the tags + */ + public List tags() { + return tags; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java new file mode 100644 index 00000000000..7319eabce7b --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java @@ -0,0 +1,131 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role associated with a policy. + */ +public class PolicyRole extends GenericModel { + + @SerializedName("role_id") + protected String roleId; + @SerializedName("display_name") + protected String displayName; + protected String description; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + + /** + * Instantiates a new Builder from an existing PolicyRole instance. + * + * @param policyRole the instance to initialize the Builder with + */ + private Builder(PolicyRole policyRole) { + this.roleId = policyRole.roleId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + */ + public Builder(String roleId) { + this.roleId = roleId; + } + + /** + * Builds a PolicyRole. + * + * @return the new PolicyRole instance + */ + public PolicyRole build() { + return new PolicyRole(this); + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the PolicyRole builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + } + + protected PolicyRole() { } + + protected PolicyRole(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleId, + "roleId cannot be null"); + roleId = builder.roleId; + } + + /** + * New builder. + * + * @return a PolicyRole builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } + + /** + * Gets the displayName. + * + * The display name of the role. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String description() { + return description; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java new file mode 100644 index 00000000000..bf1b035a6b7 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java @@ -0,0 +1,124 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The subject attribute values that must match in order for this policy to apply in a permission decision. + */ +public class PolicySubject extends GenericModel { + + protected List attributes; + + /** + * Builder. + */ + public static class Builder { + private List attributes; + + /** + * Instantiates a new Builder from an existing PolicySubject instance. + * + * @param policySubject the instance to initialize the Builder with + */ + private Builder(PolicySubject policySubject) { + this.attributes = policySubject.attributes; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param attributes the attributes + */ + public Builder(List attributes) { + this.attributes = attributes; + } + + /** + * Builds a PolicySubject. + * + * @return the new PolicySubject instance + */ + public PolicySubject build() { + return new PolicySubject(this); + } + + /** + * Adds a new element to attributes. + * + * @param attributes the new element to be added + * @return the PolicySubject builder + */ + public Builder addAttributes(SubjectAttribute attributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, + "attributes cannot be null"); + if (this.attributes == null) { + this.attributes = new ArrayList(); + } + this.attributes.add(attributes); + return this; + } + + /** + * Set the attributes. + * Existing attributes will be replaced. + * + * @param attributes the attributes + * @return the PolicySubject builder + */ + public Builder attributes(List attributes) { + this.attributes = attributes; + return this; + } + } + + protected PolicySubject() { } + + protected PolicySubject(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, + "attributes cannot be null"); + attributes = builder.attributes; + } + + /** + * New builder. + * + * @return a PolicySubject builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the attributes. + * + * List of subject attributes. + * + * @return the attributes + */ + public List attributes() { + return attributes; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java new file mode 100644 index 00000000000..bdffbe98c10 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java @@ -0,0 +1,202 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the policy template. + */ +public class PolicyTemplate extends GenericModel { + + /** + * State of policy template. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String name; + protected String description; + @SerializedName("account_id") + protected String accountId; + protected String version; + protected Boolean committed; + protected TemplatePolicy policy; + protected String state; + protected String id; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + + protected PolicyTemplate() { } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the version. + * + * Template version. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the committed. + * + * Committed status of the template version. + * + * @return the committed + */ + public Boolean isCommitted() { + return committed; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy getPolicy() { + return policy; + } + + /** + * Gets the state. + * + * State of policy template. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the id. + * + * The policy template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the policy templates API by policy template ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy template was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy template. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy template was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy template. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java new file mode 100644 index 00000000000..54727eadf4d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of policies assignments. + */ +public class PolicyTemplateAssignmentCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List assignments; + + protected PolicyTemplateAssignmentCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the assignments. + * + * List of policy assignments. + * + * @return the assignments + */ + public List getAssignments() { + return assignments; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java new file mode 100644 index 00000000000..2c8e82df441 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java @@ -0,0 +1,261 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * PolicyTemplateAssignmentItems. + * + * Classes which extend this class: + * - PolicyTemplateAssignmentItemsPolicyAssignmentV1 + * - PolicyTemplateAssignmentItemsPolicyAssignment + */ +public class PolicyTemplateAssignmentItems extends GenericModel { + + /** + * The policy assignment status. + */ + public interface Status { + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** succeeded. */ + String SUCCEEDED = "succeeded"; + /** succeed_with_errors. */ + String SUCCEED_WITH_ERRORS = "succeed_with_errors"; + /** failed. */ + String FAILED = "failed"; + } + + /** + * Assignment target type. + */ + public interface TargetType { + /** Account. */ + String ACCOUNT = "Account"; + /** AccountGroup. */ + String ACCOUNTGROUP = "AccountGroup"; + /** Enterprise. */ + String ENTERPRISE = "Enterprise"; + } + + protected AssignmentTargetDetails target; + protected String id; + @SerializedName("account_id") + protected String accountId; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected List resources; + protected PolicyAssignmentV1Subject subject; + protected AssignmentTemplateDetails template; + protected String status; + @SerializedName("template_id") + protected String templateId; + @SerializedName("template_version") + protected String templateVersion; + @SerializedName("assignment_id") + protected String assignmentId; + @SerializedName("target_type") + protected String targetType; + + protected PolicyTemplateAssignmentItems() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the id. + * + * Policy assignment ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the accountId. + * + * The account GUID that the policies assignments belong to. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the href. + * + * The href URL that links to the policies assignments API by policy assignment ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy assignment was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy assignment. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy assignment was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy assignment. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the resources. + * + * Object for each account assigned. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the subject. + * + * Subject details of access type assignment. + * + * @return the subject + */ + public PolicyAssignmentV1Subject getSubject() { + return subject; + } + + /** + * Gets the template. + * + * policy template details. + * + * @return the template + */ + public AssignmentTemplateDetails getTemplate() { + return template; + } + + /** + * Gets the status. + * + * The policy assignment status. + * + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * Gets the templateId. + * + * policy template ID. + * + * @return the templateId + */ + public String getTemplateId() { + return templateId; + } + + /** + * Gets the templateVersion. + * + * policy template version. + * + * @return the templateVersion + */ + public String getTemplateVersion() { + return templateVersion; + } + + /** + * Gets the assignmentId. + * + * Passed in value to correlate with other assignments. + * + * @return the assignmentId + */ + public String getAssignmentId() { + return assignmentId; + } + + /** + * Gets the targetType. + * + * Assignment target type. + * + * @return the targetType + */ + public String getTargetType() { + return targetType; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java new file mode 100644 index 00000000000..ec9c32e5bdd --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +/** + * The set of properties associated with the policy template assignment. + */ +public class PolicyTemplateAssignmentItemsPolicyAssignment extends PolicyTemplateAssignmentItems { + + /** + * Assignment target type. + */ + public interface TargetType { + /** Account. */ + String ACCOUNT = "Account"; + /** AccountGroup. */ + String ACCOUNTGROUP = "AccountGroup"; + /** Enterprise. */ + String ENTERPRISE = "Enterprise"; + } + + /** + * The policy assignment status. + */ + public interface Status { + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** succeeded. */ + String SUCCEEDED = "succeeded"; + /** succeed_with_errors. */ + String SUCCEED_WITH_ERRORS = "succeed_with_errors"; + /** failed. */ + String FAILED = "failed"; + } + + + protected PolicyTemplateAssignmentItemsPolicyAssignment() { } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java new file mode 100644 index 00000000000..4cebdbb17b1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.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_policy_management.v1.model; + +/** + * The set of properties associated with the policy template assignment. + */ +public class PolicyTemplateAssignmentItemsPolicyAssignmentV1 extends PolicyTemplateAssignmentItems { + + /** + * The policy assignment status. + */ + public interface Status { + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** succeeded. */ + String SUCCEEDED = "succeeded"; + /** succeed_with_errors. */ + String SUCCEED_WITH_ERRORS = "succeed_with_errors"; + /** failed. */ + String FAILED = "failed"; + } + + + protected PolicyTemplateAssignmentItemsPolicyAssignmentV1() { } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java new file mode 100644 index 00000000000..2a262c584b5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java @@ -0,0 +1,90 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of policy Templates. + */ +public class PolicyTemplateCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + @SerializedName("policy_templates") + protected List policyTemplates; + + protected PolicyTemplateCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the policyTemplates. + * + * List of policy templates. + * + * @return the policyTemplates + */ + public List getPolicyTemplates() { + return policyTemplates; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java new file mode 100644 index 00000000000..5a2876dfe28 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java @@ -0,0 +1,214 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the policy template. + */ +public class PolicyTemplateLimitData extends GenericModel { + + /** + * State of policy template. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String name; + protected String description; + @SerializedName("account_id") + protected String accountId; + protected String version; + protected Boolean committed; + protected TemplatePolicy policy; + protected String state; + protected String id; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected TemplateCountData counts; + + protected PolicyTemplateLimitData() { } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the version. + * + * Template version. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the committed. + * + * Committed status of the template version. + * + * @return the committed + */ + public Boolean isCommitted() { + return committed; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy getPolicy() { + return policy; + } + + /** + * Gets the state. + * + * State of policy template. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the id. + * + * The policy template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the policy templates API by policy template ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy template was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy template. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy template was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy template. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the counts. + * + * policy template count details. + * + * @return the counts + */ + public TemplateCountData getCounts() { + return counts; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java new file mode 100644 index 00000000000..07effc5b3ad --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java @@ -0,0 +1,201 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with a policy. + */ +public class PolicyTemplateMetaData extends GenericModel { + + /** + * The policy state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String id; + protected String type; + protected String description; + protected List subjects; + protected List roles; + protected List resources; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String state; + protected TemplateMetadata template; + + protected PolicyTemplateMetaData() { } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the description. + * + * Customer-defined description. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the subjects. + * + * The subjects associated with a policy. + * + * @return the subjects + */ + public List getSubjects() { + return subjects; + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List getRoles() { + return roles; + } + + /** + * Gets the resources. + * + * The resources associated with a policy. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the href. + * + * The href links back to the policy. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the state. + * + * The policy state. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the template. + * + * The details of the IAM template that was used to create an enterprise-managed policy in your account. When + * returned, this indicates that the policy is created from and managed by a template in the root enterprise account. + * + * @return the template + */ + public TemplateMetadata getTemplate() { + return template; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java new file mode 100644 index 00000000000..a4f95bc6562 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of versions for a specific policy template. + */ +public class PolicyTemplateVersionsCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List versions; + + protected PolicyTemplateVersionsCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the versions. + * + * List of policy templates versions. + * + * @return the versions + */ + public List getVersions() { + return versions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java new file mode 100644 index 00000000000..f6a2496cf91 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * PolicyTemplateVersionsPager can be used to simplify the use of the "listPolicyTemplateVersions" method. + */ +public class PolicyTemplateVersionsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListPolicyTemplateVersionsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected PolicyTemplateVersionsPager() { } + + /** + * Constructs a new PolicyTemplateVersionsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyTemplateVersions" method + * @param options the ListPolicyTemplateVersionsOptions instance to be used to invoke the "listPolicyTemplateVersions" method + */ + public PolicyTemplateVersionsPager(IamPolicyManagement client, ListPolicyTemplateVersionsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<PolicyTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListPolicyTemplateVersionsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + PolicyTemplateVersionsCollection result = client.listPolicyTemplateVersions(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getVersions(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<PolicyTemplate> containing all results returned by the "listPolicyTemplateVersions" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java new file mode 100644 index 00000000000..eba6e6c8fad --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * PolicyTemplatesPager can be used to simplify the use of the "listPolicyTemplates" method. + */ +public class PolicyTemplatesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListPolicyTemplatesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected PolicyTemplatesPager() { } + + /** + * Constructs a new PolicyTemplatesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyTemplates" method + * @param options the ListPolicyTemplatesOptions instance to be used to invoke the "listPolicyTemplates" method + */ + public PolicyTemplatesPager(IamPolicyManagement client, ListPolicyTemplatesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<PolicyTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListPolicyTemplatesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + PolicyTemplateCollection result = client.listPolicyTemplates(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getPolicyTemplates(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<PolicyTemplate> containing all results returned by the "listPolicyTemplates" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java new file mode 100644 index 00000000000..2656f3fb790 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Details with linking href to previous page of requested collection. + */ +public class Previous extends GenericModel { + + protected String href; + protected String start; + + protected Previous() { } + + /** + * Gets the href. + * + * The href linking to the page of requested collection. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the start. + * + * Page token that refers to the page of the collection. + * + * @return the start + */ + public String getStart() { + return start; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java new file mode 100644 index 00000000000..151a77e8cb9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java @@ -0,0 +1,273 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replaceActionControlTemplate options. + */ +public class ReplaceActionControlTemplateOptions extends GenericModel { + + protected String actionControlTemplateId; + protected String version; + protected String ifMatch; + protected String name; + protected String description; + protected TemplateActionControl actionControl; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String actionControlTemplateId; + private String version; + private String ifMatch; + private String name; + private String description; + private TemplateActionControl actionControl; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing ReplaceActionControlTemplateOptions instance. + * + * @param replaceActionControlTemplateOptions the instance to initialize the Builder with + */ + private Builder(ReplaceActionControlTemplateOptions replaceActionControlTemplateOptions) { + this.actionControlTemplateId = replaceActionControlTemplateOptions.actionControlTemplateId; + this.version = replaceActionControlTemplateOptions.version; + this.ifMatch = replaceActionControlTemplateOptions.ifMatch; + this.name = replaceActionControlTemplateOptions.name; + this.description = replaceActionControlTemplateOptions.description; + this.actionControl = replaceActionControlTemplateOptions.actionControl; + this.committed = replaceActionControlTemplateOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param actionControlTemplateId the actionControlTemplateId + * @param version the version + * @param ifMatch the ifMatch + */ + public Builder(String actionControlTemplateId, String version, String ifMatch) { + this.actionControlTemplateId = actionControlTemplateId; + this.version = version; + this.ifMatch = ifMatch; + } + + /** + * Builds a ReplaceActionControlTemplateOptions. + * + * @return the new ReplaceActionControlTemplateOptions instance + */ + public ReplaceActionControlTemplateOptions build() { + return new ReplaceActionControlTemplateOptions(this); + } + + /** + * Set the actionControlTemplateId. + * + * @param actionControlTemplateId the actionControlTemplateId + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder actionControlTemplateId(String actionControlTemplateId) { + this.actionControlTemplateId = actionControlTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actionControl. + * + * @param actionControl the actionControl + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder actionControl(TemplateActionControl actionControl) { + this.actionControl = actionControl; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the ReplaceActionControlTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected ReplaceActionControlTemplateOptions() { } + + protected ReplaceActionControlTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, + "actionControlTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + actionControlTemplateId = builder.actionControlTemplateId; + version = builder.version; + ifMatch = builder.ifMatch; + name = builder.name; + description = builder.description; + actionControl = builder.actionControl; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a ReplaceActionControlTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the actionControlTemplateId. + * + * Action control template ID. + * + * @return the actionControlTemplateId + */ + public String actionControlTemplateId() { + return actionControlTemplateId; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating an action control template version must match the Etag value of the existing + * action control template version. The Etag can be retrieved using the GET + * /v1/action_control_templates/{template_id}/versions/{version} API and looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will + * change the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the action control template. This is shown to users in the enterprise account. Use this to describe + * the purpose or context of the action control for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actionControl. + * + * The action control properties that are created in an action resource when the template is assigned. + * + * @return the actionControl + */ + public TemplateActionControl actionControl() { + return actionControl; + } + + /** + * Gets the committed. + * + * Committed status of the template version. If committed is set to true, then the template version can no longer be + * updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java new file mode 100644 index 00000000000..80cbe9e4c79 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java @@ -0,0 +1,335 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replacePolicy options. + */ +public class ReplacePolicyOptions extends GenericModel { + + protected String policyId; + protected String ifMatch; + protected String type; + protected List subjects; + protected List roles; + protected List resources; + protected String description; + + /** + * Builder. + */ + public static class Builder { + private String policyId; + private String ifMatch; + private String type; + private List subjects; + private List roles; + private List resources; + private String description; + + /** + * Instantiates a new Builder from an existing ReplacePolicyOptions instance. + * + * @param replacePolicyOptions the instance to initialize the Builder with + */ + private Builder(ReplacePolicyOptions replacePolicyOptions) { + this.policyId = replacePolicyOptions.policyId; + this.ifMatch = replacePolicyOptions.ifMatch; + this.type = replacePolicyOptions.type; + this.subjects = replacePolicyOptions.subjects; + this.roles = replacePolicyOptions.roles; + this.resources = replacePolicyOptions.resources; + this.description = replacePolicyOptions.description; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyId the policyId + * @param ifMatch the ifMatch + * @param type the type + * @param subjects the subjects + * @param roles the roles + * @param resources the resources + */ + public Builder(String policyId, String ifMatch, String type, List subjects, List roles, List resources) { + this.policyId = policyId; + this.ifMatch = ifMatch; + this.type = type; + this.subjects = subjects; + this.roles = roles; + this.resources = resources; + } + + /** + * Builds a ReplacePolicyOptions. + * + * @return the new ReplacePolicyOptions instance + */ + public ReplacePolicyOptions build() { + return new ReplacePolicyOptions(this); + } + + /** + * Adds a new element to subjects. + * + * @param subjects the new element to be added + * @return the ReplacePolicyOptions builder + */ + public Builder addSubjects(PolicySubject subjects) { + com.ibm.cloud.sdk.core.util.Validator.notNull(subjects, + "subjects cannot be null"); + if (this.subjects == null) { + this.subjects = new ArrayList(); + } + this.subjects.add(subjects); + return this; + } + + /** + * Adds a new element to roles. + * + * @param roles the new element to be added + * @return the ReplacePolicyOptions builder + */ + public Builder addRoles(PolicyRole roles) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roles, + "roles cannot be null"); + if (this.roles == null) { + this.roles = new ArrayList(); + } + this.roles.add(roles); + return this; + } + + /** + * Adds a new element to resources. + * + * @param resources the new element to be added + * @return the ReplacePolicyOptions builder + */ + public Builder addResources(PolicyResource resources) { + com.ibm.cloud.sdk.core.util.Validator.notNull(resources, + "resources cannot be null"); + if (this.resources == null) { + this.resources = new ArrayList(); + } + this.resources.add(resources); + return this; + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the ReplacePolicyOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplacePolicyOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the ReplacePolicyOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the subjects. + * Existing subjects will be replaced. + * + * @param subjects the subjects + * @return the ReplacePolicyOptions builder + */ + public Builder subjects(List subjects) { + this.subjects = subjects; + return this; + } + + /** + * Set the roles. + * Existing roles will be replaced. + * + * @param roles the roles + * @return the ReplacePolicyOptions builder + */ + public Builder roles(List roles) { + this.roles = roles; + return this; + } + + /** + * Set the resources. + * Existing resources will be replaced. + * + * @param resources the resources + * @return the ReplacePolicyOptions builder + */ + public Builder resources(List resources) { + this.resources = resources; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplacePolicyOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + } + + protected ReplacePolicyOptions() { } + + protected ReplacePolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId 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.type, + "type cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subjects, + "subjects cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, + "roles cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resources, + "resources cannot be null"); + policyId = builder.policyId; + ifMatch = builder.ifMatch; + type = builder.type; + subjects = builder.subjects; + roles = builder.roles; + resources = builder.resources; + description = builder.description; + } + + /** + * New builder. + * + * @return a ReplacePolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyId. + * + * The policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be + * retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the subjects. + * + * The subjects associated with a policy. + * + * @return the subjects + */ + public List subjects() { + return subjects; + } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List roles() { + return roles; + } + + /** + * Gets the resources. + * + * The resources associated with a policy. + * + * @return the resources + */ + public List resources() { + return resources; + } + + /** + * Gets the description. + * + * Customer-defined description. + * + * @return the description + */ + public String description() { + return description; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java new file mode 100644 index 00000000000..5a55c4898e5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java @@ -0,0 +1,276 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replacePolicyTemplate options. + */ +public class ReplacePolicyTemplateOptions extends GenericModel { + + protected String policyTemplateId; + protected String version; + protected String ifMatch; + protected TemplatePolicy policy; + protected String name; + protected String description; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String policyTemplateId; + private String version; + private String ifMatch; + private TemplatePolicy policy; + private String name; + private String description; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing ReplacePolicyTemplateOptions instance. + * + * @param replacePolicyTemplateOptions the instance to initialize the Builder with + */ + private Builder(ReplacePolicyTemplateOptions replacePolicyTemplateOptions) { + this.policyTemplateId = replacePolicyTemplateOptions.policyTemplateId; + this.version = replacePolicyTemplateOptions.version; + this.ifMatch = replacePolicyTemplateOptions.ifMatch; + this.policy = replacePolicyTemplateOptions.policy; + this.name = replacePolicyTemplateOptions.name; + this.description = replacePolicyTemplateOptions.description; + this.committed = replacePolicyTemplateOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyTemplateId the policyTemplateId + * @param version the version + * @param ifMatch the ifMatch + * @param policy the policy + */ + public Builder(String policyTemplateId, String version, String ifMatch, TemplatePolicy policy) { + this.policyTemplateId = policyTemplateId; + this.version = version; + this.ifMatch = ifMatch; + this.policy = policy; + } + + /** + * Builds a ReplacePolicyTemplateOptions. + * + * @return the new ReplacePolicyTemplateOptions instance + */ + public ReplacePolicyTemplateOptions build() { + return new ReplacePolicyTemplateOptions(this); + } + + /** + * Set the policyTemplateId. + * + * @param policyTemplateId the policyTemplateId + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder policyTemplateId(String policyTemplateId) { + this.policyTemplateId = policyTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the policy. + * + * @param policy the policy + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder policy(TemplatePolicy policy) { + this.policy = policy; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the ReplacePolicyTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected ReplacePolicyTemplateOptions() { } + + protected ReplacePolicyTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, + "policyTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version 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.policy, + "policy cannot be null"); + policyTemplateId = builder.policyTemplateId; + version = builder.version; + ifMatch = builder.ifMatch; + policy = builder.policy; + name = builder.name; + description = builder.description; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a ReplacePolicyTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyTemplateId. + * + * The policy template ID. + * + * @return the policyTemplateId + */ + public String policyTemplateId() { + return policyTemplateId; + } + + /** + * Gets the version. + * + * The policy template version. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy template version and must match the Etag value of the existing policy + * template version. The Etag can be retrieved using the GET + * /v1/policy_templates/{policy_template_id}/versions/{version} API and looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the policy. + * + * The core set of properties associated with the template's policy object. + * + * @return the policy + */ + public TemplatePolicy policy() { + return policy; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the policy for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the committed. + * + * Committed status of the template version. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java new file mode 100644 index 00000000000..fc4b536103d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java @@ -0,0 +1,255 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replaceRole options. + */ +public class ReplaceRoleOptions extends GenericModel { + + protected String roleId; + protected String ifMatch; + protected String displayName; + protected List actions; + protected String description; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + private String ifMatch; + private String displayName; + private List actions; + private String description; + + /** + * Instantiates a new Builder from an existing ReplaceRoleOptions instance. + * + * @param replaceRoleOptions the instance to initialize the Builder with + */ + private Builder(ReplaceRoleOptions replaceRoleOptions) { + this.roleId = replaceRoleOptions.roleId; + this.ifMatch = replaceRoleOptions.ifMatch; + this.displayName = replaceRoleOptions.displayName; + this.actions = replaceRoleOptions.actions; + this.description = replaceRoleOptions.description; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + * @param ifMatch the ifMatch + * @param displayName the displayName + * @param actions the actions + */ + public Builder(String roleId, String ifMatch, String displayName, List actions) { + this.roleId = roleId; + this.ifMatch = ifMatch; + this.displayName = displayName; + this.actions = actions; + } + + /** + * Builds a ReplaceRoleOptions. + * + * @return the new ReplaceRoleOptions instance + */ + public ReplaceRoleOptions build() { + return new ReplaceRoleOptions(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the ReplaceRoleOptions builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the ReplaceRoleOptions builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplaceRoleOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the ReplaceRoleOptions builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the ReplaceRoleOptions builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplaceRoleOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the role. + * + * @param role the role + * @return the ReplaceRoleOptions builder + */ + public Builder role(Role role) { + this.displayName = role.displayName(); + this.actions = role.actions(); + this.description = role.description(); + return this; + } + } + + protected ReplaceRoleOptions() { } + + protected ReplaceRoleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, + "roleId 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.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + roleId = builder.roleId; + ifMatch = builder.ifMatch; + displayName = builder.displayName; + actions = builder.actions; + description = builder.description; + } + + /** + * New builder. + * + * @return a ReplaceRoleOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role ID. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a role and must match the ETag value of the existing role. The Etag can be + * retrieved using the GET /v2/roles/{role_id} API and looking at the ETag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List actions() { + return actions; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String description() { + return description; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java new file mode 100644 index 00000000000..9a69b13326c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java @@ -0,0 +1,273 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replaceRoleTemplate options. + */ +public class ReplaceRoleTemplateOptions extends GenericModel { + + protected String roleTemplateId; + protected String version; + protected String ifMatch; + protected String name; + protected String description; + protected TemplateRole role; + protected Boolean committed; + + /** + * Builder. + */ + public static class Builder { + private String roleTemplateId; + private String version; + private String ifMatch; + private String name; + private String description; + private TemplateRole role; + private Boolean committed; + + /** + * Instantiates a new Builder from an existing ReplaceRoleTemplateOptions instance. + * + * @param replaceRoleTemplateOptions the instance to initialize the Builder with + */ + private Builder(ReplaceRoleTemplateOptions replaceRoleTemplateOptions) { + this.roleTemplateId = replaceRoleTemplateOptions.roleTemplateId; + this.version = replaceRoleTemplateOptions.version; + this.ifMatch = replaceRoleTemplateOptions.ifMatch; + this.name = replaceRoleTemplateOptions.name; + this.description = replaceRoleTemplateOptions.description; + this.role = replaceRoleTemplateOptions.role; + this.committed = replaceRoleTemplateOptions.committed; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateId the roleTemplateId + * @param version the version + * @param ifMatch the ifMatch + */ + public Builder(String roleTemplateId, String version, String ifMatch) { + this.roleTemplateId = roleTemplateId; + this.version = version; + this.ifMatch = ifMatch; + } + + /** + * Builds a ReplaceRoleTemplateOptions. + * + * @return the new ReplaceRoleTemplateOptions instance + */ + public ReplaceRoleTemplateOptions build() { + return new ReplaceRoleTemplateOptions(this); + } + + /** + * Set the roleTemplateId. + * + * @param roleTemplateId the roleTemplateId + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder roleTemplateId(String roleTemplateId) { + this.roleTemplateId = roleTemplateId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the role. + * + * @param role the role + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder role(TemplateRole role) { + this.role = role; + return this; + } + + /** + * Set the committed. + * + * @param committed the committed + * @return the ReplaceRoleTemplateOptions builder + */ + public Builder committed(Boolean committed) { + this.committed = committed; + return this; + } + } + + protected ReplaceRoleTemplateOptions() { } + + protected ReplaceRoleTemplateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, + "roleTemplateId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, + "version cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + roleTemplateId = builder.roleTemplateId; + version = builder.version; + ifMatch = builder.ifMatch; + name = builder.name; + description = builder.description; + role = builder.role; + committed = builder.committed; + } + + /** + * New builder. + * + * @return a ReplaceRoleTemplateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleTemplateId. + * + * Role template ID. + * + * @return the roleTemplateId + */ + public String roleTemplateId() { + return roleTemplateId; + } + + /** + * Gets the version. + * + * Role template version. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a role template version must match the Etag value of the existing role template + * version. The Etag can be retrieved using the GET /v1/role_templates/{template_id}/versions/{version} API and + * looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will + * change the name value for all existing versions of the template. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * Description of the role template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the role for enterprise users managing IAM templates. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the role. + * + * The role properties that are created in an action resource when the template is assigned. + * + * @return the role + */ + public TemplateRole role() { + return role; + } + + /** + * Gets the committed. + * + * Committed status of the template version. If committed is set to true, then the template version can no longer be + * updated. + * + * @return the committed + */ + public Boolean committed() { + return committed; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java new file mode 100644 index 00000000000..960f4782635 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java @@ -0,0 +1,336 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replaceV2Policy options. + */ +public class ReplaceV2PolicyOptions extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + protected String id; + protected String ifMatch; + protected Control control; + protected String type; + protected String description; + protected V2PolicySubject subject; + protected V2PolicyResource resource; + protected String pattern; + protected V2PolicyRule rule; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String ifMatch; + private Control control; + private String type; + private String description; + private V2PolicySubject subject; + private V2PolicyResource resource; + private String pattern; + private V2PolicyRule rule; + + /** + * Instantiates a new Builder from an existing ReplaceV2PolicyOptions instance. + * + * @param replaceV2PolicyOptions the instance to initialize the Builder with + */ + private Builder(ReplaceV2PolicyOptions replaceV2PolicyOptions) { + this.id = replaceV2PolicyOptions.id; + this.ifMatch = replaceV2PolicyOptions.ifMatch; + this.control = replaceV2PolicyOptions.control; + this.type = replaceV2PolicyOptions.type; + this.description = replaceV2PolicyOptions.description; + this.subject = replaceV2PolicyOptions.subject; + this.resource = replaceV2PolicyOptions.resource; + this.pattern = replaceV2PolicyOptions.pattern; + this.rule = replaceV2PolicyOptions.rule; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + * @param ifMatch the ifMatch + * @param control the control + * @param type the type + */ + public Builder(String id, String ifMatch, Control control, String type) { + this.id = id; + this.ifMatch = ifMatch; + this.control = control; + this.type = type; + } + + /** + * Builds a ReplaceV2PolicyOptions. + * + * @return the new ReplaceV2PolicyOptions instance + */ + public ReplaceV2PolicyOptions build() { + return new ReplaceV2PolicyOptions(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the ReplaceV2PolicyOptions builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the ReplaceV2PolicyOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the control. + * + * @param control the control + * @return the ReplaceV2PolicyOptions builder + */ + public Builder control(Control control) { + this.control = control; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the ReplaceV2PolicyOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ReplaceV2PolicyOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the subject. + * + * @param subject the subject + * @return the ReplaceV2PolicyOptions builder + */ + public Builder subject(V2PolicySubject subject) { + this.subject = subject; + return this; + } + + /** + * Set the resource. + * + * @param resource the resource + * @return the ReplaceV2PolicyOptions builder + */ + public Builder resource(V2PolicyResource resource) { + this.resource = resource; + return this; + } + + /** + * Set the pattern. + * + * @param pattern the pattern + * @return the ReplaceV2PolicyOptions builder + */ + public Builder pattern(String pattern) { + this.pattern = pattern; + return this; + } + + /** + * Set the rule. + * + * @param rule the rule + * @return the ReplaceV2PolicyOptions builder + */ + public Builder rule(V2PolicyRule rule) { + this.rule = rule; + return this; + } + } + + protected ReplaceV2PolicyOptions() { } + + protected ReplaceV2PolicyOptions(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.control, + "control cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + id = builder.id; + ifMatch = builder.ifMatch; + control = builder.control; + type = builder.type; + description = builder.description; + subject = builder.subject; + resource = builder.resource; + pattern = builder.pattern; + rule = builder.rule; + } + + /** + * New builder. + * + * @return a ReplaceV2PolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be + * retrieved using the GET /v2/policies/{id} API and looking at the ETag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the control. + * + * Specifies the type of access that is granted by the policy. + * + * @return the control + */ + public Control control() { + return control; + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject subject() { + return subject; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource resource() { + return resource; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String pattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule rule() { + return rule; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java new file mode 100644 index 00000000000..3a8b7e87b9e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * An attribute associated with a resource. + */ +public class ResourceAttribute extends GenericModel { + + protected String name; + protected String value; + protected String operator; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String value; + private String operator; + + /** + * Instantiates a new Builder from an existing ResourceAttribute instance. + * + * @param resourceAttribute the instance to initialize the Builder with + */ + private Builder(ResourceAttribute resourceAttribute) { + this.name = resourceAttribute.name; + this.value = resourceAttribute.value; + this.operator = resourceAttribute.operator; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param value the value + */ + public Builder(String name, String value) { + this.name = name; + this.value = value; + } + + /** + * Builds a ResourceAttribute. + * + * @return the new ResourceAttribute instance + */ + public ResourceAttribute build() { + return new ResourceAttribute(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the ResourceAttribute builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the ResourceAttribute builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the ResourceAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + } + + protected ResourceAttribute() { } + + protected ResourceAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + name = builder.name; + value = builder.value; + operator = builder.operator; + } + + /** + * New builder. + * + * @return a ResourceAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The name of an attribute. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the value. + * + * The value of an attribute. + * + * @return the value + */ + public String value() { + return value; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java new file mode 100644 index 00000000000..7da4cffee56 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A tag associated with a resource. + */ +public class ResourceTag extends GenericModel { + + protected String name; + protected String value; + protected String operator; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String value; + private String operator; + + /** + * Instantiates a new Builder from an existing ResourceTag instance. + * + * @param resourceTag the instance to initialize the Builder with + */ + private Builder(ResourceTag resourceTag) { + this.name = resourceTag.name; + this.value = resourceTag.value; + this.operator = resourceTag.operator; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param value the value + */ + public Builder(String name, String value) { + this.name = name; + this.value = value; + } + + /** + * Builds a ResourceTag. + * + * @return the new ResourceTag instance + */ + public ResourceTag build() { + return new ResourceTag(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the ResourceTag builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the ResourceTag builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the ResourceTag builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + } + + protected ResourceTag() { } + + protected ResourceTag(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + name = builder.name; + value = builder.value; + operator = builder.operator; + } + + /** + * New builder. + * + * @return a ResourceTag builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The name of an access management tag. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the value. + * + * The value of an access management tag. + * + * @return the value + */ + public String value() { + return value; + } + + /** + * Gets the operator. + * + * The operator of an access management tag. + * + * @return the operator + */ + public String operator() { + return operator; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java new file mode 100644 index 00000000000..24b99c9bd08 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java @@ -0,0 +1,196 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role resource. + */ +public class Role extends GenericModel { + + @SerializedName("display_name") + protected String displayName; + protected String description; + protected List actions; + protected String crn; + + /** + * Builder. + */ + public static class Builder { + private String displayName; + private String description; + private List actions; + + /** + * Instantiates a new Builder from an existing Role instance. + * + * @param role the instance to initialize the Builder with + */ + private Builder(Role role) { + this.displayName = role.displayName; + this.description = role.description; + this.actions = role.actions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param displayName the displayName + * @param actions the actions + */ + public Builder(String displayName, List actions) { + this.displayName = displayName; + this.actions = actions; + } + + /** + * Builds a Role. + * + * @return the new Role instance + */ + public Role build() { + return new Role(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the Role builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the Role builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the Role builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the Role builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + } + + protected Role() { } + + protected Role(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + displayName = builder.displayName; + description = builder.description; + actions = builder.actions; + } + + /** + * New builder. + * + * @return a Role builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the description. + * + * The description of the role. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. For more information, see [IAM roles and + * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). + * + * @return the actions + */ + public List actions() { + return actions; + } + + /** + * Gets the crn. + * + * The role Cloud Resource Name (CRN). Example CRN: + * 'crn:v1:ibmcloud:public:iam-access-management::a/exampleAccountId::customRole:ExampleRoleName'. + * + * @return the crn + */ + public String crn() { + return crn; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java new file mode 100644 index 00000000000..9169fc88572 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java @@ -0,0 +1,64 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * An action that can be performed by the policy subject when assigned a role. + */ +public class RoleAction extends GenericModel { + + protected String id; + @SerializedName("display_name") + protected String displayName; + protected String description; + + protected RoleAction() { } + + /** + * Gets the id. + * + * Unique identifier for action with structure service.resource.action. For example, cbr.rule.read. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the displayName. + * + * Services defined display name for action. + * + * @return the displayName + */ + public String getDisplayName() { + return displayName; + } + + /** + * Gets the description. + * + * Service defined description for action. + * + * @return the description + */ + public String getDescription() { + return description; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java new file mode 100644 index 00000000000..23bb4b65c6f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java @@ -0,0 +1,207 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the assigned role template. + */ +public class RoleAssignment extends GenericModel { + + /** + * The current operation of the role assignment. + */ + public interface Operation { + /** create. */ + String CREATE = "create"; + /** apply. */ + String APPLY = "apply"; + /** update. */ + String UPDATE = "update"; + /** remove. */ + String REMOVE = "remove"; + } + + /** + * The role assignment status. + */ + public interface Status { + /** accepted. */ + String ACCEPTED = "accepted"; + /** failure. */ + String FAILURE = "failure"; + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** superseded. */ + String SUPERSEDED = "superseded"; + } + + protected String id; + @SerializedName("account_id") + protected String accountId; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String operation; + protected List resources; + protected RoleAssignmentTemplate template; + protected AssignmentTargetDetails target; + protected String status; + + protected RoleAssignment() { } + + /** + * Gets the id. + * + * Action control assignment ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the accountId. + * + * The account GUID that the role assignments belong to. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the href. + * + * The href URL that links to the role assignments API by role assignment ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the role assignment was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the role assignment. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the role assignment was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the role assignment. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the operation. + * + * The current operation of the role assignment. + * + * @return the operation + */ + public String getOperation() { + return operation; + } + + /** + * Gets the resources. + * + * Resources created when role template is assigned. + * + * @return the resources + */ + public List getResources() { + return resources; + } + + /** + * Gets the template. + * + * The role template id and version that will be assigned. + * + * @return the template + */ + public RoleAssignmentTemplate getTemplate() { + return template; + } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the status. + * + * The role assignment status. + * + * @return the status + */ + public String getStatus() { + return status; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java new file mode 100644 index 00000000000..658ac5b8c99 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of role assignments. + */ +public class RoleAssignmentCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List assignments; + + protected RoleAssignmentCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the assignments. + * + * List of role assignments. + * + * @return the assignments + */ + public List getAssignments() { + return assignments; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java new file mode 100644 index 00000000000..60d7a02d604 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The role assignment resources and target where the template is assigned. + */ +public class RoleAssignmentResource extends GenericModel { + + protected AssignmentTargetDetails target; + protected RoleAssignmentResourceRole role; + + protected RoleAssignmentResource() { } + + /** + * Gets the target. + * + * assignment target account and type. + * + * @return the target + */ + public AssignmentTargetDetails getTarget() { + return target; + } + + /** + * Gets the role. + * + * Set of properties of the assigned resource or error message if assignment failed. + * + * @return the role + */ + public RoleAssignmentResourceRole getRole() { + return role; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java new file mode 100644 index 00000000000..9ea359d63fb --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * On success, it includes the role assigned. + */ +public class RoleAssignmentResourceCreated extends GenericModel { + + protected String id; + + protected RoleAssignmentResourceCreated() { } + + /** + * Gets the id. + * + * role id. + * + * @return the id + */ + public String getId() { + return id; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java new file mode 100644 index 00000000000..22d40bdaef4 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Set of properties of the assigned resource or error message if assignment failed. + */ +public class RoleAssignmentResourceRole extends GenericModel { + + @SerializedName("resource_created") + protected RoleAssignmentResourceCreated resourceCreated; + @SerializedName("error_message") + protected AssignmentResourceError errorMessage; + + protected RoleAssignmentResourceRole() { } + + /** + * Gets the resourceCreated. + * + * On success, it includes the role assigned. + * + * @return the resourceCreated + */ + public RoleAssignmentResourceCreated getResourceCreated() { + return resourceCreated; + } + + /** + * Gets the errorMessage. + * + * Body parameters for assignment error. + * + * @return the errorMessage + */ + public AssignmentResourceError getErrorMessage() { + return errorMessage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java new file mode 100644 index 00000000000..3524b91f4d5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The role template id and version that will be assigned. + */ +public class RoleAssignmentTemplate extends GenericModel { + + protected String id; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String version; + + /** + * Instantiates a new Builder from an existing RoleAssignmentTemplate instance. + * + * @param roleAssignmentTemplate the instance to initialize the Builder with + */ + private Builder(RoleAssignmentTemplate roleAssignmentTemplate) { + this.id = roleAssignmentTemplate.id; + this.version = roleAssignmentTemplate.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + * @param version the version + */ + public Builder(String id, String version) { + this.id = id; + this.version = version; + } + + /** + * Builds a RoleAssignmentTemplate. + * + * @return the new RoleAssignmentTemplate instance + */ + public RoleAssignmentTemplate build() { + return new RoleAssignmentTemplate(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the RoleAssignmentTemplate builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the RoleAssignmentTemplate builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected RoleAssignmentTemplate() { } + + protected RoleAssignmentTemplate(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, + "id cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + id = builder.id; + version = builder.version; + } + + /** + * New builder. + * + * @return a RoleAssignmentTemplate builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * Action control template ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the version. + * + * Action control template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java new file mode 100644 index 00000000000..16296a82e40 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * RoleAssignmentsPager can be used to simplify the use of the "listRoleAssignments" method. + */ +public class RoleAssignmentsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListRoleAssignmentsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected RoleAssignmentsPager() { } + + /** + * Constructs a new RoleAssignmentsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listRoleAssignments" method + * @param options the ListRoleAssignmentsOptions instance to be used to invoke the "listRoleAssignments" method + */ + public RoleAssignmentsPager(IamPolicyManagement client, ListRoleAssignmentsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<RoleAssignment> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListRoleAssignmentsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + RoleAssignmentCollection result = client.listRoleAssignments(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getAssignments(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<RoleAssignment> containing all results returned by the "listRoleAssignments" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java new file mode 100644 index 00000000000..282730a2dfc --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java @@ -0,0 +1,68 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of roles returned by the 'list roles' operation. + */ +public class RoleCollection extends GenericModel { + + @SerializedName("custom_roles") + protected List customRoles; + @SerializedName("service_roles") + protected List serviceRoles; + @SerializedName("system_roles") + protected List systemRoles; + + protected RoleCollection() { } + + /** + * Gets the customRoles. + * + * List of custom roles. + * + * @return the customRoles + */ + public List getCustomRoles() { + return customRoles; + } + + /** + * Gets the serviceRoles. + * + * List of service roles. + * + * @return the serviceRoles + */ + public List getServiceRoles() { + return serviceRoles; + } + + /** + * Gets the systemRoles. + * + * List of system roles. + * + * @return the systemRoles + */ + public List getSystemRoles() { + return systemRoles; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java new file mode 100644 index 00000000000..663d0f7f1d0 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java @@ -0,0 +1,202 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The set of properties associated with the role template. + */ +public class RoleTemplate extends GenericModel { + + /** + * State of role template. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String name; + protected String description; + @SerializedName("account_id") + protected String accountId; + protected Boolean committed; + protected RoleTemplatePrototypeRole role; + protected String id; + protected String href; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String version; + protected String state; + + protected RoleTemplate() { } + + /** + * Gets the name. + * + * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it + * changes the name value for all existing versions of the template. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Description of the role template. This is shown to users in the enterprise account. Use this to describe the + * purpose or context of the role for enterprise users managing IAM templates. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the accountId. + * + * Enterprise account ID where this template is created. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the committed. + * + * Committed status of the template. If committed is set to true, then the template version can no longer be updated. + * + * @return the committed + */ + public Boolean isCommitted() { + return committed; + } + + /** + * Gets the role. + * + * The role properties that are created in an action resource when the template is assigned. + * + * @return the role + */ + public RoleTemplatePrototypeRole getRole() { + return role; + } + + /** + * Gets the id. + * + * The role template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the role templates API by role template ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the role template was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the role template. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the role template was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the role template. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the version. + * + * The version number of the template used to identify different versions of same template. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the state. + * + * State of role template. + * + * @return the state + */ + public String getState() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java new file mode 100644 index 00000000000..22a739b4a58 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java @@ -0,0 +1,90 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of role templates. + */ +public class RoleTemplateCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + @SerializedName("role_templates") + protected List roleTemplates; + + protected RoleTemplateCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the roleTemplates. + * + * List of role templates. + * + * @return the roleTemplates + */ + public List getRoleTemplates() { + return roleTemplates; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java new file mode 100644 index 00000000000..43197620689 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java @@ -0,0 +1,239 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The role properties that are created in an action resource when the template is assigned. + */ +public class RoleTemplatePrototypeRole extends GenericModel { + + protected String name; + @SerializedName("display_name") + protected String displayName; + @SerializedName("service_name") + protected String serviceName; + protected String description; + protected List actions; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String displayName; + private String serviceName; + private String description; + private List actions; + + /** + * Instantiates a new Builder from an existing RoleTemplatePrototypeRole instance. + * + * @param roleTemplatePrototypeRole the instance to initialize the Builder with + */ + private Builder(RoleTemplatePrototypeRole roleTemplatePrototypeRole) { + this.name = roleTemplatePrototypeRole.name; + this.displayName = roleTemplatePrototypeRole.displayName; + this.serviceName = roleTemplatePrototypeRole.serviceName; + this.description = roleTemplatePrototypeRole.description; + this.actions = roleTemplatePrototypeRole.actions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param displayName the displayName + * @param actions the actions + */ + public Builder(String name, String displayName, List actions) { + this.name = name; + this.displayName = displayName; + this.actions = actions; + } + + /** + * Builds a RoleTemplatePrototypeRole. + * + * @return the new RoleTemplatePrototypeRole instance + */ + public RoleTemplatePrototypeRole build() { + return new RoleTemplatePrototypeRole(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the RoleTemplatePrototypeRole builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the RoleTemplatePrototypeRole builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the RoleTemplatePrototypeRole builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the RoleTemplatePrototypeRole builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the RoleTemplatePrototypeRole builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the RoleTemplatePrototypeRole builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + } + + protected RoleTemplatePrototypeRole() { } + + protected RoleTemplatePrototypeRole(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + name = builder.name; + displayName = builder.displayName; + serviceName = builder.serviceName; + description = builder.description; + actions = builder.actions; + } + + /** + * New builder. + * + * @return a RoleTemplatePrototypeRole builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the serviceName. + * + * The service name that the role refers. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the description. + * + * Description of the role. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. + * + * @return the actions + */ + public List actions() { + return actions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java new file mode 100644 index 00000000000..673ff7f9750 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role template reference associated with a policy template. + */ +public class RoleTemplateReferencesItem extends GenericModel { + + protected String id; + protected String version; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String version; + + /** + * Instantiates a new Builder from an existing RoleTemplateReferencesItem instance. + * + * @param roleTemplateReferencesItem the instance to initialize the Builder with + */ + private Builder(RoleTemplateReferencesItem roleTemplateReferencesItem) { + this.id = roleTemplateReferencesItem.id; + this.version = roleTemplateReferencesItem.version; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param id the id + * @param version the version + */ + public Builder(String id, String version) { + this.id = id; + this.version = version; + } + + /** + * Builds a RoleTemplateReferencesItem. + * + * @return the new RoleTemplateReferencesItem instance + */ + public RoleTemplateReferencesItem build() { + return new RoleTemplateReferencesItem(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the RoleTemplateReferencesItem builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the RoleTemplateReferencesItem builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + } + + protected RoleTemplateReferencesItem() { } + + protected RoleTemplateReferencesItem(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, + "id cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + id = builder.id; + version = builder.version; + } + + /** + * New builder. + * + * @return a RoleTemplateReferencesItem builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The role template ID. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the version. + * + * Role template version. + * + * @return the version + */ + public String version() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java new file mode 100644 index 00000000000..a983208afe3 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of versions for a specific role template. + */ +public class RoleTemplateVersionsCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List versions; + + protected RoleTemplateVersionsCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the versions. + * + * List of role templates versions. + * + * @return the versions + */ + public List getVersions() { + return versions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java new file mode 100644 index 00000000000..7af200cd72f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * RoleTemplateVersionsPager can be used to simplify the use of the "listRoleTemplateVersions" method. + */ +public class RoleTemplateVersionsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListRoleTemplateVersionsOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected RoleTemplateVersionsPager() { } + + /** + * Constructs a new RoleTemplateVersionsPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listRoleTemplateVersions" method + * @param options the ListRoleTemplateVersionsOptions instance to be used to invoke the "listRoleTemplateVersions" method + */ + public RoleTemplateVersionsPager(IamPolicyManagement client, ListRoleTemplateVersionsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<RoleTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListRoleTemplateVersionsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + RoleTemplateVersionsCollection result = client.listRoleTemplateVersions(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getVersions(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<RoleTemplate> containing all results returned by the "listRoleTemplateVersions" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java new file mode 100644 index 00000000000..3654e0757ba --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * RoleTemplatesPager can be used to simplify the use of the "listRoleTemplates" method. + */ +public class RoleTemplatesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListRoleTemplatesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected RoleTemplatesPager() { } + + /** + * Constructs a new RoleTemplatesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listRoleTemplates" method + * @param options the ListRoleTemplatesOptions instance to be used to invoke the "listRoleTemplates" method + */ + public RoleTemplatesPager(IamPolicyManagement client, ListRoleTemplatesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<RoleTemplate> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListRoleTemplatesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + RoleTemplateCollection result = client.listRoleTemplates(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getRoleTemplates(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<RoleTemplate> containing all results returned by the "listRoleTemplates" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java new file mode 100644 index 00000000000..03b6ff75eb1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java @@ -0,0 +1,106 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A role associated with a policy. + */ +public class Roles extends GenericModel { + + @SerializedName("role_id") + protected String roleId; + + /** + * Builder. + */ + public static class Builder { + private String roleId; + + /** + * Instantiates a new Builder from an existing Roles instance. + * + * @param roles the instance to initialize the Builder with + */ + private Builder(Roles roles) { + this.roleId = roles.roleId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleId the roleId + */ + public Builder(String roleId) { + this.roleId = roleId; + } + + /** + * Builds a Roles. + * + * @return the new Roles instance + */ + public Roles build() { + return new Roles(this); + } + + /** + * Set the roleId. + * + * @param roleId the roleId + * @return the Roles builder + */ + public Builder roleId(String roleId) { + this.roleId = roleId; + return this; + } + } + + protected Roles() { } + + protected Roles(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleId, + "roleId cannot be null"); + roleId = builder.roleId; + } + + /** + * New builder. + * + * @return a Roles builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the roleId. + * + * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. + * + * @return the roleId + */ + public String roleId() { + return roleId; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java new file mode 100644 index 00000000000..fbf66d53ae1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java @@ -0,0 +1,209 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Rule that specifies additional access that is granted (For example, time-based condition). + */ +public class RuleAttribute extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + protected String key; + protected String operator; + protected Object value; + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing RuleAttribute instance. + * + * @param ruleAttribute the instance to initialize the Builder with + */ + private Builder(RuleAttribute ruleAttribute) { + this.key = ruleAttribute.key; + this.operator = ruleAttribute.operator; + this.value = ruleAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a RuleAttribute. + * + * @return the new RuleAttribute instance + */ + public RuleAttribute build() { + return new RuleAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the RuleAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the RuleAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the RuleAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected RuleAttribute() { } + + protected RuleAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a RuleAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the key. + * + * The name of an attribute. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java new file mode 100644 index 00000000000..d7e54e112c5 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java @@ -0,0 +1,134 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * An attribute associated with a subject. + */ +public class SubjectAttribute extends GenericModel { + + protected String name; + protected String value; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String value; + + /** + * Instantiates a new Builder from an existing SubjectAttribute instance. + * + * @param subjectAttribute the instance to initialize the Builder with + */ + private Builder(SubjectAttribute subjectAttribute) { + this.name = subjectAttribute.name; + this.value = subjectAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param value the value + */ + public Builder(String name, String value) { + this.name = name; + this.value = value; + } + + /** + * Builds a SubjectAttribute. + * + * @return the new SubjectAttribute instance + */ + public SubjectAttribute build() { + return new SubjectAttribute(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the SubjectAttribute builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the SubjectAttribute builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + } + + protected SubjectAttribute() { } + + protected SubjectAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + name = builder.name; + value = builder.value; + } + + /** + * New builder. + * + * @return a SubjectAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The name of an attribute. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the value. + * + * The value of an attribute. + * + * @return the value + */ + public String value() { + return value; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java new file mode 100644 index 00000000000..62f4bd77f87 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java @@ -0,0 +1,182 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The action control properties that are created in an action resource when the template is assigned. + */ +public class TemplateActionControl extends GenericModel { + + @SerializedName("service_name") + protected String serviceName; + protected String description; + protected List actions; + + /** + * Builder. + */ + public static class Builder { + private String serviceName; + private String description; + private List actions; + + /** + * Instantiates a new Builder from an existing TemplateActionControl instance. + * + * @param templateActionControl the instance to initialize the Builder with + */ + private Builder(TemplateActionControl templateActionControl) { + this.serviceName = templateActionControl.serviceName; + this.description = templateActionControl.description; + this.actions = templateActionControl.actions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param serviceName the serviceName + * @param actions the actions + */ + public Builder(String serviceName, List actions) { + this.serviceName = serviceName; + this.actions = actions; + } + + /** + * Builds a TemplateActionControl. + * + * @return the new TemplateActionControl instance + */ + public TemplateActionControl build() { + return new TemplateActionControl(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the TemplateActionControl builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the TemplateActionControl builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the TemplateActionControl builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the TemplateActionControl builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + } + + protected TemplateActionControl() { } + + protected TemplateActionControl(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, + "serviceName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + serviceName = builder.serviceName; + description = builder.description; + actions = builder.actions; + } + + /** + * New builder. + * + * @return a TemplateActionControl builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the serviceName. + * + * The service name that the action control refers. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the description. + * + * Description of the action control. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actions. + * + * List of actions to control access. + * + * @return the actions + */ + public List actions() { + return actions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java new file mode 100644 index 00000000000..c74a77d9b6d --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Specifies the type of access that is granted by the policy. + */ +public class TemplateControl extends GenericModel { + + protected TemplateGrant grant; + + /** + * Builder. + */ + public static class Builder { + private TemplateGrant grant; + + /** + * Instantiates a new Builder from an existing TemplateControl instance. + * + * @param templateControl the instance to initialize the Builder with + */ + private Builder(TemplateControl templateControl) { + this.grant = templateControl.grant; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param grant the grant + */ + public Builder(TemplateGrant grant) { + this.grant = grant; + } + + /** + * Builds a TemplateControl. + * + * @return the new TemplateControl instance + */ + public TemplateControl build() { + return new TemplateControl(this); + } + + /** + * Set the grant. + * + * @param grant the grant + * @return the TemplateControl builder + */ + public Builder grant(TemplateGrant grant) { + this.grant = grant; + return this; + } + } + + protected TemplateControl() { } + + protected TemplateControl(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.grant, + "grant cannot be null"); + grant = builder.grant; + } + + /** + * New builder. + * + * @return a TemplateControl builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the grant. + * + * Permission is granted by the policy. + * + * @return the grant + */ + public TemplateGrant grant() { + return grant; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java new file mode 100644 index 00000000000..edb134e1270 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * policy template count details. + */ +public class TemplateCountData extends GenericModel { + + protected LimitData template; + protected LimitData version; + + protected TemplateCountData() { } + + /** + * Gets the template. + * + * policy template current and limit details with in an account. + * + * @return the template + */ + public LimitData getTemplate() { + return template; + } + + /** + * Gets the version. + * + * policy template current and limit details with in an account. + * + * @return the version + */ + public LimitData getVersion() { + return version; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java new file mode 100644 index 00000000000..fd0daff9665 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java @@ -0,0 +1,58 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Permission is granted by the policy. + * + * Classes which extend this class: + * - TemplateGrantRoles + * - TemplateGrantRoleReferences + */ +public class TemplateGrant extends GenericModel { + + protected List roles; + @SerializedName("role_template_references") + protected List roleTemplateReferences; + + protected TemplateGrant() { } + + /** + * Gets the roles. + * + * A set of role Cloud Resource Names (CRNs) granted by the policy. + * + * @return the roles + */ + public List roles() { + return roles; + } + + /** + * Gets the roleTemplateReferences. + * + * A set of role template reference IDs granted by the policy. + * + * @return the roleTemplateReferences + */ + public List roleTemplateReferences() { + return roleTemplateReferences; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java new file mode 100644 index 00000000000..248eb121b72 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java @@ -0,0 +1,110 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * TemplateGrantRoleReferences. + */ +public class TemplateGrantRoleReferences extends TemplateGrant { + + + /** + * Builder. + */ + public static class Builder { + private List roleTemplateReferences; + + /** + * Instantiates a new Builder from an existing TemplateGrantRoleReferences instance. + * + * @param templateGrantRoleReferences the instance to initialize the Builder with + */ + public Builder(TemplateGrant templateGrantRoleReferences) { + this.roleTemplateReferences = templateGrantRoleReferences.roleTemplateReferences; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roleTemplateReferences the roleTemplateReferences + */ + public Builder(List roleTemplateReferences) { + this.roleTemplateReferences = roleTemplateReferences; + } + + /** + * Builds a TemplateGrantRoleReferences. + * + * @return the new TemplateGrantRoleReferences instance + */ + public TemplateGrantRoleReferences build() { + return new TemplateGrantRoleReferences(this); + } + + /** + * Adds a new element to roleTemplateReferences. + * + * @param roleTemplateReferences the new element to be added + * @return the TemplateGrantRoleReferences builder + */ + public Builder addRoleTemplateReferences(RoleTemplateReferencesItem roleTemplateReferences) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roleTemplateReferences, + "roleTemplateReferences cannot be null"); + if (this.roleTemplateReferences == null) { + this.roleTemplateReferences = new ArrayList(); + } + this.roleTemplateReferences.add(roleTemplateReferences); + return this; + } + + /** + * Set the roleTemplateReferences. + * Existing roleTemplateReferences will be replaced. + * + * @param roleTemplateReferences the roleTemplateReferences + * @return the TemplateGrantRoleReferences builder + */ + public Builder roleTemplateReferences(List roleTemplateReferences) { + this.roleTemplateReferences = roleTemplateReferences; + return this; + } + } + + protected TemplateGrantRoleReferences() { } + + protected TemplateGrantRoleReferences(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleTemplateReferences, + "roleTemplateReferences cannot be null"); + roleTemplateReferences = builder.roleTemplateReferences; + } + + /** + * New builder. + * + * @return a TemplateGrantRoleReferences builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java new file mode 100644 index 00000000000..6524b3645eb --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java @@ -0,0 +1,110 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * TemplateGrantRoles. + */ +public class TemplateGrantRoles extends TemplateGrant { + + + /** + * Builder. + */ + public static class Builder { + private List roles; + + /** + * Instantiates a new Builder from an existing TemplateGrantRoles instance. + * + * @param templateGrantRoles the instance to initialize the Builder with + */ + public Builder(TemplateGrant templateGrantRoles) { + this.roles = templateGrantRoles.roles; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param roles the roles + */ + public Builder(List roles) { + this.roles = roles; + } + + /** + * Builds a TemplateGrantRoles. + * + * @return the new TemplateGrantRoles instance + */ + public TemplateGrantRoles build() { + return new TemplateGrantRoles(this); + } + + /** + * Adds a new element to roles. + * + * @param roles the new element to be added + * @return the TemplateGrantRoles builder + */ + public Builder addRoles(Roles roles) { + com.ibm.cloud.sdk.core.util.Validator.notNull(roles, + "roles cannot be null"); + if (this.roles == null) { + this.roles = new ArrayList(); + } + this.roles.add(roles); + return this; + } + + /** + * Set the roles. + * Existing roles will be replaced. + * + * @param roles the roles + * @return the TemplateGrantRoles builder + */ + public Builder roles(List roles) { + this.roles = roles; + return this; + } + } + + protected TemplateGrantRoles() { } + + protected TemplateGrantRoles(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, + "roles cannot be null"); + roles = builder.roles; + } + + /** + * New builder. + * + * @return a TemplateGrantRoles builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java new file mode 100644 index 00000000000..41f112312cd --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java @@ -0,0 +1,91 @@ +/* + * (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_policy_management.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The details of the IAM template that was used to create an enterprise-managed policy in your account. When returned, + * this indicates that the policy is created from and managed by a template in the root enterprise account. + */ +public class TemplateMetadata extends GenericModel { + + protected String id; + protected String version; + @SerializedName("assignment_id") + protected String assignmentId; + @SerializedName("root_id") + protected String rootId; + @SerializedName("root_version") + protected String rootVersion; + + protected TemplateMetadata() { } + + /** + * Gets the id. + * + * The policy template ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the version. + * + * Template version. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Gets the assignmentId. + * + * Policy assignment ID. + * + * @return the assignmentId + */ + public String getAssignmentId() { + return assignmentId; + } + + /** + * Gets the rootId. + * + * Orchestrator template ID. + * + * @return the rootId + */ + public String getRootId() { + return rootId; + } + + /** + * Gets the rootVersion. + * + * Orchestrator template version. + * + * @return the rootVersion + */ + public String getRootVersion() { + return rootVersion; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java new file mode 100644 index 00000000000..496b2e70e40 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java @@ -0,0 +1,272 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the template's policy object. + */ +public class TemplatePolicy extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + protected String type; + protected String description; + protected V2PolicyResource resource; + protected V2PolicySubject subject; + protected String pattern; + protected V2PolicyRule rule; + protected TemplateControl control; + + /** + * Builder. + */ + public static class Builder { + private String type; + private String description; + private V2PolicyResource resource; + private V2PolicySubject subject; + private String pattern; + private V2PolicyRule rule; + private TemplateControl control; + + /** + * Instantiates a new Builder from an existing TemplatePolicy instance. + * + * @param templatePolicy the instance to initialize the Builder with + */ + private Builder(TemplatePolicy templatePolicy) { + this.type = templatePolicy.type; + this.description = templatePolicy.description; + this.resource = templatePolicy.resource; + this.subject = templatePolicy.subject; + this.pattern = templatePolicy.pattern; + this.rule = templatePolicy.rule; + this.control = templatePolicy.control; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param type the type + */ + public Builder(String type) { + this.type = type; + } + + /** + * Builds a TemplatePolicy. + * + * @return the new TemplatePolicy instance + */ + public TemplatePolicy build() { + return new TemplatePolicy(this); + } + + /** + * Set the type. + * + * @param type the type + * @return the TemplatePolicy builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the TemplatePolicy builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the resource. + * + * @param resource the resource + * @return the TemplatePolicy builder + */ + public Builder resource(V2PolicyResource resource) { + this.resource = resource; + return this; + } + + /** + * Set the subject. + * + * @param subject the subject + * @return the TemplatePolicy builder + */ + public Builder subject(V2PolicySubject subject) { + this.subject = subject; + return this; + } + + /** + * Set the pattern. + * + * @param pattern the pattern + * @return the TemplatePolicy builder + */ + public Builder pattern(String pattern) { + this.pattern = pattern; + return this; + } + + /** + * Set the rule. + * + * @param rule the rule + * @return the TemplatePolicy builder + */ + public Builder rule(V2PolicyRule rule) { + this.rule = rule; + return this; + } + + /** + * Set the control. + * + * @param control the control + * @return the TemplatePolicy builder + */ + public Builder control(TemplateControl control) { + this.control = control; + return this; + } + } + + protected TemplatePolicy() { } + + protected TemplatePolicy(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + type = builder.type; + description = builder.description; + resource = builder.resource; + subject = builder.subject; + pattern = builder.pattern; + rule = builder.rule; + control = builder.control; + } + + /** + * New builder. + * + * @return a TemplatePolicy builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. This is shown in child accounts when an access group or trusted profile template uses + * the policy template to assign access. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource resource() { + return resource; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject subject() { + return subject; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String pattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule rule() { + return rule; + } + + /** + * Gets the control. + * + * Specifies the type of access that is granted by the policy. + * + * @return the control + */ + public TemplateControl control() { + return control; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java new file mode 100644 index 00000000000..b76beb3bddb --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java @@ -0,0 +1,209 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The role properties that are created in an action resource when the template is assigned. + */ +public class TemplateRole extends GenericModel { + + @SerializedName("display_name") + protected String displayName; + @SerializedName("service_name") + protected String serviceName; + protected String description; + protected List actions; + + /** + * Builder. + */ + public static class Builder { + private String displayName; + private String serviceName; + private String description; + private List actions; + + /** + * Instantiates a new Builder from an existing TemplateRole instance. + * + * @param templateRole the instance to initialize the Builder with + */ + private Builder(TemplateRole templateRole) { + this.displayName = templateRole.displayName; + this.serviceName = templateRole.serviceName; + this.description = templateRole.description; + this.actions = templateRole.actions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param displayName the displayName + * @param actions the actions + */ + public Builder(String displayName, List actions) { + this.displayName = displayName; + this.actions = actions; + } + + /** + * Builds a TemplateRole. + * + * @return the new TemplateRole instance + */ + public TemplateRole build() { + return new TemplateRole(this); + } + + /** + * Adds a new element to actions. + * + * @param actions the new element to be added + * @return the TemplateRole builder + */ + public Builder addActions(String actions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(actions, + "actions cannot be null"); + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actions); + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the TemplateRole builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the TemplateRole builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the TemplateRole builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the actions. + * Existing actions will be replaced. + * + * @param actions the actions + * @return the TemplateRole builder + */ + public Builder actions(List actions) { + this.actions = actions; + return this; + } + } + + protected TemplateRole() { } + + protected TemplateRole(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, + "displayName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, + "actions cannot be null"); + displayName = builder.displayName; + serviceName = builder.serviceName; + description = builder.description; + actions = builder.actions; + } + + /** + * New builder. + * + * @return a TemplateRole builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the displayName. + * + * The display the name of the role that is shown in the console. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the serviceName. + * + * The service name that the role refers. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the description. + * + * Description of the role. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the actions. + * + * The actions of the role. + * + * @return the actions + */ + public List actions() { + return actions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java new file mode 100644 index 00000000000..caf2f737b55 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java @@ -0,0 +1,166 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updateActionControlAssignment options. + */ +public class UpdateActionControlAssignmentOptions extends GenericModel { + + protected String assignmentId; + protected String ifMatch; + protected String templateVersion; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + private String ifMatch; + private String templateVersion; + + /** + * Instantiates a new Builder from an existing UpdateActionControlAssignmentOptions instance. + * + * @param updateActionControlAssignmentOptions the instance to initialize the Builder with + */ + private Builder(UpdateActionControlAssignmentOptions updateActionControlAssignmentOptions) { + this.assignmentId = updateActionControlAssignmentOptions.assignmentId; + this.ifMatch = updateActionControlAssignmentOptions.ifMatch; + this.templateVersion = updateActionControlAssignmentOptions.templateVersion; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + * @param ifMatch the ifMatch + * @param templateVersion the templateVersion + */ + public Builder(String assignmentId, String ifMatch, String templateVersion) { + this.assignmentId = assignmentId; + this.ifMatch = ifMatch; + this.templateVersion = templateVersion; + } + + /** + * Builds a UpdateActionControlAssignmentOptions. + * + * @return the new UpdateActionControlAssignmentOptions instance + */ + public UpdateActionControlAssignmentOptions build() { + return new UpdateActionControlAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the UpdateActionControlAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdateActionControlAssignmentOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the UpdateActionControlAssignmentOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + } + + protected UpdateActionControlAssignmentOptions() { } + + protected UpdateActionControlAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId 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.templateVersion, + "templateVersion cannot be null"); + assignmentId = builder.assignmentId; + ifMatch = builder.ifMatch; + templateVersion = builder.templateVersion; + } + + /** + * New builder. + * + * @return a UpdateActionControlAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Action control template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating an action control assignment and must match the Etag value of the existing action + * control assignment. The Etag can be retrieved using the GET /v1/action_control_assignments/{assignment_id} API and + * looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the templateVersion. + * + * The version number of the template used to identify different versions of same template. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java new file mode 100644 index 00000000000..869eb357802 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java @@ -0,0 +1,196 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updatePolicyAssignment options. + */ +public class UpdatePolicyAssignmentOptions extends GenericModel { + + protected String assignmentId; + protected String version; + protected String ifMatch; + protected String templateVersion; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + private String version; + private String ifMatch; + private String templateVersion; + + /** + * Instantiates a new Builder from an existing UpdatePolicyAssignmentOptions instance. + * + * @param updatePolicyAssignmentOptions the instance to initialize the Builder with + */ + private Builder(UpdatePolicyAssignmentOptions updatePolicyAssignmentOptions) { + this.assignmentId = updatePolicyAssignmentOptions.assignmentId; + this.version = updatePolicyAssignmentOptions.version; + this.ifMatch = updatePolicyAssignmentOptions.ifMatch; + this.templateVersion = updatePolicyAssignmentOptions.templateVersion; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + * @param version the version + * @param ifMatch the ifMatch + * @param templateVersion the templateVersion + */ + public Builder(String assignmentId, String version, String ifMatch, String templateVersion) { + this.assignmentId = assignmentId; + this.version = version; + this.ifMatch = ifMatch; + this.templateVersion = templateVersion; + } + + /** + * Builds a UpdatePolicyAssignmentOptions. + * + * @return the new UpdatePolicyAssignmentOptions instance + */ + public UpdatePolicyAssignmentOptions build() { + return new UpdatePolicyAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the UpdatePolicyAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + + /** + * Set the version. + * + * @param version the version + * @return the UpdatePolicyAssignmentOptions builder + */ + public Builder version(String version) { + this.version = version; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdatePolicyAssignmentOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the UpdatePolicyAssignmentOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + } + + protected UpdatePolicyAssignmentOptions() { } + + protected UpdatePolicyAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, + "version cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templateVersion, + "templateVersion cannot be null"); + assignmentId = builder.assignmentId; + version = builder.version; + ifMatch = builder.ifMatch; + templateVersion = builder.templateVersion; + } + + /** + * New builder. + * + * @return a UpdatePolicyAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * The policy template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } + + /** + * Gets the version. + * + * specify version of response body format. + * + * @return the version + */ + public String version() { + return version; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy assignment and must match the Etag value of the existing policy + * assignment. The Etag can be retrieved using the GET /v1/policy_assignments/{assignment_id} API and looking at the + * Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the templateVersion. + * + * The policy template version to update to. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java new file mode 100644 index 00000000000..a28b357641f --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java @@ -0,0 +1,171 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updatePolicyState options. + */ +public class UpdatePolicyStateOptions extends GenericModel { + + /** + * The policy state. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String policyId; + protected String ifMatch; + protected String state; + + /** + * Builder. + */ + public static class Builder { + private String policyId; + private String ifMatch; + private String state; + + /** + * Instantiates a new Builder from an existing UpdatePolicyStateOptions instance. + * + * @param updatePolicyStateOptions the instance to initialize the Builder with + */ + private Builder(UpdatePolicyStateOptions updatePolicyStateOptions) { + this.policyId = updatePolicyStateOptions.policyId; + this.ifMatch = updatePolicyStateOptions.ifMatch; + this.state = updatePolicyStateOptions.state; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param policyId the policyId + * @param ifMatch the ifMatch + */ + public Builder(String policyId, String ifMatch) { + this.policyId = policyId; + this.ifMatch = ifMatch; + } + + /** + * Builds a UpdatePolicyStateOptions. + * + * @return the new UpdatePolicyStateOptions instance + */ + public UpdatePolicyStateOptions build() { + return new UpdatePolicyStateOptions(this); + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the UpdatePolicyStateOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdatePolicyStateOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the state. + * + * @param state the state + * @return the UpdatePolicyStateOptions builder + */ + public Builder state(String state) { + this.state = state; + return this; + } + } + + protected UpdatePolicyStateOptions() { } + + protected UpdatePolicyStateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + policyId = builder.policyId; + ifMatch = builder.ifMatch; + state = builder.state; + } + + /** + * New builder. + * + * @return a UpdatePolicyStateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the policyId. + * + * The policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be + * retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the state. + * + * The policy state. + * + * @return the state + */ + public String state() { + return state; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java new file mode 100644 index 00000000000..f10cba5fe93 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java @@ -0,0 +1,166 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updateRoleAssignment options. + */ +public class UpdateRoleAssignmentOptions extends GenericModel { + + protected String assignmentId; + protected String ifMatch; + protected String templateVersion; + + /** + * Builder. + */ + public static class Builder { + private String assignmentId; + private String ifMatch; + private String templateVersion; + + /** + * Instantiates a new Builder from an existing UpdateRoleAssignmentOptions instance. + * + * @param updateRoleAssignmentOptions the instance to initialize the Builder with + */ + private Builder(UpdateRoleAssignmentOptions updateRoleAssignmentOptions) { + this.assignmentId = updateRoleAssignmentOptions.assignmentId; + this.ifMatch = updateRoleAssignmentOptions.ifMatch; + this.templateVersion = updateRoleAssignmentOptions.templateVersion; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assignmentId the assignmentId + * @param ifMatch the ifMatch + * @param templateVersion the templateVersion + */ + public Builder(String assignmentId, String ifMatch, String templateVersion) { + this.assignmentId = assignmentId; + this.ifMatch = ifMatch; + this.templateVersion = templateVersion; + } + + /** + * Builds a UpdateRoleAssignmentOptions. + * + * @return the new UpdateRoleAssignmentOptions instance + */ + public UpdateRoleAssignmentOptions build() { + return new UpdateRoleAssignmentOptions(this); + } + + /** + * Set the assignmentId. + * + * @param assignmentId the assignmentId + * @return the UpdateRoleAssignmentOptions builder + */ + public Builder assignmentId(String assignmentId) { + this.assignmentId = assignmentId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdateRoleAssignmentOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the templateVersion. + * + * @param templateVersion the templateVersion + * @return the UpdateRoleAssignmentOptions builder + */ + public Builder templateVersion(String templateVersion) { + this.templateVersion = templateVersion; + return this; + } + } + + protected UpdateRoleAssignmentOptions() { } + + protected UpdateRoleAssignmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, + "assignmentId 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.templateVersion, + "templateVersion cannot be null"); + assignmentId = builder.assignmentId; + ifMatch = builder.ifMatch; + templateVersion = builder.templateVersion; + } + + /** + * New builder. + * + * @return a UpdateRoleAssignmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assignmentId. + * + * Role template assignment ID. + * + * @return the assignmentId + */ + public String assignmentId() { + return assignmentId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating a role assignment and must match the Etag value of the existing role assignment. + * The Etag can be retrieved using the GET /v1/role_assignments/{assignment_id} API and looking at the Etag response + * header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the templateVersion. + * + * The version number of the template used to identify different versions of same template. + * + * @return the templateVersion + */ + public String templateVersion() { + return templateVersion; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java new file mode 100644 index 00000000000..3d9dbb43fb3 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java @@ -0,0 +1,199 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updateSettings options. + */ +public class UpdateSettingsOptions extends GenericModel { + + protected String accountId; + protected String ifMatch; + protected ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction; + protected String acceptLanguage; + + /** + * Builder. + */ + public static class Builder { + private String accountId; + private String ifMatch; + private ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction; + private String acceptLanguage; + + /** + * Instantiates a new Builder from an existing UpdateSettingsOptions instance. + * + * @param updateSettingsOptions the instance to initialize the Builder with + */ + private Builder(UpdateSettingsOptions updateSettingsOptions) { + this.accountId = updateSettingsOptions.accountId; + this.ifMatch = updateSettingsOptions.ifMatch; + this.externalAccountIdentityInteraction = updateSettingsOptions.externalAccountIdentityInteraction; + this.acceptLanguage = updateSettingsOptions.acceptLanguage; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param accountId the accountId + * @param ifMatch the ifMatch + */ + public Builder(String accountId, String ifMatch) { + this.accountId = accountId; + this.ifMatch = ifMatch; + } + + /** + * Builds a UpdateSettingsOptions. + * + * @return the new UpdateSettingsOptions instance + */ + public UpdateSettingsOptions build() { + return new UpdateSettingsOptions(this); + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the UpdateSettingsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the ifMatch. + * + * @param ifMatch the ifMatch + * @return the UpdateSettingsOptions builder + */ + public Builder ifMatch(String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + /** + * Set the externalAccountIdentityInteraction. + * + * @param externalAccountIdentityInteraction the externalAccountIdentityInteraction + * @return the UpdateSettingsOptions builder + */ + public Builder externalAccountIdentityInteraction(ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction) { + this.externalAccountIdentityInteraction = externalAccountIdentityInteraction; + return this; + } + + /** + * Set the acceptLanguage. + * + * @param acceptLanguage the acceptLanguage + * @return the UpdateSettingsOptions builder + */ + public Builder acceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + } + + protected UpdateSettingsOptions() { } + + protected UpdateSettingsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.accountId, + "accountId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, + "ifMatch cannot be null"); + accountId = builder.accountId; + ifMatch = builder.ifMatch; + externalAccountIdentityInteraction = builder.externalAccountIdentityInteraction; + acceptLanguage = builder.acceptLanguage; + } + + /** + * New builder. + * + * @return a UpdateSettingsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the accountId. + * + * The account GUID that the settings belong to. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the ifMatch. + * + * The revision number for updating Access Management Account Settings and must match the Etag value of the existing + * Access Management Account Settings. The Etag can be retrieved using the GET + * /v1/accounts/{account_id}/settings/access_management API and looking at the Etag response header. + * + * @return the ifMatch + */ + public String ifMatch() { + return ifMatch; + } + + /** + * Gets the externalAccountIdentityInteraction. + * + * Update to how external accounts can interact in relation to the requested account. + * + * @return the externalAccountIdentityInteraction + */ + public ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction() { + return externalAccountIdentityInteraction; + } + + /** + * Gets the acceptLanguage. + * + * Language code for translations + * * `default` - English + * * `de` - German (Standard) + * * `en` - English + * * `es` - Spanish (Spain) + * * `fr` - French (Standard) + * * `it` - Italian (Standard) + * * `ja` - Japanese + * * `ko` - Korean + * * `pt-br` - Portuguese (Brazil) + * * `zh-cn` - Chinese (Simplified, PRC) + * * `zh-tw` - (Chinese, Taiwan). + * + * @return the acceptLanguage + */ + public String acceptLanguage() { + return acceptLanguage; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java new file mode 100644 index 00000000000..fdae9e28c12 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java @@ -0,0 +1,108 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * V2PoliciesPager can be used to simplify the use of the "listV2Policies" method. + */ +public class V2PoliciesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListV2PoliciesOptions options; + protected IamPolicyManagement client; + protected PageContext pageContext; + + // Hide the default ctor. + protected V2PoliciesPager() { } + + /** + * Constructs a new V2PoliciesPager instance with the specified client and options model instance. + * @param client the IamPolicyManagement instance to be used to invoke the "listV2Policies" method + * @param options the ListV2PoliciesOptions instance to be used to invoke the "listV2Policies" method + */ + public V2PoliciesPager(IamPolicyManagement client, ListV2PoliciesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<V2PolicyTemplateMetaData> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListV2PoliciesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + V2PolicyCollection result = client.listV2Policies(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getPolicies(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<V2PolicyTemplateMetaData> containing all results returned by the "listV2Policies" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java new file mode 100644 index 00000000000..842a354b7b1 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java @@ -0,0 +1,247 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the policy. + */ +public class V2Policy extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + /** + * The policy state, either 'deleted' or 'active'. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String type; + protected String description; + protected V2PolicySubject subject; + protected V2PolicyResource resource; + protected String pattern; + protected V2PolicyRule rule; + protected String id; + protected String href; + protected ControlResponse control; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String state; + @SerializedName("last_permit_at") + protected String lastPermitAt; + @SerializedName("last_permit_frequency") + protected Long lastPermitFrequency; + + protected V2Policy() { } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject getSubject() { + return subject; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource getResource() { + return resource; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String getPattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule getRule() { + return rule; + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the policies API by policy ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the control. + * + * @return the control + */ + public ControlResponse getControl() { + return control; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the state. + * + * The policy state, either 'deleted' or 'active'. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the lastPermitAt. + * + * The optional last permit time of policy, when passing query parameter format=include_last_permit. + * + * @return the lastPermitAt + */ + public String getLastPermitAt() { + return lastPermitAt; + } + + /** + * Gets the lastPermitFrequency. + * + * The optional count of times that policy has provided a permit, when passing query parameter + * format=include_last_permit. + * + * @return the lastPermitFrequency + */ + public Long getLastPermitFrequency() { + return lastPermitFrequency; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java new file mode 100644 index 00000000000..d392025f8d8 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java @@ -0,0 +1,88 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A collection of policies. + */ +public class V2PolicyCollection extends GenericModel { + + protected Long limit; + protected First first; + protected Next next; + protected Previous previous; + protected List policies; + + protected V2PolicyCollection() { } + + /** + * Gets the limit. + * + * The number of documents to include per each page of the collection. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the first. + * + * Details with linking href to first page of requested collection. + * + * @return the first + */ + public First getFirst() { + return first; + } + + /** + * Gets the next. + * + * Details with href linking to the following page of requested collection. + * + * @return the next + */ + public Next getNext() { + return next; + } + + /** + * Gets the previous. + * + * Details with linking href to previous page of requested collection. + * + * @return the previous + */ + public Previous getPrevious() { + return previous; + } + + /** + * Gets the policies. + * + * List of policies. + * + * @return the policies + */ + public List getPolicies() { + return policies; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java new file mode 100644 index 00000000000..caf8dd522a9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java @@ -0,0 +1,167 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The resource attributes to which the policy grants access. + */ +public class V2PolicyResource extends GenericModel { + + protected List attributes; + protected List tags; + + /** + * Builder. + */ + public static class Builder { + private List attributes; + private List tags; + + /** + * Instantiates a new Builder from an existing V2PolicyResource instance. + * + * @param v2PolicyResource the instance to initialize the Builder with + */ + private Builder(V2PolicyResource v2PolicyResource) { + this.attributes = v2PolicyResource.attributes; + this.tags = v2PolicyResource.tags; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param attributes the attributes + */ + public Builder(List attributes) { + this.attributes = attributes; + } + + /** + * Builds a V2PolicyResource. + * + * @return the new V2PolicyResource instance + */ + public V2PolicyResource build() { + return new V2PolicyResource(this); + } + + /** + * Adds a new element to attributes. + * + * @param attributes the new element to be added + * @return the V2PolicyResource builder + */ + public Builder addAttributes(V2PolicyResourceAttribute attributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, + "attributes cannot be null"); + if (this.attributes == null) { + this.attributes = new ArrayList(); + } + this.attributes.add(attributes); + return this; + } + + /** + * Adds a new element to tags. + * + * @param tags the new element to be added + * @return the V2PolicyResource builder + */ + public Builder addTags(V2PolicyResourceTag tags) { + com.ibm.cloud.sdk.core.util.Validator.notNull(tags, + "tags cannot be null"); + if (this.tags == null) { + this.tags = new ArrayList(); + } + this.tags.add(tags); + return this; + } + + /** + * Set the attributes. + * Existing attributes will be replaced. + * + * @param attributes the attributes + * @return the V2PolicyResource builder + */ + public Builder attributes(List attributes) { + this.attributes = attributes; + return this; + } + + /** + * Set the tags. + * Existing tags will be replaced. + * + * @param tags the tags + * @return the V2PolicyResource builder + */ + public Builder tags(List tags) { + this.tags = tags; + return this; + } + } + + protected V2PolicyResource() { } + + protected V2PolicyResource(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, + "attributes cannot be null"); + attributes = builder.attributes; + tags = builder.tags; + } + + /** + * New builder. + * + * @return a V2PolicyResource builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the attributes. + * + * List of resource attributes to which the policy grants access. + * + * @return the attributes + */ + public List attributes() { + return attributes; + } + + /** + * Gets the tags. + * + * Optional list of resource tags to which the policy grants access. + * + * @return the tags + */ + public List tags() { + return tags; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java new file mode 100644 index 00000000000..73e7cedd55e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java @@ -0,0 +1,181 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Resource attribute to which the policy grants access. + */ +public class V2PolicyResourceAttribute extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + } + + protected String key; + protected String operator; + protected Object value; + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing V2PolicyResourceAttribute instance. + * + * @param v2PolicyResourceAttribute the instance to initialize the Builder with + */ + private Builder(V2PolicyResourceAttribute v2PolicyResourceAttribute) { + this.key = v2PolicyResourceAttribute.key; + this.operator = v2PolicyResourceAttribute.operator; + this.value = v2PolicyResourceAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a V2PolicyResourceAttribute. + * + * @return the new V2PolicyResourceAttribute instance + */ + public V2PolicyResourceAttribute build() { + return new V2PolicyResourceAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the V2PolicyResourceAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicyResourceAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the V2PolicyResourceAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected V2PolicyResourceAttribute() { } + + protected V2PolicyResourceAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a V2PolicyResourceAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the key. + * + * The name of a resource attribute. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java new file mode 100644 index 00000000000..bb32772b8dc --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java @@ -0,0 +1,174 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A tag associated with a resource. + */ +public class V2PolicyResourceTag extends GenericModel { + + /** + * The operator of an access management tag. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + } + + protected String key; + protected String value; + protected String operator; + + /** + * Builder. + */ + public static class Builder { + private String key; + private String value; + private String operator; + + /** + * Instantiates a new Builder from an existing V2PolicyResourceTag instance. + * + * @param v2PolicyResourceTag the instance to initialize the Builder with + */ + private Builder(V2PolicyResourceTag v2PolicyResourceTag) { + this.key = v2PolicyResourceTag.key; + this.value = v2PolicyResourceTag.value; + this.operator = v2PolicyResourceTag.operator; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param value the value + * @param operator the operator + */ + public Builder(String key, String value, String operator) { + this.key = key; + this.value = value; + this.operator = operator; + } + + /** + * Builds a V2PolicyResourceTag. + * + * @return the new V2PolicyResourceTag instance + */ + public V2PolicyResourceTag build() { + return new V2PolicyResourceTag(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the V2PolicyResourceTag builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the V2PolicyResourceTag builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicyResourceTag builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + } + + protected V2PolicyResourceTag() { } + + protected V2PolicyResourceTag(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + key = builder.key; + value = builder.value; + operator = builder.operator; + } + + /** + * New builder. + * + * @return a V2PolicyResourceTag builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the key. + * + * The name of an access management tag. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the value. + * + * The value of an access management tag. + * + * @return the value + */ + public String value() { + return value; + } + + /** + * Gets the operator. + * + * The operator of an access management tag. + * + * @return the operator + */ + public String operator() { + return operator; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java new file mode 100644 index 00000000000..13a9f5fbd94 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java @@ -0,0 +1,126 @@ +/* + * (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_policy_management.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Additional access conditions associated with the policy. + * + * Classes which extend this class: + * - V2PolicyRuleRuleAttribute + * - V2PolicyRuleRuleWithNestedConditions + */ +public class V2PolicyRule extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + protected String key; + protected String operator; + protected Object value; + protected List conditions; + + protected V2PolicyRule() { } + + /** + * Gets the key. + * + * The name of an attribute. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } + + /** + * Gets the conditions. + * + * List of conditions associated with a policy. For example, time-based conditions that grant access over a certain + * time period. + * + * @return the conditions + */ + public List conditions() { + return conditions; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java new file mode 100644 index 00000000000..c20b3a8cb0c --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java @@ -0,0 +1,170 @@ +/* + * (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_policy_management.v1.model; + +/** + * Rule that specifies additional access that is granted (For example, time-based condition). + */ +public class V2PolicyRuleRuleAttribute extends V2PolicyRule { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + /** stringEqualsAnyOf. */ + String STRINGEQUALSANYOF = "stringEqualsAnyOf"; + /** stringMatchAnyOf. */ + String STRINGMATCHANYOF = "stringMatchAnyOf"; + /** stringMatch. */ + String STRINGMATCH = "stringMatch"; + /** timeLessThan. */ + String TIMELESSTHAN = "timeLessThan"; + /** timeLessThanOrEquals. */ + String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; + /** timeGreaterThan. */ + String TIMEGREATERTHAN = "timeGreaterThan"; + /** timeGreaterThanOrEquals. */ + String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; + /** dateLessThan. */ + String DATELESSTHAN = "dateLessThan"; + /** dateLessThanOrEquals. */ + String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; + /** dateGreaterThan. */ + String DATEGREATERTHAN = "dateGreaterThan"; + /** dateGreaterThanOrEquals. */ + String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; + /** dateTimeLessThan. */ + String DATETIMELESSTHAN = "dateTimeLessThan"; + /** dateTimeLessThanOrEquals. */ + String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; + /** dateTimeGreaterThan. */ + String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; + /** dateTimeGreaterThanOrEquals. */ + String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; + /** dayOfWeekEquals. */ + String DAYOFWEEKEQUALS = "dayOfWeekEquals"; + /** dayOfWeekAnyOf. */ + String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; + } + + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing V2PolicyRuleRuleAttribute instance. + * + * @param v2PolicyRuleRuleAttribute the instance to initialize the Builder with + */ + public Builder(V2PolicyRule v2PolicyRuleRuleAttribute) { + this.key = v2PolicyRuleRuleAttribute.key; + this.operator = v2PolicyRuleRuleAttribute.operator; + this.value = v2PolicyRuleRuleAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a V2PolicyRuleRuleAttribute. + * + * @return the new V2PolicyRuleRuleAttribute instance + */ + public V2PolicyRuleRuleAttribute build() { + return new V2PolicyRuleRuleAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the V2PolicyRuleRuleAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicyRuleRuleAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the V2PolicyRuleRuleAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected V2PolicyRuleRuleAttribute() { } + + protected V2PolicyRuleRuleAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a V2PolicyRuleRuleAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java new file mode 100644 index 00000000000..8d6e57920f9 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java @@ -0,0 +1,139 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * Rule that specifies additional access that is granted (for example, time-based condition) accross multiple + * conditions. + */ +public class V2PolicyRuleRuleWithNestedConditions extends V2PolicyRule { + + /** + * Operator to evaluate conditions. + */ + public interface Operator { + /** and. */ + String AND = "and"; + /** or. */ + String OR = "or"; + } + + + /** + * Builder. + */ + public static class Builder { + private String operator; + private List conditions; + + /** + * Instantiates a new Builder from an existing V2PolicyRuleRuleWithNestedConditions instance. + * + * @param v2PolicyRuleRuleWithNestedConditions the instance to initialize the Builder with + */ + public Builder(V2PolicyRule v2PolicyRuleRuleWithNestedConditions) { + this.operator = v2PolicyRuleRuleWithNestedConditions.operator; + this.conditions = v2PolicyRuleRuleWithNestedConditions.conditions; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param operator the operator + * @param conditions the conditions + */ + public Builder(String operator, List conditions) { + this.operator = operator; + this.conditions = conditions; + } + + /** + * Builds a V2PolicyRuleRuleWithNestedConditions. + * + * @return the new V2PolicyRuleRuleWithNestedConditions instance + */ + public V2PolicyRuleRuleWithNestedConditions build() { + return new V2PolicyRuleRuleWithNestedConditions(this); + } + + /** + * Adds a new element to conditions. + * + * @param conditions the new element to be added + * @return the V2PolicyRuleRuleWithNestedConditions builder + */ + public Builder addConditions(NestedCondition conditions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(conditions, + "conditions cannot be null"); + if (this.conditions == null) { + this.conditions = new ArrayList(); + } + this.conditions.add(conditions); + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicyRuleRuleWithNestedConditions builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the conditions. + * Existing conditions will be replaced. + * + * @param conditions the conditions + * @return the V2PolicyRuleRuleWithNestedConditions builder + */ + public Builder conditions(List conditions) { + this.conditions = conditions; + return this; + } + } + + protected V2PolicyRuleRuleWithNestedConditions() { } + + protected V2PolicyRuleRuleWithNestedConditions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.conditions, + "conditions cannot be null"); + operator = builder.operator; + conditions = builder.conditions; + } + + /** + * New builder. + * + * @return a V2PolicyRuleRuleWithNestedConditions builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java new file mode 100644 index 00000000000..891513fd45a --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java @@ -0,0 +1,124 @@ +/* + * (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_policy_management.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The subject attributes for whom the policy grants access. + */ +public class V2PolicySubject extends GenericModel { + + protected List attributes; + + /** + * Builder. + */ + public static class Builder { + private List attributes; + + /** + * Instantiates a new Builder from an existing V2PolicySubject instance. + * + * @param v2PolicySubject the instance to initialize the Builder with + */ + private Builder(V2PolicySubject v2PolicySubject) { + this.attributes = v2PolicySubject.attributes; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param attributes the attributes + */ + public Builder(List attributes) { + this.attributes = attributes; + } + + /** + * Builds a V2PolicySubject. + * + * @return the new V2PolicySubject instance + */ + public V2PolicySubject build() { + return new V2PolicySubject(this); + } + + /** + * Adds a new element to attributes. + * + * @param attributes the new element to be added + * @return the V2PolicySubject builder + */ + public Builder addAttributes(V2PolicySubjectAttribute attributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, + "attributes cannot be null"); + if (this.attributes == null) { + this.attributes = new ArrayList(); + } + this.attributes.add(attributes); + return this; + } + + /** + * Set the attributes. + * Existing attributes will be replaced. + * + * @param attributes the attributes + * @return the V2PolicySubject builder + */ + public Builder attributes(List attributes) { + this.attributes = attributes; + return this; + } + } + + protected V2PolicySubject() { } + + protected V2PolicySubject(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, + "attributes cannot be null"); + attributes = builder.attributes; + } + + /** + * New builder. + * + * @return a V2PolicySubject builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the attributes. + * + * List of subject attributes associated with policy. + * + * @return the attributes + */ + public List attributes() { + return attributes; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java new file mode 100644 index 00000000000..c90606429df --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java @@ -0,0 +1,175 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Subject attribute for whom the policy grants access. + */ +public class V2PolicySubjectAttribute extends GenericModel { + + /** + * The operator of an attribute. + */ + public interface Operator { + /** stringEquals. */ + String STRINGEQUALS = "stringEquals"; + /** stringExists. */ + String STRINGEXISTS = "stringExists"; + } + + protected String key; + protected String operator; + protected Object value; + + /** + * Builder. + */ + public static class Builder { + private String key; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing V2PolicySubjectAttribute instance. + * + * @param v2PolicySubjectAttribute the instance to initialize the Builder with + */ + private Builder(V2PolicySubjectAttribute v2PolicySubjectAttribute) { + this.key = v2PolicySubjectAttribute.key; + this.operator = v2PolicySubjectAttribute.operator; + this.value = v2PolicySubjectAttribute.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param key the key + * @param operator the operator + * @param value the value + */ + public Builder(String key, String operator, Object value) { + this.key = key; + this.operator = operator; + this.value = value; + } + + /** + * Builds a V2PolicySubjectAttribute. + * + * @return the new V2PolicySubjectAttribute instance + */ + public V2PolicySubjectAttribute build() { + return new V2PolicySubjectAttribute(this); + } + + /** + * Set the key. + * + * @param key the key + * @return the V2PolicySubjectAttribute builder + */ + public Builder key(String key) { + this.key = key; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the V2PolicySubjectAttribute builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the V2PolicySubjectAttribute builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected V2PolicySubjectAttribute() { } + + protected V2PolicySubjectAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, + "key cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + key = builder.key; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a V2PolicySubjectAttribute builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the key. + * + * The name of a subject attribute. For example, iam_id, access_group_id. + * + * @return the key + */ + public String key() { + return key; + } + + /** + * Gets the operator. + * + * The operator of an attribute. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. + * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. + * + * @return the value + */ + public Object value() { + return value; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java new file mode 100644 index 00000000000..720f7b57d4e --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java @@ -0,0 +1,260 @@ +/* + * (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_policy_management.v1.model; + +import java.util.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The core set of properties associated with the policy. + */ +public class V2PolicyTemplateMetaData extends GenericModel { + + /** + * The policy type; either 'access' or 'authorization'. + */ + public interface Type { + /** access. */ + String ACCESS = "access"; + /** authorization. */ + String AUTHORIZATION = "authorization"; + } + + /** + * The policy state, either 'deleted' or 'active'. + */ + public interface State { + /** active. */ + String ACTIVE = "active"; + /** deleted. */ + String DELETED = "deleted"; + } + + protected String type; + protected String description; + protected V2PolicySubject subject; + protected V2PolicyResource resource; + protected String pattern; + protected V2PolicyRule rule; + protected String id; + protected String href; + protected ControlResponse control; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("created_by_id") + protected String createdById; + @SerializedName("last_modified_at") + protected Date lastModifiedAt; + @SerializedName("last_modified_by_id") + protected String lastModifiedById; + protected String state; + @SerializedName("last_permit_at") + protected String lastPermitAt; + @SerializedName("last_permit_frequency") + protected Long lastPermitFrequency; + protected TemplateMetadata template; + + protected V2PolicyTemplateMetaData() { } + + /** + * Gets the type. + * + * The policy type; either 'access' or 'authorization'. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the description. + * + * Description of the policy. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the subject. + * + * The subject attributes for whom the policy grants access. + * + * @return the subject + */ + public V2PolicySubject getSubject() { + return subject; + } + + /** + * Gets the resource. + * + * The resource attributes to which the policy grants access. + * + * @return the resource + */ + public V2PolicyResource getResource() { + return resource; + } + + /** + * Gets the pattern. + * + * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or + * 'time-based-conditions:weekly:custom-hours'. + * + * @return the pattern + */ + public String getPattern() { + return pattern; + } + + /** + * Gets the rule. + * + * Additional access conditions associated with the policy. + * + * @return the rule + */ + public V2PolicyRule getRule() { + return rule; + } + + /** + * Gets the id. + * + * The policy ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the href. + * + * The href URL that links to the policies API by policy ID. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the control. + * + * @return the control + */ + public ControlResponse getControl() { + return control; + } + + /** + * Gets the createdAt. + * + * The UTC timestamp when the policy was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the createdById. + * + * The IAM ID of the entity that created the policy. + * + * @return the createdById + */ + public String getCreatedById() { + return createdById; + } + + /** + * Gets the lastModifiedAt. + * + * The UTC timestamp when the policy was last modified. + * + * @return the lastModifiedAt + */ + public Date getLastModifiedAt() { + return lastModifiedAt; + } + + /** + * Gets the lastModifiedById. + * + * The IAM ID of the entity that last modified the policy. + * + * @return the lastModifiedById + */ + public String getLastModifiedById() { + return lastModifiedById; + } + + /** + * Gets the state. + * + * The policy state, either 'deleted' or 'active'. + * + * @return the state + */ + public String getState() { + return state; + } + + /** + * Gets the lastPermitAt. + * + * The optional last permit time of policy, when passing query parameter format=include_last_permit. + * + * @return the lastPermitAt + */ + public String getLastPermitAt() { + return lastPermitAt; + } + + /** + * Gets the lastPermitFrequency. + * + * The optional count of times that policy has provided a permit, when passing query parameter + * format=include_last_permit. + * + * @return the lastPermitFrequency + */ + public Long getLastPermitFrequency() { + return lastPermitFrequency; + } + + /** + * Gets the template. + * + * The details of the IAM template that was used to create an enterprise-managed policy in your account. When + * returned, this indicates that the policy is created from and managed by a template in the root enterprise account. + * + * @return the template + */ + public TemplateMetadata getTemplate() { + return template; + } +} + diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java new file mode 100644 index 00000000000..63a87389391 --- /dev/null +++ b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java @@ -0,0 +1,17 @@ +/* + * (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. + */ + +/** + * IAM Policy Management v1. + */ +package com.ibm.cloud.platform_services.iam_policy_management.v1; diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java new file mode 100644 index 00000000000..b38933306a6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java @@ -0,0 +1,5007 @@ +/* + * (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_policy_management.v1; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplatesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponse; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControlWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedCondition; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleWithConditions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PoliciesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplatesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoleReferences; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PoliciesPager; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRule; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleWithNestedConditions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.http.Response; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import okhttp3.mockwebserver.RecordedRequest; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the IamPolicyManagement service. + */ +public class IamPolicyManagementTest { + + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + protected MockWebServer server; + protected IamPolicyManagement iamPolicyManagementService; + + // Construct the service with a null authenticator (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testConstructorWithNullAuthenticator() throws Throwable { + final String serviceName = "testService"; + new IamPolicyManagement(serviceName, null); + } + + // Test the listPolicies operation with a valid options model parameter + @Test + public void testListPoliciesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policies\": [{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}]}"; + String listPoliciesPath = "/v1/policies"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListPoliciesOptions model + ListPoliciesOptions listPoliciesOptionsModel = new ListPoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .tagName("testString") + .tagValue("testString") + .sort("id") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listPolicies() with a valid options model and verify the result + Response response = iamPolicyManagementService.listPolicies(listPoliciesOptionsModel).execute(); + assertNotNull(response); + PolicyCollection 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, listPoliciesPath); + // 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("access_group_id"), "testString"); + assertEquals(query.get("type"), "access"); + assertEquals(query.get("service_type"), "service"); + assertEquals(query.get("tag_name"), "testString"); + assertEquals(query.get("tag_value"), "testString"); + assertEquals(query.get("sort"), "id"); + assertEquals(query.get("format"), "include_last_permit"); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listPolicies operation with and without retries enabled + @Test + public void testListPoliciesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListPoliciesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListPoliciesWOptions(); + } + + // Test the listPolicies operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPoliciesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listPolicies(null).execute(); + } + + // Test the listPolicies operation using the PoliciesPager.getNext() method + @Test + public void testListPoliciesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPoliciesOptions listPoliciesOptions = new ListPoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .tagName("testString") + .tagValue("testString") + .sort("id") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + PoliciesPager pager = new PoliciesPager(iamPolicyManagementService, listPoliciesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listPolicies operation using the PoliciesPager.getAll() method + @Test + public void testListPoliciesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPoliciesOptions listPoliciesOptions = new ListPoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .tagName("testString") + .tagValue("testString") + .sort("id") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + PoliciesPager pager = new PoliciesPager(iamPolicyManagementService, listPoliciesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createPolicy operation with a valid options model parameter + @Test + public void testCreatePolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; + String createPolicyPath = "/v1/policies"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the SubjectAttribute model + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + + // Construct an instance of the PolicySubject model + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + + // Construct an instance of the PolicyRole model + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the ResourceAttribute model + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + + // Construct an instance of the ResourceTag model + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + + // Construct an instance of the PolicyResource model + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + + // Construct an instance of the CreatePolicyOptions model + CreatePolicyOptions createPolicyOptionsModel = new CreatePolicyOptions.Builder() + .type("testString") + .subjects(java.util.Arrays.asList(policySubjectModel)) + .roles(java.util.Arrays.asList(policyRoleModel)) + .resources(java.util.Arrays.asList(policyResourceModel)) + .description("testString") + .acceptLanguage("default") + .build(); + + // Invoke createPolicy() with a valid options model and verify the result + Response response = iamPolicyManagementService.createPolicy(createPolicyOptionsModel).execute(); + assertNotNull(response); + Policy 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createPolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createPolicy operation with and without retries enabled + @Test + public void testCreatePolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreatePolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreatePolicyWOptions(); + } + + // Test the createPolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createPolicy(null).execute(); + } + + // Test the replacePolicy operation with a valid options model parameter + @Test + public void testReplacePolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; + String replacePolicyPath = "/v1/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the SubjectAttribute model + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + + // Construct an instance of the PolicySubject model + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + + // Construct an instance of the PolicyRole model + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the ResourceAttribute model + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + + // Construct an instance of the ResourceTag model + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + + // Construct an instance of the PolicyResource model + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + + // Construct an instance of the ReplacePolicyOptions model + ReplacePolicyOptions replacePolicyOptionsModel = new ReplacePolicyOptions.Builder() + .policyId("testString") + .ifMatch("testString") + .type("testString") + .subjects(java.util.Arrays.asList(policySubjectModel)) + .roles(java.util.Arrays.asList(policyRoleModel)) + .resources(java.util.Arrays.asList(policyResourceModel)) + .description("testString") + .build(); + + // Invoke replacePolicy() with a valid options model and verify the result + Response response = iamPolicyManagementService.replacePolicy(replacePolicyOptionsModel).execute(); + assertNotNull(response); + Policy 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, replacePolicyPath); + // 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 replacePolicy operation with and without retries enabled + @Test + public void testReplacePolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplacePolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplacePolicyWOptions(); + } + + // Test the replacePolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplacePolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replacePolicy(null).execute(); + } + + // Test the getPolicy operation with a valid options model parameter + @Test + public void testGetPolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}"; + String getPolicyPath = "/v1/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetPolicyOptions model + GetPolicyOptions getPolicyOptionsModel = new GetPolicyOptions.Builder() + .policyId("testString") + .build(); + + // Invoke getPolicy() with a valid options model and verify the result + Response response = iamPolicyManagementService.getPolicy(getPolicyOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateMetaData 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, getPolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getPolicy operation with and without retries enabled + @Test + public void testGetPolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetPolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetPolicyWOptions(); + } + + // Test the getPolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getPolicy(null).execute(); + } + + // Test the deletePolicy operation with a valid options model parameter + @Test + public void testDeletePolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deletePolicyPath = "/v1/policies/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeletePolicyOptions model + DeletePolicyOptions deletePolicyOptionsModel = new DeletePolicyOptions.Builder() + .policyId("testString") + .build(); + + // Invoke deletePolicy() with a valid options model and verify the result + Response response = iamPolicyManagementService.deletePolicy(deletePolicyOptionsModel).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, deletePolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deletePolicy operation with and without retries enabled + @Test + public void testDeletePolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeletePolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeletePolicyWOptions(); + } + + // Test the deletePolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deletePolicy(null).execute(); + } + + // Test the updatePolicyState operation with a valid options model parameter + @Test + public void testUpdatePolicyStateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; + String updatePolicyStatePath = "/v1/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdatePolicyStateOptions model + UpdatePolicyStateOptions updatePolicyStateOptionsModel = new UpdatePolicyStateOptions.Builder() + .policyId("testString") + .ifMatch("testString") + .state("active") + .build(); + + // Invoke updatePolicyState() with a valid options model and verify the result + Response response = iamPolicyManagementService.updatePolicyState(updatePolicyStateOptionsModel).execute(); + assertNotNull(response); + Policy 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updatePolicyStatePath); + // 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 updatePolicyState operation with and without retries enabled + @Test + public void testUpdatePolicyStateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdatePolicyStateWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdatePolicyStateWOptions(); + } + + // Test the updatePolicyState operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdatePolicyStateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updatePolicyState(null).execute(); + } + + // Test the listRoles operation with a valid options model parameter + @Test + public void testListRolesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"custom_roles\": [{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}], \"service_roles\": [{\"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\"}], \"system_roles\": [{\"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\"}]}"; + String listRolesPath = "/v2/roles"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListRolesOptions model + ListRolesOptions listRolesOptionsModel = new ListRolesOptions.Builder() + .acceptLanguage("default") + .accountId("testString") + .serviceName("iam-groups") + .sourceServiceName("iam-groups") + .policyType("authorization") + .serviceGroupId("IAM") + .build(); + + // Invoke listRoles() with a valid options model and verify the result + Response response = iamPolicyManagementService.listRoles(listRolesOptionsModel).execute(); + assertNotNull(response); + RoleCollection 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, listRolesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("service_name"), "iam-groups"); + assertEquals(query.get("source_service_name"), "iam-groups"); + assertEquals(query.get("policy_type"), "authorization"); + assertEquals(query.get("service_group_id"), "IAM"); + } + + // Test the listRoles operation with and without retries enabled + @Test + public void testListRolesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListRolesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListRolesWOptions(); + } + + // Test the createRole operation with a valid options model parameter + @Test + public void testCreateRoleWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; + String createRolePath = "/v2/roles"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the CreateRoleOptions model + CreateRoleOptions createRoleOptionsModel = new CreateRoleOptions.Builder() + .displayName("testString") + .actions(java.util.Arrays.asList("testString")) + .name("Developer") + .accountId("testString") + .serviceName("iam-groups") + .description("testString") + .acceptLanguage("default") + .build(); + + // Invoke createRole() with a valid options model and verify the result + Response response = iamPolicyManagementService.createRole(createRoleOptionsModel).execute(); + assertNotNull(response); + CustomRole 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createRolePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createRole operation with and without retries enabled + @Test + public void testCreateRoleWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateRoleWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateRoleWOptions(); + } + + // Test the createRole operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createRole(null).execute(); + } + + // Test the replaceRole operation with a valid options model parameter + @Test + public void testReplaceRoleWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; + String replaceRolePath = "/v2/roles/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ReplaceRoleOptions model + ReplaceRoleOptions replaceRoleOptionsModel = new ReplaceRoleOptions.Builder() + .roleId("testString") + .ifMatch("testString") + .displayName("testString") + .actions(java.util.Arrays.asList("testString")) + .description("testString") + .build(); + + // Invoke replaceRole() with a valid options model and verify the result + Response response = iamPolicyManagementService.replaceRole(replaceRoleOptionsModel).execute(); + assertNotNull(response); + CustomRole 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, replaceRolePath); + // 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 replaceRole operation with and without retries enabled + @Test + public void testReplaceRoleWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplaceRoleWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplaceRoleWOptions(); + } + + // Test the replaceRole operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceRoleNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replaceRole(null).execute(); + } + + // Test the getRole operation with a valid options model parameter + @Test + public void testGetRoleWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; + String getRolePath = "/v2/roles/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetRoleOptions model + GetRoleOptions getRoleOptionsModel = new GetRoleOptions.Builder() + .roleId("testString") + .build(); + + // Invoke getRole() with a valid options model and verify the result + Response response = iamPolicyManagementService.getRole(getRoleOptionsModel).execute(); + assertNotNull(response); + CustomRole 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, getRolePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getRole operation with and without retries enabled + @Test + public void testGetRoleWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetRoleWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetRoleWOptions(); + } + + // Test the getRole operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getRole(null).execute(); + } + + // Test the deleteRole operation with a valid options model parameter + @Test + public void testDeleteRoleWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteRolePath = "/v2/roles/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteRoleOptions model + DeleteRoleOptions deleteRoleOptionsModel = new DeleteRoleOptions.Builder() + .roleId("testString") + .build(); + + // Invoke deleteRole() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteRole(deleteRoleOptionsModel).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, deleteRolePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteRole operation with and without retries enabled + @Test + public void testDeleteRoleWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteRoleWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteRoleWOptions(); + } + + // Test the deleteRole operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteRole(null).execute(); + } + + // Test the listV2Policies operation with a valid options model parameter + @Test + public void testListV2PoliciesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policies\": [{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19, \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}]}"; + String listV2PoliciesPath = "/v2/policies"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListV2PoliciesOptions model + ListV2PoliciesOptions listV2PoliciesOptionsModel = new ListV2PoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .serviceName("testString") + .serviceGroupId("testString") + .sort("testString") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listV2Policies() with a valid options model and verify the result + Response response = iamPolicyManagementService.listV2Policies(listV2PoliciesOptionsModel).execute(); + assertNotNull(response); + V2PolicyCollection 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, listV2PoliciesPath); + // 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("access_group_id"), "testString"); + assertEquals(query.get("type"), "access"); + assertEquals(query.get("service_type"), "service"); + assertEquals(query.get("service_name"), "testString"); + assertEquals(query.get("service_group_id"), "testString"); + assertEquals(query.get("sort"), "testString"); + assertEquals(query.get("format"), "include_last_permit"); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listV2Policies operation with and without retries enabled + @Test + public void testListV2PoliciesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListV2PoliciesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListV2PoliciesWOptions(); + } + + // Test the listV2Policies operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListV2PoliciesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listV2Policies(null).execute(); + } + + // Test the listV2Policies operation using the V2PoliciesPager.getNext() method + @Test + public void testListV2PoliciesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListV2PoliciesOptions listV2PoliciesOptions = new ListV2PoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .serviceName("testString") + .serviceGroupId("testString") + .sort("testString") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + V2PoliciesPager pager = new V2PoliciesPager(iamPolicyManagementService, listV2PoliciesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listV2Policies operation using the V2PoliciesPager.getAll() method + @Test + public void testListV2PoliciesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListV2PoliciesOptions listV2PoliciesOptions = new ListV2PoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .serviceName("testString") + .serviceGroupId("testString") + .sort("testString") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + V2PoliciesPager pager = new V2PoliciesPager(iamPolicyManagementService, listV2PoliciesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createV2Policy operation with a valid options model parameter + @Test + public void testCreateV2PolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19}"; + String createV2PolicyPath = "/v2/policies"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the Grant model + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the Control model + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the CreateV2PolicyOptions model + CreateV2PolicyOptions createV2PolicyOptionsModel = new CreateV2PolicyOptions.Builder() + .control(controlModel) + .type("access") + .description("testString") + .subject(v2PolicySubjectModel) + .resource(v2PolicyResourceModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .acceptLanguage("default") + .build(); + + // Invoke createV2Policy() with a valid options model and verify the result + Response response = iamPolicyManagementService.createV2Policy(createV2PolicyOptionsModel).execute(); + assertNotNull(response); + V2Policy 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createV2PolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createV2Policy operation with and without retries enabled + @Test + public void testCreateV2PolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateV2PolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateV2PolicyWOptions(); + } + + // Test the createV2Policy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateV2PolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createV2Policy(null).execute(); + } + + // Test the replaceV2Policy operation with a valid options model parameter + @Test + public void testReplaceV2PolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19}"; + String replaceV2PolicyPath = "/v2/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the Grant model + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the Control model + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the ReplaceV2PolicyOptions model + ReplaceV2PolicyOptions replaceV2PolicyOptionsModel = new ReplaceV2PolicyOptions.Builder() + .id("testString") + .ifMatch("testString") + .control(controlModel) + .type("access") + .description("testString") + .subject(v2PolicySubjectModel) + .resource(v2PolicyResourceModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .build(); + + // Invoke replaceV2Policy() with a valid options model and verify the result + Response response = iamPolicyManagementService.replaceV2Policy(replaceV2PolicyOptionsModel).execute(); + assertNotNull(response); + V2Policy 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, replaceV2PolicyPath); + // 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 replaceV2Policy operation with and without retries enabled + @Test + public void testReplaceV2PolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplaceV2PolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplaceV2PolicyWOptions(); + } + + // Test the replaceV2Policy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceV2PolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replaceV2Policy(null).execute(); + } + + // Test the getV2Policy operation with a valid options model parameter + @Test + public void testGetV2PolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19, \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}"; + String getV2PolicyPath = "/v2/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetV2PolicyOptions model + GetV2PolicyOptions getV2PolicyOptionsModel = new GetV2PolicyOptions.Builder() + .id("testString") + .format("include_last_permit") + .build(); + + // Invoke getV2Policy() with a valid options model and verify the result + Response response = iamPolicyManagementService.getV2Policy(getV2PolicyOptionsModel).execute(); + assertNotNull(response); + V2PolicyTemplateMetaData 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, getV2PolicyPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("format"), "include_last_permit"); + } + + // Test the getV2Policy operation with and without retries enabled + @Test + public void testGetV2PolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetV2PolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetV2PolicyWOptions(); + } + + // Test the getV2Policy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetV2PolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getV2Policy(null).execute(); + } + + // Test the deleteV2Policy operation with a valid options model parameter + @Test + public void testDeleteV2PolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteV2PolicyPath = "/v2/policies/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteV2PolicyOptions model + DeleteV2PolicyOptions deleteV2PolicyOptionsModel = new DeleteV2PolicyOptions.Builder() + .id("testString") + .build(); + + // Invoke deleteV2Policy() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteV2Policy(deleteV2PolicyOptionsModel).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, deleteV2PolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteV2Policy operation with and without retries enabled + @Test + public void testDeleteV2PolicyWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteV2PolicyWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteV2PolicyWOptions(); + } + + // Test the deleteV2Policy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteV2PolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteV2Policy(null).execute(); + } + + // Test the listPolicyTemplates operation with a valid options model parameter + @Test + public void testListPolicyTemplatesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policy_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; + String listPolicyTemplatesPath = "/v1/policy_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListPolicyTemplatesOptions model + ListPolicyTemplatesOptions listPolicyTemplatesOptionsModel = new ListPolicyTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .state("active") + .name("testString") + .policyServiceType("service") + .policyServiceName("testString") + .policyServiceGroupId("testString") + .policyType("access") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listPolicyTemplates() with a valid options model and verify the result + Response response = iamPolicyManagementService.listPolicyTemplates(listPolicyTemplatesOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateCollection 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, listPolicyTemplatesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("state"), "active"); + assertEquals(query.get("name"), "testString"); + assertEquals(query.get("policy_service_type"), "service"); + assertEquals(query.get("policy_service_name"), "testString"); + assertEquals(query.get("policy_service_group_id"), "testString"); + assertEquals(query.get("policy_type"), "access"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listPolicyTemplates operation with and without retries enabled + @Test + public void testListPolicyTemplatesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListPolicyTemplatesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListPolicyTemplatesWOptions(); + } + + // Test the listPolicyTemplates operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyTemplatesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listPolicyTemplates(null).execute(); + } + + // Test the listPolicyTemplates operation using the PolicyTemplatesPager.getNext() method + @Test + public void testListPolicyTemplatesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyTemplatesOptions listPolicyTemplatesOptions = new ListPolicyTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .state("active") + .name("testString") + .policyServiceType("service") + .policyServiceName("testString") + .policyServiceGroupId("testString") + .policyType("access") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + PolicyTemplatesPager pager = new PolicyTemplatesPager(iamPolicyManagementService, listPolicyTemplatesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listPolicyTemplates operation using the PolicyTemplatesPager.getAll() method + @Test + public void testListPolicyTemplatesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyTemplatesOptions listPolicyTemplatesOptions = new ListPolicyTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .state("active") + .name("testString") + .policyServiceType("service") + .policyServiceName("testString") + .policyServiceGroupId("testString") + .policyType("access") + .limit(Long.valueOf("10")) + .build(); + + PolicyTemplatesPager pager = new PolicyTemplatesPager(iamPolicyManagementService, listPolicyTemplatesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createPolicyTemplate operation with a valid options model parameter + @Test + public void testCreatePolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; + String createPolicyTemplatePath = "/v1/policy_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the TemplateGrantRoles model + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the TemplateControl model + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + + // Construct an instance of the TemplatePolicy model + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + + // Construct an instance of the CreatePolicyTemplateOptions model + CreatePolicyTemplateOptions createPolicyTemplateOptionsModel = new CreatePolicyTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .policy(templatePolicyModel) + .description("testString") + .committed(true) + .acceptLanguage("default") + .build(); + + // Invoke createPolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.createPolicyTemplate(createPolicyTemplateOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateLimitData 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createPolicyTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createPolicyTemplate operation with and without retries enabled + @Test + public void testCreatePolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreatePolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreatePolicyTemplateWOptions(); + } + + // Test the createPolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createPolicyTemplate(null).execute(); + } + + // Test the getPolicyTemplate operation with a valid options model parameter + @Test + public void testGetPolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String getPolicyTemplatePath = "/v1/policy_templates/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetPolicyTemplateOptions model + GetPolicyTemplateOptions getPolicyTemplateOptionsModel = new GetPolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .state("active") + .build(); + + // Invoke getPolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.getPolicyTemplate(getPolicyTemplateOptionsModel).execute(); + assertNotNull(response); + PolicyTemplate 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, getPolicyTemplatePath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + } + + // Test the getPolicyTemplate operation with and without retries enabled + @Test + public void testGetPolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetPolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetPolicyTemplateWOptions(); + } + + // Test the getPolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getPolicyTemplate(null).execute(); + } + + // Test the deletePolicyTemplate operation with a valid options model parameter + @Test + public void testDeletePolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deletePolicyTemplatePath = "/v1/policy_templates/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeletePolicyTemplateOptions model + DeletePolicyTemplateOptions deletePolicyTemplateOptionsModel = new DeletePolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .build(); + + // Invoke deletePolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.deletePolicyTemplate(deletePolicyTemplateOptionsModel).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, deletePolicyTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deletePolicyTemplate operation with and without retries enabled + @Test + public void testDeletePolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeletePolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeletePolicyTemplateWOptions(); + } + + // Test the deletePolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deletePolicyTemplate(null).execute(); + } + + // Test the createPolicyTemplateVersion operation with a valid options model parameter + @Test + public void testCreatePolicyTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; + String createPolicyTemplateVersionPath = "/v1/policy_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the TemplateGrantRoles model + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the TemplateControl model + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + + // Construct an instance of the TemplatePolicy model + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + + // Construct an instance of the CreatePolicyTemplateVersionOptions model + CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptionsModel = new CreatePolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .policy(templatePolicyModel) + .name("testString") + .description("testString") + .committed(true) + .build(); + + // Invoke createPolicyTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.createPolicyTemplateVersion(createPolicyTemplateVersionOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateLimitData 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createPolicyTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createPolicyTemplateVersion operation with and without retries enabled + @Test + public void testCreatePolicyTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreatePolicyTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreatePolicyTemplateVersionWOptions(); + } + + // Test the createPolicyTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createPolicyTemplateVersion(null).execute(); + } + + // Test the listPolicyTemplateVersions operation with a valid options model parameter + @Test + public void testListPolicyTemplateVersionsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; + String listPolicyTemplateVersionsPath = "/v1/policy_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListPolicyTemplateVersionsOptions model + ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptionsModel = new ListPolicyTemplateVersionsOptions.Builder() + .policyTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listPolicyTemplateVersions() with a valid options model and verify the result + Response response = iamPolicyManagementService.listPolicyTemplateVersions(listPolicyTemplateVersionsOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateVersionsCollection 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, listPolicyTemplateVersionsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listPolicyTemplateVersions operation with and without retries enabled + @Test + public void testListPolicyTemplateVersionsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListPolicyTemplateVersionsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListPolicyTemplateVersionsWOptions(); + } + + // Test the listPolicyTemplateVersions operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyTemplateVersionsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listPolicyTemplateVersions(null).execute(); + } + + // Test the listPolicyTemplateVersions operation using the PolicyTemplateVersionsPager.getNext() method + @Test + public void testListPolicyTemplateVersionsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions = new ListPolicyTemplateVersionsOptions.Builder() + .policyTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + PolicyTemplateVersionsPager pager = new PolicyTemplateVersionsPager(iamPolicyManagementService, listPolicyTemplateVersionsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listPolicyTemplateVersions operation using the PolicyTemplateVersionsPager.getAll() method + @Test + public void testListPolicyTemplateVersionsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions = new ListPolicyTemplateVersionsOptions.Builder() + .policyTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + PolicyTemplateVersionsPager pager = new PolicyTemplateVersionsPager(iamPolicyManagementService, listPolicyTemplateVersionsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the replacePolicyTemplate operation with a valid options model parameter + @Test + public void testReplacePolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String replacePolicyTemplatePath = "/v1/policy_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the V2PolicyResourceAttribute model + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicyResourceTag model + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + + // Construct an instance of the V2PolicyResource model + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + + // Construct an instance of the V2PolicySubjectAttribute model + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the V2PolicySubject model + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + + // Construct an instance of the V2PolicyRuleRuleAttribute model + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + + // Construct an instance of the Roles model + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + + // Construct an instance of the TemplateGrantRoles model + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + + // Construct an instance of the TemplateControl model + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + + // Construct an instance of the TemplatePolicy model + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + + // Construct an instance of the ReplacePolicyTemplateOptions model + ReplacePolicyTemplateOptions replacePolicyTemplateOptionsModel = new ReplacePolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .ifMatch("testString") + .policy(templatePolicyModel) + .name("testString") + .description("testString") + .committed(true) + .build(); + + // Invoke replacePolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.replacePolicyTemplate(replacePolicyTemplateOptionsModel).execute(); + assertNotNull(response); + PolicyTemplate 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, replacePolicyTemplatePath); + // 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 replacePolicyTemplate operation with and without retries enabled + @Test + public void testReplacePolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplacePolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplacePolicyTemplateWOptions(); + } + + // Test the replacePolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplacePolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replacePolicyTemplate(null).execute(); + } + + // Test the deletePolicyTemplateVersion operation with a valid options model parameter + @Test + public void testDeletePolicyTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deletePolicyTemplateVersionPath = "/v1/policy_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeletePolicyTemplateVersionOptions model + DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptionsModel = new DeletePolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + + // Invoke deletePolicyTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.deletePolicyTemplateVersion(deletePolicyTemplateVersionOptionsModel).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, deletePolicyTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deletePolicyTemplateVersion operation with and without retries enabled + @Test + public void testDeletePolicyTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeletePolicyTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeletePolicyTemplateVersionWOptions(); + } + + // Test the deletePolicyTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deletePolicyTemplateVersion(null).execute(); + } + + // Test the getPolicyTemplateVersion operation with a valid options model parameter + @Test + public void testGetPolicyTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; + String getPolicyTemplateVersionPath = "/v1/policy_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetPolicyTemplateVersionOptions model + GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptionsModel = new GetPolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + + // Invoke getPolicyTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.getPolicyTemplateVersion(getPolicyTemplateVersionOptionsModel).execute(); + assertNotNull(response); + PolicyTemplate 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, getPolicyTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getPolicyTemplateVersion operation with and without retries enabled + @Test + public void testGetPolicyTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetPolicyTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetPolicyTemplateVersionWOptions(); + } + + // Test the getPolicyTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getPolicyTemplateVersion(null).execute(); + } + + // Test the commitPolicyTemplate operation with a valid options model parameter + @Test + public void testCommitPolicyTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String commitPolicyTemplatePath = "/v1/policy_templates/testString/versions/testString/commit"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the CommitPolicyTemplateOptions model + CommitPolicyTemplateOptions commitPolicyTemplateOptionsModel = new CommitPolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + + // Invoke commitPolicyTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.commitPolicyTemplate(commitPolicyTemplateOptionsModel).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, commitPolicyTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the commitPolicyTemplate operation with and without retries enabled + @Test + public void testCommitPolicyTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCommitPolicyTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCommitPolicyTemplateWOptions(); + } + + // Test the commitPolicyTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitPolicyTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.commitPolicyTemplate(null).execute(); + } + + // Test the listPolicyAssignments operation with a valid options model parameter + @Test + public void testListPolicyAssignmentsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}]}"; + String listPolicyAssignmentsPath = "/v1/policy_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListPolicyAssignmentsOptions model + ListPolicyAssignmentsOptions listPolicyAssignmentsOptionsModel = new ListPolicyAssignmentsOptions.Builder() + .version("1.0") + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listPolicyAssignments() with a valid options model and verify the result + Response response = iamPolicyManagementService.listPolicyAssignments(listPolicyAssignmentsOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateAssignmentCollection 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, listPolicyAssignmentsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "1.0"); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("template_id"), "testString"); + assertEquals(query.get("template_version"), "testString"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listPolicyAssignments operation with and without retries enabled + @Test + public void testListPolicyAssignmentsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListPolicyAssignmentsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListPolicyAssignmentsWOptions(); + } + + // Test the listPolicyAssignments operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyAssignmentsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listPolicyAssignments(null).execute(); + } + + // Test the listPolicyAssignments operation using the PolicyAssignmentsPager.getNext() method + @Test + public void testListPolicyAssignmentsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyAssignmentsOptions listPolicyAssignmentsOptions = new ListPolicyAssignmentsOptions.Builder() + .version("1.0") + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + PolicyAssignmentsPager pager = new PolicyAssignmentsPager(iamPolicyManagementService, listPolicyAssignmentsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listPolicyAssignments operation using the PolicyAssignmentsPager.getAll() method + @Test + public void testListPolicyAssignmentsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListPolicyAssignmentsOptions listPolicyAssignmentsOptions = new ListPolicyAssignmentsOptions.Builder() + .version("1.0") + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + PolicyAssignmentsPager pager = new PolicyAssignmentsPager(iamPolicyManagementService, listPolicyAssignmentsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createPolicyTemplateAssignment operation with a valid options model parameter + @Test + public void testCreatePolicyTemplateAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}]}"; + String createPolicyTemplateAssignmentPath = "/v1/policy_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the AssignmentTargetDetails model + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + + // Construct an instance of the AssignmentTemplateDetails model + AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() + .id("testString") + .version("testString") + .build(); + + // Construct an instance of the CreatePolicyTemplateAssignmentOptions model + CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptionsModel = new CreatePolicyTemplateAssignmentOptions.Builder() + .version("1.0") + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(assignmentTemplateDetailsModel)) + .acceptLanguage("default") + .build(); + + // Invoke createPolicyTemplateAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.createPolicyTemplateAssignment(createPolicyTemplateAssignmentOptionsModel).execute(); + assertNotNull(response); + PolicyAssignmentV1Collection 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createPolicyTemplateAssignmentPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "1.0"); + } + + // Test the createPolicyTemplateAssignment operation with and without retries enabled + @Test + public void testCreatePolicyTemplateAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreatePolicyTemplateAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreatePolicyTemplateAssignmentWOptions(); + } + + // Test the createPolicyTemplateAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createPolicyTemplateAssignment(null).execute(); + } + + // Test the getPolicyAssignment operation with a valid options model parameter + @Test + public void testGetPolicyAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}"; + String getPolicyAssignmentPath = "/v1/policy_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetPolicyAssignmentOptions model + GetPolicyAssignmentOptions getPolicyAssignmentOptionsModel = new GetPolicyAssignmentOptions.Builder() + .assignmentId("testString") + .version("1.0") + .build(); + + // Invoke getPolicyAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.getPolicyAssignment(getPolicyAssignmentOptionsModel).execute(); + assertNotNull(response); + PolicyTemplateAssignmentItems 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, getPolicyAssignmentPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "1.0"); + } + + // Test the getPolicyAssignment operation with and without retries enabled + @Test + public void testGetPolicyAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetPolicyAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetPolicyAssignmentWOptions(); + } + + // Test the getPolicyAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getPolicyAssignment(null).execute(); + } + + // Test the updatePolicyAssignment operation with a valid options model parameter + @Test + public void testUpdatePolicyAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}"; + String updatePolicyAssignmentPath = "/v1/policy_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdatePolicyAssignmentOptions model + UpdatePolicyAssignmentOptions updatePolicyAssignmentOptionsModel = new UpdatePolicyAssignmentOptions.Builder() + .assignmentId("testString") + .version("1.0") + .ifMatch("testString") + .templateVersion("testString") + .build(); + + // Invoke updatePolicyAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.updatePolicyAssignment(updatePolicyAssignmentOptionsModel).execute(); + assertNotNull(response); + PolicyAssignmentV1 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updatePolicyAssignmentPath); + // Verify header parameters + assertEquals(request.getHeader("If-Match"), "testString"); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "1.0"); + } + + // Test the updatePolicyAssignment operation with and without retries enabled + @Test + public void testUpdatePolicyAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdatePolicyAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdatePolicyAssignmentWOptions(); + } + + // Test the updatePolicyAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdatePolicyAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updatePolicyAssignment(null).execute(); + } + + // Test the deletePolicyAssignment operation with a valid options model parameter + @Test + public void testDeletePolicyAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deletePolicyAssignmentPath = "/v1/policy_assignments/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeletePolicyAssignmentOptions model + DeletePolicyAssignmentOptions deletePolicyAssignmentOptionsModel = new DeletePolicyAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke deletePolicyAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.deletePolicyAssignment(deletePolicyAssignmentOptionsModel).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, deletePolicyAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deletePolicyAssignment operation with and without retries enabled + @Test + public void testDeletePolicyAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeletePolicyAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeletePolicyAssignmentWOptions(); + } + + // Test the deletePolicyAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deletePolicyAssignment(null).execute(); + } + + // Test the getSettings operation with a valid options model parameter + @Test + public void testGetSettingsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"external_account_identity_interaction\": {\"identity_types\": {\"user\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service_id\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}}}}"; + String getSettingsPath = "/v1/accounts/testString/settings/access_management"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetSettingsOptions model + GetSettingsOptions getSettingsOptionsModel = new GetSettingsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .build(); + + // Invoke getSettings() with a valid options model and verify the result + Response response = iamPolicyManagementService.getSettings(getSettingsOptionsModel).execute(); + assertNotNull(response); + AccountSettingsAccessManagement 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, getSettingsPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getSettings operation with and without retries enabled + @Test + public void testGetSettingsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetSettingsWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetSettingsWOptions(); + } + + // Test the getSettings operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetSettingsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getSettings(null).execute(); + } + + // Test the updateSettings operation with a valid options model parameter + @Test + public void testUpdateSettingsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"external_account_identity_interaction\": {\"identity_types\": {\"user\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service_id\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}}}}"; + String updateSettingsPath = "/v1/accounts/testString/settings/access_management"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the IdentityTypesBase model + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the IdentityTypesPatch model + IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() + .user(identityTypesBaseModel) + .serviceId(identityTypesBaseModel) + .service(identityTypesBaseModel) + .build(); + + // Construct an instance of the ExternalAccountIdentityInteractionPatch model + ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() + .identityTypes(identityTypesPatchModel) + .build(); + + // Construct an instance of the UpdateSettingsOptions model + UpdateSettingsOptions updateSettingsOptionsModel = new UpdateSettingsOptions.Builder() + .accountId("testString") + .ifMatch("testString") + .externalAccountIdentityInteraction(externalAccountIdentityInteractionPatchModel) + .acceptLanguage("default") + .build(); + + // Invoke updateSettings() with a valid options model and verify the result + Response response = iamPolicyManagementService.updateSettings(updateSettingsOptionsModel).execute(); + assertNotNull(response); + AccountSettingsAccessManagement 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updateSettingsPath); + // 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 updateSettings operation with and without retries enabled + @Test + public void testUpdateSettingsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdateSettingsWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdateSettingsWOptions(); + } + + // Test the updateSettings operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateSettingsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updateSettings(null).execute(); + } + + // Test the listActionControlTemplates operation with a valid options model parameter + @Test + public void testListActionControlTemplatesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"action_control_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; + String listActionControlTemplatesPath = "/v1/action_control_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListActionControlTemplatesOptions model + ListActionControlTemplatesOptions listActionControlTemplatesOptionsModel = new ListActionControlTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listActionControlTemplates() with a valid options model and verify the result + Response response = iamPolicyManagementService.listActionControlTemplates(listActionControlTemplatesOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplateCollection 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, listActionControlTemplatesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listActionControlTemplates operation with and without retries enabled + @Test + public void testListActionControlTemplatesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListActionControlTemplatesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListActionControlTemplatesWOptions(); + } + + // Test the listActionControlTemplates operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlTemplatesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listActionControlTemplates(null).execute(); + } + + // Test the listActionControlTemplates operation using the ActionControlTemplatesPager.getNext() method + @Test + public void testListActionControlTemplatesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlTemplatesOptions listActionControlTemplatesOptions = new ListActionControlTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + ActionControlTemplatesPager pager = new ActionControlTemplatesPager(iamPolicyManagementService, listActionControlTemplatesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listActionControlTemplates operation using the ActionControlTemplatesPager.getAll() method + @Test + public void testListActionControlTemplatesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlTemplatesOptions listActionControlTemplatesOptions = new ListActionControlTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .limit(Long.valueOf("10")) + .build(); + + ActionControlTemplatesPager pager = new ActionControlTemplatesPager(iamPolicyManagementService, listActionControlTemplatesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createActionControlTemplate operation with a valid options model parameter + @Test + public void testCreateActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String createActionControlTemplatePath = "/v1/action_control_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateActionControl model + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the CreateActionControlTemplateOptions model + CreateActionControlTemplateOptions createActionControlTemplateOptionsModel = new CreateActionControlTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .description("testString") + .committed(true) + .actionControl(templateActionControlModel) + .acceptLanguage("default") + .build(); + + // Invoke createActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.createActionControlTemplate(createActionControlTemplateOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createActionControlTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createActionControlTemplate operation with and without retries enabled + @Test + public void testCreateActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateActionControlTemplateWOptions(); + } + + // Test the createActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createActionControlTemplate(null).execute(); + } + + // Test the getActionControlTemplate operation with a valid options model parameter + @Test + public void testGetActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String getActionControlTemplatePath = "/v1/action_control_templates/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetActionControlTemplateOptions model + GetActionControlTemplateOptions getActionControlTemplateOptionsModel = new GetActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .build(); + + // Invoke getActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.getActionControlTemplate(getActionControlTemplateOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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, getActionControlTemplatePath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + } + + // Test the getActionControlTemplate operation with and without retries enabled + @Test + public void testGetActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetActionControlTemplateWOptions(); + } + + // Test the getActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getActionControlTemplate(null).execute(); + } + + // Test the deleteActionControlTemplate operation with a valid options model parameter + @Test + public void testDeleteActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteActionControlTemplatePath = "/v1/action_control_templates/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteActionControlTemplateOptions model + DeleteActionControlTemplateOptions deleteActionControlTemplateOptionsModel = new DeleteActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .build(); + + // Invoke deleteActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteActionControlTemplate(deleteActionControlTemplateOptionsModel).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, deleteActionControlTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteActionControlTemplate operation with and without retries enabled + @Test + public void testDeleteActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteActionControlTemplateWOptions(); + } + + // Test the deleteActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteActionControlTemplate(null).execute(); + } + + // Test the createActionControlTemplateVersion operation with a valid options model parameter + @Test + public void testCreateActionControlTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String createActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateActionControl model + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the CreateActionControlTemplateVersionOptions model + CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptionsModel = new CreateActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .name("testString") + .description("testString") + .actionControl(templateActionControlModel) + .committed(true) + .build(); + + // Invoke createActionControlTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.createActionControlTemplateVersion(createActionControlTemplateVersionOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createActionControlTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createActionControlTemplateVersion operation with and without retries enabled + @Test + public void testCreateActionControlTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateActionControlTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateActionControlTemplateVersionWOptions(); + } + + // Test the createActionControlTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createActionControlTemplateVersion(null).execute(); + } + + // Test the listActionControlTemplateVersions operation with a valid options model parameter + @Test + public void testListActionControlTemplateVersionsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; + String listActionControlTemplateVersionsPath = "/v1/action_control_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListActionControlTemplateVersionsOptions model + ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptionsModel = new ListActionControlTemplateVersionsOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listActionControlTemplateVersions() with a valid options model and verify the result + Response response = iamPolicyManagementService.listActionControlTemplateVersions(listActionControlTemplateVersionsOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplateVersionsCollection 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, listActionControlTemplateVersionsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listActionControlTemplateVersions operation with and without retries enabled + @Test + public void testListActionControlTemplateVersionsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListActionControlTemplateVersionsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListActionControlTemplateVersionsWOptions(); + } + + // Test the listActionControlTemplateVersions operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlTemplateVersionsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listActionControlTemplateVersions(null).execute(); + } + + // Test the listActionControlTemplateVersions operation using the ActionControlTemplateVersionsPager.getNext() method + @Test + public void testListActionControlTemplateVersionsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions = new ListActionControlTemplateVersionsOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + ActionControlTemplateVersionsPager pager = new ActionControlTemplateVersionsPager(iamPolicyManagementService, listActionControlTemplateVersionsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listActionControlTemplateVersions operation using the ActionControlTemplateVersionsPager.getAll() method + @Test + public void testListActionControlTemplateVersionsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions = new ListActionControlTemplateVersionsOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + ActionControlTemplateVersionsPager pager = new ActionControlTemplateVersionsPager(iamPolicyManagementService, listActionControlTemplateVersionsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the replaceActionControlTemplate operation with a valid options model parameter + @Test + public void testReplaceActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String replaceActionControlTemplatePath = "/v1/action_control_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateActionControl model + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the ReplaceActionControlTemplateOptions model + ReplaceActionControlTemplateOptions replaceActionControlTemplateOptionsModel = new ReplaceActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .actionControl(templateActionControlModel) + .committed(true) + .build(); + + // Invoke replaceActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.replaceActionControlTemplate(replaceActionControlTemplateOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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, replaceActionControlTemplatePath); + // 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 replaceActionControlTemplate operation with and without retries enabled + @Test + public void testReplaceActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplaceActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplaceActionControlTemplateWOptions(); + } + + // Test the replaceActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replaceActionControlTemplate(null).execute(); + } + + // Test the deleteActionControlTemplateVersion operation with a valid options model parameter + @Test + public void testDeleteActionControlTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteActionControlTemplateVersionOptions model + DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptionsModel = new DeleteActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + + // Invoke deleteActionControlTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteActionControlTemplateVersion(deleteActionControlTemplateVersionOptionsModel).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, deleteActionControlTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteActionControlTemplateVersion operation with and without retries enabled + @Test + public void testDeleteActionControlTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteActionControlTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteActionControlTemplateVersionWOptions(); + } + + // Test the deleteActionControlTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteActionControlTemplateVersion(null).execute(); + } + + // Test the getActionControlTemplateVersion operation with a valid options model parameter + @Test + public void testGetActionControlTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String getActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetActionControlTemplateVersionOptions model + GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptionsModel = new GetActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + + // Invoke getActionControlTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.getActionControlTemplateVersion(getActionControlTemplateVersionOptionsModel).execute(); + assertNotNull(response); + ActionControlTemplate 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, getActionControlTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getActionControlTemplateVersion operation with and without retries enabled + @Test + public void testGetActionControlTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetActionControlTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetActionControlTemplateVersionWOptions(); + } + + // Test the getActionControlTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getActionControlTemplateVersion(null).execute(); + } + + // Test the commitActionControlTemplate operation with a valid options model parameter + @Test + public void testCommitActionControlTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String commitActionControlTemplatePath = "/v1/action_control_templates/testString/versions/testString/commit"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the CommitActionControlTemplateOptions model + CommitActionControlTemplateOptions commitActionControlTemplateOptionsModel = new CommitActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + + // Invoke commitActionControlTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.commitActionControlTemplate(commitActionControlTemplateOptionsModel).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, commitActionControlTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the commitActionControlTemplate operation with and without retries enabled + @Test + public void testCommitActionControlTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCommitActionControlTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCommitActionControlTemplateWOptions(); + } + + // Test the commitActionControlTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitActionControlTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.commitActionControlTemplate(null).execute(); + } + + // Test the listActionControlAssignments operation with a valid options model parameter + @Test + public void testListActionControlAssignmentsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; + String listActionControlAssignmentsPath = "/v1/action_control_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListActionControlAssignmentsOptions model + ListActionControlAssignmentsOptions listActionControlAssignmentsOptionsModel = new ListActionControlAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listActionControlAssignments() with a valid options model and verify the result + Response response = iamPolicyManagementService.listActionControlAssignments(listActionControlAssignmentsOptionsModel).execute(); + assertNotNull(response); + ActionControlAssignmentCollection 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, listActionControlAssignmentsPath); + // 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(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listActionControlAssignments operation with and without retries enabled + @Test + public void testListActionControlAssignmentsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListActionControlAssignmentsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListActionControlAssignmentsWOptions(); + } + + // Test the listActionControlAssignments operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlAssignmentsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listActionControlAssignments(null).execute(); + } + + // Test the listActionControlAssignments operation using the ActionControlAssignmentsPager.getNext() method + @Test + public void testListActionControlAssignmentsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlAssignmentsOptions listActionControlAssignmentsOptions = new ListActionControlAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + ActionControlAssignmentsPager pager = new ActionControlAssignmentsPager(iamPolicyManagementService, listActionControlAssignmentsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listActionControlAssignments operation using the ActionControlAssignmentsPager.getAll() method + @Test + public void testListActionControlAssignmentsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListActionControlAssignmentsOptions listActionControlAssignmentsOptions = new ListActionControlAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + ActionControlAssignmentsPager pager = new ActionControlAssignmentsPager(iamPolicyManagementService, listActionControlAssignmentsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createActionControlTemplateAssignment operation with a valid options model parameter + @Test + public void testCreateActionControlTemplateAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; + String createActionControlTemplateAssignmentPath = "/v1/action_control_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the AssignmentTargetDetails model + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + + // Construct an instance of the ActionControlAssignmentTemplate model + ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + + // Construct an instance of the CreateActionControlTemplateAssignmentOptions model + CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptionsModel = new CreateActionControlTemplateAssignmentOptions.Builder() + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(actionControlAssignmentTemplateModel)) + .acceptLanguage("default") + .build(); + + // Invoke createActionControlTemplateAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.createActionControlTemplateAssignment(createActionControlTemplateAssignmentOptionsModel).execute(); + assertNotNull(response); + ActionControlAssignmentCollection 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createActionControlTemplateAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createActionControlTemplateAssignment operation with and without retries enabled + @Test + public void testCreateActionControlTemplateAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateActionControlTemplateAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateActionControlTemplateAssignmentWOptions(); + } + + // Test the createActionControlTemplateAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createActionControlTemplateAssignment(null).execute(); + } + + // Test the getActionControlAssignment operation with a valid options model parameter + @Test + public void testGetActionControlAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; + String getActionControlAssignmentPath = "/v1/action_control_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetActionControlAssignmentOptions model + GetActionControlAssignmentOptions getActionControlAssignmentOptionsModel = new GetActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke getActionControlAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.getActionControlAssignment(getActionControlAssignmentOptionsModel).execute(); + assertNotNull(response); + ActionControlAssignment 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, getActionControlAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getActionControlAssignment operation with and without retries enabled + @Test + public void testGetActionControlAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetActionControlAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetActionControlAssignmentWOptions(); + } + + // Test the getActionControlAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getActionControlAssignment(null).execute(); + } + + // Test the updateActionControlAssignment operation with a valid options model parameter + @Test + public void testUpdateActionControlAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; + String updateActionControlAssignmentPath = "/v1/action_control_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdateActionControlAssignmentOptions model + UpdateActionControlAssignmentOptions updateActionControlAssignmentOptionsModel = new UpdateActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .ifMatch("testString") + .templateVersion("testString") + .build(); + + // Invoke updateActionControlAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.updateActionControlAssignment(updateActionControlAssignmentOptionsModel).execute(); + assertNotNull(response); + ActionControlAssignment 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updateActionControlAssignmentPath); + // 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 updateActionControlAssignment operation with and without retries enabled + @Test + public void testUpdateActionControlAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdateActionControlAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdateActionControlAssignmentWOptions(); + } + + // Test the updateActionControlAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateActionControlAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updateActionControlAssignment(null).execute(); + } + + // Test the deleteActionControlAssignment operation with a valid options model parameter + @Test + public void testDeleteActionControlAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteActionControlAssignmentPath = "/v1/action_control_assignments/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteActionControlAssignmentOptions model + DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptionsModel = new DeleteActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke deleteActionControlAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteActionControlAssignment(deleteActionControlAssignmentOptionsModel).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, deleteActionControlAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteActionControlAssignment operation with and without retries enabled + @Test + public void testDeleteActionControlAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteActionControlAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteActionControlAssignmentWOptions(); + } + + // Test the deleteActionControlAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteActionControlAssignment(null).execute(); + } + + // Test the listRoleTemplates operation with a valid options model parameter + @Test + public void testListRoleTemplatesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"role_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; + String listRoleTemplatesPath = "/v1/role_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListRoleTemplatesOptions model + ListRoleTemplatesOptions listRoleTemplatesOptionsModel = new ListRoleTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .name("testString") + .roleName("testString") + .roleServiceName("testString") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listRoleTemplates() with a valid options model and verify the result + Response response = iamPolicyManagementService.listRoleTemplates(listRoleTemplatesOptionsModel).execute(); + assertNotNull(response); + RoleTemplateCollection 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, listRoleTemplatesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("name"), "testString"); + assertEquals(query.get("role_name"), "testString"); + assertEquals(query.get("role_service_name"), "testString"); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listRoleTemplates operation with and without retries enabled + @Test + public void testListRoleTemplatesWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListRoleTemplatesWOptions(); + + iamPolicyManagementService.disableRetries(); + testListRoleTemplatesWOptions(); + } + + // Test the listRoleTemplates operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleTemplatesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listRoleTemplates(null).execute(); + } + + // Test the listRoleTemplates operation using the RoleTemplatesPager.getNext() method + @Test + public void testListRoleTemplatesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleTemplatesOptions listRoleTemplatesOptions = new ListRoleTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .name("testString") + .roleName("testString") + .roleServiceName("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + RoleTemplatesPager pager = new RoleTemplatesPager(iamPolicyManagementService, listRoleTemplatesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listRoleTemplates operation using the RoleTemplatesPager.getAll() method + @Test + public void testListRoleTemplatesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleTemplatesOptions listRoleTemplatesOptions = new ListRoleTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .name("testString") + .roleName("testString") + .roleServiceName("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + RoleTemplatesPager pager = new RoleTemplatesPager(iamPolicyManagementService, listRoleTemplatesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createRoleTemplate operation with a valid options model parameter + @Test + public void testCreateRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String createRoleTemplatePath = "/v1/role_templates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the RoleTemplatePrototypeRole model + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() + .name("testString") + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the CreateRoleTemplateOptions model + CreateRoleTemplateOptions createRoleTemplateOptionsModel = new CreateRoleTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .description("testString") + .committed(true) + .role(roleTemplatePrototypeRoleModel) + .acceptLanguage("default") + .build(); + + // Invoke createRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.createRoleTemplate(createRoleTemplateOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createRoleTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createRoleTemplate operation with and without retries enabled + @Test + public void testCreateRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateRoleTemplateWOptions(); + } + + // Test the createRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createRoleTemplate(null).execute(); + } + + // Test the getRoleTemplate operation with a valid options model parameter + @Test + public void testGetRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String getRoleTemplatePath = "/v1/role_templates/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetRoleTemplateOptions model + GetRoleTemplateOptions getRoleTemplateOptionsModel = new GetRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .state("active") + .build(); + + // Invoke getRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.getRoleTemplate(getRoleTemplateOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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, getRoleTemplatePath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + } + + // Test the getRoleTemplate operation with and without retries enabled + @Test + public void testGetRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetRoleTemplateWOptions(); + } + + // Test the getRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getRoleTemplate(null).execute(); + } + + // Test the deleteRoleTemplate operation with a valid options model parameter + @Test + public void testDeleteRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteRoleTemplatePath = "/v1/role_templates/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteRoleTemplateOptions model + DeleteRoleTemplateOptions deleteRoleTemplateOptionsModel = new DeleteRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .build(); + + // Invoke deleteRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteRoleTemplate(deleteRoleTemplateOptionsModel).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, deleteRoleTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteRoleTemplate operation with and without retries enabled + @Test + public void testDeleteRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteRoleTemplateWOptions(); + } + + // Test the deleteRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteRoleTemplate(null).execute(); + } + + // Test the createRoleTemplateVersion operation with a valid options model parameter + @Test + public void testCreateRoleTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String createRoleTemplateVersionPath = "/v1/role_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateRole model + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the CreateRoleTemplateVersionOptions model + CreateRoleTemplateVersionOptions createRoleTemplateVersionOptionsModel = new CreateRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .name("testString") + .description("testString") + .role(templateRoleModel) + .committed(true) + .build(); + + // Invoke createRoleTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.createRoleTemplateVersion(createRoleTemplateVersionOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createRoleTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createRoleTemplateVersion operation with and without retries enabled + @Test + public void testCreateRoleTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateRoleTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateRoleTemplateVersionWOptions(); + } + + // Test the createRoleTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createRoleTemplateVersion(null).execute(); + } + + // Test the listRoleTemplateVersions operation with a valid options model parameter + @Test + public void testListRoleTemplateVersionsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; + String listRoleTemplateVersionsPath = "/v1/role_templates/testString/versions"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListRoleTemplateVersionsOptions model + ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptionsModel = new ListRoleTemplateVersionsOptions.Builder() + .roleTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listRoleTemplateVersions() with a valid options model and verify the result + Response response = iamPolicyManagementService.listRoleTemplateVersions(listRoleTemplateVersionsOptionsModel).execute(); + assertNotNull(response); + RoleTemplateVersionsCollection 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, listRoleTemplateVersionsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("state"), "active"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listRoleTemplateVersions operation with and without retries enabled + @Test + public void testListRoleTemplateVersionsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListRoleTemplateVersionsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListRoleTemplateVersionsWOptions(); + } + + // Test the listRoleTemplateVersions operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleTemplateVersionsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listRoleTemplateVersions(null).execute(); + } + + // Test the listRoleTemplateVersions operation using the RoleTemplateVersionsPager.getNext() method + @Test + public void testListRoleTemplateVersionsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions = new ListRoleTemplateVersionsOptions.Builder() + .roleTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + RoleTemplateVersionsPager pager = new RoleTemplateVersionsPager(iamPolicyManagementService, listRoleTemplateVersionsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listRoleTemplateVersions operation using the RoleTemplateVersionsPager.getAll() method + @Test + public void testListRoleTemplateVersionsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions = new ListRoleTemplateVersionsOptions.Builder() + .roleTemplateId("testString") + .state("active") + .limit(Long.valueOf("10")) + .build(); + + RoleTemplateVersionsPager pager = new RoleTemplateVersionsPager(iamPolicyManagementService, listRoleTemplateVersionsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the replaceRoleTemplate operation with a valid options model parameter + @Test + public void testReplaceRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String replaceRoleTemplatePath = "/v1/role_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the TemplateRole model + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the ReplaceRoleTemplateOptions model + ReplaceRoleTemplateOptions replaceRoleTemplateOptionsModel = new ReplaceRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .role(templateRoleModel) + .committed(true) + .build(); + + // Invoke replaceRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.replaceRoleTemplate(replaceRoleTemplateOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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, replaceRoleTemplatePath); + // 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 replaceRoleTemplate operation with and without retries enabled + @Test + public void testReplaceRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testReplaceRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testReplaceRoleTemplateWOptions(); + } + + // Test the replaceRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.replaceRoleTemplate(null).execute(); + } + + // Test the deleteRoleTemplateVersion operation with a valid options model parameter + @Test + public void testDeleteRoleTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteRoleTemplateVersionPath = "/v1/role_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteRoleTemplateVersionOptions model + DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptionsModel = new DeleteRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + + // Invoke deleteRoleTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteRoleTemplateVersion(deleteRoleTemplateVersionOptionsModel).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, deleteRoleTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteRoleTemplateVersion operation with and without retries enabled + @Test + public void testDeleteRoleTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteRoleTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteRoleTemplateVersionWOptions(); + } + + // Test the deleteRoleTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteRoleTemplateVersion(null).execute(); + } + + // Test the getRoleTemplateVersion operation with a valid options model parameter + @Test + public void testGetRoleTemplateVersionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; + String getRoleTemplateVersionPath = "/v1/role_templates/testString/versions/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetRoleTemplateVersionOptions model + GetRoleTemplateVersionOptions getRoleTemplateVersionOptionsModel = new GetRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + + // Invoke getRoleTemplateVersion() with a valid options model and verify the result + Response response = iamPolicyManagementService.getRoleTemplateVersion(getRoleTemplateVersionOptionsModel).execute(); + assertNotNull(response); + RoleTemplate 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, getRoleTemplateVersionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getRoleTemplateVersion operation with and without retries enabled + @Test + public void testGetRoleTemplateVersionWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetRoleTemplateVersionWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetRoleTemplateVersionWOptions(); + } + + // Test the getRoleTemplateVersion operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleTemplateVersionNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getRoleTemplateVersion(null).execute(); + } + + // Test the commitRoleTemplate operation with a valid options model parameter + @Test + public void testCommitRoleTemplateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String commitRoleTemplatePath = "/v1/role_templates/testString/versions/testString/commit"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the CommitRoleTemplateOptions model + CommitRoleTemplateOptions commitRoleTemplateOptionsModel = new CommitRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + + // Invoke commitRoleTemplate() with a valid options model and verify the result + Response response = iamPolicyManagementService.commitRoleTemplate(commitRoleTemplateOptionsModel).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, commitRoleTemplatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the commitRoleTemplate operation with and without retries enabled + @Test + public void testCommitRoleTemplateWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCommitRoleTemplateWOptions(); + + iamPolicyManagementService.disableRetries(); + testCommitRoleTemplateWOptions(); + } + + // Test the commitRoleTemplate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitRoleTemplateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.commitRoleTemplate(null).execute(); + } + + // Test the listRoleAssignments operation with a valid options model parameter + @Test + public void testListRoleAssignmentsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; + String listRoleAssignmentsPath = "/v1/role_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListRoleAssignmentsOptions model + ListRoleAssignmentsOptions listRoleAssignmentsOptionsModel = new ListRoleAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listRoleAssignments() with a valid options model and verify the result + Response response = iamPolicyManagementService.listRoleAssignments(listRoleAssignmentsOptionsModel).execute(); + assertNotNull(response); + RoleAssignmentCollection 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, listRoleAssignmentsPath); + // 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(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listRoleAssignments operation with and without retries enabled + @Test + public void testListRoleAssignmentsWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testListRoleAssignmentsWOptions(); + + iamPolicyManagementService.disableRetries(); + testListRoleAssignmentsWOptions(); + } + + // Test the listRoleAssignments operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleAssignmentsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.listRoleAssignments(null).execute(); + } + + // Test the listRoleAssignments operation using the RoleAssignmentsPager.getNext() method + @Test + public void testListRoleAssignmentsWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleAssignmentsOptions listRoleAssignmentsOptions = new ListRoleAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + RoleAssignmentsPager pager = new RoleAssignmentsPager(iamPolicyManagementService, listRoleAssignmentsOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listRoleAssignments operation using the RoleAssignmentsPager.getAll() method + @Test + public void testListRoleAssignmentsWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRoleAssignmentsOptions listRoleAssignmentsOptions = new ListRoleAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("10")) + .build(); + + RoleAssignmentsPager pager = new RoleAssignmentsPager(iamPolicyManagementService, listRoleAssignmentsOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createRoleTemplateAssignment operation with a valid options model parameter + @Test + public void testCreateRoleTemplateAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; + String createRoleTemplateAssignmentPath = "/v1/role_assignments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the AssignmentTargetDetails model + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + + // Construct an instance of the RoleAssignmentTemplate model + RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + + // Construct an instance of the CreateRoleTemplateAssignmentOptions model + CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptionsModel = new CreateRoleTemplateAssignmentOptions.Builder() + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(roleAssignmentTemplateModel)) + .acceptLanguage("default") + .build(); + + // Invoke createRoleTemplateAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.createRoleTemplateAssignment(createRoleTemplateAssignmentOptionsModel).execute(); + assertNotNull(response); + RoleAssignmentCollection 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createRoleTemplateAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createRoleTemplateAssignment operation with and without retries enabled + @Test + public void testCreateRoleTemplateAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testCreateRoleTemplateAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testCreateRoleTemplateAssignmentWOptions(); + } + + // Test the createRoleTemplateAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.createRoleTemplateAssignment(null).execute(); + } + + // Test the getRoleAssignment operation with a valid options model parameter + @Test + public void testGetRoleAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; + String getRoleAssignmentPath = "/v1/role_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetRoleAssignmentOptions model + GetRoleAssignmentOptions getRoleAssignmentOptionsModel = new GetRoleAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke getRoleAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.getRoleAssignment(getRoleAssignmentOptionsModel).execute(); + assertNotNull(response); + RoleAssignment 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, getRoleAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getRoleAssignment operation with and without retries enabled + @Test + public void testGetRoleAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testGetRoleAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testGetRoleAssignmentWOptions(); + } + + // Test the getRoleAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.getRoleAssignment(null).execute(); + } + + // Test the updateRoleAssignment operation with a valid options model parameter + @Test + public void testUpdateRoleAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; + String updateRoleAssignmentPath = "/v1/role_assignments/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdateRoleAssignmentOptions model + UpdateRoleAssignmentOptions updateRoleAssignmentOptionsModel = new UpdateRoleAssignmentOptions.Builder() + .assignmentId("testString") + .ifMatch("testString") + .templateVersion("testString") + .build(); + + // Invoke updateRoleAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.updateRoleAssignment(updateRoleAssignmentOptionsModel).execute(); + assertNotNull(response); + RoleAssignment 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"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updateRoleAssignmentPath); + // 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 updateRoleAssignment operation with and without retries enabled + @Test + public void testUpdateRoleAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testUpdateRoleAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testUpdateRoleAssignmentWOptions(); + } + + // Test the updateRoleAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateRoleAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.updateRoleAssignment(null).execute(); + } + + // Test the deleteRoleAssignment operation with a valid options model parameter + @Test + public void testDeleteRoleAssignmentWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteRoleAssignmentPath = "/v1/role_assignments/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteRoleAssignmentOptions model + DeleteRoleAssignmentOptions deleteRoleAssignmentOptionsModel = new DeleteRoleAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + + // Invoke deleteRoleAssignment() with a valid options model and verify the result + Response response = iamPolicyManagementService.deleteRoleAssignment(deleteRoleAssignmentOptionsModel).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, deleteRoleAssignmentPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteRoleAssignment operation with and without retries enabled + @Test + public void testDeleteRoleAssignmentWRetries() throws Throwable { + iamPolicyManagementService.enableRetries(4, 30); + testDeleteRoleAssignmentWOptions(); + + iamPolicyManagementService.disableRetries(); + testDeleteRoleAssignmentWOptions(); + } + + // Test the deleteRoleAssignment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleAssignmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + iamPolicyManagementService.deleteRoleAssignment(null).execute(); + } + + // Perform setup needed before each test method + @BeforeMethod + public void beforeEachTest() { + // Start the mock server. + try { + server = new MockWebServer(); + server.start(); + } catch (IOException err) { + fail("Failed to instantiate mock web server"); + } + + // Construct an instance of the service + constructClientService(); + } + + // Perform tear down after each test method + @AfterMethod + public void afterEachTest() throws IOException { + server.shutdown(); + iamPolicyManagementService = null; + } + + // Constructs an instance of the service to be used by the tests + public void constructClientService() { + System.setProperty("TESTSERVICE_AUTH_TYPE", "noAuth"); + final String serviceName = "testService"; + + iamPolicyManagementService = IamPolicyManagement.newInstance(serviceName); + String url = server.url("/").toString(); + iamPolicyManagementService.setServiceUrl(url); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java new file mode 100644 index 00000000000..5630ccb0c03 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.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 AccountSettingsAccessManagement model. + */ +public class AccountSettingsAccessManagementTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAccountSettingsAccessManagement() throws Throwable { + AccountSettingsAccessManagement accountSettingsAccessManagementModel = new AccountSettingsAccessManagement(); + assertNull(accountSettingsAccessManagementModel.getExternalAccountIdentityInteraction()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java new file mode 100644 index 00000000000..d4dfc8863c6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentCollection model. + */ +public class ActionControlAssignmentCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentCollection() throws Throwable { + ActionControlAssignmentCollection actionControlAssignmentCollectionModel = new ActionControlAssignmentCollection(); + assertNull(actionControlAssignmentCollectionModel.getLimit()); + assertNull(actionControlAssignmentCollectionModel.getFirst()); + assertNull(actionControlAssignmentCollectionModel.getNext()); + assertNull(actionControlAssignmentCollectionModel.getPrevious()); + assertNull(actionControlAssignmentCollectionModel.getAssignments()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java new file mode 100644 index 00000000000..cb53bc44d1c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java @@ -0,0 +1,43 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResourceActionControl model. + */ +public class ActionControlAssignmentResourceActionControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentResourceActionControl() throws Throwable { + ActionControlAssignmentResourceActionControl actionControlAssignmentResourceActionControlModel = new ActionControlAssignmentResourceActionControl(); + assertNull(actionControlAssignmentResourceActionControlModel.getResourceCreated()); + assertNull(actionControlAssignmentResourceActionControlModel.getErrorMessage()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java new file mode 100644 index 00000000000..284ec17a0f0 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResourceCreated model. + */ +public class ActionControlAssignmentResourceCreatedTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentResourceCreated() throws Throwable { + ActionControlAssignmentResourceCreated actionControlAssignmentResourceCreatedModel = new ActionControlAssignmentResourceCreated(); + assertNull(actionControlAssignmentResourceCreatedModel.getId()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java new file mode 100644 index 00000000000..eaa560dce78 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResource model. + */ +public class ActionControlAssignmentResourceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentResource() throws Throwable { + ActionControlAssignmentResource actionControlAssignmentResourceModel = new ActionControlAssignmentResource(); + assertNull(actionControlAssignmentResourceModel.getTarget()); + assertNull(actionControlAssignmentResourceModel.getActionControl()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java new file mode 100644 index 00000000000..262a74bea45 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentTemplate model. + */ +public class ActionControlAssignmentTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignmentTemplate() throws Throwable { + ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(actionControlAssignmentTemplateModel.id(), "testString"); + assertEquals(actionControlAssignmentTemplateModel.version(), "testString"); + + String json = TestUtilities.serialize(actionControlAssignmentTemplateModel); + + ActionControlAssignmentTemplate actionControlAssignmentTemplateModelNew = TestUtilities.deserialize(json, ActionControlAssignmentTemplate.class); + assertTrue(actionControlAssignmentTemplateModelNew instanceof ActionControlAssignmentTemplate); + assertEquals(actionControlAssignmentTemplateModelNew.id(), "testString"); + assertEquals(actionControlAssignmentTemplateModelNew.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testActionControlAssignmentTemplateError() throws Throwable { + new ActionControlAssignmentTemplate.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java new file mode 100644 index 00000000000..c5173f940c4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignment model. + */ +public class ActionControlAssignmentTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlAssignment() throws Throwable { + ActionControlAssignment actionControlAssignmentModel = new ActionControlAssignment(); + assertNull(actionControlAssignmentModel.getTemplate()); + assertNull(actionControlAssignmentModel.getTarget()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java new file mode 100644 index 00000000000..58155ee1e7e --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java @@ -0,0 +1,46 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplateCollection model. + */ +public class ActionControlTemplateCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlTemplateCollection() throws Throwable { + ActionControlTemplateCollection actionControlTemplateCollectionModel = new ActionControlTemplateCollection(); + assertNull(actionControlTemplateCollectionModel.getLimit()); + assertNull(actionControlTemplateCollectionModel.getFirst()); + assertNull(actionControlTemplateCollectionModel.getNext()); + assertNull(actionControlTemplateCollectionModel.getPrevious()); + assertNull(actionControlTemplateCollectionModel.getActionControlTemplates()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java new file mode 100644 index 00000000000..a086106a57e --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplate model. + */ +public class ActionControlTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlTemplate() throws Throwable { + ActionControlTemplate actionControlTemplateModel = new ActionControlTemplate(); + assertNull(actionControlTemplateModel.getName()); + assertNull(actionControlTemplateModel.getDescription()); + assertNull(actionControlTemplateModel.getAccountId()); + assertNull(actionControlTemplateModel.isCommitted()); + assertNull(actionControlTemplateModel.getActionControl()); + assertNull(actionControlTemplateModel.getVersion()); + assertNull(actionControlTemplateModel.getState()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java new file mode 100644 index 00000000000..7b6bf014357 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java @@ -0,0 +1,46 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplateVersionsCollection model. + */ +public class ActionControlTemplateVersionsCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testActionControlTemplateVersionsCollection() throws Throwable { + ActionControlTemplateVersionsCollection actionControlTemplateVersionsCollectionModel = new ActionControlTemplateVersionsCollection(); + assertNull(actionControlTemplateVersionsCollectionModel.getLimit()); + assertNull(actionControlTemplateVersionsCollectionModel.getFirst()); + assertNull(actionControlTemplateVersionsCollectionModel.getNext()); + assertNull(actionControlTemplateVersionsCollectionModel.getPrevious()); + assertNull(actionControlTemplateVersionsCollectionModel.getVersions()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java new file mode 100644 index 00000000000..4038d52606c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentResourceCreated model. + */ +public class AssignmentResourceCreatedTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAssignmentResourceCreated() throws Throwable { + AssignmentResourceCreated assignmentResourceCreatedModel = new AssignmentResourceCreated(); + assertNull(assignmentResourceCreatedModel.getId()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java new file mode 100644 index 00000000000..81e3799a42c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentResourceError model. + */ +public class AssignmentResourceErrorTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAssignmentResourceError() throws Throwable { + AssignmentResourceError assignmentResourceErrorModel = new AssignmentResourceError(); + assertNull(assignmentResourceErrorModel.getName()); + assertNull(assignmentResourceErrorModel.getErrorCode()); + assertNull(assignmentResourceErrorModel.getMessage()); + assertNull(assignmentResourceErrorModel.getCode()); + assertNull(assignmentResourceErrorModel.getErrors()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java new file mode 100644 index 00000000000..48e4a605cbb --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentTargetDetails model. + */ +public class AssignmentTargetDetailsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAssignmentTargetDetails() throws Throwable { + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + assertEquals(assignmentTargetDetailsModel.type(), "Account"); + assertEquals(assignmentTargetDetailsModel.id(), "testString"); + + String json = TestUtilities.serialize(assignmentTargetDetailsModel); + + AssignmentTargetDetails assignmentTargetDetailsModelNew = TestUtilities.deserialize(json, AssignmentTargetDetails.class); + assertTrue(assignmentTargetDetailsModelNew instanceof AssignmentTargetDetails); + assertEquals(assignmentTargetDetailsModelNew.type(), "Account"); + assertEquals(assignmentTargetDetailsModelNew.id(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testAssignmentTargetDetailsError() throws Throwable { + new AssignmentTargetDetails.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java new file mode 100644 index 00000000000..bcecf27ed27 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java @@ -0,0 +1,48 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentTemplateDetails model. + */ +public class AssignmentTemplateDetailsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAssignmentTemplateDetails() throws Throwable { + AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(assignmentTemplateDetailsModel.id(), "testString"); + assertEquals(assignmentTemplateDetailsModel.version(), "testString"); + + String json = TestUtilities.serialize(assignmentTemplateDetailsModel); + + AssignmentTemplateDetails assignmentTemplateDetailsModelNew = TestUtilities.deserialize(json, AssignmentTemplateDetails.class); + assertTrue(assignmentTemplateDetailsModelNew instanceof AssignmentTemplateDetails); + assertEquals(assignmentTemplateDetailsModelNew.id(), "testString"); + assertEquals(assignmentTemplateDetailsModelNew.version(), "testString"); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..2b5ed42c76a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CommitActionControlTemplateOptions model. + */ +public class CommitActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCommitActionControlTemplateOptions() throws Throwable { + CommitActionControlTemplateOptions commitActionControlTemplateOptionsModel = new CommitActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + assertEquals(commitActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(commitActionControlTemplateOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitActionControlTemplateOptionsError() throws Throwable { + new CommitActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..66cdca59588 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CommitPolicyTemplateOptions model. + */ +public class CommitPolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCommitPolicyTemplateOptions() throws Throwable { + CommitPolicyTemplateOptions commitPolicyTemplateOptionsModel = new CommitPolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + assertEquals(commitPolicyTemplateOptionsModel.policyTemplateId(), "testString"); + assertEquals(commitPolicyTemplateOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitPolicyTemplateOptionsError() throws Throwable { + new CommitPolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..09c48b8e80e --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CommitRoleTemplateOptions model. + */ +public class CommitRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCommitRoleTemplateOptions() throws Throwable { + CommitRoleTemplateOptions commitRoleTemplateOptionsModel = new CommitRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + assertEquals(commitRoleTemplateOptionsModel.roleTemplateId(), "testString"); + assertEquals(commitRoleTemplateOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCommitRoleTemplateOptionsError() throws Throwable { + new CommitRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java new file mode 100644 index 00000000000..94ef6ce21e8 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.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 ConflictsWith model. + */ +public class ConflictsWithTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testConflictsWith() throws Throwable { + ConflictsWith conflictsWithModel = new ConflictsWith(); + assertNull(conflictsWithModel.getEtag()); + assertNull(conflictsWithModel.getRole()); + assertNull(conflictsWithModel.getPolicy()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java new file mode 100644 index 00000000000..bbe19a7b9b1 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponseControl model. + */ +public class ControlResponseControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testControlResponseControl() throws Throwable { + ControlResponseControl controlResponseControlModel = new ControlResponseControl(); + assertNull(controlResponseControlModel.getGrant()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java new file mode 100644 index 00000000000..7b2fbfae90d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControlWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponseControlWithEnrichedRoles model. + */ +public class ControlResponseControlWithEnrichedRolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testControlResponseControlWithEnrichedRoles() throws Throwable { + ControlResponseControlWithEnrichedRoles controlResponseControlWithEnrichedRolesModel = new ControlResponseControlWithEnrichedRoles(); + assertNull(controlResponseControlWithEnrichedRolesModel.getGrant()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java new file mode 100644 index 00000000000..f42cbc0a2d8 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponse; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponse model. + */ +public class ControlResponseTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testControlResponse() throws Throwable { + ControlResponse controlResponseModel = new ControlResponse(); + assertNotNull(controlResponseModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java new file mode 100644 index 00000000000..c8b1e3000f9 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 Control model. + */ +public class ControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testControl() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + assertEquals(controlModel.grant(), grantModel); + + String json = TestUtilities.serialize(controlModel); + + Control controlModelNew = TestUtilities.deserialize(json, Control.class); + assertTrue(controlModelNew instanceof Control); + assertEquals(controlModelNew.grant().toString(), grantModel.toString()); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testControlError() throws Throwable { + new Control.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java new file mode 100644 index 00000000000..f2557c8f64f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateAssignmentOptions model. + */ +public class CreateActionControlTemplateAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateActionControlTemplateAssignmentOptions() throws Throwable { + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + assertEquals(assignmentTargetDetailsModel.type(), "Account"); + assertEquals(assignmentTargetDetailsModel.id(), "testString"); + + ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(actionControlAssignmentTemplateModel.id(), "testString"); + assertEquals(actionControlAssignmentTemplateModel.version(), "testString"); + + CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptionsModel = new CreateActionControlTemplateAssignmentOptions.Builder() + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(actionControlAssignmentTemplateModel)) + .acceptLanguage("default") + .build(); + assertEquals(createActionControlTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); + assertEquals(createActionControlTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(actionControlAssignmentTemplateModel)); + assertEquals(createActionControlTemplateAssignmentOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateAssignmentOptionsError() throws Throwable { + new CreateActionControlTemplateAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..2508072a03c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateOptions model. + */ +public class CreateActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateActionControlTemplateOptions() throws Throwable { + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateActionControlModel.serviceName(), "testString"); + assertEquals(templateActionControlModel.description(), "testString"); + assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); + + CreateActionControlTemplateOptions createActionControlTemplateOptionsModel = new CreateActionControlTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .description("testString") + .committed(true) + .actionControl(templateActionControlModel) + .acceptLanguage("default") + .build(); + assertEquals(createActionControlTemplateOptionsModel.name(), "testString"); + assertEquals(createActionControlTemplateOptionsModel.accountId(), "testString"); + assertEquals(createActionControlTemplateOptionsModel.description(), "testString"); + assertEquals(createActionControlTemplateOptionsModel.committed(), Boolean.valueOf(true)); + assertEquals(createActionControlTemplateOptionsModel.actionControl(), templateActionControlModel); + assertEquals(createActionControlTemplateOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateOptionsError() throws Throwable { + new CreateActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..d5070249115 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateVersionOptions model. + */ +public class CreateActionControlTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateActionControlTemplateVersionOptions() throws Throwable { + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateActionControlModel.serviceName(), "testString"); + assertEquals(templateActionControlModel.description(), "testString"); + assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); + + CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptionsModel = new CreateActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .name("testString") + .description("testString") + .actionControl(templateActionControlModel) + .committed(true) + .build(); + assertEquals(createActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(createActionControlTemplateVersionOptionsModel.name(), "testString"); + assertEquals(createActionControlTemplateVersionOptionsModel.description(), "testString"); + assertEquals(createActionControlTemplateVersionOptionsModel.actionControl(), templateActionControlModel); + assertEquals(createActionControlTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateActionControlTemplateVersionOptionsError() throws Throwable { + new CreateActionControlTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java new file mode 100644 index 00000000000..c2dd24fd213 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java @@ -0,0 +1,103 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyOptions model. + */ +public class CreatePolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreatePolicyOptions() throws Throwable { + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(subjectAttributeModel.name(), "testString"); + assertEquals(subjectAttributeModel.value(), "testString"); + + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); + + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + assertEquals(policyRoleModel.roleId(), "testString"); + + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceAttributeModel.name(), "testString"); + assertEquals(resourceAttributeModel.value(), "testString"); + assertEquals(resourceAttributeModel.operator(), "testString"); + + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceTagModel.name(), "testString"); + assertEquals(resourceTagModel.value(), "testString"); + assertEquals(resourceTagModel.operator(), "testString"); + + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); + assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); + + CreatePolicyOptions createPolicyOptionsModel = new CreatePolicyOptions.Builder() + .type("testString") + .subjects(java.util.Arrays.asList(policySubjectModel)) + .roles(java.util.Arrays.asList(policyRoleModel)) + .resources(java.util.Arrays.asList(policyResourceModel)) + .description("testString") + .acceptLanguage("default") + .build(); + assertEquals(createPolicyOptionsModel.type(), "testString"); + assertEquals(createPolicyOptionsModel.subjects(), java.util.Arrays.asList(policySubjectModel)); + assertEquals(createPolicyOptionsModel.roles(), java.util.Arrays.asList(policyRoleModel)); + assertEquals(createPolicyOptionsModel.resources(), java.util.Arrays.asList(policyResourceModel)); + assertEquals(createPolicyOptionsModel.description(), "testString"); + assertEquals(createPolicyOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyOptionsError() throws Throwable { + new CreatePolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java new file mode 100644 index 00000000000..5b08b4b398a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java @@ -0,0 +1,67 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateAssignmentOptions model. + */ +public class CreatePolicyTemplateAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreatePolicyTemplateAssignmentOptions() throws Throwable { + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + assertEquals(assignmentTargetDetailsModel.type(), "Account"); + assertEquals(assignmentTargetDetailsModel.id(), "testString"); + + AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(assignmentTemplateDetailsModel.id(), "testString"); + assertEquals(assignmentTemplateDetailsModel.version(), "testString"); + + CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptionsModel = new CreatePolicyTemplateAssignmentOptions.Builder() + .version("1.0") + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(assignmentTemplateDetailsModel)) + .acceptLanguage("default") + .build(); + assertEquals(createPolicyTemplateAssignmentOptionsModel.version(), "1.0"); + assertEquals(createPolicyTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); + assertEquals(createPolicyTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(assignmentTemplateDetailsModel)); + assertEquals(createPolicyTemplateAssignmentOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateAssignmentOptionsError() throws Throwable { + new CreatePolicyTemplateAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..68617451831 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java @@ -0,0 +1,145 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateOptions model. + */ +public class CreatePolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreatePolicyTemplateOptions() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + assertEquals(templatePolicyModel.type(), "access"); + assertEquals(templatePolicyModel.description(), "testString"); + assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); + assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); + assertEquals(templatePolicyModel.pattern(), "testString"); + assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); + assertEquals(templatePolicyModel.control(), templateControlModel); + + CreatePolicyTemplateOptions createPolicyTemplateOptionsModel = new CreatePolicyTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .policy(templatePolicyModel) + .description("testString") + .committed(true) + .acceptLanguage("default") + .build(); + assertEquals(createPolicyTemplateOptionsModel.name(), "testString"); + assertEquals(createPolicyTemplateOptionsModel.accountId(), "testString"); + assertEquals(createPolicyTemplateOptionsModel.policy(), templatePolicyModel); + assertEquals(createPolicyTemplateOptionsModel.description(), "testString"); + assertEquals(createPolicyTemplateOptionsModel.committed(), Boolean.valueOf(true)); + assertEquals(createPolicyTemplateOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateOptionsError() throws Throwable { + new CreatePolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..d6919e6e1b9 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java @@ -0,0 +1,143 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateVersionOptions model. + */ +public class CreatePolicyTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreatePolicyTemplateVersionOptions() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + assertEquals(templatePolicyModel.type(), "access"); + assertEquals(templatePolicyModel.description(), "testString"); + assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); + assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); + assertEquals(templatePolicyModel.pattern(), "testString"); + assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); + assertEquals(templatePolicyModel.control(), templateControlModel); + + CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptionsModel = new CreatePolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .policy(templatePolicyModel) + .name("testString") + .description("testString") + .committed(true) + .build(); + assertEquals(createPolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); + assertEquals(createPolicyTemplateVersionOptionsModel.policy(), templatePolicyModel); + assertEquals(createPolicyTemplateVersionOptionsModel.name(), "testString"); + assertEquals(createPolicyTemplateVersionOptionsModel.description(), "testString"); + assertEquals(createPolicyTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreatePolicyTemplateVersionOptionsError() throws Throwable { + new CreatePolicyTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java new file mode 100644 index 00000000000..849512f2bda --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleOptions model. + */ +public class CreateRoleOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateRoleOptions() throws Throwable { + CreateRoleOptions createRoleOptionsModel = new CreateRoleOptions.Builder() + .displayName("testString") + .actions(java.util.Arrays.asList("testString")) + .name("Developer") + .accountId("testString") + .serviceName("iam-groups") + .description("testString") + .acceptLanguage("default") + .build(); + assertEquals(createRoleOptionsModel.displayName(), "testString"); + assertEquals(createRoleOptionsModel.actions(), java.util.Arrays.asList("testString")); + assertEquals(createRoleOptionsModel.name(), "Developer"); + assertEquals(createRoleOptionsModel.accountId(), "testString"); + assertEquals(createRoleOptionsModel.serviceName(), "iam-groups"); + assertEquals(createRoleOptionsModel.description(), "testString"); + assertEquals(createRoleOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleOptionsError() throws Throwable { + new CreateRoleOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java new file mode 100644 index 00000000000..bff414389a5 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateAssignmentOptions model. + */ +public class CreateRoleTemplateAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateRoleTemplateAssignmentOptions() throws Throwable { + AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() + .type("Account") + .id("testString") + .build(); + assertEquals(assignmentTargetDetailsModel.type(), "Account"); + assertEquals(assignmentTargetDetailsModel.id(), "testString"); + + RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleAssignmentTemplateModel.id(), "testString"); + assertEquals(roleAssignmentTemplateModel.version(), "testString"); + + CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptionsModel = new CreateRoleTemplateAssignmentOptions.Builder() + .target(assignmentTargetDetailsModel) + .templates(java.util.Arrays.asList(roleAssignmentTemplateModel)) + .acceptLanguage("default") + .build(); + assertEquals(createRoleTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); + assertEquals(createRoleTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(roleAssignmentTemplateModel)); + assertEquals(createRoleTemplateAssignmentOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateAssignmentOptionsError() throws Throwable { + new CreateRoleTemplateAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..799743ddbf4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateOptions model. + */ +public class CreateRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateRoleTemplateOptions() throws Throwable { + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() + .name("testString") + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(roleTemplatePrototypeRoleModel.name(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.displayName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.serviceName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.description(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.actions(), java.util.Arrays.asList("testString")); + + CreateRoleTemplateOptions createRoleTemplateOptionsModel = new CreateRoleTemplateOptions.Builder() + .name("testString") + .accountId("testString") + .description("testString") + .committed(true) + .role(roleTemplatePrototypeRoleModel) + .acceptLanguage("default") + .build(); + assertEquals(createRoleTemplateOptionsModel.name(), "testString"); + assertEquals(createRoleTemplateOptionsModel.accountId(), "testString"); + assertEquals(createRoleTemplateOptionsModel.description(), "testString"); + assertEquals(createRoleTemplateOptionsModel.committed(), Boolean.valueOf(true)); + assertEquals(createRoleTemplateOptionsModel.role(), roleTemplatePrototypeRoleModel); + assertEquals(createRoleTemplateOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateOptionsError() throws Throwable { + new CreateRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..a7d2d312afa --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java @@ -0,0 +1,65 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateVersionOptions model. + */ +public class CreateRoleTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateRoleTemplateVersionOptions() throws Throwable { + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateRoleModel.displayName(), "testString"); + assertEquals(templateRoleModel.serviceName(), "testString"); + assertEquals(templateRoleModel.description(), "testString"); + assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); + + CreateRoleTemplateVersionOptions createRoleTemplateVersionOptionsModel = new CreateRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .name("testString") + .description("testString") + .role(templateRoleModel) + .committed(true) + .build(); + assertEquals(createRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); + assertEquals(createRoleTemplateVersionOptionsModel.name(), "testString"); + assertEquals(createRoleTemplateVersionOptionsModel.description(), "testString"); + assertEquals(createRoleTemplateVersionOptionsModel.role(), templateRoleModel); + assertEquals(createRoleTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateRoleTemplateVersionOptionsError() throws Throwable { + new CreateRoleTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java new file mode 100644 index 00000000000..acce8b7b537 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java @@ -0,0 +1,131 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 CreateV2PolicyOptions model. + */ +public class CreateV2PolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateV2PolicyOptions() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + assertEquals(controlModel.grant(), grantModel); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + CreateV2PolicyOptions createV2PolicyOptionsModel = new CreateV2PolicyOptions.Builder() + .control(controlModel) + .type("access") + .description("testString") + .subject(v2PolicySubjectModel) + .resource(v2PolicyResourceModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .acceptLanguage("default") + .build(); + assertEquals(createV2PolicyOptionsModel.control(), controlModel); + assertEquals(createV2PolicyOptionsModel.type(), "access"); + assertEquals(createV2PolicyOptionsModel.description(), "testString"); + assertEquals(createV2PolicyOptionsModel.subject(), v2PolicySubjectModel); + assertEquals(createV2PolicyOptionsModel.resource(), v2PolicyResourceModel); + assertEquals(createV2PolicyOptionsModel.pattern(), "testString"); + assertEquals(createV2PolicyOptionsModel.rule(), v2PolicyRuleModel); + assertEquals(createV2PolicyOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateV2PolicyOptionsError() throws Throwable { + new CreateV2PolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java new file mode 100644 index 00000000000..acc0dc0a3c1 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 CustomRole model. + */ +public class CustomRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCustomRole() throws Throwable { + CustomRole customRoleModel = new CustomRole(); + assertNull(customRoleModel.getDisplayName()); + assertNull(customRoleModel.getDescription()); + assertNull(customRoleModel.getActions()); + assertNull(customRoleModel.getName()); + assertNull(customRoleModel.getAccountId()); + assertNull(customRoleModel.getServiceName()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java new file mode 100644 index 00000000000..1a38606ede5 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlAssignmentOptions model. + */ +public class DeleteActionControlAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteActionControlAssignmentOptions() throws Throwable { + DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptionsModel = new DeleteActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(deleteActionControlAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlAssignmentOptionsError() throws Throwable { + new DeleteActionControlAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..75b111e9214 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlTemplateOptions model. + */ +public class DeleteActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteActionControlTemplateOptions() throws Throwable { + DeleteActionControlTemplateOptions deleteActionControlTemplateOptionsModel = new DeleteActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .build(); + assertEquals(deleteActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlTemplateOptionsError() throws Throwable { + new DeleteActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..64fb5790244 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlTemplateVersionOptions model. + */ +public class DeleteActionControlTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteActionControlTemplateVersionOptions() throws Throwable { + DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptionsModel = new DeleteActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + assertEquals(deleteActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(deleteActionControlTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteActionControlTemplateVersionOptionsError() throws Throwable { + new DeleteActionControlTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java new file mode 100644 index 00000000000..75aed905222 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyAssignmentOptions model. + */ +public class DeletePolicyAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeletePolicyAssignmentOptions() throws Throwable { + DeletePolicyAssignmentOptions deletePolicyAssignmentOptionsModel = new DeletePolicyAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(deletePolicyAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyAssignmentOptionsError() throws Throwable { + new DeletePolicyAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java new file mode 100644 index 00000000000..1b130eb0f79 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyOptions model. + */ +public class DeletePolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeletePolicyOptions() throws Throwable { + DeletePolicyOptions deletePolicyOptionsModel = new DeletePolicyOptions.Builder() + .policyId("testString") + .build(); + assertEquals(deletePolicyOptionsModel.policyId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyOptionsError() throws Throwable { + new DeletePolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..288517222aa --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyTemplateOptions model. + */ +public class DeletePolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeletePolicyTemplateOptions() throws Throwable { + DeletePolicyTemplateOptions deletePolicyTemplateOptionsModel = new DeletePolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .build(); + assertEquals(deletePolicyTemplateOptionsModel.policyTemplateId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyTemplateOptionsError() throws Throwable { + new DeletePolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..7b1c6cffa1d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyTemplateVersionOptions model. + */ +public class DeletePolicyTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeletePolicyTemplateVersionOptions() throws Throwable { + DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptionsModel = new DeletePolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + assertEquals(deletePolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); + assertEquals(deletePolicyTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeletePolicyTemplateVersionOptionsError() throws Throwable { + new DeletePolicyTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java new file mode 100644 index 00000000000..7f9b614304f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleAssignmentOptions model. + */ +public class DeleteRoleAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteRoleAssignmentOptions() throws Throwable { + DeleteRoleAssignmentOptions deleteRoleAssignmentOptionsModel = new DeleteRoleAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(deleteRoleAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleAssignmentOptionsError() throws Throwable { + new DeleteRoleAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java new file mode 100644 index 00000000000..9c6690cda7b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleOptions model. + */ +public class DeleteRoleOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteRoleOptions() throws Throwable { + DeleteRoleOptions deleteRoleOptionsModel = new DeleteRoleOptions.Builder() + .roleId("testString") + .build(); + assertEquals(deleteRoleOptionsModel.roleId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleOptionsError() throws Throwable { + new DeleteRoleOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..3fc04286ed3 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleTemplateOptions model. + */ +public class DeleteRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteRoleTemplateOptions() throws Throwable { + DeleteRoleTemplateOptions deleteRoleTemplateOptionsModel = new DeleteRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .build(); + assertEquals(deleteRoleTemplateOptionsModel.roleTemplateId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleTemplateOptionsError() throws Throwable { + new DeleteRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..ff652fa335c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleTemplateVersionOptions model. + */ +public class DeleteRoleTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteRoleTemplateVersionOptions() throws Throwable { + DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptionsModel = new DeleteRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + assertEquals(deleteRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); + assertEquals(deleteRoleTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRoleTemplateVersionOptionsError() throws Throwable { + new DeleteRoleTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java new file mode 100644 index 00000000000..6a33aa8f116 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteV2PolicyOptions model. + */ +public class DeleteV2PolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteV2PolicyOptions() throws Throwable { + DeleteV2PolicyOptions deleteV2PolicyOptionsModel = new DeleteV2PolicyOptions.Builder() + .id("testString") + .build(); + assertEquals(deleteV2PolicyOptionsModel.id(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteV2PolicyOptionsError() throws Throwable { + new DeleteV2PolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java new file mode 100644 index 00000000000..104a5210ed9 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.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 EnrichedRoles model. + */ +public class EnrichedRolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testEnrichedRoles() throws Throwable { + EnrichedRoles enrichedRolesModel = new EnrichedRoles(); + assertNull(enrichedRolesModel.getRoleId()); + assertNull(enrichedRolesModel.getActions()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java new file mode 100644 index 00000000000..460b37f8105 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.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 ErrorDetails model. + */ +public class ErrorDetailsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testErrorDetails() throws Throwable { + ErrorDetails errorDetailsModel = new ErrorDetails(); + assertNull(errorDetailsModel.getConflictsWith()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java new file mode 100644 index 00000000000..e7f7f9afbfc --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.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 ErrorObject model. + */ +public class ErrorObjectTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testErrorObject() throws Throwable { + ErrorObject errorObjectModel = new ErrorObject(); + assertNull(errorObjectModel.getCode()); + assertNull(errorObjectModel.getMessage()); + assertNull(errorObjectModel.getDetails()); + assertNull(errorObjectModel.getMoreInfo()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java new file mode 100644 index 00000000000..90c91c8fcaf --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; +import com.ibm.cloud.platform_services.iam_policy_management.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 ExternalAccountIdentityInteractionPatch model. + */ +public class ExternalAccountIdentityInteractionPatchTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testExternalAccountIdentityInteractionPatch() throws Throwable { + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + assertEquals(identityTypesBaseModel.state(), "enabled"); + assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); + + IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() + .user(identityTypesBaseModel) + .serviceId(identityTypesBaseModel) + .service(identityTypesBaseModel) + .build(); + assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); + + ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() + .identityTypes(identityTypesPatchModel) + .build(); + assertEquals(externalAccountIdentityInteractionPatchModel.identityTypes(), identityTypesPatchModel); + + String json = TestUtilities.serialize(externalAccountIdentityInteractionPatchModel); + + ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModelNew = TestUtilities.deserialize(json, ExternalAccountIdentityInteractionPatch.class); + assertTrue(externalAccountIdentityInteractionPatchModelNew instanceof ExternalAccountIdentityInteractionPatch); + assertEquals(externalAccountIdentityInteractionPatchModelNew.identityTypes().toString(), identityTypesPatchModel.toString()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java new file mode 100644 index 00000000000..2e4aaef7e07 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.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 ExternalAccountIdentityInteraction model. + */ +public class ExternalAccountIdentityInteractionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testExternalAccountIdentityInteraction() throws Throwable { + ExternalAccountIdentityInteraction externalAccountIdentityInteractionModel = new ExternalAccountIdentityInteraction(); + assertNull(externalAccountIdentityInteractionModel.getIdentityTypes()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java new file mode 100644 index 00000000000..b4d68673091 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java @@ -0,0 +1,36 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.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 First model. + */ +public class FirstTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testFirst() throws Throwable { + First firstModel = new First(); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java new file mode 100644 index 00000000000..73e66a5a756 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlAssignmentOptions model. + */ +public class GetActionControlAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetActionControlAssignmentOptions() throws Throwable { + GetActionControlAssignmentOptions getActionControlAssignmentOptionsModel = new GetActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(getActionControlAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlAssignmentOptionsError() throws Throwable { + new GetActionControlAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..d6e66ce6939 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlTemplateOptions model. + */ +public class GetActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetActionControlTemplateOptions() throws Throwable { + GetActionControlTemplateOptions getActionControlTemplateOptionsModel = new GetActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .build(); + assertEquals(getActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(getActionControlTemplateOptionsModel.state(), "active"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlTemplateOptionsError() throws Throwable { + new GetActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..ac8e17fe083 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlTemplateVersionOptions model. + */ +public class GetActionControlTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetActionControlTemplateVersionOptions() throws Throwable { + GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptionsModel = new GetActionControlTemplateVersionOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .build(); + assertEquals(getActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(getActionControlTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetActionControlTemplateVersionOptionsError() throws Throwable { + new GetActionControlTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java new file mode 100644 index 00000000000..6b2a479c37d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyAssignmentOptions model. + */ +public class GetPolicyAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetPolicyAssignmentOptions() throws Throwable { + GetPolicyAssignmentOptions getPolicyAssignmentOptionsModel = new GetPolicyAssignmentOptions.Builder() + .assignmentId("testString") + .version("1.0") + .build(); + assertEquals(getPolicyAssignmentOptionsModel.assignmentId(), "testString"); + assertEquals(getPolicyAssignmentOptionsModel.version(), "1.0"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyAssignmentOptionsError() throws Throwable { + new GetPolicyAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java new file mode 100644 index 00000000000..2a7348c2c2d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyOptions model. + */ +public class GetPolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetPolicyOptions() throws Throwable { + GetPolicyOptions getPolicyOptionsModel = new GetPolicyOptions.Builder() + .policyId("testString") + .build(); + assertEquals(getPolicyOptionsModel.policyId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyOptionsError() throws Throwable { + new GetPolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..06535ed77ed --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyTemplateOptions model. + */ +public class GetPolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetPolicyTemplateOptions() throws Throwable { + GetPolicyTemplateOptions getPolicyTemplateOptionsModel = new GetPolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .state("active") + .build(); + assertEquals(getPolicyTemplateOptionsModel.policyTemplateId(), "testString"); + assertEquals(getPolicyTemplateOptionsModel.state(), "active"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyTemplateOptionsError() throws Throwable { + new GetPolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..264b5db4912 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyTemplateVersionOptions model. + */ +public class GetPolicyTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetPolicyTemplateVersionOptions() throws Throwable { + GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptionsModel = new GetPolicyTemplateVersionOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .build(); + assertEquals(getPolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); + assertEquals(getPolicyTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetPolicyTemplateVersionOptionsError() throws Throwable { + new GetPolicyTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java new file mode 100644 index 00000000000..0c1f6b2bb5a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleAssignmentOptions model. + */ +public class GetRoleAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetRoleAssignmentOptions() throws Throwable { + GetRoleAssignmentOptions getRoleAssignmentOptionsModel = new GetRoleAssignmentOptions.Builder() + .assignmentId("testString") + .build(); + assertEquals(getRoleAssignmentOptionsModel.assignmentId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleAssignmentOptionsError() throws Throwable { + new GetRoleAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java new file mode 100644 index 00000000000..e589b8d1285 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleOptions model. + */ +public class GetRoleOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetRoleOptions() throws Throwable { + GetRoleOptions getRoleOptionsModel = new GetRoleOptions.Builder() + .roleId("testString") + .build(); + assertEquals(getRoleOptionsModel.roleId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleOptionsError() throws Throwable { + new GetRoleOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..3c10b5207dc --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleTemplateOptions model. + */ +public class GetRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetRoleTemplateOptions() throws Throwable { + GetRoleTemplateOptions getRoleTemplateOptionsModel = new GetRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .state("active") + .build(); + assertEquals(getRoleTemplateOptionsModel.roleTemplateId(), "testString"); + assertEquals(getRoleTemplateOptionsModel.state(), "active"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleTemplateOptionsError() throws Throwable { + new GetRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java new file mode 100644 index 00000000000..3bd5d278630 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleTemplateVersionOptions model. + */ +public class GetRoleTemplateVersionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetRoleTemplateVersionOptions() throws Throwable { + GetRoleTemplateVersionOptions getRoleTemplateVersionOptionsModel = new GetRoleTemplateVersionOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .build(); + assertEquals(getRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); + assertEquals(getRoleTemplateVersionOptionsModel.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetRoleTemplateVersionOptionsError() throws Throwable { + new GetRoleTemplateVersionOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java new file mode 100644 index 00000000000..00f780c4153 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetSettingsOptions model. + */ +public class GetSettingsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetSettingsOptions() throws Throwable { + GetSettingsOptions getSettingsOptionsModel = new GetSettingsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .build(); + assertEquals(getSettingsOptionsModel.accountId(), "testString"); + assertEquals(getSettingsOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetSettingsOptionsError() throws Throwable { + new GetSettingsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java new file mode 100644 index 00000000000..ebad7af7371 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 GetV2PolicyOptions model. + */ +public class GetV2PolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetV2PolicyOptions() throws Throwable { + GetV2PolicyOptions getV2PolicyOptionsModel = new GetV2PolicyOptions.Builder() + .id("testString") + .format("include_last_permit") + .build(); + assertEquals(getV2PolicyOptionsModel.id(), "testString"); + assertEquals(getV2PolicyOptionsModel.format(), "include_last_permit"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetV2PolicyOptionsError() throws Throwable { + new GetV2PolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java new file mode 100644 index 00000000000..f627a54ecc2 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 Grant model. + */ +public class GrantTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGrant() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + + String json = TestUtilities.serialize(grantModel); + + Grant grantModelNew = TestUtilities.deserialize(json, Grant.class); + assertTrue(grantModelNew instanceof Grant); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGrantError() throws Throwable { + new Grant.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java new file mode 100644 index 00000000000..f86af34fab8 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.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 GrantWithEnrichedRoles model. + */ +public class GrantWithEnrichedRolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGrantWithEnrichedRoles() throws Throwable { + GrantWithEnrichedRoles grantWithEnrichedRolesModel = new GrantWithEnrichedRoles(); + assertNull(grantWithEnrichedRolesModel.getRoles()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java new file mode 100644 index 00000000000..2a4d38de51a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypesBase model. + */ +public class IdentityTypesBaseTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testIdentityTypesBase() throws Throwable { + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + assertEquals(identityTypesBaseModel.state(), "enabled"); + assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(identityTypesBaseModel); + + IdentityTypesBase identityTypesBaseModelNew = TestUtilities.deserialize(json, IdentityTypesBase.class); + assertTrue(identityTypesBaseModelNew instanceof IdentityTypesBase); + assertEquals(identityTypesBaseModelNew.state(), "enabled"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testIdentityTypesBaseError() throws Throwable { + new IdentityTypesBase.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java new file mode 100644 index 00000000000..3e762536695 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java @@ -0,0 +1,59 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; +import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypesPatch model. + */ +public class IdentityTypesPatchTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testIdentityTypesPatch() throws Throwable { + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + assertEquals(identityTypesBaseModel.state(), "enabled"); + assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); + + IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() + .user(identityTypesBaseModel) + .serviceId(identityTypesBaseModel) + .service(identityTypesBaseModel) + .build(); + assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); + + String json = TestUtilities.serialize(identityTypesPatchModel); + + IdentityTypesPatch identityTypesPatchModelNew = TestUtilities.deserialize(json, IdentityTypesPatch.class); + assertTrue(identityTypesPatchModelNew instanceof IdentityTypesPatch); + assertEquals(identityTypesPatchModelNew.user().toString(), identityTypesBaseModel.toString()); + assertEquals(identityTypesPatchModelNew.serviceId().toString(), identityTypesBaseModel.toString()); + assertEquals(identityTypesPatchModelNew.service().toString(), identityTypesBaseModel.toString()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java new file mode 100644 index 00000000000..e2b6c77338f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypes model. + */ +public class IdentityTypesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testIdentityTypes() throws Throwable { + IdentityTypes identityTypesModel = new IdentityTypes(); + assertNull(identityTypesModel.getUser()); + assertNull(identityTypesModel.getServiceId()); + assertNull(identityTypesModel.getService()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java new file mode 100644 index 00000000000..c3f51516e25 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java @@ -0,0 +1,36 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; +import com.ibm.cloud.platform_services.iam_policy_management.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 LimitData model. + */ +public class LimitDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testLimitData() throws Throwable { + LimitData limitDataModel = new LimitData(); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java new file mode 100644 index 00000000000..0d64653d829 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlAssignmentsOptions model. + */ +public class ListActionControlAssignmentsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListActionControlAssignmentsOptions() throws Throwable { + ListActionControlAssignmentsOptions listActionControlAssignmentsOptionsModel = new ListActionControlAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listActionControlAssignmentsOptionsModel.accountId(), "testString"); + assertEquals(listActionControlAssignmentsOptionsModel.acceptLanguage(), "default"); + assertEquals(listActionControlAssignmentsOptionsModel.templateId(), "testString"); + assertEquals(listActionControlAssignmentsOptionsModel.templateVersion(), "testString"); + assertEquals(listActionControlAssignmentsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listActionControlAssignmentsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlAssignmentsOptionsError() throws Throwable { + new ListActionControlAssignmentsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java new file mode 100644 index 00000000000..dfe91662d83 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlTemplateVersionsOptions model. + */ +public class ListActionControlTemplateVersionsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListActionControlTemplateVersionsOptions() throws Throwable { + ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptionsModel = new ListActionControlTemplateVersionsOptions.Builder() + .actionControlTemplateId("testString") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listActionControlTemplateVersionsOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(listActionControlTemplateVersionsOptionsModel.state(), "active"); + assertEquals(listActionControlTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listActionControlTemplateVersionsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlTemplateVersionsOptionsError() throws Throwable { + new ListActionControlTemplateVersionsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java new file mode 100644 index 00000000000..9e2e6a18158 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlTemplatesOptions model. + */ +public class ListActionControlTemplatesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListActionControlTemplatesOptions() throws Throwable { + ListActionControlTemplatesOptions listActionControlTemplatesOptionsModel = new ListActionControlTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listActionControlTemplatesOptionsModel.accountId(), "testString"); + assertEquals(listActionControlTemplatesOptionsModel.acceptLanguage(), "default"); + assertEquals(listActionControlTemplatesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listActionControlTemplatesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListActionControlTemplatesOptionsError() throws Throwable { + new ListActionControlTemplatesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java new file mode 100644 index 00000000000..8bfe5000355 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListPoliciesOptions model. + */ +public class ListPoliciesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListPoliciesOptions() throws Throwable { + ListPoliciesOptions listPoliciesOptionsModel = new ListPoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .tagName("testString") + .tagValue("testString") + .sort("id") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listPoliciesOptionsModel.accountId(), "testString"); + assertEquals(listPoliciesOptionsModel.acceptLanguage(), "default"); + assertEquals(listPoliciesOptionsModel.iamId(), "testString"); + assertEquals(listPoliciesOptionsModel.accessGroupId(), "testString"); + assertEquals(listPoliciesOptionsModel.type(), "access"); + assertEquals(listPoliciesOptionsModel.serviceType(), "service"); + assertEquals(listPoliciesOptionsModel.tagName(), "testString"); + assertEquals(listPoliciesOptionsModel.tagValue(), "testString"); + assertEquals(listPoliciesOptionsModel.sort(), "id"); + assertEquals(listPoliciesOptionsModel.format(), "include_last_permit"); + assertEquals(listPoliciesOptionsModel.state(), "active"); + assertEquals(listPoliciesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listPoliciesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPoliciesOptionsError() throws Throwable { + new ListPoliciesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java new file mode 100644 index 00000000000..32729befeda --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyAssignmentsOptions model. + */ +public class ListPolicyAssignmentsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListPolicyAssignmentsOptions() throws Throwable { + ListPolicyAssignmentsOptions listPolicyAssignmentsOptionsModel = new ListPolicyAssignmentsOptions.Builder() + .version("1.0") + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listPolicyAssignmentsOptionsModel.version(), "1.0"); + assertEquals(listPolicyAssignmentsOptionsModel.accountId(), "testString"); + assertEquals(listPolicyAssignmentsOptionsModel.acceptLanguage(), "default"); + assertEquals(listPolicyAssignmentsOptionsModel.templateId(), "testString"); + assertEquals(listPolicyAssignmentsOptionsModel.templateVersion(), "testString"); + assertEquals(listPolicyAssignmentsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listPolicyAssignmentsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyAssignmentsOptionsError() throws Throwable { + new ListPolicyAssignmentsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java new file mode 100644 index 00000000000..1053d41b84b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyTemplateVersionsOptions model. + */ +public class ListPolicyTemplateVersionsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListPolicyTemplateVersionsOptions() throws Throwable { + ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptionsModel = new ListPolicyTemplateVersionsOptions.Builder() + .policyTemplateId("testString") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listPolicyTemplateVersionsOptionsModel.policyTemplateId(), "testString"); + assertEquals(listPolicyTemplateVersionsOptionsModel.state(), "active"); + assertEquals(listPolicyTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listPolicyTemplateVersionsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyTemplateVersionsOptionsError() throws Throwable { + new ListPolicyTemplateVersionsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java new file mode 100644 index 00000000000..5065a9d9495 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyTemplatesOptions model. + */ +public class ListPolicyTemplatesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListPolicyTemplatesOptions() throws Throwable { + ListPolicyTemplatesOptions listPolicyTemplatesOptionsModel = new ListPolicyTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .state("active") + .name("testString") + .policyServiceType("service") + .policyServiceName("testString") + .policyServiceGroupId("testString") + .policyType("access") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listPolicyTemplatesOptionsModel.accountId(), "testString"); + assertEquals(listPolicyTemplatesOptionsModel.acceptLanguage(), "default"); + assertEquals(listPolicyTemplatesOptionsModel.state(), "active"); + assertEquals(listPolicyTemplatesOptionsModel.name(), "testString"); + assertEquals(listPolicyTemplatesOptionsModel.policyServiceType(), "service"); + assertEquals(listPolicyTemplatesOptionsModel.policyServiceName(), "testString"); + assertEquals(listPolicyTemplatesOptionsModel.policyServiceGroupId(), "testString"); + assertEquals(listPolicyTemplatesOptionsModel.policyType(), "access"); + assertEquals(listPolicyTemplatesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listPolicyTemplatesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListPolicyTemplatesOptionsError() throws Throwable { + new ListPolicyTemplatesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java new file mode 100644 index 00000000000..bd82df9bfd5 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleAssignmentsOptions model. + */ +public class ListRoleAssignmentsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListRoleAssignmentsOptions() throws Throwable { + ListRoleAssignmentsOptions listRoleAssignmentsOptionsModel = new ListRoleAssignmentsOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .templateId("testString") + .templateVersion("testString") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listRoleAssignmentsOptionsModel.accountId(), "testString"); + assertEquals(listRoleAssignmentsOptionsModel.acceptLanguage(), "default"); + assertEquals(listRoleAssignmentsOptionsModel.templateId(), "testString"); + assertEquals(listRoleAssignmentsOptionsModel.templateVersion(), "testString"); + assertEquals(listRoleAssignmentsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listRoleAssignmentsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleAssignmentsOptionsError() throws Throwable { + new ListRoleAssignmentsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java new file mode 100644 index 00000000000..2e89527b653 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleTemplateVersionsOptions model. + */ +public class ListRoleTemplateVersionsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListRoleTemplateVersionsOptions() throws Throwable { + ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptionsModel = new ListRoleTemplateVersionsOptions.Builder() + .roleTemplateId("testString") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listRoleTemplateVersionsOptionsModel.roleTemplateId(), "testString"); + assertEquals(listRoleTemplateVersionsOptionsModel.state(), "active"); + assertEquals(listRoleTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listRoleTemplateVersionsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleTemplateVersionsOptionsError() throws Throwable { + new ListRoleTemplateVersionsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java new file mode 100644 index 00000000000..21d23a7be0f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java @@ -0,0 +1,59 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleTemplatesOptions model. + */ +public class ListRoleTemplatesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListRoleTemplatesOptions() throws Throwable { + ListRoleTemplatesOptions listRoleTemplatesOptionsModel = new ListRoleTemplatesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .name("testString") + .roleName("testString") + .roleServiceName("testString") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listRoleTemplatesOptionsModel.accountId(), "testString"); + assertEquals(listRoleTemplatesOptionsModel.acceptLanguage(), "default"); + assertEquals(listRoleTemplatesOptionsModel.name(), "testString"); + assertEquals(listRoleTemplatesOptionsModel.roleName(), "testString"); + assertEquals(listRoleTemplatesOptionsModel.roleServiceName(), "testString"); + assertEquals(listRoleTemplatesOptionsModel.state(), "active"); + assertEquals(listRoleTemplatesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listRoleTemplatesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRoleTemplatesOptionsError() throws Throwable { + new ListRoleTemplatesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java new file mode 100644 index 00000000000..4fb97c7fc9a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListRolesOptions model. + */ +public class ListRolesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListRolesOptions() throws Throwable { + ListRolesOptions listRolesOptionsModel = new ListRolesOptions.Builder() + .acceptLanguage("default") + .accountId("testString") + .serviceName("iam-groups") + .sourceServiceName("iam-groups") + .policyType("authorization") + .serviceGroupId("IAM") + .build(); + assertEquals(listRolesOptionsModel.acceptLanguage(), "default"); + assertEquals(listRolesOptionsModel.accountId(), "testString"); + assertEquals(listRolesOptionsModel.serviceName(), "iam-groups"); + assertEquals(listRolesOptionsModel.sourceServiceName(), "iam-groups"); + assertEquals(listRolesOptionsModel.policyType(), "authorization"); + assertEquals(listRolesOptionsModel.serviceGroupId(), "IAM"); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java new file mode 100644 index 00000000000..8c72945373b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ListV2PoliciesOptions model. + */ +public class ListV2PoliciesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListV2PoliciesOptions() throws Throwable { + ListV2PoliciesOptions listV2PoliciesOptionsModel = new ListV2PoliciesOptions.Builder() + .accountId("testString") + .acceptLanguage("default") + .iamId("testString") + .accessGroupId("testString") + .type("access") + .serviceType("service") + .serviceName("testString") + .serviceGroupId("testString") + .sort("testString") + .format("include_last_permit") + .state("active") + .limit(Long.valueOf("50")) + .start("testString") + .build(); + assertEquals(listV2PoliciesOptionsModel.accountId(), "testString"); + assertEquals(listV2PoliciesOptionsModel.acceptLanguage(), "default"); + assertEquals(listV2PoliciesOptionsModel.iamId(), "testString"); + assertEquals(listV2PoliciesOptionsModel.accessGroupId(), "testString"); + assertEquals(listV2PoliciesOptionsModel.type(), "access"); + assertEquals(listV2PoliciesOptionsModel.serviceType(), "service"); + assertEquals(listV2PoliciesOptionsModel.serviceName(), "testString"); + assertEquals(listV2PoliciesOptionsModel.serviceGroupId(), "testString"); + assertEquals(listV2PoliciesOptionsModel.sort(), "testString"); + assertEquals(listV2PoliciesOptionsModel.format(), "include_last_permit"); + assertEquals(listV2PoliciesOptionsModel.state(), "active"); + assertEquals(listV2PoliciesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listV2PoliciesOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListV2PoliciesOptionsError() throws Throwable { + new ListV2PoliciesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java new file mode 100644 index 00000000000..0661d4245a2 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 NestedConditionRuleAttribute model. + */ +public class NestedConditionRuleAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testNestedConditionRuleAttribute() throws Throwable { + NestedConditionRuleAttribute nestedConditionRuleAttributeModel = new NestedConditionRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(nestedConditionRuleAttributeModel.key(), "testString"); + assertEquals(nestedConditionRuleAttributeModel.operator(), "stringEquals"); + assertEquals(nestedConditionRuleAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(nestedConditionRuleAttributeModel); + + NestedConditionRuleAttribute nestedConditionRuleAttributeModelNew = TestUtilities.deserialize(json, NestedConditionRuleAttribute.class); + assertTrue(nestedConditionRuleAttributeModelNew instanceof NestedConditionRuleAttribute); + assertEquals(nestedConditionRuleAttributeModelNew.key(), "testString"); + assertEquals(nestedConditionRuleAttributeModelNew.operator(), "stringEquals"); + assertEquals(nestedConditionRuleAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testNestedConditionRuleAttributeError() throws Throwable { + new NestedConditionRuleAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java new file mode 100644 index 00000000000..1ba394dbb7d --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleWithConditions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 NestedConditionRuleWithConditions model. + */ +public class NestedConditionRuleWithConditionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testNestedConditionRuleWithConditions() throws Throwable { + RuleAttribute ruleAttributeModel = new RuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(ruleAttributeModel.key(), "testString"); + assertEquals(ruleAttributeModel.operator(), "stringEquals"); + assertEquals(ruleAttributeModel.value(), "testString"); + + NestedConditionRuleWithConditions nestedConditionRuleWithConditionsModel = new NestedConditionRuleWithConditions.Builder() + .operator("and") + .conditions(java.util.Arrays.asList(ruleAttributeModel)) + .build(); + assertEquals(nestedConditionRuleWithConditionsModel.operator(), "and"); + assertEquals(nestedConditionRuleWithConditionsModel.conditions(), java.util.Arrays.asList(ruleAttributeModel)); + + String json = TestUtilities.serialize(nestedConditionRuleWithConditionsModel); + + NestedConditionRuleWithConditions nestedConditionRuleWithConditionsModelNew = TestUtilities.deserialize(json, NestedConditionRuleWithConditions.class); + assertTrue(nestedConditionRuleWithConditionsModelNew instanceof NestedConditionRuleWithConditions); + assertEquals(nestedConditionRuleWithConditionsModelNew.operator(), "and"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testNestedConditionRuleWithConditionsError() throws Throwable { + new NestedConditionRuleWithConditions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java new file mode 100644 index 00000000000..4956eea2675 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedCondition; +import com.ibm.cloud.platform_services.iam_policy_management.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 NestedCondition model. + */ +public class NestedConditionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testNestedCondition() throws Throwable { + NestedCondition nestedConditionModel = new NestedCondition(); + assertNotNull(nestedConditionModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java new file mode 100644 index 00000000000..c5e084a44d5 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.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 Next model. + */ +public class NextTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testNext() throws Throwable { + Next nextModel = new Next(); + assertNull(nextModel.getStart()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java new file mode 100644 index 00000000000..d5b05ede760 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentResourcePolicy model. + */ +public class PolicyAssignmentResourcePolicyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentResourcePolicy() throws Throwable { + PolicyAssignmentResourcePolicy policyAssignmentResourcePolicyModel = new PolicyAssignmentResourcePolicy(); + assertNull(policyAssignmentResourcePolicyModel.getResourceCreated()); + assertNull(policyAssignmentResourcePolicyModel.getStatus()); + assertNull(policyAssignmentResourcePolicyModel.getErrorMessage()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java new file mode 100644 index 00000000000..8b146425617 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentResources model. + */ +public class PolicyAssignmentResourcesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentResources() throws Throwable { + PolicyAssignmentResources policyAssignmentResourcesModel = new PolicyAssignmentResources(); + assertNull(policyAssignmentResourcesModel.getTarget()); + assertNull(policyAssignmentResourcesModel.getPolicy()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java new file mode 100644 index 00000000000..8a3a6b67703 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Collection model. + */ +public class PolicyAssignmentV1CollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentV1Collection() throws Throwable { + PolicyAssignmentV1Collection policyAssignmentV1CollectionModel = new PolicyAssignmentV1Collection(); + assertNull(policyAssignmentV1CollectionModel.getLimit()); + assertNull(policyAssignmentV1CollectionModel.getFirst()); + assertNull(policyAssignmentV1CollectionModel.getNext()); + assertNull(policyAssignmentV1CollectionModel.getPrevious()); + assertNull(policyAssignmentV1CollectionModel.getAssignments()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java new file mode 100644 index 00000000000..56c843a232e --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Resources model. + */ +public class PolicyAssignmentV1ResourcesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentV1Resources() throws Throwable { + PolicyAssignmentV1Resources policyAssignmentV1ResourcesModel = new PolicyAssignmentV1Resources(); + assertNull(policyAssignmentV1ResourcesModel.getTarget()); + assertNull(policyAssignmentV1ResourcesModel.getPolicy()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java new file mode 100644 index 00000000000..f5d14b29447 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java @@ -0,0 +1,36 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Subject model. + */ +public class PolicyAssignmentV1SubjectTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentV1Subject() throws Throwable { + PolicyAssignmentV1Subject policyAssignmentV1SubjectModel = new PolicyAssignmentV1Subject(); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java new file mode 100644 index 00000000000..d9889483421 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1 model. + */ +public class PolicyAssignmentV1Test { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyAssignmentV1() throws Throwable { + PolicyAssignmentV1 policyAssignmentV1Model = new PolicyAssignmentV1(); + assertNull(policyAssignmentV1Model.getTarget()); + assertNull(policyAssignmentV1Model.getResources()); + assertNull(policyAssignmentV1Model.getSubject()); + assertNull(policyAssignmentV1Model.getTemplate()); + assertNull(policyAssignmentV1Model.getStatus()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java new file mode 100644 index 00000000000..3d372dfaf20 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java @@ -0,0 +1,52 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyCollection model. + */ +public class PolicyCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyCollection() throws Throwable { + PolicyCollection policyCollectionModel = new PolicyCollection(); + assertNull(policyCollectionModel.getLimit()); + assertNull(policyCollectionModel.getFirst()); + assertNull(policyCollectionModel.getNext()); + assertNull(policyCollectionModel.getPrevious()); + assertNull(policyCollectionModel.getPolicies()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java new file mode 100644 index 00000000000..cb2f203a5c3 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java @@ -0,0 +1,72 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyResource model. + */ +public class PolicyResourceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyResource() throws Throwable { + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceAttributeModel.name(), "testString"); + assertEquals(resourceAttributeModel.value(), "testString"); + assertEquals(resourceAttributeModel.operator(), "testString"); + + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceTagModel.name(), "testString"); + assertEquals(resourceTagModel.value(), "testString"); + assertEquals(resourceTagModel.operator(), "testString"); + + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); + assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); + + String json = TestUtilities.serialize(policyResourceModel); + + PolicyResource policyResourceModelNew = TestUtilities.deserialize(json, PolicyResource.class); + assertTrue(policyResourceModelNew instanceof PolicyResource); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPolicyResourceError() throws Throwable { + new PolicyResource.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java new file mode 100644 index 00000000000..299e15b1fd4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyRole model. + */ +public class PolicyRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyRole() throws Throwable { + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + assertEquals(policyRoleModel.roleId(), "testString"); + + String json = TestUtilities.serialize(policyRoleModel); + + PolicyRole policyRoleModelNew = TestUtilities.deserialize(json, PolicyRole.class); + assertTrue(policyRoleModelNew instanceof PolicyRole); + assertEquals(policyRoleModelNew.roleId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPolicyRoleError() throws Throwable { + new PolicyRole.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java new file mode 100644 index 00000000000..6d0a937bd53 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java @@ -0,0 +1,58 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicySubject model. + */ +public class PolicySubjectTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicySubject() throws Throwable { + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(subjectAttributeModel.name(), "testString"); + assertEquals(subjectAttributeModel.value(), "testString"); + + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); + + String json = TestUtilities.serialize(policySubjectModel); + + PolicySubject policySubjectModelNew = TestUtilities.deserialize(json, PolicySubject.class); + assertTrue(policySubjectModelNew instanceof PolicySubject); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPolicySubjectError() throws Throwable { + new PolicySubject.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java new file mode 100644 index 00000000000..8cb98be3d32 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentCollection model. + */ +public class PolicyTemplateAssignmentCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateAssignmentCollection() throws Throwable { + PolicyTemplateAssignmentCollection policyTemplateAssignmentCollectionModel = new PolicyTemplateAssignmentCollection(); + assertNull(policyTemplateAssignmentCollectionModel.getLimit()); + assertNull(policyTemplateAssignmentCollectionModel.getFirst()); + assertNull(policyTemplateAssignmentCollectionModel.getNext()); + assertNull(policyTemplateAssignmentCollectionModel.getPrevious()); + assertNull(policyTemplateAssignmentCollectionModel.getAssignments()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java new file mode 100644 index 00000000000..fded12633d2 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItemsPolicyAssignment model. + */ +public class PolicyTemplateAssignmentItemsPolicyAssignmentTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateAssignmentItemsPolicyAssignment() throws Throwable { + PolicyTemplateAssignmentItemsPolicyAssignment policyTemplateAssignmentItemsPolicyAssignmentModel = new PolicyTemplateAssignmentItemsPolicyAssignment(); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTemplateId()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTemplateVersion()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getAssignmentId()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTargetType()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTarget()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getResources()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getStatus()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java new file mode 100644 index 00000000000..6b74125d238 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItemsPolicyAssignmentV1 model. + */ +public class PolicyTemplateAssignmentItemsPolicyAssignmentV1Test { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateAssignmentItemsPolicyAssignmentV1() throws Throwable { + PolicyTemplateAssignmentItemsPolicyAssignmentV1 policyTemplateAssignmentItemsPolicyAssignmentV1Model = new PolicyTemplateAssignmentItemsPolicyAssignmentV1(); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getTarget()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getResources()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getSubject()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getTemplate()); + assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getStatus()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java new file mode 100644 index 00000000000..05b400e91c1 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java @@ -0,0 +1,48 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItems model. + */ +public class PolicyTemplateAssignmentItemsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testPolicyTemplateAssignmentItems() throws Throwable { + PolicyTemplateAssignmentItems policyTemplateAssignmentItemsModel = new PolicyTemplateAssignmentItems(); + assertNotNull(policyTemplateAssignmentItemsModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java new file mode 100644 index 00000000000..52041b1a6a3 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateCollection model. + */ +public class PolicyTemplateCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateCollection() throws Throwable { + PolicyTemplateCollection policyTemplateCollectionModel = new PolicyTemplateCollection(); + assertNull(policyTemplateCollectionModel.getLimit()); + assertNull(policyTemplateCollectionModel.getFirst()); + assertNull(policyTemplateCollectionModel.getNext()); + assertNull(policyTemplateCollectionModel.getPrevious()); + assertNull(policyTemplateCollectionModel.getPolicyTemplates()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java new file mode 100644 index 00000000000..b6ee06990a2 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateLimitData model. + */ +public class PolicyTemplateLimitDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateLimitData() throws Throwable { + PolicyTemplateLimitData policyTemplateLimitDataModel = new PolicyTemplateLimitData(); + assertNull(policyTemplateLimitDataModel.getName()); + assertNull(policyTemplateLimitDataModel.getDescription()); + assertNull(policyTemplateLimitDataModel.getAccountId()); + assertNull(policyTemplateLimitDataModel.getVersion()); + assertNull(policyTemplateLimitDataModel.isCommitted()); + assertNull(policyTemplateLimitDataModel.getPolicy()); + assertNull(policyTemplateLimitDataModel.getState()); + assertNull(policyTemplateLimitDataModel.getCounts()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java new file mode 100644 index 00000000000..edeb45c4d96 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java @@ -0,0 +1,50 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateMetaData model. + */ +public class PolicyTemplateMetaDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateMetaData() throws Throwable { + PolicyTemplateMetaData policyTemplateMetaDataModel = new PolicyTemplateMetaData(); + assertNull(policyTemplateMetaDataModel.getType()); + assertNull(policyTemplateMetaDataModel.getDescription()); + assertNull(policyTemplateMetaDataModel.getSubjects()); + assertNull(policyTemplateMetaDataModel.getRoles()); + assertNull(policyTemplateMetaDataModel.getResources()); + assertNull(policyTemplateMetaDataModel.getState()); + assertNull(policyTemplateMetaDataModel.getTemplate()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java new file mode 100644 index 00000000000..c349e4a3415 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplate model. + */ +public class PolicyTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplate() throws Throwable { + PolicyTemplate policyTemplateModel = new PolicyTemplate(); + assertNull(policyTemplateModel.getName()); + assertNull(policyTemplateModel.getDescription()); + assertNull(policyTemplateModel.getAccountId()); + assertNull(policyTemplateModel.getVersion()); + assertNull(policyTemplateModel.isCommitted()); + assertNull(policyTemplateModel.getPolicy()); + assertNull(policyTemplateModel.getState()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java new file mode 100644 index 00000000000..da651956461 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateVersionsCollection model. + */ +public class PolicyTemplateVersionsCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyTemplateVersionsCollection() throws Throwable { + PolicyTemplateVersionsCollection policyTemplateVersionsCollectionModel = new PolicyTemplateVersionsCollection(); + assertNull(policyTemplateVersionsCollectionModel.getLimit()); + assertNull(policyTemplateVersionsCollectionModel.getFirst()); + assertNull(policyTemplateVersionsCollectionModel.getNext()); + assertNull(policyTemplateVersionsCollectionModel.getPrevious()); + assertNull(policyTemplateVersionsCollectionModel.getVersions()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java new file mode 100644 index 00000000000..28eba4f9a85 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java @@ -0,0 +1,48 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 Policy model. + */ +public class PolicyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicy() throws Throwable { + Policy policyModel = new Policy(); + assertNull(policyModel.getType()); + assertNull(policyModel.getDescription()); + assertNull(policyModel.getSubjects()); + assertNull(policyModel.getRoles()); + assertNull(policyModel.getResources()); + assertNull(policyModel.getState()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java new file mode 100644 index 00000000000..e3788c51212 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.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 Previous model. + */ +public class PreviousTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPrevious() throws Throwable { + Previous previousModel = new Previous(); + assertNull(previousModel.getStart()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java new file mode 100644 index 00000000000..430f5f63764 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java @@ -0,0 +1,67 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceActionControlTemplateOptions model. + */ +public class ReplaceActionControlTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplaceActionControlTemplateOptions() throws Throwable { + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateActionControlModel.serviceName(), "testString"); + assertEquals(templateActionControlModel.description(), "testString"); + assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); + + ReplaceActionControlTemplateOptions replaceActionControlTemplateOptionsModel = new ReplaceActionControlTemplateOptions.Builder() + .actionControlTemplateId("testString") + .version("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .actionControl(templateActionControlModel) + .committed(true) + .build(); + assertEquals(replaceActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.version(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.ifMatch(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.name(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.description(), "testString"); + assertEquals(replaceActionControlTemplateOptionsModel.actionControl(), templateActionControlModel); + assertEquals(replaceActionControlTemplateOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceActionControlTemplateOptionsError() throws Throwable { + new ReplaceActionControlTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java new file mode 100644 index 00000000000..2f20b05f37c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java @@ -0,0 +1,105 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplacePolicyOptions model. + */ +public class ReplacePolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplacePolicyOptions() throws Throwable { + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(subjectAttributeModel.name(), "testString"); + assertEquals(subjectAttributeModel.value(), "testString"); + + PolicySubject policySubjectModel = new PolicySubject.Builder() + .attributes(java.util.Arrays.asList(subjectAttributeModel)) + .build(); + assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); + + PolicyRole policyRoleModel = new PolicyRole.Builder() + .roleId("testString") + .build(); + assertEquals(policyRoleModel.roleId(), "testString"); + + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceAttributeModel.name(), "testString"); + assertEquals(resourceAttributeModel.value(), "testString"); + assertEquals(resourceAttributeModel.operator(), "testString"); + + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceTagModel.name(), "testString"); + assertEquals(resourceTagModel.value(), "testString"); + assertEquals(resourceTagModel.operator(), "testString"); + + PolicyResource policyResourceModel = new PolicyResource.Builder() + .attributes(java.util.Arrays.asList(resourceAttributeModel)) + .tags(java.util.Arrays.asList(resourceTagModel)) + .build(); + assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); + assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); + + ReplacePolicyOptions replacePolicyOptionsModel = new ReplacePolicyOptions.Builder() + .policyId("testString") + .ifMatch("testString") + .type("testString") + .subjects(java.util.Arrays.asList(policySubjectModel)) + .roles(java.util.Arrays.asList(policyRoleModel)) + .resources(java.util.Arrays.asList(policyResourceModel)) + .description("testString") + .build(); + assertEquals(replacePolicyOptionsModel.policyId(), "testString"); + assertEquals(replacePolicyOptionsModel.ifMatch(), "testString"); + assertEquals(replacePolicyOptionsModel.type(), "testString"); + assertEquals(replacePolicyOptionsModel.subjects(), java.util.Arrays.asList(policySubjectModel)); + assertEquals(replacePolicyOptionsModel.roles(), java.util.Arrays.asList(policyRoleModel)); + assertEquals(replacePolicyOptionsModel.resources(), java.util.Arrays.asList(policyResourceModel)); + assertEquals(replacePolicyOptionsModel.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplacePolicyOptionsError() throws Throwable { + new ReplacePolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java new file mode 100644 index 00000000000..2dc2430daca --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java @@ -0,0 +1,147 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplacePolicyTemplateOptions model. + */ +public class ReplacePolicyTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplacePolicyTemplateOptions() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + assertEquals(templatePolicyModel.type(), "access"); + assertEquals(templatePolicyModel.description(), "testString"); + assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); + assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); + assertEquals(templatePolicyModel.pattern(), "testString"); + assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); + assertEquals(templatePolicyModel.control(), templateControlModel); + + ReplacePolicyTemplateOptions replacePolicyTemplateOptionsModel = new ReplacePolicyTemplateOptions.Builder() + .policyTemplateId("testString") + .version("testString") + .ifMatch("testString") + .policy(templatePolicyModel) + .name("testString") + .description("testString") + .committed(true) + .build(); + assertEquals(replacePolicyTemplateOptionsModel.policyTemplateId(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.version(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.ifMatch(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.policy(), templatePolicyModel); + assertEquals(replacePolicyTemplateOptionsModel.name(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.description(), "testString"); + assertEquals(replacePolicyTemplateOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplacePolicyTemplateOptionsError() throws Throwable { + new ReplacePolicyTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java new file mode 100644 index 00000000000..9900abb2543 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java @@ -0,0 +1,53 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceRoleOptions model. + */ +public class ReplaceRoleOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplaceRoleOptions() throws Throwable { + ReplaceRoleOptions replaceRoleOptionsModel = new ReplaceRoleOptions.Builder() + .roleId("testString") + .ifMatch("testString") + .displayName("testString") + .actions(java.util.Arrays.asList("testString")) + .description("testString") + .build(); + assertEquals(replaceRoleOptionsModel.roleId(), "testString"); + assertEquals(replaceRoleOptionsModel.ifMatch(), "testString"); + assertEquals(replaceRoleOptionsModel.displayName(), "testString"); + assertEquals(replaceRoleOptionsModel.actions(), java.util.Arrays.asList("testString")); + assertEquals(replaceRoleOptionsModel.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceRoleOptionsError() throws Throwable { + new ReplaceRoleOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java new file mode 100644 index 00000000000..2f731aea7d4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceRoleTemplateOptions model. + */ +public class ReplaceRoleTemplateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplaceRoleTemplateOptions() throws Throwable { + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateRoleModel.displayName(), "testString"); + assertEquals(templateRoleModel.serviceName(), "testString"); + assertEquals(templateRoleModel.description(), "testString"); + assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); + + ReplaceRoleTemplateOptions replaceRoleTemplateOptionsModel = new ReplaceRoleTemplateOptions.Builder() + .roleTemplateId("testString") + .version("testString") + .ifMatch("testString") + .name("testString") + .description("testString") + .role(templateRoleModel) + .committed(true) + .build(); + assertEquals(replaceRoleTemplateOptionsModel.roleTemplateId(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.version(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.ifMatch(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.name(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.description(), "testString"); + assertEquals(replaceRoleTemplateOptionsModel.role(), templateRoleModel); + assertEquals(replaceRoleTemplateOptionsModel.committed(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceRoleTemplateOptionsError() throws Throwable { + new ReplaceRoleTemplateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java new file mode 100644 index 00000000000..23690eda780 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java @@ -0,0 +1,133 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceV2PolicyOptions model. + */ +public class ReplaceV2PolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplaceV2PolicyOptions() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + Grant grantModel = new Grant.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); + + Control controlModel = new Control.Builder() + .grant(grantModel) + .build(); + assertEquals(controlModel.grant(), grantModel); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + ReplaceV2PolicyOptions replaceV2PolicyOptionsModel = new ReplaceV2PolicyOptions.Builder() + .id("testString") + .ifMatch("testString") + .control(controlModel) + .type("access") + .description("testString") + .subject(v2PolicySubjectModel) + .resource(v2PolicyResourceModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .build(); + assertEquals(replaceV2PolicyOptionsModel.id(), "testString"); + assertEquals(replaceV2PolicyOptionsModel.ifMatch(), "testString"); + assertEquals(replaceV2PolicyOptionsModel.control(), controlModel); + assertEquals(replaceV2PolicyOptionsModel.type(), "access"); + assertEquals(replaceV2PolicyOptionsModel.description(), "testString"); + assertEquals(replaceV2PolicyOptionsModel.subject(), v2PolicySubjectModel); + assertEquals(replaceV2PolicyOptionsModel.resource(), v2PolicyResourceModel); + assertEquals(replaceV2PolicyOptionsModel.pattern(), "testString"); + assertEquals(replaceV2PolicyOptionsModel.rule(), v2PolicyRuleModel); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceV2PolicyOptionsError() throws Throwable { + new ReplaceV2PolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java new file mode 100644 index 00000000000..bd50b514f43 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 ResourceAttribute model. + */ +public class ResourceAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testResourceAttribute() throws Throwable { + ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceAttributeModel.name(), "testString"); + assertEquals(resourceAttributeModel.value(), "testString"); + assertEquals(resourceAttributeModel.operator(), "testString"); + + String json = TestUtilities.serialize(resourceAttributeModel); + + ResourceAttribute resourceAttributeModelNew = TestUtilities.deserialize(json, ResourceAttribute.class); + assertTrue(resourceAttributeModelNew instanceof ResourceAttribute); + assertEquals(resourceAttributeModelNew.name(), "testString"); + assertEquals(resourceAttributeModelNew.value(), "testString"); + assertEquals(resourceAttributeModelNew.operator(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testResourceAttributeError() throws Throwable { + new ResourceAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java new file mode 100644 index 00000000000..88a1eb5d5b6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.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 ResourceTag model. + */ +public class ResourceTagTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testResourceTag() throws Throwable { + ResourceTag resourceTagModel = new ResourceTag.Builder() + .name("testString") + .value("testString") + .operator("testString") + .build(); + assertEquals(resourceTagModel.name(), "testString"); + assertEquals(resourceTagModel.value(), "testString"); + assertEquals(resourceTagModel.operator(), "testString"); + + String json = TestUtilities.serialize(resourceTagModel); + + ResourceTag resourceTagModelNew = TestUtilities.deserialize(json, ResourceTag.class); + assertTrue(resourceTagModelNew instanceof ResourceTag); + assertEquals(resourceTagModelNew.name(), "testString"); + assertEquals(resourceTagModelNew.value(), "testString"); + assertEquals(resourceTagModelNew.operator(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testResourceTagError() throws Throwable { + new ResourceTag.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java new file mode 100644 index 00000000000..e4c0bcc6f92 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAction model. + */ +public class RoleActionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAction() throws Throwable { + RoleAction roleActionModel = new RoleAction(); + assertNull(roleActionModel.getId()); + assertNull(roleActionModel.getDisplayName()); + assertNull(roleActionModel.getDescription()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java new file mode 100644 index 00000000000..42801bc7771 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java @@ -0,0 +1,47 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentCollection model. + */ +public class RoleAssignmentCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentCollection() throws Throwable { + RoleAssignmentCollection roleAssignmentCollectionModel = new RoleAssignmentCollection(); + assertNull(roleAssignmentCollectionModel.getLimit()); + assertNull(roleAssignmentCollectionModel.getFirst()); + assertNull(roleAssignmentCollectionModel.getNext()); + assertNull(roleAssignmentCollectionModel.getPrevious()); + assertNull(roleAssignmentCollectionModel.getAssignments()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java new file mode 100644 index 00000000000..bef8b71b0fa --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java @@ -0,0 +1,37 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResourceCreated model. + */ +public class RoleAssignmentResourceCreatedTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentResourceCreated() throws Throwable { + RoleAssignmentResourceCreated roleAssignmentResourceCreatedModel = new RoleAssignmentResourceCreated(); + assertNull(roleAssignmentResourceCreatedModel.getId()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java new file mode 100644 index 00000000000..c346ca0f48f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java @@ -0,0 +1,43 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResourceRole model. + */ +public class RoleAssignmentResourceRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentResourceRole() throws Throwable { + RoleAssignmentResourceRole roleAssignmentResourceRoleModel = new RoleAssignmentResourceRole(); + assertNull(roleAssignmentResourceRoleModel.getResourceCreated()); + assertNull(roleAssignmentResourceRoleModel.getErrorMessage()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java new file mode 100644 index 00000000000..4fca1b25b5b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResource model. + */ +public class RoleAssignmentResourceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentResource() throws Throwable { + RoleAssignmentResource roleAssignmentResourceModel = new RoleAssignmentResource(); + assertNull(roleAssignmentResourceModel.getTarget()); + assertNull(roleAssignmentResourceModel.getRole()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java new file mode 100644 index 00000000000..4f2e3a37200 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentTemplate model. + */ +public class RoleAssignmentTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignmentTemplate() throws Throwable { + RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleAssignmentTemplateModel.id(), "testString"); + assertEquals(roleAssignmentTemplateModel.version(), "testString"); + + String json = TestUtilities.serialize(roleAssignmentTemplateModel); + + RoleAssignmentTemplate roleAssignmentTemplateModelNew = TestUtilities.deserialize(json, RoleAssignmentTemplate.class); + assertTrue(roleAssignmentTemplateModelNew instanceof RoleAssignmentTemplate); + assertEquals(roleAssignmentTemplateModelNew.id(), "testString"); + assertEquals(roleAssignmentTemplateModelNew.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRoleAssignmentTemplateError() throws Throwable { + new RoleAssignmentTemplate.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java new file mode 100644 index 00000000000..bd3bda7ce24 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignment model. + */ +public class RoleAssignmentTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleAssignment() throws Throwable { + RoleAssignment roleAssignmentModel = new RoleAssignment(); + assertNull(roleAssignmentModel.getTemplate()); + assertNull(roleAssignmentModel.getTarget()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java new file mode 100644 index 00000000000..812c2dcb131 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java @@ -0,0 +1,41 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleCollection model. + */ +public class RoleCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleCollection() throws Throwable { + RoleCollection roleCollectionModel = new RoleCollection(); + assertNull(roleCollectionModel.getCustomRoles()); + assertNull(roleCollectionModel.getServiceRoles()); + assertNull(roleCollectionModel.getSystemRoles()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java new file mode 100644 index 00000000000..fde4d11ff4c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java @@ -0,0 +1,46 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateCollection model. + */ +public class RoleTemplateCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplateCollection() throws Throwable { + RoleTemplateCollection roleTemplateCollectionModel = new RoleTemplateCollection(); + assertNull(roleTemplateCollectionModel.getLimit()); + assertNull(roleTemplateCollectionModel.getFirst()); + assertNull(roleTemplateCollectionModel.getNext()); + assertNull(roleTemplateCollectionModel.getPrevious()); + assertNull(roleTemplateCollectionModel.getRoleTemplates()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java new file mode 100644 index 00000000000..6c208e1c38f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java @@ -0,0 +1,62 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplatePrototypeRole model. + */ +public class RoleTemplatePrototypeRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplatePrototypeRole() throws Throwable { + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() + .name("testString") + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(roleTemplatePrototypeRoleModel.name(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.displayName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.serviceName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.description(), "testString"); + assertEquals(roleTemplatePrototypeRoleModel.actions(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(roleTemplatePrototypeRoleModel); + + RoleTemplatePrototypeRole roleTemplatePrototypeRoleModelNew = TestUtilities.deserialize(json, RoleTemplatePrototypeRole.class); + assertTrue(roleTemplatePrototypeRoleModelNew instanceof RoleTemplatePrototypeRole); + assertEquals(roleTemplatePrototypeRoleModelNew.name(), "testString"); + assertEquals(roleTemplatePrototypeRoleModelNew.displayName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModelNew.serviceName(), "testString"); + assertEquals(roleTemplatePrototypeRoleModelNew.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRoleTemplatePrototypeRoleError() throws Throwable { + new RoleTemplatePrototypeRole.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java new file mode 100644 index 00000000000..af9de718e23 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateReferencesItem model. + */ +public class RoleTemplateReferencesItemTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplateReferencesItem() throws Throwable { + RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleTemplateReferencesItemModel.id(), "testString"); + assertEquals(roleTemplateReferencesItemModel.version(), "testString"); + + String json = TestUtilities.serialize(roleTemplateReferencesItemModel); + + RoleTemplateReferencesItem roleTemplateReferencesItemModelNew = TestUtilities.deserialize(json, RoleTemplateReferencesItem.class); + assertTrue(roleTemplateReferencesItemModelNew instanceof RoleTemplateReferencesItem); + assertEquals(roleTemplateReferencesItemModelNew.id(), "testString"); + assertEquals(roleTemplateReferencesItemModelNew.version(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRoleTemplateReferencesItemError() throws Throwable { + new RoleTemplateReferencesItem.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java new file mode 100644 index 00000000000..8bb27d8dd62 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java @@ -0,0 +1,44 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplate model. + */ +public class RoleTemplateTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplate() throws Throwable { + RoleTemplate roleTemplateModel = new RoleTemplate(); + assertNull(roleTemplateModel.getName()); + assertNull(roleTemplateModel.getDescription()); + assertNull(roleTemplateModel.getAccountId()); + assertNull(roleTemplateModel.isCommitted()); + assertNull(roleTemplateModel.getRole()); + assertNull(roleTemplateModel.getVersion()); + assertNull(roleTemplateModel.getState()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java new file mode 100644 index 00000000000..068cf309bd6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java @@ -0,0 +1,46 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; +import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateVersionsCollection model. + */ +public class RoleTemplateVersionsCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoleTemplateVersionsCollection() throws Throwable { + RoleTemplateVersionsCollection roleTemplateVersionsCollectionModel = new RoleTemplateVersionsCollection(); + assertNull(roleTemplateVersionsCollectionModel.getLimit()); + assertNull(roleTemplateVersionsCollectionModel.getFirst()); + assertNull(roleTemplateVersionsCollectionModel.getNext()); + assertNull(roleTemplateVersionsCollectionModel.getPrevious()); + assertNull(roleTemplateVersionsCollectionModel.getVersions()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java new file mode 100644 index 00000000000..a632e63587f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; +import com.ibm.cloud.platform_services.iam_policy_management.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 Role model. + */ +public class RoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRole() throws Throwable { + Role roleModel = new Role.Builder() + .displayName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(roleModel.displayName(), "testString"); + assertEquals(roleModel.description(), "testString"); + assertEquals(roleModel.actions(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(roleModel); + + Role roleModelNew = TestUtilities.deserialize(json, Role.class); + assertTrue(roleModelNew instanceof Role); + assertEquals(roleModelNew.displayName(), "testString"); + assertEquals(roleModelNew.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRoleError() throws Throwable { + new Role.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java new file mode 100644 index 00000000000..8383ef794a9 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.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 Roles model. + */ +public class RolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRoles() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + String json = TestUtilities.serialize(rolesModel); + + Roles rolesModelNew = TestUtilities.deserialize(json, Roles.class); + assertTrue(rolesModelNew instanceof Roles); + assertEquals(rolesModelNew.roleId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRolesError() throws Throwable { + new Roles.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java new file mode 100644 index 00000000000..a05e5ee8704 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 RuleAttribute model. + */ +public class RuleAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRuleAttribute() throws Throwable { + RuleAttribute ruleAttributeModel = new RuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(ruleAttributeModel.key(), "testString"); + assertEquals(ruleAttributeModel.operator(), "stringEquals"); + assertEquals(ruleAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(ruleAttributeModel); + + RuleAttribute ruleAttributeModelNew = TestUtilities.deserialize(json, RuleAttribute.class); + assertTrue(ruleAttributeModelNew instanceof RuleAttribute); + assertEquals(ruleAttributeModelNew.key(), "testString"); + assertEquals(ruleAttributeModelNew.operator(), "stringEquals"); + assertEquals(ruleAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRuleAttributeError() throws Throwable { + new RuleAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java new file mode 100644 index 00000000000..7bae03a42e0 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java @@ -0,0 +1,54 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 SubjectAttribute model. + */ +public class SubjectAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testSubjectAttribute() throws Throwable { + SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(subjectAttributeModel.name(), "testString"); + assertEquals(subjectAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(subjectAttributeModel); + + SubjectAttribute subjectAttributeModelNew = TestUtilities.deserialize(json, SubjectAttribute.class); + assertTrue(subjectAttributeModelNew instanceof SubjectAttribute); + assertEquals(subjectAttributeModelNew.name(), "testString"); + assertEquals(subjectAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testSubjectAttributeError() throws Throwable { + new SubjectAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java new file mode 100644 index 00000000000..d3a6d4ef53a --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateActionControl model. + */ +public class TemplateActionControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateActionControl() throws Throwable { + TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateActionControlModel.serviceName(), "testString"); + assertEquals(templateActionControlModel.description(), "testString"); + assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(templateActionControlModel); + + TemplateActionControl templateActionControlModelNew = TestUtilities.deserialize(json, TemplateActionControl.class); + assertTrue(templateActionControlModelNew instanceof TemplateActionControl); + assertEquals(templateActionControlModelNew.serviceName(), "testString"); + assertEquals(templateActionControlModelNew.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateActionControlError() throws Throwable { + new TemplateActionControl.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java new file mode 100644 index 00000000000..fba96e64cef --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateControl model. + */ +public class TemplateControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateControl() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + String json = TestUtilities.serialize(templateControlModel); + + TemplateControl templateControlModelNew = TestUtilities.deserialize(json, TemplateControl.class); + assertTrue(templateControlModelNew instanceof TemplateControl); + assertEquals(templateControlModelNew.grant().toString(), templateGrantModel.toString()); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateControlError() throws Throwable { + new TemplateControl.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java new file mode 100644 index 00000000000..b440cf19100 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateCountData model. + */ +public class TemplateCountDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateCountData() throws Throwable { + TemplateCountData templateCountDataModel = new TemplateCountData(); + assertNull(templateCountDataModel.getTemplate()); + assertNull(templateCountDataModel.getVersion()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java new file mode 100644 index 00000000000..e7759eacc21 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java @@ -0,0 +1,58 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoleReferences; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrantRoleReferences model. + */ +public class TemplateGrantRoleReferencesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateGrantRoleReferences() throws Throwable { + RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() + .id("testString") + .version("testString") + .build(); + assertEquals(roleTemplateReferencesItemModel.id(), "testString"); + assertEquals(roleTemplateReferencesItemModel.version(), "testString"); + + TemplateGrantRoleReferences templateGrantRoleReferencesModel = new TemplateGrantRoleReferences.Builder() + .roleTemplateReferences(java.util.Arrays.asList(roleTemplateReferencesItemModel)) + .build(); + assertEquals(templateGrantRoleReferencesModel.roleTemplateReferences(), java.util.Arrays.asList(roleTemplateReferencesItemModel)); + + String json = TestUtilities.serialize(templateGrantRoleReferencesModel); + + TemplateGrantRoleReferences templateGrantRoleReferencesModelNew = TestUtilities.deserialize(json, TemplateGrantRoleReferences.class); + assertTrue(templateGrantRoleReferencesModelNew instanceof TemplateGrantRoleReferences); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateGrantRoleReferencesError() throws Throwable { + new TemplateGrantRoleReferences.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java new file mode 100644 index 00000000000..8cddc6f9a19 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java @@ -0,0 +1,56 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrantRoles model. + */ +public class TemplateGrantRolesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateGrantRoles() throws Throwable { + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantRolesModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantRolesModel.roles(), java.util.Arrays.asList(rolesModel)); + + String json = TestUtilities.serialize(templateGrantRolesModel); + + TemplateGrantRoles templateGrantRolesModelNew = TestUtilities.deserialize(json, TemplateGrantRoles.class); + assertTrue(templateGrantRolesModelNew instanceof TemplateGrantRoles); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateGrantRolesError() throws Throwable { + new TemplateGrantRoles.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java new file mode 100644 index 00000000000..90e6fdc2b9f --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrant model. + */ +public class TemplateGrantTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testTemplateGrant() throws Throwable { + TemplateGrant templateGrantModel = new TemplateGrant(); + assertNotNull(templateGrantModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java new file mode 100644 index 00000000000..c2688232e2b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java @@ -0,0 +1,41 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateMetadata model. + */ +public class TemplateMetadataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateMetadata() throws Throwable { + TemplateMetadata templateMetadataModel = new TemplateMetadata(); + assertNull(templateMetadataModel.getId()); + assertNull(templateMetadataModel.getVersion()); + assertNull(templateMetadataModel.getAssignmentId()); + assertNull(templateMetadataModel.getRootId()); + assertNull(templateMetadataModel.getRootVersion()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java new file mode 100644 index 00000000000..0e256ffd599 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplatePolicy model. + */ +public class TemplatePolicyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplatePolicy() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleModel.key(), "testString"); + assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleModel.value(), "testString"); + + Roles rolesModel = new Roles.Builder() + .roleId("testString") + .build(); + assertEquals(rolesModel.roleId(), "testString"); + + TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() + .roles(java.util.Arrays.asList(rolesModel)) + .build(); + assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); + + TemplateControl templateControlModel = new TemplateControl.Builder() + .grant(templateGrantModel) + .build(); + assertEquals(templateControlModel.grant(), templateGrantModel); + + TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() + .type("access") + .description("testString") + .resource(v2PolicyResourceModel) + .subject(v2PolicySubjectModel) + .pattern("testString") + .rule(v2PolicyRuleModel) + .control(templateControlModel) + .build(); + assertEquals(templatePolicyModel.type(), "access"); + assertEquals(templatePolicyModel.description(), "testString"); + assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); + assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); + assertEquals(templatePolicyModel.pattern(), "testString"); + assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); + assertEquals(templatePolicyModel.control(), templateControlModel); + + String json = TestUtilities.serialize(templatePolicyModel); + + TemplatePolicy templatePolicyModelNew = TestUtilities.deserialize(json, TemplatePolicy.class); + assertTrue(templatePolicyModelNew instanceof TemplatePolicy); + assertEquals(templatePolicyModelNew.type(), "access"); + assertEquals(templatePolicyModelNew.description(), "testString"); + assertEquals(templatePolicyModelNew.resource().toString(), v2PolicyResourceModel.toString()); + assertEquals(templatePolicyModelNew.subject().toString(), v2PolicySubjectModel.toString()); + assertEquals(templatePolicyModelNew.pattern(), "testString"); + assertEquals(templatePolicyModelNew.rule().toString(), v2PolicyRuleModel.toString()); + assertEquals(templatePolicyModelNew.control().toString(), templateControlModel.toString()); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplatePolicyError() throws Throwable { + new TemplatePolicy.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java new file mode 100644 index 00000000000..1735364bc85 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java @@ -0,0 +1,59 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; +import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateRole model. + */ +public class TemplateRoleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTemplateRole() throws Throwable { + TemplateRole templateRoleModel = new TemplateRole.Builder() + .displayName("testString") + .serviceName("testString") + .description("testString") + .actions(java.util.Arrays.asList("testString")) + .build(); + assertEquals(templateRoleModel.displayName(), "testString"); + assertEquals(templateRoleModel.serviceName(), "testString"); + assertEquals(templateRoleModel.description(), "testString"); + assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(templateRoleModel); + + TemplateRole templateRoleModelNew = TestUtilities.deserialize(json, TemplateRole.class); + assertTrue(templateRoleModelNew instanceof TemplateRole); + assertEquals(templateRoleModelNew.displayName(), "testString"); + assertEquals(templateRoleModelNew.serviceName(), "testString"); + assertEquals(templateRoleModelNew.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTemplateRoleError() throws Throwable { + new TemplateRole.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java new file mode 100644 index 00000000000..df7a09c2829 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateActionControlAssignmentOptions model. + */ +public class UpdateActionControlAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateActionControlAssignmentOptions() throws Throwable { + UpdateActionControlAssignmentOptions updateActionControlAssignmentOptionsModel = new UpdateActionControlAssignmentOptions.Builder() + .assignmentId("testString") + .ifMatch("testString") + .templateVersion("testString") + .build(); + assertEquals(updateActionControlAssignmentOptionsModel.assignmentId(), "testString"); + assertEquals(updateActionControlAssignmentOptionsModel.ifMatch(), "testString"); + assertEquals(updateActionControlAssignmentOptionsModel.templateVersion(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateActionControlAssignmentOptionsError() throws Throwable { + new UpdateActionControlAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java new file mode 100644 index 00000000000..0008325ffcf --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdatePolicyAssignmentOptions model. + */ +public class UpdatePolicyAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdatePolicyAssignmentOptions() throws Throwable { + UpdatePolicyAssignmentOptions updatePolicyAssignmentOptionsModel = new UpdatePolicyAssignmentOptions.Builder() + .assignmentId("testString") + .version("1.0") + .ifMatch("testString") + .templateVersion("testString") + .build(); + assertEquals(updatePolicyAssignmentOptionsModel.assignmentId(), "testString"); + assertEquals(updatePolicyAssignmentOptionsModel.version(), "1.0"); + assertEquals(updatePolicyAssignmentOptionsModel.ifMatch(), "testString"); + assertEquals(updatePolicyAssignmentOptionsModel.templateVersion(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdatePolicyAssignmentOptionsError() throws Throwable { + new UpdatePolicyAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java new file mode 100644 index 00000000000..de000e8c745 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdatePolicyStateOptions model. + */ +public class UpdatePolicyStateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdatePolicyStateOptions() throws Throwable { + UpdatePolicyStateOptions updatePolicyStateOptionsModel = new UpdatePolicyStateOptions.Builder() + .policyId("testString") + .ifMatch("testString") + .state("active") + .build(); + assertEquals(updatePolicyStateOptionsModel.policyId(), "testString"); + assertEquals(updatePolicyStateOptionsModel.ifMatch(), "testString"); + assertEquals(updatePolicyStateOptionsModel.state(), "active"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdatePolicyStateOptionsError() throws Throwable { + new UpdatePolicyStateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java new file mode 100644 index 00000000000..879c3d5f456 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateRoleAssignmentOptions model. + */ +public class UpdateRoleAssignmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateRoleAssignmentOptions() throws Throwable { + UpdateRoleAssignmentOptions updateRoleAssignmentOptionsModel = new UpdateRoleAssignmentOptions.Builder() + .assignmentId("testString") + .ifMatch("testString") + .templateVersion("testString") + .build(); + assertEquals(updateRoleAssignmentOptionsModel.assignmentId(), "testString"); + assertEquals(updateRoleAssignmentOptionsModel.ifMatch(), "testString"); + assertEquals(updateRoleAssignmentOptionsModel.templateVersion(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateRoleAssignmentOptionsError() throws Throwable { + new UpdateRoleAssignmentOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java new file mode 100644 index 00000000000..1d69d016781 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java @@ -0,0 +1,75 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; +import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateSettingsOptions model. + */ +public class UpdateSettingsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateSettingsOptions() throws Throwable { + IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() + .state("enabled") + .externalAllowedAccounts(java.util.Arrays.asList("testString")) + .build(); + assertEquals(identityTypesBaseModel.state(), "enabled"); + assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); + + IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() + .user(identityTypesBaseModel) + .serviceId(identityTypesBaseModel) + .service(identityTypesBaseModel) + .build(); + assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); + assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); + + ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() + .identityTypes(identityTypesPatchModel) + .build(); + assertEquals(externalAccountIdentityInteractionPatchModel.identityTypes(), identityTypesPatchModel); + + UpdateSettingsOptions updateSettingsOptionsModel = new UpdateSettingsOptions.Builder() + .accountId("testString") + .ifMatch("testString") + .externalAccountIdentityInteraction(externalAccountIdentityInteractionPatchModel) + .acceptLanguage("default") + .build(); + assertEquals(updateSettingsOptionsModel.accountId(), "testString"); + assertEquals(updateSettingsOptionsModel.ifMatch(), "testString"); + assertEquals(updateSettingsOptionsModel.externalAccountIdentityInteraction(), externalAccountIdentityInteractionPatchModel); + assertEquals(updateSettingsOptionsModel.acceptLanguage(), "default"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateSettingsOptionsError() throws Throwable { + new UpdateSettingsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java new file mode 100644 index 00000000000..aff020c8985 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyCollection model. + */ +public class V2PolicyCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyCollection() throws Throwable { + V2PolicyCollection v2PolicyCollectionModel = new V2PolicyCollection(); + assertNull(v2PolicyCollectionModel.getLimit()); + assertNull(v2PolicyCollectionModel.getFirst()); + assertNull(v2PolicyCollectionModel.getNext()); + assertNull(v2PolicyCollectionModel.getPrevious()); + assertNull(v2PolicyCollectionModel.getPolicies()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java new file mode 100644 index 00000000000..407eaadb155 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResourceAttribute model. + */ +public class V2PolicyResourceAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyResourceAttribute() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(v2PolicyResourceAttributeModel); + + V2PolicyResourceAttribute v2PolicyResourceAttributeModelNew = TestUtilities.deserialize(json, V2PolicyResourceAttribute.class); + assertTrue(v2PolicyResourceAttributeModelNew instanceof V2PolicyResourceAttribute); + assertEquals(v2PolicyResourceAttributeModelNew.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModelNew.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyResourceAttributeError() throws Throwable { + new V2PolicyResourceAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java new file mode 100644 index 00000000000..97c9c813216 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResourceTag model. + */ +public class V2PolicyResourceTagTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyResourceTag() throws Throwable { + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + String json = TestUtilities.serialize(v2PolicyResourceTagModel); + + V2PolicyResourceTag v2PolicyResourceTagModelNew = TestUtilities.deserialize(json, V2PolicyResourceTag.class); + assertTrue(v2PolicyResourceTagModelNew instanceof V2PolicyResourceTag); + assertEquals(v2PolicyResourceTagModelNew.key(), "testString"); + assertEquals(v2PolicyResourceTagModelNew.value(), "testString"); + assertEquals(v2PolicyResourceTagModelNew.operator(), "stringEquals"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyResourceTagError() throws Throwable { + new V2PolicyResourceTag.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java new file mode 100644 index 00000000000..d153fd97be6 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java @@ -0,0 +1,72 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResource model. + */ +public class V2PolicyResourceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyResource() throws Throwable { + V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); + assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); + + V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() + .key("testString") + .value("testString") + .operator("stringEquals") + .build(); + assertEquals(v2PolicyResourceTagModel.key(), "testString"); + assertEquals(v2PolicyResourceTagModel.value(), "testString"); + assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); + + V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() + .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) + .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) + .build(); + assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); + assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); + + String json = TestUtilities.serialize(v2PolicyResourceModel); + + V2PolicyResource v2PolicyResourceModelNew = TestUtilities.deserialize(json, V2PolicyResource.class); + assertTrue(v2PolicyResourceModelNew instanceof V2PolicyResource); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyResourceError() throws Throwable { + new V2PolicyResource.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java new file mode 100644 index 00000000000..6d6da85f2b4 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRuleRuleAttribute model. + */ +public class V2PolicyRuleRuleAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyRuleRuleAttribute() throws Throwable { + V2PolicyRuleRuleAttribute v2PolicyRuleRuleAttributeModel = new V2PolicyRuleRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicyRuleRuleAttributeModel.key(), "testString"); + assertEquals(v2PolicyRuleRuleAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicyRuleRuleAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(v2PolicyRuleRuleAttributeModel); + + V2PolicyRuleRuleAttribute v2PolicyRuleRuleAttributeModelNew = TestUtilities.deserialize(json, V2PolicyRuleRuleAttribute.class); + assertTrue(v2PolicyRuleRuleAttributeModelNew instanceof V2PolicyRuleRuleAttribute); + assertEquals(v2PolicyRuleRuleAttributeModelNew.key(), "testString"); + assertEquals(v2PolicyRuleRuleAttributeModelNew.operator(), "stringEquals"); + assertEquals(v2PolicyRuleRuleAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyRuleRuleAttributeError() throws Throwable { + new V2PolicyRuleRuleAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java new file mode 100644 index 00000000000..fdf25669ef7 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java @@ -0,0 +1,63 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleWithNestedConditions; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRuleRuleWithNestedConditions model. + */ +public class V2PolicyRuleRuleWithNestedConditionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyRuleRuleWithNestedConditions() throws Throwable { + NestedConditionRuleAttribute nestedConditionModel = new NestedConditionRuleAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(nestedConditionModel.key(), "testString"); + assertEquals(nestedConditionModel.operator(), "stringEquals"); + assertEquals(nestedConditionModel.value(), "testString"); + + V2PolicyRuleRuleWithNestedConditions v2PolicyRuleRuleWithNestedConditionsModel = new V2PolicyRuleRuleWithNestedConditions.Builder() + .operator("and") + .conditions(java.util.Arrays.asList(nestedConditionModel)) + .build(); + assertEquals(v2PolicyRuleRuleWithNestedConditionsModel.operator(), "and"); + assertEquals(v2PolicyRuleRuleWithNestedConditionsModel.conditions(), java.util.Arrays.asList(nestedConditionModel)); + + String json = TestUtilities.serialize(v2PolicyRuleRuleWithNestedConditionsModel); + + V2PolicyRuleRuleWithNestedConditions v2PolicyRuleRuleWithNestedConditionsModelNew = TestUtilities.deserialize(json, V2PolicyRuleRuleWithNestedConditions.class); + assertTrue(v2PolicyRuleRuleWithNestedConditionsModelNew instanceof V2PolicyRuleRuleWithNestedConditions); + assertEquals(v2PolicyRuleRuleWithNestedConditionsModelNew.operator(), "and"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicyRuleRuleWithNestedConditionsError() throws Throwable { + new V2PolicyRuleRuleWithNestedConditions.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java new file mode 100644 index 00000000000..e0af599840c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRule; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRule model. + */ +public class V2PolicyRuleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testV2PolicyRule() throws Throwable { + V2PolicyRule v2PolicyRuleModel = new V2PolicyRule(); + assertNotNull(v2PolicyRuleModel); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java new file mode 100644 index 00000000000..a6e8f9d8922 --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicySubjectAttribute model. + */ +public class V2PolicySubjectAttributeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicySubjectAttribute() throws Throwable { + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + String json = TestUtilities.serialize(v2PolicySubjectAttributeModel); + + V2PolicySubjectAttribute v2PolicySubjectAttributeModelNew = TestUtilities.deserialize(json, V2PolicySubjectAttribute.class); + assertTrue(v2PolicySubjectAttributeModelNew instanceof V2PolicySubjectAttribute); + assertEquals(v2PolicySubjectAttributeModelNew.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModelNew.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicySubjectAttributeError() throws Throwable { + new V2PolicySubjectAttribute.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java new file mode 100644 index 00000000000..37adbaff5df --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java @@ -0,0 +1,60 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicySubject model. + */ +public class V2PolicySubjectTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicySubject() throws Throwable { + V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() + .key("testString") + .operator("stringEquals") + .value("testString") + .build(); + assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); + assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); + assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); + + V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() + .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) + .build(); + assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); + + String json = TestUtilities.serialize(v2PolicySubjectModel); + + V2PolicySubject v2PolicySubjectModelNew = TestUtilities.deserialize(json, V2PolicySubject.class); + assertTrue(v2PolicySubjectModelNew instanceof V2PolicySubject); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testV2PolicySubjectError() throws Throwable { + new V2PolicySubject.Builder().build(); + } + +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java new file mode 100644 index 00000000000..2ffbe45575b --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java @@ -0,0 +1,57 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyTemplateMetaData model. + */ +public class V2PolicyTemplateMetaDataTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2PolicyTemplateMetaData() throws Throwable { + V2PolicyTemplateMetaData v2PolicyTemplateMetaDataModel = new V2PolicyTemplateMetaData(); + assertNull(v2PolicyTemplateMetaDataModel.getType()); + assertNull(v2PolicyTemplateMetaDataModel.getDescription()); + assertNull(v2PolicyTemplateMetaDataModel.getSubject()); + assertNull(v2PolicyTemplateMetaDataModel.getResource()); + assertNull(v2PolicyTemplateMetaDataModel.getPattern()); + assertNull(v2PolicyTemplateMetaDataModel.getRule()); + assertNull(v2PolicyTemplateMetaDataModel.getControl()); + assertNull(v2PolicyTemplateMetaDataModel.getState()); + assertNull(v2PolicyTemplateMetaDataModel.getLastPermitAt()); + assertNull(v2PolicyTemplateMetaDataModel.getLastPermitFrequency()); + assertNull(v2PolicyTemplateMetaDataModel.getTemplate()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java new file mode 100644 index 00000000000..1630201062c --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java @@ -0,0 +1,55 @@ +/* + * (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_policy_management.v1.model; + +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; +import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; +import com.ibm.cloud.platform_services.iam_policy_management.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 V2Policy model. + */ +public class V2PolicyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testV2Policy() throws Throwable { + V2Policy v2PolicyModel = new V2Policy(); + assertNull(v2PolicyModel.getType()); + assertNull(v2PolicyModel.getDescription()); + assertNull(v2PolicyModel.getSubject()); + assertNull(v2PolicyModel.getResource()); + assertNull(v2PolicyModel.getPattern()); + assertNull(v2PolicyModel.getRule()); + assertNull(v2PolicyModel.getControl()); + assertNull(v2PolicyModel.getState()); + assertNull(v2PolicyModel.getLastPermitAt()); + assertNull(v2PolicyModel.getLastPermitFrequency()); + } +} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java new file mode 100644 index 00000000000..04aaecc16ae --- /dev/null +++ b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java @@ -0,0 +1,131 @@ +/* + * (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_policy_management.v1.utils; + +import java.util.Base64; +import java.util.Map; +import java.util.Set; +import java.util.List; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.io.InputStream; +import java.io.ByteArrayInputStream; + +import okhttp3.mockwebserver.RecordedRequest; +import okhttp3.HttpUrl; +import com.ibm.cloud.sdk.core.util.DateUtils; +import com.ibm.cloud.sdk.core.util.GsonSingleton; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; + +/** + * A class used by the unit tests containing utility functions. + */ +public class TestUtilities { + public static Map createMockMap() { + Map mockMap = new HashMap<>(); + mockMap.put("foo", "bar"); + return mockMap; + } + + public static HashMap createMockStreamMap() { + return new HashMap() { + { put("key1", createMockStream("This is a mock file.")); } + }; + } + + public static Map parseQueryString(RecordedRequest req) { + Map queryMap = new HashMap<>(); + + try { + HttpUrl requestUrl = req.getRequestUrl(); + + if (requestUrl != null) { + Set queryParamsNames = requestUrl.queryParameterNames(); + // map the parameter name to its corresponding value + for (String p : queryParamsNames) { + // get the corresponding value for the parameter (p) + List val = requestUrl.queryParameterValues(p); + if (val != null && !val.isEmpty()) { + String joinedQuery = String.join(",", val); + queryMap.put(p, joinedQuery); + } + } + } + if (queryMap.isEmpty()) { + return null; + } + } catch (Exception e) { + return null; + } + + return queryMap; + } + + public static String parseReqPath(RecordedRequest req) { + String parsedPath = null; + + try { + String fullPath = req.getPath(); + if (fullPath != null && !fullPath.isEmpty()) { + // retrieve the path segment before the query parameter + parsedPath = fullPath.split("\\?", 2)[0]; + } + if (parsedPath.isEmpty() || parsedPath == null) { + return null; + } + + } catch (Exception e) { + return null; + } + + return parsedPath; + } + + public static String serialize(Object obj) { + return GsonSingleton.getGson().toJson(obj); + } + + public static T deserialize(String json, Class clazz) { + return GsonSingleton.getGson().fromJson(json, clazz); + } + + public static InputStream createMockStream(String s) { + return new ByteArrayInputStream(s.getBytes()); + } + + public static List creatMockListFileWithMetadata() { + List list = new ArrayList(); + byte[] fileBytes = {(byte) 0xde, (byte) 0xad, (byte) 0xbe, (byte) 0xef}; + InputStream inputStream = new ByteArrayInputStream(fileBytes); + FileWithMetadata.Builder builder = new FileWithMetadata.Builder(); + builder.data(inputStream); + FileWithMetadata fileWithMetadata = builder.build(); + list.add(fileWithMetadata); + + return list; + } + + public static byte[] createMockByteArray(String encodedString) throws Exception { + return Base64.getDecoder().decode(encodedString); + } + + public static Date createMockDate(String date) throws Exception { + return DateUtils.parseAsDate(date); + } + + public static Date createMockDateTime(String date) throws Exception { + return DateUtils.parseAsDateTime(date); + } +} \ No newline at end of file From be03467642e857bad18db3fe503da4f12d1497c9 Mon Sep 17 00:00:00 2001 From: Bhavana Bellamgari Date: Wed, 10 Dec 2025 15:31:55 +0530 Subject: [PATCH 13/13] Removed the wrongly generated code Signed-off-by: Bhavana Bellamgari Signed-off-by: Bhavana Bellamgari --- .../v1/IamPolicyManagement.java | 2566 --------- .../AccountSettingsAccessManagement.java | 40 - .../v1/model/ActionControlAssignment.java | 207 - .../ActionControlAssignmentCollection.java | 88 - .../ActionControlAssignmentResource.java | 52 - ...ontrolAssignmentResourceActionControl.java | 53 - ...ctionControlAssignmentResourceCreated.java | 38 - .../ActionControlAssignmentTemplate.java | 134 - .../model/ActionControlAssignmentsPager.java | 108 - .../v1/model/ActionControlTemplate.java | 203 - .../ActionControlTemplateCollection.java | 90 - ...tionControlTemplateVersionsCollection.java | 88 - .../ActionControlTemplateVersionsPager.java | 108 - .../v1/model/ActionControlTemplatesPager.java | 108 - .../v1/model/AssignmentResourceCreated.java | 38 - .../v1/model/AssignmentResourceError.java | 88 - .../v1/model/AssignmentTargetDetails.java | 142 - .../v1/model/AssignmentTemplateDetails.java | 119 - .../CommitActionControlTemplateOptions.java | 134 - .../v1/model/CommitPolicyTemplateOptions.java | 134 - .../v1/model/CommitRoleTemplateOptions.java | 134 - .../v1/model/ConflictsWith.java | 62 - .../v1/model/Control.java | 104 - .../v1/model/ControlResponse.java | 42 - .../v1/model/ControlResponseControl.java | 24 - ...ntrolResponseControlWithEnrichedRoles.java | 24 - ...ctionControlTemplateAssignmentOptions.java | 191 - .../CreateActionControlTemplateOptions.java | 251 - ...teActionControlTemplateVersionOptions.java | 211 - .../v1/model/CreatePolicyOptions.java | 311 - ...CreatePolicyTemplateAssignmentOptions.java | 221 - .../v1/model/CreatePolicyTemplateOptions.java | 255 - .../CreatePolicyTemplateVersionOptions.java | 214 - .../v1/model/CreateRoleOptions.java | 308 - .../CreateRoleTemplateAssignmentOptions.java | 191 - .../v1/model/CreateRoleTemplateOptions.java | 251 - .../CreateRoleTemplateVersionOptions.java | 211 - .../v1/model/CreateV2PolicyOptions.java | 312 - .../v1/model/CustomRole.java | 195 - .../DeleteActionControlAssignmentOptions.java | 104 - .../DeleteActionControlTemplateOptions.java | 104 - ...teActionControlTemplateVersionOptions.java | 134 - .../model/DeletePolicyAssignmentOptions.java | 104 - .../v1/model/DeletePolicyOptions.java | 104 - .../v1/model/DeletePolicyTemplateOptions.java | 104 - .../DeletePolicyTemplateVersionOptions.java | 134 - .../v1/model/DeleteRoleAssignmentOptions.java | 104 - .../v1/model/DeleteRoleOptions.java | 104 - .../v1/model/DeleteRoleTemplateOptions.java | 104 - .../DeleteRoleTemplateVersionOptions.java | 134 - .../v1/model/DeleteV2PolicyOptions.java | 104 - .../v1/model/EnrichedRoles.java | 81 - .../v1/model/ErrorDetails.java | 40 - .../v1/model/ErrorObject.java | 128 - .../ExternalAccountIdentityInteraction.java | 40 - ...ternalAccountIdentityInteractionPatch.java | 95 - .../iam_policy_management/v1/model/First.java | 38 - .../GetActionControlAssignmentOptions.java | 104 - .../GetActionControlTemplateOptions.java | 140 - ...etActionControlTemplateVersionOptions.java | 134 - .../v1/model/GetPolicyAssignmentOptions.java | 134 - .../v1/model/GetPolicyOptions.java | 104 - .../v1/model/GetPolicyTemplateOptions.java | 140 - .../GetPolicyTemplateVersionOptions.java | 134 - .../v1/model/GetRoleAssignmentOptions.java | 104 - .../v1/model/GetRoleOptions.java | 104 - .../v1/model/GetRoleTemplateOptions.java | 140 - .../model/GetRoleTemplateVersionOptions.java | 134 - .../v1/model/GetSettingsOptions.java | 141 - .../v1/model/GetV2PolicyOptions.java | 148 - .../iam_policy_management/v1/model/Grant.java | 124 - .../v1/model/GrantWithEnrichedRoles.java | 40 - .../v1/model/IdentityTypes.java | 64 - .../v1/model/IdentityTypesBase.java | 168 - .../v1/model/IdentityTypesPatch.java | 147 - .../v1/model/LimitData.java | 50 - .../ListActionControlAssignmentsOptions.java | 245 - ...tActionControlTemplateVersionsOptions.java | 192 - .../ListActionControlTemplatesOptions.java | 193 - .../v1/model/ListPoliciesOptions.java | 501 -- .../model/ListPolicyAssignmentsOptions.java | 275 - .../ListPolicyTemplateVersionsOptions.java | 192 - .../v1/model/ListPolicyTemplatesOptions.java | 379 -- .../v1/model/ListRoleAssignmentsOptions.java | 245 - .../ListRoleTemplateVersionsOptions.java | 192 - .../v1/model/ListRoleTemplatesOptions.java | 307 - .../v1/model/ListRolesOptions.java | 234 - .../v1/model/ListV2PoliciesOptions.java | 492 -- .../v1/model/NestedCondition.java | 126 - .../model/NestedConditionRuleAttribute.java | 170 - .../NestedConditionRuleWithConditions.java | 139 - .../iam_policy_management/v1/model/Next.java | 50 - .../v1/model/PoliciesPager.java | 108 - .../v1/model/Policy.java | 188 - .../model/PolicyAssignmentResourcePolicy.java | 65 - .../v1/model/PolicyAssignmentResources.java | 50 - .../v1/model/PolicyAssignmentV1.java | 193 - .../model/PolicyAssignmentV1Collection.java | 88 - .../v1/model/PolicyAssignmentV1Resources.java | 50 - .../v1/model/PolicyAssignmentV1Subject.java | 60 - .../v1/model/PolicyAssignmentsPager.java | 108 - .../v1/model/PolicyCollection.java | 88 - .../v1/model/PolicyResource.java | 167 - .../v1/model/PolicyRole.java | 131 - .../v1/model/PolicySubject.java | 124 - .../v1/model/PolicyTemplate.java | 202 - .../PolicyTemplateAssignmentCollection.java | 88 - .../model/PolicyTemplateAssignmentItems.java | 261 - ...mplateAssignmentItemsPolicyAssignment.java | 50 - ...lateAssignmentItemsPolicyAssignmentV1.java | 38 - .../v1/model/PolicyTemplateCollection.java | 90 - .../v1/model/PolicyTemplateLimitData.java | 214 - .../v1/model/PolicyTemplateMetaData.java | 201 - .../PolicyTemplateVersionsCollection.java | 88 - .../v1/model/PolicyTemplateVersionsPager.java | 108 - .../v1/model/PolicyTemplatesPager.java | 108 - .../v1/model/Previous.java | 50 - .../ReplaceActionControlTemplateOptions.java | 273 - .../v1/model/ReplacePolicyOptions.java | 335 -- .../model/ReplacePolicyTemplateOptions.java | 276 - .../v1/model/ReplaceRoleOptions.java | 255 - .../v1/model/ReplaceRoleTemplateOptions.java | 273 - .../v1/model/ReplaceV2PolicyOptions.java | 336 -- .../v1/model/ResourceAttribute.java | 160 - .../v1/model/ResourceTag.java | 160 - .../iam_policy_management/v1/model/Role.java | 196 - .../v1/model/RoleAction.java | 64 - .../v1/model/RoleAssignment.java | 207 - .../v1/model/RoleAssignmentCollection.java | 88 - .../v1/model/RoleAssignmentResource.java | 50 - .../model/RoleAssignmentResourceCreated.java | 38 - .../v1/model/RoleAssignmentResourceRole.java | 53 - .../v1/model/RoleAssignmentTemplate.java | 134 - .../v1/model/RoleAssignmentsPager.java | 108 - .../v1/model/RoleCollection.java | 68 - .../v1/model/RoleTemplate.java | 202 - .../v1/model/RoleTemplateCollection.java | 90 - .../v1/model/RoleTemplatePrototypeRole.java | 239 - .../v1/model/RoleTemplateReferencesItem.java | 134 - .../model/RoleTemplateVersionsCollection.java | 88 - .../v1/model/RoleTemplateVersionsPager.java | 108 - .../v1/model/RoleTemplatesPager.java | 108 - .../iam_policy_management/v1/model/Roles.java | 106 - .../v1/model/RuleAttribute.java | 209 - .../v1/model/SubjectAttribute.java | 134 - .../v1/model/TemplateActionControl.java | 182 - .../v1/model/TemplateControl.java | 104 - .../v1/model/TemplateCountData.java | 50 - .../v1/model/TemplateGrant.java | 58 - .../v1/model/TemplateGrantRoleReferences.java | 110 - .../v1/model/TemplateGrantRoles.java | 110 - .../v1/model/TemplateMetadata.java | 91 - .../v1/model/TemplatePolicy.java | 272 - .../v1/model/TemplateRole.java | 209 - .../UpdateActionControlAssignmentOptions.java | 166 - .../model/UpdatePolicyAssignmentOptions.java | 196 - .../v1/model/UpdatePolicyStateOptions.java | 171 - .../v1/model/UpdateRoleAssignmentOptions.java | 166 - .../v1/model/UpdateSettingsOptions.java | 199 - .../v1/model/V2PoliciesPager.java | 108 - .../v1/model/V2Policy.java | 247 - .../v1/model/V2PolicyCollection.java | 88 - .../v1/model/V2PolicyResource.java | 167 - .../v1/model/V2PolicyResourceAttribute.java | 181 - .../v1/model/V2PolicyResourceTag.java | 174 - .../v1/model/V2PolicyRule.java | 126 - .../v1/model/V2PolicyRuleRuleAttribute.java | 170 - .../V2PolicyRuleRuleWithNestedConditions.java | 139 - .../v1/model/V2PolicySubject.java | 124 - .../v1/model/V2PolicySubjectAttribute.java | 175 - .../v1/model/V2PolicyTemplateMetaData.java | 260 - .../v1/package-info.java | 17 - .../v1/IamPolicyManagementTest.java | 5007 ----------------- .../AccountSettingsAccessManagementTest.java | 40 - ...ActionControlAssignmentCollectionTest.java | 47 - ...olAssignmentResourceActionControlTest.java | 43 - ...nControlAssignmentResourceCreatedTest.java | 37 - .../ActionControlAssignmentResourceTest.java | 45 - .../ActionControlAssignmentTemplateTest.java | 54 - .../v1/model/ActionControlAssignmentTest.java | 40 - .../ActionControlTemplateCollectionTest.java | 46 - .../v1/model/ActionControlTemplateTest.java | 44 - ...ControlTemplateVersionsCollectionTest.java | 46 - .../model/AssignmentResourceCreatedTest.java | 37 - .../v1/model/AssignmentResourceErrorTest.java | 44 - .../v1/model/AssignmentTargetDetailsTest.java | 54 - .../model/AssignmentTemplateDetailsTest.java | 48 - ...ommitActionControlTemplateOptionsTest.java | 47 - .../CommitPolicyTemplateOptionsTest.java | 47 - .../model/CommitRoleTemplateOptionsTest.java | 47 - .../v1/model/ConflictsWithTest.java | 39 - .../v1/model/ControlResponseControlTest.java | 39 - ...lResponseControlWithEnrichedRolesTest.java | 40 - .../v1/model/ControlResponseTest.java | 40 - .../v1/model/ControlTest.java | 63 - ...nControlTemplateAssignmentOptionsTest.java | 65 - ...reateActionControlTemplateOptionsTest.java | 65 - ...tionControlTemplateVersionOptionsTest.java | 63 - .../v1/model/CreatePolicyOptionsTest.java | 103 - ...tePolicyTemplateAssignmentOptionsTest.java | 67 - .../CreatePolicyTemplateOptionsTest.java | 145 - ...reatePolicyTemplateVersionOptionsTest.java | 143 - .../v1/model/CreateRoleOptionsTest.java | 57 - ...eateRoleTemplateAssignmentOptionsTest.java | 65 - .../model/CreateRoleTemplateOptionsTest.java | 69 - .../CreateRoleTemplateVersionOptionsTest.java | 65 - .../v1/model/CreateV2PolicyOptionsTest.java | 131 - .../v1/model/CustomRoleTest.java | 42 - ...eteActionControlAssignmentOptionsTest.java | 45 - ...eleteActionControlTemplateOptionsTest.java | 45 - ...tionControlTemplateVersionOptionsTest.java | 47 - .../DeletePolicyAssignmentOptionsTest.java | 45 - .../v1/model/DeletePolicyOptionsTest.java | 45 - .../DeletePolicyTemplateOptionsTest.java | 45 - ...eletePolicyTemplateVersionOptionsTest.java | 47 - .../DeleteRoleAssignmentOptionsTest.java | 45 - .../v1/model/DeleteRoleOptionsTest.java | 45 - .../model/DeleteRoleTemplateOptionsTest.java | 45 - .../DeleteRoleTemplateVersionOptionsTest.java | 47 - .../v1/model/DeleteV2PolicyOptionsTest.java | 45 - .../v1/model/EnrichedRolesTest.java | 39 - .../v1/model/ErrorDetailsTest.java | 38 - .../v1/model/ErrorObjectTest.java | 42 - ...alAccountIdentityInteractionPatchTest.java | 63 - ...xternalAccountIdentityInteractionTest.java | 39 - .../v1/model/FirstTest.java | 36 - ...GetActionControlAssignmentOptionsTest.java | 45 - .../GetActionControlTemplateOptionsTest.java | 47 - ...tionControlTemplateVersionOptionsTest.java | 47 - .../model/GetPolicyAssignmentOptionsTest.java | 47 - .../v1/model/GetPolicyOptionsTest.java | 45 - .../model/GetPolicyTemplateOptionsTest.java | 47 - .../GetPolicyTemplateVersionOptionsTest.java | 47 - .../model/GetRoleAssignmentOptionsTest.java | 45 - .../v1/model/GetRoleOptionsTest.java | 45 - .../v1/model/GetRoleTemplateOptionsTest.java | 47 - .../GetRoleTemplateVersionOptionsTest.java | 47 - .../v1/model/GetSettingsOptionsTest.java | 47 - .../v1/model/GetV2PolicyOptionsTest.java | 47 - .../v1/model/GrantTest.java | 56 - .../v1/model/GrantWithEnrichedRolesTest.java | 39 - .../v1/model/IdentityTypesBaseTest.java | 53 - .../v1/model/IdentityTypesPatchTest.java | 59 - .../v1/model/IdentityTypesTest.java | 40 - .../v1/model/LimitDataTest.java | 36 - ...stActionControlAssignmentsOptionsTest.java | 55 - ...ionControlTemplateVersionsOptionsTest.java | 51 - ...ListActionControlTemplatesOptionsTest.java | 51 - .../v1/model/ListPoliciesOptionsTest.java | 69 - .../ListPolicyAssignmentsOptionsTest.java | 57 - ...ListPolicyTemplateVersionsOptionsTest.java | 51 - .../model/ListPolicyTemplatesOptionsTest.java | 63 - .../model/ListRoleAssignmentsOptionsTest.java | 55 - .../ListRoleTemplateVersionsOptionsTest.java | 51 - .../model/ListRoleTemplatesOptionsTest.java | 59 - .../v1/model/ListRolesOptionsTest.java | 49 - .../v1/model/ListV2PoliciesOptionsTest.java | 69 - .../NestedConditionRuleAttributeTest.java | 57 - ...NestedConditionRuleWithConditionsTest.java | 63 - .../v1/model/NestedConditionTest.java | 38 - .../v1/model/NextTest.java | 37 - .../PolicyAssignmentResourcePolicyTest.java | 44 - .../model/PolicyAssignmentResourcesTest.java | 44 - .../PolicyAssignmentV1CollectionTest.java | 55 - .../PolicyAssignmentV1ResourcesTest.java | 45 - .../model/PolicyAssignmentV1SubjectTest.java | 36 - .../v1/model/PolicyAssignmentV1Test.java | 51 - .../v1/model/PolicyCollectionTest.java | 52 - .../v1/model/PolicyResourceTest.java | 72 - .../v1/model/PolicyRoleTest.java | 51 - .../v1/model/PolicySubjectTest.java | 58 - ...olicyTemplateAssignmentCollectionTest.java | 55 - ...teAssignmentItemsPolicyAssignmentTest.java | 50 - ...AssignmentItemsPolicyAssignmentV1Test.java | 51 - .../PolicyTemplateAssignmentItemsTest.java | 48 - .../model/PolicyTemplateCollectionTest.java | 55 - .../v1/model/PolicyTemplateLimitDataTest.java | 56 - .../v1/model/PolicyTemplateMetaDataTest.java | 50 - .../v1/model/PolicyTemplateTest.java | 53 - .../PolicyTemplateVersionsCollectionTest.java | 55 - .../v1/model/PolicyTest.java | 48 - .../v1/model/PreviousTest.java | 37 - ...placeActionControlTemplateOptionsTest.java | 67 - .../v1/model/ReplacePolicyOptionsTest.java | 105 - .../ReplacePolicyTemplateOptionsTest.java | 147 - .../v1/model/ReplaceRoleOptionsTest.java | 53 - .../model/ReplaceRoleTemplateOptionsTest.java | 69 - .../v1/model/ReplaceV2PolicyOptionsTest.java | 133 - .../v1/model/ResourceAttributeTest.java | 57 - .../v1/model/ResourceTagTest.java | 57 - .../v1/model/RoleActionTest.java | 39 - .../model/RoleAssignmentCollectionTest.java | 47 - .../RoleAssignmentResourceCreatedTest.java | 37 - .../model/RoleAssignmentResourceRoleTest.java | 43 - .../v1/model/RoleAssignmentResourceTest.java | 45 - .../v1/model/RoleAssignmentTemplateTest.java | 54 - .../v1/model/RoleAssignmentTest.java | 40 - .../v1/model/RoleCollectionTest.java | 41 - .../v1/model/RoleTemplateCollectionTest.java | 46 - .../model/RoleTemplatePrototypeRoleTest.java | 62 - .../model/RoleTemplateReferencesItemTest.java | 54 - .../v1/model/RoleTemplateTest.java | 44 - .../RoleTemplateVersionsCollectionTest.java | 46 - .../v1/model/RoleTest.java | 56 - .../v1/model/RolesTest.java | 51 - .../v1/model/RuleAttributeTest.java | 57 - .../v1/model/SubjectAttributeTest.java | 54 - .../v1/model/TemplateActionControlTest.java | 56 - .../v1/model/TemplateControlTest.java | 63 - .../v1/model/TemplateCountDataTest.java | 39 - .../TemplateGrantRoleReferencesTest.java | 58 - .../v1/model/TemplateGrantRolesTest.java | 56 - .../v1/model/TemplateGrantTest.java | 39 - .../v1/model/TemplateMetadataTest.java | 41 - .../v1/model/TemplatePolicyTest.java | 141 - .../v1/model/TemplateRoleTest.java | 59 - ...ateActionControlAssignmentOptionsTest.java | 49 - .../UpdatePolicyAssignmentOptionsTest.java | 51 - .../model/UpdatePolicyStateOptionsTest.java | 49 - .../UpdateRoleAssignmentOptionsTest.java | 49 - .../v1/model/UpdateSettingsOptionsTest.java | 75 - .../v1/model/V2PolicyCollectionTest.java | 55 - .../model/V2PolicyResourceAttributeTest.java | 57 - .../v1/model/V2PolicyResourceTagTest.java | 57 - .../v1/model/V2PolicyResourceTest.java | 72 - .../model/V2PolicyRuleRuleAttributeTest.java | 57 - ...olicyRuleRuleWithNestedConditionsTest.java | 63 - .../v1/model/V2PolicyRuleTest.java | 38 - .../model/V2PolicySubjectAttributeTest.java | 57 - .../v1/model/V2PolicySubjectTest.java | 60 - .../model/V2PolicyTemplateMetaDataTest.java | 57 - .../v1/model/V2PolicyTest.java | 55 - .../v1/utils/TestUtilities.java | 131 - 333 files changed, 41258 deletions(-) delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java delete mode 100644 iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java delete mode 100644 iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java deleted file mode 100644 index 2abe3baea4e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagement.java +++ /dev/null @@ -1,2566 +0,0 @@ -/* - * (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. - */ - -/* - * IBM OpenAPI SDK Code Generator Version: 3.107.1-41b0fbd0-20250825-080732 - */ - -package com.ibm.cloud.platform_services.iam_policy_management.v1; - -import com.google.gson.JsonObject; -import com.ibm.cloud.platform_services.common.SdkCommon; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; -import com.ibm.cloud.sdk.core.http.RequestBuilder; -import com.ibm.cloud.sdk.core.http.ResponseConverter; -import com.ibm.cloud.sdk.core.http.ServiceCall; -import com.ibm.cloud.sdk.core.security.Authenticator; -import com.ibm.cloud.sdk.core.security.ConfigBasedAuthenticatorFactory; -import com.ibm.cloud.sdk.core.service.BaseService; -import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -/** - * IAM Policy Management API. - * - * API Version: 1.0.1 - */ -public class IamPolicyManagement extends BaseService { - - /** - * Default service name used when configuring the `IamPolicyManagement` client. - */ - public static final String DEFAULT_SERVICE_NAME = "iam_policy_management"; - - /** - * Default service endpoint URL. - */ - public static final String DEFAULT_SERVICE_URL = "https://iam.cloud.ibm.com"; - - /** - * Class method which constructs an instance of the `IamPolicyManagement` client. - * The default service name is used to configure the client instance. - * - * @return an instance of the `IamPolicyManagement` client using external configuration - */ - public static IamPolicyManagement newInstance() { - return newInstance(DEFAULT_SERVICE_NAME); - } - - /** - * Class method which constructs an instance of the `IamPolicyManagement` client. - * The specified service name is used to configure the client instance. - * - * @param serviceName the service name to be used when configuring the client instance - * @return an instance of the `IamPolicyManagement` client using external configuration - */ - public static IamPolicyManagement newInstance(String serviceName) { - Authenticator authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(serviceName); - IamPolicyManagement service = new IamPolicyManagement(serviceName, authenticator); - service.configureService(serviceName); - return service; - } - - /** - * Constructs an instance of the `IamPolicyManagement` client. - * The specified service name and authenticator are used to configure the client instance. - * - * @param serviceName the service name to be used when configuring the client instance - * @param authenticator the {@link Authenticator} instance to be configured for this client - */ - public IamPolicyManagement(String serviceName, Authenticator authenticator) { - super(serviceName, authenticator); - setServiceUrl(DEFAULT_SERVICE_URL); - } - - /** - * Get policies by attributes. - * - * Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account - * and filter by attribute values. This can be done through query parameters. The following attributes are supported: - * account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query - * parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If - * the caller does not have read access to any policies an empty array is returned. - * - * @param listPoliciesOptions the {@link ListPoliciesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyCollection} - */ - public ServiceCall listPolicies(ListPoliciesOptions listPoliciesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listPoliciesOptions, - "listPoliciesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicies"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listPoliciesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listPoliciesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listPoliciesOptions.accountId())); - if (listPoliciesOptions.iamId() != null) { - builder.query("iam_id", String.valueOf(listPoliciesOptions.iamId())); - } - if (listPoliciesOptions.accessGroupId() != null) { - builder.query("access_group_id", String.valueOf(listPoliciesOptions.accessGroupId())); - } - if (listPoliciesOptions.type() != null) { - builder.query("type", String.valueOf(listPoliciesOptions.type())); - } - if (listPoliciesOptions.serviceType() != null) { - builder.query("service_type", String.valueOf(listPoliciesOptions.serviceType())); - } - if (listPoliciesOptions.tagName() != null) { - builder.query("tag_name", String.valueOf(listPoliciesOptions.tagName())); - } - if (listPoliciesOptions.tagValue() != null) { - builder.query("tag_value", String.valueOf(listPoliciesOptions.tagValue())); - } - if (listPoliciesOptions.sort() != null) { - builder.query("sort", String.valueOf(listPoliciesOptions.sort())); - } - if (listPoliciesOptions.format() != null) { - builder.query("format", String.valueOf(listPoliciesOptions.format())); - } - if (listPoliciesOptions.state() != null) { - builder.query("state", String.valueOf(listPoliciesOptions.state())); - } - if (listPoliciesOptions.limit() != null) { - builder.query("limit", String.valueOf(listPoliciesOptions.limit())); - } - if (listPoliciesOptions.start() != null) { - builder.query("start", String.valueOf(listPoliciesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a policy. - * - * Creates a policy to grant access between a subject and a resource. There are two types of policies: **access** and - * **authorization**. A policy administrator might want to create an access policy which grants access to a user, - * service-id, or an access group. They might also want to create an authorization policy and setup access between - * services. - * - * ### Access - * - * To create an access policy, use **`"type": "access"`** in the body. The possible subject attributes are - * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or - * service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. Assign roles - * that are supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or - * **`service_group_id`** attribute and the **`accountId`** attribute. The IAM Services group (`IAM`) is a subset of - * account management services that includes the IAM platform services IAM Identity, IAM Access Management, IAM Users - * Management, IAM Groups, and future IAM services. If the subject is a locked service-id, the request will fail. - * - * ### Authorization - * - * Authorization policies are supported by services on a case by case basis. Refer to service documentation to verify - * their support of authorization policies. To create an authorization policy, use **`"type": "authorization"`** in - * the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject - * attributes might be provided. The following attributes are supported: - * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are - * supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access - * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject - * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. - * - * ### Attribute Operators - * - * Currently, only the `stringEquals` and the `stringMatch` operators are available. Resource attributes may support - * one or both operators. For more information, see [Assigning access by using wildcard - * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). - * - * ### Attribute Validations - * - * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like - * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated - * against Global Catalog locations. - * - * @param createPolicyOptions the {@link CreatePolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Policy} - */ - public ServiceCall createPolicy(CreatePolicyOptions createPolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyOptions, - "createPolicyOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createPolicyOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createPolicyOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("type", createPolicyOptions.type()); - contentJson.add("subjects", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.subjects())); - contentJson.add("roles", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.roles())); - contentJson.add("resources", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyOptions.resources())); - if (createPolicyOptions.description() != null) { - contentJson.addProperty("description", createPolicyOptions.description()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a policy. - * - * Update a policy to grant access between a subject and a resource. A policy administrator might want to update an - * existing policy. The policy type cannot be changed (You cannot change an access policy to an authorization policy). - * - * ### Access - * - * To update an access policy, use **`"type": "access"`** in the body. The possible subject attributes are - * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or - * service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. Assign roles - * that are supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * The policy resource must include either the **`serviceType`**, **`serviceName`**, or **`resourceGroupId`** - * attribute and the **`accountId`** attribute.` If the subject is a locked service-id, the request will fail. - * - * ### Authorization - * - * To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match - * the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following - * attributes are supported: - * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are - * supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access - * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject - * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. - * - * ### Attribute Operators - * - * Currently, only the `stringEquals` and the `stringMatch` operators are available. Resource attributes might support - * one or both operators. For more information, see [Assigning access by using wildcard - * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). - * - * ### Attribute Validations - * - * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like - * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated - * against Global Catalog locations. - * - * @param replacePolicyOptions the {@link ReplacePolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Policy} - */ - public ServiceCall replacePolicy(ReplacePolicyOptions replacePolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replacePolicyOptions, - "replacePolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_id", replacePolicyOptions.policyId()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replacePolicy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replacePolicyOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("type", replacePolicyOptions.type()); - contentJson.add("subjects", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.subjects())); - contentJson.add("roles", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.roles())); - contentJson.add("resources", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyOptions.resources())); - if (replacePolicyOptions.description() != null) { - contentJson.addProperty("description", replacePolicyOptions.description()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a policy by ID. - * - * Retrieve a policy by providing a policy ID. - * - * @param getPolicyOptions the {@link GetPolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateMetaData} - */ - public ServiceCall getPolicy(GetPolicyOptions getPolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyOptions, - "getPolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_id", getPolicyOptions.policyId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicy"); - 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); - } - - /** - * Delete a policy by ID. - * - * Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service - * ID. If the subject of the policy is a locked service-id, the request will fail. - * - * @param deletePolicyOptions the {@link DeletePolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deletePolicy(DeletePolicyOptions deletePolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyOptions, - "deletePolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_id", deletePolicyOptions.policyId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Restore a deleted policy by ID. - * - * Restore a policy that has recently been deleted. A policy administrator might want to restore a deleted policy. To - * restore a policy, use **`"state": "active"`** in the body. - * - * @param updatePolicyStateOptions the {@link UpdatePolicyStateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Policy} - */ - public ServiceCall updatePolicyState(UpdatePolicyStateOptions updatePolicyStateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updatePolicyStateOptions, - "updatePolicyStateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_id", updatePolicyStateOptions.policyId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policies/{policy_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updatePolicyState"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updatePolicyStateOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - if (updatePolicyStateOptions.state() != null) { - contentJson.addProperty("state", updatePolicyStateOptions.state()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get roles by filters. - * - * Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can - * be done through query parameters. Currently, we only support the following attributes: account_id, service_name, - * service_group_id, source_service_name and policy_type. Both service_name and service_group_id attributes are - * mutually exclusive. Only roles that match the filter and that the caller has read access to are returned. If the - * caller does not have read access to any roles an empty array is returned. - * - * @param listRolesOptions the {@link ListRolesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleCollection} - */ - public ServiceCall listRoles(ListRolesOptions listRolesOptions) { - if (listRolesOptions == null) { - listRolesOptions = new ListRolesOptions.Builder().build(); - } - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoles"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listRolesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listRolesOptions.acceptLanguage()); - } - if (listRolesOptions.accountId() != null) { - builder.query("account_id", String.valueOf(listRolesOptions.accountId())); - } - if (listRolesOptions.serviceName() != null) { - builder.query("service_name", String.valueOf(listRolesOptions.serviceName())); - } - if (listRolesOptions.sourceServiceName() != null) { - builder.query("source_service_name", String.valueOf(listRolesOptions.sourceServiceName())); - } - if (listRolesOptions.policyType() != null) { - builder.query("policy_type", String.valueOf(listRolesOptions.policyType())); - } - if (listRolesOptions.serviceGroupId() != null) { - builder.query("service_group_id", String.valueOf(listRolesOptions.serviceGroupId())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get roles by filters. - * - * Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can - * be done through query parameters. Currently, we only support the following attributes: account_id, service_name, - * service_group_id, source_service_name and policy_type. Both service_name and service_group_id attributes are - * mutually exclusive. Only roles that match the filter and that the caller has read access to are returned. If the - * caller does not have read access to any roles an empty array is returned. - * - * @return a {@link ServiceCall} with a result of type {@link RoleCollection} - */ - public ServiceCall listRoles() { - return listRoles(null); - } - - /** - * Create a role. - * - * Creates a custom role for a specific service within the account. An account owner or a user assigned the - * Administrator role on the Role management service can create a custom role. Any number of actions for a single - * service can be mapped to the new role, but there must be at least one service-defined action to successfully create - * the new role. - * - * @param createRoleOptions the {@link CreateRoleOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link CustomRole} - */ - public ServiceCall createRole(CreateRoleOptions createRoleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleOptions, - "createRoleOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRole"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createRoleOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createRoleOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("display_name", createRoleOptions.displayName()); - contentJson.add("actions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleOptions.actions())); - contentJson.addProperty("name", createRoleOptions.name()); - contentJson.addProperty("account_id", createRoleOptions.accountId()); - contentJson.addProperty("service_name", createRoleOptions.serviceName()); - if (createRoleOptions.description() != null) { - contentJson.addProperty("description", createRoleOptions.description()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a role. - * - * Update a custom role. A role administrator might want to update an existing role by updating the display name, - * description, or the actions that are mapped to the role. The name, account_id, and service_name can't be changed. - * - * @param replaceRoleOptions the {@link ReplaceRoleOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link CustomRole} - */ - public ServiceCall replaceRole(ReplaceRoleOptions replaceRoleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceRoleOptions, - "replaceRoleOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_id", replaceRoleOptions.roleId()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceRole"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replaceRoleOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("display_name", replaceRoleOptions.displayName()); - contentJson.add("actions", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRoleOptions.actions())); - if (replaceRoleOptions.description() != null) { - contentJson.addProperty("description", replaceRoleOptions.description()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a role by ID. - * - * Retrieve a role by providing a role ID. - * - * @param getRoleOptions the {@link GetRoleOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link CustomRole} - */ - public ServiceCall getRole(GetRoleOptions getRoleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleOptions, - "getRoleOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_id", getRoleOptions.roleId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRole"); - 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); - } - - /** - * Delete a role by ID. - * - * Delete a role by providing a role ID. - * - * @param deleteRoleOptions the {@link DeleteRoleOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteRole(DeleteRoleOptions deleteRoleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleOptions, - "deleteRoleOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_id", deleteRoleOptions.roleId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/roles/{role_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRole"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get policies by attributes. - * - * Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account - * and filter by attribute values. This can be done through query parameters. The following attributes are supported: - * account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query - * parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If - * the caller does not have read access to any policies an empty array is returned. - * - * @param listV2PoliciesOptions the {@link ListV2PoliciesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link V2PolicyCollection} - */ - public ServiceCall listV2Policies(ListV2PoliciesOptions listV2PoliciesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listV2PoliciesOptions, - "listV2PoliciesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listV2Policies"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listV2PoliciesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listV2PoliciesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listV2PoliciesOptions.accountId())); - if (listV2PoliciesOptions.iamId() != null) { - builder.query("iam_id", String.valueOf(listV2PoliciesOptions.iamId())); - } - if (listV2PoliciesOptions.accessGroupId() != null) { - builder.query("access_group_id", String.valueOf(listV2PoliciesOptions.accessGroupId())); - } - if (listV2PoliciesOptions.type() != null) { - builder.query("type", String.valueOf(listV2PoliciesOptions.type())); - } - if (listV2PoliciesOptions.serviceType() != null) { - builder.query("service_type", String.valueOf(listV2PoliciesOptions.serviceType())); - } - if (listV2PoliciesOptions.serviceName() != null) { - builder.query("service_name", String.valueOf(listV2PoliciesOptions.serviceName())); - } - if (listV2PoliciesOptions.serviceGroupId() != null) { - builder.query("service_group_id", String.valueOf(listV2PoliciesOptions.serviceGroupId())); - } - if (listV2PoliciesOptions.sort() != null) { - builder.query("sort", String.valueOf(listV2PoliciesOptions.sort())); - } - if (listV2PoliciesOptions.format() != null) { - builder.query("format", String.valueOf(listV2PoliciesOptions.format())); - } - if (listV2PoliciesOptions.state() != null) { - builder.query("state", String.valueOf(listV2PoliciesOptions.state())); - } - if (listV2PoliciesOptions.limit() != null) { - builder.query("limit", String.valueOf(listV2PoliciesOptions.limit())); - } - if (listV2PoliciesOptions.start() != null) { - builder.query("start", String.valueOf(listV2PoliciesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a policy. - * - * Creates a policy to grant access between a subject and a resource. Currently, there is one type of a v2/policy: - * **access**. A policy administrator might want to create an access policy that grants access to a user, service-id, - * or an access group. - * - * ### Access - * - * To create an access policy, use **`"type": "access"`** in the body. The supported subject attributes are - * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute to assign access to a user or - * service-id. Use the **`access_group_id`** subject attribute to assign access to an access group. Assign roles that - * are supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or - * **`service_group_id`** attribute and the **`accountId`** attribute. In the rule field, you can specify a single - * condition by using **`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`** with a - * combination **`operator`**. The possible combination operators are **`and`** and **`or`**. - * - * Currently, we support two types of patterns: - * - * 1. `time-based`: Used to specify a time-based restriction - * - * Combine conditions to specify a time-based restriction (e.g., access only during business hours, during the - * Monday-Friday work week). For example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following - * rule: - * ```json - * "rule": { - * "operator": "and", - * "conditions": [{ - * "key": "{{environment.attributes.day_of_week}}", - * "operator": "dayOfWeekAnyOf", - * "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] - * }, - * "key": "{{environment.attributes.current_time}}", - * "operator": "timeGreaterThanOrEquals", - * "value": "09:00:00+00:00" - * }, - * "key": "{{environment.attributes.current_time}}", - * "operator": "timeLessThanOrEquals", - * "value": "17:00:00+00:00" - * }] - * } - * ``` You can use the following operators in the **`key`** and **`value`** pair: - * ``` - * 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', - * 'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan', 'dateGreaterThanOrEquals', - * 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', - * 'dayOfWeekEquals', 'dayOfWeekAnyOf' - * ``` - * - * The pattern field that matches the rule is required when rule is provided. For the business hour rule example - * above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions - * operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) and - * [Limiting access with time-based conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the - * subject is a locked service-id, the request will fail. - * - * 2. `attribute-based`: Used to specify a combination of OR/AND based conditions applied on resource attributes. - * - * Combine conditions to specify an attribute-based condition using AND/OR-based operators. - * - * For example, a policy can grant access based on multiple conditions applied on the resource attributes below: - * ```json - * "pattern": "attribute-based-condition:resource:literal-and-wildcard" - * "rule": { - * "operator": "or", - * "conditions": [ - * { - * "operator": "and", - * "conditions": [ - * { - * "key": "{{resource.attributes.prefix}}", - * "operator": "stringEquals", - * "value": "home/test" - * }, - * { - * "key": "{{environment.attributes.delimiter}}", - * "operator": "stringEquals", - * "value": "/" - * } - * ] - * }, - * { - * "key": "{{resource.attributes.path}}", - * "operator": "stringMatch", - * "value": "home/David/_*" - * } - * ] - * } - * ``` - * - * In addition to satisfying the `resources` section, the policy grants permission only if either the `path` begins - * with `home/David/` **OR** the `prefix` is `home/test` and the `delimiter` is `/`. This mechanism helps you - * consolidate multiple policies in to a single policy, making policies easier to administer and stay within the - * policy limit for an account. View the list of operators that can be used in the condition - * [here](/docs/account?topic=account-wildcard#string-comparisons). - * - * ### Authorization - * - * Authorization policies are supported by services on a case by case basis. Refer to service documentation to verify - * their support of authorization policies. To create an authorization policy, use **`"type": "authorization"`** in - * the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject - * attributes might be provided. The following attributes are supported: - * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are - * supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access - * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject - * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. - * - * ### Attribute Operators - * - * Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators are available. For more - * information, see [Assigning access by using wildcard - * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). - * - * ### Attribute Validations - * - * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like - * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated - * against Global Catalog locations. - * - * @param createV2PolicyOptions the {@link CreateV2PolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link V2Policy} - */ - public ServiceCall createV2Policy(CreateV2PolicyOptions createV2PolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createV2PolicyOptions, - "createV2PolicyOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createV2Policy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createV2PolicyOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createV2PolicyOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.add("control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.control())); - contentJson.addProperty("type", createV2PolicyOptions.type()); - if (createV2PolicyOptions.description() != null) { - contentJson.addProperty("description", createV2PolicyOptions.description()); - } - if (createV2PolicyOptions.subject() != null) { - contentJson.add("subject", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.subject())); - } - if (createV2PolicyOptions.resource() != null) { - contentJson.add("resource", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.resource())); - } - if (createV2PolicyOptions.pattern() != null) { - contentJson.addProperty("pattern", createV2PolicyOptions.pattern()); - } - if (createV2PolicyOptions.rule() != null) { - contentJson.add("rule", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createV2PolicyOptions.rule())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a policy. - * - * Update a policy to grant access between a subject and a resource. A policy administrator might want to update an - * existing policy. - * - * ### Access - * - * To update an access policy, use **`"type": "access"`** in the body. The supported subject attributes are - * **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute to assign access to a user or - * service-id. Use the **`access_group_id`** subject attribute to assign access to an access group. Assign roles that - * are supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or - * **`service_group_id`** attribute and the **`accountId`** attribute. In the rule field, you can specify a single - * condition by using **`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`** with a - * combination **`operator`**. The possible combination operators are **`and`** and **`or`**. - * - * Currently, we support two types of patterns: - * - * 1. `time-based`: Used to specify a time-based restriction - * - * Combine conditions to specify a time-based restriction (e.g., access only during business hours, during the - * Monday-Friday work week). For example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following - * rule: - * ```json - * "rule": { - * "operator": "and", - * "conditions": [{ - * "key": "{{environment.attributes.day_of_week}}", - * "operator": "dayOfWeekAnyOf", - * "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] - * }, - * "key": "{{environment.attributes.current_time}}", - * "operator": "timeGreaterThanOrEquals", - * "value": "09:00:00+00:00" - * }, - * "key": "{{environment.attributes.current_time}}", - * "operator": "timeLessThanOrEquals", - * "value": "17:00:00+00:00" - * }] - * } - * ``` You can use the following operators in the **`key`** and **`value`** pair: - * ``` - * 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', - * 'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan', 'dateGreaterThanOrEquals', - * 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', - * 'dayOfWeekEquals', 'dayOfWeekAnyOf' - * ``` The pattern field that matches the rule is required when rule is provided. For the business hour rule example - * above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions - * operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) and - * [Limiting access with time-based conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the - * subject is a locked service-id, the request will fail. - * - * 2. `attribute-based`: Used to specify a combination of OR/AND based conditions applied on resource attributes. - * - * Combine conditions to specify an attribute-based condition using AND/OR-based operators. - * - * For example, a policy can grant access based on multiple conditions applied on the resource attributes below: - * ```json - * "pattern": "attribute-based-condition:resource:literal-and-wildcard" - * "rule": { - * "operator": "or", - * "conditions": [ - * { - * "operator": "and", - * "conditions": [ - * { - * "key": "{{resource.attributes.prefix}}", - * "operator": "stringEquals", - * "value": "home/test" - * }, - * { - * "key": "{{environment.attributes.delimiter}}", - * "operator": "stringEquals", - * "value": "/" - * } - * ] - * }, - * { - * "key": "{{resource.attributes.path}}", - * "operator": "stringMatch", - * "value": "home/David/_*" - * } - * ] - * } - * ``` - * - * In addition to satisfying the `resources` section, the policy grants permission only if either the `path` begins - * with `home/David/` **OR** the `prefix` is `home/test` and the `delimiter` is `/`. This mechanism helps you - * consolidate multiple policies in to a single policy, making policies easier to administer and stay within the - * policy limit for an account. View the list of operators that can be used in the condition - * [here](/docs/account?topic=account-wildcard#string-comparisons). - * - * ### Authorization - * - * To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match - * the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following - * attributes are supported: - * serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are - * supported by the service or platform roles. For more information, see [IAM roles and - * actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access - * or greater to the target resource in order to grant the role. Use only the resource attributes supported by the - * service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). - * Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject - * must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. - * - * ### Attribute Operators - * - * Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators are available. For more - * information, see [Assigning access by using wildcard - * policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). - * - * ### Attribute Validations - * - * Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like - * geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated - * against Global Catalog locations. - * - * @param replaceV2PolicyOptions the {@link ReplaceV2PolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link V2Policy} - */ - public ServiceCall replaceV2Policy(ReplaceV2PolicyOptions replaceV2PolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceV2PolicyOptions, - "replaceV2PolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", replaceV2PolicyOptions.id()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceV2Policy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replaceV2PolicyOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.add("control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.control())); - contentJson.addProperty("type", replaceV2PolicyOptions.type()); - if (replaceV2PolicyOptions.description() != null) { - contentJson.addProperty("description", replaceV2PolicyOptions.description()); - } - if (replaceV2PolicyOptions.subject() != null) { - contentJson.add("subject", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.subject())); - } - if (replaceV2PolicyOptions.resource() != null) { - contentJson.add("resource", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.resource())); - } - if (replaceV2PolicyOptions.pattern() != null) { - contentJson.addProperty("pattern", replaceV2PolicyOptions.pattern()); - } - if (replaceV2PolicyOptions.rule() != null) { - contentJson.add("rule", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceV2PolicyOptions.rule())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a policy by ID. - * - * Retrieve a policy by providing a policy ID. - * - * @param getV2PolicyOptions the {@link GetV2PolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link V2PolicyTemplateMetaData} - */ - public ServiceCall getV2Policy(GetV2PolicyOptions getV2PolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getV2PolicyOptions, - "getV2PolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", getV2PolicyOptions.id()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getV2Policy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getV2PolicyOptions.format() != null) { - builder.query("format", String.valueOf(getV2PolicyOptions.format())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a policy by ID. - * - * Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service - * ID. If the subject of the policy is a locked service-id, the request will fail. - * - * @param deleteV2PolicyOptions the {@link DeleteV2PolicyOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteV2Policy(DeleteV2PolicyOptions deleteV2PolicyOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteV2PolicyOptions, - "deleteV2PolicyOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("id", deleteV2PolicyOptions.id()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/policies/{id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteV2Policy"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List policy templates by attributes. - * - * List policy templates and filter by attributes by using query parameters. The following attributes are supported: - * `account_id`, `policy_service_name`, `policy_service_type`, `policy_service_group_id` and `policy_type`. - * `account_id` is a required query parameter. These attributes `policy_service_name`, `policy_service_type` and - * `policy_service_group_id` are mutually exclusive. Only policy templates that have the specified attributes and that - * the caller has read access to are returned. If the caller does not have read access to any policy templates an - * empty array is returned. - * - * @param listPolicyTemplatesOptions the {@link ListPolicyTemplatesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateCollection} - */ - public ServiceCall listPolicyTemplates(ListPolicyTemplatesOptions listPolicyTemplatesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyTemplatesOptions, - "listPolicyTemplatesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyTemplates"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listPolicyTemplatesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listPolicyTemplatesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listPolicyTemplatesOptions.accountId())); - if (listPolicyTemplatesOptions.state() != null) { - builder.query("state", String.valueOf(listPolicyTemplatesOptions.state())); - } - if (listPolicyTemplatesOptions.name() != null) { - builder.query("name", String.valueOf(listPolicyTemplatesOptions.name())); - } - if (listPolicyTemplatesOptions.policyServiceType() != null) { - builder.query("policy_service_type", String.valueOf(listPolicyTemplatesOptions.policyServiceType())); - } - if (listPolicyTemplatesOptions.policyServiceName() != null) { - builder.query("policy_service_name", String.valueOf(listPolicyTemplatesOptions.policyServiceName())); - } - if (listPolicyTemplatesOptions.policyServiceGroupId() != null) { - builder.query("policy_service_group_id", String.valueOf(listPolicyTemplatesOptions.policyServiceGroupId())); - } - if (listPolicyTemplatesOptions.policyType() != null) { - builder.query("policy_type", String.valueOf(listPolicyTemplatesOptions.policyType())); - } - if (listPolicyTemplatesOptions.limit() != null) { - builder.query("limit", String.valueOf(listPolicyTemplatesOptions.limit())); - } - if (listPolicyTemplatesOptions.start() != null) { - builder.query("start", String.valueOf(listPolicyTemplatesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a policy template. - * - * Create a policy template. Policy templates define a policy without requiring a subject, and you can use them to - * grant access to multiple subjects. - * - * @param createPolicyTemplateOptions the {@link CreatePolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateLimitData} - */ - public ServiceCall createPolicyTemplate(CreatePolicyTemplateOptions createPolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateOptions, - "createPolicyTemplateOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createPolicyTemplateOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createPolicyTemplateOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("name", createPolicyTemplateOptions.name()); - contentJson.addProperty("account_id", createPolicyTemplateOptions.accountId()); - contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateOptions.policy())); - if (createPolicyTemplateOptions.description() != null) { - contentJson.addProperty("description", createPolicyTemplateOptions.description()); - } - if (createPolicyTemplateOptions.committed() != null) { - contentJson.addProperty("committed", createPolicyTemplateOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve latest version of a policy template. - * - * Retrieve the latest version of a policy template by providing a policy template ID. - * - * @param getPolicyTemplateOptions the {@link GetPolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} - */ - public ServiceCall getPolicyTemplate(GetPolicyTemplateOptions getPolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyTemplateOptions, - "getPolicyTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", getPolicyTemplateOptions.policyTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getPolicyTemplateOptions.state() != null) { - builder.query("state", String.valueOf(getPolicyTemplateOptions.state())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a policy template. - * - * Delete a policy template by providing the policy template ID. This deletes all versions of this template. A policy - * template can't be deleted if any version of the template is assigned to one or more child accounts. You must remove - * the policy assignments first. - * - * @param deletePolicyTemplateOptions the {@link DeletePolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deletePolicyTemplate(DeletePolicyTemplateOptions deletePolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyTemplateOptions, - "deletePolicyTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", deletePolicyTemplateOptions.policyTemplateId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a new policy template version. - * - * Create a new version of a policy template. Use this if you need to make updates to a policy template that is - * committed. - * - * @param createPolicyTemplateVersionOptions the {@link CreatePolicyTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateLimitData} - */ - public ServiceCall createPolicyTemplateVersion(CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateVersionOptions, - "createPolicyTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", createPolicyTemplateVersionOptions.policyTemplateId()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - final JsonObject contentJson = new JsonObject(); - contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateVersionOptions.policy())); - if (createPolicyTemplateVersionOptions.name() != null) { - contentJson.addProperty("name", createPolicyTemplateVersionOptions.name()); - } - if (createPolicyTemplateVersionOptions.description() != null) { - contentJson.addProperty("description", createPolicyTemplateVersionOptions.description()); - } - if (createPolicyTemplateVersionOptions.committed() != null) { - contentJson.addProperty("committed", createPolicyTemplateVersionOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve policy template versions. - * - * Retrieve the versions of a policy template by providing a policy template ID. - * - * @param listPolicyTemplateVersionsOptions the {@link ListPolicyTemplateVersionsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateVersionsCollection} - */ - public ServiceCall listPolicyTemplateVersions(ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyTemplateVersionsOptions, - "listPolicyTemplateVersionsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", listPolicyTemplateVersionsOptions.policyTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyTemplateVersions"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listPolicyTemplateVersionsOptions.state() != null) { - builder.query("state", String.valueOf(listPolicyTemplateVersionsOptions.state())); - } - if (listPolicyTemplateVersionsOptions.limit() != null) { - builder.query("limit", String.valueOf(listPolicyTemplateVersionsOptions.limit())); - } - if (listPolicyTemplateVersionsOptions.start() != null) { - builder.query("start", String.valueOf(listPolicyTemplateVersionsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a policy template version. - * - * Update a specific version of a policy template. You can use this only if the version isn't committed. - * - * @param replacePolicyTemplateOptions the {@link ReplacePolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} - */ - public ServiceCall replacePolicyTemplate(ReplacePolicyTemplateOptions replacePolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replacePolicyTemplateOptions, - "replacePolicyTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", replacePolicyTemplateOptions.policyTemplateId()); - pathParamsMap.put("version", replacePolicyTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replacePolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replacePolicyTemplateOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.add("policy", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replacePolicyTemplateOptions.policy())); - if (replacePolicyTemplateOptions.name() != null) { - contentJson.addProperty("name", replacePolicyTemplateOptions.name()); - } - if (replacePolicyTemplateOptions.description() != null) { - contentJson.addProperty("description", replacePolicyTemplateOptions.description()); - } - if (replacePolicyTemplateOptions.committed() != null) { - contentJson.addProperty("committed", replacePolicyTemplateOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a policy template version. - * - * Delete a specific version of a policy template by providing a policy template ID and version number. You can't - * delete a policy template version that is assigned to one or more child accounts. You must remove the policy - * assignments first. - * - * @param deletePolicyTemplateVersionOptions the {@link DeletePolicyTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deletePolicyTemplateVersion(DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyTemplateVersionOptions, - "deletePolicyTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", deletePolicyTemplateVersionOptions.policyTemplateId()); - pathParamsMap.put("version", deletePolicyTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a policy template version. - * - * Retrieve a policy template by providing a policy template ID and version number. - * - * @param getPolicyTemplateVersionOptions the {@link GetPolicyTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplate} - */ - public ServiceCall getPolicyTemplateVersion(GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyTemplateVersionOptions, - "getPolicyTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", getPolicyTemplateVersionOptions.policyTemplateId()); - pathParamsMap.put("version", getPolicyTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyTemplateVersion"); - 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); - } - - /** - * Commit a policy template version. - * - * Commit a policy template version. You can make no further changes to the policy template once it's committed. If - * you need to make updates after committing a version, create a new version. - * - * @param commitPolicyTemplateOptions the {@link CommitPolicyTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall commitPolicyTemplate(CommitPolicyTemplateOptions commitPolicyTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(commitPolicyTemplateOptions, - "commitPolicyTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("policy_template_id", commitPolicyTemplateOptions.policyTemplateId()); - pathParamsMap.put("version", commitPolicyTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_templates/{policy_template_id}/versions/{version}/commit", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitPolicyTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get policy template assignments. - * - * Get policy template assignments by attributes. The following attributes are supported: - * `account_id`, `template_id`, `template_version`, `sort`. - * `account_id` is a required query parameter. Only policy template assignments that have the specified attributes and - * that the caller has read access to are returned. If the caller does not have read access to any policy template - * assignments an empty array is returned. - * - * @param listPolicyAssignmentsOptions the {@link ListPolicyAssignmentsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateAssignmentCollection} - */ - public ServiceCall listPolicyAssignments(ListPolicyAssignmentsOptions listPolicyAssignmentsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listPolicyAssignmentsOptions, - "listPolicyAssignmentsOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listPolicyAssignments"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listPolicyAssignmentsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listPolicyAssignmentsOptions.acceptLanguage()); - } - builder.query("version", String.valueOf(listPolicyAssignmentsOptions.version())); - builder.query("account_id", String.valueOf(listPolicyAssignmentsOptions.accountId())); - if (listPolicyAssignmentsOptions.templateId() != null) { - builder.query("template_id", String.valueOf(listPolicyAssignmentsOptions.templateId())); - } - if (listPolicyAssignmentsOptions.templateVersion() != null) { - builder.query("template_version", String.valueOf(listPolicyAssignmentsOptions.templateVersion())); - } - if (listPolicyAssignmentsOptions.limit() != null) { - builder.query("limit", String.valueOf(listPolicyAssignmentsOptions.limit())); - } - if (listPolicyAssignmentsOptions.start() != null) { - builder.query("start", String.valueOf(listPolicyAssignmentsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a policy authorization template assignment. - * - * Assign a policy template to child accounts and account groups. This creates the policy in the accounts and account - * groups that you specify. - * - * @param createPolicyTemplateAssignmentOptions the {@link CreatePolicyTemplateAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyAssignmentV1Collection} - */ - public ServiceCall createPolicyTemplateAssignment(CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createPolicyTemplateAssignmentOptions, - "createPolicyTemplateAssignmentOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createPolicyTemplateAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createPolicyTemplateAssignmentOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createPolicyTemplateAssignmentOptions.acceptLanguage()); - } - builder.query("version", String.valueOf(createPolicyTemplateAssignmentOptions.version())); - final JsonObject contentJson = new JsonObject(); - contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateAssignmentOptions.target())); - contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createPolicyTemplateAssignmentOptions.templates())); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a policy assignment. - * - * Retrieve a policy template assignment by providing a policy assignment ID. - * - * @param getPolicyAssignmentOptions the {@link GetPolicyAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyTemplateAssignmentItems} - */ - public ServiceCall getPolicyAssignment(GetPolicyAssignmentOptions getPolicyAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getPolicyAssignmentOptions, - "getPolicyAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", getPolicyAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getPolicyAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(getPolicyAssignmentOptions.version())); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a policy authorization type assignment. - * - * Update a policy assignment by providing a policy assignment ID. - * - * @param updatePolicyAssignmentOptions the {@link UpdatePolicyAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link PolicyAssignmentV1} - */ - public ServiceCall updatePolicyAssignment(UpdatePolicyAssignmentOptions updatePolicyAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updatePolicyAssignmentOptions, - "updatePolicyAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", updatePolicyAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updatePolicyAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updatePolicyAssignmentOptions.ifMatch()); - builder.query("version", String.valueOf(updatePolicyAssignmentOptions.version())); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("template_version", updatePolicyAssignmentOptions.templateVersion()); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Remove a policy assignment. - * - * Remove a policy template assignment by providing a policy assignment ID. You can't delete a policy assignment if - * the status is "in_progress". - * - * @param deletePolicyAssignmentOptions the {@link DeletePolicyAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deletePolicyAssignment(DeletePolicyAssignmentOptions deletePolicyAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deletePolicyAssignmentOptions, - "deletePolicyAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", deletePolicyAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/policy_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deletePolicyAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve Access Management account settings by account ID. - * - * Retrieve Access Management settings for an account by providing the account ID. - * - * @param getSettingsOptions the {@link GetSettingsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AccountSettingsAccessManagement} - */ - public ServiceCall getSettings(GetSettingsOptions getSettingsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getSettingsOptions, - "getSettingsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", getSettingsOptions.accountId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/settings/access_management", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getSettings"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getSettingsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", getSettingsOptions.acceptLanguage()); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update Access Management account settings by account ID. - * - * Update access management settings for an account. - * - * ### External Account Identity Interaction - * - * Update the way identities within an external account are allowed to interact with the requested account by - * providing: - * * the `account_id` as a parameter - * * one or more external account ID(s) and state for the specific identity in the request body - * - * External account identity interaction includes the following `identity_types`: `user` (user identities that are - * defined as [IBMid's](https://cloud.ibm.com/docs/account?topic=account-identity-overview#users-bestpract)), - * `service_id` (defined as [IAM - * ServiceIds](https://cloud.ibm.com/docs/account?topic=account-identity-overview#serviceid-bestpract)), `service` - * (defined by a service’s [CRN](https://cloud.ibm.com/docs/account?topic=account-crn)). To update an Identity’s - * setting, the `state` and `external_allowed_accounts` fields are required. - * - * Different identity states are: - * * "enabled": An identity type is allowed to access resources in the account provided it has access policies on - * those resources. - * * "limited": An identity type is allowed to access resources in the account provided it has access policies on - * those resources AND it is associated with either the account the resources are in or one of the allowed accounts. - * This setting uses the "external_allowed_accounts" list. - * * "monitor": It has no direct impact on an Identity’s access. Instead, it creates AT events for access decisions as - * if the account were in a limited “state”. - * - * **Note**: The state "enabled" is a special case. In this case, access is given to all accounts and there is no need - * to specify a particular list. Therefore, when updating "state" to "enabled" for an identity type - * "external_allowed_accounts" should be left empty. - * - * @param updateSettingsOptions the {@link UpdateSettingsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AccountSettingsAccessManagement} - */ - public ServiceCall updateSettings(UpdateSettingsOptions updateSettingsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateSettingsOptions, - "updateSettingsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", updateSettingsOptions.accountId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/settings/access_management", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateSettings"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updateSettingsOptions.ifMatch()); - if (updateSettingsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", updateSettingsOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - if (updateSettingsOptions.externalAccountIdentityInteraction() != null) { - contentJson.add("external_account_identity_interaction", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateSettingsOptions.externalAccountIdentityInteraction())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List action control templates by attributes. - * - * List action control templates and filter by attributes by using query parameters. The following attributes are - * supported: - * `account_id` - * `account_id` is a required query parameter. Only action control templates that have the specified attributes and - * that the caller has read access to are returned. If the caller does not have read access to any action control - * templates an empty array is returned. - * - * @param listActionControlTemplatesOptions the {@link ListActionControlTemplatesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplateCollection} - */ - public ServiceCall listActionControlTemplates(ListActionControlTemplatesOptions listActionControlTemplatesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlTemplatesOptions, - "listActionControlTemplatesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlTemplates"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listActionControlTemplatesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listActionControlTemplatesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listActionControlTemplatesOptions.accountId())); - if (listActionControlTemplatesOptions.limit() != null) { - builder.query("limit", String.valueOf(listActionControlTemplatesOptions.limit())); - } - if (listActionControlTemplatesOptions.start() != null) { - builder.query("start", String.valueOf(listActionControlTemplatesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create an action control template. - * - * Create an action control template. Action control templates define a service action control. - * - * @param createActionControlTemplateOptions the {@link CreateActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall createActionControlTemplate(CreateActionControlTemplateOptions createActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateOptions, - "createActionControlTemplateOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createActionControlTemplateOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createActionControlTemplateOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("name", createActionControlTemplateOptions.name()); - contentJson.addProperty("account_id", createActionControlTemplateOptions.accountId()); - if (createActionControlTemplateOptions.description() != null) { - contentJson.addProperty("description", createActionControlTemplateOptions.description()); - } - if (createActionControlTemplateOptions.committed() != null) { - contentJson.addProperty("committed", createActionControlTemplateOptions.committed()); - } - if (createActionControlTemplateOptions.actionControl() != null) { - contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateOptions.actionControl())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve the latest version of an action control template. - * - * Retrieve the latest version of an action control template by providing an action control template ID. - * - * @param getActionControlTemplateOptions the {@link GetActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall getActionControlTemplate(GetActionControlTemplateOptions getActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlTemplateOptions, - "getActionControlTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", getActionControlTemplateOptions.actionControlTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getActionControlTemplateOptions.state() != null) { - builder.query("state", String.valueOf(getActionControlTemplateOptions.state())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete an action control template. - * - * Delete an action control template by providing the action control template ID. This deletes all versions of this - * template. An action control template can't be deleted if any version of the template is assigned to one or more - * child accounts. You must remove the action control assignments first. - * - * @param deleteActionControlTemplateOptions the {@link DeleteActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteActionControlTemplate(DeleteActionControlTemplateOptions deleteActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlTemplateOptions, - "deleteActionControlTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", deleteActionControlTemplateOptions.actionControlTemplateId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a new action control template version. - * - * Create a new version of an action control template. Use this if you need to make updates to an action control - * template that is committed. - * - * @param createActionControlTemplateVersionOptions the {@link CreateActionControlTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall createActionControlTemplateVersion(CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateVersionOptions, - "createActionControlTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", createActionControlTemplateVersionOptions.actionControlTemplateId()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - final JsonObject contentJson = new JsonObject(); - if (createActionControlTemplateVersionOptions.name() != null) { - contentJson.addProperty("name", createActionControlTemplateVersionOptions.name()); - } - if (createActionControlTemplateVersionOptions.description() != null) { - contentJson.addProperty("description", createActionControlTemplateVersionOptions.description()); - } - if (createActionControlTemplateVersionOptions.actionControl() != null) { - contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateVersionOptions.actionControl())); - } - if (createActionControlTemplateVersionOptions.committed() != null) { - contentJson.addProperty("committed", createActionControlTemplateVersionOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve action control template versions. - * - * Retrieve the versions of an action control template by providing an action control template ID. - * - * @param listActionControlTemplateVersionsOptions the {@link ListActionControlTemplateVersionsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplateVersionsCollection} - */ - public ServiceCall listActionControlTemplateVersions(ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlTemplateVersionsOptions, - "listActionControlTemplateVersionsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", listActionControlTemplateVersionsOptions.actionControlTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlTemplateVersions"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listActionControlTemplateVersionsOptions.state() != null) { - builder.query("state", String.valueOf(listActionControlTemplateVersionsOptions.state())); - } - if (listActionControlTemplateVersionsOptions.limit() != null) { - builder.query("limit", String.valueOf(listActionControlTemplateVersionsOptions.limit())); - } - if (listActionControlTemplateVersionsOptions.start() != null) { - builder.query("start", String.valueOf(listActionControlTemplateVersionsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update an action control template version. - * - * Update a specific version of an action control template. You can use this only if the version isn't committed. - * - * @param replaceActionControlTemplateOptions the {@link ReplaceActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall replaceActionControlTemplate(ReplaceActionControlTemplateOptions replaceActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceActionControlTemplateOptions, - "replaceActionControlTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", replaceActionControlTemplateOptions.actionControlTemplateId()); - pathParamsMap.put("version", replaceActionControlTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replaceActionControlTemplateOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - if (replaceActionControlTemplateOptions.name() != null) { - contentJson.addProperty("name", replaceActionControlTemplateOptions.name()); - } - if (replaceActionControlTemplateOptions.description() != null) { - contentJson.addProperty("description", replaceActionControlTemplateOptions.description()); - } - if (replaceActionControlTemplateOptions.actionControl() != null) { - contentJson.add("action_control", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceActionControlTemplateOptions.actionControl())); - } - if (replaceActionControlTemplateOptions.committed() != null) { - contentJson.addProperty("committed", replaceActionControlTemplateOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete an action control template version. - * - * Delete a specific version of an action control template by providing an action control template ID and version - * number. You can't delete an action control template version that is assigned to one or more child accounts. You - * must remove the action control assignments first. - * - * @param deleteActionControlTemplateVersionOptions the {@link DeleteActionControlTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteActionControlTemplateVersion(DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlTemplateVersionOptions, - "deleteActionControlTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", deleteActionControlTemplateVersionOptions.actionControlTemplateId()); - pathParamsMap.put("version", deleteActionControlTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve an action control template version. - * - * Retrieve an action control template by providing an action control template ID and version number. - * - * @param getActionControlTemplateVersionOptions the {@link GetActionControlTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlTemplate} - */ - public ServiceCall getActionControlTemplateVersion(GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlTemplateVersionOptions, - "getActionControlTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", getActionControlTemplateVersionOptions.actionControlTemplateId()); - pathParamsMap.put("version", getActionControlTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlTemplateVersion"); - 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); - } - - /** - * Commit an action control template version. - * - * Commit an action control template version. You cannot make any further changes to the action control template once - * it's committed. If you have to make updates after committing a version, create a new version. - * - * @param commitActionControlTemplateOptions the {@link CommitActionControlTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall commitActionControlTemplate(CommitActionControlTemplateOptions commitActionControlTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(commitActionControlTemplateOptions, - "commitActionControlTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("action_control_template_id", commitActionControlTemplateOptions.actionControlTemplateId()); - pathParamsMap.put("version", commitActionControlTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_templates/{action_control_template_id}/versions/{version}/commit", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitActionControlTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get action control template assignments. - * - * Get action control template assignments by attributes. The following attributes are supported: - * `account_id`, `template_id`, `template_version`, `sort`. - * `account_id` is a required query parameter. Only action control template assignments with the specified attributes - * and accessible by the caller are returned. If the caller does not have read access to any action control template - * assignments, an empty array is returned. - * - * @param listActionControlAssignmentsOptions the {@link ListActionControlAssignmentsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignmentCollection} - */ - public ServiceCall listActionControlAssignments(ListActionControlAssignmentsOptions listActionControlAssignmentsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listActionControlAssignmentsOptions, - "listActionControlAssignmentsOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listActionControlAssignments"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listActionControlAssignmentsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listActionControlAssignmentsOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listActionControlAssignmentsOptions.accountId())); - if (listActionControlAssignmentsOptions.templateId() != null) { - builder.query("template_id", String.valueOf(listActionControlAssignmentsOptions.templateId())); - } - if (listActionControlAssignmentsOptions.templateVersion() != null) { - builder.query("template_version", String.valueOf(listActionControlAssignmentsOptions.templateVersion())); - } - if (listActionControlAssignmentsOptions.limit() != null) { - builder.query("limit", String.valueOf(listActionControlAssignmentsOptions.limit())); - } - if (listActionControlAssignmentsOptions.start() != null) { - builder.query("start", String.valueOf(listActionControlAssignmentsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create an action control template assignment. - * - * Assign an action control template to child accounts and account groups. This creates the action control in the - * accounts and account groups that you specify. - * - * @param createActionControlTemplateAssignmentOptions the {@link CreateActionControlTemplateAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignmentCollection} - */ - public ServiceCall createActionControlTemplateAssignment(CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createActionControlTemplateAssignmentOptions, - "createActionControlTemplateAssignmentOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createActionControlTemplateAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createActionControlTemplateAssignmentOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createActionControlTemplateAssignmentOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateAssignmentOptions.target())); - contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createActionControlTemplateAssignmentOptions.templates())); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve an action control assignment. - * - * Retrieve an action control template assignment by providing an action control assignment ID. - * - * @param getActionControlAssignmentOptions the {@link GetActionControlAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignment} - */ - public ServiceCall getActionControlAssignment(GetActionControlAssignmentOptions getActionControlAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getActionControlAssignmentOptions, - "getActionControlAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", getActionControlAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getActionControlAssignment"); - 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 an action control assignment. - * - * Update an action control assignment by providing an action control assignment ID. - * - * @param updateActionControlAssignmentOptions the {@link UpdateActionControlAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ActionControlAssignment} - */ - public ServiceCall updateActionControlAssignment(UpdateActionControlAssignmentOptions updateActionControlAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateActionControlAssignmentOptions, - "updateActionControlAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", updateActionControlAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateActionControlAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updateActionControlAssignmentOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("template_version", updateActionControlAssignmentOptions.templateVersion()); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Remove an action control assignment. - * - * Remove an action control template assignment by providing an action control assignment ID. You can't delete an - * action control assignment if the status is "in_progress". - * - * @param deleteActionControlAssignmentOptions the {@link DeleteActionControlAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteActionControlAssignment(DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteActionControlAssignmentOptions, - "deleteActionControlAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", deleteActionControlAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/action_control_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteActionControlAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List role templates by attributes. - * - * List role templates and filter by attributes by using query parameters. The following attributes are supported: - * `account_id`, `name`, `role_name`, `role_service_name`, `state`, `limit`, `start`. - * `account_id` is a required query parameter. Only role templates that have the specified attributes and that the - * caller has read access to are returned. If the caller does not have read access to any role templates an empty - * array is returned. - * - * @param listRoleTemplatesOptions the {@link ListRoleTemplatesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplateCollection} - */ - public ServiceCall listRoleTemplates(ListRoleTemplatesOptions listRoleTemplatesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleTemplatesOptions, - "listRoleTemplatesOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleTemplates"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listRoleTemplatesOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listRoleTemplatesOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listRoleTemplatesOptions.accountId())); - if (listRoleTemplatesOptions.name() != null) { - builder.query("name", String.valueOf(listRoleTemplatesOptions.name())); - } - if (listRoleTemplatesOptions.roleName() != null) { - builder.query("role_name", String.valueOf(listRoleTemplatesOptions.roleName())); - } - if (listRoleTemplatesOptions.roleServiceName() != null) { - builder.query("role_service_name", String.valueOf(listRoleTemplatesOptions.roleServiceName())); - } - if (listRoleTemplatesOptions.state() != null) { - builder.query("state", String.valueOf(listRoleTemplatesOptions.state())); - } - if (listRoleTemplatesOptions.limit() != null) { - builder.query("limit", String.valueOf(listRoleTemplatesOptions.limit())); - } - if (listRoleTemplatesOptions.start() != null) { - builder.query("start", String.valueOf(listRoleTemplatesOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create role template. - * - * Create a role template. Role templates define roles from an existing system or service defined role. - * - * @param createRoleTemplateOptions the {@link CreateRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall createRoleTemplate(CreateRoleTemplateOptions createRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateOptions, - "createRoleTemplateOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createRoleTemplateOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createRoleTemplateOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("name", createRoleTemplateOptions.name()); - contentJson.addProperty("account_id", createRoleTemplateOptions.accountId()); - if (createRoleTemplateOptions.description() != null) { - contentJson.addProperty("description", createRoleTemplateOptions.description()); - } - if (createRoleTemplateOptions.committed() != null) { - contentJson.addProperty("committed", createRoleTemplateOptions.committed()); - } - if (createRoleTemplateOptions.role() != null) { - contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateOptions.role())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve the latest version of a role template. - * - * Retrieve the latest version of a role template by providing a role template ID. - * - * @param getRoleTemplateOptions the {@link GetRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall getRoleTemplate(GetRoleTemplateOptions getRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleTemplateOptions, - "getRoleTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", getRoleTemplateOptions.roleTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getRoleTemplateOptions.state() != null) { - builder.query("state", String.valueOf(getRoleTemplateOptions.state())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a Role template. - * - * Delete a role template by providing the role template ID. This deletes all versions of this template. A role - * template can't be deleted if any version of the template is assigned to one or more child accounts. You must remove - * the role assignments first. - * - * @param deleteRoleTemplateOptions the {@link DeleteRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteRoleTemplate(DeleteRoleTemplateOptions deleteRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleTemplateOptions, - "deleteRoleTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", deleteRoleTemplateOptions.roleTemplateId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a new role template version. - * - * Create a new version of a role template. Use this if you need to make updates to a role template that is committed. - * - * @param createRoleTemplateVersionOptions the {@link CreateRoleTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall createRoleTemplateVersion(CreateRoleTemplateVersionOptions createRoleTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateVersionOptions, - "createRoleTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", createRoleTemplateVersionOptions.roleTemplateId()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - final JsonObject contentJson = new JsonObject(); - if (createRoleTemplateVersionOptions.name() != null) { - contentJson.addProperty("name", createRoleTemplateVersionOptions.name()); - } - if (createRoleTemplateVersionOptions.description() != null) { - contentJson.addProperty("description", createRoleTemplateVersionOptions.description()); - } - if (createRoleTemplateVersionOptions.role() != null) { - contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateVersionOptions.role())); - } - if (createRoleTemplateVersionOptions.committed() != null) { - contentJson.addProperty("committed", createRoleTemplateVersionOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve role template versions. - * - * Retrieve the versions of a role template by providing a role template ID. - * - * @param listRoleTemplateVersionsOptions the {@link ListRoleTemplateVersionsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplateVersionsCollection} - */ - public ServiceCall listRoleTemplateVersions(ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleTemplateVersionsOptions, - "listRoleTemplateVersionsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", listRoleTemplateVersionsOptions.roleTemplateId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleTemplateVersions"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listRoleTemplateVersionsOptions.state() != null) { - builder.query("state", String.valueOf(listRoleTemplateVersionsOptions.state())); - } - if (listRoleTemplateVersionsOptions.limit() != null) { - builder.query("limit", String.valueOf(listRoleTemplateVersionsOptions.limit())); - } - if (listRoleTemplateVersionsOptions.start() != null) { - builder.query("start", String.valueOf(listRoleTemplateVersionsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a role template version. - * - * Update a specific version of a role template. You can use this only if the version isn't committed. - * - * @param replaceRoleTemplateOptions the {@link ReplaceRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall replaceRoleTemplate(ReplaceRoleTemplateOptions replaceRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceRoleTemplateOptions, - "replaceRoleTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", replaceRoleTemplateOptions.roleTemplateId()); - pathParamsMap.put("version", replaceRoleTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "replaceRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", replaceRoleTemplateOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - if (replaceRoleTemplateOptions.name() != null) { - contentJson.addProperty("name", replaceRoleTemplateOptions.name()); - } - if (replaceRoleTemplateOptions.description() != null) { - contentJson.addProperty("description", replaceRoleTemplateOptions.description()); - } - if (replaceRoleTemplateOptions.role() != null) { - contentJson.add("role", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRoleTemplateOptions.role())); - } - if (replaceRoleTemplateOptions.committed() != null) { - contentJson.addProperty("committed", replaceRoleTemplateOptions.committed()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a role template version. - * - * Delete a specific version of a role template by providing a role template ID and version number. You can't delete a - * role template version that is assigned to one or more child accounts. You must remove the role assignments first. - * - * @param deleteRoleTemplateVersionOptions the {@link DeleteRoleTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteRoleTemplateVersion(DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleTemplateVersionOptions, - "deleteRoleTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", deleteRoleTemplateVersionOptions.roleTemplateId()); - pathParamsMap.put("version", deleteRoleTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleTemplateVersion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a role template version. - * - * Retrieve a role template by providing a role template ID and version number. - * - * @param getRoleTemplateVersionOptions the {@link GetRoleTemplateVersionOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleTemplate} - */ - public ServiceCall getRoleTemplateVersion(GetRoleTemplateVersionOptions getRoleTemplateVersionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleTemplateVersionOptions, - "getRoleTemplateVersionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", getRoleTemplateVersionOptions.roleTemplateId()); - pathParamsMap.put("version", getRoleTemplateVersionOptions.version()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleTemplateVersion"); - 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); - } - - /** - * Commit a role template version. - * - * Commit a role template version. You cannot make any further changes to the role template once it's committed. If - * you have to make updates after committing a version, create a new version. - * - * @param commitRoleTemplateOptions the {@link CommitRoleTemplateOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall commitRoleTemplate(CommitRoleTemplateOptions commitRoleTemplateOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(commitRoleTemplateOptions, - "commitRoleTemplateOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("role_template_id", commitRoleTemplateOptions.roleTemplateId()); - pathParamsMap.put("version", commitRoleTemplateOptions.version()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_templates/{role_template_id}/versions/{version}/commit", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "commitRoleTemplate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get role template assignments. - * - * Get role template assignments by attributes. The following attributes are supported: - * `account_id`, `template_id`, `template_version`, `target`, `target_type`, `limit`, `start`. - * `account_id` is a required query parameter. Only role template assignments with the specified attributes and - * accessible by the caller are returned. If the caller does not have read access to any role template assignments, an - * empty array is returned. - * - * @param listRoleAssignmentsOptions the {@link ListRoleAssignmentsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleAssignmentCollection} - */ - public ServiceCall listRoleAssignments(ListRoleAssignmentsOptions listRoleAssignmentsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listRoleAssignmentsOptions, - "listRoleAssignmentsOptions cannot be null"); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "listRoleAssignments"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listRoleAssignmentsOptions.acceptLanguage() != null) { - builder.header("Accept-Language", listRoleAssignmentsOptions.acceptLanguage()); - } - builder.query("account_id", String.valueOf(listRoleAssignmentsOptions.accountId())); - if (listRoleAssignmentsOptions.templateId() != null) { - builder.query("template_id", String.valueOf(listRoleAssignmentsOptions.templateId())); - } - if (listRoleAssignmentsOptions.templateVersion() != null) { - builder.query("template_version", String.valueOf(listRoleAssignmentsOptions.templateVersion())); - } - if (listRoleAssignmentsOptions.limit() != null) { - builder.query("limit", String.valueOf(listRoleAssignmentsOptions.limit())); - } - if (listRoleAssignmentsOptions.start() != null) { - builder.query("start", String.valueOf(listRoleAssignmentsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a role template assignment. - * - * Assign a role template to child accounts and account groups. This creates the role in the accounts and account - * groups that you specify. - * - * @param createRoleTemplateAssignmentOptions the {@link CreateRoleTemplateAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleAssignmentCollection} - */ - public ServiceCall createRoleTemplateAssignment(CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createRoleTemplateAssignmentOptions, - "createRoleTemplateAssignmentOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "createRoleTemplateAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createRoleTemplateAssignmentOptions.acceptLanguage() != null) { - builder.header("Accept-Language", createRoleTemplateAssignmentOptions.acceptLanguage()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateAssignmentOptions.target())); - contentJson.add("templates", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRoleTemplateAssignmentOptions.templates())); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Retrieve a role assignment. - * - * Retrieve a role template assignment by providing a role assignment ID. - * - * @param getRoleAssignmentOptions the {@link GetRoleAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleAssignment} - */ - public ServiceCall getRoleAssignment(GetRoleAssignmentOptions getRoleAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getRoleAssignmentOptions, - "getRoleAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", getRoleAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "getRoleAssignment"); - 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 a role assignment. - * - * Update a role assignment by providing a role assignment ID. - * - * @param updateRoleAssignmentOptions the {@link UpdateRoleAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RoleAssignment} - */ - public ServiceCall updateRoleAssignment(UpdateRoleAssignmentOptions updateRoleAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateRoleAssignmentOptions, - "updateRoleAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", updateRoleAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "updateRoleAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.header("If-Match", updateRoleAssignmentOptions.ifMatch()); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("template_version", updateRoleAssignmentOptions.templateVersion()); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Remove a role assignment. - * - * Remove a role template assignment by providing a role assignment ID. You can't delete a role assignment if the - * status is "in_progress". - * - * @param deleteRoleAssignmentOptions the {@link DeleteRoleAssignmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteRoleAssignment(DeleteRoleAssignmentOptions deleteRoleAssignmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRoleAssignmentOptions, - "deleteRoleAssignmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("assignment_id", deleteRoleAssignmentOptions.assignmentId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/role_assignments/{assignment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("iam_policy_management", "v1", "deleteRoleAssignment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java deleted file mode 100644 index af82ea2abe8..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagement.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The Access Management Account Settings that are currently set for the requested account. - */ -public class AccountSettingsAccessManagement extends GenericModel { - - @SerializedName("external_account_identity_interaction") - protected ExternalAccountIdentityInteraction externalAccountIdentityInteraction; - - protected AccountSettingsAccessManagement() { } - - /** - * Gets the externalAccountIdentityInteraction. - * - * How external accounts can interact in relation to the requested account. - * - * @return the externalAccountIdentityInteraction - */ - public ExternalAccountIdentityInteraction getExternalAccountIdentityInteraction() { - return externalAccountIdentityInteraction; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java deleted file mode 100644 index ea230f57263..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignment.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the assigned action control template. - */ -public class ActionControlAssignment extends GenericModel { - - /** - * The current operation of the action control assignment. - */ - public interface Operation { - /** create. */ - String CREATE = "create"; - /** apply. */ - String APPLY = "apply"; - /** update. */ - String UPDATE = "update"; - /** remove. */ - String REMOVE = "remove"; - } - - /** - * The action control assignment status. - */ - public interface Status { - /** accepted. */ - String ACCEPTED = "accepted"; - /** failure. */ - String FAILURE = "failure"; - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** superseded. */ - String SUPERSEDED = "superseded"; - } - - protected String id; - @SerializedName("account_id") - protected String accountId; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String operation; - protected List resources; - protected ActionControlAssignmentTemplate template; - protected AssignmentTargetDetails target; - protected String status; - - protected ActionControlAssignment() { } - - /** - * Gets the id. - * - * Action control assignment ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the accountId. - * - * The account GUID that the action control assignments belong to. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the href. - * - * The href URL that links to the action control assignments API by action control assignment ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the action control assignment was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the action control assignment. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the action control assignment was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the action control assignment. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the operation. - * - * The current operation of the action control assignment. - * - * @return the operation - */ - public String getOperation() { - return operation; - } - - /** - * Gets the resources. - * - * Resources created when action control template is assigned. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the template. - * - * The action control template id and version that will be assigned. - * - * @return the template - */ - public ActionControlAssignmentTemplate getTemplate() { - return template; - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the status. - * - * The action control assignment status. - * - * @return the status - */ - public String getStatus() { - return status; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java deleted file mode 100644 index a9d6b28ce39..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of action control assignments. - */ -public class ActionControlAssignmentCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List assignments; - - protected ActionControlAssignmentCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the assignments. - * - * List of action control assignments. - * - * @return the assignments - */ - public List getAssignments() { - return assignments; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java deleted file mode 100644 index 122d3c8277b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResource.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The action control assignment resources and target where the template is assigned. - */ -public class ActionControlAssignmentResource extends GenericModel { - - protected AssignmentTargetDetails target; - @SerializedName("action_control") - protected ActionControlAssignmentResourceActionControl actionControl; - - protected ActionControlAssignmentResource() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the actionControl. - * - * Set of properties of the assigned resource or error message if assignment failed. - * - * @return the actionControl - */ - public ActionControlAssignmentResourceActionControl getActionControl() { - return actionControl; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java deleted file mode 100644 index 0e5550eb4da..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControl.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Set of properties of the assigned resource or error message if assignment failed. - */ -public class ActionControlAssignmentResourceActionControl extends GenericModel { - - @SerializedName("resource_created") - protected ActionControlAssignmentResourceCreated resourceCreated; - @SerializedName("error_message") - protected AssignmentResourceError errorMessage; - - protected ActionControlAssignmentResourceActionControl() { } - - /** - * Gets the resourceCreated. - * - * On success, it includes the action control assigned. - * - * @return the resourceCreated - */ - public ActionControlAssignmentResourceCreated getResourceCreated() { - return resourceCreated; - } - - /** - * Gets the errorMessage. - * - * Body parameters for assignment error. - * - * @return the errorMessage - */ - public AssignmentResourceError getErrorMessage() { - return errorMessage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java deleted file mode 100644 index 6ecbd23392a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreated.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * On success, it includes the action control assigned. - */ -public class ActionControlAssignmentResourceCreated extends GenericModel { - - protected String id; - - protected ActionControlAssignmentResourceCreated() { } - - /** - * Gets the id. - * - * action control id. - * - * @return the id - */ - public String getId() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java deleted file mode 100644 index 4e6d2543e18..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplate.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The action control template id and version that will be assigned. - */ -public class ActionControlAssignmentTemplate extends GenericModel { - - protected String id; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String version; - - /** - * Instantiates a new Builder from an existing ActionControlAssignmentTemplate instance. - * - * @param actionControlAssignmentTemplate the instance to initialize the Builder with - */ - private Builder(ActionControlAssignmentTemplate actionControlAssignmentTemplate) { - this.id = actionControlAssignmentTemplate.id; - this.version = actionControlAssignmentTemplate.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param id the id - * @param version the version - */ - public Builder(String id, String version) { - this.id = id; - this.version = version; - } - - /** - * Builds a ActionControlAssignmentTemplate. - * - * @return the new ActionControlAssignmentTemplate instance - */ - public ActionControlAssignmentTemplate build() { - return new ActionControlAssignmentTemplate(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the ActionControlAssignmentTemplate builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the ActionControlAssignmentTemplate builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected ActionControlAssignmentTemplate() { } - - protected ActionControlAssignmentTemplate(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - id = builder.id; - version = builder.version; - } - - /** - * New builder. - * - * @return a ActionControlAssignmentTemplate builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * Action control template ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java deleted file mode 100644 index 78b6d56be6d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * ActionControlAssignmentsPager can be used to simplify the use of the "listActionControlAssignments" method. - */ -public class ActionControlAssignmentsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListActionControlAssignmentsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected ActionControlAssignmentsPager() { } - - /** - * Constructs a new ActionControlAssignmentsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlAssignments" method - * @param options the ListActionControlAssignmentsOptions instance to be used to invoke the "listActionControlAssignments" method - */ - public ActionControlAssignmentsPager(IamPolicyManagement client, ListActionControlAssignmentsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<ActionControlAssignment> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListActionControlAssignmentsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - ActionControlAssignmentCollection result = client.listActionControlAssignments(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getAssignments(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<ActionControlAssignment> containing all results returned by the "listActionControlAssignments" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java deleted file mode 100644 index 157c9f6a390..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplate.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the action control template. - */ -public class ActionControlTemplate extends GenericModel { - - /** - * State of action control template. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String name; - protected String description; - @SerializedName("account_id") - protected String accountId; - protected Boolean committed; - @SerializedName("action_control") - protected TemplateActionControl actionControl; - protected String id; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String version; - protected String state; - - protected ActionControlTemplate() { } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the description. - * - * Description of the action control template. This is shown to users in the enterprise account. Use this to describe - * the purpose or context of the action control for enterprise users managing IAM templates. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the committed. - * - * Committed status of the template. If committed is set to true, then the template version can no longer be updated. - * - * @return the committed - */ - public Boolean isCommitted() { - return committed; - } - - /** - * Gets the actionControl. - * - * The action control properties that are created in an action resource when the template is assigned. - * - * @return the actionControl - */ - public TemplateActionControl getActionControl() { - return actionControl; - } - - /** - * Gets the id. - * - * The action control template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the action control templates API by action control template ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the action control template was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the action control template. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the action control template was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the action control template. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the version. - * - * The version number of the template used to identify different versions of same template. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the state. - * - * State of action control template. - * - * @return the state - */ - public String getState() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java deleted file mode 100644 index e7536d2c9ae..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollection.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of action control templates. - */ -public class ActionControlTemplateCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - @SerializedName("action_control_templates") - protected List actionControlTemplates; - - protected ActionControlTemplateCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the actionControlTemplates. - * - * List of action control templates. - * - * @return the actionControlTemplates - */ - public List getActionControlTemplates() { - return actionControlTemplates; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java deleted file mode 100644 index 5e26f45cf46..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of versions for a specific action control template. - */ -public class ActionControlTemplateVersionsCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List versions; - - protected ActionControlTemplateVersionsCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the versions. - * - * List of action control templates versions. - * - * @return the versions - */ - public List getVersions() { - return versions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java deleted file mode 100644 index 660aefe11ba..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * ActionControlTemplateVersionsPager can be used to simplify the use of the "listActionControlTemplateVersions" method. - */ -public class ActionControlTemplateVersionsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListActionControlTemplateVersionsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected ActionControlTemplateVersionsPager() { } - - /** - * Constructs a new ActionControlTemplateVersionsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlTemplateVersions" method - * @param options the ListActionControlTemplateVersionsOptions instance to be used to invoke the "listActionControlTemplateVersions" method - */ - public ActionControlTemplateVersionsPager(IamPolicyManagement client, ListActionControlTemplateVersionsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<ActionControlTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListActionControlTemplateVersionsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - ActionControlTemplateVersionsCollection result = client.listActionControlTemplateVersions(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getVersions(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<ActionControlTemplate> containing all results returned by the "listActionControlTemplateVersions" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java deleted file mode 100644 index bd326c8d7ec..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplatesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * ActionControlTemplatesPager can be used to simplify the use of the "listActionControlTemplates" method. - */ -public class ActionControlTemplatesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListActionControlTemplatesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected ActionControlTemplatesPager() { } - - /** - * Constructs a new ActionControlTemplatesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listActionControlTemplates" method - * @param options the ListActionControlTemplatesOptions instance to be used to invoke the "listActionControlTemplates" method - */ - public ActionControlTemplatesPager(IamPolicyManagement client, ListActionControlTemplatesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<ActionControlTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListActionControlTemplatesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - ActionControlTemplateCollection result = client.listActionControlTemplates(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getActionControlTemplates(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<ActionControlTemplate> containing all results returned by the "listActionControlTemplates" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java deleted file mode 100644 index c454c7a3ef5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreated.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * On success, includes the policy that is assigned. - */ -public class AssignmentResourceCreated extends GenericModel { - - protected String id; - - protected AssignmentResourceCreated() { } - - /** - * Gets the id. - * - * Policy id. - * - * @return the id - */ - public String getId() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java deleted file mode 100644 index e74dbe58b3a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceError.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Body parameters for assignment error. - */ -public class AssignmentResourceError extends GenericModel { - - protected String name; - protected String errorCode; - protected String message; - protected String code; - protected List errors; - - protected AssignmentResourceError() { } - - /** - * Gets the name. - * - * Name of the error. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the errorCode. - * - * error code. - * - * @return the errorCode - */ - public String getErrorCode() { - return errorCode; - } - - /** - * Gets the message. - * - * Error message detailing the nature of the error. - * - * @return the message - */ - public String getMessage() { - return message; - } - - /** - * Gets the code. - * - * Internal status code for the error. - * - * @return the code - */ - public String getCode() { - return code; - } - - /** - * Gets the errors. - * - * The errors encountered during the response. - * - * @return the errors - */ - public List getErrors() { - return errors; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java deleted file mode 100644 index 893d528604c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetails.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * assignment target account and type. - */ -public class AssignmentTargetDetails extends GenericModel { - - /** - * Assignment target type. - */ - public interface Type { - /** Account. */ - String ACCOUNT = "Account"; - } - - protected String type; - protected String id; - - /** - * Builder. - */ - public static class Builder { - private String type; - private String id; - - /** - * Instantiates a new Builder from an existing AssignmentTargetDetails instance. - * - * @param assignmentTargetDetails the instance to initialize the Builder with - */ - private Builder(AssignmentTargetDetails assignmentTargetDetails) { - this.type = assignmentTargetDetails.type; - this.id = assignmentTargetDetails.id; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param type the type - * @param id the id - */ - public Builder(String type, String id) { - this.type = type; - this.id = id; - } - - /** - * Builds a AssignmentTargetDetails. - * - * @return the new AssignmentTargetDetails instance - */ - public AssignmentTargetDetails build() { - return new AssignmentTargetDetails(this); - } - - /** - * Set the type. - * - * @param type the type - * @return the AssignmentTargetDetails builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the id. - * - * @param id the id - * @return the AssignmentTargetDetails builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - } - - protected AssignmentTargetDetails() { } - - protected AssignmentTargetDetails(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - type = builder.type; - id = builder.id; - } - - /** - * New builder. - * - * @return a AssignmentTargetDetails builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the type. - * - * Assignment target type. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the id. - * - * ID of the target account. - * - * @return the id - */ - public String id() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java deleted file mode 100644 index b8025e305a9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetails.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * policy template details. - */ -public class AssignmentTemplateDetails extends GenericModel { - - protected String id; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String version; - - /** - * Instantiates a new Builder from an existing AssignmentTemplateDetails instance. - * - * @param assignmentTemplateDetails the instance to initialize the Builder with - */ - private Builder(AssignmentTemplateDetails assignmentTemplateDetails) { - this.id = assignmentTemplateDetails.id; - this.version = assignmentTemplateDetails.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a AssignmentTemplateDetails. - * - * @return the new AssignmentTemplateDetails instance - */ - public AssignmentTemplateDetails build() { - return new AssignmentTemplateDetails(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the AssignmentTemplateDetails builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the AssignmentTemplateDetails builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected AssignmentTemplateDetails() { } - - protected AssignmentTemplateDetails(Builder builder) { - id = builder.id; - version = builder.version; - } - - /** - * New builder. - * - * @return a AssignmentTemplateDetails builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * Policy template ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the version. - * - * Policy template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java deleted file mode 100644 index 78291e6c2c5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The commitActionControlTemplate options. - */ -public class CommitActionControlTemplateOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing CommitActionControlTemplateOptions instance. - * - * @param commitActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(CommitActionControlTemplateOptions commitActionControlTemplateOptions) { - this.actionControlTemplateId = commitActionControlTemplateOptions.actionControlTemplateId; - this.version = commitActionControlTemplateOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - * @param version the version - */ - public Builder(String actionControlTemplateId, String version) { - this.actionControlTemplateId = actionControlTemplateId; - this.version = version; - } - - /** - * Builds a CommitActionControlTemplateOptions. - * - * @return the new CommitActionControlTemplateOptions instance - */ - public CommitActionControlTemplateOptions build() { - return new CommitActionControlTemplateOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the CommitActionControlTemplateOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the CommitActionControlTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected CommitActionControlTemplateOptions() { } - - protected CommitActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a CommitActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the version. - * - * The action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java deleted file mode 100644 index 61283194c44..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The commitPolicyTemplate options. - */ -public class CommitPolicyTemplateOptions extends GenericModel { - - protected String policyTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing CommitPolicyTemplateOptions instance. - * - * @param commitPolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(CommitPolicyTemplateOptions commitPolicyTemplateOptions) { - this.policyTemplateId = commitPolicyTemplateOptions.policyTemplateId; - this.version = commitPolicyTemplateOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param version the version - */ - public Builder(String policyTemplateId, String version) { - this.policyTemplateId = policyTemplateId; - this.version = version; - } - - /** - * Builds a CommitPolicyTemplateOptions. - * - * @return the new CommitPolicyTemplateOptions instance - */ - public CommitPolicyTemplateOptions build() { - return new CommitPolicyTemplateOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the CommitPolicyTemplateOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the CommitPolicyTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected CommitPolicyTemplateOptions() { } - - protected CommitPolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - policyTemplateId = builder.policyTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a CommitPolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the version. - * - * The policy template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java deleted file mode 100644 index 7e93c92fb0b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The commitRoleTemplate options. - */ -public class CommitRoleTemplateOptions extends GenericModel { - - protected String roleTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing CommitRoleTemplateOptions instance. - * - * @param commitRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(CommitRoleTemplateOptions commitRoleTemplateOptions) { - this.roleTemplateId = commitRoleTemplateOptions.roleTemplateId; - this.version = commitRoleTemplateOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - * @param version the version - */ - public Builder(String roleTemplateId, String version) { - this.roleTemplateId = roleTemplateId; - this.version = version; - } - - /** - * Builds a CommitRoleTemplateOptions. - * - * @return the new CommitRoleTemplateOptions instance - */ - public CommitRoleTemplateOptions build() { - return new CommitRoleTemplateOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the CommitRoleTemplateOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the CommitRoleTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected CommitRoleTemplateOptions() { } - - protected CommitRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - roleTemplateId = builder.roleTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a CommitRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the version. - * - * The role template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java deleted file mode 100644 index be0c3d0aa98..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWith.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Details of conflicting resource. - */ -public class ConflictsWith extends GenericModel { - - protected String etag; - protected String role; - protected String policy; - - protected ConflictsWith() { } - - /** - * Gets the etag. - * - * The revision number of the resource. - * - * @return the etag - */ - public String getEtag() { - return etag; - } - - /** - * Gets the role. - * - * The conflicting role of ID. - * - * @return the role - */ - public String getRole() { - return role; - } - - /** - * Gets the policy. - * - * The conflicting policy ID. - * - * @return the policy - */ - public String getPolicy() { - return policy; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java deleted file mode 100644 index 15e502ac214..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Control.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Specifies the type of access that is granted by the policy. - */ -public class Control extends GenericModel { - - protected Grant grant; - - /** - * Builder. - */ - public static class Builder { - private Grant grant; - - /** - * Instantiates a new Builder from an existing Control instance. - * - * @param control the instance to initialize the Builder with - */ - private Builder(Control control) { - this.grant = control.grant; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param grant the grant - */ - public Builder(Grant grant) { - this.grant = grant; - } - - /** - * Builds a Control. - * - * @return the new Control instance - */ - public Control build() { - return new Control(this); - } - - /** - * Set the grant. - * - * @param grant the grant - * @return the Control builder - */ - public Builder grant(Grant grant) { - this.grant = grant; - return this; - } - } - - protected Control() { } - - protected Control(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.grant, - "grant cannot be null"); - grant = builder.grant; - } - - /** - * New builder. - * - * @return a Control builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the grant. - * - * Permission is granted by the policy. - * - * @return the grant - */ - public Grant grant() { - return grant; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java deleted file mode 100644 index 5055d290c80..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponse.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * ControlResponse. - * - * Classes which extend this class: - * - ControlResponseControl - * - ControlResponseControlWithEnrichedRoles - */ -public class ControlResponse extends GenericModel { - - protected Grant grant; - - protected ControlResponse() { } - - /** - * Gets the grant. - * - * Permission is granted by the policy. - * - * @return the grant - */ - public Grant getGrant() { - return grant; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java deleted file mode 100644 index 5934ebf7c76..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControl.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * Specifies the type of access that is granted by the policy. - */ -public class ControlResponseControl extends ControlResponse { - - - protected ControlResponseControl() { } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java deleted file mode 100644 index 8b3c73d73c0..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRoles.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * Specifies the type of access that is granted by the policy with additional role information. - */ -public class ControlResponseControlWithEnrichedRoles extends ControlResponse { - - - protected ControlResponseControlWithEnrichedRoles() { } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java deleted file mode 100644 index 1ccd3f8b4dd..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptions.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createActionControlTemplateAssignment options. - */ -public class CreateActionControlTemplateAssignmentOptions extends GenericModel { - - protected AssignmentTargetDetails target; - protected List templates; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private AssignmentTargetDetails target; - private List templates; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateActionControlTemplateAssignmentOptions instance. - * - * @param createActionControlTemplateAssignmentOptions the instance to initialize the Builder with - */ - private Builder(CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptions) { - this.target = createActionControlTemplateAssignmentOptions.target; - this.templates = createActionControlTemplateAssignmentOptions.templates; - this.acceptLanguage = createActionControlTemplateAssignmentOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param target the target - * @param templates the templates - */ - public Builder(AssignmentTargetDetails target, List templates) { - this.target = target; - this.templates = templates; - } - - /** - * Builds a CreateActionControlTemplateAssignmentOptions. - * - * @return the new CreateActionControlTemplateAssignmentOptions instance - */ - public CreateActionControlTemplateAssignmentOptions build() { - return new CreateActionControlTemplateAssignmentOptions(this); - } - - /** - * Adds a new element to templates. - * - * @param templates the new element to be added - * @return the CreateActionControlTemplateAssignmentOptions builder - */ - public Builder addTemplates(ActionControlAssignmentTemplate templates) { - com.ibm.cloud.sdk.core.util.Validator.notNull(templates, - "templates cannot be null"); - if (this.templates == null) { - this.templates = new ArrayList(); - } - this.templates.add(templates); - return this; - } - - /** - * Set the target. - * - * @param target the target - * @return the CreateActionControlTemplateAssignmentOptions builder - */ - public Builder target(AssignmentTargetDetails target) { - this.target = target; - return this; - } - - /** - * Set the templates. - * Existing templates will be replaced. - * - * @param templates the templates - * @return the CreateActionControlTemplateAssignmentOptions builder - */ - public Builder templates(List templates) { - this.templates = templates; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateActionControlTemplateAssignmentOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateActionControlTemplateAssignmentOptions() { } - - protected CreateActionControlTemplateAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, - "target cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, - "templates cannot be null"); - target = builder.target; - templates = builder.templates; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateActionControlTemplateAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails target() { - return target; - } - - /** - * Gets the templates. - * - * List of action control template details for action control assignment. - * - * @return the templates - */ - public List templates() { - return templates; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java deleted file mode 100644 index 37594a7a440..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptions.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createActionControlTemplate options. - */ -public class CreateActionControlTemplateOptions extends GenericModel { - - protected String name; - protected String accountId; - protected String description; - protected Boolean committed; - protected TemplateActionControl actionControl; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String accountId; - private String description; - private Boolean committed; - private TemplateActionControl actionControl; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateActionControlTemplateOptions instance. - * - * @param createActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(CreateActionControlTemplateOptions createActionControlTemplateOptions) { - this.name = createActionControlTemplateOptions.name; - this.accountId = createActionControlTemplateOptions.accountId; - this.description = createActionControlTemplateOptions.description; - this.committed = createActionControlTemplateOptions.committed; - this.actionControl = createActionControlTemplateOptions.actionControl; - this.acceptLanguage = createActionControlTemplateOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param accountId the accountId - */ - public Builder(String name, String accountId) { - this.name = name; - this.accountId = accountId; - } - - /** - * Builds a CreateActionControlTemplateOptions. - * - * @return the new CreateActionControlTemplateOptions instance - */ - public CreateActionControlTemplateOptions build() { - return new CreateActionControlTemplateOptions(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateActionControlTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the CreateActionControlTemplateOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateActionControlTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreateActionControlTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - - /** - * Set the actionControl. - * - * @param actionControl the actionControl - * @return the CreateActionControlTemplateOptions builder - */ - public Builder actionControl(TemplateActionControl actionControl) { - this.actionControl = actionControl; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateActionControlTemplateOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateActionControlTemplateOptions() { } - - protected CreateActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - name = builder.name; - accountId = builder.accountId; - description = builder.description; - committed = builder.committed; - actionControl = builder.actionControl; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the description. - * - * Description of the action control template. This is shown to users in the enterprise account. Use this to describe - * the purpose or context of the action control for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template. If committed is set to true, then the template version can no longer be updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } - - /** - * Gets the actionControl. - * - * The action control properties that are created in an action resource when the template is assigned. - * - * @return the actionControl - */ - public TemplateActionControl actionControl() { - return actionControl; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java deleted file mode 100644 index 13ce1a8e60f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptions.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createActionControlTemplateVersion options. - */ -public class CreateActionControlTemplateVersionOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String name; - protected String description; - protected TemplateActionControl actionControl; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String name; - private String description; - private TemplateActionControl actionControl; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing CreateActionControlTemplateVersionOptions instance. - * - * @param createActionControlTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptions) { - this.actionControlTemplateId = createActionControlTemplateVersionOptions.actionControlTemplateId; - this.name = createActionControlTemplateVersionOptions.name; - this.description = createActionControlTemplateVersionOptions.description; - this.actionControl = createActionControlTemplateVersionOptions.actionControl; - this.committed = createActionControlTemplateVersionOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - */ - public Builder(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - } - - /** - * Builds a CreateActionControlTemplateVersionOptions. - * - * @return the new CreateActionControlTemplateVersionOptions instance - */ - public CreateActionControlTemplateVersionOptions build() { - return new CreateActionControlTemplateVersionOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actionControl. - * - * @param actionControl the actionControl - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder actionControl(TemplateActionControl actionControl) { - this.actionControl = actionControl; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreateActionControlTemplateVersionOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected CreateActionControlTemplateVersionOptions() { } - - protected CreateActionControlTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - name = builder.name; - description = builder.description; - actionControl = builder.actionControl; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a CreateActionControlTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * The action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will - * change the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the action control template. This is shown to users in the enterprise account. Use this to describe - * the purpose or context of the action control for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actionControl. - * - * The action control properties that are created in an action resource when the template is assigned. - * - * @return the actionControl - */ - public TemplateActionControl actionControl() { - return actionControl; - } - - /** - * Gets the committed. - * - * Committed status of the template version. If committed is set to true, then the template version can no longer be - * updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java deleted file mode 100644 index b6ec9f78c02..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptions.java +++ /dev/null @@ -1,311 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createPolicy options. - */ -public class CreatePolicyOptions extends GenericModel { - - protected String type; - protected List subjects; - protected List roles; - protected List resources; - protected String description; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String type; - private List subjects; - private List roles; - private List resources; - private String description; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreatePolicyOptions instance. - * - * @param createPolicyOptions the instance to initialize the Builder with - */ - private Builder(CreatePolicyOptions createPolicyOptions) { - this.type = createPolicyOptions.type; - this.subjects = createPolicyOptions.subjects; - this.roles = createPolicyOptions.roles; - this.resources = createPolicyOptions.resources; - this.description = createPolicyOptions.description; - this.acceptLanguage = createPolicyOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param type the type - * @param subjects the subjects - * @param roles the roles - * @param resources the resources - */ - public Builder(String type, List subjects, List roles, List resources) { - this.type = type; - this.subjects = subjects; - this.roles = roles; - this.resources = resources; - } - - /** - * Builds a CreatePolicyOptions. - * - * @return the new CreatePolicyOptions instance - */ - public CreatePolicyOptions build() { - return new CreatePolicyOptions(this); - } - - /** - * Adds a new element to subjects. - * - * @param subjects the new element to be added - * @return the CreatePolicyOptions builder - */ - public Builder addSubjects(PolicySubject subjects) { - com.ibm.cloud.sdk.core.util.Validator.notNull(subjects, - "subjects cannot be null"); - if (this.subjects == null) { - this.subjects = new ArrayList(); - } - this.subjects.add(subjects); - return this; - } - - /** - * Adds a new element to roles. - * - * @param roles the new element to be added - * @return the CreatePolicyOptions builder - */ - public Builder addRoles(PolicyRole roles) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roles, - "roles cannot be null"); - if (this.roles == null) { - this.roles = new ArrayList(); - } - this.roles.add(roles); - return this; - } - - /** - * Adds a new element to resources. - * - * @param resources the new element to be added - * @return the CreatePolicyOptions builder - */ - public Builder addResources(PolicyResource resources) { - com.ibm.cloud.sdk.core.util.Validator.notNull(resources, - "resources cannot be null"); - if (this.resources == null) { - this.resources = new ArrayList(); - } - this.resources.add(resources); - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the CreatePolicyOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the subjects. - * Existing subjects will be replaced. - * - * @param subjects the subjects - * @return the CreatePolicyOptions builder - */ - public Builder subjects(List subjects) { - this.subjects = subjects; - return this; - } - - /** - * Set the roles. - * Existing roles will be replaced. - * - * @param roles the roles - * @return the CreatePolicyOptions builder - */ - public Builder roles(List roles) { - this.roles = roles; - return this; - } - - /** - * Set the resources. - * Existing resources will be replaced. - * - * @param resources the resources - * @return the CreatePolicyOptions builder - */ - public Builder resources(List resources) { - this.resources = resources; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreatePolicyOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreatePolicyOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreatePolicyOptions() { } - - protected CreatePolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subjects, - "subjects cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, - "roles cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resources, - "resources cannot be null"); - type = builder.type; - subjects = builder.subjects; - roles = builder.roles; - resources = builder.resources; - description = builder.description; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreatePolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the subjects. - * - * The subjects associated with a policy. - * - * @return the subjects - */ - public List subjects() { - return subjects; - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List roles() { - return roles; - } - - /** - * Gets the resources. - * - * The resources associated with a policy. - * - * @return the resources - */ - public List resources() { - return resources; - } - - /** - * Gets the description. - * - * Customer-defined description. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java deleted file mode 100644 index b71ca393f11..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptions.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createPolicyTemplateAssignment options. - */ -public class CreatePolicyTemplateAssignmentOptions extends GenericModel { - - protected String version; - protected AssignmentTargetDetails target; - protected List templates; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String version; - private AssignmentTargetDetails target; - private List templates; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreatePolicyTemplateAssignmentOptions instance. - * - * @param createPolicyTemplateAssignmentOptions the instance to initialize the Builder with - */ - private Builder(CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptions) { - this.version = createPolicyTemplateAssignmentOptions.version; - this.target = createPolicyTemplateAssignmentOptions.target; - this.templates = createPolicyTemplateAssignmentOptions.templates; - this.acceptLanguage = createPolicyTemplateAssignmentOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param version the version - * @param target the target - * @param templates the templates - */ - public Builder(String version, AssignmentTargetDetails target, List templates) { - this.version = version; - this.target = target; - this.templates = templates; - } - - /** - * Builds a CreatePolicyTemplateAssignmentOptions. - * - * @return the new CreatePolicyTemplateAssignmentOptions instance - */ - public CreatePolicyTemplateAssignmentOptions build() { - return new CreatePolicyTemplateAssignmentOptions(this); - } - - /** - * Adds a new element to templates. - * - * @param templates the new element to be added - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder addTemplates(AssignmentTemplateDetails templates) { - com.ibm.cloud.sdk.core.util.Validator.notNull(templates, - "templates cannot be null"); - if (this.templates == null) { - this.templates = new ArrayList(); - } - this.templates.add(templates); - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the target. - * - * @param target the target - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder target(AssignmentTargetDetails target) { - this.target = target; - return this; - } - - /** - * Set the templates. - * Existing templates will be replaced. - * - * @param templates the templates - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder templates(List templates) { - this.templates = templates; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreatePolicyTemplateAssignmentOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreatePolicyTemplateAssignmentOptions() { } - - protected CreatePolicyTemplateAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, - "target cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, - "templates cannot be null"); - version = builder.version; - target = builder.target; - templates = builder.templates; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreatePolicyTemplateAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the version. - * - * specify version of response body format. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails target() { - return target; - } - - /** - * Gets the templates. - * - * List of template details for policy assignment. - * - * @return the templates - */ - public List templates() { - return templates; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java deleted file mode 100644 index 72944308428..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptions.java +++ /dev/null @@ -1,255 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createPolicyTemplate options. - */ -public class CreatePolicyTemplateOptions extends GenericModel { - - protected String name; - protected String accountId; - protected TemplatePolicy policy; - protected String description; - protected Boolean committed; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String accountId; - private TemplatePolicy policy; - private String description; - private Boolean committed; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreatePolicyTemplateOptions instance. - * - * @param createPolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(CreatePolicyTemplateOptions createPolicyTemplateOptions) { - this.name = createPolicyTemplateOptions.name; - this.accountId = createPolicyTemplateOptions.accountId; - this.policy = createPolicyTemplateOptions.policy; - this.description = createPolicyTemplateOptions.description; - this.committed = createPolicyTemplateOptions.committed; - this.acceptLanguage = createPolicyTemplateOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param accountId the accountId - * @param policy the policy - */ - public Builder(String name, String accountId, TemplatePolicy policy) { - this.name = name; - this.accountId = accountId; - this.policy = policy; - } - - /** - * Builds a CreatePolicyTemplateOptions. - * - * @return the new CreatePolicyTemplateOptions instance - */ - public CreatePolicyTemplateOptions build() { - return new CreatePolicyTemplateOptions(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the CreatePolicyTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the CreatePolicyTemplateOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the policy. - * - * @param policy the policy - * @return the CreatePolicyTemplateOptions builder - */ - public Builder policy(TemplatePolicy policy) { - this.policy = policy; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreatePolicyTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreatePolicyTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreatePolicyTemplateOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreatePolicyTemplateOptions() { } - - protected CreatePolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.policy, - "policy cannot be null"); - name = builder.name; - accountId = builder.accountId; - policy = builder.policy; - description = builder.description; - committed = builder.committed; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreatePolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy policy() { - return policy; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java deleted file mode 100644 index 6903774c335..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptions.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createPolicyTemplateVersion options. - */ -public class CreatePolicyTemplateVersionOptions extends GenericModel { - - protected String policyTemplateId; - protected TemplatePolicy policy; - protected String name; - protected String description; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private TemplatePolicy policy; - private String name; - private String description; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing CreatePolicyTemplateVersionOptions instance. - * - * @param createPolicyTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptions) { - this.policyTemplateId = createPolicyTemplateVersionOptions.policyTemplateId; - this.policy = createPolicyTemplateVersionOptions.policy; - this.name = createPolicyTemplateVersionOptions.name; - this.description = createPolicyTemplateVersionOptions.description; - this.committed = createPolicyTemplateVersionOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param policy the policy - */ - public Builder(String policyTemplateId, TemplatePolicy policy) { - this.policyTemplateId = policyTemplateId; - this.policy = policy; - } - - /** - * Builds a CreatePolicyTemplateVersionOptions. - * - * @return the new CreatePolicyTemplateVersionOptions instance - */ - public CreatePolicyTemplateVersionOptions build() { - return new CreatePolicyTemplateVersionOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the policy. - * - * @param policy the policy - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder policy(TemplatePolicy policy) { - this.policy = policy; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreatePolicyTemplateVersionOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected CreatePolicyTemplateVersionOptions() { } - - protected CreatePolicyTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.policy, - "policy cannot be null"); - policyTemplateId = builder.policyTemplateId; - policy = builder.policy; - name = builder.name; - description = builder.description; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a CreatePolicyTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy policy() { - return policy; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template version. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java deleted file mode 100644 index 725ec5d8a53..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptions.java +++ /dev/null @@ -1,308 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createRole options. - */ -public class CreateRoleOptions extends GenericModel { - - protected String displayName; - protected List actions; - protected String name; - protected String accountId; - protected String serviceName; - protected String description; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String displayName; - private List actions; - private String name; - private String accountId; - private String serviceName; - private String description; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateRoleOptions instance. - * - * @param createRoleOptions the instance to initialize the Builder with - */ - private Builder(CreateRoleOptions createRoleOptions) { - this.displayName = createRoleOptions.displayName; - this.actions = createRoleOptions.actions; - this.name = createRoleOptions.name; - this.accountId = createRoleOptions.accountId; - this.serviceName = createRoleOptions.serviceName; - this.description = createRoleOptions.description; - this.acceptLanguage = createRoleOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param displayName the displayName - * @param actions the actions - * @param name the name - * @param accountId the accountId - * @param serviceName the serviceName - */ - public Builder(String displayName, List actions, String name, String accountId, String serviceName) { - this.displayName = displayName; - this.actions = actions; - this.name = name; - this.accountId = accountId; - this.serviceName = serviceName; - } - - /** - * Builds a CreateRoleOptions. - * - * @return the new CreateRoleOptions instance - */ - public CreateRoleOptions build() { - return new CreateRoleOptions(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the CreateRoleOptions builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the CreateRoleOptions builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the CreateRoleOptions builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateRoleOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the CreateRoleOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the CreateRoleOptions builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateRoleOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateRoleOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateRoleOptions() { } - - protected CreateRoleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, - "serviceName cannot be null"); - displayName = builder.displayName; - actions = builder.actions; - name = builder.name; - accountId = builder.accountId; - serviceName = builder.serviceName; - description = builder.description; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateRoleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List actions() { - return actions; - } - - /** - * Gets the name. - * - * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the accountId. - * - * The account GUID. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the serviceName. - * - * The service name. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java deleted file mode 100644 index c9bef88e703..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptions.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createRoleTemplateAssignment options. - */ -public class CreateRoleTemplateAssignmentOptions extends GenericModel { - - protected AssignmentTargetDetails target; - protected List templates; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private AssignmentTargetDetails target; - private List templates; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateRoleTemplateAssignmentOptions instance. - * - * @param createRoleTemplateAssignmentOptions the instance to initialize the Builder with - */ - private Builder(CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptions) { - this.target = createRoleTemplateAssignmentOptions.target; - this.templates = createRoleTemplateAssignmentOptions.templates; - this.acceptLanguage = createRoleTemplateAssignmentOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param target the target - * @param templates the templates - */ - public Builder(AssignmentTargetDetails target, List templates) { - this.target = target; - this.templates = templates; - } - - /** - * Builds a CreateRoleTemplateAssignmentOptions. - * - * @return the new CreateRoleTemplateAssignmentOptions instance - */ - public CreateRoleTemplateAssignmentOptions build() { - return new CreateRoleTemplateAssignmentOptions(this); - } - - /** - * Adds a new element to templates. - * - * @param templates the new element to be added - * @return the CreateRoleTemplateAssignmentOptions builder - */ - public Builder addTemplates(RoleAssignmentTemplate templates) { - com.ibm.cloud.sdk.core.util.Validator.notNull(templates, - "templates cannot be null"); - if (this.templates == null) { - this.templates = new ArrayList(); - } - this.templates.add(templates); - return this; - } - - /** - * Set the target. - * - * @param target the target - * @return the CreateRoleTemplateAssignmentOptions builder - */ - public Builder target(AssignmentTargetDetails target) { - this.target = target; - return this; - } - - /** - * Set the templates. - * Existing templates will be replaced. - * - * @param templates the templates - * @return the CreateRoleTemplateAssignmentOptions builder - */ - public Builder templates(List templates) { - this.templates = templates; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateRoleTemplateAssignmentOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateRoleTemplateAssignmentOptions() { } - - protected CreateRoleTemplateAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, - "target cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templates, - "templates cannot be null"); - target = builder.target; - templates = builder.templates; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateRoleTemplateAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails target() { - return target; - } - - /** - * Gets the templates. - * - * List of role template details for role assignment. - * - * @return the templates - */ - public List templates() { - return templates; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java deleted file mode 100644 index baf82e17961..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptions.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createRoleTemplate options. - */ -public class CreateRoleTemplateOptions extends GenericModel { - - protected String name; - protected String accountId; - protected String description; - protected Boolean committed; - protected RoleTemplatePrototypeRole role; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String accountId; - private String description; - private Boolean committed; - private RoleTemplatePrototypeRole role; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateRoleTemplateOptions instance. - * - * @param createRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(CreateRoleTemplateOptions createRoleTemplateOptions) { - this.name = createRoleTemplateOptions.name; - this.accountId = createRoleTemplateOptions.accountId; - this.description = createRoleTemplateOptions.description; - this.committed = createRoleTemplateOptions.committed; - this.role = createRoleTemplateOptions.role; - this.acceptLanguage = createRoleTemplateOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param accountId the accountId - */ - public Builder(String name, String accountId) { - this.name = name; - this.accountId = accountId; - } - - /** - * Builds a CreateRoleTemplateOptions. - * - * @return the new CreateRoleTemplateOptions instance - */ - public CreateRoleTemplateOptions build() { - return new CreateRoleTemplateOptions(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateRoleTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the CreateRoleTemplateOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateRoleTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreateRoleTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - - /** - * Set the role. - * - * @param role the role - * @return the CreateRoleTemplateOptions builder - */ - public Builder role(RoleTemplatePrototypeRole role) { - this.role = role; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateRoleTemplateOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateRoleTemplateOptions() { } - - protected CreateRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - name = builder.name; - accountId = builder.accountId; - description = builder.description; - committed = builder.committed; - role = builder.role; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the description. - * - * Description of the role template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the role for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template. If committed is set to true, then the template version can no longer be updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } - - /** - * Gets the role. - * - * The role properties that are created in an action resource when the template is assigned. - * - * @return the role - */ - public RoleTemplatePrototypeRole role() { - return role; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java deleted file mode 100644 index c322c5a332d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptions.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createRoleTemplateVersion options. - */ -public class CreateRoleTemplateVersionOptions extends GenericModel { - - protected String roleTemplateId; - protected String name; - protected String description; - protected TemplateRole role; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String name; - private String description; - private TemplateRole role; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing CreateRoleTemplateVersionOptions instance. - * - * @param createRoleTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(CreateRoleTemplateVersionOptions createRoleTemplateVersionOptions) { - this.roleTemplateId = createRoleTemplateVersionOptions.roleTemplateId; - this.name = createRoleTemplateVersionOptions.name; - this.description = createRoleTemplateVersionOptions.description; - this.role = createRoleTemplateVersionOptions.role; - this.committed = createRoleTemplateVersionOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - */ - public Builder(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - } - - /** - * Builds a CreateRoleTemplateVersionOptions. - * - * @return the new CreateRoleTemplateVersionOptions instance - */ - public CreateRoleTemplateVersionOptions build() { - return new CreateRoleTemplateVersionOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the role. - * - * @param role the role - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder role(TemplateRole role) { - this.role = role; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the CreateRoleTemplateVersionOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected CreateRoleTemplateVersionOptions() { } - - protected CreateRoleTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - roleTemplateId = builder.roleTemplateId; - name = builder.name; - description = builder.description; - role = builder.role; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a CreateRoleTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * The role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will - * change the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the role template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the role for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the role. - * - * The role properties that are created in an action resource when the template is assigned. - * - * @return the role - */ - public TemplateRole role() { - return role; - } - - /** - * Gets the committed. - * - * Committed status of the template version. If committed is set to true, then the template version can no longer be - * updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java deleted file mode 100644 index 59ccb4b908a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptions.java +++ /dev/null @@ -1,312 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createV2Policy options. - */ -public class CreateV2PolicyOptions extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - protected Control control; - protected String type; - protected String description; - protected V2PolicySubject subject; - protected V2PolicyResource resource; - protected String pattern; - protected V2PolicyRule rule; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private Control control; - private String type; - private String description; - private V2PolicySubject subject; - private V2PolicyResource resource; - private String pattern; - private V2PolicyRule rule; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing CreateV2PolicyOptions instance. - * - * @param createV2PolicyOptions the instance to initialize the Builder with - */ - private Builder(CreateV2PolicyOptions createV2PolicyOptions) { - this.control = createV2PolicyOptions.control; - this.type = createV2PolicyOptions.type; - this.description = createV2PolicyOptions.description; - this.subject = createV2PolicyOptions.subject; - this.resource = createV2PolicyOptions.resource; - this.pattern = createV2PolicyOptions.pattern; - this.rule = createV2PolicyOptions.rule; - this.acceptLanguage = createV2PolicyOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param control the control - * @param type the type - */ - public Builder(Control control, String type) { - this.control = control; - this.type = type; - } - - /** - * Builds a CreateV2PolicyOptions. - * - * @return the new CreateV2PolicyOptions instance - */ - public CreateV2PolicyOptions build() { - return new CreateV2PolicyOptions(this); - } - - /** - * Set the control. - * - * @param control the control - * @return the CreateV2PolicyOptions builder - */ - public Builder control(Control control) { - this.control = control; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the CreateV2PolicyOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateV2PolicyOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the subject. - * - * @param subject the subject - * @return the CreateV2PolicyOptions builder - */ - public Builder subject(V2PolicySubject subject) { - this.subject = subject; - return this; - } - - /** - * Set the resource. - * - * @param resource the resource - * @return the CreateV2PolicyOptions builder - */ - public Builder resource(V2PolicyResource resource) { - this.resource = resource; - return this; - } - - /** - * Set the pattern. - * - * @param pattern the pattern - * @return the CreateV2PolicyOptions builder - */ - public Builder pattern(String pattern) { - this.pattern = pattern; - return this; - } - - /** - * Set the rule. - * - * @param rule the rule - * @return the CreateV2PolicyOptions builder - */ - public Builder rule(V2PolicyRule rule) { - this.rule = rule; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the CreateV2PolicyOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected CreateV2PolicyOptions() { } - - protected CreateV2PolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.control, - "control cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - control = builder.control; - type = builder.type; - description = builder.description; - subject = builder.subject; - resource = builder.resource; - pattern = builder.pattern; - rule = builder.rule; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a CreateV2PolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the control. - * - * Specifies the type of access that is granted by the policy. - * - * @return the control - */ - public Control control() { - return control; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject subject() { - return subject; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource resource() { - return resource; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String pattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule rule() { - return rule; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java deleted file mode 100644 index f5e35c13d9f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRole.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * An additional set of properties associated with a role. - */ -public class CustomRole extends GenericModel { - - protected String id; - @SerializedName("display_name") - protected String displayName; - protected String description; - protected List actions; - protected String crn; - protected String name; - @SerializedName("account_id") - protected String accountId; - @SerializedName("service_name") - protected String serviceName; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String href; - - protected CustomRole() { } - - /** - * Gets the id. - * - * The role ID. Composed of hexadecimal characters. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String getDisplayName() { - return displayName; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List getActions() { - return actions; - } - - /** - * Gets the crn. - * - * The role Cloud Resource Name (CRN). Example CRN: - * 'crn:v1:ibmcloud:public:iam-access-management::a/exampleAccountId::customRole:ExampleRoleName'. - * - * @return the crn - */ - public String getCrn() { - return crn; - } - - /** - * Gets the name. - * - * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the accountId. - * - * The account GUID. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the serviceName. - * - * The service name. - * - * @return the serviceName - */ - public String getServiceName() { - return serviceName; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the role was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the role. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the role was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the href. - * - * The href links back to the role. - * - * @return the href - */ - public String getHref() { - return href; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java deleted file mode 100644 index f71d2c2ab9d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteActionControlAssignment options. - */ -public class DeleteActionControlAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing DeleteActionControlAssignmentOptions instance. - * - * @param deleteActionControlAssignmentOptions the instance to initialize the Builder with - */ - private Builder(DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptions) { - this.assignmentId = deleteActionControlAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a DeleteActionControlAssignmentOptions. - * - * @return the new DeleteActionControlAssignmentOptions instance - */ - public DeleteActionControlAssignmentOptions build() { - return new DeleteActionControlAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the DeleteActionControlAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected DeleteActionControlAssignmentOptions() { } - - protected DeleteActionControlAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a DeleteActionControlAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Action control template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java deleted file mode 100644 index 6ff35d83603..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteActionControlTemplate options. - */ -public class DeleteActionControlTemplateOptions extends GenericModel { - - protected String actionControlTemplateId; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - - /** - * Instantiates a new Builder from an existing DeleteActionControlTemplateOptions instance. - * - * @param deleteActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(DeleteActionControlTemplateOptions deleteActionControlTemplateOptions) { - this.actionControlTemplateId = deleteActionControlTemplateOptions.actionControlTemplateId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - */ - public Builder(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - } - - /** - * Builds a DeleteActionControlTemplateOptions. - * - * @return the new DeleteActionControlTemplateOptions instance - */ - public DeleteActionControlTemplateOptions build() { - return new DeleteActionControlTemplateOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the DeleteActionControlTemplateOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - } - - protected DeleteActionControlTemplateOptions() { } - - protected DeleteActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - } - - /** - * New builder. - * - * @return a DeleteActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java deleted file mode 100644 index 69aca0555a1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteActionControlTemplateVersion options. - */ -public class DeleteActionControlTemplateVersionOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing DeleteActionControlTemplateVersionOptions instance. - * - * @param deleteActionControlTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptions) { - this.actionControlTemplateId = deleteActionControlTemplateVersionOptions.actionControlTemplateId; - this.version = deleteActionControlTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - * @param version the version - */ - public Builder(String actionControlTemplateId, String version) { - this.actionControlTemplateId = actionControlTemplateId; - this.version = version; - } - - /** - * Builds a DeleteActionControlTemplateVersionOptions. - * - * @return the new DeleteActionControlTemplateVersionOptions instance - */ - public DeleteActionControlTemplateVersionOptions build() { - return new DeleteActionControlTemplateVersionOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the DeleteActionControlTemplateVersionOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the DeleteActionControlTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected DeleteActionControlTemplateVersionOptions() { } - - protected DeleteActionControlTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a DeleteActionControlTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java deleted file mode 100644 index 3ab2cf17469..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deletePolicyAssignment options. - */ -public class DeletePolicyAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing DeletePolicyAssignmentOptions instance. - * - * @param deletePolicyAssignmentOptions the instance to initialize the Builder with - */ - private Builder(DeletePolicyAssignmentOptions deletePolicyAssignmentOptions) { - this.assignmentId = deletePolicyAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a DeletePolicyAssignmentOptions. - * - * @return the new DeletePolicyAssignmentOptions instance - */ - public DeletePolicyAssignmentOptions build() { - return new DeletePolicyAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the DeletePolicyAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected DeletePolicyAssignmentOptions() { } - - protected DeletePolicyAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a DeletePolicyAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * The policy template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java deleted file mode 100644 index fe070b2064a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deletePolicy options. - */ -public class DeletePolicyOptions extends GenericModel { - - protected String policyId; - - /** - * Builder. - */ - public static class Builder { - private String policyId; - - /** - * Instantiates a new Builder from an existing DeletePolicyOptions instance. - * - * @param deletePolicyOptions the instance to initialize the Builder with - */ - private Builder(DeletePolicyOptions deletePolicyOptions) { - this.policyId = deletePolicyOptions.policyId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyId the policyId - */ - public Builder(String policyId) { - this.policyId = policyId; - } - - /** - * Builds a DeletePolicyOptions. - * - * @return the new DeletePolicyOptions instance - */ - public DeletePolicyOptions build() { - return new DeletePolicyOptions(this); - } - - /** - * Set the policyId. - * - * @param policyId the policyId - * @return the DeletePolicyOptions builder - */ - public Builder policyId(String policyId) { - this.policyId = policyId; - return this; - } - } - - protected DeletePolicyOptions() { } - - protected DeletePolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, - "policyId cannot be empty"); - policyId = builder.policyId; - } - - /** - * New builder. - * - * @return a DeletePolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyId. - * - * The policy ID. - * - * @return the policyId - */ - public String policyId() { - return policyId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java deleted file mode 100644 index bb70b0d6727..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deletePolicyTemplate options. - */ -public class DeletePolicyTemplateOptions extends GenericModel { - - protected String policyTemplateId; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - - /** - * Instantiates a new Builder from an existing DeletePolicyTemplateOptions instance. - * - * @param deletePolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(DeletePolicyTemplateOptions deletePolicyTemplateOptions) { - this.policyTemplateId = deletePolicyTemplateOptions.policyTemplateId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - */ - public Builder(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - } - - /** - * Builds a DeletePolicyTemplateOptions. - * - * @return the new DeletePolicyTemplateOptions instance - */ - public DeletePolicyTemplateOptions build() { - return new DeletePolicyTemplateOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the DeletePolicyTemplateOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - } - - protected DeletePolicyTemplateOptions() { } - - protected DeletePolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - policyTemplateId = builder.policyTemplateId; - } - - /** - * New builder. - * - * @return a DeletePolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java deleted file mode 100644 index 9a04a5157b6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deletePolicyTemplateVersion options. - */ -public class DeletePolicyTemplateVersionOptions extends GenericModel { - - protected String policyTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing DeletePolicyTemplateVersionOptions instance. - * - * @param deletePolicyTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptions) { - this.policyTemplateId = deletePolicyTemplateVersionOptions.policyTemplateId; - this.version = deletePolicyTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param version the version - */ - public Builder(String policyTemplateId, String version) { - this.policyTemplateId = policyTemplateId; - this.version = version; - } - - /** - * Builds a DeletePolicyTemplateVersionOptions. - * - * @return the new DeletePolicyTemplateVersionOptions instance - */ - public DeletePolicyTemplateVersionOptions build() { - return new DeletePolicyTemplateVersionOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the DeletePolicyTemplateVersionOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the DeletePolicyTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected DeletePolicyTemplateVersionOptions() { } - - protected DeletePolicyTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - policyTemplateId = builder.policyTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a DeletePolicyTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the version. - * - * The policy template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java deleted file mode 100644 index b9341a9f414..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteRoleAssignment options. - */ -public class DeleteRoleAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing DeleteRoleAssignmentOptions instance. - * - * @param deleteRoleAssignmentOptions the instance to initialize the Builder with - */ - private Builder(DeleteRoleAssignmentOptions deleteRoleAssignmentOptions) { - this.assignmentId = deleteRoleAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a DeleteRoleAssignmentOptions. - * - * @return the new DeleteRoleAssignmentOptions instance - */ - public DeleteRoleAssignmentOptions build() { - return new DeleteRoleAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the DeleteRoleAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected DeleteRoleAssignmentOptions() { } - - protected DeleteRoleAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a DeleteRoleAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Role template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java deleted file mode 100644 index 8675777719e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteRole options. - */ -public class DeleteRoleOptions extends GenericModel { - - protected String roleId; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - - /** - * Instantiates a new Builder from an existing DeleteRoleOptions instance. - * - * @param deleteRoleOptions the instance to initialize the Builder with - */ - private Builder(DeleteRoleOptions deleteRoleOptions) { - this.roleId = deleteRoleOptions.roleId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - */ - public Builder(String roleId) { - this.roleId = roleId; - } - - /** - * Builds a DeleteRoleOptions. - * - * @return the new DeleteRoleOptions instance - */ - public DeleteRoleOptions build() { - return new DeleteRoleOptions(this); - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the DeleteRoleOptions builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - } - - protected DeleteRoleOptions() { } - - protected DeleteRoleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, - "roleId cannot be empty"); - roleId = builder.roleId; - } - - /** - * New builder. - * - * @return a DeleteRoleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role ID. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java deleted file mode 100644 index c76bf3bfda4..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteRoleTemplate options. - */ -public class DeleteRoleTemplateOptions extends GenericModel { - - protected String roleTemplateId; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - - /** - * Instantiates a new Builder from an existing DeleteRoleTemplateOptions instance. - * - * @param deleteRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(DeleteRoleTemplateOptions deleteRoleTemplateOptions) { - this.roleTemplateId = deleteRoleTemplateOptions.roleTemplateId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - */ - public Builder(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - } - - /** - * Builds a DeleteRoleTemplateOptions. - * - * @return the new DeleteRoleTemplateOptions instance - */ - public DeleteRoleTemplateOptions build() { - return new DeleteRoleTemplateOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the DeleteRoleTemplateOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - } - - protected DeleteRoleTemplateOptions() { } - - protected DeleteRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - roleTemplateId = builder.roleTemplateId; - } - - /** - * New builder. - * - * @return a DeleteRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java deleted file mode 100644 index 9f974213165..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteRoleTemplateVersion options. - */ -public class DeleteRoleTemplateVersionOptions extends GenericModel { - - protected String roleTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing DeleteRoleTemplateVersionOptions instance. - * - * @param deleteRoleTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptions) { - this.roleTemplateId = deleteRoleTemplateVersionOptions.roleTemplateId; - this.version = deleteRoleTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - * @param version the version - */ - public Builder(String roleTemplateId, String version) { - this.roleTemplateId = roleTemplateId; - this.version = version; - } - - /** - * Builds a DeleteRoleTemplateVersionOptions. - * - * @return the new DeleteRoleTemplateVersionOptions instance - */ - public DeleteRoleTemplateVersionOptions build() { - return new DeleteRoleTemplateVersionOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the DeleteRoleTemplateVersionOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the DeleteRoleTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected DeleteRoleTemplateVersionOptions() { } - - protected DeleteRoleTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - roleTemplateId = builder.roleTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a DeleteRoleTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the version. - * - * Role template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java deleted file mode 100644 index 92c1caaa34c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteV2Policy options. - */ -public class DeleteV2PolicyOptions extends GenericModel { - - protected String id; - - /** - * Builder. - */ - public static class Builder { - private String id; - - /** - * Instantiates a new Builder from an existing DeleteV2PolicyOptions instance. - * - * @param deleteV2PolicyOptions the instance to initialize the Builder with - */ - private Builder(DeleteV2PolicyOptions deleteV2PolicyOptions) { - this.id = deleteV2PolicyOptions.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 DeleteV2PolicyOptions. - * - * @return the new DeleteV2PolicyOptions instance - */ - public DeleteV2PolicyOptions build() { - return new DeleteV2PolicyOptions(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the DeleteV2PolicyOptions builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - } - - protected DeleteV2PolicyOptions() { } - - protected DeleteV2PolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, - "id cannot be empty"); - id = builder.id; - } - - /** - * New builder. - * - * @return a DeleteV2PolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String id() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java deleted file mode 100644 index 0978eb1040b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRoles.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role associated with a policy with additional information (display_name, description, actions) when - * `format=display`. - */ -public class EnrichedRoles extends GenericModel { - - @SerializedName("role_id") - protected String roleId; - @SerializedName("display_name") - protected String displayName; - protected String description; - protected List actions; - - protected EnrichedRoles() { } - - /** - * Gets the roleId. - * - * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. - * - * @return the roleId - */ - public String getRoleId() { - return roleId; - } - - /** - * Gets the displayName. - * - * The display name of the role, either service-defined or user-defined for custom roles. - * - * @return the displayName - */ - public String getDisplayName() { - return displayName; - } - - /** - * Gets the description. - * - * The role description, either service-defined or user-defined for custom roles. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List getActions() { - return actions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java deleted file mode 100644 index e99ea48f5f6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetails.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Additional error details. - */ -public class ErrorDetails extends GenericModel { - - @SerializedName("conflicts_with") - protected ConflictsWith conflictsWith; - - protected ErrorDetails() { } - - /** - * Gets the conflictsWith. - * - * Details of conflicting resource. - * - * @return the conflictsWith - */ - public ConflictsWith getConflictsWith() { - return conflictsWith; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java deleted file mode 100644 index b5411a7bb36..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObject.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * ErrorObject. - */ -public class ErrorObject extends GenericModel { - - /** - * The API error code for the error. - */ - public interface Code { - /** insufficent_permissions. */ - String INSUFFICENT_PERMISSIONS = "insufficent_permissions"; - /** invalid_body. */ - String INVALID_BODY = "invalid_body"; - /** invalid_token. */ - String INVALID_TOKEN = "invalid_token"; - /** missing_required_query_parameter. */ - String MISSING_REQUIRED_QUERY_PARAMETER = "missing_required_query_parameter"; - /** not_found. */ - String NOT_FOUND = "not_found"; - /** policy_conflict_error. */ - String POLICY_CONFLICT_ERROR = "policy_conflict_error"; - /** policy_not_found. */ - String POLICY_NOT_FOUND = "policy_not_found"; - /** request_not_processed. */ - String REQUEST_NOT_PROCESSED = "request_not_processed"; - /** role_conflict_error. */ - String ROLE_CONFLICT_ERROR = "role_conflict_error"; - /** role_not_found. */ - String ROLE_NOT_FOUND = "role_not_found"; - /** too_many_requests. */ - String TOO_MANY_REQUESTS = "too_many_requests"; - /** unable_to_process. */ - String UNABLE_TO_PROCESS = "unable_to_process"; - /** unsupported_content_type. */ - String UNSUPPORTED_CONTENT_TYPE = "unsupported_content_type"; - /** policy_template_conflict_error. */ - String POLICY_TEMPLATE_CONFLICT_ERROR = "policy_template_conflict_error"; - /** policy_template_not_found. */ - String POLICY_TEMPLATE_NOT_FOUND = "policy_template_not_found"; - /** policy_assignment_not_found. */ - String POLICY_ASSIGNMENT_NOT_FOUND = "policy_assignment_not_found"; - /** policy_assignment_conflict_error. */ - String POLICY_ASSIGNMENT_CONFLICT_ERROR = "policy_assignment_conflict_error"; - /** resource_not_found. */ - String RESOURCE_NOT_FOUND = "resource_not_found"; - /** action_control_template_not_found. */ - String ACTION_CONTROL_TEMPLATE_NOT_FOUND = "action_control_template_not_found"; - /** action_control_assignment_not_found. */ - String ACTION_CONTROL_ASSIGNMENT_NOT_FOUND = "action_control_assignment_not_found"; - /** role_template_conflict_error. */ - String ROLE_TEMPLATE_CONFLICT_ERROR = "role_template_conflict_error"; - /** role_template_not_found. */ - String ROLE_TEMPLATE_NOT_FOUND = "role_template_not_found"; - /** role_assignment_not_found. */ - String ROLE_ASSIGNMENT_NOT_FOUND = "role_assignment_not_found"; - } - - protected String code; - protected String message; - protected ErrorDetails details; - @SerializedName("more_info") - protected String moreInfo; - - protected ErrorObject() { } - - /** - * Gets the code. - * - * The API error code for the error. - * - * @return the code - */ - public String getCode() { - return code; - } - - /** - * Gets the message. - * - * The error message returned by the API. - * - * @return the message - */ - public String getMessage() { - return message; - } - - /** - * Gets the details. - * - * Additional error details. - * - * @return the details - */ - public ErrorDetails getDetails() { - return details; - } - - /** - * Gets the moreInfo. - * - * Additional info for error. - * - * @return the moreInfo - */ - public String getMoreInfo() { - return moreInfo; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java deleted file mode 100644 index 5c1c9a9fad6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteraction.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * How external accounts can interact in relation to the requested account. - */ -public class ExternalAccountIdentityInteraction extends GenericModel { - - @SerializedName("identity_types") - protected IdentityTypes identityTypes; - - protected ExternalAccountIdentityInteraction() { } - - /** - * Gets the identityTypes. - * - * The settings for each identity type. - * - * @return the identityTypes - */ - public IdentityTypes getIdentityTypes() { - return identityTypes; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java deleted file mode 100644 index 1efd0673e9d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatch.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Update to how external accounts can interact in relation to the requested account. - */ -public class ExternalAccountIdentityInteractionPatch extends GenericModel { - - @SerializedName("identity_types") - protected IdentityTypesPatch identityTypes; - - /** - * Builder. - */ - public static class Builder { - private IdentityTypesPatch identityTypes; - - /** - * Instantiates a new Builder from an existing ExternalAccountIdentityInteractionPatch instance. - * - * @param externalAccountIdentityInteractionPatch the instance to initialize the Builder with - */ - private Builder(ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatch) { - this.identityTypes = externalAccountIdentityInteractionPatch.identityTypes; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a ExternalAccountIdentityInteractionPatch. - * - * @return the new ExternalAccountIdentityInteractionPatch instance - */ - public ExternalAccountIdentityInteractionPatch build() { - return new ExternalAccountIdentityInteractionPatch(this); - } - - /** - * Set the identityTypes. - * - * @param identityTypes the identityTypes - * @return the ExternalAccountIdentityInteractionPatch builder - */ - public Builder identityTypes(IdentityTypesPatch identityTypes) { - this.identityTypes = identityTypes; - return this; - } - } - - protected ExternalAccountIdentityInteractionPatch() { } - - protected ExternalAccountIdentityInteractionPatch(Builder builder) { - identityTypes = builder.identityTypes; - } - - /** - * New builder. - * - * @return a ExternalAccountIdentityInteractionPatch builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the identityTypes. - * - * The settings to apply for each identity type for a request. - * - * @return the identityTypes - */ - public IdentityTypesPatch identityTypes() { - return identityTypes; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java deleted file mode 100644 index 83cd67d33c9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/First.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Details with linking href to first page of requested collection. - */ -public class First extends GenericModel { - - protected String href; - - protected First() { } - - /** - * Gets the href. - * - * The href linking to the page of requested collection. - * - * @return the href - */ - public String getHref() { - return href; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java deleted file mode 100644 index f87e7d741a4..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getActionControlAssignment options. - */ -public class GetActionControlAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing GetActionControlAssignmentOptions instance. - * - * @param getActionControlAssignmentOptions the instance to initialize the Builder with - */ - private Builder(GetActionControlAssignmentOptions getActionControlAssignmentOptions) { - this.assignmentId = getActionControlAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a GetActionControlAssignmentOptions. - * - * @return the new GetActionControlAssignmentOptions instance - */ - public GetActionControlAssignmentOptions build() { - return new GetActionControlAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the GetActionControlAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected GetActionControlAssignmentOptions() { } - - protected GetActionControlAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a GetActionControlAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Action control template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java deleted file mode 100644 index 963c68e8876..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptions.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getActionControlTemplate options. - */ -public class GetActionControlTemplateOptions extends GenericModel { - - /** - * The action control template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String actionControlTemplateId; - protected String state; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String state; - - /** - * Instantiates a new Builder from an existing GetActionControlTemplateOptions instance. - * - * @param getActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(GetActionControlTemplateOptions getActionControlTemplateOptions) { - this.actionControlTemplateId = getActionControlTemplateOptions.actionControlTemplateId; - this.state = getActionControlTemplateOptions.state; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - */ - public Builder(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - } - - /** - * Builds a GetActionControlTemplateOptions. - * - * @return the new GetActionControlTemplateOptions instance - */ - public GetActionControlTemplateOptions build() { - return new GetActionControlTemplateOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the GetActionControlTemplateOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the GetActionControlTemplateOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - } - - protected GetActionControlTemplateOptions() { } - - protected GetActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - state = builder.state; - } - - /** - * New builder. - * - * @return a GetActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the state. - * - * The action control template state. - * - * @return the state - */ - public String state() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java deleted file mode 100644 index 95bc94950bb..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getActionControlTemplateVersion options. - */ -public class GetActionControlTemplateVersionOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing GetActionControlTemplateVersionOptions instance. - * - * @param getActionControlTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptions) { - this.actionControlTemplateId = getActionControlTemplateVersionOptions.actionControlTemplateId; - this.version = getActionControlTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - * @param version the version - */ - public Builder(String actionControlTemplateId, String version) { - this.actionControlTemplateId = actionControlTemplateId; - this.version = version; - } - - /** - * Builds a GetActionControlTemplateVersionOptions. - * - * @return the new GetActionControlTemplateVersionOptions instance - */ - public GetActionControlTemplateVersionOptions build() { - return new GetActionControlTemplateVersionOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the GetActionControlTemplateVersionOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the GetActionControlTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected GetActionControlTemplateVersionOptions() { } - - protected GetActionControlTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a GetActionControlTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java deleted file mode 100644 index d1c7c359003..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getPolicyAssignment options. - */ -public class GetPolicyAssignmentOptions extends GenericModel { - - protected String assignmentId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - private String version; - - /** - * Instantiates a new Builder from an existing GetPolicyAssignmentOptions instance. - * - * @param getPolicyAssignmentOptions the instance to initialize the Builder with - */ - private Builder(GetPolicyAssignmentOptions getPolicyAssignmentOptions) { - this.assignmentId = getPolicyAssignmentOptions.assignmentId; - this.version = getPolicyAssignmentOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - * @param version the version - */ - public Builder(String assignmentId, String version) { - this.assignmentId = assignmentId; - this.version = version; - } - - /** - * Builds a GetPolicyAssignmentOptions. - * - * @return the new GetPolicyAssignmentOptions instance - */ - public GetPolicyAssignmentOptions build() { - return new GetPolicyAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the GetPolicyAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the GetPolicyAssignmentOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected GetPolicyAssignmentOptions() { } - - protected GetPolicyAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - assignmentId = builder.assignmentId; - version = builder.version; - } - - /** - * New builder. - * - * @return a GetPolicyAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * The policy template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } - - /** - * Gets the version. - * - * specify version of response body format. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java deleted file mode 100644 index e780ac06896..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getPolicy options. - */ -public class GetPolicyOptions extends GenericModel { - - protected String policyId; - - /** - * Builder. - */ - public static class Builder { - private String policyId; - - /** - * Instantiates a new Builder from an existing GetPolicyOptions instance. - * - * @param getPolicyOptions the instance to initialize the Builder with - */ - private Builder(GetPolicyOptions getPolicyOptions) { - this.policyId = getPolicyOptions.policyId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyId the policyId - */ - public Builder(String policyId) { - this.policyId = policyId; - } - - /** - * Builds a GetPolicyOptions. - * - * @return the new GetPolicyOptions instance - */ - public GetPolicyOptions build() { - return new GetPolicyOptions(this); - } - - /** - * Set the policyId. - * - * @param policyId the policyId - * @return the GetPolicyOptions builder - */ - public Builder policyId(String policyId) { - this.policyId = policyId; - return this; - } - } - - protected GetPolicyOptions() { } - - protected GetPolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, - "policyId cannot be empty"); - policyId = builder.policyId; - } - - /** - * New builder. - * - * @return a GetPolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyId. - * - * The policy ID. - * - * @return the policyId - */ - public String policyId() { - return policyId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java deleted file mode 100644 index ee604554a85..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptions.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getPolicyTemplate options. - */ -public class GetPolicyTemplateOptions extends GenericModel { - - /** - * The policy template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String policyTemplateId; - protected String state; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String state; - - /** - * Instantiates a new Builder from an existing GetPolicyTemplateOptions instance. - * - * @param getPolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(GetPolicyTemplateOptions getPolicyTemplateOptions) { - this.policyTemplateId = getPolicyTemplateOptions.policyTemplateId; - this.state = getPolicyTemplateOptions.state; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - */ - public Builder(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - } - - /** - * Builds a GetPolicyTemplateOptions. - * - * @return the new GetPolicyTemplateOptions instance - */ - public GetPolicyTemplateOptions build() { - return new GetPolicyTemplateOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the GetPolicyTemplateOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the GetPolicyTemplateOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - } - - protected GetPolicyTemplateOptions() { } - - protected GetPolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - policyTemplateId = builder.policyTemplateId; - state = builder.state; - } - - /** - * New builder. - * - * @return a GetPolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the state. - * - * The policy template state. - * - * @return the state - */ - public String state() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java deleted file mode 100644 index 8741f83357d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getPolicyTemplateVersion options. - */ -public class GetPolicyTemplateVersionOptions extends GenericModel { - - protected String policyTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing GetPolicyTemplateVersionOptions instance. - * - * @param getPolicyTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptions) { - this.policyTemplateId = getPolicyTemplateVersionOptions.policyTemplateId; - this.version = getPolicyTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param version the version - */ - public Builder(String policyTemplateId, String version) { - this.policyTemplateId = policyTemplateId; - this.version = version; - } - - /** - * Builds a GetPolicyTemplateVersionOptions. - * - * @return the new GetPolicyTemplateVersionOptions instance - */ - public GetPolicyTemplateVersionOptions build() { - return new GetPolicyTemplateVersionOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the GetPolicyTemplateVersionOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the GetPolicyTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected GetPolicyTemplateVersionOptions() { } - - protected GetPolicyTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - policyTemplateId = builder.policyTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a GetPolicyTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the version. - * - * The policy template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java deleted file mode 100644 index 35313b9b746..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getRoleAssignment options. - */ -public class GetRoleAssignmentOptions extends GenericModel { - - protected String assignmentId; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - - /** - * Instantiates a new Builder from an existing GetRoleAssignmentOptions instance. - * - * @param getRoleAssignmentOptions the instance to initialize the Builder with - */ - private Builder(GetRoleAssignmentOptions getRoleAssignmentOptions) { - this.assignmentId = getRoleAssignmentOptions.assignmentId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - */ - public Builder(String assignmentId) { - this.assignmentId = assignmentId; - } - - /** - * Builds a GetRoleAssignmentOptions. - * - * @return the new GetRoleAssignmentOptions instance - */ - public GetRoleAssignmentOptions build() { - return new GetRoleAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the GetRoleAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - } - - protected GetRoleAssignmentOptions() { } - - protected GetRoleAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - assignmentId = builder.assignmentId; - } - - /** - * New builder. - * - * @return a GetRoleAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Role template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java deleted file mode 100644 index 8c56ac7f58a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptions.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getRole options. - */ -public class GetRoleOptions extends GenericModel { - - protected String roleId; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - - /** - * Instantiates a new Builder from an existing GetRoleOptions instance. - * - * @param getRoleOptions the instance to initialize the Builder with - */ - private Builder(GetRoleOptions getRoleOptions) { - this.roleId = getRoleOptions.roleId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - */ - public Builder(String roleId) { - this.roleId = roleId; - } - - /** - * Builds a GetRoleOptions. - * - * @return the new GetRoleOptions instance - */ - public GetRoleOptions build() { - return new GetRoleOptions(this); - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the GetRoleOptions builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - } - - protected GetRoleOptions() { } - - protected GetRoleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, - "roleId cannot be empty"); - roleId = builder.roleId; - } - - /** - * New builder. - * - * @return a GetRoleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role ID. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java deleted file mode 100644 index e33fcf29b32..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptions.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getRoleTemplate options. - */ -public class GetRoleTemplateOptions extends GenericModel { - - /** - * The role template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String roleTemplateId; - protected String state; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String state; - - /** - * Instantiates a new Builder from an existing GetRoleTemplateOptions instance. - * - * @param getRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(GetRoleTemplateOptions getRoleTemplateOptions) { - this.roleTemplateId = getRoleTemplateOptions.roleTemplateId; - this.state = getRoleTemplateOptions.state; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - */ - public Builder(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - } - - /** - * Builds a GetRoleTemplateOptions. - * - * @return the new GetRoleTemplateOptions instance - */ - public GetRoleTemplateOptions build() { - return new GetRoleTemplateOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the GetRoleTemplateOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the GetRoleTemplateOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - } - - protected GetRoleTemplateOptions() { } - - protected GetRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - roleTemplateId = builder.roleTemplateId; - state = builder.state; - } - - /** - * New builder. - * - * @return a GetRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the state. - * - * The role template state. - * - * @return the state - */ - public String state() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java deleted file mode 100644 index 4757484f969..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptions.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getRoleTemplateVersion options. - */ -public class GetRoleTemplateVersionOptions extends GenericModel { - - protected String roleTemplateId; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String version; - - /** - * Instantiates a new Builder from an existing GetRoleTemplateVersionOptions instance. - * - * @param getRoleTemplateVersionOptions the instance to initialize the Builder with - */ - private Builder(GetRoleTemplateVersionOptions getRoleTemplateVersionOptions) { - this.roleTemplateId = getRoleTemplateVersionOptions.roleTemplateId; - this.version = getRoleTemplateVersionOptions.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - * @param version the version - */ - public Builder(String roleTemplateId, String version) { - this.roleTemplateId = roleTemplateId; - this.version = version; - } - - /** - * Builds a GetRoleTemplateVersionOptions. - * - * @return the new GetRoleTemplateVersionOptions instance - */ - public GetRoleTemplateVersionOptions build() { - return new GetRoleTemplateVersionOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the GetRoleTemplateVersionOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the GetRoleTemplateVersionOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected GetRoleTemplateVersionOptions() { } - - protected GetRoleTemplateVersionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - roleTemplateId = builder.roleTemplateId; - version = builder.version; - } - - /** - * New builder. - * - * @return a GetRoleTemplateVersionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the version. - * - * Role template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java deleted file mode 100644 index ebc88bbf45c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptions.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getSettings options. - */ -public class GetSettingsOptions extends GenericModel { - - protected String accountId; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing GetSettingsOptions instance. - * - * @param getSettingsOptions the instance to initialize the Builder with - */ - private Builder(GetSettingsOptions getSettingsOptions) { - this.accountId = getSettingsOptions.accountId; - this.acceptLanguage = getSettingsOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a GetSettingsOptions. - * - * @return the new GetSettingsOptions instance - */ - public GetSettingsOptions build() { - return new GetSettingsOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the GetSettingsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the GetSettingsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected GetSettingsOptions() { } - - protected GetSettingsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.accountId, - "accountId cannot be empty"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a GetSettingsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the settings belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java deleted file mode 100644 index 23a950cc815..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptions.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getV2Policy options. - */ -public class GetV2PolicyOptions extends GenericModel { - - /** - * Include additional data for policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles and translations for all - * relevant fields. - */ - public interface Format { - /** include_last_permit. */ - String INCLUDE_LAST_PERMIT = "include_last_permit"; - /** display. */ - String DISPLAY = "display"; - } - - protected String id; - protected String format; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String format; - - /** - * Instantiates a new Builder from an existing GetV2PolicyOptions instance. - * - * @param getV2PolicyOptions the instance to initialize the Builder with - */ - private Builder(GetV2PolicyOptions getV2PolicyOptions) { - this.id = getV2PolicyOptions.id; - this.format = getV2PolicyOptions.format; - } - - /** - * 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 GetV2PolicyOptions. - * - * @return the new GetV2PolicyOptions instance - */ - public GetV2PolicyOptions build() { - return new GetV2PolicyOptions(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the GetV2PolicyOptions builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the format. - * - * @param format the format - * @return the GetV2PolicyOptions builder - */ - public Builder format(String format) { - this.format = format; - return this; - } - } - - protected GetV2PolicyOptions() { } - - protected GetV2PolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.id, - "id cannot be empty"); - id = builder.id; - format = builder.format; - } - - /** - * New builder. - * - * @return a GetV2PolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the format. - * - * Include additional data for policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles and translations for all - * relevant fields. - * - * @return the format - */ - public String format() { - return format; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java deleted file mode 100644 index d8439c9d6f7..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Grant.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Permission is granted by the policy. - */ -public class Grant extends GenericModel { - - protected List roles; - - /** - * Builder. - */ - public static class Builder { - private List roles; - - /** - * Instantiates a new Builder from an existing Grant instance. - * - * @param grant the instance to initialize the Builder with - */ - private Builder(Grant grant) { - this.roles = grant.roles; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roles the roles - */ - public Builder(List roles) { - this.roles = roles; - } - - /** - * Builds a Grant. - * - * @return the new Grant instance - */ - public Grant build() { - return new Grant(this); - } - - /** - * Adds a new element to roles. - * - * @param roles the new element to be added - * @return the Grant builder - */ - public Builder addRoles(Roles roles) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roles, - "roles cannot be null"); - if (this.roles == null) { - this.roles = new ArrayList(); - } - this.roles.add(roles); - return this; - } - - /** - * Set the roles. - * Existing roles will be replaced. - * - * @param roles the roles - * @return the Grant builder - */ - public Builder roles(List roles) { - this.roles = roles; - return this; - } - } - - protected Grant() { } - - protected Grant(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, - "roles cannot be null"); - roles = builder.roles; - } - - /** - * New builder. - * - * @return a Grant builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List roles() { - return roles; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java deleted file mode 100644 index 1dbc53fefb6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRoles.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Permission granted by the policy with translated roles and additional role information. - */ -public class GrantWithEnrichedRoles extends GenericModel { - - protected List roles; - - protected GrantWithEnrichedRoles() { } - - /** - * Gets the roles. - * - * A set of roles granted by the policy. - * - * @return the roles - */ - public List getRoles() { - return roles; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java deleted file mode 100644 index 0ac71d8192b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypes.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The settings for each identity type. - */ -public class IdentityTypes extends GenericModel { - - protected IdentityTypesBase user; - @SerializedName("service_id") - protected IdentityTypesBase serviceId; - protected IdentityTypesBase service; - - protected IdentityTypes() { } - - /** - * Gets the user. - * - * The core set of properties associated with an identity type. - * - * @return the user - */ - public IdentityTypesBase getUser() { - return user; - } - - /** - * Gets the serviceId. - * - * The core set of properties associated with an identity type. - * - * @return the serviceId - */ - public IdentityTypesBase getServiceId() { - return serviceId; - } - - /** - * Gets the service. - * - * The core set of properties associated with an identity type. - * - * @return the service - */ - public IdentityTypesBase getService() { - return service; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java deleted file mode 100644 index e8df91a1e5d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBase.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with an identity type. - */ -public class IdentityTypesBase extends GenericModel { - - /** - * The state of the identity type. - */ - public interface State { - /** enabled. */ - String ENABLED = "enabled"; - /** monitor. */ - String MONITOR = "monitor"; - /** limited. */ - String LIMITED = "limited"; - } - - protected String state; - @SerializedName("external_allowed_accounts") - protected List externalAllowedAccounts; - - /** - * Builder. - */ - public static class Builder { - private String state; - private List externalAllowedAccounts; - - /** - * Instantiates a new Builder from an existing IdentityTypesBase instance. - * - * @param identityTypesBase the instance to initialize the Builder with - */ - private Builder(IdentityTypesBase identityTypesBase) { - this.state = identityTypesBase.state; - this.externalAllowedAccounts = identityTypesBase.externalAllowedAccounts; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param state the state - * @param externalAllowedAccounts the externalAllowedAccounts - */ - public Builder(String state, List externalAllowedAccounts) { - this.state = state; - this.externalAllowedAccounts = externalAllowedAccounts; - } - - /** - * Builds a IdentityTypesBase. - * - * @return the new IdentityTypesBase instance - */ - public IdentityTypesBase build() { - return new IdentityTypesBase(this); - } - - /** - * Adds a new element to externalAllowedAccounts. - * - * @param externalAllowedAccounts the new element to be added - * @return the IdentityTypesBase builder - */ - public Builder addExternalAllowedAccounts(String externalAllowedAccounts) { - com.ibm.cloud.sdk.core.util.Validator.notNull(externalAllowedAccounts, - "externalAllowedAccounts cannot be null"); - if (this.externalAllowedAccounts == null) { - this.externalAllowedAccounts = new ArrayList(); - } - this.externalAllowedAccounts.add(externalAllowedAccounts); - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the IdentityTypesBase builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the externalAllowedAccounts. - * Existing externalAllowedAccounts will be replaced. - * - * @param externalAllowedAccounts the externalAllowedAccounts - * @return the IdentityTypesBase builder - */ - public Builder externalAllowedAccounts(List externalAllowedAccounts) { - this.externalAllowedAccounts = externalAllowedAccounts; - return this; - } - } - - protected IdentityTypesBase() { } - - protected IdentityTypesBase(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.state, - "state cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.externalAllowedAccounts, - "externalAllowedAccounts cannot be null"); - state = builder.state; - externalAllowedAccounts = builder.externalAllowedAccounts; - } - - /** - * New builder. - * - * @return a IdentityTypesBase builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the state. - * - * The state of the identity type. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the externalAllowedAccounts. - * - * List of accounts that the state applies to for a given identity. - * - * @return the externalAllowedAccounts - */ - public List externalAllowedAccounts() { - return externalAllowedAccounts; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java deleted file mode 100644 index 77aa5a26366..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatch.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The settings to apply for each identity type for a request. - */ -public class IdentityTypesPatch extends GenericModel { - - protected IdentityTypesBase user; - @SerializedName("service_id") - protected IdentityTypesBase serviceId; - protected IdentityTypesBase service; - - /** - * Builder. - */ - public static class Builder { - private IdentityTypesBase user; - private IdentityTypesBase serviceId; - private IdentityTypesBase service; - - /** - * Instantiates a new Builder from an existing IdentityTypesPatch instance. - * - * @param identityTypesPatch the instance to initialize the Builder with - */ - private Builder(IdentityTypesPatch identityTypesPatch) { - this.user = identityTypesPatch.user; - this.serviceId = identityTypesPatch.serviceId; - this.service = identityTypesPatch.service; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a IdentityTypesPatch. - * - * @return the new IdentityTypesPatch instance - */ - public IdentityTypesPatch build() { - return new IdentityTypesPatch(this); - } - - /** - * Set the user. - * - * @param user the user - * @return the IdentityTypesPatch builder - */ - public Builder user(IdentityTypesBase user) { - this.user = user; - return this; - } - - /** - * Set the serviceId. - * - * @param serviceId the serviceId - * @return the IdentityTypesPatch builder - */ - public Builder serviceId(IdentityTypesBase serviceId) { - this.serviceId = serviceId; - return this; - } - - /** - * Set the service. - * - * @param service the service - * @return the IdentityTypesPatch builder - */ - public Builder service(IdentityTypesBase service) { - this.service = service; - return this; - } - } - - protected IdentityTypesPatch() { } - - protected IdentityTypesPatch(Builder builder) { - user = builder.user; - serviceId = builder.serviceId; - service = builder.service; - } - - /** - * New builder. - * - * @return a IdentityTypesPatch builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the user. - * - * The core set of properties associated with an identity type. - * - * @return the user - */ - public IdentityTypesBase user() { - return user; - } - - /** - * Gets the serviceId. - * - * The core set of properties associated with an identity type. - * - * @return the serviceId - */ - public IdentityTypesBase serviceId() { - return serviceId; - } - - /** - * Gets the service. - * - * The core set of properties associated with an identity type. - * - * @return the service - */ - public IdentityTypesBase service() { - return service; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java deleted file mode 100644 index 5aa0b39573b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitData.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * policy template current and limit details with in an account. - */ -public class LimitData extends GenericModel { - - protected Long current; - protected Long limit; - - protected LimitData() { } - - /** - * Gets the current. - * - * policy template current count. - * - * @return the current - */ - public Long getCurrent() { - return current; - } - - /** - * Gets the limit. - * - * policy template limit count. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java deleted file mode 100644 index 6835f5afccc..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptions.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listActionControlAssignments options. - */ -public class ListActionControlAssignmentsOptions extends GenericModel { - - protected String accountId; - protected String acceptLanguage; - protected String templateId; - protected String templateVersion; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String templateId; - private String templateVersion; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListActionControlAssignmentsOptions instance. - * - * @param listActionControlAssignmentsOptions the instance to initialize the Builder with - */ - private Builder(ListActionControlAssignmentsOptions listActionControlAssignmentsOptions) { - this.accountId = listActionControlAssignmentsOptions.accountId; - this.acceptLanguage = listActionControlAssignmentsOptions.acceptLanguage; - this.templateId = listActionControlAssignmentsOptions.templateId; - this.templateVersion = listActionControlAssignmentsOptions.templateVersion; - this.limit = listActionControlAssignmentsOptions.limit; - this.start = listActionControlAssignmentsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListActionControlAssignmentsOptions. - * - * @return the new ListActionControlAssignmentsOptions instance - */ - public ListActionControlAssignmentsOptions build() { - return new ListActionControlAssignmentsOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the templateId. - * - * @param templateId the templateId - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder templateId(String templateId) { - this.templateId = templateId; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListActionControlAssignmentsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListActionControlAssignmentsOptions() { } - - protected ListActionControlAssignmentsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - templateId = builder.templateId; - templateVersion = builder.templateVersion; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListActionControlAssignmentsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID in which the action control assignment belongs to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the templateId. - * - * Optional template ID. - * - * @return the templateId - */ - public String templateId() { - return templateId; - } - - /** - * Gets the templateVersion. - * - * Optional action control template version. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java deleted file mode 100644 index 984d1060c83..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptions.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listActionControlTemplateVersions options. - */ -public class ListActionControlTemplateVersionsOptions extends GenericModel { - - /** - * Action control template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String actionControlTemplateId; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListActionControlTemplateVersionsOptions instance. - * - * @param listActionControlTemplateVersionsOptions the instance to initialize the Builder with - */ - private Builder(ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions) { - this.actionControlTemplateId = listActionControlTemplateVersionsOptions.actionControlTemplateId; - this.state = listActionControlTemplateVersionsOptions.state; - this.limit = listActionControlTemplateVersionsOptions.limit; - this.start = listActionControlTemplateVersionsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - */ - public Builder(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - } - - /** - * Builds a ListActionControlTemplateVersionsOptions. - * - * @return the new ListActionControlTemplateVersionsOptions instance - */ - public ListActionControlTemplateVersionsOptions build() { - return new ListActionControlTemplateVersionsOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the ListActionControlTemplateVersionsOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListActionControlTemplateVersionsOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListActionControlTemplateVersionsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListActionControlTemplateVersionsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListActionControlTemplateVersionsOptions() { } - - protected ListActionControlTemplateVersionsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - actionControlTemplateId = builder.actionControlTemplateId; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListActionControlTemplateVersionsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * The action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the state. - * - * Action control template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java deleted file mode 100644 index d019db6119f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptions.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listActionControlTemplates options. - */ -public class ListActionControlTemplatesOptions extends GenericModel { - - protected String accountId; - protected String acceptLanguage; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListActionControlTemplatesOptions instance. - * - * @param listActionControlTemplatesOptions the instance to initialize the Builder with - */ - private Builder(ListActionControlTemplatesOptions listActionControlTemplatesOptions) { - this.accountId = listActionControlTemplatesOptions.accountId; - this.acceptLanguage = listActionControlTemplatesOptions.acceptLanguage; - this.limit = listActionControlTemplatesOptions.limit; - this.start = listActionControlTemplatesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListActionControlTemplatesOptions. - * - * @return the new ListActionControlTemplatesOptions instance - */ - public ListActionControlTemplatesOptions build() { - return new ListActionControlTemplatesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListActionControlTemplatesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListActionControlTemplatesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListActionControlTemplatesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListActionControlTemplatesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListActionControlTemplatesOptions() { } - - protected ListActionControlTemplatesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListActionControlTemplatesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the action control templates belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java deleted file mode 100644 index 90ecb352c37..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptions.java +++ /dev/null @@ -1,501 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listPolicies options. - */ -public class ListPoliciesOptions extends GenericModel { - - /** - * Optional type of policy. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - /** - * Optional type of service. - */ - public interface ServiceType { - /** service. */ - String SERVICE = "service"; - /** platform_service. */ - String PLATFORM_SERVICE = "platform_service"; - } - - /** - * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending - * '-' to field. Example '-last_modified_at'. - */ - public interface Sort { - /** id. */ - String ID = "id"; - /** type. */ - String TYPE = "type"; - /** href. */ - String HREF = "href"; - /** created_at. */ - String CREATED_AT = "created_at"; - /** created_by_id. */ - String CREATED_BY_ID = "created_by_id"; - /** last_modified_at. */ - String LAST_MODIFIED_AT = "last_modified_at"; - /** last_modified_by_id. */ - String LAST_MODIFIED_BY_ID = "last_modified_by_id"; - /** state. */ - String STATE = "state"; - } - - /** - * Include additional data per policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles. - */ - public interface Format { - /** include_last_permit. */ - String INCLUDE_LAST_PERMIT = "include_last_permit"; - /** display. */ - String DISPLAY = "display"; - } - - /** - * The state of the policy. - * * `active` - returns active policies - * * `deleted` - returns non-active policies. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String accountId; - protected String acceptLanguage; - protected String iamId; - protected String accessGroupId; - protected String type; - protected String serviceType; - protected String tagName; - protected String tagValue; - protected String sort; - protected String format; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String iamId; - private String accessGroupId; - private String type; - private String serviceType; - private String tagName; - private String tagValue; - private String sort; - private String format; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListPoliciesOptions instance. - * - * @param listPoliciesOptions the instance to initialize the Builder with - */ - private Builder(ListPoliciesOptions listPoliciesOptions) { - this.accountId = listPoliciesOptions.accountId; - this.acceptLanguage = listPoliciesOptions.acceptLanguage; - this.iamId = listPoliciesOptions.iamId; - this.accessGroupId = listPoliciesOptions.accessGroupId; - this.type = listPoliciesOptions.type; - this.serviceType = listPoliciesOptions.serviceType; - this.tagName = listPoliciesOptions.tagName; - this.tagValue = listPoliciesOptions.tagValue; - this.sort = listPoliciesOptions.sort; - this.format = listPoliciesOptions.format; - this.state = listPoliciesOptions.state; - this.limit = listPoliciesOptions.limit; - this.start = listPoliciesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListPoliciesOptions. - * - * @return the new ListPoliciesOptions instance - */ - public ListPoliciesOptions build() { - return new ListPoliciesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListPoliciesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListPoliciesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the iamId. - * - * @param iamId the iamId - * @return the ListPoliciesOptions builder - */ - public Builder iamId(String iamId) { - this.iamId = iamId; - return this; - } - - /** - * Set the accessGroupId. - * - * @param accessGroupId the accessGroupId - * @return the ListPoliciesOptions builder - */ - public Builder accessGroupId(String accessGroupId) { - this.accessGroupId = accessGroupId; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the ListPoliciesOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the serviceType. - * - * @param serviceType the serviceType - * @return the ListPoliciesOptions builder - */ - public Builder serviceType(String serviceType) { - this.serviceType = serviceType; - return this; - } - - /** - * Set the tagName. - * - * @param tagName the tagName - * @return the ListPoliciesOptions builder - */ - public Builder tagName(String tagName) { - this.tagName = tagName; - return this; - } - - /** - * Set the tagValue. - * - * @param tagValue the tagValue - * @return the ListPoliciesOptions builder - */ - public Builder tagValue(String tagValue) { - this.tagValue = tagValue; - return this; - } - - /** - * Set the sort. - * - * @param sort the sort - * @return the ListPoliciesOptions builder - */ - public Builder sort(String sort) { - this.sort = sort; - return this; - } - - /** - * Set the format. - * - * @param format the format - * @return the ListPoliciesOptions builder - */ - public Builder format(String format) { - this.format = format; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListPoliciesOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListPoliciesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListPoliciesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListPoliciesOptions() { } - - protected ListPoliciesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - iamId = builder.iamId; - accessGroupId = builder.accessGroupId; - type = builder.type; - serviceType = builder.serviceType; - tagName = builder.tagName; - tagValue = builder.tagValue; - sort = builder.sort; - format = builder.format; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListPoliciesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the policies belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the iamId. - * - * Optional IAM ID used to identify the subject. - * - * @return the iamId - */ - public String iamId() { - return iamId; - } - - /** - * Gets the accessGroupId. - * - * Optional access group id. - * - * @return the accessGroupId - */ - public String accessGroupId() { - return accessGroupId; - } - - /** - * Gets the type. - * - * Optional type of policy. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the serviceType. - * - * Optional type of service. - * - * @return the serviceType - */ - public String serviceType() { - return serviceType; - } - - /** - * Gets the tagName. - * - * Optional name of the access tag in the policy. - * - * @return the tagName - */ - public String tagName() { - return tagName; - } - - /** - * Gets the tagValue. - * - * Optional value of the access tag in the policy. - * - * @return the tagValue - */ - public String tagValue() { - return tagValue; - } - - /** - * Gets the sort. - * - * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending - * '-' to field. Example '-last_modified_at'. - * - * @return the sort - */ - public String sort() { - return sort; - } - - /** - * Gets the format. - * - * Include additional data per policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles. - * - * @return the format - */ - public String format() { - return format; - } - - /** - * Gets the state. - * - * The state of the policy. - * * `active` - returns active policies - * * `deleted` - returns non-active policies. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java deleted file mode 100644 index 9362749c670..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptions.java +++ /dev/null @@ -1,275 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listPolicyAssignments options. - */ -public class ListPolicyAssignmentsOptions extends GenericModel { - - protected String version; - protected String accountId; - protected String acceptLanguage; - protected String templateId; - protected String templateVersion; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String version; - private String accountId; - private String acceptLanguage; - private String templateId; - private String templateVersion; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListPolicyAssignmentsOptions instance. - * - * @param listPolicyAssignmentsOptions the instance to initialize the Builder with - */ - private Builder(ListPolicyAssignmentsOptions listPolicyAssignmentsOptions) { - this.version = listPolicyAssignmentsOptions.version; - this.accountId = listPolicyAssignmentsOptions.accountId; - this.acceptLanguage = listPolicyAssignmentsOptions.acceptLanguage; - this.templateId = listPolicyAssignmentsOptions.templateId; - this.templateVersion = listPolicyAssignmentsOptions.templateVersion; - this.limit = listPolicyAssignmentsOptions.limit; - this.start = listPolicyAssignmentsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param version the version - * @param accountId the accountId - */ - public Builder(String version, String accountId) { - this.version = version; - this.accountId = accountId; - } - - /** - * Builds a ListPolicyAssignmentsOptions. - * - * @return the new ListPolicyAssignmentsOptions instance - */ - public ListPolicyAssignmentsOptions build() { - return new ListPolicyAssignmentsOptions(this); - } - - /** - * Set the version. - * - * @param version the version - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the templateId. - * - * @param templateId the templateId - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder templateId(String templateId) { - this.templateId = templateId; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListPolicyAssignmentsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListPolicyAssignmentsOptions() { } - - protected ListPolicyAssignmentsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - version = builder.version; - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - templateId = builder.templateId; - templateVersion = builder.templateVersion; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListPolicyAssignmentsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the version. - * - * specify version of response body format. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the accountId. - * - * The account GUID in which the policies belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the templateId. - * - * Optional template id. - * - * @return the templateId - */ - public String templateId() { - return templateId; - } - - /** - * Gets the templateVersion. - * - * Optional policy template version. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java deleted file mode 100644 index c7965ba6c31..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptions.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listPolicyTemplateVersions options. - */ -public class ListPolicyTemplateVersionsOptions extends GenericModel { - - /** - * The policy template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String policyTemplateId; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListPolicyTemplateVersionsOptions instance. - * - * @param listPolicyTemplateVersionsOptions the instance to initialize the Builder with - */ - private Builder(ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions) { - this.policyTemplateId = listPolicyTemplateVersionsOptions.policyTemplateId; - this.state = listPolicyTemplateVersionsOptions.state; - this.limit = listPolicyTemplateVersionsOptions.limit; - this.start = listPolicyTemplateVersionsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - */ - public Builder(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - } - - /** - * Builds a ListPolicyTemplateVersionsOptions. - * - * @return the new ListPolicyTemplateVersionsOptions instance - */ - public ListPolicyTemplateVersionsOptions build() { - return new ListPolicyTemplateVersionsOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the ListPolicyTemplateVersionsOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListPolicyTemplateVersionsOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListPolicyTemplateVersionsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListPolicyTemplateVersionsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListPolicyTemplateVersionsOptions() { } - - protected ListPolicyTemplateVersionsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - policyTemplateId = builder.policyTemplateId; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListPolicyTemplateVersionsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the state. - * - * The policy template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java deleted file mode 100644 index f230c9bd549..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptions.java +++ /dev/null @@ -1,379 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listPolicyTemplates options. - */ -public class ListPolicyTemplatesOptions extends GenericModel { - - /** - * The policy template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - /** - * Service type, Optional. - */ - public interface PolicyServiceType { - /** service. */ - String SERVICE = "service"; - /** platform_service. */ - String PLATFORM_SERVICE = "platform_service"; - } - - /** - * Policy type, Optional. - */ - public interface PolicyType { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - protected String accountId; - protected String acceptLanguage; - protected String state; - protected String name; - protected String policyServiceType; - protected String policyServiceName; - protected String policyServiceGroupId; - protected String policyType; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String state; - private String name; - private String policyServiceType; - private String policyServiceName; - private String policyServiceGroupId; - private String policyType; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListPolicyTemplatesOptions instance. - * - * @param listPolicyTemplatesOptions the instance to initialize the Builder with - */ - private Builder(ListPolicyTemplatesOptions listPolicyTemplatesOptions) { - this.accountId = listPolicyTemplatesOptions.accountId; - this.acceptLanguage = listPolicyTemplatesOptions.acceptLanguage; - this.state = listPolicyTemplatesOptions.state; - this.name = listPolicyTemplatesOptions.name; - this.policyServiceType = listPolicyTemplatesOptions.policyServiceType; - this.policyServiceName = listPolicyTemplatesOptions.policyServiceName; - this.policyServiceGroupId = listPolicyTemplatesOptions.policyServiceGroupId; - this.policyType = listPolicyTemplatesOptions.policyType; - this.limit = listPolicyTemplatesOptions.limit; - this.start = listPolicyTemplatesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListPolicyTemplatesOptions. - * - * @return the new ListPolicyTemplatesOptions instance - */ - public ListPolicyTemplatesOptions build() { - return new ListPolicyTemplatesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListPolicyTemplatesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListPolicyTemplatesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListPolicyTemplatesOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ListPolicyTemplatesOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the policyServiceType. - * - * @param policyServiceType the policyServiceType - * @return the ListPolicyTemplatesOptions builder - */ - public Builder policyServiceType(String policyServiceType) { - this.policyServiceType = policyServiceType; - return this; - } - - /** - * Set the policyServiceName. - * - * @param policyServiceName the policyServiceName - * @return the ListPolicyTemplatesOptions builder - */ - public Builder policyServiceName(String policyServiceName) { - this.policyServiceName = policyServiceName; - return this; - } - - /** - * Set the policyServiceGroupId. - * - * @param policyServiceGroupId the policyServiceGroupId - * @return the ListPolicyTemplatesOptions builder - */ - public Builder policyServiceGroupId(String policyServiceGroupId) { - this.policyServiceGroupId = policyServiceGroupId; - return this; - } - - /** - * Set the policyType. - * - * @param policyType the policyType - * @return the ListPolicyTemplatesOptions builder - */ - public Builder policyType(String policyType) { - this.policyType = policyType; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListPolicyTemplatesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListPolicyTemplatesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListPolicyTemplatesOptions() { } - - protected ListPolicyTemplatesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - state = builder.state; - name = builder.name; - policyServiceType = builder.policyServiceType; - policyServiceName = builder.policyServiceName; - policyServiceGroupId = builder.policyServiceGroupId; - policyType = builder.policyType; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListPolicyTemplatesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the policy templates belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the state. - * - * The policy template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the name. - * - * The policy template name. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the policyServiceType. - * - * Service type, Optional. - * - * @return the policyServiceType - */ - public String policyServiceType() { - return policyServiceType; - } - - /** - * Gets the policyServiceName. - * - * Service name, Optional. - * - * @return the policyServiceName - */ - public String policyServiceName() { - return policyServiceName; - } - - /** - * Gets the policyServiceGroupId. - * - * Service group id, Optional. - * - * @return the policyServiceGroupId - */ - public String policyServiceGroupId() { - return policyServiceGroupId; - } - - /** - * Gets the policyType. - * - * Policy type, Optional. - * - * @return the policyType - */ - public String policyType() { - return policyType; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java deleted file mode 100644 index adcb3f0cc90..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptions.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listRoleAssignments options. - */ -public class ListRoleAssignmentsOptions extends GenericModel { - - protected String accountId; - protected String acceptLanguage; - protected String templateId; - protected String templateVersion; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String templateId; - private String templateVersion; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListRoleAssignmentsOptions instance. - * - * @param listRoleAssignmentsOptions the instance to initialize the Builder with - */ - private Builder(ListRoleAssignmentsOptions listRoleAssignmentsOptions) { - this.accountId = listRoleAssignmentsOptions.accountId; - this.acceptLanguage = listRoleAssignmentsOptions.acceptLanguage; - this.templateId = listRoleAssignmentsOptions.templateId; - this.templateVersion = listRoleAssignmentsOptions.templateVersion; - this.limit = listRoleAssignmentsOptions.limit; - this.start = listRoleAssignmentsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListRoleAssignmentsOptions. - * - * @return the new ListRoleAssignmentsOptions instance - */ - public ListRoleAssignmentsOptions build() { - return new ListRoleAssignmentsOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListRoleAssignmentsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListRoleAssignmentsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the templateId. - * - * @param templateId the templateId - * @return the ListRoleAssignmentsOptions builder - */ - public Builder templateId(String templateId) { - this.templateId = templateId; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the ListRoleAssignmentsOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListRoleAssignmentsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListRoleAssignmentsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListRoleAssignmentsOptions() { } - - protected ListRoleAssignmentsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - templateId = builder.templateId; - templateVersion = builder.templateVersion; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListRoleAssignmentsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID in which the role assignment belongs to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the templateId. - * - * Optional template ID. - * - * @return the templateId - */ - public String templateId() { - return templateId; - } - - /** - * Gets the templateVersion. - * - * Optional role template version. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java deleted file mode 100644 index e22751433e5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptions.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listRoleTemplateVersions options. - */ -public class ListRoleTemplateVersionsOptions extends GenericModel { - - /** - * Role template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String roleTemplateId; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListRoleTemplateVersionsOptions instance. - * - * @param listRoleTemplateVersionsOptions the instance to initialize the Builder with - */ - private Builder(ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions) { - this.roleTemplateId = listRoleTemplateVersionsOptions.roleTemplateId; - this.state = listRoleTemplateVersionsOptions.state; - this.limit = listRoleTemplateVersionsOptions.limit; - this.start = listRoleTemplateVersionsOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - */ - public Builder(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - } - - /** - * Builds a ListRoleTemplateVersionsOptions. - * - * @return the new ListRoleTemplateVersionsOptions instance - */ - public ListRoleTemplateVersionsOptions build() { - return new ListRoleTemplateVersionsOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the ListRoleTemplateVersionsOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListRoleTemplateVersionsOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListRoleTemplateVersionsOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListRoleTemplateVersionsOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListRoleTemplateVersionsOptions() { } - - protected ListRoleTemplateVersionsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - roleTemplateId = builder.roleTemplateId; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListRoleTemplateVersionsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * The role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the state. - * - * Role template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java deleted file mode 100644 index 8f889bdce96..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptions.java +++ /dev/null @@ -1,307 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listRoleTemplates options. - */ -public class ListRoleTemplatesOptions extends GenericModel { - - /** - * The role template state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String accountId; - protected String acceptLanguage; - protected String name; - protected String roleName; - protected String roleServiceName; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String name; - private String roleName; - private String roleServiceName; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListRoleTemplatesOptions instance. - * - * @param listRoleTemplatesOptions the instance to initialize the Builder with - */ - private Builder(ListRoleTemplatesOptions listRoleTemplatesOptions) { - this.accountId = listRoleTemplatesOptions.accountId; - this.acceptLanguage = listRoleTemplatesOptions.acceptLanguage; - this.name = listRoleTemplatesOptions.name; - this.roleName = listRoleTemplatesOptions.roleName; - this.roleServiceName = listRoleTemplatesOptions.roleServiceName; - this.state = listRoleTemplatesOptions.state; - this.limit = listRoleTemplatesOptions.limit; - this.start = listRoleTemplatesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListRoleTemplatesOptions. - * - * @return the new ListRoleTemplatesOptions instance - */ - public ListRoleTemplatesOptions build() { - return new ListRoleTemplatesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListRoleTemplatesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListRoleTemplatesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ListRoleTemplatesOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the roleName. - * - * @param roleName the roleName - * @return the ListRoleTemplatesOptions builder - */ - public Builder roleName(String roleName) { - this.roleName = roleName; - return this; - } - - /** - * Set the roleServiceName. - * - * @param roleServiceName the roleServiceName - * @return the ListRoleTemplatesOptions builder - */ - public Builder roleServiceName(String roleServiceName) { - this.roleServiceName = roleServiceName; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListRoleTemplatesOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListRoleTemplatesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListRoleTemplatesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListRoleTemplatesOptions() { } - - protected ListRoleTemplatesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - name = builder.name; - roleName = builder.roleName; - roleServiceName = builder.roleServiceName; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListRoleTemplatesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the role templates belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the name. - * - * The role template name. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the roleName. - * - * The template role name. - * - * @return the roleName - */ - public String roleName() { - return roleName; - } - - /** - * Gets the roleServiceName. - * - * The template role service name. - * - * @return the roleServiceName - */ - public String roleServiceName() { - return roleServiceName; - } - - /** - * Gets the state. - * - * The role template state. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java deleted file mode 100644 index 2ca364c53a3..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptions.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listRoles options. - */ -public class ListRolesOptions extends GenericModel { - - protected String acceptLanguage; - protected String accountId; - protected String serviceName; - protected String sourceServiceName; - protected String policyType; - protected String serviceGroupId; - - /** - * Builder. - */ - public static class Builder { - private String acceptLanguage; - private String accountId; - private String serviceName; - private String sourceServiceName; - private String policyType; - private String serviceGroupId; - - /** - * Instantiates a new Builder from an existing ListRolesOptions instance. - * - * @param listRolesOptions the instance to initialize the Builder with - */ - private Builder(ListRolesOptions listRolesOptions) { - this.acceptLanguage = listRolesOptions.acceptLanguage; - this.accountId = listRolesOptions.accountId; - this.serviceName = listRolesOptions.serviceName; - this.sourceServiceName = listRolesOptions.sourceServiceName; - this.policyType = listRolesOptions.policyType; - this.serviceGroupId = listRolesOptions.serviceGroupId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a ListRolesOptions. - * - * @return the new ListRolesOptions instance - */ - public ListRolesOptions build() { - return new ListRolesOptions(this); - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListRolesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListRolesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the ListRolesOptions builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the sourceServiceName. - * - * @param sourceServiceName the sourceServiceName - * @return the ListRolesOptions builder - */ - public Builder sourceServiceName(String sourceServiceName) { - this.sourceServiceName = sourceServiceName; - return this; - } - - /** - * Set the policyType. - * - * @param policyType the policyType - * @return the ListRolesOptions builder - */ - public Builder policyType(String policyType) { - this.policyType = policyType; - return this; - } - - /** - * Set the serviceGroupId. - * - * @param serviceGroupId the serviceGroupId - * @return the ListRolesOptions builder - */ - public Builder serviceGroupId(String serviceGroupId) { - this.serviceGroupId = serviceGroupId; - return this; - } - } - - protected ListRolesOptions() { } - - protected ListRolesOptions(Builder builder) { - acceptLanguage = builder.acceptLanguage; - accountId = builder.accountId; - serviceName = builder.serviceName; - sourceServiceName = builder.sourceServiceName; - policyType = builder.policyType; - serviceGroupId = builder.serviceGroupId; - } - - /** - * New builder. - * - * @return a ListRolesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the accountId. - * - * Optional account GUID in which the roles belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the serviceName. - * - * Optional name of IAM enabled service. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the sourceServiceName. - * - * Optional name of source IAM enabled service. - * - * @return the sourceServiceName - */ - public String sourceServiceName() { - return sourceServiceName; - } - - /** - * Gets the policyType. - * - * Optional Policy Type. - * - * @return the policyType - */ - public String policyType() { - return policyType; - } - - /** - * Gets the serviceGroupId. - * - * Optional id of service group. - * - * @return the serviceGroupId - */ - public String serviceGroupId() { - return serviceGroupId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java deleted file mode 100644 index 65849c3d9a6..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptions.java +++ /dev/null @@ -1,492 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listV2Policies options. - */ -public class ListV2PoliciesOptions extends GenericModel { - - /** - * Optional type of policy. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - /** - * Optional type of service. - */ - public interface ServiceType { - /** service. */ - String SERVICE = "service"; - /** platform_service. */ - String PLATFORM_SERVICE = "platform_service"; - } - - /** - * Include additional data per policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles and translations for all - * relevant fields. - */ - public interface Format { - /** include_last_permit. */ - String INCLUDE_LAST_PERMIT = "include_last_permit"; - /** display. */ - String DISPLAY = "display"; - } - - /** - * The state of the policy. - * * `active` - returns active policies - * * `deleted` - returns non-active policies. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String accountId; - protected String acceptLanguage; - protected String iamId; - protected String accessGroupId; - protected String type; - protected String serviceType; - protected String serviceName; - protected String serviceGroupId; - protected String sort; - protected String format; - protected String state; - protected Long limit; - protected String start; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String acceptLanguage; - private String iamId; - private String accessGroupId; - private String type; - private String serviceType; - private String serviceName; - private String serviceGroupId; - private String sort; - private String format; - private String state; - private Long limit; - private String start; - - /** - * Instantiates a new Builder from an existing ListV2PoliciesOptions instance. - * - * @param listV2PoliciesOptions the instance to initialize the Builder with - */ - private Builder(ListV2PoliciesOptions listV2PoliciesOptions) { - this.accountId = listV2PoliciesOptions.accountId; - this.acceptLanguage = listV2PoliciesOptions.acceptLanguage; - this.iamId = listV2PoliciesOptions.iamId; - this.accessGroupId = listV2PoliciesOptions.accessGroupId; - this.type = listV2PoliciesOptions.type; - this.serviceType = listV2PoliciesOptions.serviceType; - this.serviceName = listV2PoliciesOptions.serviceName; - this.serviceGroupId = listV2PoliciesOptions.serviceGroupId; - this.sort = listV2PoliciesOptions.sort; - this.format = listV2PoliciesOptions.format; - this.state = listV2PoliciesOptions.state; - this.limit = listV2PoliciesOptions.limit; - this.start = listV2PoliciesOptions.start; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - */ - public Builder(String accountId) { - this.accountId = accountId; - } - - /** - * Builds a ListV2PoliciesOptions. - * - * @return the new ListV2PoliciesOptions instance - */ - public ListV2PoliciesOptions build() { - return new ListV2PoliciesOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ListV2PoliciesOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the ListV2PoliciesOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** - * Set the iamId. - * - * @param iamId the iamId - * @return the ListV2PoliciesOptions builder - */ - public Builder iamId(String iamId) { - this.iamId = iamId; - return this; - } - - /** - * Set the accessGroupId. - * - * @param accessGroupId the accessGroupId - * @return the ListV2PoliciesOptions builder - */ - public Builder accessGroupId(String accessGroupId) { - this.accessGroupId = accessGroupId; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the ListV2PoliciesOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the serviceType. - * - * @param serviceType the serviceType - * @return the ListV2PoliciesOptions builder - */ - public Builder serviceType(String serviceType) { - this.serviceType = serviceType; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the ListV2PoliciesOptions builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the serviceGroupId. - * - * @param serviceGroupId the serviceGroupId - * @return the ListV2PoliciesOptions builder - */ - public Builder serviceGroupId(String serviceGroupId) { - this.serviceGroupId = serviceGroupId; - return this; - } - - /** - * Set the sort. - * - * @param sort the sort - * @return the ListV2PoliciesOptions builder - */ - public Builder sort(String sort) { - this.sort = sort; - return this; - } - - /** - * Set the format. - * - * @param format the format - * @return the ListV2PoliciesOptions builder - */ - public Builder format(String format) { - this.format = format; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the ListV2PoliciesOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListV2PoliciesOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the start. - * - * @param start the start - * @return the ListV2PoliciesOptions builder - */ - public Builder start(String start) { - this.start = start; - return this; - } - } - - protected ListV2PoliciesOptions() { } - - protected ListV2PoliciesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, - "accountId cannot be null"); - accountId = builder.accountId; - acceptLanguage = builder.acceptLanguage; - iamId = builder.iamId; - accessGroupId = builder.accessGroupId; - type = builder.type; - serviceType = builder.serviceType; - serviceName = builder.serviceName; - serviceGroupId = builder.serviceGroupId; - sort = builder.sort; - format = builder.format; - state = builder.state; - limit = builder.limit; - start = builder.start; - } - - /** - * New builder. - * - * @return a ListV2PoliciesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID in which the policies belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } - - /** - * Gets the iamId. - * - * Optional IAM ID used to identify the subject. - * - * @return the iamId - */ - public String iamId() { - return iamId; - } - - /** - * Gets the accessGroupId. - * - * Optional access group id. - * - * @return the accessGroupId - */ - public String accessGroupId() { - return accessGroupId; - } - - /** - * Gets the type. - * - * Optional type of policy. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the serviceType. - * - * Optional type of service. - * - * @return the serviceType - */ - public String serviceType() { - return serviceType; - } - - /** - * Gets the serviceName. - * - * Optional name of service. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the serviceGroupId. - * - * Optional ID of service group. - * - * @return the serviceGroupId - */ - public String serviceGroupId() { - return serviceGroupId; - } - - /** - * Gets the sort. - * - * Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending - * '-' to field, for example, '-last_modified_at'. Note that last permit information is only included when - * 'format=include_last_permit', for example, "format=include_last_permit&sort=last_permit_at" Example fields that - * can be sorted on: - * - 'id' - * - 'type' - * - 'href' - * - 'created_at' - * - 'created_by_id' - * - 'last_modified_at' - * - 'last_modified_by_id' - * - 'state' - * - 'last_permit_at' - * - 'last_permit_frequency'. - * - * @return the sort - */ - public String sort() { - return sort; - } - - /** - * Gets the format. - * - * Include additional data per policy returned - * * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times - * it has done so - * * `display` - returns the list of all actions included in each of the policy roles and translations for all - * relevant fields. - * - * @return the format - */ - public String format() { - return format; - } - - /** - * Gets the state. - * - * The state of the policy. - * * `active` - returns active policies - * * `deleted` - returns non-active policies. - * - * @return the state - */ - public String state() { - return state; - } - - /** - * Gets the limit. - * - * The number of documents to include in the collection. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection to return. - * - * @return the start - */ - public String start() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java deleted file mode 100644 index 4d43d84dbba..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedCondition.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Condition that specifies additional conditions or RuleAttribute to grant access. - * - * Classes which extend this class: - * - NestedConditionRuleAttribute - * - NestedConditionRuleWithConditions - */ -public class NestedCondition extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - protected String key; - protected String operator; - protected Object value; - protected List conditions; - - protected NestedCondition() { } - - /** - * Gets the key. - * - * The name of an attribute. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } - - /** - * Gets the conditions. - * - * List of conditions associated with a policy. For example, time-based conditions that grant access over a certain - * time period. - * - * @return the conditions - */ - public List conditions() { - return conditions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java deleted file mode 100644 index b1d44da3f6b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttribute.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * Rule that specifies additional access that is granted (For example, time-based condition). - */ -public class NestedConditionRuleAttribute extends NestedCondition { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing NestedConditionRuleAttribute instance. - * - * @param nestedConditionRuleAttribute the instance to initialize the Builder with - */ - public Builder(NestedCondition nestedConditionRuleAttribute) { - this.key = nestedConditionRuleAttribute.key; - this.operator = nestedConditionRuleAttribute.operator; - this.value = nestedConditionRuleAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a NestedConditionRuleAttribute. - * - * @return the new NestedConditionRuleAttribute instance - */ - public NestedConditionRuleAttribute build() { - return new NestedConditionRuleAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the NestedConditionRuleAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the NestedConditionRuleAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the NestedConditionRuleAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected NestedConditionRuleAttribute() { } - - protected NestedConditionRuleAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a NestedConditionRuleAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java deleted file mode 100644 index 20d0faac795..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditions.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * Rule that specifies additional access that is granted (for example, time-based condition) accross multiple - * conditions. - */ -public class NestedConditionRuleWithConditions extends NestedCondition { - - /** - * Operator to evaluate conditions. - */ - public interface Operator { - /** and. */ - String AND = "and"; - /** or. */ - String OR = "or"; - } - - - /** - * Builder. - */ - public static class Builder { - private String operator; - private List conditions; - - /** - * Instantiates a new Builder from an existing NestedConditionRuleWithConditions instance. - * - * @param nestedConditionRuleWithConditions the instance to initialize the Builder with - */ - public Builder(NestedCondition nestedConditionRuleWithConditions) { - this.operator = nestedConditionRuleWithConditions.operator; - this.conditions = nestedConditionRuleWithConditions.conditions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param operator the operator - * @param conditions the conditions - */ - public Builder(String operator, List conditions) { - this.operator = operator; - this.conditions = conditions; - } - - /** - * Builds a NestedConditionRuleWithConditions. - * - * @return the new NestedConditionRuleWithConditions instance - */ - public NestedConditionRuleWithConditions build() { - return new NestedConditionRuleWithConditions(this); - } - - /** - * Adds a new element to conditions. - * - * @param conditions the new element to be added - * @return the NestedConditionRuleWithConditions builder - */ - public Builder addConditions(RuleAttribute conditions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(conditions, - "conditions cannot be null"); - if (this.conditions == null) { - this.conditions = new ArrayList(); - } - this.conditions.add(conditions); - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the NestedConditionRuleWithConditions builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the conditions. - * Existing conditions will be replaced. - * - * @param conditions the conditions - * @return the NestedConditionRuleWithConditions builder - */ - public Builder conditions(List conditions) { - this.conditions = conditions; - return this; - } - } - - protected NestedConditionRuleWithConditions() { } - - protected NestedConditionRuleWithConditions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.conditions, - "conditions cannot be null"); - operator = builder.operator; - conditions = builder.conditions; - } - - /** - * New builder. - * - * @return a NestedConditionRuleWithConditions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java deleted file mode 100644 index b0442f902bc..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Next.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Details with href linking to the following page of requested collection. - */ -public class Next extends GenericModel { - - protected String href; - protected String start; - - protected Next() { } - - /** - * Gets the href. - * - * The href linking to the page of requested collection. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection. - * - * @return the start - */ - public String getStart() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java deleted file mode 100644 index 8f12053c72e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PoliciesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * PoliciesPager can be used to simplify the use of the "listPolicies" method. - */ -public class PoliciesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListPoliciesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected PoliciesPager() { } - - /** - * Constructs a new PoliciesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listPolicies" method - * @param options the ListPoliciesOptions instance to be used to invoke the "listPolicies" method - */ - public PoliciesPager(IamPolicyManagement client, ListPoliciesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<PolicyTemplateMetaData> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListPoliciesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - PolicyCollection result = client.listPolicies(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getPolicies(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<PolicyTemplateMetaData> containing all results returned by the "listPolicies" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java deleted file mode 100644 index af852b7cd74..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Policy.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with a policy. - */ -public class Policy extends GenericModel { - - /** - * The policy state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String id; - protected String type; - protected String description; - protected List subjects; - protected List roles; - protected List resources; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String state; - - protected Policy() { } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Gets the description. - * - * Customer-defined description. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the subjects. - * - * The subjects associated with a policy. - * - * @return the subjects - */ - public List getSubjects() { - return subjects; - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List getRoles() { - return roles; - } - - /** - * Gets the resources. - * - * The resources associated with a policy. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the href. - * - * The href links back to the policy. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the state. - * - * The policy state. - * - * @return the state - */ - public String getState() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java deleted file mode 100644 index 3e566ce7bdf..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicy.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Set of properties for the assigned resource. - */ -public class PolicyAssignmentResourcePolicy extends GenericModel { - - @SerializedName("resource_created") - protected AssignmentResourceCreated resourceCreated; - protected String status; - @SerializedName("error_message") - protected AssignmentResourceError errorMessage; - - protected PolicyAssignmentResourcePolicy() { } - - /** - * Gets the resourceCreated. - * - * On success, includes the policy that is assigned. - * - * @return the resourceCreated - */ - public AssignmentResourceCreated getResourceCreated() { - return resourceCreated; - } - - /** - * Gets the status. - * - * policy status. - * - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * Gets the errorMessage. - * - * Body parameters for assignment error. - * - * @return the errorMessage - */ - public AssignmentResourceError getErrorMessage() { - return errorMessage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java deleted file mode 100644 index ad944536b0d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResources.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The policy assignment resources. - */ -public class PolicyAssignmentResources extends GenericModel { - - protected String target; - protected PolicyAssignmentResourcePolicy policy; - - protected PolicyAssignmentResources() { } - - /** - * Gets the target. - * - * Account ID where resources are assigned. - * - * @return the target - */ - public String getTarget() { - return target; - } - - /** - * Gets the policy. - * - * Set of properties for the assigned resource. - * - * @return the policy - */ - public PolicyAssignmentResourcePolicy getPolicy() { - return policy; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java deleted file mode 100644 index f1ea295713c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the policy template assignment. - */ -public class PolicyAssignmentV1 extends GenericModel { - - /** - * The policy assignment status. - */ - public interface Status { - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** succeeded. */ - String SUCCEEDED = "succeeded"; - /** succeed_with_errors. */ - String SUCCEED_WITH_ERRORS = "succeed_with_errors"; - /** failed. */ - String FAILED = "failed"; - } - - protected AssignmentTargetDetails target; - protected String id; - @SerializedName("account_id") - protected String accountId; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected List resources; - protected PolicyAssignmentV1Subject subject; - protected AssignmentTemplateDetails template; - protected String status; - - protected PolicyAssignmentV1() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the id. - * - * Policy assignment ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the accountId. - * - * The account GUID that the policies assignments belong to. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the href. - * - * The href URL that links to the policies assignments API by policy assignment ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy assignment was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy assignment. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy assignment was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy assignment. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the resources. - * - * Object for each account assigned. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the subject. - * - * Subject details of access type assignment. - * - * @return the subject - */ - public PolicyAssignmentV1Subject getSubject() { - return subject; - } - - /** - * Gets the template. - * - * policy template details. - * - * @return the template - */ - public AssignmentTemplateDetails getTemplate() { - return template; - } - - /** - * Gets the status. - * - * The policy assignment status. - * - * @return the status - */ - public String getStatus() { - return status; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java deleted file mode 100644 index 7331ee5a854..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Collection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Policy assignment response. - */ -public class PolicyAssignmentV1Collection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List assignments; - - protected PolicyAssignmentV1Collection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the assignments. - * - * Response of policy assignments. - * - * @return the assignments - */ - public List getAssignments() { - return assignments; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java deleted file mode 100644 index c05eb90816b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Resources.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The policy assignment resources. - */ -public class PolicyAssignmentV1Resources extends GenericModel { - - protected AssignmentTargetDetails target; - protected PolicyAssignmentResourcePolicy policy; - - protected PolicyAssignmentV1Resources() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the policy. - * - * Set of properties for the assigned resource. - * - * @return the policy - */ - public PolicyAssignmentResourcePolicy getPolicy() { - return policy; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java deleted file mode 100644 index 58b2cd240ba..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Subject.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Subject details of access type assignment. - */ -public class PolicyAssignmentV1Subject extends GenericModel { - - /** - * The identity type of the subject of the assignment. - */ - public interface Type { - /** iam_id. */ - String IAM_ID = "iam_id"; - /** access_group_id. */ - String ACCESS_GROUP_ID = "access_group_id"; - } - - protected String id; - protected String type; - - protected PolicyAssignmentV1Subject() { } - - /** - * Gets the id. - * - * The unique identifier of the subject of the assignment. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the type. - * - * The identity type of the subject of the assignment. - * - * @return the type - */ - public String getType() { - return type; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java deleted file mode 100644 index 931769daed5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * PolicyAssignmentsPager can be used to simplify the use of the "listPolicyAssignments" method. - */ -public class PolicyAssignmentsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListPolicyAssignmentsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected PolicyAssignmentsPager() { } - - /** - * Constructs a new PolicyAssignmentsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyAssignments" method - * @param options the ListPolicyAssignmentsOptions instance to be used to invoke the "listPolicyAssignments" method - */ - public PolicyAssignmentsPager(IamPolicyManagement client, ListPolicyAssignmentsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<PolicyTemplateAssignmentItems> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListPolicyAssignmentsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - PolicyTemplateAssignmentCollection result = client.listPolicyAssignments(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getAssignments(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<PolicyTemplateAssignmentItems> containing all results returned by the "listPolicyAssignments" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java deleted file mode 100644 index 25062dd0a52..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of policies. - */ -public class PolicyCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List policies; - - protected PolicyCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the policies. - * - * List of policies. - * - * @return the policies - */ - public List getPolicies() { - return policies; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java deleted file mode 100644 index 4033f2dbc9d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResource.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The attributes of the resource. Note that only one resource is allowed in a policy. - */ -public class PolicyResource extends GenericModel { - - protected List attributes; - protected List tags; - - /** - * Builder. - */ - public static class Builder { - private List attributes; - private List tags; - - /** - * Instantiates a new Builder from an existing PolicyResource instance. - * - * @param policyResource the instance to initialize the Builder with - */ - private Builder(PolicyResource policyResource) { - this.attributes = policyResource.attributes; - this.tags = policyResource.tags; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param attributes the attributes - */ - public Builder(List attributes) { - this.attributes = attributes; - } - - /** - * Builds a PolicyResource. - * - * @return the new PolicyResource instance - */ - public PolicyResource build() { - return new PolicyResource(this); - } - - /** - * Adds a new element to attributes. - * - * @param attributes the new element to be added - * @return the PolicyResource builder - */ - public Builder addAttributes(ResourceAttribute attributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, - "attributes cannot be null"); - if (this.attributes == null) { - this.attributes = new ArrayList(); - } - this.attributes.add(attributes); - return this; - } - - /** - * Adds a new element to tags. - * - * @param tags the new element to be added - * @return the PolicyResource builder - */ - public Builder addTags(ResourceTag tags) { - com.ibm.cloud.sdk.core.util.Validator.notNull(tags, - "tags cannot be null"); - if (this.tags == null) { - this.tags = new ArrayList(); - } - this.tags.add(tags); - return this; - } - - /** - * Set the attributes. - * Existing attributes will be replaced. - * - * @param attributes the attributes - * @return the PolicyResource builder - */ - public Builder attributes(List attributes) { - this.attributes = attributes; - return this; - } - - /** - * Set the tags. - * Existing tags will be replaced. - * - * @param tags the tags - * @return the PolicyResource builder - */ - public Builder tags(List tags) { - this.tags = tags; - return this; - } - } - - protected PolicyResource() { } - - protected PolicyResource(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, - "attributes cannot be null"); - attributes = builder.attributes; - tags = builder.tags; - } - - /** - * New builder. - * - * @return a PolicyResource builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the attributes. - * - * List of resource attributes. - * - * @return the attributes - */ - public List attributes() { - return attributes; - } - - /** - * Gets the tags. - * - * List of access management tags. - * - * @return the tags - */ - public List tags() { - return tags; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java deleted file mode 100644 index 7319eabce7b..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRole.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role associated with a policy. - */ -public class PolicyRole extends GenericModel { - - @SerializedName("role_id") - protected String roleId; - @SerializedName("display_name") - protected String displayName; - protected String description; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - - /** - * Instantiates a new Builder from an existing PolicyRole instance. - * - * @param policyRole the instance to initialize the Builder with - */ - private Builder(PolicyRole policyRole) { - this.roleId = policyRole.roleId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - */ - public Builder(String roleId) { - this.roleId = roleId; - } - - /** - * Builds a PolicyRole. - * - * @return the new PolicyRole instance - */ - public PolicyRole build() { - return new PolicyRole(this); - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the PolicyRole builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - } - - protected PolicyRole() { } - - protected PolicyRole(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleId, - "roleId cannot be null"); - roleId = builder.roleId; - } - - /** - * New builder. - * - * @return a PolicyRole builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } - - /** - * Gets the displayName. - * - * The display name of the role. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String description() { - return description; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java deleted file mode 100644 index bf1b035a6b7..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubject.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The subject attribute values that must match in order for this policy to apply in a permission decision. - */ -public class PolicySubject extends GenericModel { - - protected List attributes; - - /** - * Builder. - */ - public static class Builder { - private List attributes; - - /** - * Instantiates a new Builder from an existing PolicySubject instance. - * - * @param policySubject the instance to initialize the Builder with - */ - private Builder(PolicySubject policySubject) { - this.attributes = policySubject.attributes; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param attributes the attributes - */ - public Builder(List attributes) { - this.attributes = attributes; - } - - /** - * Builds a PolicySubject. - * - * @return the new PolicySubject instance - */ - public PolicySubject build() { - return new PolicySubject(this); - } - - /** - * Adds a new element to attributes. - * - * @param attributes the new element to be added - * @return the PolicySubject builder - */ - public Builder addAttributes(SubjectAttribute attributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, - "attributes cannot be null"); - if (this.attributes == null) { - this.attributes = new ArrayList(); - } - this.attributes.add(attributes); - return this; - } - - /** - * Set the attributes. - * Existing attributes will be replaced. - * - * @param attributes the attributes - * @return the PolicySubject builder - */ - public Builder attributes(List attributes) { - this.attributes = attributes; - return this; - } - } - - protected PolicySubject() { } - - protected PolicySubject(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, - "attributes cannot be null"); - attributes = builder.attributes; - } - - /** - * New builder. - * - * @return a PolicySubject builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the attributes. - * - * List of subject attributes. - * - * @return the attributes - */ - public List attributes() { - return attributes; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java deleted file mode 100644 index bdffbe98c10..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplate.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the policy template. - */ -public class PolicyTemplate extends GenericModel { - - /** - * State of policy template. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String name; - protected String description; - @SerializedName("account_id") - protected String accountId; - protected String version; - protected Boolean committed; - protected TemplatePolicy policy; - protected String state; - protected String id; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - - protected PolicyTemplate() { } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the version. - * - * Template version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the committed. - * - * Committed status of the template version. - * - * @return the committed - */ - public Boolean isCommitted() { - return committed; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy getPolicy() { - return policy; - } - - /** - * Gets the state. - * - * State of policy template. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the id. - * - * The policy template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the policy templates API by policy template ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy template was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy template. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy template was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy template. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java deleted file mode 100644 index 54727eadf4d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of policies assignments. - */ -public class PolicyTemplateAssignmentCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List assignments; - - protected PolicyTemplateAssignmentCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the assignments. - * - * List of policy assignments. - * - * @return the assignments - */ - public List getAssignments() { - return assignments; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java deleted file mode 100644 index 2c8e82df441..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItems.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * PolicyTemplateAssignmentItems. - * - * Classes which extend this class: - * - PolicyTemplateAssignmentItemsPolicyAssignmentV1 - * - PolicyTemplateAssignmentItemsPolicyAssignment - */ -public class PolicyTemplateAssignmentItems extends GenericModel { - - /** - * The policy assignment status. - */ - public interface Status { - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** succeeded. */ - String SUCCEEDED = "succeeded"; - /** succeed_with_errors. */ - String SUCCEED_WITH_ERRORS = "succeed_with_errors"; - /** failed. */ - String FAILED = "failed"; - } - - /** - * Assignment target type. - */ - public interface TargetType { - /** Account. */ - String ACCOUNT = "Account"; - /** AccountGroup. */ - String ACCOUNTGROUP = "AccountGroup"; - /** Enterprise. */ - String ENTERPRISE = "Enterprise"; - } - - protected AssignmentTargetDetails target; - protected String id; - @SerializedName("account_id") - protected String accountId; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected List resources; - protected PolicyAssignmentV1Subject subject; - protected AssignmentTemplateDetails template; - protected String status; - @SerializedName("template_id") - protected String templateId; - @SerializedName("template_version") - protected String templateVersion; - @SerializedName("assignment_id") - protected String assignmentId; - @SerializedName("target_type") - protected String targetType; - - protected PolicyTemplateAssignmentItems() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the id. - * - * Policy assignment ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the accountId. - * - * The account GUID that the policies assignments belong to. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the href. - * - * The href URL that links to the policies assignments API by policy assignment ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy assignment was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy assignment. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy assignment was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy assignment. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the resources. - * - * Object for each account assigned. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the subject. - * - * Subject details of access type assignment. - * - * @return the subject - */ - public PolicyAssignmentV1Subject getSubject() { - return subject; - } - - /** - * Gets the template. - * - * policy template details. - * - * @return the template - */ - public AssignmentTemplateDetails getTemplate() { - return template; - } - - /** - * Gets the status. - * - * The policy assignment status. - * - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * Gets the templateId. - * - * policy template ID. - * - * @return the templateId - */ - public String getTemplateId() { - return templateId; - } - - /** - * Gets the templateVersion. - * - * policy template version. - * - * @return the templateVersion - */ - public String getTemplateVersion() { - return templateVersion; - } - - /** - * Gets the assignmentId. - * - * Passed in value to correlate with other assignments. - * - * @return the assignmentId - */ - public String getAssignmentId() { - return assignmentId; - } - - /** - * Gets the targetType. - * - * Assignment target type. - * - * @return the targetType - */ - public String getTargetType() { - return targetType; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java deleted file mode 100644 index ec9c32e5bdd..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignment.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * The set of properties associated with the policy template assignment. - */ -public class PolicyTemplateAssignmentItemsPolicyAssignment extends PolicyTemplateAssignmentItems { - - /** - * Assignment target type. - */ - public interface TargetType { - /** Account. */ - String ACCOUNT = "Account"; - /** AccountGroup. */ - String ACCOUNTGROUP = "AccountGroup"; - /** Enterprise. */ - String ENTERPRISE = "Enterprise"; - } - - /** - * The policy assignment status. - */ - public interface Status { - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** succeeded. */ - String SUCCEEDED = "succeeded"; - /** succeed_with_errors. */ - String SUCCEED_WITH_ERRORS = "succeed_with_errors"; - /** failed. */ - String FAILED = "failed"; - } - - - protected PolicyTemplateAssignmentItemsPolicyAssignment() { } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java deleted file mode 100644 index 4cebdbb17b1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * The set of properties associated with the policy template assignment. - */ -public class PolicyTemplateAssignmentItemsPolicyAssignmentV1 extends PolicyTemplateAssignmentItems { - - /** - * The policy assignment status. - */ - public interface Status { - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** succeeded. */ - String SUCCEEDED = "succeeded"; - /** succeed_with_errors. */ - String SUCCEED_WITH_ERRORS = "succeed_with_errors"; - /** failed. */ - String FAILED = "failed"; - } - - - protected PolicyTemplateAssignmentItemsPolicyAssignmentV1() { } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java deleted file mode 100644 index 2a262c584b5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollection.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of policy Templates. - */ -public class PolicyTemplateCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - @SerializedName("policy_templates") - protected List policyTemplates; - - protected PolicyTemplateCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the policyTemplates. - * - * List of policy templates. - * - * @return the policyTemplates - */ - public List getPolicyTemplates() { - return policyTemplates; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java deleted file mode 100644 index 5a2876dfe28..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitData.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the policy template. - */ -public class PolicyTemplateLimitData extends GenericModel { - - /** - * State of policy template. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String name; - protected String description; - @SerializedName("account_id") - protected String accountId; - protected String version; - protected Boolean committed; - protected TemplatePolicy policy; - protected String state; - protected String id; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected TemplateCountData counts; - - protected PolicyTemplateLimitData() { } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the version. - * - * Template version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the committed. - * - * Committed status of the template version. - * - * @return the committed - */ - public Boolean isCommitted() { - return committed; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy getPolicy() { - return policy; - } - - /** - * Gets the state. - * - * State of policy template. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the id. - * - * The policy template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the policy templates API by policy template ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy template was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy template. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy template was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy template. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the counts. - * - * policy template count details. - * - * @return the counts - */ - public TemplateCountData getCounts() { - return counts; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java deleted file mode 100644 index 07effc5b3ad..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaData.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with a policy. - */ -public class PolicyTemplateMetaData extends GenericModel { - - /** - * The policy state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String id; - protected String type; - protected String description; - protected List subjects; - protected List roles; - protected List resources; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String state; - protected TemplateMetadata template; - - protected PolicyTemplateMetaData() { } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Gets the description. - * - * Customer-defined description. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the subjects. - * - * The subjects associated with a policy. - * - * @return the subjects - */ - public List getSubjects() { - return subjects; - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List getRoles() { - return roles; - } - - /** - * Gets the resources. - * - * The resources associated with a policy. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the href. - * - * The href links back to the policy. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the state. - * - * The policy state. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the template. - * - * The details of the IAM template that was used to create an enterprise-managed policy in your account. When - * returned, this indicates that the policy is created from and managed by a template in the root enterprise account. - * - * @return the template - */ - public TemplateMetadata getTemplate() { - return template; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java deleted file mode 100644 index a4f95bc6562..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of versions for a specific policy template. - */ -public class PolicyTemplateVersionsCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List versions; - - protected PolicyTemplateVersionsCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the versions. - * - * List of policy templates versions. - * - * @return the versions - */ - public List getVersions() { - return versions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java deleted file mode 100644 index f6a2496cf91..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * PolicyTemplateVersionsPager can be used to simplify the use of the "listPolicyTemplateVersions" method. - */ -public class PolicyTemplateVersionsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListPolicyTemplateVersionsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected PolicyTemplateVersionsPager() { } - - /** - * Constructs a new PolicyTemplateVersionsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyTemplateVersions" method - * @param options the ListPolicyTemplateVersionsOptions instance to be used to invoke the "listPolicyTemplateVersions" method - */ - public PolicyTemplateVersionsPager(IamPolicyManagement client, ListPolicyTemplateVersionsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<PolicyTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListPolicyTemplateVersionsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - PolicyTemplateVersionsCollection result = client.listPolicyTemplateVersions(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getVersions(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<PolicyTemplate> containing all results returned by the "listPolicyTemplateVersions" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java deleted file mode 100644 index eba6e6c8fad..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplatesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * PolicyTemplatesPager can be used to simplify the use of the "listPolicyTemplates" method. - */ -public class PolicyTemplatesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListPolicyTemplatesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected PolicyTemplatesPager() { } - - /** - * Constructs a new PolicyTemplatesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listPolicyTemplates" method - * @param options the ListPolicyTemplatesOptions instance to be used to invoke the "listPolicyTemplates" method - */ - public PolicyTemplatesPager(IamPolicyManagement client, ListPolicyTemplatesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<PolicyTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListPolicyTemplatesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - PolicyTemplateCollection result = client.listPolicyTemplates(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getPolicyTemplates(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<PolicyTemplate> containing all results returned by the "listPolicyTemplates" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java deleted file mode 100644 index 2656f3fb790..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Previous.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Details with linking href to previous page of requested collection. - */ -public class Previous extends GenericModel { - - protected String href; - protected String start; - - protected Previous() { } - - /** - * Gets the href. - * - * The href linking to the page of requested collection. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the start. - * - * Page token that refers to the page of the collection. - * - * @return the start - */ - public String getStart() { - return start; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java deleted file mode 100644 index 151a77e8cb9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptions.java +++ /dev/null @@ -1,273 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replaceActionControlTemplate options. - */ -public class ReplaceActionControlTemplateOptions extends GenericModel { - - protected String actionControlTemplateId; - protected String version; - protected String ifMatch; - protected String name; - protected String description; - protected TemplateActionControl actionControl; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String actionControlTemplateId; - private String version; - private String ifMatch; - private String name; - private String description; - private TemplateActionControl actionControl; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing ReplaceActionControlTemplateOptions instance. - * - * @param replaceActionControlTemplateOptions the instance to initialize the Builder with - */ - private Builder(ReplaceActionControlTemplateOptions replaceActionControlTemplateOptions) { - this.actionControlTemplateId = replaceActionControlTemplateOptions.actionControlTemplateId; - this.version = replaceActionControlTemplateOptions.version; - this.ifMatch = replaceActionControlTemplateOptions.ifMatch; - this.name = replaceActionControlTemplateOptions.name; - this.description = replaceActionControlTemplateOptions.description; - this.actionControl = replaceActionControlTemplateOptions.actionControl; - this.committed = replaceActionControlTemplateOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param actionControlTemplateId the actionControlTemplateId - * @param version the version - * @param ifMatch the ifMatch - */ - public Builder(String actionControlTemplateId, String version, String ifMatch) { - this.actionControlTemplateId = actionControlTemplateId; - this.version = version; - this.ifMatch = ifMatch; - } - - /** - * Builds a ReplaceActionControlTemplateOptions. - * - * @return the new ReplaceActionControlTemplateOptions instance - */ - public ReplaceActionControlTemplateOptions build() { - return new ReplaceActionControlTemplateOptions(this); - } - - /** - * Set the actionControlTemplateId. - * - * @param actionControlTemplateId the actionControlTemplateId - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder actionControlTemplateId(String actionControlTemplateId) { - this.actionControlTemplateId = actionControlTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actionControl. - * - * @param actionControl the actionControl - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder actionControl(TemplateActionControl actionControl) { - this.actionControl = actionControl; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the ReplaceActionControlTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected ReplaceActionControlTemplateOptions() { } - - protected ReplaceActionControlTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.actionControlTemplateId, - "actionControlTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - actionControlTemplateId = builder.actionControlTemplateId; - version = builder.version; - ifMatch = builder.ifMatch; - name = builder.name; - description = builder.description; - actionControl = builder.actionControl; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a ReplaceActionControlTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the actionControlTemplateId. - * - * Action control template ID. - * - * @return the actionControlTemplateId - */ - public String actionControlTemplateId() { - return actionControlTemplateId; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating an action control template version must match the Etag value of the existing - * action control template version. The Etag can be retrieved using the GET - * /v1/action_control_templates/{template_id}/versions/{version} API and looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will - * change the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the action control template. This is shown to users in the enterprise account. Use this to describe - * the purpose or context of the action control for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actionControl. - * - * The action control properties that are created in an action resource when the template is assigned. - * - * @return the actionControl - */ - public TemplateActionControl actionControl() { - return actionControl; - } - - /** - * Gets the committed. - * - * Committed status of the template version. If committed is set to true, then the template version can no longer be - * updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java deleted file mode 100644 index 80cbe9e4c79..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptions.java +++ /dev/null @@ -1,335 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replacePolicy options. - */ -public class ReplacePolicyOptions extends GenericModel { - - protected String policyId; - protected String ifMatch; - protected String type; - protected List subjects; - protected List roles; - protected List resources; - protected String description; - - /** - * Builder. - */ - public static class Builder { - private String policyId; - private String ifMatch; - private String type; - private List subjects; - private List roles; - private List resources; - private String description; - - /** - * Instantiates a new Builder from an existing ReplacePolicyOptions instance. - * - * @param replacePolicyOptions the instance to initialize the Builder with - */ - private Builder(ReplacePolicyOptions replacePolicyOptions) { - this.policyId = replacePolicyOptions.policyId; - this.ifMatch = replacePolicyOptions.ifMatch; - this.type = replacePolicyOptions.type; - this.subjects = replacePolicyOptions.subjects; - this.roles = replacePolicyOptions.roles; - this.resources = replacePolicyOptions.resources; - this.description = replacePolicyOptions.description; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyId the policyId - * @param ifMatch the ifMatch - * @param type the type - * @param subjects the subjects - * @param roles the roles - * @param resources the resources - */ - public Builder(String policyId, String ifMatch, String type, List subjects, List roles, List resources) { - this.policyId = policyId; - this.ifMatch = ifMatch; - this.type = type; - this.subjects = subjects; - this.roles = roles; - this.resources = resources; - } - - /** - * Builds a ReplacePolicyOptions. - * - * @return the new ReplacePolicyOptions instance - */ - public ReplacePolicyOptions build() { - return new ReplacePolicyOptions(this); - } - - /** - * Adds a new element to subjects. - * - * @param subjects the new element to be added - * @return the ReplacePolicyOptions builder - */ - public Builder addSubjects(PolicySubject subjects) { - com.ibm.cloud.sdk.core.util.Validator.notNull(subjects, - "subjects cannot be null"); - if (this.subjects == null) { - this.subjects = new ArrayList(); - } - this.subjects.add(subjects); - return this; - } - - /** - * Adds a new element to roles. - * - * @param roles the new element to be added - * @return the ReplacePolicyOptions builder - */ - public Builder addRoles(PolicyRole roles) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roles, - "roles cannot be null"); - if (this.roles == null) { - this.roles = new ArrayList(); - } - this.roles.add(roles); - return this; - } - - /** - * Adds a new element to resources. - * - * @param resources the new element to be added - * @return the ReplacePolicyOptions builder - */ - public Builder addResources(PolicyResource resources) { - com.ibm.cloud.sdk.core.util.Validator.notNull(resources, - "resources cannot be null"); - if (this.resources == null) { - this.resources = new ArrayList(); - } - this.resources.add(resources); - return this; - } - - /** - * Set the policyId. - * - * @param policyId the policyId - * @return the ReplacePolicyOptions builder - */ - public Builder policyId(String policyId) { - this.policyId = policyId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplacePolicyOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the ReplacePolicyOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the subjects. - * Existing subjects will be replaced. - * - * @param subjects the subjects - * @return the ReplacePolicyOptions builder - */ - public Builder subjects(List subjects) { - this.subjects = subjects; - return this; - } - - /** - * Set the roles. - * Existing roles will be replaced. - * - * @param roles the roles - * @return the ReplacePolicyOptions builder - */ - public Builder roles(List roles) { - this.roles = roles; - return this; - } - - /** - * Set the resources. - * Existing resources will be replaced. - * - * @param resources the resources - * @return the ReplacePolicyOptions builder - */ - public Builder resources(List resources) { - this.resources = resources; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplacePolicyOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - } - - protected ReplacePolicyOptions() { } - - protected ReplacePolicyOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, - "policyId 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.type, - "type cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subjects, - "subjects cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, - "roles cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resources, - "resources cannot be null"); - policyId = builder.policyId; - ifMatch = builder.ifMatch; - type = builder.type; - subjects = builder.subjects; - roles = builder.roles; - resources = builder.resources; - description = builder.description; - } - - /** - * New builder. - * - * @return a ReplacePolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyId. - * - * The policy ID. - * - * @return the policyId - */ - public String policyId() { - return policyId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be - * retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the subjects. - * - * The subjects associated with a policy. - * - * @return the subjects - */ - public List subjects() { - return subjects; - } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List roles() { - return roles; - } - - /** - * Gets the resources. - * - * The resources associated with a policy. - * - * @return the resources - */ - public List resources() { - return resources; - } - - /** - * Gets the description. - * - * Customer-defined description. - * - * @return the description - */ - public String description() { - return description; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java deleted file mode 100644 index 5a55c4898e5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptions.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replacePolicyTemplate options. - */ -public class ReplacePolicyTemplateOptions extends GenericModel { - - protected String policyTemplateId; - protected String version; - protected String ifMatch; - protected TemplatePolicy policy; - protected String name; - protected String description; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String policyTemplateId; - private String version; - private String ifMatch; - private TemplatePolicy policy; - private String name; - private String description; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing ReplacePolicyTemplateOptions instance. - * - * @param replacePolicyTemplateOptions the instance to initialize the Builder with - */ - private Builder(ReplacePolicyTemplateOptions replacePolicyTemplateOptions) { - this.policyTemplateId = replacePolicyTemplateOptions.policyTemplateId; - this.version = replacePolicyTemplateOptions.version; - this.ifMatch = replacePolicyTemplateOptions.ifMatch; - this.policy = replacePolicyTemplateOptions.policy; - this.name = replacePolicyTemplateOptions.name; - this.description = replacePolicyTemplateOptions.description; - this.committed = replacePolicyTemplateOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyTemplateId the policyTemplateId - * @param version the version - * @param ifMatch the ifMatch - * @param policy the policy - */ - public Builder(String policyTemplateId, String version, String ifMatch, TemplatePolicy policy) { - this.policyTemplateId = policyTemplateId; - this.version = version; - this.ifMatch = ifMatch; - this.policy = policy; - } - - /** - * Builds a ReplacePolicyTemplateOptions. - * - * @return the new ReplacePolicyTemplateOptions instance - */ - public ReplacePolicyTemplateOptions build() { - return new ReplacePolicyTemplateOptions(this); - } - - /** - * Set the policyTemplateId. - * - * @param policyTemplateId the policyTemplateId - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder policyTemplateId(String policyTemplateId) { - this.policyTemplateId = policyTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the policy. - * - * @param policy the policy - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder policy(TemplatePolicy policy) { - this.policy = policy; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the ReplacePolicyTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected ReplacePolicyTemplateOptions() { } - - protected ReplacePolicyTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyTemplateId, - "policyTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version 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.policy, - "policy cannot be null"); - policyTemplateId = builder.policyTemplateId; - version = builder.version; - ifMatch = builder.ifMatch; - policy = builder.policy; - name = builder.name; - description = builder.description; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a ReplacePolicyTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyTemplateId. - * - * The policy template ID. - * - * @return the policyTemplateId - */ - public String policyTemplateId() { - return policyTemplateId; - } - - /** - * Gets the version. - * - * The policy template version. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy template version and must match the Etag value of the existing policy - * template version. The Etag can be retrieved using the GET - * /v1/policy_templates/{policy_template_id}/versions/{version} API and looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the policy. - * - * The core set of properties associated with the template's policy object. - * - * @return the policy - */ - public TemplatePolicy policy() { - return policy; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the policy template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the policy for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the committed. - * - * Committed status of the template version. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java deleted file mode 100644 index fc4b536103d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptions.java +++ /dev/null @@ -1,255 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replaceRole options. - */ -public class ReplaceRoleOptions extends GenericModel { - - protected String roleId; - protected String ifMatch; - protected String displayName; - protected List actions; - protected String description; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - private String ifMatch; - private String displayName; - private List actions; - private String description; - - /** - * Instantiates a new Builder from an existing ReplaceRoleOptions instance. - * - * @param replaceRoleOptions the instance to initialize the Builder with - */ - private Builder(ReplaceRoleOptions replaceRoleOptions) { - this.roleId = replaceRoleOptions.roleId; - this.ifMatch = replaceRoleOptions.ifMatch; - this.displayName = replaceRoleOptions.displayName; - this.actions = replaceRoleOptions.actions; - this.description = replaceRoleOptions.description; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - * @param ifMatch the ifMatch - * @param displayName the displayName - * @param actions the actions - */ - public Builder(String roleId, String ifMatch, String displayName, List actions) { - this.roleId = roleId; - this.ifMatch = ifMatch; - this.displayName = displayName; - this.actions = actions; - } - - /** - * Builds a ReplaceRoleOptions. - * - * @return the new ReplaceRoleOptions instance - */ - public ReplaceRoleOptions build() { - return new ReplaceRoleOptions(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the ReplaceRoleOptions builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the ReplaceRoleOptions builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplaceRoleOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the ReplaceRoleOptions builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the ReplaceRoleOptions builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplaceRoleOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the role. - * - * @param role the role - * @return the ReplaceRoleOptions builder - */ - public Builder role(Role role) { - this.displayName = role.displayName(); - this.actions = role.actions(); - this.description = role.description(); - return this; - } - } - - protected ReplaceRoleOptions() { } - - protected ReplaceRoleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleId, - "roleId 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.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - roleId = builder.roleId; - ifMatch = builder.ifMatch; - displayName = builder.displayName; - actions = builder.actions; - description = builder.description; - } - - /** - * New builder. - * - * @return a ReplaceRoleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role ID. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a role and must match the ETag value of the existing role. The Etag can be - * retrieved using the GET /v2/roles/{role_id} API and looking at the ETag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List actions() { - return actions; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String description() { - return description; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java deleted file mode 100644 index 9a69b13326c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptions.java +++ /dev/null @@ -1,273 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replaceRoleTemplate options. - */ -public class ReplaceRoleTemplateOptions extends GenericModel { - - protected String roleTemplateId; - protected String version; - protected String ifMatch; - protected String name; - protected String description; - protected TemplateRole role; - protected Boolean committed; - - /** - * Builder. - */ - public static class Builder { - private String roleTemplateId; - private String version; - private String ifMatch; - private String name; - private String description; - private TemplateRole role; - private Boolean committed; - - /** - * Instantiates a new Builder from an existing ReplaceRoleTemplateOptions instance. - * - * @param replaceRoleTemplateOptions the instance to initialize the Builder with - */ - private Builder(ReplaceRoleTemplateOptions replaceRoleTemplateOptions) { - this.roleTemplateId = replaceRoleTemplateOptions.roleTemplateId; - this.version = replaceRoleTemplateOptions.version; - this.ifMatch = replaceRoleTemplateOptions.ifMatch; - this.name = replaceRoleTemplateOptions.name; - this.description = replaceRoleTemplateOptions.description; - this.role = replaceRoleTemplateOptions.role; - this.committed = replaceRoleTemplateOptions.committed; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateId the roleTemplateId - * @param version the version - * @param ifMatch the ifMatch - */ - public Builder(String roleTemplateId, String version, String ifMatch) { - this.roleTemplateId = roleTemplateId; - this.version = version; - this.ifMatch = ifMatch; - } - - /** - * Builds a ReplaceRoleTemplateOptions. - * - * @return the new ReplaceRoleTemplateOptions instance - */ - public ReplaceRoleTemplateOptions build() { - return new ReplaceRoleTemplateOptions(this); - } - - /** - * Set the roleTemplateId. - * - * @param roleTemplateId the roleTemplateId - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder roleTemplateId(String roleTemplateId) { - this.roleTemplateId = roleTemplateId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the role. - * - * @param role the role - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder role(TemplateRole role) { - this.role = role; - return this; - } - - /** - * Set the committed. - * - * @param committed the committed - * @return the ReplaceRoleTemplateOptions builder - */ - public Builder committed(Boolean committed) { - this.committed = committed; - return this; - } - } - - protected ReplaceRoleTemplateOptions() { } - - protected ReplaceRoleTemplateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.roleTemplateId, - "roleTemplateId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.version, - "version cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - roleTemplateId = builder.roleTemplateId; - version = builder.version; - ifMatch = builder.ifMatch; - name = builder.name; - description = builder.description; - role = builder.role; - committed = builder.committed; - } - - /** - * New builder. - * - * @return a ReplaceRoleTemplateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleTemplateId. - * - * Role template ID. - * - * @return the roleTemplateId - */ - public String roleTemplateId() { - return roleTemplateId; - } - - /** - * Gets the version. - * - * Role template version. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a role template version must match the Etag value of the existing role template - * version. The Etag can be retrieved using the GET /v1/role_templates/{template_id}/versions/{version} API and - * looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it will - * change the name value for all existing versions of the template. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - * Description of the role template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the role for enterprise users managing IAM templates. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the role. - * - * The role properties that are created in an action resource when the template is assigned. - * - * @return the role - */ - public TemplateRole role() { - return role; - } - - /** - * Gets the committed. - * - * Committed status of the template version. If committed is set to true, then the template version can no longer be - * updated. - * - * @return the committed - */ - public Boolean committed() { - return committed; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java deleted file mode 100644 index 960f4782635..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptions.java +++ /dev/null @@ -1,336 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The replaceV2Policy options. - */ -public class ReplaceV2PolicyOptions extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - protected String id; - protected String ifMatch; - protected Control control; - protected String type; - protected String description; - protected V2PolicySubject subject; - protected V2PolicyResource resource; - protected String pattern; - protected V2PolicyRule rule; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String ifMatch; - private Control control; - private String type; - private String description; - private V2PolicySubject subject; - private V2PolicyResource resource; - private String pattern; - private V2PolicyRule rule; - - /** - * Instantiates a new Builder from an existing ReplaceV2PolicyOptions instance. - * - * @param replaceV2PolicyOptions the instance to initialize the Builder with - */ - private Builder(ReplaceV2PolicyOptions replaceV2PolicyOptions) { - this.id = replaceV2PolicyOptions.id; - this.ifMatch = replaceV2PolicyOptions.ifMatch; - this.control = replaceV2PolicyOptions.control; - this.type = replaceV2PolicyOptions.type; - this.description = replaceV2PolicyOptions.description; - this.subject = replaceV2PolicyOptions.subject; - this.resource = replaceV2PolicyOptions.resource; - this.pattern = replaceV2PolicyOptions.pattern; - this.rule = replaceV2PolicyOptions.rule; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param id the id - * @param ifMatch the ifMatch - * @param control the control - * @param type the type - */ - public Builder(String id, String ifMatch, Control control, String type) { - this.id = id; - this.ifMatch = ifMatch; - this.control = control; - this.type = type; - } - - /** - * Builds a ReplaceV2PolicyOptions. - * - * @return the new ReplaceV2PolicyOptions instance - */ - public ReplaceV2PolicyOptions build() { - return new ReplaceV2PolicyOptions(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the ReplaceV2PolicyOptions builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the ReplaceV2PolicyOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the control. - * - * @param control the control - * @return the ReplaceV2PolicyOptions builder - */ - public Builder control(Control control) { - this.control = control; - return this; - } - - /** - * Set the type. - * - * @param type the type - * @return the ReplaceV2PolicyOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the ReplaceV2PolicyOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the subject. - * - * @param subject the subject - * @return the ReplaceV2PolicyOptions builder - */ - public Builder subject(V2PolicySubject subject) { - this.subject = subject; - return this; - } - - /** - * Set the resource. - * - * @param resource the resource - * @return the ReplaceV2PolicyOptions builder - */ - public Builder resource(V2PolicyResource resource) { - this.resource = resource; - return this; - } - - /** - * Set the pattern. - * - * @param pattern the pattern - * @return the ReplaceV2PolicyOptions builder - */ - public Builder pattern(String pattern) { - this.pattern = pattern; - return this; - } - - /** - * Set the rule. - * - * @param rule the rule - * @return the ReplaceV2PolicyOptions builder - */ - public Builder rule(V2PolicyRule rule) { - this.rule = rule; - return this; - } - } - - protected ReplaceV2PolicyOptions() { } - - protected ReplaceV2PolicyOptions(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.control, - "control cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - id = builder.id; - ifMatch = builder.ifMatch; - control = builder.control; - type = builder.type; - description = builder.description; - subject = builder.subject; - resource = builder.resource; - pattern = builder.pattern; - rule = builder.rule; - } - - /** - * New builder. - * - * @return a ReplaceV2PolicyOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be - * retrieved using the GET /v2/policies/{id} API and looking at the ETag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the control. - * - * Specifies the type of access that is granted by the policy. - * - * @return the control - */ - public Control control() { - return control; - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject subject() { - return subject; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource resource() { - return resource; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String pattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule rule() { - return rule; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java deleted file mode 100644 index 3a8b7e87b9e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttribute.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * An attribute associated with a resource. - */ -public class ResourceAttribute extends GenericModel { - - protected String name; - protected String value; - protected String operator; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String value; - private String operator; - - /** - * Instantiates a new Builder from an existing ResourceAttribute instance. - * - * @param resourceAttribute the instance to initialize the Builder with - */ - private Builder(ResourceAttribute resourceAttribute) { - this.name = resourceAttribute.name; - this.value = resourceAttribute.value; - this.operator = resourceAttribute.operator; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param value the value - */ - public Builder(String name, String value) { - this.name = name; - this.value = value; - } - - /** - * Builds a ResourceAttribute. - * - * @return the new ResourceAttribute instance - */ - public ResourceAttribute build() { - return new ResourceAttribute(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the ResourceAttribute builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the ResourceAttribute builder - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the ResourceAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - } - - protected ResourceAttribute() { } - - protected ResourceAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - name = builder.name; - value = builder.value; - operator = builder.operator; - } - - /** - * New builder. - * - * @return a ResourceAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * The name of an attribute. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the value. - * - * The value of an attribute. - * - * @return the value - */ - public String value() { - return value; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java deleted file mode 100644 index 7da4cffee56..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTag.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A tag associated with a resource. - */ -public class ResourceTag extends GenericModel { - - protected String name; - protected String value; - protected String operator; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String value; - private String operator; - - /** - * Instantiates a new Builder from an existing ResourceTag instance. - * - * @param resourceTag the instance to initialize the Builder with - */ - private Builder(ResourceTag resourceTag) { - this.name = resourceTag.name; - this.value = resourceTag.value; - this.operator = resourceTag.operator; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param value the value - */ - public Builder(String name, String value) { - this.name = name; - this.value = value; - } - - /** - * Builds a ResourceTag. - * - * @return the new ResourceTag instance - */ - public ResourceTag build() { - return new ResourceTag(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the ResourceTag builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the ResourceTag builder - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the ResourceTag builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - } - - protected ResourceTag() { } - - protected ResourceTag(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - name = builder.name; - value = builder.value; - operator = builder.operator; - } - - /** - * New builder. - * - * @return a ResourceTag builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * The name of an access management tag. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the value. - * - * The value of an access management tag. - * - * @return the value - */ - public String value() { - return value; - } - - /** - * Gets the operator. - * - * The operator of an access management tag. - * - * @return the operator - */ - public String operator() { - return operator; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java deleted file mode 100644 index 24b99c9bd08..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Role.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role resource. - */ -public class Role extends GenericModel { - - @SerializedName("display_name") - protected String displayName; - protected String description; - protected List actions; - protected String crn; - - /** - * Builder. - */ - public static class Builder { - private String displayName; - private String description; - private List actions; - - /** - * Instantiates a new Builder from an existing Role instance. - * - * @param role the instance to initialize the Builder with - */ - private Builder(Role role) { - this.displayName = role.displayName; - this.description = role.description; - this.actions = role.actions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param displayName the displayName - * @param actions the actions - */ - public Builder(String displayName, List actions) { - this.displayName = displayName; - this.actions = actions; - } - - /** - * Builds a Role. - * - * @return the new Role instance - */ - public Role build() { - return new Role(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the Role builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the Role builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the Role builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the Role builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - } - - protected Role() { } - - protected Role(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - displayName = builder.displayName; - description = builder.description; - actions = builder.actions; - } - - /** - * New builder. - * - * @return a Role builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the description. - * - * The description of the role. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. For more information, see [IAM roles and - * actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). - * - * @return the actions - */ - public List actions() { - return actions; - } - - /** - * Gets the crn. - * - * The role Cloud Resource Name (CRN). Example CRN: - * 'crn:v1:ibmcloud:public:iam-access-management::a/exampleAccountId::customRole:ExampleRoleName'. - * - * @return the crn - */ - public String crn() { - return crn; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java deleted file mode 100644 index 9169fc88572..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAction.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * An action that can be performed by the policy subject when assigned a role. - */ -public class RoleAction extends GenericModel { - - protected String id; - @SerializedName("display_name") - protected String displayName; - protected String description; - - protected RoleAction() { } - - /** - * Gets the id. - * - * Unique identifier for action with structure service.resource.action. For example, cbr.rule.read. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the displayName. - * - * Services defined display name for action. - * - * @return the displayName - */ - public String getDisplayName() { - return displayName; - } - - /** - * Gets the description. - * - * Service defined description for action. - * - * @return the description - */ - public String getDescription() { - return description; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java deleted file mode 100644 index 23bb4b65c6f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignment.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the assigned role template. - */ -public class RoleAssignment extends GenericModel { - - /** - * The current operation of the role assignment. - */ - public interface Operation { - /** create. */ - String CREATE = "create"; - /** apply. */ - String APPLY = "apply"; - /** update. */ - String UPDATE = "update"; - /** remove. */ - String REMOVE = "remove"; - } - - /** - * The role assignment status. - */ - public interface Status { - /** accepted. */ - String ACCEPTED = "accepted"; - /** failure. */ - String FAILURE = "failure"; - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** superseded. */ - String SUPERSEDED = "superseded"; - } - - protected String id; - @SerializedName("account_id") - protected String accountId; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String operation; - protected List resources; - protected RoleAssignmentTemplate template; - protected AssignmentTargetDetails target; - protected String status; - - protected RoleAssignment() { } - - /** - * Gets the id. - * - * Action control assignment ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the accountId. - * - * The account GUID that the role assignments belong to. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the href. - * - * The href URL that links to the role assignments API by role assignment ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the role assignment was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the role assignment. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the role assignment was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the role assignment. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the operation. - * - * The current operation of the role assignment. - * - * @return the operation - */ - public String getOperation() { - return operation; - } - - /** - * Gets the resources. - * - * Resources created when role template is assigned. - * - * @return the resources - */ - public List getResources() { - return resources; - } - - /** - * Gets the template. - * - * The role template id and version that will be assigned. - * - * @return the template - */ - public RoleAssignmentTemplate getTemplate() { - return template; - } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the status. - * - * The role assignment status. - * - * @return the status - */ - public String getStatus() { - return status; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java deleted file mode 100644 index 658ac5b8c99..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of role assignments. - */ -public class RoleAssignmentCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List assignments; - - protected RoleAssignmentCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the assignments. - * - * List of role assignments. - * - * @return the assignments - */ - public List getAssignments() { - return assignments; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java deleted file mode 100644 index 60d7a02d604..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResource.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The role assignment resources and target where the template is assigned. - */ -public class RoleAssignmentResource extends GenericModel { - - protected AssignmentTargetDetails target; - protected RoleAssignmentResourceRole role; - - protected RoleAssignmentResource() { } - - /** - * Gets the target. - * - * assignment target account and type. - * - * @return the target - */ - public AssignmentTargetDetails getTarget() { - return target; - } - - /** - * Gets the role. - * - * Set of properties of the assigned resource or error message if assignment failed. - * - * @return the role - */ - public RoleAssignmentResourceRole getRole() { - return role; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java deleted file mode 100644 index 9ea359d63fb..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreated.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * On success, it includes the role assigned. - */ -public class RoleAssignmentResourceCreated extends GenericModel { - - protected String id; - - protected RoleAssignmentResourceCreated() { } - - /** - * Gets the id. - * - * role id. - * - * @return the id - */ - public String getId() { - return id; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java deleted file mode 100644 index 22d40bdaef4..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRole.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Set of properties of the assigned resource or error message if assignment failed. - */ -public class RoleAssignmentResourceRole extends GenericModel { - - @SerializedName("resource_created") - protected RoleAssignmentResourceCreated resourceCreated; - @SerializedName("error_message") - protected AssignmentResourceError errorMessage; - - protected RoleAssignmentResourceRole() { } - - /** - * Gets the resourceCreated. - * - * On success, it includes the role assigned. - * - * @return the resourceCreated - */ - public RoleAssignmentResourceCreated getResourceCreated() { - return resourceCreated; - } - - /** - * Gets the errorMessage. - * - * Body parameters for assignment error. - * - * @return the errorMessage - */ - public AssignmentResourceError getErrorMessage() { - return errorMessage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java deleted file mode 100644 index 3524b91f4d5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplate.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The role template id and version that will be assigned. - */ -public class RoleAssignmentTemplate extends GenericModel { - - protected String id; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String version; - - /** - * Instantiates a new Builder from an existing RoleAssignmentTemplate instance. - * - * @param roleAssignmentTemplate the instance to initialize the Builder with - */ - private Builder(RoleAssignmentTemplate roleAssignmentTemplate) { - this.id = roleAssignmentTemplate.id; - this.version = roleAssignmentTemplate.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param id the id - * @param version the version - */ - public Builder(String id, String version) { - this.id = id; - this.version = version; - } - - /** - * Builds a RoleAssignmentTemplate. - * - * @return the new RoleAssignmentTemplate instance - */ - public RoleAssignmentTemplate build() { - return new RoleAssignmentTemplate(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the RoleAssignmentTemplate builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the RoleAssignmentTemplate builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected RoleAssignmentTemplate() { } - - protected RoleAssignmentTemplate(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - id = builder.id; - version = builder.version; - } - - /** - * New builder. - * - * @return a RoleAssignmentTemplate builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * Action control template ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the version. - * - * Action control template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java deleted file mode 100644 index 16296a82e40..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * RoleAssignmentsPager can be used to simplify the use of the "listRoleAssignments" method. - */ -public class RoleAssignmentsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListRoleAssignmentsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected RoleAssignmentsPager() { } - - /** - * Constructs a new RoleAssignmentsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listRoleAssignments" method - * @param options the ListRoleAssignmentsOptions instance to be used to invoke the "listRoleAssignments" method - */ - public RoleAssignmentsPager(IamPolicyManagement client, ListRoleAssignmentsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<RoleAssignment> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListRoleAssignmentsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - RoleAssignmentCollection result = client.listRoleAssignments(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getAssignments(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<RoleAssignment> containing all results returned by the "listRoleAssignments" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java deleted file mode 100644 index 282730a2dfc..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollection.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of roles returned by the 'list roles' operation. - */ -public class RoleCollection extends GenericModel { - - @SerializedName("custom_roles") - protected List customRoles; - @SerializedName("service_roles") - protected List serviceRoles; - @SerializedName("system_roles") - protected List systemRoles; - - protected RoleCollection() { } - - /** - * Gets the customRoles. - * - * List of custom roles. - * - * @return the customRoles - */ - public List getCustomRoles() { - return customRoles; - } - - /** - * Gets the serviceRoles. - * - * List of service roles. - * - * @return the serviceRoles - */ - public List getServiceRoles() { - return serviceRoles; - } - - /** - * Gets the systemRoles. - * - * List of system roles. - * - * @return the systemRoles - */ - public List getSystemRoles() { - return systemRoles; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java deleted file mode 100644 index 663d0f7f1d0..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplate.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The set of properties associated with the role template. - */ -public class RoleTemplate extends GenericModel { - - /** - * State of role template. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String name; - protected String description; - @SerializedName("account_id") - protected String accountId; - protected Boolean committed; - protected RoleTemplatePrototypeRole role; - protected String id; - protected String href; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String version; - protected String state; - - protected RoleTemplate() { } - - /** - * Gets the name. - * - * Required field when creating a new template. Otherwise, this field is optional. If the field is included, it - * changes the name value for all existing versions of the template. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the description. - * - * Description of the role template. This is shown to users in the enterprise account. Use this to describe the - * purpose or context of the role for enterprise users managing IAM templates. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the accountId. - * - * Enterprise account ID where this template is created. - * - * @return the accountId - */ - public String getAccountId() { - return accountId; - } - - /** - * Gets the committed. - * - * Committed status of the template. If committed is set to true, then the template version can no longer be updated. - * - * @return the committed - */ - public Boolean isCommitted() { - return committed; - } - - /** - * Gets the role. - * - * The role properties that are created in an action resource when the template is assigned. - * - * @return the role - */ - public RoleTemplatePrototypeRole getRole() { - return role; - } - - /** - * Gets the id. - * - * The role template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the role templates API by role template ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the role template was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the role template. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the role template was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the role template. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the version. - * - * The version number of the template used to identify different versions of same template. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the state. - * - * State of role template. - * - * @return the state - */ - public String getState() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java deleted file mode 100644 index 22a739b4a58..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollection.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of role templates. - */ -public class RoleTemplateCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - @SerializedName("role_templates") - protected List roleTemplates; - - protected RoleTemplateCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the roleTemplates. - * - * List of role templates. - * - * @return the roleTemplates - */ - public List getRoleTemplates() { - return roleTemplates; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java deleted file mode 100644 index 43197620689..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRole.java +++ /dev/null @@ -1,239 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The role properties that are created in an action resource when the template is assigned. - */ -public class RoleTemplatePrototypeRole extends GenericModel { - - protected String name; - @SerializedName("display_name") - protected String displayName; - @SerializedName("service_name") - protected String serviceName; - protected String description; - protected List actions; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String displayName; - private String serviceName; - private String description; - private List actions; - - /** - * Instantiates a new Builder from an existing RoleTemplatePrototypeRole instance. - * - * @param roleTemplatePrototypeRole the instance to initialize the Builder with - */ - private Builder(RoleTemplatePrototypeRole roleTemplatePrototypeRole) { - this.name = roleTemplatePrototypeRole.name; - this.displayName = roleTemplatePrototypeRole.displayName; - this.serviceName = roleTemplatePrototypeRole.serviceName; - this.description = roleTemplatePrototypeRole.description; - this.actions = roleTemplatePrototypeRole.actions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param displayName the displayName - * @param actions the actions - */ - public Builder(String name, String displayName, List actions) { - this.name = name; - this.displayName = displayName; - this.actions = actions; - } - - /** - * Builds a RoleTemplatePrototypeRole. - * - * @return the new RoleTemplatePrototypeRole instance - */ - public RoleTemplatePrototypeRole build() { - return new RoleTemplatePrototypeRole(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the RoleTemplatePrototypeRole builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the RoleTemplatePrototypeRole builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the RoleTemplatePrototypeRole builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the RoleTemplatePrototypeRole builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the RoleTemplatePrototypeRole builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the RoleTemplatePrototypeRole builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - } - - protected RoleTemplatePrototypeRole() { } - - protected RoleTemplatePrototypeRole(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - name = builder.name; - displayName = builder.displayName; - serviceName = builder.serviceName; - description = builder.description; - actions = builder.actions; - } - - /** - * New builder. - * - * @return a RoleTemplatePrototypeRole builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * The name of the role that is used in the CRN. This must be alphanumeric and capitalized. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the serviceName. - * - * The service name that the role refers. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the description. - * - * Description of the role. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. - * - * @return the actions - */ - public List actions() { - return actions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java deleted file mode 100644 index 673ff7f9750..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItem.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role template reference associated with a policy template. - */ -public class RoleTemplateReferencesItem extends GenericModel { - - protected String id; - protected String version; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String version; - - /** - * Instantiates a new Builder from an existing RoleTemplateReferencesItem instance. - * - * @param roleTemplateReferencesItem the instance to initialize the Builder with - */ - private Builder(RoleTemplateReferencesItem roleTemplateReferencesItem) { - this.id = roleTemplateReferencesItem.id; - this.version = roleTemplateReferencesItem.version; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param id the id - * @param version the version - */ - public Builder(String id, String version) { - this.id = id; - this.version = version; - } - - /** - * Builds a RoleTemplateReferencesItem. - * - * @return the new RoleTemplateReferencesItem instance - */ - public RoleTemplateReferencesItem build() { - return new RoleTemplateReferencesItem(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the RoleTemplateReferencesItem builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the RoleTemplateReferencesItem builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - } - - protected RoleTemplateReferencesItem() { } - - protected RoleTemplateReferencesItem(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - id = builder.id; - version = builder.version; - } - - /** - * New builder. - * - * @return a RoleTemplateReferencesItem builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * The role template ID. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the version. - * - * Role template version. - * - * @return the version - */ - public String version() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java deleted file mode 100644 index a983208afe3..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of versions for a specific role template. - */ -public class RoleTemplateVersionsCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List versions; - - protected RoleTemplateVersionsCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the versions. - * - * List of role templates versions. - * - * @return the versions - */ - public List getVersions() { - return versions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java deleted file mode 100644 index 7af200cd72f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * RoleTemplateVersionsPager can be used to simplify the use of the "listRoleTemplateVersions" method. - */ -public class RoleTemplateVersionsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListRoleTemplateVersionsOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected RoleTemplateVersionsPager() { } - - /** - * Constructs a new RoleTemplateVersionsPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listRoleTemplateVersions" method - * @param options the ListRoleTemplateVersionsOptions instance to be used to invoke the "listRoleTemplateVersions" method - */ - public RoleTemplateVersionsPager(IamPolicyManagement client, ListRoleTemplateVersionsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<RoleTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListRoleTemplateVersionsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - RoleTemplateVersionsCollection result = client.listRoleTemplateVersions(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getVersions(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<RoleTemplate> containing all results returned by the "listRoleTemplateVersions" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java deleted file mode 100644 index 3654e0757ba..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * RoleTemplatesPager can be used to simplify the use of the "listRoleTemplates" method. - */ -public class RoleTemplatesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListRoleTemplatesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected RoleTemplatesPager() { } - - /** - * Constructs a new RoleTemplatesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listRoleTemplates" method - * @param options the ListRoleTemplatesOptions instance to be used to invoke the "listRoleTemplates" method - */ - public RoleTemplatesPager(IamPolicyManagement client, ListRoleTemplatesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<RoleTemplate> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListRoleTemplatesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - RoleTemplateCollection result = client.listRoleTemplates(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getRoleTemplates(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<RoleTemplate> containing all results returned by the "listRoleTemplates" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java deleted file mode 100644 index 03b6ff75eb1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/Roles.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A role associated with a policy. - */ -public class Roles extends GenericModel { - - @SerializedName("role_id") - protected String roleId; - - /** - * Builder. - */ - public static class Builder { - private String roleId; - - /** - * Instantiates a new Builder from an existing Roles instance. - * - * @param roles the instance to initialize the Builder with - */ - private Builder(Roles roles) { - this.roleId = roles.roleId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleId the roleId - */ - public Builder(String roleId) { - this.roleId = roleId; - } - - /** - * Builds a Roles. - * - * @return the new Roles instance - */ - public Roles build() { - return new Roles(this); - } - - /** - * Set the roleId. - * - * @param roleId the roleId - * @return the Roles builder - */ - public Builder roleId(String roleId) { - this.roleId = roleId; - return this; - } - } - - protected Roles() { } - - protected Roles(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleId, - "roleId cannot be null"); - roleId = builder.roleId; - } - - /** - * New builder. - * - * @return a Roles builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the roleId. - * - * The role Cloud Resource Name (CRN) granted by the policy. Example CRN: 'crn:v1:bluemix:public:iam::::role:Editor'. - * - * @return the roleId - */ - public String roleId() { - return roleId; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java deleted file mode 100644 index fbf66d53ae1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttribute.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Rule that specifies additional access that is granted (For example, time-based condition). - */ -public class RuleAttribute extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - protected String key; - protected String operator; - protected Object value; - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing RuleAttribute instance. - * - * @param ruleAttribute the instance to initialize the Builder with - */ - private Builder(RuleAttribute ruleAttribute) { - this.key = ruleAttribute.key; - this.operator = ruleAttribute.operator; - this.value = ruleAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a RuleAttribute. - * - * @return the new RuleAttribute instance - */ - public RuleAttribute build() { - return new RuleAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the RuleAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the RuleAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the RuleAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected RuleAttribute() { } - - protected RuleAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a RuleAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the key. - * - * The name of an attribute. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java deleted file mode 100644 index d7e54e112c5..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttribute.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * An attribute associated with a subject. - */ -public class SubjectAttribute extends GenericModel { - - protected String name; - protected String value; - - /** - * Builder. - */ - public static class Builder { - private String name; - private String value; - - /** - * Instantiates a new Builder from an existing SubjectAttribute instance. - * - * @param subjectAttribute the instance to initialize the Builder with - */ - private Builder(SubjectAttribute subjectAttribute) { - this.name = subjectAttribute.name; - this.value = subjectAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - * @param value the value - */ - public Builder(String name, String value) { - this.name = name; - this.value = value; - } - - /** - * Builds a SubjectAttribute. - * - * @return the new SubjectAttribute instance - */ - public SubjectAttribute build() { - return new SubjectAttribute(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the SubjectAttribute builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the SubjectAttribute builder - */ - public Builder value(String value) { - this.value = value; - return this; - } - } - - protected SubjectAttribute() { } - - protected SubjectAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - name = builder.name; - value = builder.value; - } - - /** - * New builder. - * - * @return a SubjectAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - * The name of an attribute. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the value. - * - * The value of an attribute. - * - * @return the value - */ - public String value() { - return value; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java deleted file mode 100644 index 62f4bd77f87..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControl.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The action control properties that are created in an action resource when the template is assigned. - */ -public class TemplateActionControl extends GenericModel { - - @SerializedName("service_name") - protected String serviceName; - protected String description; - protected List actions; - - /** - * Builder. - */ - public static class Builder { - private String serviceName; - private String description; - private List actions; - - /** - * Instantiates a new Builder from an existing TemplateActionControl instance. - * - * @param templateActionControl the instance to initialize the Builder with - */ - private Builder(TemplateActionControl templateActionControl) { - this.serviceName = templateActionControl.serviceName; - this.description = templateActionControl.description; - this.actions = templateActionControl.actions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param serviceName the serviceName - * @param actions the actions - */ - public Builder(String serviceName, List actions) { - this.serviceName = serviceName; - this.actions = actions; - } - - /** - * Builds a TemplateActionControl. - * - * @return the new TemplateActionControl instance - */ - public TemplateActionControl build() { - return new TemplateActionControl(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the TemplateActionControl builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the TemplateActionControl builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the TemplateActionControl builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the TemplateActionControl builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - } - - protected TemplateActionControl() { } - - protected TemplateActionControl(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, - "serviceName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - serviceName = builder.serviceName; - description = builder.description; - actions = builder.actions; - } - - /** - * New builder. - * - * @return a TemplateActionControl builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the serviceName. - * - * The service name that the action control refers. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the description. - * - * Description of the action control. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actions. - * - * List of actions to control access. - * - * @return the actions - */ - public List actions() { - return actions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java deleted file mode 100644 index c74a77d9b6d..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControl.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Specifies the type of access that is granted by the policy. - */ -public class TemplateControl extends GenericModel { - - protected TemplateGrant grant; - - /** - * Builder. - */ - public static class Builder { - private TemplateGrant grant; - - /** - * Instantiates a new Builder from an existing TemplateControl instance. - * - * @param templateControl the instance to initialize the Builder with - */ - private Builder(TemplateControl templateControl) { - this.grant = templateControl.grant; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param grant the grant - */ - public Builder(TemplateGrant grant) { - this.grant = grant; - } - - /** - * Builds a TemplateControl. - * - * @return the new TemplateControl instance - */ - public TemplateControl build() { - return new TemplateControl(this); - } - - /** - * Set the grant. - * - * @param grant the grant - * @return the TemplateControl builder - */ - public Builder grant(TemplateGrant grant) { - this.grant = grant; - return this; - } - } - - protected TemplateControl() { } - - protected TemplateControl(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.grant, - "grant cannot be null"); - grant = builder.grant; - } - - /** - * New builder. - * - * @return a TemplateControl builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the grant. - * - * Permission is granted by the policy. - * - * @return the grant - */ - public TemplateGrant grant() { - return grant; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java deleted file mode 100644 index edb134e1270..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountData.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * policy template count details. - */ -public class TemplateCountData extends GenericModel { - - protected LimitData template; - protected LimitData version; - - protected TemplateCountData() { } - - /** - * Gets the template. - * - * policy template current and limit details with in an account. - * - * @return the template - */ - public LimitData getTemplate() { - return template; - } - - /** - * Gets the version. - * - * policy template current and limit details with in an account. - * - * @return the version - */ - public LimitData getVersion() { - return version; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java deleted file mode 100644 index fd0daff9665..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrant.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Permission is granted by the policy. - * - * Classes which extend this class: - * - TemplateGrantRoles - * - TemplateGrantRoleReferences - */ -public class TemplateGrant extends GenericModel { - - protected List roles; - @SerializedName("role_template_references") - protected List roleTemplateReferences; - - protected TemplateGrant() { } - - /** - * Gets the roles. - * - * A set of role Cloud Resource Names (CRNs) granted by the policy. - * - * @return the roles - */ - public List roles() { - return roles; - } - - /** - * Gets the roleTemplateReferences. - * - * A set of role template reference IDs granted by the policy. - * - * @return the roleTemplateReferences - */ - public List roleTemplateReferences() { - return roleTemplateReferences; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java deleted file mode 100644 index 248eb121b72..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferences.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * TemplateGrantRoleReferences. - */ -public class TemplateGrantRoleReferences extends TemplateGrant { - - - /** - * Builder. - */ - public static class Builder { - private List roleTemplateReferences; - - /** - * Instantiates a new Builder from an existing TemplateGrantRoleReferences instance. - * - * @param templateGrantRoleReferences the instance to initialize the Builder with - */ - public Builder(TemplateGrant templateGrantRoleReferences) { - this.roleTemplateReferences = templateGrantRoleReferences.roleTemplateReferences; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roleTemplateReferences the roleTemplateReferences - */ - public Builder(List roleTemplateReferences) { - this.roleTemplateReferences = roleTemplateReferences; - } - - /** - * Builds a TemplateGrantRoleReferences. - * - * @return the new TemplateGrantRoleReferences instance - */ - public TemplateGrantRoleReferences build() { - return new TemplateGrantRoleReferences(this); - } - - /** - * Adds a new element to roleTemplateReferences. - * - * @param roleTemplateReferences the new element to be added - * @return the TemplateGrantRoleReferences builder - */ - public Builder addRoleTemplateReferences(RoleTemplateReferencesItem roleTemplateReferences) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roleTemplateReferences, - "roleTemplateReferences cannot be null"); - if (this.roleTemplateReferences == null) { - this.roleTemplateReferences = new ArrayList(); - } - this.roleTemplateReferences.add(roleTemplateReferences); - return this; - } - - /** - * Set the roleTemplateReferences. - * Existing roleTemplateReferences will be replaced. - * - * @param roleTemplateReferences the roleTemplateReferences - * @return the TemplateGrantRoleReferences builder - */ - public Builder roleTemplateReferences(List roleTemplateReferences) { - this.roleTemplateReferences = roleTemplateReferences; - return this; - } - } - - protected TemplateGrantRoleReferences() { } - - protected TemplateGrantRoleReferences(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roleTemplateReferences, - "roleTemplateReferences cannot be null"); - roleTemplateReferences = builder.roleTemplateReferences; - } - - /** - * New builder. - * - * @return a TemplateGrantRoleReferences builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java deleted file mode 100644 index 6524b3645eb..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoles.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * TemplateGrantRoles. - */ -public class TemplateGrantRoles extends TemplateGrant { - - - /** - * Builder. - */ - public static class Builder { - private List roles; - - /** - * Instantiates a new Builder from an existing TemplateGrantRoles instance. - * - * @param templateGrantRoles the instance to initialize the Builder with - */ - public Builder(TemplateGrant templateGrantRoles) { - this.roles = templateGrantRoles.roles; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param roles the roles - */ - public Builder(List roles) { - this.roles = roles; - } - - /** - * Builds a TemplateGrantRoles. - * - * @return the new TemplateGrantRoles instance - */ - public TemplateGrantRoles build() { - return new TemplateGrantRoles(this); - } - - /** - * Adds a new element to roles. - * - * @param roles the new element to be added - * @return the TemplateGrantRoles builder - */ - public Builder addRoles(Roles roles) { - com.ibm.cloud.sdk.core.util.Validator.notNull(roles, - "roles cannot be null"); - if (this.roles == null) { - this.roles = new ArrayList(); - } - this.roles.add(roles); - return this; - } - - /** - * Set the roles. - * Existing roles will be replaced. - * - * @param roles the roles - * @return the TemplateGrantRoles builder - */ - public Builder roles(List roles) { - this.roles = roles; - return this; - } - } - - protected TemplateGrantRoles() { } - - protected TemplateGrantRoles(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.roles, - "roles cannot be null"); - roles = builder.roles; - } - - /** - * New builder. - * - * @return a TemplateGrantRoles builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java deleted file mode 100644 index 41f112312cd..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadata.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The details of the IAM template that was used to create an enterprise-managed policy in your account. When returned, - * this indicates that the policy is created from and managed by a template in the root enterprise account. - */ -public class TemplateMetadata extends GenericModel { - - protected String id; - protected String version; - @SerializedName("assignment_id") - protected String assignmentId; - @SerializedName("root_id") - protected String rootId; - @SerializedName("root_version") - protected String rootVersion; - - protected TemplateMetadata() { } - - /** - * Gets the id. - * - * The policy template ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the version. - * - * Template version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Gets the assignmentId. - * - * Policy assignment ID. - * - * @return the assignmentId - */ - public String getAssignmentId() { - return assignmentId; - } - - /** - * Gets the rootId. - * - * Orchestrator template ID. - * - * @return the rootId - */ - public String getRootId() { - return rootId; - } - - /** - * Gets the rootVersion. - * - * Orchestrator template version. - * - * @return the rootVersion - */ - public String getRootVersion() { - return rootVersion; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java deleted file mode 100644 index 496b2e70e40..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicy.java +++ /dev/null @@ -1,272 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the template's policy object. - */ -public class TemplatePolicy extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - protected String type; - protected String description; - protected V2PolicyResource resource; - protected V2PolicySubject subject; - protected String pattern; - protected V2PolicyRule rule; - protected TemplateControl control; - - /** - * Builder. - */ - public static class Builder { - private String type; - private String description; - private V2PolicyResource resource; - private V2PolicySubject subject; - private String pattern; - private V2PolicyRule rule; - private TemplateControl control; - - /** - * Instantiates a new Builder from an existing TemplatePolicy instance. - * - * @param templatePolicy the instance to initialize the Builder with - */ - private Builder(TemplatePolicy templatePolicy) { - this.type = templatePolicy.type; - this.description = templatePolicy.description; - this.resource = templatePolicy.resource; - this.subject = templatePolicy.subject; - this.pattern = templatePolicy.pattern; - this.rule = templatePolicy.rule; - this.control = templatePolicy.control; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param type the type - */ - public Builder(String type) { - this.type = type; - } - - /** - * Builds a TemplatePolicy. - * - * @return the new TemplatePolicy instance - */ - public TemplatePolicy build() { - return new TemplatePolicy(this); - } - - /** - * Set the type. - * - * @param type the type - * @return the TemplatePolicy builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the TemplatePolicy builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the resource. - * - * @param resource the resource - * @return the TemplatePolicy builder - */ - public Builder resource(V2PolicyResource resource) { - this.resource = resource; - return this; - } - - /** - * Set the subject. - * - * @param subject the subject - * @return the TemplatePolicy builder - */ - public Builder subject(V2PolicySubject subject) { - this.subject = subject; - return this; - } - - /** - * Set the pattern. - * - * @param pattern the pattern - * @return the TemplatePolicy builder - */ - public Builder pattern(String pattern) { - this.pattern = pattern; - return this; - } - - /** - * Set the rule. - * - * @param rule the rule - * @return the TemplatePolicy builder - */ - public Builder rule(V2PolicyRule rule) { - this.rule = rule; - return this; - } - - /** - * Set the control. - * - * @param control the control - * @return the TemplatePolicy builder - */ - public Builder control(TemplateControl control) { - this.control = control; - return this; - } - } - - protected TemplatePolicy() { } - - protected TemplatePolicy(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, - "type cannot be null"); - type = builder.type; - description = builder.description; - resource = builder.resource; - subject = builder.subject; - pattern = builder.pattern; - rule = builder.rule; - control = builder.control; - } - - /** - * New builder. - * - * @return a TemplatePolicy builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. This is shown in child accounts when an access group or trusted profile template uses - * the policy template to assign access. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource resource() { - return resource; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject subject() { - return subject; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String pattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule rule() { - return rule; - } - - /** - * Gets the control. - * - * Specifies the type of access that is granted by the policy. - * - * @return the control - */ - public TemplateControl control() { - return control; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java deleted file mode 100644 index b76beb3bddb..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRole.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The role properties that are created in an action resource when the template is assigned. - */ -public class TemplateRole extends GenericModel { - - @SerializedName("display_name") - protected String displayName; - @SerializedName("service_name") - protected String serviceName; - protected String description; - protected List actions; - - /** - * Builder. - */ - public static class Builder { - private String displayName; - private String serviceName; - private String description; - private List actions; - - /** - * Instantiates a new Builder from an existing TemplateRole instance. - * - * @param templateRole the instance to initialize the Builder with - */ - private Builder(TemplateRole templateRole) { - this.displayName = templateRole.displayName; - this.serviceName = templateRole.serviceName; - this.description = templateRole.description; - this.actions = templateRole.actions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param displayName the displayName - * @param actions the actions - */ - public Builder(String displayName, List actions) { - this.displayName = displayName; - this.actions = actions; - } - - /** - * Builds a TemplateRole. - * - * @return the new TemplateRole instance - */ - public TemplateRole build() { - return new TemplateRole(this); - } - - /** - * Adds a new element to actions. - * - * @param actions the new element to be added - * @return the TemplateRole builder - */ - public Builder addActions(String actions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(actions, - "actions cannot be null"); - if (this.actions == null) { - this.actions = new ArrayList(); - } - this.actions.add(actions); - return this; - } - - /** - * Set the displayName. - * - * @param displayName the displayName - * @return the TemplateRole builder - */ - public Builder displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the TemplateRole builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the TemplateRole builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the actions. - * Existing actions will be replaced. - * - * @param actions the actions - * @return the TemplateRole builder - */ - public Builder actions(List actions) { - this.actions = actions; - return this; - } - } - - protected TemplateRole() { } - - protected TemplateRole(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.displayName, - "displayName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.actions, - "actions cannot be null"); - displayName = builder.displayName; - serviceName = builder.serviceName; - description = builder.description; - actions = builder.actions; - } - - /** - * New builder. - * - * @return a TemplateRole builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the displayName. - * - * The display the name of the role that is shown in the console. - * - * @return the displayName - */ - public String displayName() { - return displayName; - } - - /** - * Gets the serviceName. - * - * The service name that the role refers. - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the description. - * - * Description of the role. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the actions. - * - * The actions of the role. - * - * @return the actions - */ - public List actions() { - return actions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java deleted file mode 100644 index caf2f737b55..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptions.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updateActionControlAssignment options. - */ -public class UpdateActionControlAssignmentOptions extends GenericModel { - - protected String assignmentId; - protected String ifMatch; - protected String templateVersion; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - private String ifMatch; - private String templateVersion; - - /** - * Instantiates a new Builder from an existing UpdateActionControlAssignmentOptions instance. - * - * @param updateActionControlAssignmentOptions the instance to initialize the Builder with - */ - private Builder(UpdateActionControlAssignmentOptions updateActionControlAssignmentOptions) { - this.assignmentId = updateActionControlAssignmentOptions.assignmentId; - this.ifMatch = updateActionControlAssignmentOptions.ifMatch; - this.templateVersion = updateActionControlAssignmentOptions.templateVersion; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - * @param ifMatch the ifMatch - * @param templateVersion the templateVersion - */ - public Builder(String assignmentId, String ifMatch, String templateVersion) { - this.assignmentId = assignmentId; - this.ifMatch = ifMatch; - this.templateVersion = templateVersion; - } - - /** - * Builds a UpdateActionControlAssignmentOptions. - * - * @return the new UpdateActionControlAssignmentOptions instance - */ - public UpdateActionControlAssignmentOptions build() { - return new UpdateActionControlAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the UpdateActionControlAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdateActionControlAssignmentOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the UpdateActionControlAssignmentOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - } - - protected UpdateActionControlAssignmentOptions() { } - - protected UpdateActionControlAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId 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.templateVersion, - "templateVersion cannot be null"); - assignmentId = builder.assignmentId; - ifMatch = builder.ifMatch; - templateVersion = builder.templateVersion; - } - - /** - * New builder. - * - * @return a UpdateActionControlAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Action control template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating an action control assignment and must match the Etag value of the existing action - * control assignment. The Etag can be retrieved using the GET /v1/action_control_assignments/{assignment_id} API and - * looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the templateVersion. - * - * The version number of the template used to identify different versions of same template. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java deleted file mode 100644 index 869eb357802..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptions.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updatePolicyAssignment options. - */ -public class UpdatePolicyAssignmentOptions extends GenericModel { - - protected String assignmentId; - protected String version; - protected String ifMatch; - protected String templateVersion; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - private String version; - private String ifMatch; - private String templateVersion; - - /** - * Instantiates a new Builder from an existing UpdatePolicyAssignmentOptions instance. - * - * @param updatePolicyAssignmentOptions the instance to initialize the Builder with - */ - private Builder(UpdatePolicyAssignmentOptions updatePolicyAssignmentOptions) { - this.assignmentId = updatePolicyAssignmentOptions.assignmentId; - this.version = updatePolicyAssignmentOptions.version; - this.ifMatch = updatePolicyAssignmentOptions.ifMatch; - this.templateVersion = updatePolicyAssignmentOptions.templateVersion; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - * @param version the version - * @param ifMatch the ifMatch - * @param templateVersion the templateVersion - */ - public Builder(String assignmentId, String version, String ifMatch, String templateVersion) { - this.assignmentId = assignmentId; - this.version = version; - this.ifMatch = ifMatch; - this.templateVersion = templateVersion; - } - - /** - * Builds a UpdatePolicyAssignmentOptions. - * - * @return the new UpdatePolicyAssignmentOptions instance - */ - public UpdatePolicyAssignmentOptions build() { - return new UpdatePolicyAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the UpdatePolicyAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - - /** - * Set the version. - * - * @param version the version - * @return the UpdatePolicyAssignmentOptions builder - */ - public Builder version(String version) { - this.version = version; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdatePolicyAssignmentOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the UpdatePolicyAssignmentOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - } - - protected UpdatePolicyAssignmentOptions() { } - - protected UpdatePolicyAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.version, - "version cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.templateVersion, - "templateVersion cannot be null"); - assignmentId = builder.assignmentId; - version = builder.version; - ifMatch = builder.ifMatch; - templateVersion = builder.templateVersion; - } - - /** - * New builder. - * - * @return a UpdatePolicyAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * The policy template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } - - /** - * Gets the version. - * - * specify version of response body format. - * - * @return the version - */ - public String version() { - return version; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy assignment and must match the Etag value of the existing policy - * assignment. The Etag can be retrieved using the GET /v1/policy_assignments/{assignment_id} API and looking at the - * Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the templateVersion. - * - * The policy template version to update to. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java deleted file mode 100644 index a28b357641f..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptions.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updatePolicyState options. - */ -public class UpdatePolicyStateOptions extends GenericModel { - - /** - * The policy state. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String policyId; - protected String ifMatch; - protected String state; - - /** - * Builder. - */ - public static class Builder { - private String policyId; - private String ifMatch; - private String state; - - /** - * Instantiates a new Builder from an existing UpdatePolicyStateOptions instance. - * - * @param updatePolicyStateOptions the instance to initialize the Builder with - */ - private Builder(UpdatePolicyStateOptions updatePolicyStateOptions) { - this.policyId = updatePolicyStateOptions.policyId; - this.ifMatch = updatePolicyStateOptions.ifMatch; - this.state = updatePolicyStateOptions.state; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param policyId the policyId - * @param ifMatch the ifMatch - */ - public Builder(String policyId, String ifMatch) { - this.policyId = policyId; - this.ifMatch = ifMatch; - } - - /** - * Builds a UpdatePolicyStateOptions. - * - * @return the new UpdatePolicyStateOptions instance - */ - public UpdatePolicyStateOptions build() { - return new UpdatePolicyStateOptions(this); - } - - /** - * Set the policyId. - * - * @param policyId the policyId - * @return the UpdatePolicyStateOptions builder - */ - public Builder policyId(String policyId) { - this.policyId = policyId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdatePolicyStateOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the state. - * - * @param state the state - * @return the UpdatePolicyStateOptions builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - } - - protected UpdatePolicyStateOptions() { } - - protected UpdatePolicyStateOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, - "policyId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - policyId = builder.policyId; - ifMatch = builder.ifMatch; - state = builder.state; - } - - /** - * New builder. - * - * @return a UpdatePolicyStateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the policyId. - * - * The policy ID. - * - * @return the policyId - */ - public String policyId() { - return policyId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be - * retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the state. - * - * The policy state. - * - * @return the state - */ - public String state() { - return state; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java deleted file mode 100644 index f10cba5fe93..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptions.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updateRoleAssignment options. - */ -public class UpdateRoleAssignmentOptions extends GenericModel { - - protected String assignmentId; - protected String ifMatch; - protected String templateVersion; - - /** - * Builder. - */ - public static class Builder { - private String assignmentId; - private String ifMatch; - private String templateVersion; - - /** - * Instantiates a new Builder from an existing UpdateRoleAssignmentOptions instance. - * - * @param updateRoleAssignmentOptions the instance to initialize the Builder with - */ - private Builder(UpdateRoleAssignmentOptions updateRoleAssignmentOptions) { - this.assignmentId = updateRoleAssignmentOptions.assignmentId; - this.ifMatch = updateRoleAssignmentOptions.ifMatch; - this.templateVersion = updateRoleAssignmentOptions.templateVersion; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param assignmentId the assignmentId - * @param ifMatch the ifMatch - * @param templateVersion the templateVersion - */ - public Builder(String assignmentId, String ifMatch, String templateVersion) { - this.assignmentId = assignmentId; - this.ifMatch = ifMatch; - this.templateVersion = templateVersion; - } - - /** - * Builds a UpdateRoleAssignmentOptions. - * - * @return the new UpdateRoleAssignmentOptions instance - */ - public UpdateRoleAssignmentOptions build() { - return new UpdateRoleAssignmentOptions(this); - } - - /** - * Set the assignmentId. - * - * @param assignmentId the assignmentId - * @return the UpdateRoleAssignmentOptions builder - */ - public Builder assignmentId(String assignmentId) { - this.assignmentId = assignmentId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdateRoleAssignmentOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the templateVersion. - * - * @param templateVersion the templateVersion - * @return the UpdateRoleAssignmentOptions builder - */ - public Builder templateVersion(String templateVersion) { - this.templateVersion = templateVersion; - return this; - } - } - - protected UpdateRoleAssignmentOptions() { } - - protected UpdateRoleAssignmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.assignmentId, - "assignmentId 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.templateVersion, - "templateVersion cannot be null"); - assignmentId = builder.assignmentId; - ifMatch = builder.ifMatch; - templateVersion = builder.templateVersion; - } - - /** - * New builder. - * - * @return a UpdateRoleAssignmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the assignmentId. - * - * Role template assignment ID. - * - * @return the assignmentId - */ - public String assignmentId() { - return assignmentId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating a role assignment and must match the Etag value of the existing role assignment. - * The Etag can be retrieved using the GET /v1/role_assignments/{assignment_id} API and looking at the Etag response - * header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the templateVersion. - * - * The version number of the template used to identify different versions of same template. - * - * @return the templateVersion - */ - public String templateVersion() { - return templateVersion; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java deleted file mode 100644 index 3d9dbb43fb3..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptions.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updateSettings options. - */ -public class UpdateSettingsOptions extends GenericModel { - - protected String accountId; - protected String ifMatch; - protected ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction; - protected String acceptLanguage; - - /** - * Builder. - */ - public static class Builder { - private String accountId; - private String ifMatch; - private ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction; - private String acceptLanguage; - - /** - * Instantiates a new Builder from an existing UpdateSettingsOptions instance. - * - * @param updateSettingsOptions the instance to initialize the Builder with - */ - private Builder(UpdateSettingsOptions updateSettingsOptions) { - this.accountId = updateSettingsOptions.accountId; - this.ifMatch = updateSettingsOptions.ifMatch; - this.externalAccountIdentityInteraction = updateSettingsOptions.externalAccountIdentityInteraction; - this.acceptLanguage = updateSettingsOptions.acceptLanguage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param accountId the accountId - * @param ifMatch the ifMatch - */ - public Builder(String accountId, String ifMatch) { - this.accountId = accountId; - this.ifMatch = ifMatch; - } - - /** - * Builds a UpdateSettingsOptions. - * - * @return the new UpdateSettingsOptions instance - */ - public UpdateSettingsOptions build() { - return new UpdateSettingsOptions(this); - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the UpdateSettingsOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the ifMatch. - * - * @param ifMatch the ifMatch - * @return the UpdateSettingsOptions builder - */ - public Builder ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Set the externalAccountIdentityInteraction. - * - * @param externalAccountIdentityInteraction the externalAccountIdentityInteraction - * @return the UpdateSettingsOptions builder - */ - public Builder externalAccountIdentityInteraction(ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction) { - this.externalAccountIdentityInteraction = externalAccountIdentityInteraction; - return this; - } - - /** - * Set the acceptLanguage. - * - * @param acceptLanguage the acceptLanguage - * @return the UpdateSettingsOptions builder - */ - public Builder acceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - } - - protected UpdateSettingsOptions() { } - - protected UpdateSettingsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.accountId, - "accountId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, - "ifMatch cannot be null"); - accountId = builder.accountId; - ifMatch = builder.ifMatch; - externalAccountIdentityInteraction = builder.externalAccountIdentityInteraction; - acceptLanguage = builder.acceptLanguage; - } - - /** - * New builder. - * - * @return a UpdateSettingsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the accountId. - * - * The account GUID that the settings belong to. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the ifMatch. - * - * The revision number for updating Access Management Account Settings and must match the Etag value of the existing - * Access Management Account Settings. The Etag can be retrieved using the GET - * /v1/accounts/{account_id}/settings/access_management API and looking at the Etag response header. - * - * @return the ifMatch - */ - public String ifMatch() { - return ifMatch; - } - - /** - * Gets the externalAccountIdentityInteraction. - * - * Update to how external accounts can interact in relation to the requested account. - * - * @return the externalAccountIdentityInteraction - */ - public ExternalAccountIdentityInteractionPatch externalAccountIdentityInteraction() { - return externalAccountIdentityInteraction; - } - - /** - * Gets the acceptLanguage. - * - * Language code for translations - * * `default` - English - * * `de` - German (Standard) - * * `en` - English - * * `es` - Spanish (Spain) - * * `fr` - French (Standard) - * * `it` - Italian (Standard) - * * `ja` - Japanese - * * `ko` - Korean - * * `pt-br` - Portuguese (Brazil) - * * `zh-cn` - Chinese (Simplified, PRC) - * * `zh-tw` - (Chinese, Taiwan). - * - * @return the acceptLanguage - */ - public String acceptLanguage() { - return acceptLanguage; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java deleted file mode 100644 index fdae9e28c12..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PoliciesPager.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * V2PoliciesPager can be used to simplify the use of the "listV2Policies" method. - */ -public class V2PoliciesPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListV2PoliciesOptions options; - protected IamPolicyManagement client; - protected PageContext pageContext; - - // Hide the default ctor. - protected V2PoliciesPager() { } - - /** - * Constructs a new V2PoliciesPager instance with the specified client and options model instance. - * @param client the IamPolicyManagement instance to be used to invoke the "listV2Policies" method - * @param options the ListV2PoliciesOptions instance to be used to invoke the "listV2Policies" method - */ - public V2PoliciesPager(IamPolicyManagement client, ListV2PoliciesOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<V2PolicyTemplateMetaData> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListV2PoliciesOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - V2PolicyCollection result = client.listV2Policies(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getPolicies(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<V2PolicyTemplateMetaData> containing all results returned by the "listV2Policies" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java deleted file mode 100644 index 842a354b7b1..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2Policy.java +++ /dev/null @@ -1,247 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the policy. - */ -public class V2Policy extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - /** - * The policy state, either 'deleted' or 'active'. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String type; - protected String description; - protected V2PolicySubject subject; - protected V2PolicyResource resource; - protected String pattern; - protected V2PolicyRule rule; - protected String id; - protected String href; - protected ControlResponse control; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String state; - @SerializedName("last_permit_at") - protected String lastPermitAt; - @SerializedName("last_permit_frequency") - protected Long lastPermitFrequency; - - protected V2Policy() { } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject getSubject() { - return subject; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource getResource() { - return resource; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String getPattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule getRule() { - return rule; - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the policies API by policy ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the control. - * - * @return the control - */ - public ControlResponse getControl() { - return control; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the state. - * - * The policy state, either 'deleted' or 'active'. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the lastPermitAt. - * - * The optional last permit time of policy, when passing query parameter format=include_last_permit. - * - * @return the lastPermitAt - */ - public String getLastPermitAt() { - return lastPermitAt; - } - - /** - * Gets the lastPermitFrequency. - * - * The optional count of times that policy has provided a permit, when passing query parameter - * format=include_last_permit. - * - * @return the lastPermitFrequency - */ - public Long getLastPermitFrequency() { - return lastPermitFrequency; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java deleted file mode 100644 index d392025f8d8..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A collection of policies. - */ -public class V2PolicyCollection extends GenericModel { - - protected Long limit; - protected First first; - protected Next next; - protected Previous previous; - protected List policies; - - protected V2PolicyCollection() { } - - /** - * Gets the limit. - * - * The number of documents to include per each page of the collection. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the first. - * - * Details with linking href to first page of requested collection. - * - * @return the first - */ - public First getFirst() { - return first; - } - - /** - * Gets the next. - * - * Details with href linking to the following page of requested collection. - * - * @return the next - */ - public Next getNext() { - return next; - } - - /** - * Gets the previous. - * - * Details with linking href to previous page of requested collection. - * - * @return the previous - */ - public Previous getPrevious() { - return previous; - } - - /** - * Gets the policies. - * - * List of policies. - * - * @return the policies - */ - public List getPolicies() { - return policies; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java deleted file mode 100644 index caf8dd522a9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResource.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The resource attributes to which the policy grants access. - */ -public class V2PolicyResource extends GenericModel { - - protected List attributes; - protected List tags; - - /** - * Builder. - */ - public static class Builder { - private List attributes; - private List tags; - - /** - * Instantiates a new Builder from an existing V2PolicyResource instance. - * - * @param v2PolicyResource the instance to initialize the Builder with - */ - private Builder(V2PolicyResource v2PolicyResource) { - this.attributes = v2PolicyResource.attributes; - this.tags = v2PolicyResource.tags; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param attributes the attributes - */ - public Builder(List attributes) { - this.attributes = attributes; - } - - /** - * Builds a V2PolicyResource. - * - * @return the new V2PolicyResource instance - */ - public V2PolicyResource build() { - return new V2PolicyResource(this); - } - - /** - * Adds a new element to attributes. - * - * @param attributes the new element to be added - * @return the V2PolicyResource builder - */ - public Builder addAttributes(V2PolicyResourceAttribute attributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, - "attributes cannot be null"); - if (this.attributes == null) { - this.attributes = new ArrayList(); - } - this.attributes.add(attributes); - return this; - } - - /** - * Adds a new element to tags. - * - * @param tags the new element to be added - * @return the V2PolicyResource builder - */ - public Builder addTags(V2PolicyResourceTag tags) { - com.ibm.cloud.sdk.core.util.Validator.notNull(tags, - "tags cannot be null"); - if (this.tags == null) { - this.tags = new ArrayList(); - } - this.tags.add(tags); - return this; - } - - /** - * Set the attributes. - * Existing attributes will be replaced. - * - * @param attributes the attributes - * @return the V2PolicyResource builder - */ - public Builder attributes(List attributes) { - this.attributes = attributes; - return this; - } - - /** - * Set the tags. - * Existing tags will be replaced. - * - * @param tags the tags - * @return the V2PolicyResource builder - */ - public Builder tags(List tags) { - this.tags = tags; - return this; - } - } - - protected V2PolicyResource() { } - - protected V2PolicyResource(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, - "attributes cannot be null"); - attributes = builder.attributes; - tags = builder.tags; - } - - /** - * New builder. - * - * @return a V2PolicyResource builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the attributes. - * - * List of resource attributes to which the policy grants access. - * - * @return the attributes - */ - public List attributes() { - return attributes; - } - - /** - * Gets the tags. - * - * Optional list of resource tags to which the policy grants access. - * - * @return the tags - */ - public List tags() { - return tags; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java deleted file mode 100644 index 73e7cedd55e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttribute.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Resource attribute to which the policy grants access. - */ -public class V2PolicyResourceAttribute extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - } - - protected String key; - protected String operator; - protected Object value; - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing V2PolicyResourceAttribute instance. - * - * @param v2PolicyResourceAttribute the instance to initialize the Builder with - */ - private Builder(V2PolicyResourceAttribute v2PolicyResourceAttribute) { - this.key = v2PolicyResourceAttribute.key; - this.operator = v2PolicyResourceAttribute.operator; - this.value = v2PolicyResourceAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a V2PolicyResourceAttribute. - * - * @return the new V2PolicyResourceAttribute instance - */ - public V2PolicyResourceAttribute build() { - return new V2PolicyResourceAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the V2PolicyResourceAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicyResourceAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the V2PolicyResourceAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected V2PolicyResourceAttribute() { } - - protected V2PolicyResourceAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a V2PolicyResourceAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the key. - * - * The name of a resource attribute. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java deleted file mode 100644 index bb32772b8dc..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTag.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A tag associated with a resource. - */ -public class V2PolicyResourceTag extends GenericModel { - - /** - * The operator of an access management tag. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - } - - protected String key; - protected String value; - protected String operator; - - /** - * Builder. - */ - public static class Builder { - private String key; - private String value; - private String operator; - - /** - * Instantiates a new Builder from an existing V2PolicyResourceTag instance. - * - * @param v2PolicyResourceTag the instance to initialize the Builder with - */ - private Builder(V2PolicyResourceTag v2PolicyResourceTag) { - this.key = v2PolicyResourceTag.key; - this.value = v2PolicyResourceTag.value; - this.operator = v2PolicyResourceTag.operator; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param value the value - * @param operator the operator - */ - public Builder(String key, String value, String operator) { - this.key = key; - this.value = value; - this.operator = operator; - } - - /** - * Builds a V2PolicyResourceTag. - * - * @return the new V2PolicyResourceTag instance - */ - public V2PolicyResourceTag build() { - return new V2PolicyResourceTag(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the V2PolicyResourceTag builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the V2PolicyResourceTag builder - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicyResourceTag builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - } - - protected V2PolicyResourceTag() { } - - protected V2PolicyResourceTag(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - key = builder.key; - value = builder.value; - operator = builder.operator; - } - - /** - * New builder. - * - * @return a V2PolicyResourceTag builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the key. - * - * The name of an access management tag. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the value. - * - * The value of an access management tag. - * - * @return the value - */ - public String value() { - return value; - } - - /** - * Gets the operator. - * - * The operator of an access management tag. - * - * @return the operator - */ - public String operator() { - return operator; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java deleted file mode 100644 index 13a9f5fbd94..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRule.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Additional access conditions associated with the policy. - * - * Classes which extend this class: - * - V2PolicyRuleRuleAttribute - * - V2PolicyRuleRuleWithNestedConditions - */ -public class V2PolicyRule extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - protected String key; - protected String operator; - protected Object value; - protected List conditions; - - protected V2PolicyRule() { } - - /** - * Gets the key. - * - * The name of an attribute. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } - - /** - * Gets the conditions. - * - * List of conditions associated with a policy. For example, time-based conditions that grant access over a certain - * time period. - * - * @return the conditions - */ - public List conditions() { - return conditions; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java deleted file mode 100644 index c20b3a8cb0c..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttribute.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * (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_policy_management.v1.model; - -/** - * Rule that specifies additional access that is granted (For example, time-based condition). - */ -public class V2PolicyRuleRuleAttribute extends V2PolicyRule { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - /** stringEqualsAnyOf. */ - String STRINGEQUALSANYOF = "stringEqualsAnyOf"; - /** stringMatchAnyOf. */ - String STRINGMATCHANYOF = "stringMatchAnyOf"; - /** stringMatch. */ - String STRINGMATCH = "stringMatch"; - /** timeLessThan. */ - String TIMELESSTHAN = "timeLessThan"; - /** timeLessThanOrEquals. */ - String TIMELESSTHANOREQUALS = "timeLessThanOrEquals"; - /** timeGreaterThan. */ - String TIMEGREATERTHAN = "timeGreaterThan"; - /** timeGreaterThanOrEquals. */ - String TIMEGREATERTHANOREQUALS = "timeGreaterThanOrEquals"; - /** dateLessThan. */ - String DATELESSTHAN = "dateLessThan"; - /** dateLessThanOrEquals. */ - String DATELESSTHANOREQUALS = "dateLessThanOrEquals"; - /** dateGreaterThan. */ - String DATEGREATERTHAN = "dateGreaterThan"; - /** dateGreaterThanOrEquals. */ - String DATEGREATERTHANOREQUALS = "dateGreaterThanOrEquals"; - /** dateTimeLessThan. */ - String DATETIMELESSTHAN = "dateTimeLessThan"; - /** dateTimeLessThanOrEquals. */ - String DATETIMELESSTHANOREQUALS = "dateTimeLessThanOrEquals"; - /** dateTimeGreaterThan. */ - String DATETIMEGREATERTHAN = "dateTimeGreaterThan"; - /** dateTimeGreaterThanOrEquals. */ - String DATETIMEGREATERTHANOREQUALS = "dateTimeGreaterThanOrEquals"; - /** dayOfWeekEquals. */ - String DAYOFWEEKEQUALS = "dayOfWeekEquals"; - /** dayOfWeekAnyOf. */ - String DAYOFWEEKANYOF = "dayOfWeekAnyOf"; - } - - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing V2PolicyRuleRuleAttribute instance. - * - * @param v2PolicyRuleRuleAttribute the instance to initialize the Builder with - */ - public Builder(V2PolicyRule v2PolicyRuleRuleAttribute) { - this.key = v2PolicyRuleRuleAttribute.key; - this.operator = v2PolicyRuleRuleAttribute.operator; - this.value = v2PolicyRuleRuleAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a V2PolicyRuleRuleAttribute. - * - * @return the new V2PolicyRuleRuleAttribute instance - */ - public V2PolicyRuleRuleAttribute build() { - return new V2PolicyRuleRuleAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the V2PolicyRuleRuleAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicyRuleRuleAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the V2PolicyRuleRuleAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected V2PolicyRuleRuleAttribute() { } - - protected V2PolicyRuleRuleAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a V2PolicyRuleRuleAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java deleted file mode 100644 index 8d6e57920f9..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditions.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * Rule that specifies additional access that is granted (for example, time-based condition) accross multiple - * conditions. - */ -public class V2PolicyRuleRuleWithNestedConditions extends V2PolicyRule { - - /** - * Operator to evaluate conditions. - */ - public interface Operator { - /** and. */ - String AND = "and"; - /** or. */ - String OR = "or"; - } - - - /** - * Builder. - */ - public static class Builder { - private String operator; - private List conditions; - - /** - * Instantiates a new Builder from an existing V2PolicyRuleRuleWithNestedConditions instance. - * - * @param v2PolicyRuleRuleWithNestedConditions the instance to initialize the Builder with - */ - public Builder(V2PolicyRule v2PolicyRuleRuleWithNestedConditions) { - this.operator = v2PolicyRuleRuleWithNestedConditions.operator; - this.conditions = v2PolicyRuleRuleWithNestedConditions.conditions; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param operator the operator - * @param conditions the conditions - */ - public Builder(String operator, List conditions) { - this.operator = operator; - this.conditions = conditions; - } - - /** - * Builds a V2PolicyRuleRuleWithNestedConditions. - * - * @return the new V2PolicyRuleRuleWithNestedConditions instance - */ - public V2PolicyRuleRuleWithNestedConditions build() { - return new V2PolicyRuleRuleWithNestedConditions(this); - } - - /** - * Adds a new element to conditions. - * - * @param conditions the new element to be added - * @return the V2PolicyRuleRuleWithNestedConditions builder - */ - public Builder addConditions(NestedCondition conditions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(conditions, - "conditions cannot be null"); - if (this.conditions == null) { - this.conditions = new ArrayList(); - } - this.conditions.add(conditions); - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicyRuleRuleWithNestedConditions builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the conditions. - * Existing conditions will be replaced. - * - * @param conditions the conditions - * @return the V2PolicyRuleRuleWithNestedConditions builder - */ - public Builder conditions(List conditions) { - this.conditions = conditions; - return this; - } - } - - protected V2PolicyRuleRuleWithNestedConditions() { } - - protected V2PolicyRuleRuleWithNestedConditions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.conditions, - "conditions cannot be null"); - operator = builder.operator; - conditions = builder.conditions; - } - - /** - * New builder. - * - * @return a V2PolicyRuleRuleWithNestedConditions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java deleted file mode 100644 index 891513fd45a..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubject.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The subject attributes for whom the policy grants access. - */ -public class V2PolicySubject extends GenericModel { - - protected List attributes; - - /** - * Builder. - */ - public static class Builder { - private List attributes; - - /** - * Instantiates a new Builder from an existing V2PolicySubject instance. - * - * @param v2PolicySubject the instance to initialize the Builder with - */ - private Builder(V2PolicySubject v2PolicySubject) { - this.attributes = v2PolicySubject.attributes; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param attributes the attributes - */ - public Builder(List attributes) { - this.attributes = attributes; - } - - /** - * Builds a V2PolicySubject. - * - * @return the new V2PolicySubject instance - */ - public V2PolicySubject build() { - return new V2PolicySubject(this); - } - - /** - * Adds a new element to attributes. - * - * @param attributes the new element to be added - * @return the V2PolicySubject builder - */ - public Builder addAttributes(V2PolicySubjectAttribute attributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(attributes, - "attributes cannot be null"); - if (this.attributes == null) { - this.attributes = new ArrayList(); - } - this.attributes.add(attributes); - return this; - } - - /** - * Set the attributes. - * Existing attributes will be replaced. - * - * @param attributes the attributes - * @return the V2PolicySubject builder - */ - public Builder attributes(List attributes) { - this.attributes = attributes; - return this; - } - } - - protected V2PolicySubject() { } - - protected V2PolicySubject(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, - "attributes cannot be null"); - attributes = builder.attributes; - } - - /** - * New builder. - * - * @return a V2PolicySubject builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the attributes. - * - * List of subject attributes associated with policy. - * - * @return the attributes - */ - public List attributes() { - return attributes; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java deleted file mode 100644 index c90606429df..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttribute.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Subject attribute for whom the policy grants access. - */ -public class V2PolicySubjectAttribute extends GenericModel { - - /** - * The operator of an attribute. - */ - public interface Operator { - /** stringEquals. */ - String STRINGEQUALS = "stringEquals"; - /** stringExists. */ - String STRINGEXISTS = "stringExists"; - } - - protected String key; - protected String operator; - protected Object value; - - /** - * Builder. - */ - public static class Builder { - private String key; - private String operator; - private Object value; - - /** - * Instantiates a new Builder from an existing V2PolicySubjectAttribute instance. - * - * @param v2PolicySubjectAttribute the instance to initialize the Builder with - */ - private Builder(V2PolicySubjectAttribute v2PolicySubjectAttribute) { - this.key = v2PolicySubjectAttribute.key; - this.operator = v2PolicySubjectAttribute.operator; - this.value = v2PolicySubjectAttribute.value; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param key the key - * @param operator the operator - * @param value the value - */ - public Builder(String key, String operator, Object value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - /** - * Builds a V2PolicySubjectAttribute. - * - * @return the new V2PolicySubjectAttribute instance - */ - public V2PolicySubjectAttribute build() { - return new V2PolicySubjectAttribute(this); - } - - /** - * Set the key. - * - * @param key the key - * @return the V2PolicySubjectAttribute builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Set the operator. - * - * @param operator the operator - * @return the V2PolicySubjectAttribute builder - */ - public Builder operator(String operator) { - this.operator = operator; - return this; - } - - /** - * Set the value. - * - * @param value the value - * @return the V2PolicySubjectAttribute builder - */ - public Builder value(Object value) { - this.value = value; - return this; - } - } - - protected V2PolicySubjectAttribute() { } - - protected V2PolicySubjectAttribute(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.key, - "key cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, - "operator cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - key = builder.key; - operator = builder.operator; - value = builder.value; - } - - /** - * New builder. - * - * @return a V2PolicySubjectAttribute builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the key. - * - * The name of a subject attribute. For example, iam_id, access_group_id. - * - * @return the key - */ - public String key() { - return key; - } - - /** - * Gets the operator. - * - * The operator of an attribute. - * - * @return the operator - */ - public String operator() { - return operator; - } - - /** - * Gets the value. - * - * The value of a rule, resource, or subject attribute; can be boolean or string for resource and subject attribute. - * Can be a string or an array of strings (for example, an array of days to permit access) for rule attribute. - * - * @return the value - */ - public Object value() { - return value; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java deleted file mode 100644 index 720f7b57d4e..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaData.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import java.util.Date; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The core set of properties associated with the policy. - */ -public class V2PolicyTemplateMetaData extends GenericModel { - - /** - * The policy type; either 'access' or 'authorization'. - */ - public interface Type { - /** access. */ - String ACCESS = "access"; - /** authorization. */ - String AUTHORIZATION = "authorization"; - } - - /** - * The policy state, either 'deleted' or 'active'. - */ - public interface State { - /** active. */ - String ACTIVE = "active"; - /** deleted. */ - String DELETED = "deleted"; - } - - protected String type; - protected String description; - protected V2PolicySubject subject; - protected V2PolicyResource resource; - protected String pattern; - protected V2PolicyRule rule; - protected String id; - protected String href; - protected ControlResponse control; - @SerializedName("created_at") - protected Date createdAt; - @SerializedName("created_by_id") - protected String createdById; - @SerializedName("last_modified_at") - protected Date lastModifiedAt; - @SerializedName("last_modified_by_id") - protected String lastModifiedById; - protected String state; - @SerializedName("last_permit_at") - protected String lastPermitAt; - @SerializedName("last_permit_frequency") - protected Long lastPermitFrequency; - protected TemplateMetadata template; - - protected V2PolicyTemplateMetaData() { } - - /** - * Gets the type. - * - * The policy type; either 'access' or 'authorization'. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Gets the description. - * - * Description of the policy. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the subject. - * - * The subject attributes for whom the policy grants access. - * - * @return the subject - */ - public V2PolicySubject getSubject() { - return subject; - } - - /** - * Gets the resource. - * - * The resource attributes to which the policy grants access. - * - * @return the resource - */ - public V2PolicyResource getResource() { - return resource; - } - - /** - * Gets the pattern. - * - * Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or - * 'time-based-conditions:weekly:custom-hours'. - * - * @return the pattern - */ - public String getPattern() { - return pattern; - } - - /** - * Gets the rule. - * - * Additional access conditions associated with the policy. - * - * @return the rule - */ - public V2PolicyRule getRule() { - return rule; - } - - /** - * Gets the id. - * - * The policy ID. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Gets the href. - * - * The href URL that links to the policies API by policy ID. - * - * @return the href - */ - public String getHref() { - return href; - } - - /** - * Gets the control. - * - * @return the control - */ - public ControlResponse getControl() { - return control; - } - - /** - * Gets the createdAt. - * - * The UTC timestamp when the policy was created. - * - * @return the createdAt - */ - public Date getCreatedAt() { - return createdAt; - } - - /** - * Gets the createdById. - * - * The IAM ID of the entity that created the policy. - * - * @return the createdById - */ - public String getCreatedById() { - return createdById; - } - - /** - * Gets the lastModifiedAt. - * - * The UTC timestamp when the policy was last modified. - * - * @return the lastModifiedAt - */ - public Date getLastModifiedAt() { - return lastModifiedAt; - } - - /** - * Gets the lastModifiedById. - * - * The IAM ID of the entity that last modified the policy. - * - * @return the lastModifiedById - */ - public String getLastModifiedById() { - return lastModifiedById; - } - - /** - * Gets the state. - * - * The policy state, either 'deleted' or 'active'. - * - * @return the state - */ - public String getState() { - return state; - } - - /** - * Gets the lastPermitAt. - * - * The optional last permit time of policy, when passing query parameter format=include_last_permit. - * - * @return the lastPermitAt - */ - public String getLastPermitAt() { - return lastPermitAt; - } - - /** - * Gets the lastPermitFrequency. - * - * The optional count of times that policy has provided a permit, when passing query parameter - * format=include_last_permit. - * - * @return the lastPermitFrequency - */ - public Long getLastPermitFrequency() { - return lastPermitFrequency; - } - - /** - * Gets the template. - * - * The details of the IAM template that was used to create an enterprise-managed policy in your account. When - * returned, this indicates that the policy is created from and managed by a template in the root enterprise account. - * - * @return the template - */ - public TemplateMetadata getTemplate() { - return template; - } -} - diff --git a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java b/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java deleted file mode 100644 index 63a87389391..00000000000 --- a/iam-policy-management/src/main/java/com/ibm/cloud/platform_services/iam_policy_management/v1/package-info.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * (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. - */ - -/** - * IAM Policy Management v1. - */ -package com.ibm.cloud.platform_services.iam_policy_management.v1; diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java deleted file mode 100644 index b38933306a6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/IamPolicyManagementTest.java +++ /dev/null @@ -1,5007 +0,0 @@ -/* - * (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_policy_management.v1; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.IamPolicyManagement; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplatesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponse; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControlWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedCondition; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleWithConditions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PoliciesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplatesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoleReferences; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PoliciesPager; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRule; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleWithNestedConditions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.utils.TestUtilities; -import com.ibm.cloud.sdk.core.http.Response; -import com.ibm.cloud.sdk.core.security.Authenticator; -import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import okhttp3.mockwebserver.MockResponse; -import okhttp3.mockwebserver.MockWebServer; -import okhttp3.mockwebserver.RecordedRequest; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; -import static org.testng.Assert.*; - -/** - * Unit test class for the IamPolicyManagement service. - */ -public class IamPolicyManagementTest { - - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - protected MockWebServer server; - protected IamPolicyManagement iamPolicyManagementService; - - // Construct the service with a null authenticator (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testConstructorWithNullAuthenticator() throws Throwable { - final String serviceName = "testService"; - new IamPolicyManagement(serviceName, null); - } - - // Test the listPolicies operation with a valid options model parameter - @Test - public void testListPoliciesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policies\": [{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}]}"; - String listPoliciesPath = "/v1/policies"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListPoliciesOptions model - ListPoliciesOptions listPoliciesOptionsModel = new ListPoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .tagName("testString") - .tagValue("testString") - .sort("id") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listPolicies() with a valid options model and verify the result - Response response = iamPolicyManagementService.listPolicies(listPoliciesOptionsModel).execute(); - assertNotNull(response); - PolicyCollection 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, listPoliciesPath); - // 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("access_group_id"), "testString"); - assertEquals(query.get("type"), "access"); - assertEquals(query.get("service_type"), "service"); - assertEquals(query.get("tag_name"), "testString"); - assertEquals(query.get("tag_value"), "testString"); - assertEquals(query.get("sort"), "id"); - assertEquals(query.get("format"), "include_last_permit"); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listPolicies operation with and without retries enabled - @Test - public void testListPoliciesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListPoliciesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListPoliciesWOptions(); - } - - // Test the listPolicies operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPoliciesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listPolicies(null).execute(); - } - - // Test the listPolicies operation using the PoliciesPager.getNext() method - @Test - public void testListPoliciesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPoliciesOptions listPoliciesOptions = new ListPoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .tagName("testString") - .tagValue("testString") - .sort("id") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - PoliciesPager pager = new PoliciesPager(iamPolicyManagementService, listPoliciesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listPolicies operation using the PoliciesPager.getAll() method - @Test - public void testListPoliciesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"id\":\"id\",\"type\":\"type\",\"description\":\"description\",\"subjects\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"roles\":[{\"role_id\":\"roleId\",\"display_name\":\"displayName\",\"description\":\"description\"}],\"resources\":[{\"attributes\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}],\"tags\":[{\"name\":\"name\",\"value\":\"value\",\"operator\":\"operator\"}]}],\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPoliciesOptions listPoliciesOptions = new ListPoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .tagName("testString") - .tagValue("testString") - .sort("id") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - PoliciesPager pager = new PoliciesPager(iamPolicyManagementService, listPoliciesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createPolicy operation with a valid options model parameter - @Test - public void testCreatePolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; - String createPolicyPath = "/v1/policies"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the SubjectAttribute model - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - - // Construct an instance of the PolicySubject model - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - - // Construct an instance of the PolicyRole model - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the ResourceAttribute model - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - - // Construct an instance of the ResourceTag model - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - - // Construct an instance of the PolicyResource model - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - - // Construct an instance of the CreatePolicyOptions model - CreatePolicyOptions createPolicyOptionsModel = new CreatePolicyOptions.Builder() - .type("testString") - .subjects(java.util.Arrays.asList(policySubjectModel)) - .roles(java.util.Arrays.asList(policyRoleModel)) - .resources(java.util.Arrays.asList(policyResourceModel)) - .description("testString") - .acceptLanguage("default") - .build(); - - // Invoke createPolicy() with a valid options model and verify the result - Response response = iamPolicyManagementService.createPolicy(createPolicyOptionsModel).execute(); - assertNotNull(response); - Policy 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createPolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createPolicy operation with and without retries enabled - @Test - public void testCreatePolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreatePolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreatePolicyWOptions(); - } - - // Test the createPolicy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createPolicy(null).execute(); - } - - // Test the replacePolicy operation with a valid options model parameter - @Test - public void testReplacePolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; - String replacePolicyPath = "/v1/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the SubjectAttribute model - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - - // Construct an instance of the PolicySubject model - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - - // Construct an instance of the PolicyRole model - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the ResourceAttribute model - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - - // Construct an instance of the ResourceTag model - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - - // Construct an instance of the PolicyResource model - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - - // Construct an instance of the ReplacePolicyOptions model - ReplacePolicyOptions replacePolicyOptionsModel = new ReplacePolicyOptions.Builder() - .policyId("testString") - .ifMatch("testString") - .type("testString") - .subjects(java.util.Arrays.asList(policySubjectModel)) - .roles(java.util.Arrays.asList(policyRoleModel)) - .resources(java.util.Arrays.asList(policyResourceModel)) - .description("testString") - .build(); - - // Invoke replacePolicy() with a valid options model and verify the result - Response response = iamPolicyManagementService.replacePolicy(replacePolicyOptionsModel).execute(); - assertNotNull(response); - Policy 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, replacePolicyPath); - // 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 replacePolicy operation with and without retries enabled - @Test - public void testReplacePolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplacePolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplacePolicyWOptions(); - } - - // Test the replacePolicy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplacePolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replacePolicy(null).execute(); - } - - // Test the getPolicy operation with a valid options model parameter - @Test - public void testGetPolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}"; - String getPolicyPath = "/v1/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetPolicyOptions model - GetPolicyOptions getPolicyOptionsModel = new GetPolicyOptions.Builder() - .policyId("testString") - .build(); - - // Invoke getPolicy() with a valid options model and verify the result - Response response = iamPolicyManagementService.getPolicy(getPolicyOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateMetaData 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, getPolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getPolicy operation with and without retries enabled - @Test - public void testGetPolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetPolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetPolicyWOptions(); - } - - // Test the getPolicy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getPolicy(null).execute(); - } - - // Test the deletePolicy operation with a valid options model parameter - @Test - public void testDeletePolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deletePolicyPath = "/v1/policies/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeletePolicyOptions model - DeletePolicyOptions deletePolicyOptionsModel = new DeletePolicyOptions.Builder() - .policyId("testString") - .build(); - - // Invoke deletePolicy() with a valid options model and verify the result - Response response = iamPolicyManagementService.deletePolicy(deletePolicyOptionsModel).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, deletePolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deletePolicy operation with and without retries enabled - @Test - public void testDeletePolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeletePolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeletePolicyWOptions(); - } - - // Test the deletePolicy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deletePolicy(null).execute(); - } - - // Test the updatePolicyState operation with a valid options model parameter - @Test - public void testUpdatePolicyStateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"type\": \"type\", \"description\": \"description\", \"subjects\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"roles\": [{\"role_id\": \"roleId\", \"display_name\": \"displayName\", \"description\": \"description\"}], \"resources\": [{\"attributes\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}], \"tags\": [{\"name\": \"name\", \"value\": \"value\", \"operator\": \"operator\"}]}], \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\"}"; - String updatePolicyStatePath = "/v1/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdatePolicyStateOptions model - UpdatePolicyStateOptions updatePolicyStateOptionsModel = new UpdatePolicyStateOptions.Builder() - .policyId("testString") - .ifMatch("testString") - .state("active") - .build(); - - // Invoke updatePolicyState() with a valid options model and verify the result - Response response = iamPolicyManagementService.updatePolicyState(updatePolicyStateOptionsModel).execute(); - assertNotNull(response); - Policy 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updatePolicyStatePath); - // 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 updatePolicyState operation with and without retries enabled - @Test - public void testUpdatePolicyStateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdatePolicyStateWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdatePolicyStateWOptions(); - } - - // Test the updatePolicyState operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdatePolicyStateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updatePolicyState(null).execute(); - } - - // Test the listRoles operation with a valid options model parameter - @Test - public void testListRolesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"custom_roles\": [{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}], \"service_roles\": [{\"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\"}], \"system_roles\": [{\"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\"}]}"; - String listRolesPath = "/v2/roles"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListRolesOptions model - ListRolesOptions listRolesOptionsModel = new ListRolesOptions.Builder() - .acceptLanguage("default") - .accountId("testString") - .serviceName("iam-groups") - .sourceServiceName("iam-groups") - .policyType("authorization") - .serviceGroupId("IAM") - .build(); - - // Invoke listRoles() with a valid options model and verify the result - Response response = iamPolicyManagementService.listRoles(listRolesOptionsModel).execute(); - assertNotNull(response); - RoleCollection 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, listRolesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("service_name"), "iam-groups"); - assertEquals(query.get("source_service_name"), "iam-groups"); - assertEquals(query.get("policy_type"), "authorization"); - assertEquals(query.get("service_group_id"), "IAM"); - } - - // Test the listRoles operation with and without retries enabled - @Test - public void testListRolesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListRolesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListRolesWOptions(); - } - - // Test the createRole operation with a valid options model parameter - @Test - public void testCreateRoleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; - String createRolePath = "/v2/roles"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the CreateRoleOptions model - CreateRoleOptions createRoleOptionsModel = new CreateRoleOptions.Builder() - .displayName("testString") - .actions(java.util.Arrays.asList("testString")) - .name("Developer") - .accountId("testString") - .serviceName("iam-groups") - .description("testString") - .acceptLanguage("default") - .build(); - - // Invoke createRole() with a valid options model and verify the result - Response response = iamPolicyManagementService.createRole(createRoleOptionsModel).execute(); - assertNotNull(response); - CustomRole 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createRolePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createRole operation with and without retries enabled - @Test - public void testCreateRoleWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateRoleWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateRoleWOptions(); - } - - // Test the createRole operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createRole(null).execute(); - } - - // Test the replaceRole operation with a valid options model parameter - @Test - public void testReplaceRoleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; - String replaceRolePath = "/v2/roles/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ReplaceRoleOptions model - ReplaceRoleOptions replaceRoleOptionsModel = new ReplaceRoleOptions.Builder() - .roleId("testString") - .ifMatch("testString") - .displayName("testString") - .actions(java.util.Arrays.asList("testString")) - .description("testString") - .build(); - - // Invoke replaceRole() with a valid options model and verify the result - Response response = iamPolicyManagementService.replaceRole(replaceRoleOptionsModel).execute(); - assertNotNull(response); - CustomRole 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, replaceRolePath); - // 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 replaceRole operation with and without retries enabled - @Test - public void testReplaceRoleWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplaceRoleWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplaceRoleWOptions(); - } - - // Test the replaceRole operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceRoleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replaceRole(null).execute(); - } - - // Test the getRole operation with a valid options model parameter - @Test - public void testGetRoleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"display_name\": \"displayName\", \"description\": \"description\", \"actions\": [\"actions\"], \"crn\": \"crn\", \"name\": \"Developer\", \"account_id\": \"accountId\", \"service_name\": \"iam-groups\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"href\": \"href\"}"; - String getRolePath = "/v2/roles/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetRoleOptions model - GetRoleOptions getRoleOptionsModel = new GetRoleOptions.Builder() - .roleId("testString") - .build(); - - // Invoke getRole() with a valid options model and verify the result - Response response = iamPolicyManagementService.getRole(getRoleOptionsModel).execute(); - assertNotNull(response); - CustomRole 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, getRolePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getRole operation with and without retries enabled - @Test - public void testGetRoleWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetRoleWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetRoleWOptions(); - } - - // Test the getRole operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getRole(null).execute(); - } - - // Test the deleteRole operation with a valid options model parameter - @Test - public void testDeleteRoleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteRolePath = "/v2/roles/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteRoleOptions model - DeleteRoleOptions deleteRoleOptionsModel = new DeleteRoleOptions.Builder() - .roleId("testString") - .build(); - - // Invoke deleteRole() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteRole(deleteRoleOptionsModel).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, deleteRolePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteRole operation with and without retries enabled - @Test - public void testDeleteRoleWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteRoleWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteRoleWOptions(); - } - - // Test the deleteRole operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteRole(null).execute(); - } - - // Test the listV2Policies operation with a valid options model parameter - @Test - public void testListV2PoliciesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policies\": [{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19, \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}]}"; - String listV2PoliciesPath = "/v2/policies"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListV2PoliciesOptions model - ListV2PoliciesOptions listV2PoliciesOptionsModel = new ListV2PoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .serviceName("testString") - .serviceGroupId("testString") - .sort("testString") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listV2Policies() with a valid options model and verify the result - Response response = iamPolicyManagementService.listV2Policies(listV2PoliciesOptionsModel).execute(); - assertNotNull(response); - V2PolicyCollection 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, listV2PoliciesPath); - // 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("access_group_id"), "testString"); - assertEquals(query.get("type"), "access"); - assertEquals(query.get("service_type"), "service"); - assertEquals(query.get("service_name"), "testString"); - assertEquals(query.get("service_group_id"), "testString"); - assertEquals(query.get("sort"), "testString"); - assertEquals(query.get("format"), "include_last_permit"); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listV2Policies operation with and without retries enabled - @Test - public void testListV2PoliciesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListV2PoliciesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListV2PoliciesWOptions(); - } - - // Test the listV2Policies operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListV2PoliciesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listV2Policies(null).execute(); - } - - // Test the listV2Policies operation using the V2PoliciesPager.getNext() method - @Test - public void testListV2PoliciesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListV2PoliciesOptions listV2PoliciesOptions = new ListV2PoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .serviceName("testString") - .serviceGroupId("testString") - .sort("testString") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - V2PoliciesPager pager = new V2PoliciesPager(iamPolicyManagementService, listV2PoliciesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listV2Policies operation using the V2PoliciesPager.getAll() method - @Test - public void testListV2PoliciesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"policies\":[{\"type\":\"access\",\"description\":\"description\",\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"id\":\"id\",\"href\":\"href\",\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}},\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"state\":\"active\",\"last_permit_at\":\"lastPermitAt\",\"last_permit_frequency\":19,\"template\":{\"id\":\"id\",\"version\":\"version\",\"assignment_id\":\"assignmentId\",\"root_id\":\"rootId\",\"root_version\":\"rootVersion\"}}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListV2PoliciesOptions listV2PoliciesOptions = new ListV2PoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .serviceName("testString") - .serviceGroupId("testString") - .sort("testString") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - V2PoliciesPager pager = new V2PoliciesPager(iamPolicyManagementService, listV2PoliciesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createV2Policy operation with a valid options model parameter - @Test - public void testCreateV2PolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19}"; - String createV2PolicyPath = "/v2/policies"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the Grant model - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the Control model - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the CreateV2PolicyOptions model - CreateV2PolicyOptions createV2PolicyOptionsModel = new CreateV2PolicyOptions.Builder() - .control(controlModel) - .type("access") - .description("testString") - .subject(v2PolicySubjectModel) - .resource(v2PolicyResourceModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .acceptLanguage("default") - .build(); - - // Invoke createV2Policy() with a valid options model and verify the result - Response response = iamPolicyManagementService.createV2Policy(createV2PolicyOptionsModel).execute(); - assertNotNull(response); - V2Policy 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createV2PolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createV2Policy operation with and without retries enabled - @Test - public void testCreateV2PolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateV2PolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateV2PolicyWOptions(); - } - - // Test the createV2Policy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateV2PolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createV2Policy(null).execute(); - } - - // Test the replaceV2Policy operation with a valid options model parameter - @Test - public void testReplaceV2PolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19}"; - String replaceV2PolicyPath = "/v2/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the Grant model - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the Control model - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the ReplaceV2PolicyOptions model - ReplaceV2PolicyOptions replaceV2PolicyOptionsModel = new ReplaceV2PolicyOptions.Builder() - .id("testString") - .ifMatch("testString") - .control(controlModel) - .type("access") - .description("testString") - .subject(v2PolicySubjectModel) - .resource(v2PolicyResourceModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .build(); - - // Invoke replaceV2Policy() with a valid options model and verify the result - Response response = iamPolicyManagementService.replaceV2Policy(replaceV2PolicyOptionsModel).execute(); - assertNotNull(response); - V2Policy 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, replaceV2PolicyPath); - // 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 replaceV2Policy operation with and without retries enabled - @Test - public void testReplaceV2PolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplaceV2PolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplaceV2PolicyWOptions(); - } - - // Test the replaceV2Policy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceV2PolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replaceV2Policy(null).execute(); - } - - // Test the getV2Policy operation with a valid options model parameter - @Test - public void testGetV2PolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"type\": \"access\", \"description\": \"description\", \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"id\": \"id\", \"href\": \"href\", \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}, \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"state\": \"active\", \"last_permit_at\": \"lastPermitAt\", \"last_permit_frequency\": 19, \"template\": {\"id\": \"id\", \"version\": \"version\", \"assignment_id\": \"assignmentId\", \"root_id\": \"rootId\", \"root_version\": \"rootVersion\"}}"; - String getV2PolicyPath = "/v2/policies/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetV2PolicyOptions model - GetV2PolicyOptions getV2PolicyOptionsModel = new GetV2PolicyOptions.Builder() - .id("testString") - .format("include_last_permit") - .build(); - - // Invoke getV2Policy() with a valid options model and verify the result - Response response = iamPolicyManagementService.getV2Policy(getV2PolicyOptionsModel).execute(); - assertNotNull(response); - V2PolicyTemplateMetaData 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, getV2PolicyPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("format"), "include_last_permit"); - } - - // Test the getV2Policy operation with and without retries enabled - @Test - public void testGetV2PolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetV2PolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetV2PolicyWOptions(); - } - - // Test the getV2Policy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetV2PolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getV2Policy(null).execute(); - } - - // Test the deleteV2Policy operation with a valid options model parameter - @Test - public void testDeleteV2PolicyWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteV2PolicyPath = "/v2/policies/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteV2PolicyOptions model - DeleteV2PolicyOptions deleteV2PolicyOptionsModel = new DeleteV2PolicyOptions.Builder() - .id("testString") - .build(); - - // Invoke deleteV2Policy() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteV2Policy(deleteV2PolicyOptionsModel).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, deleteV2PolicyPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteV2Policy operation with and without retries enabled - @Test - public void testDeleteV2PolicyWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteV2PolicyWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteV2PolicyWOptions(); - } - - // Test the deleteV2Policy operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteV2PolicyNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteV2Policy(null).execute(); - } - - // Test the listPolicyTemplates operation with a valid options model parameter - @Test - public void testListPolicyTemplatesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"policy_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; - String listPolicyTemplatesPath = "/v1/policy_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListPolicyTemplatesOptions model - ListPolicyTemplatesOptions listPolicyTemplatesOptionsModel = new ListPolicyTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .state("active") - .name("testString") - .policyServiceType("service") - .policyServiceName("testString") - .policyServiceGroupId("testString") - .policyType("access") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listPolicyTemplates() with a valid options model and verify the result - Response response = iamPolicyManagementService.listPolicyTemplates(listPolicyTemplatesOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateCollection 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, listPolicyTemplatesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("state"), "active"); - assertEquals(query.get("name"), "testString"); - assertEquals(query.get("policy_service_type"), "service"); - assertEquals(query.get("policy_service_name"), "testString"); - assertEquals(query.get("policy_service_group_id"), "testString"); - assertEquals(query.get("policy_type"), "access"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listPolicyTemplates operation with and without retries enabled - @Test - public void testListPolicyTemplatesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListPolicyTemplatesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListPolicyTemplatesWOptions(); - } - - // Test the listPolicyTemplates operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyTemplatesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listPolicyTemplates(null).execute(); - } - - // Test the listPolicyTemplates operation using the PolicyTemplatesPager.getNext() method - @Test - public void testListPolicyTemplatesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyTemplatesOptions listPolicyTemplatesOptions = new ListPolicyTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .state("active") - .name("testString") - .policyServiceType("service") - .policyServiceName("testString") - .policyServiceGroupId("testString") - .policyType("access") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - PolicyTemplatesPager pager = new PolicyTemplatesPager(iamPolicyManagementService, listPolicyTemplatesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listPolicyTemplates operation using the PolicyTemplatesPager.getAll() method - @Test - public void testListPolicyTemplatesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"policy_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyTemplatesOptions listPolicyTemplatesOptions = new ListPolicyTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .state("active") - .name("testString") - .policyServiceType("service") - .policyServiceName("testString") - .policyServiceGroupId("testString") - .policyType("access") - .limit(Long.valueOf("10")) - .build(); - - PolicyTemplatesPager pager = new PolicyTemplatesPager(iamPolicyManagementService, listPolicyTemplatesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createPolicyTemplate operation with a valid options model parameter - @Test - public void testCreatePolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; - String createPolicyTemplatePath = "/v1/policy_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the TemplateGrantRoles model - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the TemplateControl model - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - - // Construct an instance of the TemplatePolicy model - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - - // Construct an instance of the CreatePolicyTemplateOptions model - CreatePolicyTemplateOptions createPolicyTemplateOptionsModel = new CreatePolicyTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .policy(templatePolicyModel) - .description("testString") - .committed(true) - .acceptLanguage("default") - .build(); - - // Invoke createPolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.createPolicyTemplate(createPolicyTemplateOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateLimitData 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createPolicyTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createPolicyTemplate operation with and without retries enabled - @Test - public void testCreatePolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreatePolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreatePolicyTemplateWOptions(); - } - - // Test the createPolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createPolicyTemplate(null).execute(); - } - - // Test the getPolicyTemplate operation with a valid options model parameter - @Test - public void testGetPolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String getPolicyTemplatePath = "/v1/policy_templates/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetPolicyTemplateOptions model - GetPolicyTemplateOptions getPolicyTemplateOptionsModel = new GetPolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .state("active") - .build(); - - // Invoke getPolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.getPolicyTemplate(getPolicyTemplateOptionsModel).execute(); - assertNotNull(response); - PolicyTemplate 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, getPolicyTemplatePath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - } - - // Test the getPolicyTemplate operation with and without retries enabled - @Test - public void testGetPolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetPolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetPolicyTemplateWOptions(); - } - - // Test the getPolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getPolicyTemplate(null).execute(); - } - - // Test the deletePolicyTemplate operation with a valid options model parameter - @Test - public void testDeletePolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deletePolicyTemplatePath = "/v1/policy_templates/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeletePolicyTemplateOptions model - DeletePolicyTemplateOptions deletePolicyTemplateOptionsModel = new DeletePolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .build(); - - // Invoke deletePolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.deletePolicyTemplate(deletePolicyTemplateOptionsModel).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, deletePolicyTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deletePolicyTemplate operation with and without retries enabled - @Test - public void testDeletePolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeletePolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeletePolicyTemplateWOptions(); - } - - // Test the deletePolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deletePolicyTemplate(null).execute(); - } - - // Test the createPolicyTemplateVersion operation with a valid options model parameter - @Test - public void testCreatePolicyTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"counts\": {\"template\": {\"current\": 7, \"limit\": 5}, \"version\": {\"current\": 7, \"limit\": 5}}}"; - String createPolicyTemplateVersionPath = "/v1/policy_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the TemplateGrantRoles model - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the TemplateControl model - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - - // Construct an instance of the TemplatePolicy model - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - - // Construct an instance of the CreatePolicyTemplateVersionOptions model - CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptionsModel = new CreatePolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .policy(templatePolicyModel) - .name("testString") - .description("testString") - .committed(true) - .build(); - - // Invoke createPolicyTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.createPolicyTemplateVersion(createPolicyTemplateVersionOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateLimitData 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createPolicyTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createPolicyTemplateVersion operation with and without retries enabled - @Test - public void testCreatePolicyTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreatePolicyTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreatePolicyTemplateVersionWOptions(); - } - - // Test the createPolicyTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createPolicyTemplateVersion(null).execute(); - } - - // Test the listPolicyTemplateVersions operation with a valid options model parameter - @Test - public void testListPolicyTemplateVersionsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}]}"; - String listPolicyTemplateVersionsPath = "/v1/policy_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListPolicyTemplateVersionsOptions model - ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptionsModel = new ListPolicyTemplateVersionsOptions.Builder() - .policyTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listPolicyTemplateVersions() with a valid options model and verify the result - Response response = iamPolicyManagementService.listPolicyTemplateVersions(listPolicyTemplateVersionsOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateVersionsCollection 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, listPolicyTemplateVersionsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listPolicyTemplateVersions operation with and without retries enabled - @Test - public void testListPolicyTemplateVersionsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListPolicyTemplateVersionsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListPolicyTemplateVersionsWOptions(); - } - - // Test the listPolicyTemplateVersions operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyTemplateVersionsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listPolicyTemplateVersions(null).execute(); - } - - // Test the listPolicyTemplateVersions operation using the PolicyTemplateVersionsPager.getNext() method - @Test - public void testListPolicyTemplateVersionsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions = new ListPolicyTemplateVersionsOptions.Builder() - .policyTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - PolicyTemplateVersionsPager pager = new PolicyTemplateVersionsPager(iamPolicyManagementService, listPolicyTemplateVersionsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listPolicyTemplateVersions operation using the PolicyTemplateVersionsPager.getAll() method - @Test - public void testListPolicyTemplateVersionsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"version\":\"version\",\"committed\":false,\"policy\":{\"type\":\"access\",\"description\":\"description\",\"resource\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}],\"tags\":[{\"key\":\"key\",\"value\":\"value\",\"operator\":\"stringEquals\"}]},\"subject\":{\"attributes\":[{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"}]},\"pattern\":\"pattern\",\"rule\":{\"key\":\"key\",\"operator\":\"stringEquals\",\"value\":\"anyValue\"},\"control\":{\"grant\":{\"roles\":[{\"role_id\":\"roleId\"}]}}},\"state\":\"active\",\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptions = new ListPolicyTemplateVersionsOptions.Builder() - .policyTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - PolicyTemplateVersionsPager pager = new PolicyTemplateVersionsPager(iamPolicyManagementService, listPolicyTemplateVersionsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the replacePolicyTemplate operation with a valid options model parameter - @Test - public void testReplacePolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String replacePolicyTemplatePath = "/v1/policy_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the V2PolicyResourceAttribute model - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicyResourceTag model - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - - // Construct an instance of the V2PolicyResource model - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - - // Construct an instance of the V2PolicySubjectAttribute model - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the V2PolicySubject model - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - - // Construct an instance of the V2PolicyRuleRuleAttribute model - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - - // Construct an instance of the Roles model - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - - // Construct an instance of the TemplateGrantRoles model - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - - // Construct an instance of the TemplateControl model - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - - // Construct an instance of the TemplatePolicy model - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - - // Construct an instance of the ReplacePolicyTemplateOptions model - ReplacePolicyTemplateOptions replacePolicyTemplateOptionsModel = new ReplacePolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .ifMatch("testString") - .policy(templatePolicyModel) - .name("testString") - .description("testString") - .committed(true) - .build(); - - // Invoke replacePolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.replacePolicyTemplate(replacePolicyTemplateOptionsModel).execute(); - assertNotNull(response); - PolicyTemplate 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, replacePolicyTemplatePath); - // 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 replacePolicyTemplate operation with and without retries enabled - @Test - public void testReplacePolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplacePolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplacePolicyTemplateWOptions(); - } - - // Test the replacePolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplacePolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replacePolicyTemplate(null).execute(); - } - - // Test the deletePolicyTemplateVersion operation with a valid options model parameter - @Test - public void testDeletePolicyTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deletePolicyTemplateVersionPath = "/v1/policy_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeletePolicyTemplateVersionOptions model - DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptionsModel = new DeletePolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - - // Invoke deletePolicyTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.deletePolicyTemplateVersion(deletePolicyTemplateVersionOptionsModel).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, deletePolicyTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deletePolicyTemplateVersion operation with and without retries enabled - @Test - public void testDeletePolicyTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeletePolicyTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeletePolicyTemplateVersionWOptions(); - } - - // Test the deletePolicyTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deletePolicyTemplateVersion(null).execute(); - } - - // Test the getPolicyTemplateVersion operation with a valid options model parameter - @Test - public void testGetPolicyTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"version\": \"version\", \"committed\": false, \"policy\": {\"type\": \"access\", \"description\": \"description\", \"resource\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}], \"tags\": [{\"key\": \"key\", \"value\": \"value\", \"operator\": \"stringEquals\"}]}, \"subject\": {\"attributes\": [{\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}]}, \"pattern\": \"pattern\", \"rule\": {\"key\": \"key\", \"operator\": \"stringEquals\", \"value\": \"anyValue\"}, \"control\": {\"grant\": {\"roles\": [{\"role_id\": \"roleId\"}]}}}, \"state\": \"active\", \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\"}"; - String getPolicyTemplateVersionPath = "/v1/policy_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetPolicyTemplateVersionOptions model - GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptionsModel = new GetPolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - - // Invoke getPolicyTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.getPolicyTemplateVersion(getPolicyTemplateVersionOptionsModel).execute(); - assertNotNull(response); - PolicyTemplate 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, getPolicyTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getPolicyTemplateVersion operation with and without retries enabled - @Test - public void testGetPolicyTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetPolicyTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetPolicyTemplateVersionWOptions(); - } - - // Test the getPolicyTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getPolicyTemplateVersion(null).execute(); - } - - // Test the commitPolicyTemplate operation with a valid options model parameter - @Test - public void testCommitPolicyTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String commitPolicyTemplatePath = "/v1/policy_templates/testString/versions/testString/commit"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the CommitPolicyTemplateOptions model - CommitPolicyTemplateOptions commitPolicyTemplateOptionsModel = new CommitPolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - - // Invoke commitPolicyTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.commitPolicyTemplate(commitPolicyTemplateOptionsModel).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, commitPolicyTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the commitPolicyTemplate operation with and without retries enabled - @Test - public void testCommitPolicyTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCommitPolicyTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCommitPolicyTemplateWOptions(); - } - - // Test the commitPolicyTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitPolicyTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.commitPolicyTemplate(null).execute(); - } - - // Test the listPolicyAssignments operation with a valid options model parameter - @Test - public void testListPolicyAssignmentsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}]}"; - String listPolicyAssignmentsPath = "/v1/policy_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListPolicyAssignmentsOptions model - ListPolicyAssignmentsOptions listPolicyAssignmentsOptionsModel = new ListPolicyAssignmentsOptions.Builder() - .version("1.0") - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listPolicyAssignments() with a valid options model and verify the result - Response response = iamPolicyManagementService.listPolicyAssignments(listPolicyAssignmentsOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateAssignmentCollection 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, listPolicyAssignmentsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "1.0"); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("template_id"), "testString"); - assertEquals(query.get("template_version"), "testString"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listPolicyAssignments operation with and without retries enabled - @Test - public void testListPolicyAssignmentsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListPolicyAssignmentsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListPolicyAssignmentsWOptions(); - } - - // Test the listPolicyAssignments operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyAssignmentsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listPolicyAssignments(null).execute(); - } - - // Test the listPolicyAssignments operation using the PolicyAssignmentsPager.getNext() method - @Test - public void testListPolicyAssignmentsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyAssignmentsOptions listPolicyAssignmentsOptions = new ListPolicyAssignmentsOptions.Builder() - .version("1.0") - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - PolicyAssignmentsPager pager = new PolicyAssignmentsPager(iamPolicyManagementService, listPolicyAssignmentsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listPolicyAssignments operation using the PolicyAssignmentsPager.getAll() method - @Test - public void testListPolicyAssignmentsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"policy\":{\"resource_created\":{\"id\":\"id\"},\"status\":\"status\",\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"subject\":{\"id\":\"id\",\"type\":\"iam_id\"},\"template\":{\"id\":\"id\",\"version\":\"version\"},\"status\":\"in_progress\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListPolicyAssignmentsOptions listPolicyAssignmentsOptions = new ListPolicyAssignmentsOptions.Builder() - .version("1.0") - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - PolicyAssignmentsPager pager = new PolicyAssignmentsPager(iamPolicyManagementService, listPolicyAssignmentsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createPolicyTemplateAssignment operation with a valid options model parameter - @Test - public void testCreatePolicyTemplateAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}]}"; - String createPolicyTemplateAssignmentPath = "/v1/policy_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the AssignmentTargetDetails model - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - - // Construct an instance of the AssignmentTemplateDetails model - AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() - .id("testString") - .version("testString") - .build(); - - // Construct an instance of the CreatePolicyTemplateAssignmentOptions model - CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptionsModel = new CreatePolicyTemplateAssignmentOptions.Builder() - .version("1.0") - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(assignmentTemplateDetailsModel)) - .acceptLanguage("default") - .build(); - - // Invoke createPolicyTemplateAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.createPolicyTemplateAssignment(createPolicyTemplateAssignmentOptionsModel).execute(); - assertNotNull(response); - PolicyAssignmentV1Collection 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createPolicyTemplateAssignmentPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "1.0"); - } - - // Test the createPolicyTemplateAssignment operation with and without retries enabled - @Test - public void testCreatePolicyTemplateAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreatePolicyTemplateAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreatePolicyTemplateAssignmentWOptions(); - } - - // Test the createPolicyTemplateAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createPolicyTemplateAssignment(null).execute(); - } - - // Test the getPolicyAssignment operation with a valid options model parameter - @Test - public void testGetPolicyAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}"; - String getPolicyAssignmentPath = "/v1/policy_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetPolicyAssignmentOptions model - GetPolicyAssignmentOptions getPolicyAssignmentOptionsModel = new GetPolicyAssignmentOptions.Builder() - .assignmentId("testString") - .version("1.0") - .build(); - - // Invoke getPolicyAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.getPolicyAssignment(getPolicyAssignmentOptionsModel).execute(); - assertNotNull(response); - PolicyTemplateAssignmentItems 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, getPolicyAssignmentPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "1.0"); - } - - // Test the getPolicyAssignment operation with and without retries enabled - @Test - public void testGetPolicyAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetPolicyAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetPolicyAssignmentWOptions(); - } - - // Test the getPolicyAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getPolicyAssignment(null).execute(); - } - - // Test the updatePolicyAssignment operation with a valid options model parameter - @Test - public void testUpdatePolicyAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"policy\": {\"resource_created\": {\"id\": \"id\"}, \"status\": \"status\", \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"subject\": {\"id\": \"id\", \"type\": \"iam_id\"}, \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"status\": \"in_progress\"}"; - String updatePolicyAssignmentPath = "/v1/policy_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdatePolicyAssignmentOptions model - UpdatePolicyAssignmentOptions updatePolicyAssignmentOptionsModel = new UpdatePolicyAssignmentOptions.Builder() - .assignmentId("testString") - .version("1.0") - .ifMatch("testString") - .templateVersion("testString") - .build(); - - // Invoke updatePolicyAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.updatePolicyAssignment(updatePolicyAssignmentOptionsModel).execute(); - assertNotNull(response); - PolicyAssignmentV1 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updatePolicyAssignmentPath); - // Verify header parameters - assertEquals(request.getHeader("If-Match"), "testString"); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "1.0"); - } - - // Test the updatePolicyAssignment operation with and without retries enabled - @Test - public void testUpdatePolicyAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdatePolicyAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdatePolicyAssignmentWOptions(); - } - - // Test the updatePolicyAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdatePolicyAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updatePolicyAssignment(null).execute(); - } - - // Test the deletePolicyAssignment operation with a valid options model parameter - @Test - public void testDeletePolicyAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deletePolicyAssignmentPath = "/v1/policy_assignments/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeletePolicyAssignmentOptions model - DeletePolicyAssignmentOptions deletePolicyAssignmentOptionsModel = new DeletePolicyAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke deletePolicyAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.deletePolicyAssignment(deletePolicyAssignmentOptionsModel).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, deletePolicyAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deletePolicyAssignment operation with and without retries enabled - @Test - public void testDeletePolicyAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeletePolicyAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeletePolicyAssignmentWOptions(); - } - - // Test the deletePolicyAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deletePolicyAssignment(null).execute(); - } - - // Test the getSettings operation with a valid options model parameter - @Test - public void testGetSettingsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"external_account_identity_interaction\": {\"identity_types\": {\"user\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service_id\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}}}}"; - String getSettingsPath = "/v1/accounts/testString/settings/access_management"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetSettingsOptions model - GetSettingsOptions getSettingsOptionsModel = new GetSettingsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .build(); - - // Invoke getSettings() with a valid options model and verify the result - Response response = iamPolicyManagementService.getSettings(getSettingsOptionsModel).execute(); - assertNotNull(response); - AccountSettingsAccessManagement 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, getSettingsPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getSettings operation with and without retries enabled - @Test - public void testGetSettingsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetSettingsWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetSettingsWOptions(); - } - - // Test the getSettings operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetSettingsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getSettings(null).execute(); - } - - // Test the updateSettings operation with a valid options model parameter - @Test - public void testUpdateSettingsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"external_account_identity_interaction\": {\"identity_types\": {\"user\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service_id\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}, \"service\": {\"state\": \"enabled\", \"external_allowed_accounts\": [\"externalAllowedAccounts\"]}}}}"; - String updateSettingsPath = "/v1/accounts/testString/settings/access_management"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the IdentityTypesBase model - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the IdentityTypesPatch model - IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() - .user(identityTypesBaseModel) - .serviceId(identityTypesBaseModel) - .service(identityTypesBaseModel) - .build(); - - // Construct an instance of the ExternalAccountIdentityInteractionPatch model - ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() - .identityTypes(identityTypesPatchModel) - .build(); - - // Construct an instance of the UpdateSettingsOptions model - UpdateSettingsOptions updateSettingsOptionsModel = new UpdateSettingsOptions.Builder() - .accountId("testString") - .ifMatch("testString") - .externalAccountIdentityInteraction(externalAccountIdentityInteractionPatchModel) - .acceptLanguage("default") - .build(); - - // Invoke updateSettings() with a valid options model and verify the result - Response response = iamPolicyManagementService.updateSettings(updateSettingsOptionsModel).execute(); - assertNotNull(response); - AccountSettingsAccessManagement 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateSettingsPath); - // 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 updateSettings operation with and without retries enabled - @Test - public void testUpdateSettingsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdateSettingsWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdateSettingsWOptions(); - } - - // Test the updateSettings operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateSettingsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updateSettings(null).execute(); - } - - // Test the listActionControlTemplates operation with a valid options model parameter - @Test - public void testListActionControlTemplatesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"action_control_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; - String listActionControlTemplatesPath = "/v1/action_control_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListActionControlTemplatesOptions model - ListActionControlTemplatesOptions listActionControlTemplatesOptionsModel = new ListActionControlTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listActionControlTemplates() with a valid options model and verify the result - Response response = iamPolicyManagementService.listActionControlTemplates(listActionControlTemplatesOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplateCollection 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, listActionControlTemplatesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listActionControlTemplates operation with and without retries enabled - @Test - public void testListActionControlTemplatesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListActionControlTemplatesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListActionControlTemplatesWOptions(); - } - - // Test the listActionControlTemplates operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlTemplatesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listActionControlTemplates(null).execute(); - } - - // Test the listActionControlTemplates operation using the ActionControlTemplatesPager.getNext() method - @Test - public void testListActionControlTemplatesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlTemplatesOptions listActionControlTemplatesOptions = new ListActionControlTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - ActionControlTemplatesPager pager = new ActionControlTemplatesPager(iamPolicyManagementService, listActionControlTemplatesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listActionControlTemplates operation using the ActionControlTemplatesPager.getAll() method - @Test - public void testListActionControlTemplatesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"action_control_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlTemplatesOptions listActionControlTemplatesOptions = new ListActionControlTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .limit(Long.valueOf("10")) - .build(); - - ActionControlTemplatesPager pager = new ActionControlTemplatesPager(iamPolicyManagementService, listActionControlTemplatesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createActionControlTemplate operation with a valid options model parameter - @Test - public void testCreateActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String createActionControlTemplatePath = "/v1/action_control_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateActionControl model - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the CreateActionControlTemplateOptions model - CreateActionControlTemplateOptions createActionControlTemplateOptionsModel = new CreateActionControlTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .description("testString") - .committed(true) - .actionControl(templateActionControlModel) - .acceptLanguage("default") - .build(); - - // Invoke createActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.createActionControlTemplate(createActionControlTemplateOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createActionControlTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createActionControlTemplate operation with and without retries enabled - @Test - public void testCreateActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateActionControlTemplateWOptions(); - } - - // Test the createActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createActionControlTemplate(null).execute(); - } - - // Test the getActionControlTemplate operation with a valid options model parameter - @Test - public void testGetActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String getActionControlTemplatePath = "/v1/action_control_templates/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetActionControlTemplateOptions model - GetActionControlTemplateOptions getActionControlTemplateOptionsModel = new GetActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .build(); - - // Invoke getActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.getActionControlTemplate(getActionControlTemplateOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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, getActionControlTemplatePath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - } - - // Test the getActionControlTemplate operation with and without retries enabled - @Test - public void testGetActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetActionControlTemplateWOptions(); - } - - // Test the getActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getActionControlTemplate(null).execute(); - } - - // Test the deleteActionControlTemplate operation with a valid options model parameter - @Test - public void testDeleteActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteActionControlTemplatePath = "/v1/action_control_templates/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteActionControlTemplateOptions model - DeleteActionControlTemplateOptions deleteActionControlTemplateOptionsModel = new DeleteActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .build(); - - // Invoke deleteActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteActionControlTemplate(deleteActionControlTemplateOptionsModel).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, deleteActionControlTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteActionControlTemplate operation with and without retries enabled - @Test - public void testDeleteActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteActionControlTemplateWOptions(); - } - - // Test the deleteActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteActionControlTemplate(null).execute(); - } - - // Test the createActionControlTemplateVersion operation with a valid options model parameter - @Test - public void testCreateActionControlTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String createActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateActionControl model - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the CreateActionControlTemplateVersionOptions model - CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptionsModel = new CreateActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .name("testString") - .description("testString") - .actionControl(templateActionControlModel) - .committed(true) - .build(); - - // Invoke createActionControlTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.createActionControlTemplateVersion(createActionControlTemplateVersionOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createActionControlTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createActionControlTemplateVersion operation with and without retries enabled - @Test - public void testCreateActionControlTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateActionControlTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateActionControlTemplateVersionWOptions(); - } - - // Test the createActionControlTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createActionControlTemplateVersion(null).execute(); - } - - // Test the listActionControlTemplateVersions operation with a valid options model parameter - @Test - public void testListActionControlTemplateVersionsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; - String listActionControlTemplateVersionsPath = "/v1/action_control_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListActionControlTemplateVersionsOptions model - ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptionsModel = new ListActionControlTemplateVersionsOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listActionControlTemplateVersions() with a valid options model and verify the result - Response response = iamPolicyManagementService.listActionControlTemplateVersions(listActionControlTemplateVersionsOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplateVersionsCollection 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, listActionControlTemplateVersionsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listActionControlTemplateVersions operation with and without retries enabled - @Test - public void testListActionControlTemplateVersionsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListActionControlTemplateVersionsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListActionControlTemplateVersionsWOptions(); - } - - // Test the listActionControlTemplateVersions operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlTemplateVersionsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listActionControlTemplateVersions(null).execute(); - } - - // Test the listActionControlTemplateVersions operation using the ActionControlTemplateVersionsPager.getNext() method - @Test - public void testListActionControlTemplateVersionsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions = new ListActionControlTemplateVersionsOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - ActionControlTemplateVersionsPager pager = new ActionControlTemplateVersionsPager(iamPolicyManagementService, listActionControlTemplateVersionsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listActionControlTemplateVersions operation using the ActionControlTemplateVersionsPager.getAll() method - @Test - public void testListActionControlTemplateVersionsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"action_control\":{\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptions = new ListActionControlTemplateVersionsOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - ActionControlTemplateVersionsPager pager = new ActionControlTemplateVersionsPager(iamPolicyManagementService, listActionControlTemplateVersionsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the replaceActionControlTemplate operation with a valid options model parameter - @Test - public void testReplaceActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String replaceActionControlTemplatePath = "/v1/action_control_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateActionControl model - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the ReplaceActionControlTemplateOptions model - ReplaceActionControlTemplateOptions replaceActionControlTemplateOptionsModel = new ReplaceActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .ifMatch("testString") - .name("testString") - .description("testString") - .actionControl(templateActionControlModel) - .committed(true) - .build(); - - // Invoke replaceActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.replaceActionControlTemplate(replaceActionControlTemplateOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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, replaceActionControlTemplatePath); - // 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 replaceActionControlTemplate operation with and without retries enabled - @Test - public void testReplaceActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplaceActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplaceActionControlTemplateWOptions(); - } - - // Test the replaceActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replaceActionControlTemplate(null).execute(); - } - - // Test the deleteActionControlTemplateVersion operation with a valid options model parameter - @Test - public void testDeleteActionControlTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteActionControlTemplateVersionOptions model - DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptionsModel = new DeleteActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - - // Invoke deleteActionControlTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteActionControlTemplateVersion(deleteActionControlTemplateVersionOptionsModel).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, deleteActionControlTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteActionControlTemplateVersion operation with and without retries enabled - @Test - public void testDeleteActionControlTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteActionControlTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteActionControlTemplateVersionWOptions(); - } - - // Test the deleteActionControlTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteActionControlTemplateVersion(null).execute(); - } - - // Test the getActionControlTemplateVersion operation with a valid options model parameter - @Test - public void testGetActionControlTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"action_control\": {\"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String getActionControlTemplateVersionPath = "/v1/action_control_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetActionControlTemplateVersionOptions model - GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptionsModel = new GetActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - - // Invoke getActionControlTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.getActionControlTemplateVersion(getActionControlTemplateVersionOptionsModel).execute(); - assertNotNull(response); - ActionControlTemplate 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, getActionControlTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getActionControlTemplateVersion operation with and without retries enabled - @Test - public void testGetActionControlTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetActionControlTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetActionControlTemplateVersionWOptions(); - } - - // Test the getActionControlTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getActionControlTemplateVersion(null).execute(); - } - - // Test the commitActionControlTemplate operation with a valid options model parameter - @Test - public void testCommitActionControlTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String commitActionControlTemplatePath = "/v1/action_control_templates/testString/versions/testString/commit"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the CommitActionControlTemplateOptions model - CommitActionControlTemplateOptions commitActionControlTemplateOptionsModel = new CommitActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - - // Invoke commitActionControlTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.commitActionControlTemplate(commitActionControlTemplateOptionsModel).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, commitActionControlTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the commitActionControlTemplate operation with and without retries enabled - @Test - public void testCommitActionControlTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCommitActionControlTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCommitActionControlTemplateWOptions(); - } - - // Test the commitActionControlTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitActionControlTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.commitActionControlTemplate(null).execute(); - } - - // Test the listActionControlAssignments operation with a valid options model parameter - @Test - public void testListActionControlAssignmentsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; - String listActionControlAssignmentsPath = "/v1/action_control_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListActionControlAssignmentsOptions model - ListActionControlAssignmentsOptions listActionControlAssignmentsOptionsModel = new ListActionControlAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listActionControlAssignments() with a valid options model and verify the result - Response response = iamPolicyManagementService.listActionControlAssignments(listActionControlAssignmentsOptionsModel).execute(); - assertNotNull(response); - ActionControlAssignmentCollection 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, listActionControlAssignmentsPath); - // 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(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listActionControlAssignments operation with and without retries enabled - @Test - public void testListActionControlAssignmentsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListActionControlAssignmentsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListActionControlAssignmentsWOptions(); - } - - // Test the listActionControlAssignments operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlAssignmentsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listActionControlAssignments(null).execute(); - } - - // Test the listActionControlAssignments operation using the ActionControlAssignmentsPager.getNext() method - @Test - public void testListActionControlAssignmentsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlAssignmentsOptions listActionControlAssignmentsOptions = new ListActionControlAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - ActionControlAssignmentsPager pager = new ActionControlAssignmentsPager(iamPolicyManagementService, listActionControlAssignmentsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listActionControlAssignments operation using the ActionControlAssignmentsPager.getAll() method - @Test - public void testListActionControlAssignmentsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"action_control\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListActionControlAssignmentsOptions listActionControlAssignmentsOptions = new ListActionControlAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - ActionControlAssignmentsPager pager = new ActionControlAssignmentsPager(iamPolicyManagementService, listActionControlAssignmentsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createActionControlTemplateAssignment operation with a valid options model parameter - @Test - public void testCreateActionControlTemplateAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; - String createActionControlTemplateAssignmentPath = "/v1/action_control_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the AssignmentTargetDetails model - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - - // Construct an instance of the ActionControlAssignmentTemplate model - ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - - // Construct an instance of the CreateActionControlTemplateAssignmentOptions model - CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptionsModel = new CreateActionControlTemplateAssignmentOptions.Builder() - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(actionControlAssignmentTemplateModel)) - .acceptLanguage("default") - .build(); - - // Invoke createActionControlTemplateAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.createActionControlTemplateAssignment(createActionControlTemplateAssignmentOptionsModel).execute(); - assertNotNull(response); - ActionControlAssignmentCollection 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createActionControlTemplateAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createActionControlTemplateAssignment operation with and without retries enabled - @Test - public void testCreateActionControlTemplateAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateActionControlTemplateAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateActionControlTemplateAssignmentWOptions(); - } - - // Test the createActionControlTemplateAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createActionControlTemplateAssignment(null).execute(); - } - - // Test the getActionControlAssignment operation with a valid options model parameter - @Test - public void testGetActionControlAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; - String getActionControlAssignmentPath = "/v1/action_control_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetActionControlAssignmentOptions model - GetActionControlAssignmentOptions getActionControlAssignmentOptionsModel = new GetActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke getActionControlAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.getActionControlAssignment(getActionControlAssignmentOptionsModel).execute(); - assertNotNull(response); - ActionControlAssignment 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, getActionControlAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getActionControlAssignment operation with and without retries enabled - @Test - public void testGetActionControlAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetActionControlAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetActionControlAssignmentWOptions(); - } - - // Test the getActionControlAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getActionControlAssignment(null).execute(); - } - - // Test the updateActionControlAssignment operation with a valid options model parameter - @Test - public void testUpdateActionControlAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"action_control\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; - String updateActionControlAssignmentPath = "/v1/action_control_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdateActionControlAssignmentOptions model - UpdateActionControlAssignmentOptions updateActionControlAssignmentOptionsModel = new UpdateActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .ifMatch("testString") - .templateVersion("testString") - .build(); - - // Invoke updateActionControlAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.updateActionControlAssignment(updateActionControlAssignmentOptionsModel).execute(); - assertNotNull(response); - ActionControlAssignment 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateActionControlAssignmentPath); - // 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 updateActionControlAssignment operation with and without retries enabled - @Test - public void testUpdateActionControlAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdateActionControlAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdateActionControlAssignmentWOptions(); - } - - // Test the updateActionControlAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateActionControlAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updateActionControlAssignment(null).execute(); - } - - // Test the deleteActionControlAssignment operation with a valid options model parameter - @Test - public void testDeleteActionControlAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteActionControlAssignmentPath = "/v1/action_control_assignments/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteActionControlAssignmentOptions model - DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptionsModel = new DeleteActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke deleteActionControlAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteActionControlAssignment(deleteActionControlAssignmentOptionsModel).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, deleteActionControlAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteActionControlAssignment operation with and without retries enabled - @Test - public void testDeleteActionControlAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteActionControlAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteActionControlAssignmentWOptions(); - } - - // Test the deleteActionControlAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteActionControlAssignment(null).execute(); - } - - // Test the listRoleTemplates operation with a valid options model parameter - @Test - public void testListRoleTemplatesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"role_templates\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; - String listRoleTemplatesPath = "/v1/role_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListRoleTemplatesOptions model - ListRoleTemplatesOptions listRoleTemplatesOptionsModel = new ListRoleTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .name("testString") - .roleName("testString") - .roleServiceName("testString") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listRoleTemplates() with a valid options model and verify the result - Response response = iamPolicyManagementService.listRoleTemplates(listRoleTemplatesOptionsModel).execute(); - assertNotNull(response); - RoleTemplateCollection 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, listRoleTemplatesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("account_id"), "testString"); - assertEquals(query.get("name"), "testString"); - assertEquals(query.get("role_name"), "testString"); - assertEquals(query.get("role_service_name"), "testString"); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listRoleTemplates operation with and without retries enabled - @Test - public void testListRoleTemplatesWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListRoleTemplatesWOptions(); - - iamPolicyManagementService.disableRetries(); - testListRoleTemplatesWOptions(); - } - - // Test the listRoleTemplates operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleTemplatesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listRoleTemplates(null).execute(); - } - - // Test the listRoleTemplates operation using the RoleTemplatesPager.getNext() method - @Test - public void testListRoleTemplatesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleTemplatesOptions listRoleTemplatesOptions = new ListRoleTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .name("testString") - .roleName("testString") - .roleServiceName("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - RoleTemplatesPager pager = new RoleTemplatesPager(iamPolicyManagementService, listRoleTemplatesOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listRoleTemplates operation using the RoleTemplatesPager.getAll() method - @Test - public void testListRoleTemplatesWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"role_templates\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}]}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleTemplatesOptions listRoleTemplatesOptions = new ListRoleTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .name("testString") - .roleName("testString") - .roleServiceName("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - RoleTemplatesPager pager = new RoleTemplatesPager(iamPolicyManagementService, listRoleTemplatesOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createRoleTemplate operation with a valid options model parameter - @Test - public void testCreateRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String createRoleTemplatePath = "/v1/role_templates"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the RoleTemplatePrototypeRole model - RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() - .name("testString") - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the CreateRoleTemplateOptions model - CreateRoleTemplateOptions createRoleTemplateOptionsModel = new CreateRoleTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .description("testString") - .committed(true) - .role(roleTemplatePrototypeRoleModel) - .acceptLanguage("default") - .build(); - - // Invoke createRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.createRoleTemplate(createRoleTemplateOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createRoleTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createRoleTemplate operation with and without retries enabled - @Test - public void testCreateRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateRoleTemplateWOptions(); - } - - // Test the createRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createRoleTemplate(null).execute(); - } - - // Test the getRoleTemplate operation with a valid options model parameter - @Test - public void testGetRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String getRoleTemplatePath = "/v1/role_templates/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetRoleTemplateOptions model - GetRoleTemplateOptions getRoleTemplateOptionsModel = new GetRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .state("active") - .build(); - - // Invoke getRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.getRoleTemplate(getRoleTemplateOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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, getRoleTemplatePath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - } - - // Test the getRoleTemplate operation with and without retries enabled - @Test - public void testGetRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetRoleTemplateWOptions(); - } - - // Test the getRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getRoleTemplate(null).execute(); - } - - // Test the deleteRoleTemplate operation with a valid options model parameter - @Test - public void testDeleteRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteRoleTemplatePath = "/v1/role_templates/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteRoleTemplateOptions model - DeleteRoleTemplateOptions deleteRoleTemplateOptionsModel = new DeleteRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .build(); - - // Invoke deleteRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteRoleTemplate(deleteRoleTemplateOptionsModel).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, deleteRoleTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteRoleTemplate operation with and without retries enabled - @Test - public void testDeleteRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteRoleTemplateWOptions(); - } - - // Test the deleteRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteRoleTemplate(null).execute(); - } - - // Test the createRoleTemplateVersion operation with a valid options model parameter - @Test - public void testCreateRoleTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String createRoleTemplateVersionPath = "/v1/role_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateRole model - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the CreateRoleTemplateVersionOptions model - CreateRoleTemplateVersionOptions createRoleTemplateVersionOptionsModel = new CreateRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .name("testString") - .description("testString") - .role(templateRoleModel) - .committed(true) - .build(); - - // Invoke createRoleTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.createRoleTemplateVersion(createRoleTemplateVersionOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createRoleTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createRoleTemplateVersion operation with and without retries enabled - @Test - public void testCreateRoleTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateRoleTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateRoleTemplateVersionWOptions(); - } - - // Test the createRoleTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createRoleTemplateVersion(null).execute(); - } - - // Test the listRoleTemplateVersions operation with a valid options model parameter - @Test - public void testListRoleTemplateVersionsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"versions\": [{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}]}"; - String listRoleTemplateVersionsPath = "/v1/role_templates/testString/versions"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListRoleTemplateVersionsOptions model - ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptionsModel = new ListRoleTemplateVersionsOptions.Builder() - .roleTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listRoleTemplateVersions() with a valid options model and verify the result - Response response = iamPolicyManagementService.listRoleTemplateVersions(listRoleTemplateVersionsOptionsModel).execute(); - assertNotNull(response); - RoleTemplateVersionsCollection 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, listRoleTemplateVersionsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("state"), "active"); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listRoleTemplateVersions operation with and without retries enabled - @Test - public void testListRoleTemplateVersionsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListRoleTemplateVersionsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListRoleTemplateVersionsWOptions(); - } - - // Test the listRoleTemplateVersions operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleTemplateVersionsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listRoleTemplateVersions(null).execute(); - } - - // Test the listRoleTemplateVersions operation using the RoleTemplateVersionsPager.getNext() method - @Test - public void testListRoleTemplateVersionsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions = new ListRoleTemplateVersionsOptions.Builder() - .roleTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - RoleTemplateVersionsPager pager = new RoleTemplateVersionsPager(iamPolicyManagementService, listRoleTemplateVersionsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listRoleTemplateVersions operation using the RoleTemplateVersionsPager.getAll() method - @Test - public void testListRoleTemplateVersionsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"versions\":[{\"name\":\"name\",\"description\":\"description\",\"account_id\":\"accountId\",\"committed\":false,\"role\":{\"name\":\"name\",\"display_name\":\"displayName\",\"service_name\":\"serviceName\",\"description\":\"description\",\"actions\":[\"actions\"]},\"id\":\"id\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"version\":\"version\",\"state\":\"active\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptions = new ListRoleTemplateVersionsOptions.Builder() - .roleTemplateId("testString") - .state("active") - .limit(Long.valueOf("10")) - .build(); - - RoleTemplateVersionsPager pager = new RoleTemplateVersionsPager(iamPolicyManagementService, listRoleTemplateVersionsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the replaceRoleTemplate operation with a valid options model parameter - @Test - public void testReplaceRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String replaceRoleTemplatePath = "/v1/role_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the TemplateRole model - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the ReplaceRoleTemplateOptions model - ReplaceRoleTemplateOptions replaceRoleTemplateOptionsModel = new ReplaceRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .ifMatch("testString") - .name("testString") - .description("testString") - .role(templateRoleModel) - .committed(true) - .build(); - - // Invoke replaceRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.replaceRoleTemplate(replaceRoleTemplateOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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, replaceRoleTemplatePath); - // 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 replaceRoleTemplate operation with and without retries enabled - @Test - public void testReplaceRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testReplaceRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testReplaceRoleTemplateWOptions(); - } - - // Test the replaceRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.replaceRoleTemplate(null).execute(); - } - - // Test the deleteRoleTemplateVersion operation with a valid options model parameter - @Test - public void testDeleteRoleTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteRoleTemplateVersionPath = "/v1/role_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteRoleTemplateVersionOptions model - DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptionsModel = new DeleteRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - - // Invoke deleteRoleTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteRoleTemplateVersion(deleteRoleTemplateVersionOptionsModel).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, deleteRoleTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteRoleTemplateVersion operation with and without retries enabled - @Test - public void testDeleteRoleTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteRoleTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteRoleTemplateVersionWOptions(); - } - - // Test the deleteRoleTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteRoleTemplateVersion(null).execute(); - } - - // Test the getRoleTemplateVersion operation with a valid options model parameter - @Test - public void testGetRoleTemplateVersionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"name\": \"name\", \"description\": \"description\", \"account_id\": \"accountId\", \"committed\": false, \"role\": {\"name\": \"name\", \"display_name\": \"displayName\", \"service_name\": \"serviceName\", \"description\": \"description\", \"actions\": [\"actions\"]}, \"id\": \"id\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"version\": \"version\", \"state\": \"active\"}"; - String getRoleTemplateVersionPath = "/v1/role_templates/testString/versions/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetRoleTemplateVersionOptions model - GetRoleTemplateVersionOptions getRoleTemplateVersionOptionsModel = new GetRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - - // Invoke getRoleTemplateVersion() with a valid options model and verify the result - Response response = iamPolicyManagementService.getRoleTemplateVersion(getRoleTemplateVersionOptionsModel).execute(); - assertNotNull(response); - RoleTemplate 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, getRoleTemplateVersionPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getRoleTemplateVersion operation with and without retries enabled - @Test - public void testGetRoleTemplateVersionWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetRoleTemplateVersionWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetRoleTemplateVersionWOptions(); - } - - // Test the getRoleTemplateVersion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleTemplateVersionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getRoleTemplateVersion(null).execute(); - } - - // Test the commitRoleTemplate operation with a valid options model parameter - @Test - public void testCommitRoleTemplateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String commitRoleTemplatePath = "/v1/role_templates/testString/versions/testString/commit"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the CommitRoleTemplateOptions model - CommitRoleTemplateOptions commitRoleTemplateOptionsModel = new CommitRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - - // Invoke commitRoleTemplate() with a valid options model and verify the result - Response response = iamPolicyManagementService.commitRoleTemplate(commitRoleTemplateOptionsModel).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, commitRoleTemplatePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the commitRoleTemplate operation with and without retries enabled - @Test - public void testCommitRoleTemplateWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCommitRoleTemplateWOptions(); - - iamPolicyManagementService.disableRetries(); - testCommitRoleTemplateWOptions(); - } - - // Test the commitRoleTemplate operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitRoleTemplateNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.commitRoleTemplate(null).execute(); - } - - // Test the listRoleAssignments operation with a valid options model parameter - @Test - public void testListRoleAssignmentsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; - String listRoleAssignmentsPath = "/v1/role_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListRoleAssignmentsOptions model - ListRoleAssignmentsOptions listRoleAssignmentsOptionsModel = new ListRoleAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .start("testString") - .build(); - - // Invoke listRoleAssignments() with a valid options model and verify the result - Response response = iamPolicyManagementService.listRoleAssignments(listRoleAssignmentsOptionsModel).execute(); - assertNotNull(response); - RoleAssignmentCollection 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, listRoleAssignmentsPath); - // 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(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); - } - - // Test the listRoleAssignments operation with and without retries enabled - @Test - public void testListRoleAssignmentsWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testListRoleAssignmentsWOptions(); - - iamPolicyManagementService.disableRetries(); - testListRoleAssignmentsWOptions(); - } - - // Test the listRoleAssignments operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleAssignmentsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.listRoleAssignments(null).execute(); - } - - // Test the listRoleAssignments operation using the RoleAssignmentsPager.getNext() method - @Test - public void testListRoleAssignmentsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleAssignmentsOptions listRoleAssignmentsOptions = new ListRoleAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - RoleAssignmentsPager pager = new RoleAssignmentsPager(iamPolicyManagementService, listRoleAssignmentsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listRoleAssignments operation using the RoleAssignmentsPager.getAll() method - @Test - public void testListRoleAssignmentsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"assignments\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"href\":\"href\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"created_by_id\":\"createdById\",\"last_modified_at\":\"2019-01-01T12:00:00.000Z\",\"last_modified_by_id\":\"lastModifiedById\",\"operation\":\"create\",\"resources\":[{\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"role\":{\"resource_created\":{\"id\":\"id\"},\"error_message\":{\"name\":\"name\",\"errorCode\":\"errorCode\",\"message\":\"message\",\"code\":\"code\",\"errors\":[{\"code\":\"insufficent_permissions\",\"message\":\"message\",\"details\":{\"conflicts_with\":{\"etag\":\"etag\",\"role\":\"role\",\"policy\":\"policy\"}},\"more_info\":\"moreInfo\"}]}}}],\"template\":{\"id\":\"id\",\"version\":\"version\"},\"target\":{\"type\":\"Account\",\"id\":\"id\"},\"status\":\"accepted\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListRoleAssignmentsOptions listRoleAssignmentsOptions = new ListRoleAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("10")) - .build(); - - RoleAssignmentsPager pager = new RoleAssignmentsPager(iamPolicyManagementService, listRoleAssignmentsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); - } - - // Test the createRoleTemplateAssignment operation with a valid options model parameter - @Test - public void testCreateRoleTemplateAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"limit\": 1, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"previous\": {\"href\": \"href\", \"start\": \"start\"}, \"assignments\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}]}"; - String createRoleTemplateAssignmentPath = "/v1/role_assignments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the AssignmentTargetDetails model - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - - // Construct an instance of the RoleAssignmentTemplate model - RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - - // Construct an instance of the CreateRoleTemplateAssignmentOptions model - CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptionsModel = new CreateRoleTemplateAssignmentOptions.Builder() - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(roleAssignmentTemplateModel)) - .acceptLanguage("default") - .build(); - - // Invoke createRoleTemplateAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.createRoleTemplateAssignment(createRoleTemplateAssignmentOptionsModel).execute(); - assertNotNull(response); - RoleAssignmentCollection 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createRoleTemplateAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the createRoleTemplateAssignment operation with and without retries enabled - @Test - public void testCreateRoleTemplateAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testCreateRoleTemplateAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testCreateRoleTemplateAssignmentWOptions(); - } - - // Test the createRoleTemplateAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.createRoleTemplateAssignment(null).execute(); - } - - // Test the getRoleAssignment operation with a valid options model parameter - @Test - public void testGetRoleAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; - String getRoleAssignmentPath = "/v1/role_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetRoleAssignmentOptions model - GetRoleAssignmentOptions getRoleAssignmentOptionsModel = new GetRoleAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke getRoleAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.getRoleAssignment(getRoleAssignmentOptionsModel).execute(); - assertNotNull(response); - RoleAssignment 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, getRoleAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getRoleAssignment operation with and without retries enabled - @Test - public void testGetRoleAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testGetRoleAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testGetRoleAssignmentWOptions(); - } - - // Test the getRoleAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.getRoleAssignment(null).execute(); - } - - // Test the updateRoleAssignment operation with a valid options model parameter - @Test - public void testUpdateRoleAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"href\": \"href\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"created_by_id\": \"createdById\", \"last_modified_at\": \"2019-01-01T12:00:00.000Z\", \"last_modified_by_id\": \"lastModifiedById\", \"operation\": \"create\", \"resources\": [{\"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"role\": {\"resource_created\": {\"id\": \"id\"}, \"error_message\": {\"name\": \"name\", \"errorCode\": \"errorCode\", \"message\": \"message\", \"code\": \"code\", \"errors\": [{\"code\": \"insufficent_permissions\", \"message\": \"message\", \"details\": {\"conflicts_with\": {\"etag\": \"etag\", \"role\": \"role\", \"policy\": \"policy\"}}, \"more_info\": \"moreInfo\"}]}}}], \"template\": {\"id\": \"id\", \"version\": \"version\"}, \"target\": {\"type\": \"Account\", \"id\": \"id\"}, \"status\": \"accepted\"}"; - String updateRoleAssignmentPath = "/v1/role_assignments/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdateRoleAssignmentOptions model - UpdateRoleAssignmentOptions updateRoleAssignmentOptionsModel = new UpdateRoleAssignmentOptions.Builder() - .assignmentId("testString") - .ifMatch("testString") - .templateVersion("testString") - .build(); - - // Invoke updateRoleAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.updateRoleAssignment(updateRoleAssignmentOptionsModel).execute(); - assertNotNull(response); - RoleAssignment 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"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateRoleAssignmentPath); - // 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 updateRoleAssignment operation with and without retries enabled - @Test - public void testUpdateRoleAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testUpdateRoleAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testUpdateRoleAssignmentWOptions(); - } - - // Test the updateRoleAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateRoleAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.updateRoleAssignment(null).execute(); - } - - // Test the deleteRoleAssignment operation with a valid options model parameter - @Test - public void testDeleteRoleAssignmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteRoleAssignmentPath = "/v1/role_assignments/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteRoleAssignmentOptions model - DeleteRoleAssignmentOptions deleteRoleAssignmentOptionsModel = new DeleteRoleAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - - // Invoke deleteRoleAssignment() with a valid options model and verify the result - Response response = iamPolicyManagementService.deleteRoleAssignment(deleteRoleAssignmentOptionsModel).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, deleteRoleAssignmentPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the deleteRoleAssignment operation with and without retries enabled - @Test - public void testDeleteRoleAssignmentWRetries() throws Throwable { - iamPolicyManagementService.enableRetries(4, 30); - testDeleteRoleAssignmentWOptions(); - - iamPolicyManagementService.disableRetries(); - testDeleteRoleAssignmentWOptions(); - } - - // Test the deleteRoleAssignment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleAssignmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - iamPolicyManagementService.deleteRoleAssignment(null).execute(); - } - - // Perform setup needed before each test method - @BeforeMethod - public void beforeEachTest() { - // Start the mock server. - try { - server = new MockWebServer(); - server.start(); - } catch (IOException err) { - fail("Failed to instantiate mock web server"); - } - - // Construct an instance of the service - constructClientService(); - } - - // Perform tear down after each test method - @AfterMethod - public void afterEachTest() throws IOException { - server.shutdown(); - iamPolicyManagementService = null; - } - - // Constructs an instance of the service to be used by the tests - public void constructClientService() { - System.setProperty("TESTSERVICE_AUTH_TYPE", "noAuth"); - final String serviceName = "testService"; - - iamPolicyManagementService = IamPolicyManagement.newInstance(serviceName); - String url = server.url("/").toString(); - iamPolicyManagementService.setServiceUrl(url); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java deleted file mode 100644 index 5630ccb0c03..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AccountSettingsAccessManagementTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AccountSettingsAccessManagement; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.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 AccountSettingsAccessManagement model. - */ -public class AccountSettingsAccessManagementTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAccountSettingsAccessManagement() throws Throwable { - AccountSettingsAccessManagement accountSettingsAccessManagementModel = new AccountSettingsAccessManagement(); - assertNull(accountSettingsAccessManagementModel.getExternalAccountIdentityInteraction()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java deleted file mode 100644 index d4dfc8863c6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentCollectionTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentCollection model. - */ -public class ActionControlAssignmentCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentCollection() throws Throwable { - ActionControlAssignmentCollection actionControlAssignmentCollectionModel = new ActionControlAssignmentCollection(); - assertNull(actionControlAssignmentCollectionModel.getLimit()); - assertNull(actionControlAssignmentCollectionModel.getFirst()); - assertNull(actionControlAssignmentCollectionModel.getNext()); - assertNull(actionControlAssignmentCollectionModel.getPrevious()); - assertNull(actionControlAssignmentCollectionModel.getAssignments()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java deleted file mode 100644 index cb53bc44d1c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceActionControlTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResourceActionControl model. - */ -public class ActionControlAssignmentResourceActionControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentResourceActionControl() throws Throwable { - ActionControlAssignmentResourceActionControl actionControlAssignmentResourceActionControlModel = new ActionControlAssignmentResourceActionControl(); - assertNull(actionControlAssignmentResourceActionControlModel.getResourceCreated()); - assertNull(actionControlAssignmentResourceActionControlModel.getErrorMessage()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java deleted file mode 100644 index 284ec17a0f0..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceCreatedTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResourceCreated model. - */ -public class ActionControlAssignmentResourceCreatedTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentResourceCreated() throws Throwable { - ActionControlAssignmentResourceCreated actionControlAssignmentResourceCreatedModel = new ActionControlAssignmentResourceCreated(); - assertNull(actionControlAssignmentResourceCreatedModel.getId()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java deleted file mode 100644 index eaa560dce78..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentResourceTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentResource model. - */ -public class ActionControlAssignmentResourceTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentResource() throws Throwable { - ActionControlAssignmentResource actionControlAssignmentResourceModel = new ActionControlAssignmentResource(); - assertNull(actionControlAssignmentResourceModel.getTarget()); - assertNull(actionControlAssignmentResourceModel.getActionControl()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java deleted file mode 100644 index 262a74bea45..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTemplateTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignmentTemplate model. - */ -public class ActionControlAssignmentTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignmentTemplate() throws Throwable { - ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(actionControlAssignmentTemplateModel.id(), "testString"); - assertEquals(actionControlAssignmentTemplateModel.version(), "testString"); - - String json = TestUtilities.serialize(actionControlAssignmentTemplateModel); - - ActionControlAssignmentTemplate actionControlAssignmentTemplateModelNew = TestUtilities.deserialize(json, ActionControlAssignmentTemplate.class); - assertTrue(actionControlAssignmentTemplateModelNew instanceof ActionControlAssignmentTemplate); - assertEquals(actionControlAssignmentTemplateModelNew.id(), "testString"); - assertEquals(actionControlAssignmentTemplateModelNew.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testActionControlAssignmentTemplateError() throws Throwable { - new ActionControlAssignmentTemplate.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java deleted file mode 100644 index c5173f940c4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlAssignmentTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlAssignment model. - */ -public class ActionControlAssignmentTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlAssignment() throws Throwable { - ActionControlAssignment actionControlAssignmentModel = new ActionControlAssignment(); - assertNull(actionControlAssignmentModel.getTemplate()); - assertNull(actionControlAssignmentModel.getTarget()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java deleted file mode 100644 index 58155ee1e7e..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateCollectionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplateCollection model. - */ -public class ActionControlTemplateCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlTemplateCollection() throws Throwable { - ActionControlTemplateCollection actionControlTemplateCollectionModel = new ActionControlTemplateCollection(); - assertNull(actionControlTemplateCollectionModel.getLimit()); - assertNull(actionControlTemplateCollectionModel.getFirst()); - assertNull(actionControlTemplateCollectionModel.getNext()); - assertNull(actionControlTemplateCollectionModel.getPrevious()); - assertNull(actionControlTemplateCollectionModel.getActionControlTemplates()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java deleted file mode 100644 index a086106a57e..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplate model. - */ -public class ActionControlTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlTemplate() throws Throwable { - ActionControlTemplate actionControlTemplateModel = new ActionControlTemplate(); - assertNull(actionControlTemplateModel.getName()); - assertNull(actionControlTemplateModel.getDescription()); - assertNull(actionControlTemplateModel.getAccountId()); - assertNull(actionControlTemplateModel.isCommitted()); - assertNull(actionControlTemplateModel.getActionControl()); - assertNull(actionControlTemplateModel.getVersion()); - assertNull(actionControlTemplateModel.getState()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java deleted file mode 100644 index 7b6bf014357..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ActionControlTemplateVersionsCollectionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 ActionControlTemplateVersionsCollection model. - */ -public class ActionControlTemplateVersionsCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testActionControlTemplateVersionsCollection() throws Throwable { - ActionControlTemplateVersionsCollection actionControlTemplateVersionsCollectionModel = new ActionControlTemplateVersionsCollection(); - assertNull(actionControlTemplateVersionsCollectionModel.getLimit()); - assertNull(actionControlTemplateVersionsCollectionModel.getFirst()); - assertNull(actionControlTemplateVersionsCollectionModel.getNext()); - assertNull(actionControlTemplateVersionsCollectionModel.getPrevious()); - assertNull(actionControlTemplateVersionsCollectionModel.getVersions()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java deleted file mode 100644 index 4038d52606c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceCreatedTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentResourceCreated model. - */ -public class AssignmentResourceCreatedTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAssignmentResourceCreated() throws Throwable { - AssignmentResourceCreated assignmentResourceCreatedModel = new AssignmentResourceCreated(); - assertNull(assignmentResourceCreatedModel.getId()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java deleted file mode 100644 index 81e3799a42c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentResourceErrorTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentResourceError model. - */ -public class AssignmentResourceErrorTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAssignmentResourceError() throws Throwable { - AssignmentResourceError assignmentResourceErrorModel = new AssignmentResourceError(); - assertNull(assignmentResourceErrorModel.getName()); - assertNull(assignmentResourceErrorModel.getErrorCode()); - assertNull(assignmentResourceErrorModel.getMessage()); - assertNull(assignmentResourceErrorModel.getCode()); - assertNull(assignmentResourceErrorModel.getErrors()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java deleted file mode 100644 index 48e4a605cbb..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTargetDetailsTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentTargetDetails model. - */ -public class AssignmentTargetDetailsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAssignmentTargetDetails() throws Throwable { - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - assertEquals(assignmentTargetDetailsModel.type(), "Account"); - assertEquals(assignmentTargetDetailsModel.id(), "testString"); - - String json = TestUtilities.serialize(assignmentTargetDetailsModel); - - AssignmentTargetDetails assignmentTargetDetailsModelNew = TestUtilities.deserialize(json, AssignmentTargetDetails.class); - assertTrue(assignmentTargetDetailsModelNew instanceof AssignmentTargetDetails); - assertEquals(assignmentTargetDetailsModelNew.type(), "Account"); - assertEquals(assignmentTargetDetailsModelNew.id(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testAssignmentTargetDetailsError() throws Throwable { - new AssignmentTargetDetails.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java deleted file mode 100644 index bcecf27ed27..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/AssignmentTemplateDetailsTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.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 AssignmentTemplateDetails model. - */ -public class AssignmentTemplateDetailsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAssignmentTemplateDetails() throws Throwable { - AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(assignmentTemplateDetailsModel.id(), "testString"); - assertEquals(assignmentTemplateDetailsModel.version(), "testString"); - - String json = TestUtilities.serialize(assignmentTemplateDetailsModel); - - AssignmentTemplateDetails assignmentTemplateDetailsModelNew = TestUtilities.deserialize(json, AssignmentTemplateDetails.class); - assertTrue(assignmentTemplateDetailsModelNew instanceof AssignmentTemplateDetails); - assertEquals(assignmentTemplateDetailsModelNew.id(), "testString"); - assertEquals(assignmentTemplateDetailsModelNew.version(), "testString"); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java deleted file mode 100644 index 2b5ed42c76a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CommitActionControlTemplateOptions model. - */ -public class CommitActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCommitActionControlTemplateOptions() throws Throwable { - CommitActionControlTemplateOptions commitActionControlTemplateOptionsModel = new CommitActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - assertEquals(commitActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(commitActionControlTemplateOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitActionControlTemplateOptionsError() throws Throwable { - new CommitActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java deleted file mode 100644 index 66cdca59588..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitPolicyTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CommitPolicyTemplateOptions model. - */ -public class CommitPolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCommitPolicyTemplateOptions() throws Throwable { - CommitPolicyTemplateOptions commitPolicyTemplateOptionsModel = new CommitPolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - assertEquals(commitPolicyTemplateOptionsModel.policyTemplateId(), "testString"); - assertEquals(commitPolicyTemplateOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitPolicyTemplateOptionsError() throws Throwable { - new CommitPolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java deleted file mode 100644 index 09c48b8e80e..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CommitRoleTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CommitRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CommitRoleTemplateOptions model. - */ -public class CommitRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCommitRoleTemplateOptions() throws Throwable { - CommitRoleTemplateOptions commitRoleTemplateOptionsModel = new CommitRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - assertEquals(commitRoleTemplateOptionsModel.roleTemplateId(), "testString"); - assertEquals(commitRoleTemplateOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCommitRoleTemplateOptionsError() throws Throwable { - new CommitRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java deleted file mode 100644 index 94ef6ce21e8..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ConflictsWithTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.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 ConflictsWith model. - */ -public class ConflictsWithTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testConflictsWith() throws Throwable { - ConflictsWith conflictsWithModel = new ConflictsWith(); - assertNull(conflictsWithModel.getEtag()); - assertNull(conflictsWithModel.getRole()); - assertNull(conflictsWithModel.getPolicy()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java deleted file mode 100644 index bbe19a7b9b1..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponseControl model. - */ -public class ControlResponseControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testControlResponseControl() throws Throwable { - ControlResponseControl controlResponseControlModel = new ControlResponseControl(); - assertNull(controlResponseControlModel.getGrant()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java deleted file mode 100644 index 7b2fbfae90d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseControlWithEnrichedRolesTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControlWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponseControlWithEnrichedRoles model. - */ -public class ControlResponseControlWithEnrichedRolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testControlResponseControlWithEnrichedRoles() throws Throwable { - ControlResponseControlWithEnrichedRoles controlResponseControlWithEnrichedRolesModel = new ControlResponseControlWithEnrichedRoles(); - assertNull(controlResponseControlWithEnrichedRolesModel.getGrant()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java deleted file mode 100644 index f42cbc0a2d8..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlResponseTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponse; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 ControlResponse model. - */ -public class ControlResponseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testControlResponse() throws Throwable { - ControlResponse controlResponseModel = new ControlResponse(); - assertNotNull(controlResponseModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java deleted file mode 100644 index c8b1e3000f9..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ControlTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 Control model. - */ -public class ControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testControl() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); - - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - assertEquals(controlModel.grant(), grantModel); - - String json = TestUtilities.serialize(controlModel); - - Control controlModelNew = TestUtilities.deserialize(json, Control.class); - assertTrue(controlModelNew instanceof Control); - assertEquals(controlModelNew.grant().toString(), grantModel.toString()); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testControlError() throws Throwable { - new Control.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java deleted file mode 100644 index f2557c8f64f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateAssignmentOptionsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ActionControlAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateAssignmentOptions model. - */ -public class CreateActionControlTemplateAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateActionControlTemplateAssignmentOptions() throws Throwable { - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - assertEquals(assignmentTargetDetailsModel.type(), "Account"); - assertEquals(assignmentTargetDetailsModel.id(), "testString"); - - ActionControlAssignmentTemplate actionControlAssignmentTemplateModel = new ActionControlAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(actionControlAssignmentTemplateModel.id(), "testString"); - assertEquals(actionControlAssignmentTemplateModel.version(), "testString"); - - CreateActionControlTemplateAssignmentOptions createActionControlTemplateAssignmentOptionsModel = new CreateActionControlTemplateAssignmentOptions.Builder() - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(actionControlAssignmentTemplateModel)) - .acceptLanguage("default") - .build(); - assertEquals(createActionControlTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); - assertEquals(createActionControlTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(actionControlAssignmentTemplateModel)); - assertEquals(createActionControlTemplateAssignmentOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateAssignmentOptionsError() throws Throwable { - new CreateActionControlTemplateAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java deleted file mode 100644 index 2508072a03c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateOptions model. - */ -public class CreateActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateActionControlTemplateOptions() throws Throwable { - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateActionControlModel.serviceName(), "testString"); - assertEquals(templateActionControlModel.description(), "testString"); - assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); - - CreateActionControlTemplateOptions createActionControlTemplateOptionsModel = new CreateActionControlTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .description("testString") - .committed(true) - .actionControl(templateActionControlModel) - .acceptLanguage("default") - .build(); - assertEquals(createActionControlTemplateOptionsModel.name(), "testString"); - assertEquals(createActionControlTemplateOptionsModel.accountId(), "testString"); - assertEquals(createActionControlTemplateOptionsModel.description(), "testString"); - assertEquals(createActionControlTemplateOptionsModel.committed(), Boolean.valueOf(true)); - assertEquals(createActionControlTemplateOptionsModel.actionControl(), templateActionControlModel); - assertEquals(createActionControlTemplateOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateOptionsError() throws Throwable { - new CreateActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java deleted file mode 100644 index d5070249115..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateActionControlTemplateVersionOptionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateActionControlTemplateVersionOptions model. - */ -public class CreateActionControlTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateActionControlTemplateVersionOptions() throws Throwable { - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateActionControlModel.serviceName(), "testString"); - assertEquals(templateActionControlModel.description(), "testString"); - assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); - - CreateActionControlTemplateVersionOptions createActionControlTemplateVersionOptionsModel = new CreateActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .name("testString") - .description("testString") - .actionControl(templateActionControlModel) - .committed(true) - .build(); - assertEquals(createActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(createActionControlTemplateVersionOptionsModel.name(), "testString"); - assertEquals(createActionControlTemplateVersionOptionsModel.description(), "testString"); - assertEquals(createActionControlTemplateVersionOptionsModel.actionControl(), templateActionControlModel); - assertEquals(createActionControlTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateActionControlTemplateVersionOptionsError() throws Throwable { - new CreateActionControlTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java deleted file mode 100644 index c2dd24fd213..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyOptionsTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyOptions model. - */ -public class CreatePolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreatePolicyOptions() throws Throwable { - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - assertEquals(subjectAttributeModel.name(), "testString"); - assertEquals(subjectAttributeModel.value(), "testString"); - - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); - - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - assertEquals(policyRoleModel.roleId(), "testString"); - - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceAttributeModel.name(), "testString"); - assertEquals(resourceAttributeModel.value(), "testString"); - assertEquals(resourceAttributeModel.operator(), "testString"); - - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceTagModel.name(), "testString"); - assertEquals(resourceTagModel.value(), "testString"); - assertEquals(resourceTagModel.operator(), "testString"); - - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); - assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); - - CreatePolicyOptions createPolicyOptionsModel = new CreatePolicyOptions.Builder() - .type("testString") - .subjects(java.util.Arrays.asList(policySubjectModel)) - .roles(java.util.Arrays.asList(policyRoleModel)) - .resources(java.util.Arrays.asList(policyResourceModel)) - .description("testString") - .acceptLanguage("default") - .build(); - assertEquals(createPolicyOptionsModel.type(), "testString"); - assertEquals(createPolicyOptionsModel.subjects(), java.util.Arrays.asList(policySubjectModel)); - assertEquals(createPolicyOptionsModel.roles(), java.util.Arrays.asList(policyRoleModel)); - assertEquals(createPolicyOptionsModel.resources(), java.util.Arrays.asList(policyResourceModel)); - assertEquals(createPolicyOptionsModel.description(), "testString"); - assertEquals(createPolicyOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyOptionsError() throws Throwable { - new CreatePolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java deleted file mode 100644 index 5b08b4b398a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateAssignmentOptionsTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateAssignmentOptions model. - */ -public class CreatePolicyTemplateAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreatePolicyTemplateAssignmentOptions() throws Throwable { - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - assertEquals(assignmentTargetDetailsModel.type(), "Account"); - assertEquals(assignmentTargetDetailsModel.id(), "testString"); - - AssignmentTemplateDetails assignmentTemplateDetailsModel = new AssignmentTemplateDetails.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(assignmentTemplateDetailsModel.id(), "testString"); - assertEquals(assignmentTemplateDetailsModel.version(), "testString"); - - CreatePolicyTemplateAssignmentOptions createPolicyTemplateAssignmentOptionsModel = new CreatePolicyTemplateAssignmentOptions.Builder() - .version("1.0") - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(assignmentTemplateDetailsModel)) - .acceptLanguage("default") - .build(); - assertEquals(createPolicyTemplateAssignmentOptionsModel.version(), "1.0"); - assertEquals(createPolicyTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); - assertEquals(createPolicyTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(assignmentTemplateDetailsModel)); - assertEquals(createPolicyTemplateAssignmentOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateAssignmentOptionsError() throws Throwable { - new CreatePolicyTemplateAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java deleted file mode 100644 index 68617451831..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateOptionsTest.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateOptions model. - */ -public class CreatePolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreatePolicyTemplateOptions() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - assertEquals(templatePolicyModel.type(), "access"); - assertEquals(templatePolicyModel.description(), "testString"); - assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); - assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); - assertEquals(templatePolicyModel.pattern(), "testString"); - assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), templateControlModel); - - CreatePolicyTemplateOptions createPolicyTemplateOptionsModel = new CreatePolicyTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .policy(templatePolicyModel) - .description("testString") - .committed(true) - .acceptLanguage("default") - .build(); - assertEquals(createPolicyTemplateOptionsModel.name(), "testString"); - assertEquals(createPolicyTemplateOptionsModel.accountId(), "testString"); - assertEquals(createPolicyTemplateOptionsModel.policy(), templatePolicyModel); - assertEquals(createPolicyTemplateOptionsModel.description(), "testString"); - assertEquals(createPolicyTemplateOptionsModel.committed(), Boolean.valueOf(true)); - assertEquals(createPolicyTemplateOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateOptionsError() throws Throwable { - new CreatePolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java deleted file mode 100644 index d6919e6e1b9..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreatePolicyTemplateVersionOptionsTest.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreatePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreatePolicyTemplateVersionOptions model. - */ -public class CreatePolicyTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreatePolicyTemplateVersionOptions() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - assertEquals(templatePolicyModel.type(), "access"); - assertEquals(templatePolicyModel.description(), "testString"); - assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); - assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); - assertEquals(templatePolicyModel.pattern(), "testString"); - assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), templateControlModel); - - CreatePolicyTemplateVersionOptions createPolicyTemplateVersionOptionsModel = new CreatePolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .policy(templatePolicyModel) - .name("testString") - .description("testString") - .committed(true) - .build(); - assertEquals(createPolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); - assertEquals(createPolicyTemplateVersionOptionsModel.policy(), templatePolicyModel); - assertEquals(createPolicyTemplateVersionOptionsModel.name(), "testString"); - assertEquals(createPolicyTemplateVersionOptionsModel.description(), "testString"); - assertEquals(createPolicyTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreatePolicyTemplateVersionOptionsError() throws Throwable { - new CreatePolicyTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java deleted file mode 100644 index 849512f2bda..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleOptionsTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleOptions model. - */ -public class CreateRoleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateRoleOptions() throws Throwable { - CreateRoleOptions createRoleOptionsModel = new CreateRoleOptions.Builder() - .displayName("testString") - .actions(java.util.Arrays.asList("testString")) - .name("Developer") - .accountId("testString") - .serviceName("iam-groups") - .description("testString") - .acceptLanguage("default") - .build(); - assertEquals(createRoleOptionsModel.displayName(), "testString"); - assertEquals(createRoleOptionsModel.actions(), java.util.Arrays.asList("testString")); - assertEquals(createRoleOptionsModel.name(), "Developer"); - assertEquals(createRoleOptionsModel.accountId(), "testString"); - assertEquals(createRoleOptionsModel.serviceName(), "iam-groups"); - assertEquals(createRoleOptionsModel.description(), "testString"); - assertEquals(createRoleOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleOptionsError() throws Throwable { - new CreateRoleOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java deleted file mode 100644 index bff414389a5..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateAssignmentOptionsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateAssignmentOptions model. - */ -public class CreateRoleTemplateAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateRoleTemplateAssignmentOptions() throws Throwable { - AssignmentTargetDetails assignmentTargetDetailsModel = new AssignmentTargetDetails.Builder() - .type("Account") - .id("testString") - .build(); - assertEquals(assignmentTargetDetailsModel.type(), "Account"); - assertEquals(assignmentTargetDetailsModel.id(), "testString"); - - RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(roleAssignmentTemplateModel.id(), "testString"); - assertEquals(roleAssignmentTemplateModel.version(), "testString"); - - CreateRoleTemplateAssignmentOptions createRoleTemplateAssignmentOptionsModel = new CreateRoleTemplateAssignmentOptions.Builder() - .target(assignmentTargetDetailsModel) - .templates(java.util.Arrays.asList(roleAssignmentTemplateModel)) - .acceptLanguage("default") - .build(); - assertEquals(createRoleTemplateAssignmentOptionsModel.target(), assignmentTargetDetailsModel); - assertEquals(createRoleTemplateAssignmentOptionsModel.templates(), java.util.Arrays.asList(roleAssignmentTemplateModel)); - assertEquals(createRoleTemplateAssignmentOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateAssignmentOptionsError() throws Throwable { - new CreateRoleTemplateAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java deleted file mode 100644 index 799743ddbf4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateOptionsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateOptions model. - */ -public class CreateRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateRoleTemplateOptions() throws Throwable { - RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() - .name("testString") - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(roleTemplatePrototypeRoleModel.name(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.displayName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.serviceName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.description(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.actions(), java.util.Arrays.asList("testString")); - - CreateRoleTemplateOptions createRoleTemplateOptionsModel = new CreateRoleTemplateOptions.Builder() - .name("testString") - .accountId("testString") - .description("testString") - .committed(true) - .role(roleTemplatePrototypeRoleModel) - .acceptLanguage("default") - .build(); - assertEquals(createRoleTemplateOptionsModel.name(), "testString"); - assertEquals(createRoleTemplateOptionsModel.accountId(), "testString"); - assertEquals(createRoleTemplateOptionsModel.description(), "testString"); - assertEquals(createRoleTemplateOptionsModel.committed(), Boolean.valueOf(true)); - assertEquals(createRoleTemplateOptionsModel.role(), roleTemplatePrototypeRoleModel); - assertEquals(createRoleTemplateOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateOptionsError() throws Throwable { - new CreateRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java deleted file mode 100644 index a7d2d312afa..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateRoleTemplateVersionOptionsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateRoleTemplateVersionOptions model. - */ -public class CreateRoleTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateRoleTemplateVersionOptions() throws Throwable { - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateRoleModel.displayName(), "testString"); - assertEquals(templateRoleModel.serviceName(), "testString"); - assertEquals(templateRoleModel.description(), "testString"); - assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); - - CreateRoleTemplateVersionOptions createRoleTemplateVersionOptionsModel = new CreateRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .name("testString") - .description("testString") - .role(templateRoleModel) - .committed(true) - .build(); - assertEquals(createRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); - assertEquals(createRoleTemplateVersionOptionsModel.name(), "testString"); - assertEquals(createRoleTemplateVersionOptionsModel.description(), "testString"); - assertEquals(createRoleTemplateVersionOptionsModel.role(), templateRoleModel); - assertEquals(createRoleTemplateVersionOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRoleTemplateVersionOptionsError() throws Throwable { - new CreateRoleTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java deleted file mode 100644 index acce8b7b537..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CreateV2PolicyOptionsTest.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CreateV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 CreateV2PolicyOptions model. - */ -public class CreateV2PolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateV2PolicyOptions() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); - - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - assertEquals(controlModel.grant(), grantModel); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - CreateV2PolicyOptions createV2PolicyOptionsModel = new CreateV2PolicyOptions.Builder() - .control(controlModel) - .type("access") - .description("testString") - .subject(v2PolicySubjectModel) - .resource(v2PolicyResourceModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .acceptLanguage("default") - .build(); - assertEquals(createV2PolicyOptionsModel.control(), controlModel); - assertEquals(createV2PolicyOptionsModel.type(), "access"); - assertEquals(createV2PolicyOptionsModel.description(), "testString"); - assertEquals(createV2PolicyOptionsModel.subject(), v2PolicySubjectModel); - assertEquals(createV2PolicyOptionsModel.resource(), v2PolicyResourceModel); - assertEquals(createV2PolicyOptionsModel.pattern(), "testString"); - assertEquals(createV2PolicyOptionsModel.rule(), v2PolicyRuleModel); - assertEquals(createV2PolicyOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateV2PolicyOptionsError() throws Throwable { - new CreateV2PolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java deleted file mode 100644 index acc0dc0a3c1..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/CustomRoleTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 CustomRole model. - */ -public class CustomRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCustomRole() throws Throwable { - CustomRole customRoleModel = new CustomRole(); - assertNull(customRoleModel.getDisplayName()); - assertNull(customRoleModel.getDescription()); - assertNull(customRoleModel.getActions()); - assertNull(customRoleModel.getName()); - assertNull(customRoleModel.getAccountId()); - assertNull(customRoleModel.getServiceName()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java deleted file mode 100644 index 1a38606ede5..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlAssignmentOptions model. - */ -public class DeleteActionControlAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteActionControlAssignmentOptions() throws Throwable { - DeleteActionControlAssignmentOptions deleteActionControlAssignmentOptionsModel = new DeleteActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(deleteActionControlAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlAssignmentOptionsError() throws Throwable { - new DeleteActionControlAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java deleted file mode 100644 index 75b111e9214..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlTemplateOptions model. - */ -public class DeleteActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteActionControlTemplateOptions() throws Throwable { - DeleteActionControlTemplateOptions deleteActionControlTemplateOptionsModel = new DeleteActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .build(); - assertEquals(deleteActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlTemplateOptionsError() throws Throwable { - new DeleteActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java deleted file mode 100644 index 64fb5790244..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteActionControlTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteActionControlTemplateVersionOptions model. - */ -public class DeleteActionControlTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteActionControlTemplateVersionOptions() throws Throwable { - DeleteActionControlTemplateVersionOptions deleteActionControlTemplateVersionOptionsModel = new DeleteActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - assertEquals(deleteActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(deleteActionControlTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteActionControlTemplateVersionOptionsError() throws Throwable { - new DeleteActionControlTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java deleted file mode 100644 index 75aed905222..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyAssignmentOptions model. - */ -public class DeletePolicyAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeletePolicyAssignmentOptions() throws Throwable { - DeletePolicyAssignmentOptions deletePolicyAssignmentOptionsModel = new DeletePolicyAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(deletePolicyAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyAssignmentOptionsError() throws Throwable { - new DeletePolicyAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java deleted file mode 100644 index 1b130eb0f79..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyOptions model. - */ -public class DeletePolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeletePolicyOptions() throws Throwable { - DeletePolicyOptions deletePolicyOptionsModel = new DeletePolicyOptions.Builder() - .policyId("testString") - .build(); - assertEquals(deletePolicyOptionsModel.policyId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyOptionsError() throws Throwable { - new DeletePolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java deleted file mode 100644 index 288517222aa..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyTemplateOptions model. - */ -public class DeletePolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeletePolicyTemplateOptions() throws Throwable { - DeletePolicyTemplateOptions deletePolicyTemplateOptionsModel = new DeletePolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .build(); - assertEquals(deletePolicyTemplateOptionsModel.policyTemplateId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyTemplateOptionsError() throws Throwable { - new DeletePolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java deleted file mode 100644 index 7b1c6cffa1d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeletePolicyTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeletePolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeletePolicyTemplateVersionOptions model. - */ -public class DeletePolicyTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeletePolicyTemplateVersionOptions() throws Throwable { - DeletePolicyTemplateVersionOptions deletePolicyTemplateVersionOptionsModel = new DeletePolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - assertEquals(deletePolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); - assertEquals(deletePolicyTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeletePolicyTemplateVersionOptionsError() throws Throwable { - new DeletePolicyTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java deleted file mode 100644 index 7f9b614304f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleAssignmentOptions model. - */ -public class DeleteRoleAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteRoleAssignmentOptions() throws Throwable { - DeleteRoleAssignmentOptions deleteRoleAssignmentOptionsModel = new DeleteRoleAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(deleteRoleAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleAssignmentOptionsError() throws Throwable { - new DeleteRoleAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java deleted file mode 100644 index 9c6690cda7b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleOptions model. - */ -public class DeleteRoleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteRoleOptions() throws Throwable { - DeleteRoleOptions deleteRoleOptionsModel = new DeleteRoleOptions.Builder() - .roleId("testString") - .build(); - assertEquals(deleteRoleOptionsModel.roleId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleOptionsError() throws Throwable { - new DeleteRoleOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java deleted file mode 100644 index 3fc04286ed3..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleTemplateOptions model. - */ -public class DeleteRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteRoleTemplateOptions() throws Throwable { - DeleteRoleTemplateOptions deleteRoleTemplateOptionsModel = new DeleteRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .build(); - assertEquals(deleteRoleTemplateOptionsModel.roleTemplateId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleTemplateOptionsError() throws Throwable { - new DeleteRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java deleted file mode 100644 index ff652fa335c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteRoleTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteRoleTemplateVersionOptions model. - */ -public class DeleteRoleTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteRoleTemplateVersionOptions() throws Throwable { - DeleteRoleTemplateVersionOptions deleteRoleTemplateVersionOptionsModel = new DeleteRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - assertEquals(deleteRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); - assertEquals(deleteRoleTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRoleTemplateVersionOptionsError() throws Throwable { - new DeleteRoleTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java deleted file mode 100644 index 6a33aa8f116..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/DeleteV2PolicyOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.DeleteV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 DeleteV2PolicyOptions model. - */ -public class DeleteV2PolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteV2PolicyOptions() throws Throwable { - DeleteV2PolicyOptions deleteV2PolicyOptionsModel = new DeleteV2PolicyOptions.Builder() - .id("testString") - .build(); - assertEquals(deleteV2PolicyOptionsModel.id(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteV2PolicyOptionsError() throws Throwable { - new DeleteV2PolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java deleted file mode 100644 index 104a5210ed9..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/EnrichedRolesTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.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 EnrichedRoles model. - */ -public class EnrichedRolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testEnrichedRoles() throws Throwable { - EnrichedRoles enrichedRolesModel = new EnrichedRoles(); - assertNull(enrichedRolesModel.getRoleId()); - assertNull(enrichedRolesModel.getActions()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java deleted file mode 100644 index 460b37f8105..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorDetailsTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.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 ErrorDetails model. - */ -public class ErrorDetailsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testErrorDetails() throws Throwable { - ErrorDetails errorDetailsModel = new ErrorDetails(); - assertNull(errorDetailsModel.getConflictsWith()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java deleted file mode 100644 index e7f7f9afbfc..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ErrorObjectTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.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 ErrorObject model. - */ -public class ErrorObjectTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testErrorObject() throws Throwable { - ErrorObject errorObjectModel = new ErrorObject(); - assertNull(errorObjectModel.getCode()); - assertNull(errorObjectModel.getMessage()); - assertNull(errorObjectModel.getDetails()); - assertNull(errorObjectModel.getMoreInfo()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java deleted file mode 100644 index 90c91c8fcaf..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionPatchTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; -import com.ibm.cloud.platform_services.iam_policy_management.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 ExternalAccountIdentityInteractionPatch model. - */ -public class ExternalAccountIdentityInteractionPatchTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testExternalAccountIdentityInteractionPatch() throws Throwable { - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - assertEquals(identityTypesBaseModel.state(), "enabled"); - assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); - - IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() - .user(identityTypesBaseModel) - .serviceId(identityTypesBaseModel) - .service(identityTypesBaseModel) - .build(); - assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); - - ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() - .identityTypes(identityTypesPatchModel) - .build(); - assertEquals(externalAccountIdentityInteractionPatchModel.identityTypes(), identityTypesPatchModel); - - String json = TestUtilities.serialize(externalAccountIdentityInteractionPatchModel); - - ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModelNew = TestUtilities.deserialize(json, ExternalAccountIdentityInteractionPatch.class); - assertTrue(externalAccountIdentityInteractionPatchModelNew instanceof ExternalAccountIdentityInteractionPatch); - assertEquals(externalAccountIdentityInteractionPatchModelNew.identityTypes().toString(), identityTypesPatchModel.toString()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java deleted file mode 100644 index 2e4aaef7e07..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ExternalAccountIdentityInteractionTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteraction; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.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 ExternalAccountIdentityInteraction model. - */ -public class ExternalAccountIdentityInteractionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testExternalAccountIdentityInteraction() throws Throwable { - ExternalAccountIdentityInteraction externalAccountIdentityInteractionModel = new ExternalAccountIdentityInteraction(); - assertNull(externalAccountIdentityInteractionModel.getIdentityTypes()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java deleted file mode 100644 index b4d68673091..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/FirstTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.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 First model. - */ -public class FirstTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testFirst() throws Throwable { - First firstModel = new First(); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java deleted file mode 100644 index 73e66a5a756..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlAssignmentOptions model. - */ -public class GetActionControlAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetActionControlAssignmentOptions() throws Throwable { - GetActionControlAssignmentOptions getActionControlAssignmentOptionsModel = new GetActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(getActionControlAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlAssignmentOptionsError() throws Throwable { - new GetActionControlAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java deleted file mode 100644 index d6e66ce6939..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlTemplateOptions model. - */ -public class GetActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetActionControlTemplateOptions() throws Throwable { - GetActionControlTemplateOptions getActionControlTemplateOptionsModel = new GetActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .build(); - assertEquals(getActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(getActionControlTemplateOptionsModel.state(), "active"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlTemplateOptionsError() throws Throwable { - new GetActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java deleted file mode 100644 index ac8e17fe083..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetActionControlTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetActionControlTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetActionControlTemplateVersionOptions model. - */ -public class GetActionControlTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetActionControlTemplateVersionOptions() throws Throwable { - GetActionControlTemplateVersionOptions getActionControlTemplateVersionOptionsModel = new GetActionControlTemplateVersionOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .build(); - assertEquals(getActionControlTemplateVersionOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(getActionControlTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetActionControlTemplateVersionOptionsError() throws Throwable { - new GetActionControlTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java deleted file mode 100644 index 6b2a479c37d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyAssignmentOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyAssignmentOptions model. - */ -public class GetPolicyAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetPolicyAssignmentOptions() throws Throwable { - GetPolicyAssignmentOptions getPolicyAssignmentOptionsModel = new GetPolicyAssignmentOptions.Builder() - .assignmentId("testString") - .version("1.0") - .build(); - assertEquals(getPolicyAssignmentOptionsModel.assignmentId(), "testString"); - assertEquals(getPolicyAssignmentOptionsModel.version(), "1.0"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyAssignmentOptionsError() throws Throwable { - new GetPolicyAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java deleted file mode 100644 index 2a7348c2c2d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyOptions model. - */ -public class GetPolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetPolicyOptions() throws Throwable { - GetPolicyOptions getPolicyOptionsModel = new GetPolicyOptions.Builder() - .policyId("testString") - .build(); - assertEquals(getPolicyOptionsModel.policyId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyOptionsError() throws Throwable { - new GetPolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java deleted file mode 100644 index 06535ed77ed..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyTemplateOptions model. - */ -public class GetPolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetPolicyTemplateOptions() throws Throwable { - GetPolicyTemplateOptions getPolicyTemplateOptionsModel = new GetPolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .state("active") - .build(); - assertEquals(getPolicyTemplateOptionsModel.policyTemplateId(), "testString"); - assertEquals(getPolicyTemplateOptionsModel.state(), "active"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyTemplateOptionsError() throws Throwable { - new GetPolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java deleted file mode 100644 index 264b5db4912..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetPolicyTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetPolicyTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetPolicyTemplateVersionOptions model. - */ -public class GetPolicyTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetPolicyTemplateVersionOptions() throws Throwable { - GetPolicyTemplateVersionOptions getPolicyTemplateVersionOptionsModel = new GetPolicyTemplateVersionOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .build(); - assertEquals(getPolicyTemplateVersionOptionsModel.policyTemplateId(), "testString"); - assertEquals(getPolicyTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetPolicyTemplateVersionOptionsError() throws Throwable { - new GetPolicyTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java deleted file mode 100644 index 0c1f6b2bb5a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleAssignmentOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleAssignmentOptions model. - */ -public class GetRoleAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetRoleAssignmentOptions() throws Throwable { - GetRoleAssignmentOptions getRoleAssignmentOptionsModel = new GetRoleAssignmentOptions.Builder() - .assignmentId("testString") - .build(); - assertEquals(getRoleAssignmentOptionsModel.assignmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleAssignmentOptionsError() throws Throwable { - new GetRoleAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java deleted file mode 100644 index e589b8d1285..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleOptionsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleOptions model. - */ -public class GetRoleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetRoleOptions() throws Throwable { - GetRoleOptions getRoleOptionsModel = new GetRoleOptions.Builder() - .roleId("testString") - .build(); - assertEquals(getRoleOptionsModel.roleId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleOptionsError() throws Throwable { - new GetRoleOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java deleted file mode 100644 index 3c10b5207dc..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleTemplateOptions model. - */ -public class GetRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetRoleTemplateOptions() throws Throwable { - GetRoleTemplateOptions getRoleTemplateOptionsModel = new GetRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .state("active") - .build(); - assertEquals(getRoleTemplateOptionsModel.roleTemplateId(), "testString"); - assertEquals(getRoleTemplateOptionsModel.state(), "active"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleTemplateOptionsError() throws Throwable { - new GetRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java deleted file mode 100644 index 3bd5d278630..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetRoleTemplateVersionOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetRoleTemplateVersionOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetRoleTemplateVersionOptions model. - */ -public class GetRoleTemplateVersionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetRoleTemplateVersionOptions() throws Throwable { - GetRoleTemplateVersionOptions getRoleTemplateVersionOptionsModel = new GetRoleTemplateVersionOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .build(); - assertEquals(getRoleTemplateVersionOptionsModel.roleTemplateId(), "testString"); - assertEquals(getRoleTemplateVersionOptionsModel.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRoleTemplateVersionOptionsError() throws Throwable { - new GetRoleTemplateVersionOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java deleted file mode 100644 index 00f780c4153..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetSettingsOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetSettingsOptions model. - */ -public class GetSettingsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetSettingsOptions() throws Throwable { - GetSettingsOptions getSettingsOptionsModel = new GetSettingsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .build(); - assertEquals(getSettingsOptionsModel.accountId(), "testString"); - assertEquals(getSettingsOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetSettingsOptionsError() throws Throwable { - new GetSettingsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java deleted file mode 100644 index ebad7af7371..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GetV2PolicyOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GetV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 GetV2PolicyOptions model. - */ -public class GetV2PolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetV2PolicyOptions() throws Throwable { - GetV2PolicyOptions getV2PolicyOptionsModel = new GetV2PolicyOptions.Builder() - .id("testString") - .format("include_last_permit") - .build(); - assertEquals(getV2PolicyOptionsModel.id(), "testString"); - assertEquals(getV2PolicyOptionsModel.format(), "include_last_permit"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetV2PolicyOptionsError() throws Throwable { - new GetV2PolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java deleted file mode 100644 index f627a54ecc2..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 Grant model. - */ -public class GrantTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGrant() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); - - String json = TestUtilities.serialize(grantModel); - - Grant grantModelNew = TestUtilities.deserialize(json, Grant.class); - assertTrue(grantModelNew instanceof Grant); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGrantError() throws Throwable { - new Grant.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java deleted file mode 100644 index f86af34fab8..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/GrantWithEnrichedRolesTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.EnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.GrantWithEnrichedRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.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 GrantWithEnrichedRoles model. - */ -public class GrantWithEnrichedRolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGrantWithEnrichedRoles() throws Throwable { - GrantWithEnrichedRoles grantWithEnrichedRolesModel = new GrantWithEnrichedRoles(); - assertNull(grantWithEnrichedRolesModel.getRoles()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java deleted file mode 100644 index 2a4d38de51a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesBaseTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypesBase model. - */ -public class IdentityTypesBaseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testIdentityTypesBase() throws Throwable { - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - assertEquals(identityTypesBaseModel.state(), "enabled"); - assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(identityTypesBaseModel); - - IdentityTypesBase identityTypesBaseModelNew = TestUtilities.deserialize(json, IdentityTypesBase.class); - assertTrue(identityTypesBaseModelNew instanceof IdentityTypesBase); - assertEquals(identityTypesBaseModelNew.state(), "enabled"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testIdentityTypesBaseError() throws Throwable { - new IdentityTypesBase.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java deleted file mode 100644 index 3e762536695..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesPatchTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; -import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypesPatch model. - */ -public class IdentityTypesPatchTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testIdentityTypesPatch() throws Throwable { - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - assertEquals(identityTypesBaseModel.state(), "enabled"); - assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); - - IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() - .user(identityTypesBaseModel) - .serviceId(identityTypesBaseModel) - .service(identityTypesBaseModel) - .build(); - assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); - - String json = TestUtilities.serialize(identityTypesPatchModel); - - IdentityTypesPatch identityTypesPatchModelNew = TestUtilities.deserialize(json, IdentityTypesPatch.class); - assertTrue(identityTypesPatchModelNew instanceof IdentityTypesPatch); - assertEquals(identityTypesPatchModelNew.user().toString(), identityTypesBaseModel.toString()); - assertEquals(identityTypesPatchModelNew.serviceId().toString(), identityTypesBaseModel.toString()); - assertEquals(identityTypesPatchModelNew.service().toString(), identityTypesBaseModel.toString()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java deleted file mode 100644 index e2b6c77338f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/IdentityTypesTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypes; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.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 IdentityTypes model. - */ -public class IdentityTypesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testIdentityTypes() throws Throwable { - IdentityTypes identityTypesModel = new IdentityTypes(); - assertNull(identityTypesModel.getUser()); - assertNull(identityTypesModel.getServiceId()); - assertNull(identityTypesModel.getService()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java deleted file mode 100644 index c3f51516e25..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/LimitDataTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; -import com.ibm.cloud.platform_services.iam_policy_management.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 LimitData model. - */ -public class LimitDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testLimitData() throws Throwable { - LimitData limitDataModel = new LimitData(); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java deleted file mode 100644 index 0d64653d829..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlAssignmentsOptionsTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlAssignmentsOptions model. - */ -public class ListActionControlAssignmentsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListActionControlAssignmentsOptions() throws Throwable { - ListActionControlAssignmentsOptions listActionControlAssignmentsOptionsModel = new ListActionControlAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listActionControlAssignmentsOptionsModel.accountId(), "testString"); - assertEquals(listActionControlAssignmentsOptionsModel.acceptLanguage(), "default"); - assertEquals(listActionControlAssignmentsOptionsModel.templateId(), "testString"); - assertEquals(listActionControlAssignmentsOptionsModel.templateVersion(), "testString"); - assertEquals(listActionControlAssignmentsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listActionControlAssignmentsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlAssignmentsOptionsError() throws Throwable { - new ListActionControlAssignmentsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java deleted file mode 100644 index dfe91662d83..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplateVersionsOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlTemplateVersionsOptions model. - */ -public class ListActionControlTemplateVersionsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListActionControlTemplateVersionsOptions() throws Throwable { - ListActionControlTemplateVersionsOptions listActionControlTemplateVersionsOptionsModel = new ListActionControlTemplateVersionsOptions.Builder() - .actionControlTemplateId("testString") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listActionControlTemplateVersionsOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(listActionControlTemplateVersionsOptionsModel.state(), "active"); - assertEquals(listActionControlTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listActionControlTemplateVersionsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlTemplateVersionsOptionsError() throws Throwable { - new ListActionControlTemplateVersionsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java deleted file mode 100644 index 9e2e6a18158..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListActionControlTemplatesOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListActionControlTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListActionControlTemplatesOptions model. - */ -public class ListActionControlTemplatesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListActionControlTemplatesOptions() throws Throwable { - ListActionControlTemplatesOptions listActionControlTemplatesOptionsModel = new ListActionControlTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listActionControlTemplatesOptionsModel.accountId(), "testString"); - assertEquals(listActionControlTemplatesOptionsModel.acceptLanguage(), "default"); - assertEquals(listActionControlTemplatesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listActionControlTemplatesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListActionControlTemplatesOptionsError() throws Throwable { - new ListActionControlTemplatesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java deleted file mode 100644 index 8bfe5000355..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPoliciesOptionsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListPoliciesOptions model. - */ -public class ListPoliciesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListPoliciesOptions() throws Throwable { - ListPoliciesOptions listPoliciesOptionsModel = new ListPoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .tagName("testString") - .tagValue("testString") - .sort("id") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listPoliciesOptionsModel.accountId(), "testString"); - assertEquals(listPoliciesOptionsModel.acceptLanguage(), "default"); - assertEquals(listPoliciesOptionsModel.iamId(), "testString"); - assertEquals(listPoliciesOptionsModel.accessGroupId(), "testString"); - assertEquals(listPoliciesOptionsModel.type(), "access"); - assertEquals(listPoliciesOptionsModel.serviceType(), "service"); - assertEquals(listPoliciesOptionsModel.tagName(), "testString"); - assertEquals(listPoliciesOptionsModel.tagValue(), "testString"); - assertEquals(listPoliciesOptionsModel.sort(), "id"); - assertEquals(listPoliciesOptionsModel.format(), "include_last_permit"); - assertEquals(listPoliciesOptionsModel.state(), "active"); - assertEquals(listPoliciesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listPoliciesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPoliciesOptionsError() throws Throwable { - new ListPoliciesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java deleted file mode 100644 index 32729befeda..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyAssignmentsOptionsTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyAssignmentsOptions model. - */ -public class ListPolicyAssignmentsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListPolicyAssignmentsOptions() throws Throwable { - ListPolicyAssignmentsOptions listPolicyAssignmentsOptionsModel = new ListPolicyAssignmentsOptions.Builder() - .version("1.0") - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listPolicyAssignmentsOptionsModel.version(), "1.0"); - assertEquals(listPolicyAssignmentsOptionsModel.accountId(), "testString"); - assertEquals(listPolicyAssignmentsOptionsModel.acceptLanguage(), "default"); - assertEquals(listPolicyAssignmentsOptionsModel.templateId(), "testString"); - assertEquals(listPolicyAssignmentsOptionsModel.templateVersion(), "testString"); - assertEquals(listPolicyAssignmentsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listPolicyAssignmentsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyAssignmentsOptionsError() throws Throwable { - new ListPolicyAssignmentsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java deleted file mode 100644 index 1053d41b84b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplateVersionsOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyTemplateVersionsOptions model. - */ -public class ListPolicyTemplateVersionsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListPolicyTemplateVersionsOptions() throws Throwable { - ListPolicyTemplateVersionsOptions listPolicyTemplateVersionsOptionsModel = new ListPolicyTemplateVersionsOptions.Builder() - .policyTemplateId("testString") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listPolicyTemplateVersionsOptionsModel.policyTemplateId(), "testString"); - assertEquals(listPolicyTemplateVersionsOptionsModel.state(), "active"); - assertEquals(listPolicyTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listPolicyTemplateVersionsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyTemplateVersionsOptionsError() throws Throwable { - new ListPolicyTemplateVersionsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java deleted file mode 100644 index 5065a9d9495..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListPolicyTemplatesOptionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListPolicyTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListPolicyTemplatesOptions model. - */ -public class ListPolicyTemplatesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListPolicyTemplatesOptions() throws Throwable { - ListPolicyTemplatesOptions listPolicyTemplatesOptionsModel = new ListPolicyTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .state("active") - .name("testString") - .policyServiceType("service") - .policyServiceName("testString") - .policyServiceGroupId("testString") - .policyType("access") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listPolicyTemplatesOptionsModel.accountId(), "testString"); - assertEquals(listPolicyTemplatesOptionsModel.acceptLanguage(), "default"); - assertEquals(listPolicyTemplatesOptionsModel.state(), "active"); - assertEquals(listPolicyTemplatesOptionsModel.name(), "testString"); - assertEquals(listPolicyTemplatesOptionsModel.policyServiceType(), "service"); - assertEquals(listPolicyTemplatesOptionsModel.policyServiceName(), "testString"); - assertEquals(listPolicyTemplatesOptionsModel.policyServiceGroupId(), "testString"); - assertEquals(listPolicyTemplatesOptionsModel.policyType(), "access"); - assertEquals(listPolicyTemplatesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listPolicyTemplatesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListPolicyTemplatesOptionsError() throws Throwable { - new ListPolicyTemplatesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java deleted file mode 100644 index bd82df9bfd5..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleAssignmentsOptionsTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleAssignmentsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleAssignmentsOptions model. - */ -public class ListRoleAssignmentsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListRoleAssignmentsOptions() throws Throwable { - ListRoleAssignmentsOptions listRoleAssignmentsOptionsModel = new ListRoleAssignmentsOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .templateId("testString") - .templateVersion("testString") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listRoleAssignmentsOptionsModel.accountId(), "testString"); - assertEquals(listRoleAssignmentsOptionsModel.acceptLanguage(), "default"); - assertEquals(listRoleAssignmentsOptionsModel.templateId(), "testString"); - assertEquals(listRoleAssignmentsOptionsModel.templateVersion(), "testString"); - assertEquals(listRoleAssignmentsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listRoleAssignmentsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleAssignmentsOptionsError() throws Throwable { - new ListRoleAssignmentsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java deleted file mode 100644 index 2e89527b653..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplateVersionsOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplateVersionsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleTemplateVersionsOptions model. - */ -public class ListRoleTemplateVersionsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListRoleTemplateVersionsOptions() throws Throwable { - ListRoleTemplateVersionsOptions listRoleTemplateVersionsOptionsModel = new ListRoleTemplateVersionsOptions.Builder() - .roleTemplateId("testString") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listRoleTemplateVersionsOptionsModel.roleTemplateId(), "testString"); - assertEquals(listRoleTemplateVersionsOptionsModel.state(), "active"); - assertEquals(listRoleTemplateVersionsOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listRoleTemplateVersionsOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleTemplateVersionsOptionsError() throws Throwable { - new ListRoleTemplateVersionsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java deleted file mode 100644 index 21d23a7be0f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRoleTemplatesOptionsTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRoleTemplatesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListRoleTemplatesOptions model. - */ -public class ListRoleTemplatesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListRoleTemplatesOptions() throws Throwable { - ListRoleTemplatesOptions listRoleTemplatesOptionsModel = new ListRoleTemplatesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .name("testString") - .roleName("testString") - .roleServiceName("testString") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listRoleTemplatesOptionsModel.accountId(), "testString"); - assertEquals(listRoleTemplatesOptionsModel.acceptLanguage(), "default"); - assertEquals(listRoleTemplatesOptionsModel.name(), "testString"); - assertEquals(listRoleTemplatesOptionsModel.roleName(), "testString"); - assertEquals(listRoleTemplatesOptionsModel.roleServiceName(), "testString"); - assertEquals(listRoleTemplatesOptionsModel.state(), "active"); - assertEquals(listRoleTemplatesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listRoleTemplatesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListRoleTemplatesOptionsError() throws Throwable { - new ListRoleTemplatesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java deleted file mode 100644 index 4fb97c7fc9a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListRolesOptionsTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListRolesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListRolesOptions model. - */ -public class ListRolesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListRolesOptions() throws Throwable { - ListRolesOptions listRolesOptionsModel = new ListRolesOptions.Builder() - .acceptLanguage("default") - .accountId("testString") - .serviceName("iam-groups") - .sourceServiceName("iam-groups") - .policyType("authorization") - .serviceGroupId("IAM") - .build(); - assertEquals(listRolesOptionsModel.acceptLanguage(), "default"); - assertEquals(listRolesOptionsModel.accountId(), "testString"); - assertEquals(listRolesOptionsModel.serviceName(), "iam-groups"); - assertEquals(listRolesOptionsModel.sourceServiceName(), "iam-groups"); - assertEquals(listRolesOptionsModel.policyType(), "authorization"); - assertEquals(listRolesOptionsModel.serviceGroupId(), "IAM"); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java deleted file mode 100644 index 8c72945373b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ListV2PoliciesOptionsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ListV2PoliciesOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ListV2PoliciesOptions model. - */ -public class ListV2PoliciesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListV2PoliciesOptions() throws Throwable { - ListV2PoliciesOptions listV2PoliciesOptionsModel = new ListV2PoliciesOptions.Builder() - .accountId("testString") - .acceptLanguage("default") - .iamId("testString") - .accessGroupId("testString") - .type("access") - .serviceType("service") - .serviceName("testString") - .serviceGroupId("testString") - .sort("testString") - .format("include_last_permit") - .state("active") - .limit(Long.valueOf("50")) - .start("testString") - .build(); - assertEquals(listV2PoliciesOptionsModel.accountId(), "testString"); - assertEquals(listV2PoliciesOptionsModel.acceptLanguage(), "default"); - assertEquals(listV2PoliciesOptionsModel.iamId(), "testString"); - assertEquals(listV2PoliciesOptionsModel.accessGroupId(), "testString"); - assertEquals(listV2PoliciesOptionsModel.type(), "access"); - assertEquals(listV2PoliciesOptionsModel.serviceType(), "service"); - assertEquals(listV2PoliciesOptionsModel.serviceName(), "testString"); - assertEquals(listV2PoliciesOptionsModel.serviceGroupId(), "testString"); - assertEquals(listV2PoliciesOptionsModel.sort(), "testString"); - assertEquals(listV2PoliciesOptionsModel.format(), "include_last_permit"); - assertEquals(listV2PoliciesOptionsModel.state(), "active"); - assertEquals(listV2PoliciesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listV2PoliciesOptionsModel.start(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListV2PoliciesOptionsError() throws Throwable { - new ListV2PoliciesOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java deleted file mode 100644 index 0661d4245a2..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 NestedConditionRuleAttribute model. - */ -public class NestedConditionRuleAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNestedConditionRuleAttribute() throws Throwable { - NestedConditionRuleAttribute nestedConditionRuleAttributeModel = new NestedConditionRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(nestedConditionRuleAttributeModel.key(), "testString"); - assertEquals(nestedConditionRuleAttributeModel.operator(), "stringEquals"); - assertEquals(nestedConditionRuleAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(nestedConditionRuleAttributeModel); - - NestedConditionRuleAttribute nestedConditionRuleAttributeModelNew = TestUtilities.deserialize(json, NestedConditionRuleAttribute.class); - assertTrue(nestedConditionRuleAttributeModelNew instanceof NestedConditionRuleAttribute); - assertEquals(nestedConditionRuleAttributeModelNew.key(), "testString"); - assertEquals(nestedConditionRuleAttributeModelNew.operator(), "stringEquals"); - assertEquals(nestedConditionRuleAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testNestedConditionRuleAttributeError() throws Throwable { - new NestedConditionRuleAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java deleted file mode 100644 index 1ba394dbb7d..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionRuleWithConditionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleWithConditions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 NestedConditionRuleWithConditions model. - */ -public class NestedConditionRuleWithConditionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNestedConditionRuleWithConditions() throws Throwable { - RuleAttribute ruleAttributeModel = new RuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(ruleAttributeModel.key(), "testString"); - assertEquals(ruleAttributeModel.operator(), "stringEquals"); - assertEquals(ruleAttributeModel.value(), "testString"); - - NestedConditionRuleWithConditions nestedConditionRuleWithConditionsModel = new NestedConditionRuleWithConditions.Builder() - .operator("and") - .conditions(java.util.Arrays.asList(ruleAttributeModel)) - .build(); - assertEquals(nestedConditionRuleWithConditionsModel.operator(), "and"); - assertEquals(nestedConditionRuleWithConditionsModel.conditions(), java.util.Arrays.asList(ruleAttributeModel)); - - String json = TestUtilities.serialize(nestedConditionRuleWithConditionsModel); - - NestedConditionRuleWithConditions nestedConditionRuleWithConditionsModelNew = TestUtilities.deserialize(json, NestedConditionRuleWithConditions.class); - assertTrue(nestedConditionRuleWithConditionsModelNew instanceof NestedConditionRuleWithConditions); - assertEquals(nestedConditionRuleWithConditionsModelNew.operator(), "and"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testNestedConditionRuleWithConditionsError() throws Throwable { - new NestedConditionRuleWithConditions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java deleted file mode 100644 index 4956eea2675..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NestedConditionTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedCondition; -import com.ibm.cloud.platform_services.iam_policy_management.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 NestedCondition model. - */ -public class NestedConditionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testNestedCondition() throws Throwable { - NestedCondition nestedConditionModel = new NestedCondition(); - assertNotNull(nestedConditionModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java deleted file mode 100644 index c5e084a44d5..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/NextTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.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 Next model. - */ -public class NextTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNext() throws Throwable { - Next nextModel = new Next(); - assertNull(nextModel.getStart()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java deleted file mode 100644 index d5b05ede760..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcePolicyTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentResourcePolicy model. - */ -public class PolicyAssignmentResourcePolicyTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentResourcePolicy() throws Throwable { - PolicyAssignmentResourcePolicy policyAssignmentResourcePolicyModel = new PolicyAssignmentResourcePolicy(); - assertNull(policyAssignmentResourcePolicyModel.getResourceCreated()); - assertNull(policyAssignmentResourcePolicyModel.getStatus()); - assertNull(policyAssignmentResourcePolicyModel.getErrorMessage()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java deleted file mode 100644 index 8b146425617..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentResourcesTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentResources model. - */ -public class PolicyAssignmentResourcesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentResources() throws Throwable { - PolicyAssignmentResources policyAssignmentResourcesModel = new PolicyAssignmentResources(); - assertNull(policyAssignmentResourcesModel.getTarget()); - assertNull(policyAssignmentResourcesModel.getPolicy()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java deleted file mode 100644 index 8a3a6b67703..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1CollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Collection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Collection model. - */ -public class PolicyAssignmentV1CollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentV1Collection() throws Throwable { - PolicyAssignmentV1Collection policyAssignmentV1CollectionModel = new PolicyAssignmentV1Collection(); - assertNull(policyAssignmentV1CollectionModel.getLimit()); - assertNull(policyAssignmentV1CollectionModel.getFirst()); - assertNull(policyAssignmentV1CollectionModel.getNext()); - assertNull(policyAssignmentV1CollectionModel.getPrevious()); - assertNull(policyAssignmentV1CollectionModel.getAssignments()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java deleted file mode 100644 index 56c843a232e..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1ResourcesTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Resources model. - */ -public class PolicyAssignmentV1ResourcesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentV1Resources() throws Throwable { - PolicyAssignmentV1Resources policyAssignmentV1ResourcesModel = new PolicyAssignmentV1Resources(); - assertNull(policyAssignmentV1ResourcesModel.getTarget()); - assertNull(policyAssignmentV1ResourcesModel.getPolicy()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java deleted file mode 100644 index f5d14b29447..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1SubjectTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1Subject model. - */ -public class PolicyAssignmentV1SubjectTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentV1Subject() throws Throwable { - PolicyAssignmentV1Subject policyAssignmentV1SubjectModel = new PolicyAssignmentV1Subject(); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java deleted file mode 100644 index d9889483421..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyAssignmentV1Test.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyAssignmentV1 model. - */ -public class PolicyAssignmentV1Test { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyAssignmentV1() throws Throwable { - PolicyAssignmentV1 policyAssignmentV1Model = new PolicyAssignmentV1(); - assertNull(policyAssignmentV1Model.getTarget()); - assertNull(policyAssignmentV1Model.getResources()); - assertNull(policyAssignmentV1Model.getSubject()); - assertNull(policyAssignmentV1Model.getTemplate()); - assertNull(policyAssignmentV1Model.getStatus()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java deleted file mode 100644 index 3d372dfaf20..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyCollectionTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyCollection model. - */ -public class PolicyCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyCollection() throws Throwable { - PolicyCollection policyCollectionModel = new PolicyCollection(); - assertNull(policyCollectionModel.getLimit()); - assertNull(policyCollectionModel.getFirst()); - assertNull(policyCollectionModel.getNext()); - assertNull(policyCollectionModel.getPrevious()); - assertNull(policyCollectionModel.getPolicies()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java deleted file mode 100644 index cb2f203a5c3..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyResourceTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyResource model. - */ -public class PolicyResourceTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyResource() throws Throwable { - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceAttributeModel.name(), "testString"); - assertEquals(resourceAttributeModel.value(), "testString"); - assertEquals(resourceAttributeModel.operator(), "testString"); - - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceTagModel.name(), "testString"); - assertEquals(resourceTagModel.value(), "testString"); - assertEquals(resourceTagModel.operator(), "testString"); - - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); - assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); - - String json = TestUtilities.serialize(policyResourceModel); - - PolicyResource policyResourceModelNew = TestUtilities.deserialize(json, PolicyResource.class); - assertTrue(policyResourceModelNew instanceof PolicyResource); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testPolicyResourceError() throws Throwable { - new PolicyResource.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java deleted file mode 100644 index 299e15b1fd4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyRoleTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyRole model. - */ -public class PolicyRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyRole() throws Throwable { - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - assertEquals(policyRoleModel.roleId(), "testString"); - - String json = TestUtilities.serialize(policyRoleModel); - - PolicyRole policyRoleModelNew = TestUtilities.deserialize(json, PolicyRole.class); - assertTrue(policyRoleModelNew instanceof PolicyRole); - assertEquals(policyRoleModelNew.roleId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testPolicyRoleError() throws Throwable { - new PolicyRole.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java deleted file mode 100644 index 6d0a937bd53..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicySubjectTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicySubject model. - */ -public class PolicySubjectTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicySubject() throws Throwable { - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - assertEquals(subjectAttributeModel.name(), "testString"); - assertEquals(subjectAttributeModel.value(), "testString"); - - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); - - String json = TestUtilities.serialize(policySubjectModel); - - PolicySubject policySubjectModelNew = TestUtilities.deserialize(json, PolicySubject.class); - assertTrue(policySubjectModelNew instanceof PolicySubject); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testPolicySubjectError() throws Throwable { - new PolicySubject.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java deleted file mode 100644 index 8cb98be3d32..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentCollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentCollection model. - */ -public class PolicyTemplateAssignmentCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateAssignmentCollection() throws Throwable { - PolicyTemplateAssignmentCollection policyTemplateAssignmentCollectionModel = new PolicyTemplateAssignmentCollection(); - assertNull(policyTemplateAssignmentCollectionModel.getLimit()); - assertNull(policyTemplateAssignmentCollectionModel.getFirst()); - assertNull(policyTemplateAssignmentCollectionModel.getNext()); - assertNull(policyTemplateAssignmentCollectionModel.getPrevious()); - assertNull(policyTemplateAssignmentCollectionModel.getAssignments()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java deleted file mode 100644 index fded12633d2..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItemsPolicyAssignment model. - */ -public class PolicyTemplateAssignmentItemsPolicyAssignmentTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateAssignmentItemsPolicyAssignment() throws Throwable { - PolicyTemplateAssignmentItemsPolicyAssignment policyTemplateAssignmentItemsPolicyAssignmentModel = new PolicyTemplateAssignmentItemsPolicyAssignment(); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTemplateId()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTemplateVersion()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getAssignmentId()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTargetType()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getTarget()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getResources()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentModel.getStatus()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java deleted file mode 100644 index 6b74125d238..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsPolicyAssignmentV1Test.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItemsPolicyAssignmentV1; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItemsPolicyAssignmentV1 model. - */ -public class PolicyTemplateAssignmentItemsPolicyAssignmentV1Test { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateAssignmentItemsPolicyAssignmentV1() throws Throwable { - PolicyTemplateAssignmentItemsPolicyAssignmentV1 policyTemplateAssignmentItemsPolicyAssignmentV1Model = new PolicyTemplateAssignmentItemsPolicyAssignmentV1(); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getTarget()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getResources()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getSubject()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getTemplate()); - assertNull(policyTemplateAssignmentItemsPolicyAssignmentV1Model.getStatus()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java deleted file mode 100644 index 05b400e91c1..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateAssignmentItemsTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTemplateDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentResourcePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Resources; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyAssignmentV1Subject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateAssignmentItems; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateAssignmentItems model. - */ -public class PolicyTemplateAssignmentItemsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testPolicyTemplateAssignmentItems() throws Throwable { - PolicyTemplateAssignmentItems policyTemplateAssignmentItemsModel = new PolicyTemplateAssignmentItems(); - assertNotNull(policyTemplateAssignmentItemsModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java deleted file mode 100644 index 52041b1a6a3..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateCollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateCollection model. - */ -public class PolicyTemplateCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateCollection() throws Throwable { - PolicyTemplateCollection policyTemplateCollectionModel = new PolicyTemplateCollection(); - assertNull(policyTemplateCollectionModel.getLimit()); - assertNull(policyTemplateCollectionModel.getFirst()); - assertNull(policyTemplateCollectionModel.getNext()); - assertNull(policyTemplateCollectionModel.getPrevious()); - assertNull(policyTemplateCollectionModel.getPolicyTemplates()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java deleted file mode 100644 index b6ee06990a2..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateLimitDataTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateLimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateLimitData model. - */ -public class PolicyTemplateLimitDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateLimitData() throws Throwable { - PolicyTemplateLimitData policyTemplateLimitDataModel = new PolicyTemplateLimitData(); - assertNull(policyTemplateLimitDataModel.getName()); - assertNull(policyTemplateLimitDataModel.getDescription()); - assertNull(policyTemplateLimitDataModel.getAccountId()); - assertNull(policyTemplateLimitDataModel.getVersion()); - assertNull(policyTemplateLimitDataModel.isCommitted()); - assertNull(policyTemplateLimitDataModel.getPolicy()); - assertNull(policyTemplateLimitDataModel.getState()); - assertNull(policyTemplateLimitDataModel.getCounts()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java deleted file mode 100644 index edeb45c4d96..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateMetaDataTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateMetaData model. - */ -public class PolicyTemplateMetaDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateMetaData() throws Throwable { - PolicyTemplateMetaData policyTemplateMetaDataModel = new PolicyTemplateMetaData(); - assertNull(policyTemplateMetaDataModel.getType()); - assertNull(policyTemplateMetaDataModel.getDescription()); - assertNull(policyTemplateMetaDataModel.getSubjects()); - assertNull(policyTemplateMetaDataModel.getRoles()); - assertNull(policyTemplateMetaDataModel.getResources()); - assertNull(policyTemplateMetaDataModel.getState()); - assertNull(policyTemplateMetaDataModel.getTemplate()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java deleted file mode 100644 index c349e4a3415..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplate model. - */ -public class PolicyTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplate() throws Throwable { - PolicyTemplate policyTemplateModel = new PolicyTemplate(); - assertNull(policyTemplateModel.getName()); - assertNull(policyTemplateModel.getDescription()); - assertNull(policyTemplateModel.getAccountId()); - assertNull(policyTemplateModel.getVersion()); - assertNull(policyTemplateModel.isCommitted()); - assertNull(policyTemplateModel.getPolicy()); - assertNull(policyTemplateModel.getState()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java deleted file mode 100644 index da651956461..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTemplateVersionsCollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 PolicyTemplateVersionsCollection model. - */ -public class PolicyTemplateVersionsCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicyTemplateVersionsCollection() throws Throwable { - PolicyTemplateVersionsCollection policyTemplateVersionsCollectionModel = new PolicyTemplateVersionsCollection(); - assertNull(policyTemplateVersionsCollectionModel.getLimit()); - assertNull(policyTemplateVersionsCollectionModel.getFirst()); - assertNull(policyTemplateVersionsCollectionModel.getNext()); - assertNull(policyTemplateVersionsCollectionModel.getPrevious()); - assertNull(policyTemplateVersionsCollectionModel.getVersions()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java deleted file mode 100644 index 28eba4f9a85..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PolicyTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 Policy model. - */ -public class PolicyTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPolicy() throws Throwable { - Policy policyModel = new Policy(); - assertNull(policyModel.getType()); - assertNull(policyModel.getDescription()); - assertNull(policyModel.getSubjects()); - assertNull(policyModel.getRoles()); - assertNull(policyModel.getResources()); - assertNull(policyModel.getState()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java deleted file mode 100644 index e3788c51212..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/PreviousTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.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 Previous model. - */ -public class PreviousTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPrevious() throws Throwable { - Previous previousModel = new Previous(); - assertNull(previousModel.getStart()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java deleted file mode 100644 index 430f5f63764..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceActionControlTemplateOptionsTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceActionControlTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceActionControlTemplateOptions model. - */ -public class ReplaceActionControlTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplaceActionControlTemplateOptions() throws Throwable { - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateActionControlModel.serviceName(), "testString"); - assertEquals(templateActionControlModel.description(), "testString"); - assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); - - ReplaceActionControlTemplateOptions replaceActionControlTemplateOptionsModel = new ReplaceActionControlTemplateOptions.Builder() - .actionControlTemplateId("testString") - .version("testString") - .ifMatch("testString") - .name("testString") - .description("testString") - .actionControl(templateActionControlModel) - .committed(true) - .build(); - assertEquals(replaceActionControlTemplateOptionsModel.actionControlTemplateId(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.version(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.ifMatch(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.name(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.description(), "testString"); - assertEquals(replaceActionControlTemplateOptionsModel.actionControl(), templateActionControlModel); - assertEquals(replaceActionControlTemplateOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceActionControlTemplateOptionsError() throws Throwable { - new ReplaceActionControlTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java deleted file mode 100644 index 2f20b05f37c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyOptionsTest.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicyRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplacePolicyOptions model. - */ -public class ReplacePolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplacePolicyOptions() throws Throwable { - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - assertEquals(subjectAttributeModel.name(), "testString"); - assertEquals(subjectAttributeModel.value(), "testString"); - - PolicySubject policySubjectModel = new PolicySubject.Builder() - .attributes(java.util.Arrays.asList(subjectAttributeModel)) - .build(); - assertEquals(policySubjectModel.attributes(), java.util.Arrays.asList(subjectAttributeModel)); - - PolicyRole policyRoleModel = new PolicyRole.Builder() - .roleId("testString") - .build(); - assertEquals(policyRoleModel.roleId(), "testString"); - - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceAttributeModel.name(), "testString"); - assertEquals(resourceAttributeModel.value(), "testString"); - assertEquals(resourceAttributeModel.operator(), "testString"); - - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceTagModel.name(), "testString"); - assertEquals(resourceTagModel.value(), "testString"); - assertEquals(resourceTagModel.operator(), "testString"); - - PolicyResource policyResourceModel = new PolicyResource.Builder() - .attributes(java.util.Arrays.asList(resourceAttributeModel)) - .tags(java.util.Arrays.asList(resourceTagModel)) - .build(); - assertEquals(policyResourceModel.attributes(), java.util.Arrays.asList(resourceAttributeModel)); - assertEquals(policyResourceModel.tags(), java.util.Arrays.asList(resourceTagModel)); - - ReplacePolicyOptions replacePolicyOptionsModel = new ReplacePolicyOptions.Builder() - .policyId("testString") - .ifMatch("testString") - .type("testString") - .subjects(java.util.Arrays.asList(policySubjectModel)) - .roles(java.util.Arrays.asList(policyRoleModel)) - .resources(java.util.Arrays.asList(policyResourceModel)) - .description("testString") - .build(); - assertEquals(replacePolicyOptionsModel.policyId(), "testString"); - assertEquals(replacePolicyOptionsModel.ifMatch(), "testString"); - assertEquals(replacePolicyOptionsModel.type(), "testString"); - assertEquals(replacePolicyOptionsModel.subjects(), java.util.Arrays.asList(policySubjectModel)); - assertEquals(replacePolicyOptionsModel.roles(), java.util.Arrays.asList(policyRoleModel)); - assertEquals(replacePolicyOptionsModel.resources(), java.util.Arrays.asList(policyResourceModel)); - assertEquals(replacePolicyOptionsModel.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplacePolicyOptionsError() throws Throwable { - new ReplacePolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java deleted file mode 100644 index 2dc2430daca..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplacePolicyTemplateOptionsTest.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplacePolicyTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplacePolicyTemplateOptions model. - */ -public class ReplacePolicyTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplacePolicyTemplateOptions() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - assertEquals(templatePolicyModel.type(), "access"); - assertEquals(templatePolicyModel.description(), "testString"); - assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); - assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); - assertEquals(templatePolicyModel.pattern(), "testString"); - assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), templateControlModel); - - ReplacePolicyTemplateOptions replacePolicyTemplateOptionsModel = new ReplacePolicyTemplateOptions.Builder() - .policyTemplateId("testString") - .version("testString") - .ifMatch("testString") - .policy(templatePolicyModel) - .name("testString") - .description("testString") - .committed(true) - .build(); - assertEquals(replacePolicyTemplateOptionsModel.policyTemplateId(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.version(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.ifMatch(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.policy(), templatePolicyModel); - assertEquals(replacePolicyTemplateOptionsModel.name(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.description(), "testString"); - assertEquals(replacePolicyTemplateOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplacePolicyTemplateOptionsError() throws Throwable { - new ReplacePolicyTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java deleted file mode 100644 index 9900abb2543..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleOptionsTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceRoleOptions model. - */ -public class ReplaceRoleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplaceRoleOptions() throws Throwable { - ReplaceRoleOptions replaceRoleOptionsModel = new ReplaceRoleOptions.Builder() - .roleId("testString") - .ifMatch("testString") - .displayName("testString") - .actions(java.util.Arrays.asList("testString")) - .description("testString") - .build(); - assertEquals(replaceRoleOptionsModel.roleId(), "testString"); - assertEquals(replaceRoleOptionsModel.ifMatch(), "testString"); - assertEquals(replaceRoleOptionsModel.displayName(), "testString"); - assertEquals(replaceRoleOptionsModel.actions(), java.util.Arrays.asList("testString")); - assertEquals(replaceRoleOptionsModel.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceRoleOptionsError() throws Throwable { - new ReplaceRoleOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java deleted file mode 100644 index 2f731aea7d4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceRoleTemplateOptionsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceRoleTemplateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceRoleTemplateOptions model. - */ -public class ReplaceRoleTemplateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplaceRoleTemplateOptions() throws Throwable { - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateRoleModel.displayName(), "testString"); - assertEquals(templateRoleModel.serviceName(), "testString"); - assertEquals(templateRoleModel.description(), "testString"); - assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); - - ReplaceRoleTemplateOptions replaceRoleTemplateOptionsModel = new ReplaceRoleTemplateOptions.Builder() - .roleTemplateId("testString") - .version("testString") - .ifMatch("testString") - .name("testString") - .description("testString") - .role(templateRoleModel) - .committed(true) - .build(); - assertEquals(replaceRoleTemplateOptionsModel.roleTemplateId(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.version(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.ifMatch(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.name(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.description(), "testString"); - assertEquals(replaceRoleTemplateOptionsModel.role(), templateRoleModel); - assertEquals(replaceRoleTemplateOptionsModel.committed(), Boolean.valueOf(true)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceRoleTemplateOptionsError() throws Throwable { - new ReplaceRoleTemplateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java deleted file mode 100644 index 23690eda780..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ReplaceV2PolicyOptionsTest.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Control; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ReplaceV2PolicyOptions; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 ReplaceV2PolicyOptions model. - */ -public class ReplaceV2PolicyOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testReplaceV2PolicyOptions() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - Grant grantModel = new Grant.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(grantModel.roles(), java.util.Arrays.asList(rolesModel)); - - Control controlModel = new Control.Builder() - .grant(grantModel) - .build(); - assertEquals(controlModel.grant(), grantModel); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - ReplaceV2PolicyOptions replaceV2PolicyOptionsModel = new ReplaceV2PolicyOptions.Builder() - .id("testString") - .ifMatch("testString") - .control(controlModel) - .type("access") - .description("testString") - .subject(v2PolicySubjectModel) - .resource(v2PolicyResourceModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .build(); - assertEquals(replaceV2PolicyOptionsModel.id(), "testString"); - assertEquals(replaceV2PolicyOptionsModel.ifMatch(), "testString"); - assertEquals(replaceV2PolicyOptionsModel.control(), controlModel); - assertEquals(replaceV2PolicyOptionsModel.type(), "access"); - assertEquals(replaceV2PolicyOptionsModel.description(), "testString"); - assertEquals(replaceV2PolicyOptionsModel.subject(), v2PolicySubjectModel); - assertEquals(replaceV2PolicyOptionsModel.resource(), v2PolicyResourceModel); - assertEquals(replaceV2PolicyOptionsModel.pattern(), "testString"); - assertEquals(replaceV2PolicyOptionsModel.rule(), v2PolicyRuleModel); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceV2PolicyOptionsError() throws Throwable { - new ReplaceV2PolicyOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java deleted file mode 100644 index bd50b514f43..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 ResourceAttribute model. - */ -public class ResourceAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testResourceAttribute() throws Throwable { - ResourceAttribute resourceAttributeModel = new ResourceAttribute.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceAttributeModel.name(), "testString"); - assertEquals(resourceAttributeModel.value(), "testString"); - assertEquals(resourceAttributeModel.operator(), "testString"); - - String json = TestUtilities.serialize(resourceAttributeModel); - - ResourceAttribute resourceAttributeModelNew = TestUtilities.deserialize(json, ResourceAttribute.class); - assertTrue(resourceAttributeModelNew instanceof ResourceAttribute); - assertEquals(resourceAttributeModelNew.name(), "testString"); - assertEquals(resourceAttributeModelNew.value(), "testString"); - assertEquals(resourceAttributeModelNew.operator(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testResourceAttributeError() throws Throwable { - new ResourceAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java deleted file mode 100644 index 88a1eb5d5b6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/ResourceTagTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.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 ResourceTag model. - */ -public class ResourceTagTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testResourceTag() throws Throwable { - ResourceTag resourceTagModel = new ResourceTag.Builder() - .name("testString") - .value("testString") - .operator("testString") - .build(); - assertEquals(resourceTagModel.name(), "testString"); - assertEquals(resourceTagModel.value(), "testString"); - assertEquals(resourceTagModel.operator(), "testString"); - - String json = TestUtilities.serialize(resourceTagModel); - - ResourceTag resourceTagModelNew = TestUtilities.deserialize(json, ResourceTag.class); - assertTrue(resourceTagModelNew instanceof ResourceTag); - assertEquals(resourceTagModelNew.name(), "testString"); - assertEquals(resourceTagModelNew.value(), "testString"); - assertEquals(resourceTagModelNew.operator(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testResourceTagError() throws Throwable { - new ResourceTag.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java deleted file mode 100644 index e4c0bcc6f92..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleActionTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAction; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAction model. - */ -public class RoleActionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAction() throws Throwable { - RoleAction roleActionModel = new RoleAction(); - assertNull(roleActionModel.getId()); - assertNull(roleActionModel.getDisplayName()); - assertNull(roleActionModel.getDescription()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java deleted file mode 100644 index 42801bc7771..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentCollectionTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentCollection model. - */ -public class RoleAssignmentCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentCollection() throws Throwable { - RoleAssignmentCollection roleAssignmentCollectionModel = new RoleAssignmentCollection(); - assertNull(roleAssignmentCollectionModel.getLimit()); - assertNull(roleAssignmentCollectionModel.getFirst()); - assertNull(roleAssignmentCollectionModel.getNext()); - assertNull(roleAssignmentCollectionModel.getPrevious()); - assertNull(roleAssignmentCollectionModel.getAssignments()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java deleted file mode 100644 index bef8b71b0fa..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceCreatedTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResourceCreated model. - */ -public class RoleAssignmentResourceCreatedTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentResourceCreated() throws Throwable { - RoleAssignmentResourceCreated roleAssignmentResourceCreatedModel = new RoleAssignmentResourceCreated(); - assertNull(roleAssignmentResourceCreatedModel.getId()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java deleted file mode 100644 index c346ca0f48f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceRoleTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResourceRole model. - */ -public class RoleAssignmentResourceRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentResourceRole() throws Throwable { - RoleAssignmentResourceRole roleAssignmentResourceRoleModel = new RoleAssignmentResourceRole(); - assertNull(roleAssignmentResourceRoleModel.getResourceCreated()); - assertNull(roleAssignmentResourceRoleModel.getErrorMessage()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java deleted file mode 100644 index 4fca1b25b5b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentResourceTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentResourceError; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ConflictsWith; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ErrorObject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceCreated; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentResourceRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentResource model. - */ -public class RoleAssignmentResourceTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentResource() throws Throwable { - RoleAssignmentResource roleAssignmentResourceModel = new RoleAssignmentResource(); - assertNull(roleAssignmentResourceModel.getTarget()); - assertNull(roleAssignmentResourceModel.getRole()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java deleted file mode 100644 index 4f2e3a37200..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTemplateTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignmentTemplate model. - */ -public class RoleAssignmentTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignmentTemplate() throws Throwable { - RoleAssignmentTemplate roleAssignmentTemplateModel = new RoleAssignmentTemplate.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(roleAssignmentTemplateModel.id(), "testString"); - assertEquals(roleAssignmentTemplateModel.version(), "testString"); - - String json = TestUtilities.serialize(roleAssignmentTemplateModel); - - RoleAssignmentTemplate roleAssignmentTemplateModelNew = TestUtilities.deserialize(json, RoleAssignmentTemplate.class); - assertTrue(roleAssignmentTemplateModelNew instanceof RoleAssignmentTemplate); - assertEquals(roleAssignmentTemplateModelNew.id(), "testString"); - assertEquals(roleAssignmentTemplateModelNew.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRoleAssignmentTemplateError() throws Throwable { - new RoleAssignmentTemplate.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java deleted file mode 100644 index bd3bda7ce24..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleAssignmentTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.AssignmentTargetDetails; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignment; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleAssignmentTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleAssignment model. - */ -public class RoleAssignmentTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleAssignment() throws Throwable { - RoleAssignment roleAssignmentModel = new RoleAssignment(); - assertNull(roleAssignmentModel.getTemplate()); - assertNull(roleAssignmentModel.getTarget()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java deleted file mode 100644 index 812c2dcb131..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleCollectionTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.CustomRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleCollection; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleCollection model. - */ -public class RoleCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleCollection() throws Throwable { - RoleCollection roleCollectionModel = new RoleCollection(); - assertNull(roleCollectionModel.getCustomRoles()); - assertNull(roleCollectionModel.getServiceRoles()); - assertNull(roleCollectionModel.getSystemRoles()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java deleted file mode 100644 index fde4d11ff4c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateCollectionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateCollection model. - */ -public class RoleTemplateCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplateCollection() throws Throwable { - RoleTemplateCollection roleTemplateCollectionModel = new RoleTemplateCollection(); - assertNull(roleTemplateCollectionModel.getLimit()); - assertNull(roleTemplateCollectionModel.getFirst()); - assertNull(roleTemplateCollectionModel.getNext()); - assertNull(roleTemplateCollectionModel.getPrevious()); - assertNull(roleTemplateCollectionModel.getRoleTemplates()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java deleted file mode 100644 index 6c208e1c38f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplatePrototypeRoleTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplatePrototypeRole model. - */ -public class RoleTemplatePrototypeRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplatePrototypeRole() throws Throwable { - RoleTemplatePrototypeRole roleTemplatePrototypeRoleModel = new RoleTemplatePrototypeRole.Builder() - .name("testString") - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(roleTemplatePrototypeRoleModel.name(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.displayName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.serviceName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.description(), "testString"); - assertEquals(roleTemplatePrototypeRoleModel.actions(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(roleTemplatePrototypeRoleModel); - - RoleTemplatePrototypeRole roleTemplatePrototypeRoleModelNew = TestUtilities.deserialize(json, RoleTemplatePrototypeRole.class); - assertTrue(roleTemplatePrototypeRoleModelNew instanceof RoleTemplatePrototypeRole); - assertEquals(roleTemplatePrototypeRoleModelNew.name(), "testString"); - assertEquals(roleTemplatePrototypeRoleModelNew.displayName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModelNew.serviceName(), "testString"); - assertEquals(roleTemplatePrototypeRoleModelNew.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRoleTemplatePrototypeRoleError() throws Throwable { - new RoleTemplatePrototypeRole.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java deleted file mode 100644 index af9de718e23..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateReferencesItemTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateReferencesItem model. - */ -public class RoleTemplateReferencesItemTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplateReferencesItem() throws Throwable { - RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(roleTemplateReferencesItemModel.id(), "testString"); - assertEquals(roleTemplateReferencesItemModel.version(), "testString"); - - String json = TestUtilities.serialize(roleTemplateReferencesItemModel); - - RoleTemplateReferencesItem roleTemplateReferencesItemModelNew = TestUtilities.deserialize(json, RoleTemplateReferencesItem.class); - assertTrue(roleTemplateReferencesItemModelNew instanceof RoleTemplateReferencesItem); - assertEquals(roleTemplateReferencesItemModelNew.id(), "testString"); - assertEquals(roleTemplateReferencesItemModelNew.version(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRoleTemplateReferencesItemError() throws Throwable { - new RoleTemplateReferencesItem.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java deleted file mode 100644 index 8bb27d8dd62..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplate model. - */ -public class RoleTemplateTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplate() throws Throwable { - RoleTemplate roleTemplateModel = new RoleTemplate(); - assertNull(roleTemplateModel.getName()); - assertNull(roleTemplateModel.getDescription()); - assertNull(roleTemplateModel.getAccountId()); - assertNull(roleTemplateModel.isCommitted()); - assertNull(roleTemplateModel.getRole()); - assertNull(roleTemplateModel.getVersion()); - assertNull(roleTemplateModel.getState()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java deleted file mode 100644 index 068cf309bd6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTemplateVersionsCollectionTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplate; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplatePrototypeRole; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateVersionsCollection; -import com.ibm.cloud.platform_services.iam_policy_management.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 RoleTemplateVersionsCollection model. - */ -public class RoleTemplateVersionsCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoleTemplateVersionsCollection() throws Throwable { - RoleTemplateVersionsCollection roleTemplateVersionsCollectionModel = new RoleTemplateVersionsCollection(); - assertNull(roleTemplateVersionsCollectionModel.getLimit()); - assertNull(roleTemplateVersionsCollectionModel.getFirst()); - assertNull(roleTemplateVersionsCollectionModel.getNext()); - assertNull(roleTemplateVersionsCollectionModel.getPrevious()); - assertNull(roleTemplateVersionsCollectionModel.getVersions()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java deleted file mode 100644 index a632e63587f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RoleTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Role; -import com.ibm.cloud.platform_services.iam_policy_management.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 Role model. - */ -public class RoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRole() throws Throwable { - Role roleModel = new Role.Builder() - .displayName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(roleModel.displayName(), "testString"); - assertEquals(roleModel.description(), "testString"); - assertEquals(roleModel.actions(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(roleModel); - - Role roleModelNew = TestUtilities.deserialize(json, Role.class); - assertTrue(roleModelNew instanceof Role); - assertEquals(roleModelNew.displayName(), "testString"); - assertEquals(roleModelNew.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRoleError() throws Throwable { - new Role.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java deleted file mode 100644 index 8383ef794a9..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RolesTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.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 Roles model. - */ -public class RolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRoles() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - String json = TestUtilities.serialize(rolesModel); - - Roles rolesModelNew = TestUtilities.deserialize(json, Roles.class); - assertTrue(rolesModelNew instanceof Roles); - assertEquals(rolesModelNew.roleId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRolesError() throws Throwable { - new Roles.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java deleted file mode 100644 index a05e5ee8704..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/RuleAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 RuleAttribute model. - */ -public class RuleAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRuleAttribute() throws Throwable { - RuleAttribute ruleAttributeModel = new RuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(ruleAttributeModel.key(), "testString"); - assertEquals(ruleAttributeModel.operator(), "stringEquals"); - assertEquals(ruleAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(ruleAttributeModel); - - RuleAttribute ruleAttributeModelNew = TestUtilities.deserialize(json, RuleAttribute.class); - assertTrue(ruleAttributeModelNew instanceof RuleAttribute); - assertEquals(ruleAttributeModelNew.key(), "testString"); - assertEquals(ruleAttributeModelNew.operator(), "stringEquals"); - assertEquals(ruleAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testRuleAttributeError() throws Throwable { - new RuleAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java deleted file mode 100644 index 7bae03a42e0..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/SubjectAttributeTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.SubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 SubjectAttribute model. - */ -public class SubjectAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testSubjectAttribute() throws Throwable { - SubjectAttribute subjectAttributeModel = new SubjectAttribute.Builder() - .name("testString") - .value("testString") - .build(); - assertEquals(subjectAttributeModel.name(), "testString"); - assertEquals(subjectAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(subjectAttributeModel); - - SubjectAttribute subjectAttributeModelNew = TestUtilities.deserialize(json, SubjectAttribute.class); - assertTrue(subjectAttributeModelNew instanceof SubjectAttribute); - assertEquals(subjectAttributeModelNew.name(), "testString"); - assertEquals(subjectAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testSubjectAttributeError() throws Throwable { - new SubjectAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java deleted file mode 100644 index d3a6d4ef53a..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateActionControlTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateActionControl; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateActionControl model. - */ -public class TemplateActionControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateActionControl() throws Throwable { - TemplateActionControl templateActionControlModel = new TemplateActionControl.Builder() - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateActionControlModel.serviceName(), "testString"); - assertEquals(templateActionControlModel.description(), "testString"); - assertEquals(templateActionControlModel.actions(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(templateActionControlModel); - - TemplateActionControl templateActionControlModelNew = TestUtilities.deserialize(json, TemplateActionControl.class); - assertTrue(templateActionControlModelNew instanceof TemplateActionControl); - assertEquals(templateActionControlModelNew.serviceName(), "testString"); - assertEquals(templateActionControlModelNew.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateActionControlError() throws Throwable { - new TemplateActionControl.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java deleted file mode 100644 index fba96e64cef..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateControlTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateControl model. - */ -public class TemplateControlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateControl() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - String json = TestUtilities.serialize(templateControlModel); - - TemplateControl templateControlModelNew = TestUtilities.deserialize(json, TemplateControl.class); - assertTrue(templateControlModelNew instanceof TemplateControl); - assertEquals(templateControlModelNew.grant().toString(), templateGrantModel.toString()); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateControlError() throws Throwable { - new TemplateControl.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java deleted file mode 100644 index b440cf19100..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateCountDataTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.LimitData; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateCountData; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateCountData model. - */ -public class TemplateCountDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateCountData() throws Throwable { - TemplateCountData templateCountDataModel = new TemplateCountData(); - assertNull(templateCountDataModel.getTemplate()); - assertNull(templateCountDataModel.getVersion()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java deleted file mode 100644 index e7759eacc21..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRoleReferencesTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.RoleTemplateReferencesItem; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoleReferences; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrantRoleReferences model. - */ -public class TemplateGrantRoleReferencesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateGrantRoleReferences() throws Throwable { - RoleTemplateReferencesItem roleTemplateReferencesItemModel = new RoleTemplateReferencesItem.Builder() - .id("testString") - .version("testString") - .build(); - assertEquals(roleTemplateReferencesItemModel.id(), "testString"); - assertEquals(roleTemplateReferencesItemModel.version(), "testString"); - - TemplateGrantRoleReferences templateGrantRoleReferencesModel = new TemplateGrantRoleReferences.Builder() - .roleTemplateReferences(java.util.Arrays.asList(roleTemplateReferencesItemModel)) - .build(); - assertEquals(templateGrantRoleReferencesModel.roleTemplateReferences(), java.util.Arrays.asList(roleTemplateReferencesItemModel)); - - String json = TestUtilities.serialize(templateGrantRoleReferencesModel); - - TemplateGrantRoleReferences templateGrantRoleReferencesModelNew = TestUtilities.deserialize(json, TemplateGrantRoleReferences.class); - assertTrue(templateGrantRoleReferencesModelNew instanceof TemplateGrantRoleReferences); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateGrantRoleReferencesError() throws Throwable { - new TemplateGrantRoleReferences.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java deleted file mode 100644 index 8cddc6f9a19..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantRolesTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrantRoles model. - */ -public class TemplateGrantRolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateGrantRoles() throws Throwable { - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantRolesModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantRolesModel.roles(), java.util.Arrays.asList(rolesModel)); - - String json = TestUtilities.serialize(templateGrantRolesModel); - - TemplateGrantRoles templateGrantRolesModelNew = TestUtilities.deserialize(json, TemplateGrantRoles.class); - assertTrue(templateGrantRolesModelNew instanceof TemplateGrantRoles); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateGrantRolesError() throws Throwable { - new TemplateGrantRoles.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java deleted file mode 100644 index 90e6fdc2b9f..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateGrantTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrant; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateGrant model. - */ -public class TemplateGrantTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testTemplateGrant() throws Throwable { - TemplateGrant templateGrantModel = new TemplateGrant(); - assertNotNull(templateGrantModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java deleted file mode 100644 index c2688232e2b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateMetadataTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateMetadata model. - */ -public class TemplateMetadataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateMetadata() throws Throwable { - TemplateMetadata templateMetadataModel = new TemplateMetadata(); - assertNull(templateMetadataModel.getId()); - assertNull(templateMetadataModel.getVersion()); - assertNull(templateMetadataModel.getAssignmentId()); - assertNull(templateMetadataModel.getRootId()); - assertNull(templateMetadataModel.getRootVersion()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java deleted file mode 100644 index 0e256ffd599..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplatePolicyTest.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateGrantRoles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplatePolicy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplatePolicy model. - */ -public class TemplatePolicyTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplatePolicy() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - V2PolicyRuleRuleAttribute v2PolicyRuleModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleModel.key(), "testString"); - assertEquals(v2PolicyRuleModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleModel.value(), "testString"); - - Roles rolesModel = new Roles.Builder() - .roleId("testString") - .build(); - assertEquals(rolesModel.roleId(), "testString"); - - TemplateGrantRoles templateGrantModel = new TemplateGrantRoles.Builder() - .roles(java.util.Arrays.asList(rolesModel)) - .build(); - assertEquals(templateGrantModel.roles(), java.util.Arrays.asList(rolesModel)); - - TemplateControl templateControlModel = new TemplateControl.Builder() - .grant(templateGrantModel) - .build(); - assertEquals(templateControlModel.grant(), templateGrantModel); - - TemplatePolicy templatePolicyModel = new TemplatePolicy.Builder() - .type("access") - .description("testString") - .resource(v2PolicyResourceModel) - .subject(v2PolicySubjectModel) - .pattern("testString") - .rule(v2PolicyRuleModel) - .control(templateControlModel) - .build(); - assertEquals(templatePolicyModel.type(), "access"); - assertEquals(templatePolicyModel.description(), "testString"); - assertEquals(templatePolicyModel.resource(), v2PolicyResourceModel); - assertEquals(templatePolicyModel.subject(), v2PolicySubjectModel); - assertEquals(templatePolicyModel.pattern(), "testString"); - assertEquals(templatePolicyModel.rule(), v2PolicyRuleModel); - assertEquals(templatePolicyModel.control(), templateControlModel); - - String json = TestUtilities.serialize(templatePolicyModel); - - TemplatePolicy templatePolicyModelNew = TestUtilities.deserialize(json, TemplatePolicy.class); - assertTrue(templatePolicyModelNew instanceof TemplatePolicy); - assertEquals(templatePolicyModelNew.type(), "access"); - assertEquals(templatePolicyModelNew.description(), "testString"); - assertEquals(templatePolicyModelNew.resource().toString(), v2PolicyResourceModel.toString()); - assertEquals(templatePolicyModelNew.subject().toString(), v2PolicySubjectModel.toString()); - assertEquals(templatePolicyModelNew.pattern(), "testString"); - assertEquals(templatePolicyModelNew.rule().toString(), v2PolicyRuleModel.toString()); - assertEquals(templatePolicyModelNew.control().toString(), templateControlModel.toString()); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplatePolicyError() throws Throwable { - new TemplatePolicy.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java deleted file mode 100644 index 1735364bc85..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/TemplateRoleTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateRole; -import com.ibm.cloud.platform_services.iam_policy_management.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 TemplateRole model. - */ -public class TemplateRoleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTemplateRole() throws Throwable { - TemplateRole templateRoleModel = new TemplateRole.Builder() - .displayName("testString") - .serviceName("testString") - .description("testString") - .actions(java.util.Arrays.asList("testString")) - .build(); - assertEquals(templateRoleModel.displayName(), "testString"); - assertEquals(templateRoleModel.serviceName(), "testString"); - assertEquals(templateRoleModel.description(), "testString"); - assertEquals(templateRoleModel.actions(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(templateRoleModel); - - TemplateRole templateRoleModelNew = TestUtilities.deserialize(json, TemplateRole.class); - assertTrue(templateRoleModelNew instanceof TemplateRole); - assertEquals(templateRoleModelNew.displayName(), "testString"); - assertEquals(templateRoleModelNew.serviceName(), "testString"); - assertEquals(templateRoleModelNew.description(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTemplateRoleError() throws Throwable { - new TemplateRole.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java deleted file mode 100644 index df7a09c2829..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateActionControlAssignmentOptionsTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateActionControlAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateActionControlAssignmentOptions model. - */ -public class UpdateActionControlAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdateActionControlAssignmentOptions() throws Throwable { - UpdateActionControlAssignmentOptions updateActionControlAssignmentOptionsModel = new UpdateActionControlAssignmentOptions.Builder() - .assignmentId("testString") - .ifMatch("testString") - .templateVersion("testString") - .build(); - assertEquals(updateActionControlAssignmentOptionsModel.assignmentId(), "testString"); - assertEquals(updateActionControlAssignmentOptionsModel.ifMatch(), "testString"); - assertEquals(updateActionControlAssignmentOptionsModel.templateVersion(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateActionControlAssignmentOptionsError() throws Throwable { - new UpdateActionControlAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java deleted file mode 100644 index 0008325ffcf..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyAssignmentOptionsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdatePolicyAssignmentOptions model. - */ -public class UpdatePolicyAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdatePolicyAssignmentOptions() throws Throwable { - UpdatePolicyAssignmentOptions updatePolicyAssignmentOptionsModel = new UpdatePolicyAssignmentOptions.Builder() - .assignmentId("testString") - .version("1.0") - .ifMatch("testString") - .templateVersion("testString") - .build(); - assertEquals(updatePolicyAssignmentOptionsModel.assignmentId(), "testString"); - assertEquals(updatePolicyAssignmentOptionsModel.version(), "1.0"); - assertEquals(updatePolicyAssignmentOptionsModel.ifMatch(), "testString"); - assertEquals(updatePolicyAssignmentOptionsModel.templateVersion(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdatePolicyAssignmentOptionsError() throws Throwable { - new UpdatePolicyAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java deleted file mode 100644 index de000e8c745..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdatePolicyStateOptionsTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdatePolicyStateOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdatePolicyStateOptions model. - */ -public class UpdatePolicyStateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdatePolicyStateOptions() throws Throwable { - UpdatePolicyStateOptions updatePolicyStateOptionsModel = new UpdatePolicyStateOptions.Builder() - .policyId("testString") - .ifMatch("testString") - .state("active") - .build(); - assertEquals(updatePolicyStateOptionsModel.policyId(), "testString"); - assertEquals(updatePolicyStateOptionsModel.ifMatch(), "testString"); - assertEquals(updatePolicyStateOptionsModel.state(), "active"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdatePolicyStateOptionsError() throws Throwable { - new UpdatePolicyStateOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java deleted file mode 100644 index 879c3d5f456..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateRoleAssignmentOptionsTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateRoleAssignmentOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateRoleAssignmentOptions model. - */ -public class UpdateRoleAssignmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdateRoleAssignmentOptions() throws Throwable { - UpdateRoleAssignmentOptions updateRoleAssignmentOptionsModel = new UpdateRoleAssignmentOptions.Builder() - .assignmentId("testString") - .ifMatch("testString") - .templateVersion("testString") - .build(); - assertEquals(updateRoleAssignmentOptionsModel.assignmentId(), "testString"); - assertEquals(updateRoleAssignmentOptionsModel.ifMatch(), "testString"); - assertEquals(updateRoleAssignmentOptionsModel.templateVersion(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateRoleAssignmentOptionsError() throws Throwable { - new UpdateRoleAssignmentOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java deleted file mode 100644 index 1d69d016781..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/UpdateSettingsOptionsTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ExternalAccountIdentityInteractionPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesBase; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.IdentityTypesPatch; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.UpdateSettingsOptions; -import com.ibm.cloud.platform_services.iam_policy_management.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 UpdateSettingsOptions model. - */ -public class UpdateSettingsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdateSettingsOptions() throws Throwable { - IdentityTypesBase identityTypesBaseModel = new IdentityTypesBase.Builder() - .state("enabled") - .externalAllowedAccounts(java.util.Arrays.asList("testString")) - .build(); - assertEquals(identityTypesBaseModel.state(), "enabled"); - assertEquals(identityTypesBaseModel.externalAllowedAccounts(), java.util.Arrays.asList("testString")); - - IdentityTypesPatch identityTypesPatchModel = new IdentityTypesPatch.Builder() - .user(identityTypesBaseModel) - .serviceId(identityTypesBaseModel) - .service(identityTypesBaseModel) - .build(); - assertEquals(identityTypesPatchModel.user(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.serviceId(), identityTypesBaseModel); - assertEquals(identityTypesPatchModel.service(), identityTypesBaseModel); - - ExternalAccountIdentityInteractionPatch externalAccountIdentityInteractionPatchModel = new ExternalAccountIdentityInteractionPatch.Builder() - .identityTypes(identityTypesPatchModel) - .build(); - assertEquals(externalAccountIdentityInteractionPatchModel.identityTypes(), identityTypesPatchModel); - - UpdateSettingsOptions updateSettingsOptionsModel = new UpdateSettingsOptions.Builder() - .accountId("testString") - .ifMatch("testString") - .externalAccountIdentityInteraction(externalAccountIdentityInteractionPatchModel) - .acceptLanguage("default") - .build(); - assertEquals(updateSettingsOptionsModel.accountId(), "testString"); - assertEquals(updateSettingsOptionsModel.ifMatch(), "testString"); - assertEquals(updateSettingsOptionsModel.externalAccountIdentityInteraction(), externalAccountIdentityInteractionPatchModel); - assertEquals(updateSettingsOptionsModel.acceptLanguage(), "default"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateSettingsOptionsError() throws Throwable { - new UpdateSettingsOptions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java deleted file mode 100644 index aff020c8985..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyCollectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.First; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Next; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Previous; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyCollection; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyCollection model. - */ -public class V2PolicyCollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyCollection() throws Throwable { - V2PolicyCollection v2PolicyCollectionModel = new V2PolicyCollection(); - assertNull(v2PolicyCollectionModel.getLimit()); - assertNull(v2PolicyCollectionModel.getFirst()); - assertNull(v2PolicyCollectionModel.getNext()); - assertNull(v2PolicyCollectionModel.getPrevious()); - assertNull(v2PolicyCollectionModel.getPolicies()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java deleted file mode 100644 index 407eaadb155..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResourceAttribute model. - */ -public class V2PolicyResourceAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyResourceAttribute() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(v2PolicyResourceAttributeModel); - - V2PolicyResourceAttribute v2PolicyResourceAttributeModelNew = TestUtilities.deserialize(json, V2PolicyResourceAttribute.class); - assertTrue(v2PolicyResourceAttributeModelNew instanceof V2PolicyResourceAttribute); - assertEquals(v2PolicyResourceAttributeModelNew.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModelNew.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyResourceAttributeError() throws Throwable { - new V2PolicyResourceAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java deleted file mode 100644 index 97c9c813216..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTagTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResourceTag model. - */ -public class V2PolicyResourceTagTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyResourceTag() throws Throwable { - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - String json = TestUtilities.serialize(v2PolicyResourceTagModel); - - V2PolicyResourceTag v2PolicyResourceTagModelNew = TestUtilities.deserialize(json, V2PolicyResourceTag.class); - assertTrue(v2PolicyResourceTagModelNew instanceof V2PolicyResourceTag); - assertEquals(v2PolicyResourceTagModelNew.key(), "testString"); - assertEquals(v2PolicyResourceTagModelNew.value(), "testString"); - assertEquals(v2PolicyResourceTagModelNew.operator(), "stringEquals"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyResourceTagError() throws Throwable { - new V2PolicyResourceTag.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java deleted file mode 100644 index d153fd97be6..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyResourceTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyResource model. - */ -public class V2PolicyResourceTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyResource() throws Throwable { - V2PolicyResourceAttribute v2PolicyResourceAttributeModel = new V2PolicyResourceAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyResourceAttributeModel.key(), "testString"); - assertEquals(v2PolicyResourceAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyResourceAttributeModel.value(), "testString"); - - V2PolicyResourceTag v2PolicyResourceTagModel = new V2PolicyResourceTag.Builder() - .key("testString") - .value("testString") - .operator("stringEquals") - .build(); - assertEquals(v2PolicyResourceTagModel.key(), "testString"); - assertEquals(v2PolicyResourceTagModel.value(), "testString"); - assertEquals(v2PolicyResourceTagModel.operator(), "stringEquals"); - - V2PolicyResource v2PolicyResourceModel = new V2PolicyResource.Builder() - .attributes(java.util.Arrays.asList(v2PolicyResourceAttributeModel)) - .tags(java.util.Arrays.asList(v2PolicyResourceTagModel)) - .build(); - assertEquals(v2PolicyResourceModel.attributes(), java.util.Arrays.asList(v2PolicyResourceAttributeModel)); - assertEquals(v2PolicyResourceModel.tags(), java.util.Arrays.asList(v2PolicyResourceTagModel)); - - String json = TestUtilities.serialize(v2PolicyResourceModel); - - V2PolicyResource v2PolicyResourceModelNew = TestUtilities.deserialize(json, V2PolicyResource.class); - assertTrue(v2PolicyResourceModelNew instanceof V2PolicyResource); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyResourceError() throws Throwable { - new V2PolicyResource.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java deleted file mode 100644 index 6d6da85f2b4..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRuleRuleAttribute model. - */ -public class V2PolicyRuleRuleAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyRuleRuleAttribute() throws Throwable { - V2PolicyRuleRuleAttribute v2PolicyRuleRuleAttributeModel = new V2PolicyRuleRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicyRuleRuleAttributeModel.key(), "testString"); - assertEquals(v2PolicyRuleRuleAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicyRuleRuleAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(v2PolicyRuleRuleAttributeModel); - - V2PolicyRuleRuleAttribute v2PolicyRuleRuleAttributeModelNew = TestUtilities.deserialize(json, V2PolicyRuleRuleAttribute.class); - assertTrue(v2PolicyRuleRuleAttributeModelNew instanceof V2PolicyRuleRuleAttribute); - assertEquals(v2PolicyRuleRuleAttributeModelNew.key(), "testString"); - assertEquals(v2PolicyRuleRuleAttributeModelNew.operator(), "stringEquals"); - assertEquals(v2PolicyRuleRuleAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyRuleRuleAttributeError() throws Throwable { - new V2PolicyRuleRuleAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java deleted file mode 100644 index fdf25669ef7..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleRuleWithNestedConditionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.NestedConditionRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleWithNestedConditions; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRuleRuleWithNestedConditions model. - */ -public class V2PolicyRuleRuleWithNestedConditionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyRuleRuleWithNestedConditions() throws Throwable { - NestedConditionRuleAttribute nestedConditionModel = new NestedConditionRuleAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(nestedConditionModel.key(), "testString"); - assertEquals(nestedConditionModel.operator(), "stringEquals"); - assertEquals(nestedConditionModel.value(), "testString"); - - V2PolicyRuleRuleWithNestedConditions v2PolicyRuleRuleWithNestedConditionsModel = new V2PolicyRuleRuleWithNestedConditions.Builder() - .operator("and") - .conditions(java.util.Arrays.asList(nestedConditionModel)) - .build(); - assertEquals(v2PolicyRuleRuleWithNestedConditionsModel.operator(), "and"); - assertEquals(v2PolicyRuleRuleWithNestedConditionsModel.conditions(), java.util.Arrays.asList(nestedConditionModel)); - - String json = TestUtilities.serialize(v2PolicyRuleRuleWithNestedConditionsModel); - - V2PolicyRuleRuleWithNestedConditions v2PolicyRuleRuleWithNestedConditionsModelNew = TestUtilities.deserialize(json, V2PolicyRuleRuleWithNestedConditions.class); - assertTrue(v2PolicyRuleRuleWithNestedConditionsModelNew instanceof V2PolicyRuleRuleWithNestedConditions); - assertEquals(v2PolicyRuleRuleWithNestedConditionsModelNew.operator(), "and"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicyRuleRuleWithNestedConditionsError() throws Throwable { - new V2PolicyRuleRuleWithNestedConditions.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java deleted file mode 100644 index e0af599840c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyRuleTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRule; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyRule model. - */ -public class V2PolicyRuleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testV2PolicyRule() throws Throwable { - V2PolicyRule v2PolicyRuleModel = new V2PolicyRule(); - assertNotNull(v2PolicyRuleModel); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java deleted file mode 100644 index a6e8f9d8922..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectAttributeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicySubjectAttribute model. - */ -public class V2PolicySubjectAttributeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicySubjectAttribute() throws Throwable { - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - String json = TestUtilities.serialize(v2PolicySubjectAttributeModel); - - V2PolicySubjectAttribute v2PolicySubjectAttributeModelNew = TestUtilities.deserialize(json, V2PolicySubjectAttribute.class); - assertTrue(v2PolicySubjectAttributeModelNew instanceof V2PolicySubjectAttribute); - assertEquals(v2PolicySubjectAttributeModelNew.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModelNew.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModelNew.value(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicySubjectAttributeError() throws Throwable { - new V2PolicySubjectAttribute.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java deleted file mode 100644 index 37adbaff5df..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicySubjectTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicySubject model. - */ -public class V2PolicySubjectTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicySubject() throws Throwable { - V2PolicySubjectAttribute v2PolicySubjectAttributeModel = new V2PolicySubjectAttribute.Builder() - .key("testString") - .operator("stringEquals") - .value("testString") - .build(); - assertEquals(v2PolicySubjectAttributeModel.key(), "testString"); - assertEquals(v2PolicySubjectAttributeModel.operator(), "stringEquals"); - assertEquals(v2PolicySubjectAttributeModel.value(), "testString"); - - V2PolicySubject v2PolicySubjectModel = new V2PolicySubject.Builder() - .attributes(java.util.Arrays.asList(v2PolicySubjectAttributeModel)) - .build(); - assertEquals(v2PolicySubjectModel.attributes(), java.util.Arrays.asList(v2PolicySubjectAttributeModel)); - - String json = TestUtilities.serialize(v2PolicySubjectModel); - - V2PolicySubject v2PolicySubjectModelNew = TestUtilities.deserialize(json, V2PolicySubject.class); - assertTrue(v2PolicySubjectModelNew instanceof V2PolicySubject); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testV2PolicySubjectError() throws Throwable { - new V2PolicySubject.Builder().build(); - } - -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java deleted file mode 100644 index 2ffbe45575b..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTemplateMetaDataTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.TemplateMetadata; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyTemplateMetaData; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2PolicyTemplateMetaData model. - */ -public class V2PolicyTemplateMetaDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2PolicyTemplateMetaData() throws Throwable { - V2PolicyTemplateMetaData v2PolicyTemplateMetaDataModel = new V2PolicyTemplateMetaData(); - assertNull(v2PolicyTemplateMetaDataModel.getType()); - assertNull(v2PolicyTemplateMetaDataModel.getDescription()); - assertNull(v2PolicyTemplateMetaDataModel.getSubject()); - assertNull(v2PolicyTemplateMetaDataModel.getResource()); - assertNull(v2PolicyTemplateMetaDataModel.getPattern()); - assertNull(v2PolicyTemplateMetaDataModel.getRule()); - assertNull(v2PolicyTemplateMetaDataModel.getControl()); - assertNull(v2PolicyTemplateMetaDataModel.getState()); - assertNull(v2PolicyTemplateMetaDataModel.getLastPermitAt()); - assertNull(v2PolicyTemplateMetaDataModel.getLastPermitFrequency()); - assertNull(v2PolicyTemplateMetaDataModel.getTemplate()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java deleted file mode 100644 index 1630201062c..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/model/V2PolicyTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (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_policy_management.v1.model; - -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.ControlResponseControl; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Grant; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.Roles; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2Policy; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResource; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyResourceTag; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicyRuleRuleAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubject; -import com.ibm.cloud.platform_services.iam_policy_management.v1.model.V2PolicySubjectAttribute; -import com.ibm.cloud.platform_services.iam_policy_management.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 V2Policy model. - */ -public class V2PolicyTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testV2Policy() throws Throwable { - V2Policy v2PolicyModel = new V2Policy(); - assertNull(v2PolicyModel.getType()); - assertNull(v2PolicyModel.getDescription()); - assertNull(v2PolicyModel.getSubject()); - assertNull(v2PolicyModel.getResource()); - assertNull(v2PolicyModel.getPattern()); - assertNull(v2PolicyModel.getRule()); - assertNull(v2PolicyModel.getControl()); - assertNull(v2PolicyModel.getState()); - assertNull(v2PolicyModel.getLastPermitAt()); - assertNull(v2PolicyModel.getLastPermitFrequency()); - } -} \ No newline at end of file diff --git a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java b/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java deleted file mode 100644 index 04aaecc16ae..00000000000 --- a/iam-policy-management/src/test/java/com/ibm/cloud/platform_services/iam_policy_management/v1/utils/TestUtilities.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * (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_policy_management.v1.utils; - -import java.util.Base64; -import java.util.Map; -import java.util.Set; -import java.util.List; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.io.InputStream; -import java.io.ByteArrayInputStream; - -import okhttp3.mockwebserver.RecordedRequest; -import okhttp3.HttpUrl; -import com.ibm.cloud.sdk.core.util.DateUtils; -import com.ibm.cloud.sdk.core.util.GsonSingleton; -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; - -/** - * A class used by the unit tests containing utility functions. - */ -public class TestUtilities { - public static Map createMockMap() { - Map mockMap = new HashMap<>(); - mockMap.put("foo", "bar"); - return mockMap; - } - - public static HashMap createMockStreamMap() { - return new HashMap() { - { put("key1", createMockStream("This is a mock file.")); } - }; - } - - public static Map parseQueryString(RecordedRequest req) { - Map queryMap = new HashMap<>(); - - try { - HttpUrl requestUrl = req.getRequestUrl(); - - if (requestUrl != null) { - Set queryParamsNames = requestUrl.queryParameterNames(); - // map the parameter name to its corresponding value - for (String p : queryParamsNames) { - // get the corresponding value for the parameter (p) - List val = requestUrl.queryParameterValues(p); - if (val != null && !val.isEmpty()) { - String joinedQuery = String.join(",", val); - queryMap.put(p, joinedQuery); - } - } - } - if (queryMap.isEmpty()) { - return null; - } - } catch (Exception e) { - return null; - } - - return queryMap; - } - - public static String parseReqPath(RecordedRequest req) { - String parsedPath = null; - - try { - String fullPath = req.getPath(); - if (fullPath != null && !fullPath.isEmpty()) { - // retrieve the path segment before the query parameter - parsedPath = fullPath.split("\\?", 2)[0]; - } - if (parsedPath.isEmpty() || parsedPath == null) { - return null; - } - - } catch (Exception e) { - return null; - } - - return parsedPath; - } - - public static String serialize(Object obj) { - return GsonSingleton.getGson().toJson(obj); - } - - public static T deserialize(String json, Class clazz) { - return GsonSingleton.getGson().fromJson(json, clazz); - } - - public static InputStream createMockStream(String s) { - return new ByteArrayInputStream(s.getBytes()); - } - - public static List creatMockListFileWithMetadata() { - List list = new ArrayList(); - byte[] fileBytes = {(byte) 0xde, (byte) 0xad, (byte) 0xbe, (byte) 0xef}; - InputStream inputStream = new ByteArrayInputStream(fileBytes); - FileWithMetadata.Builder builder = new FileWithMetadata.Builder(); - builder.data(inputStream); - FileWithMetadata fileWithMetadata = builder.build(); - list.add(fileWithMetadata); - - return list; - } - - public static byte[] createMockByteArray(String encodedString) throws Exception { - return Base64.getDecoder().decode(encodedString); - } - - public static Date createMockDate(String date) throws Exception { - return DateUtils.parseAsDate(date); - } - - public static Date createMockDateTime(String date) throws Exception { - return DateUtils.parseAsDateTime(date); - } -} \ No newline at end of file